Author: Nikita Popov Date: 2024-01-23T12:16:14+01:00 New Revision: ea4d22f22568ccce7985032d150e79197694d38f
URL: https://github.com/llvm/llvm-project/commit/ea4d22f22568ccce7985032d150e79197694d38f DIFF: https://github.com/llvm/llvm-project/commit/ea4d22f22568ccce7985032d150e79197694d38f.diff LOG: [Lex] Avoid repeated calls to getIdentifierInfo() (NFC) We're calling it four times in the same function. Added: Modified: clang/include/clang/Lex/Preprocessor.h Removed: ################################################################################ diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h index fed3c1b7703837..2d9c53cdf5bde8 100644 --- a/clang/include/clang/Lex/Preprocessor.h +++ b/clang/include/clang/Lex/Preprocessor.h @@ -2829,17 +2829,18 @@ class Preprocessor { } void emitMacroExpansionWarnings(const Token &Identifier) const { - if (Identifier.getIdentifierInfo()->isDeprecatedMacro()) + IdentifierInfo *Info = Identifier.getIdentifierInfo(); + if (Info->isDeprecatedMacro()) emitMacroDeprecationWarning(Identifier); - if (Identifier.getIdentifierInfo()->isRestrictExpansion() && + if (Info->isRestrictExpansion() && !SourceMgr.isInMainFile(Identifier.getLocation())) emitRestrictExpansionWarning(Identifier); - if (Identifier.getIdentifierInfo()->getName() == "INFINITY") + if (Info->getName() == "INFINITY") if (getLangOpts().NoHonorInfs) emitRestrictInfNaNWarning(Identifier, 0); - if (Identifier.getIdentifierInfo()->getName() == "NAN") + if (Info->getName() == "NAN") if (getLangOpts().NoHonorNaNs) emitRestrictInfNaNWarning(Identifier, 1); } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits