Eliminate the IdentifierInfo::IsMacroArg flag.

llvm-svn: 38715
This commit is contained in:
Chris Lattner 2006-07-15 06:55:18 +00:00
parent 6ae37dfba3
commit c653246bfb
5 changed files with 3 additions and 30 deletions

View File

@ -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.

View File

@ -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.

View File

@ -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();

View File

@ -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>

View File

@ -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