From 02fef3f84a9737180922e962e68f38a38f1c7d16 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Thu, 13 Nov 2014 09:02:43 +0100 Subject: [PATCH] Remove unions from the DebugInfo class --- lib/base/debuginfo.hpp | 26 ++++---------------------- lib/config/config_lexer.ll | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/lib/base/debuginfo.hpp b/lib/base/debuginfo.hpp index 43829ec2e..316dc8286 100644 --- a/lib/base/debuginfo.hpp +++ b/lib/base/debuginfo.hpp @@ -36,29 +36,11 @@ struct DebugInfo { String Path; - union - { - int FirstLine; - int first_line; - }; + int FirstLine; + int FirstColumn; - union - { - int FirstColumn; - int first_column; - }; - - union - { - int LastLine; - int last_line; - }; - - union - { - int LastColumn; - int last_column; - }; + int LastLine; + int LastColumn; }; I2_BASE_API std::ostream& operator<<(std::ostream& out, const DebugInfo& val); diff --git a/lib/config/config_lexer.ll b/lib/config/config_lexer.ll index 90f03577b..81777bff8 100644 --- a/lib/config/config_lexer.ll +++ b/lib/config/config_lexer.ll @@ -41,6 +41,21 @@ do { \ yycolumn += yyleng; \ } while (0); +#define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } else { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC(Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC(Rhs, 0).last_column; \ + } \ + while (YYID(0)) + #define YY_INPUT(buf, result, max_size) \ do { \ result = yyextra->ReadInput(buf, max_size); \ -- 2.50.0