forked from OSchip/llvm-project
Eliminate the IdentifierInfo::IsMacroArg flag.
llvm-svn: 38715
This commit is contained in:
parent
6ae37dfba3
commit
c653246bfb
|
@ -209,7 +209,6 @@ IdentifierInfo &IdentifierTable::get(const char *NameStart,
|
||||||
Identifier->TokInfo.TokenID = tok::identifier;
|
Identifier->TokInfo.TokenID = tok::identifier;
|
||||||
Identifier->TokInfo.IsExtension = false;
|
Identifier->TokInfo.IsExtension = false;
|
||||||
Identifier->TokInfo.IsPoisoned = false;
|
Identifier->TokInfo.IsPoisoned = false;
|
||||||
Identifier->TokInfo.IsMacroArg = false;
|
|
||||||
Identifier->TokInfo.FETokenInfo = 0;
|
Identifier->TokInfo.FETokenInfo = 0;
|
||||||
|
|
||||||
// Copy the string information.
|
// Copy the string information.
|
||||||
|
|
|
@ -26,13 +26,6 @@ MacroInfo::MacroInfo(SourceLocation DefLoc) : Location(DefLoc) {
|
||||||
IsUsed = true;
|
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
|
/// isIdenticalTo - Return true if the specified macro definition is equal to
|
||||||
/// this macro in spelling, arguments, and whitespace. This is used to emit
|
/// this macro in spelling, arguments, and whitespace. This is used to emit
|
||||||
/// duplicate definition warnings. This implements the rules in C99 6.10.3.
|
/// duplicate definition warnings. This implements the rules in C99 6.10.3.
|
||||||
|
|
|
@ -1609,15 +1609,13 @@ bool Preprocessor::ReadMacroDefinitionArgList(MacroInfo *MI) {
|
||||||
|
|
||||||
// If this is already used as an argument, it is used multiple times (e.g.
|
// If this is already used as an argument, it is used multiple times (e.g.
|
||||||
// #define X(A,A.
|
// #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());
|
Diag(Tok, diag::err_pp_duplicate_name_in_arg_list, II->getName());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the argument to the macro info.
|
// Add the argument to the macro info.
|
||||||
MI->addArgument(II);
|
MI->addArgument(II);
|
||||||
// Remember it is an argument now.
|
|
||||||
II->setIsMacroArg(true);
|
|
||||||
|
|
||||||
// Lex the token after the identifier.
|
// Lex the token after the identifier.
|
||||||
LexUnexpandedToken(Tok);
|
LexUnexpandedToken(Tok);
|
||||||
|
@ -1677,8 +1675,6 @@ void Preprocessor::HandleDefineDirective(LexerToken &DefineTok) {
|
||||||
// This is a function-like macro definition. Read the argument list.
|
// This is a function-like macro definition. Read the argument list.
|
||||||
MI->setIsFunctionLike();
|
MI->setIsFunctionLike();
|
||||||
if (ReadMacroDefinitionArgList(MI)) {
|
if (ReadMacroDefinitionArgList(MI)) {
|
||||||
// Clear the "isMacroArg" flags from all the macro arguments parsed.
|
|
||||||
MI->SetIdentifierIsMacroArgFlags(false);
|
|
||||||
// Forget about MI.
|
// Forget about MI.
|
||||||
delete MI;
|
delete MI;
|
||||||
// Throw away the rest of the line.
|
// Throw away the rest of the line.
|
||||||
|
@ -1720,10 +1716,9 @@ void Preprocessor::HandleDefineDirective(LexerToken &DefineTok) {
|
||||||
LexUnexpandedToken(Tok);
|
LexUnexpandedToken(Tok);
|
||||||
|
|
||||||
// Not a macro arg identifier?
|
// 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);
|
Diag(Tok, diag::err_pp_stringize_not_parameter);
|
||||||
// Clear the "isMacroArg" flags from all the macro arguments.
|
|
||||||
MI->SetIdentifierIsMacroArgFlags(false);
|
|
||||||
delete MI;
|
delete MI;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1735,9 +1730,6 @@ void Preprocessor::HandleDefineDirective(LexerToken &DefineTok) {
|
||||||
LexUnexpandedToken(Tok);
|
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
|
// Check that there is no paste (##) operator at the begining or end of the
|
||||||
// replacement list.
|
// replacement list.
|
||||||
unsigned NumTokens = MI->getNumTokens();
|
unsigned NumTokens = MI->getNumTokens();
|
||||||
|
|
|
@ -34,7 +34,6 @@ class IdentifierInfo {
|
||||||
tok::TokenKind TokenID:8; // Front-end token ID or tok::identifier.
|
tok::TokenKind TokenID:8; // Front-end token ID or tok::identifier.
|
||||||
bool IsExtension : 1; // True if this identifier is a language extension.
|
bool IsExtension : 1; // True if this identifier is a language extension.
|
||||||
bool IsPoisoned : 1; // True if this identifier is poisoned.
|
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.
|
void *FETokenInfo; // Managed by the language front-end.
|
||||||
friend class IdentifierTable;
|
friend class IdentifierTable;
|
||||||
public:
|
public:
|
||||||
|
@ -77,12 +76,6 @@ public:
|
||||||
/// isPoisoned - Return true if this token has been poisoned.
|
/// isPoisoned - Return true if this token has been poisoned.
|
||||||
bool isPoisoned() const { return IsPoisoned; }
|
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
|
/// getFETokenInfo/setFETokenInfo - The language front-end is allowed to
|
||||||
/// associate arbitrary metadata with this token.
|
/// associate arbitrary metadata with this token.
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|
|
@ -169,10 +169,6 @@ public:
|
||||||
assert(!IsDisabled && "Cannot disable an already-disabled macro!");
|
assert(!IsDisabled && "Cannot disable an already-disabled macro!");
|
||||||
IsDisabled = true;
|
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
|
} // end namespace llvm
|
||||||
|
|
Loading…
Reference in New Issue