diff options
author | Manuel Klimek <klimek@google.com> | 2013-01-05 22:14:16 +0000 |
---|---|---|
committer | Manuel Klimek <klimek@google.com> | 2013-01-05 22:14:16 +0000 |
commit | c37b4d60f926bf440dfcc312bd6482fed3176e33 (patch) | |
tree | c1dd06f2f3ef4c91bb88df9d9418b11d93d03185 /lib/Format/UnwrappedLineParser.cpp | |
parent | 9ef1518fb0e7ab7586655265de5f69c9310bc2e6 (diff) |
Fixes PR14801 - preprocessor directives shouldn't be indented
Uses indent 0 for macros for now and resets the indent state to the
level prior to the preprocessor directive.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171639 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/UnwrappedLineParser.cpp')
-rw-r--r-- | lib/Format/UnwrappedLineParser.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp index c1bafa9a3b..2f3a6034bc 100644 --- a/lib/Format/UnwrappedLineParser.cpp +++ b/lib/Format/UnwrappedLineParser.cpp @@ -27,10 +27,11 @@ public: ScopedMacroState(UnwrappedLine &Line, FormatTokenSource *&TokenSource, FormatToken &ResetToken) : Line(Line), TokenSource(TokenSource), ResetToken(ResetToken), - PreviousTokenSource(TokenSource) { + PreviousLineLevel(Line.Level), PreviousTokenSource(TokenSource) { TokenSource = this; // FIXME: Back up all other state (errors, line indent, etc) and reset after // parsing the macro. + Line.Level = 0; Line.InPPDirective = true; } @@ -38,7 +39,7 @@ public: TokenSource = PreviousTokenSource; ResetToken = Token; Line.InPPDirective = false; - Line.Level = 0; // FIXME: Test + this is obviously incorrect + Line.Level = PreviousLineLevel; } virtual FormatToken getNextToken() { @@ -65,7 +66,7 @@ private: UnwrappedLine &Line; FormatTokenSource *&TokenSource; FormatToken &ResetToken; - + unsigned PreviousLineLevel; FormatTokenSource *PreviousTokenSource; FormatToken Token; |