Skip to content

Commit ea4d22f

Browse files
committed
[Lex] Avoid repeated calls to getIdentifierInfo() (NFC)
We're calling it four times in the same function.
1 parent 96adf69 commit ea4d22f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

clang/include/clang/Lex/Preprocessor.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2829,17 +2829,18 @@ class Preprocessor {
28292829
}
28302830

28312831
void emitMacroExpansionWarnings(const Token &Identifier) const {
2832-
if (Identifier.getIdentifierInfo()->isDeprecatedMacro())
2832+
IdentifierInfo *Info = Identifier.getIdentifierInfo();
2833+
if (Info->isDeprecatedMacro())
28332834
emitMacroDeprecationWarning(Identifier);
28342835

2835-
if (Identifier.getIdentifierInfo()->isRestrictExpansion() &&
2836+
if (Info->isRestrictExpansion() &&
28362837
!SourceMgr.isInMainFile(Identifier.getLocation()))
28372838
emitRestrictExpansionWarning(Identifier);
28382839

2839-
if (Identifier.getIdentifierInfo()->getName() == "INFINITY")
2840+
if (Info->getName() == "INFINITY")
28402841
if (getLangOpts().NoHonorInfs)
28412842
emitRestrictInfNaNWarning(Identifier, 0);
2842-
if (Identifier.getIdentifierInfo()->getName() == "NAN")
2843+
if (Info->getName() == "NAN")
28432844
if (getLangOpts().NoHonorNaNs)
28442845
emitRestrictInfNaNWarning(Identifier, 1);
28452846
}

0 commit comments

Comments
 (0)