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/InfoSink.cpp b/src/compiler/InfoSink.cpp
index ba32f78..d20a6c0 100644
--- a/src/compiler/InfoSink.cpp
+++ b/src/compiler/InfoSink.cpp
@@ -6,8 +6,8 @@
#include "compiler/InfoSink.h"
-void TInfoSinkBase::prefix(TPrefixType message) {
- switch(message) {
+void TInfoSinkBase::prefix(TPrefixType p) {
+ switch(p) {
case EPrefixNone:
break;
case EPrefixWarning:
@@ -31,29 +31,24 @@
}
}
-void TInfoSinkBase::location(TSourceLoc loc) {
- int string = 0, line = 0;
- DecodeSourceLoc(loc, &string, &line);
-
+void TInfoSinkBase::location(int file, int line) {
TPersistStringStream stream;
if (line)
- stream << string << ":" << line;
+ stream << file << ":" << line;
else
- stream << string << ":? ";
+ stream << file << ":? ";
stream << ": ";
sink.append(stream.str());
}
-void TInfoSinkBase::message(TPrefixType message, const char* s) {
- prefix(message);
- sink.append(s);
- sink.append("\n");
+void TInfoSinkBase::location(const TSourceLoc& loc) {
+ location(loc.first_file, loc.first_line);
}
-void TInfoSinkBase::message(TPrefixType message, const char* s, TSourceLoc loc) {
- prefix(message);
+void TInfoSinkBase::message(TPrefixType p, const TSourceLoc& loc, const char* m) {
+ prefix(p);
location(loc);
- sink.append(s);
+ sink.append(m);
sink.append("\n");
}