summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAbramo Bagnara <abramo.bagnara@gmail.com>2012-03-31 20:17:27 +0000
committerAbramo Bagnara <abramo.bagnara@gmail.com>2012-03-31 20:17:27 +0000
commitc9e48c0a3f21f0da42768d52096c61d0b6f5c396 (patch)
treecb44e8ef328886590c684acff8a602921ede72c7
parent77242fa79e0ef9e9313b0048d95e5d36081eccc1 (diff)
downloadbcm5719-llvm-c9e48c0a3f21f0da42768d52096c61d0b6f5c396.tar.gz
bcm5719-llvm-c9e48c0a3f21f0da42768d52096c61d0b6f5c396.zip
Fixed MacroInfo definition range for function like macros with empty body.
llvm-svn: 153819
-rw-r--r--clang/include/clang/Lex/Preprocessor.h7
-rw-r--r--clang/lib/Lex/PPDirectives.cpp5
2 files changed, 6 insertions, 6 deletions
diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h
index fa9c417af54..591a4498eb8 100644
--- a/clang/include/clang/Lex/Preprocessor.h
+++ b/clang/include/clang/Lex/Preprocessor.h
@@ -1120,9 +1120,10 @@ private:
/// ReadMacroDefinitionArgList - The ( starting an argument list of a macro
/// definition has just been read. Lex the rest of the arguments and the
- /// closing ), updating MI with what we learn. Return true if an error occurs
- /// parsing the arg list.
- bool ReadMacroDefinitionArgList(MacroInfo *MI);
+ /// closing ), updating MI with what we learn and saving in LastTok the
+ /// last token read.
+ /// Return true if an error occurs parsing the arg list.
+ bool ReadMacroDefinitionArgList(MacroInfo *MI, Token& LastTok);
/// SkipExcludedConditionalBlock - We just read a #if or related directive and
/// decided that the subsequent tokens are in the #if'd out portion of the
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index aa3d1bf66df..625a204af99 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -1549,10 +1549,9 @@ void Preprocessor::HandleIncludeMacrosDirective(SourceLocation HashLoc,
/// definition has just been read. Lex the rest of the arguments and the
/// closing ), updating MI with what we learn. Return true if an error occurs
/// parsing the arg list.
-bool Preprocessor::ReadMacroDefinitionArgList(MacroInfo *MI) {
+bool Preprocessor::ReadMacroDefinitionArgList(MacroInfo *MI, Token &Tok) {
SmallVector<IdentifierInfo*, 32> Arguments;
- Token Tok;
while (1) {
LexUnexpandedToken(Tok);
switch (Tok.getKind()) {
@@ -1671,7 +1670,7 @@ void Preprocessor::HandleDefineDirective(Token &DefineTok) {
} else if (Tok.is(tok::l_paren)) {
// This is a function-like macro definition. Read the argument list.
MI->setIsFunctionLike();
- if (ReadMacroDefinitionArgList(MI)) {
+ if (ReadMacroDefinitionArgList(MI, LastTok)) {
// Forget about MI.
ReleaseMacroInfo(MI);
// Throw away the rest of the line.
OpenPOWER on IntegriCloud