summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/PrintPreprocessedOutput.cpp
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2013-01-28 04:37:37 +0000
committerHal Finkel <hfinkel@anl.gov>2013-01-28 04:37:37 +0000
commit2109f23000133dcf82ae835a17896365fc62045a (patch)
treee7a96a5a52e52c18ee130f58eb3c218c3def8f13 /clang/lib/Frontend/PrintPreprocessedOutput.cpp
parent55ec92004f9a56bbff330b649b4cb2e72b59cd59 (diff)
downloadbcm5719-llvm-2109f23000133dcf82ae835a17896365fc62045a.tar.gz
bcm5719-llvm-2109f23000133dcf82ae835a17896365fc62045a.zip
Fix the indentation of the first line of preprocessor output
The -E output from clang did not produce the correct indentation on the first line. This is because MoveToLine returned false, and when this happens, the regular process for producing initial indentation is skipped. Thanks to Eli for suggesting a way to simplify this to a one-line change. llvm-svn: 173657
Diffstat (limited to 'clang/lib/Frontend/PrintPreprocessedOutput.cpp')
-rw-r--r--clang/lib/Frontend/PrintPreprocessedOutput.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/clang/lib/Frontend/PrintPreprocessedOutput.cpp
index cc8d935b52f..e7b64973ad5 100644
--- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp
+++ b/clang/lib/Frontend/PrintPreprocessedOutput.cpp
@@ -139,11 +139,15 @@ public:
diag::Mapping Map, StringRef Str);
bool HandleFirstTokOnLine(Token &Tok);
+
+ /// Move to the line of the provided source location. This will
+ /// return true if the output stream required adjustment or if
+ /// the requested location is on the first line.
bool MoveToLine(SourceLocation Loc) {
PresumedLoc PLoc = SM.getPresumedLoc(Loc);
if (PLoc.isInvalid())
return false;
- return MoveToLine(PLoc.getLine());
+ return MoveToLine(PLoc.getLine()) || (PLoc.getLine() == 1);
}
bool MoveToLine(unsigned LineNo);
OpenPOWER on IntegriCloud