Refactor location tracking.
R=kbr@chromium.org
Review URL: https://codereview.appspot.com/9078046
git-svn-id: https://angleproject.googlecode.com/svn/trunk@2202 736b8ea6-26fd-11df-bfd4-992fa37f6226
TRAC #23333
Authored-by: alokp@chromium.org
Signed-off-by: Shannon Woods
Signed-off-by Nicolas Capens
Merged-by: Jamie Madill
diff --git a/src/compiler/Common.h b/src/compiler/Common.h
index 27a5598..532486a 100644
--- a/src/compiler/Common.h
+++ b/src/compiler/Common.h
@@ -14,24 +14,12 @@
#include "compiler/PoolAlloc.h"
-// We need two pieces of information to report errors/warnings - string and
-// line number. We encode these into a single int so that it can be easily
-// incremented/decremented by lexer. The right SOURCE_LOC_LINE_SIZE bits store
-// line number while the rest store the string number. Since the shaders are
-// usually small, we should not run out of memory. SOURCE_LOC_LINE_SIZE
-// can be increased to alleviate this issue.
-typedef int TSourceLoc;
-const unsigned int SOURCE_LOC_LINE_SIZE = 16; // in bits.
-const unsigned int SOURCE_LOC_LINE_MASK = (1 << SOURCE_LOC_LINE_SIZE) - 1;
-
-inline TSourceLoc EncodeSourceLoc(int string, int line) {
- return (string << SOURCE_LOC_LINE_SIZE) | (line & SOURCE_LOC_LINE_MASK);
-}
-
-inline void DecodeSourceLoc(TSourceLoc loc, int* string, int* line) {
- if (string) *string = loc >> SOURCE_LOC_LINE_SIZE;
- if (line) *line = loc & SOURCE_LOC_LINE_MASK;
-}
+struct TSourceLoc {
+ int first_file;
+ int first_line;
+ int last_file;
+ int last_line;
+};
//
// Put POOL_ALLOCATOR_NEW_DELETE in base classes to make them use this scheme.