aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend
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
commit43bb45d152b14e186689e159ac9be2e27787d5ac (patch)
treea85f4b670b70e0ff7b400af6a1ace55b75294c2b /lib/Frontend
parent23d5b090cb11078714139bdb5a30d814e3443c4c (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173657 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend')
-rw-r--r--lib/Frontend/PrintPreprocessedOutput.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Frontend/PrintPreprocessedOutput.cpp b/lib/Frontend/PrintPreprocessedOutput.cpp
index cc8d935b52..e7b64973ad 100644
--- a/lib/Frontend/PrintPreprocessedOutput.cpp
+++ b/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);