diff options
| author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-04-27 05:04:02 +0000 |
|---|---|---|
| committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-04-27 05:04:02 +0000 |
| commit | f7620e4d4913c4cae8a956593f1509aa40edc02f (patch) | |
| tree | 314695e456245908e1d0e04e9d4a8e0fcdf3a924 /clang/lib/Lex | |
| parent | 8b02cd0beae6e38273afb9d339489f6bb59b8bde (diff) | |
| download | bcm5719-llvm-f7620e4d4913c4cae8a956593f1509aa40edc02f.tar.gz bcm5719-llvm-f7620e4d4913c4cae8a956593f1509aa40edc02f.zip | |
If a null statement was preceded by an empty macro keep its instantiation source location
in NullStmt.
llvm-svn: 130289
Diffstat (limited to 'clang/lib/Lex')
| -rw-r--r-- | clang/lib/Lex/PPMacroExpansion.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp index 29f9cd6e323..32b2188af58 100644 --- a/clang/lib/Lex/PPMacroExpansion.cpp +++ b/clang/lib/Lex/PPMacroExpansion.cpp @@ -227,6 +227,9 @@ bool Preprocessor::HandleMacroExpandedIdentifier(Token &Identifier, // If we started lexing a macro, enter the macro expansion body. + // Remember where the token is instantiated. + SourceLocation InstantiateLoc = Identifier.getLocation(); + // If this macro expands to no tokens, don't bother to push it onto the // expansion stack, only to take it right back off. if (MI->getNumTokens() == 0) { @@ -249,6 +252,7 @@ bool Preprocessor::HandleMacroExpandedIdentifier(Token &Identifier, if (HadLeadingSpace) Identifier.setFlag(Token::LeadingSpace); } Identifier.setFlag(Token::LeadingEmptyMacro); + LastEmptyMacroInstantiationLoc = InstantiateLoc; ++NumFastMacroExpanded; return false; @@ -267,9 +271,6 @@ bool Preprocessor::HandleMacroExpandedIdentifier(Token &Identifier, bool isAtStartOfLine = Identifier.isAtStartOfLine(); bool hasLeadingSpace = Identifier.hasLeadingSpace(); - // Remember where the token is instantiated. - SourceLocation InstantiateLoc = Identifier.getLocation(); - // Replace the result token. Identifier = MI->getReplacementToken(0); |

