summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/PrintPreprocessedOutput.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-12-07 01:42:56 +0000
committerChris Lattner <sabre@nondot.org>2009-12-07 01:42:56 +0000
commit76b4445d6fb524b90ec0a8628a42faf04376bf19 (patch)
treec4401a8efc34e18fa8d2ad07b64d4de30eba5dad /clang/lib/Frontend/PrintPreprocessedOutput.cpp
parentd62268a66859edf4a7170642a0bedfcdb11926c9 (diff)
downloadbcm5719-llvm-76b4445d6fb524b90ec0a8628a42faf04376bf19.tar.gz
bcm5719-llvm-76b4445d6fb524b90ec0a8628a42faf04376bf19.zip
some code cleanup.
llvm-svn: 90732
Diffstat (limited to 'clang/lib/Frontend/PrintPreprocessedOutput.cpp')
-rw-r--r--clang/lib/Frontend/PrintPreprocessedOutput.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/clang/lib/Frontend/PrintPreprocessedOutput.cpp
index ff8dfcd3c84..e0186abeb49 100644
--- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp
+++ b/clang/lib/Frontend/PrintPreprocessedOutput.cpp
@@ -94,6 +94,7 @@ private:
bool Initialized;
bool DisableLineMarkers;
bool DumpDefines;
+ bool UseLineDirective;
public:
PrintPPOutputPPCallbacks(Preprocessor &pp, llvm::raw_ostream &os,
bool lineMarkers, bool defines)
@@ -105,6 +106,9 @@ public:
EmittedMacroOnThisLine = false;
FileType = SrcMgr::C_User;
Initialized = false;
+
+ // If we're in microsoft mode, use normal #line instead of line markers.
+ UseLineDirective = PP.getLangOptions().Microsoft;
}
void SetEmittedTokensOnThisLine() { EmittedTokensOnThisLine = true; }
@@ -141,15 +145,16 @@ void PrintPPOutputPPCallbacks::WriteLineInfo(unsigned LineNo,
EmittedMacroOnThisLine = false;
}
- OS << '#';
- if (PP.getLangOptions().Microsoft)
- OS << "line";
- OS << ' ' << LineNo << ' ' << '"';
-
- OS.write(&CurFilename[0], CurFilename.size());
- OS << '"';
-
- if (!PP.getLangOptions().Microsoft) {
+ // Emit #line directives or GNU line markers depending on what mode we're in.
+ if (UseLineDirective) {
+ OS << "#line" << ' ' << LineNo << ' ' << '"';
+ OS.write(&CurFilename[0], CurFilename.size());
+ OS << '"';
+ } else {
+ OS << '#' << ' ' << LineNo << ' ' << '"';
+ OS.write(&CurFilename[0], CurFilename.size());
+ OS << '"';
+
if (ExtraLen)
OS.write(Extra, ExtraLen);
OpenPOWER on IntegriCloud