diff options
-rw-r--r-- | clang/Lex/IdentifierTable.cpp | 1 | ||||
-rw-r--r-- | clang/Lex/MacroInfo.cpp | 7 | ||||
-rw-r--r-- | clang/Lex/Preprocessor.cpp | 14 | ||||
-rw-r--r-- | clang/include/clang/Lex/IdentifierTable.h | 7 | ||||
-rw-r--r-- | clang/include/clang/Lex/MacroInfo.h | 4 |
5 files changed, 3 insertions, 30 deletions
diff --git a/clang/Lex/IdentifierTable.cpp b/clang/Lex/IdentifierTable.cpp index 29f90edc2bd..f0272ea7950 100644 --- a/clang/Lex/IdentifierTable.cpp +++ b/clang/Lex/IdentifierTable.cpp @@ -209,7 +209,6 @@ IdentifierInfo &IdentifierTable::get(const char *NameStart, Identifier->TokInfo.TokenID = tok::identifier; Identifier->TokInfo.IsExtension = false; Identifier->TokInfo.IsPoisoned = false; - Identifier->TokInfo.IsMacroArg = false; Identifier->TokInfo.FETokenInfo = 0; // Copy the string information. diff --git a/clang/Lex/MacroInfo.cpp b/clang/Lex/MacroInfo.cpp index 8b3b87e42a6..6587fa7ec6a 100644 --- a/clang/Lex/MacroInfo.cpp +++ b/clang/Lex/MacroInfo.cpp @@ -26,13 +26,6 @@ MacroInfo::MacroInfo(SourceLocation DefLoc) : Location(DefLoc) { IsUsed = true; } -/// SetIdentifierIsMacroArgFlags - Set or clear the "isMacroArg" flags on the -/// identifiers that make up the argument list for this macro. -void MacroInfo::SetIdentifierIsMacroArgFlags(bool Val) const { - for (arg_iterator I = arg_begin(), E = arg_end(); I != E; ++I) - (*I)->setIsMacroArg(Val); -} - /// isIdenticalTo - Return true if the specified macro definition is equal to /// this macro in spelling, arguments, and whitespace. This is used to emit /// duplicate definition warnings. This implements the rules in C99 6.10.3. diff --git a/clang/Lex/Preprocessor.cpp b/clang/Lex/Preprocessor.cpp index 8002702638d..6f1c9cea388 100644 --- a/clang/Lex/Preprocessor.cpp +++ b/clang/Lex/Preprocessor.cpp @@ -1609,15 +1609,13 @@ bool Preprocessor::ReadMacroDefinitionArgList(MacroInfo *MI) { // If this is already used as an argument, it is used multiple times (e.g. // #define X(A,A. - if (II->isMacroArg()) { // C99 6.10.3p6 + if (MI->getArgumentNum(II) != -1) { // C99 6.10.3p6 Diag(Tok, diag::err_pp_duplicate_name_in_arg_list, II->getName()); return true; } // Add the argument to the macro info. MI->addArgument(II); - // Remember it is an argument now. - II->setIsMacroArg(true); // Lex the token after the identifier. LexUnexpandedToken(Tok); @@ -1677,8 +1675,6 @@ void Preprocessor::HandleDefineDirective(LexerToken &DefineTok) { // This is a function-like macro definition. Read the argument list. MI->setIsFunctionLike(); if (ReadMacroDefinitionArgList(MI)) { - // Clear the "isMacroArg" flags from all the macro arguments parsed. - MI->SetIdentifierIsMacroArgFlags(false); // Forget about MI. delete MI; // Throw away the rest of the line. @@ -1720,10 +1716,9 @@ void Preprocessor::HandleDefineDirective(LexerToken &DefineTok) { LexUnexpandedToken(Tok); // Not a macro arg identifier? - if (!Tok.getIdentifierInfo() || !Tok.getIdentifierInfo()->isMacroArg()) { + if (!Tok.getIdentifierInfo() || + MI->getArgumentNum(Tok.getIdentifierInfo()) == -1) { Diag(Tok, diag::err_pp_stringize_not_parameter); - // Clear the "isMacroArg" flags from all the macro arguments. - MI->SetIdentifierIsMacroArgFlags(false); delete MI; return; } @@ -1735,9 +1730,6 @@ void Preprocessor::HandleDefineDirective(LexerToken &DefineTok) { LexUnexpandedToken(Tok); } - // Clear the "isMacroArg" flags from all the macro arguments. - MI->SetIdentifierIsMacroArgFlags(false); - // Check that there is no paste (##) operator at the begining or end of the // replacement list. unsigned NumTokens = MI->getNumTokens(); diff --git a/clang/include/clang/Lex/IdentifierTable.h b/clang/include/clang/Lex/IdentifierTable.h index 9eecc14240d..c3a1a74b926 100644 --- a/clang/include/clang/Lex/IdentifierTable.h +++ b/clang/include/clang/Lex/IdentifierTable.h @@ -34,7 +34,6 @@ class IdentifierInfo { tok::TokenKind TokenID:8; // Front-end token ID or tok::identifier. bool IsExtension : 1; // True if this identifier is a language extension. bool IsPoisoned : 1; // True if this identifier is poisoned. - bool IsMacroArg : 1; // True if currently used as a macro argument. void *FETokenInfo; // Managed by the language front-end. friend class IdentifierTable; public: @@ -77,12 +76,6 @@ public: /// isPoisoned - Return true if this token has been poisoned. bool isPoisoned() const { return IsPoisoned; } - /// IsMacroArg accessors - These indicate if the identifier is currently in - /// use as a macro argument identifier. This is a transient property only - /// used during macro definition and expansion. - bool isMacroArg() const { return IsMacroArg; } - void setIsMacroArg(bool Val) { IsMacroArg = Val; } - /// getFETokenInfo/setFETokenInfo - The language front-end is allowed to /// associate arbitrary metadata with this token. template<typename T> diff --git a/clang/include/clang/Lex/MacroInfo.h b/clang/include/clang/Lex/MacroInfo.h index e537b74eda3..c12e064abbb 100644 --- a/clang/include/clang/Lex/MacroInfo.h +++ b/clang/include/clang/Lex/MacroInfo.h @@ -169,10 +169,6 @@ public: assert(!IsDisabled && "Cannot disable an already-disabled macro!"); IsDisabled = true; } - - /// SetIdentifierIsMacroArgFlags - Set or clear the "isMacroArg" flags on the - /// identifiers that make up the argument list for this macro. - void SetIdentifierIsMacroArgFlags(bool Val) const; }; } // end namespace llvm |