https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/141483
isInPredefinedFile() will look at the presumed loc, which is comparatively slow. Move it after isInSystemFile(). http://llvm-compile-time-tracker.com/compare.php?from=843e362318e884991e517a54446b4faeacdad789&to=de0421a1a38052042721a67a6094f5cb38431f26&stat=instructions:u >From fc2a7157b912b4eff6e9921b797b01792506a72c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbae...@redhat.com> Date: Mon, 26 May 2025 14:05:24 +0200 Subject: [PATCH] [clang][Lex][NFC] Reorder SrcMgr checks in CheckMacroName isInPredefinedFile() will look at the presumed loc, which is comparatively slow. Move it after isInSystemFile(). --- clang/lib/Lex/PPDirectives.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index b2a8459d6b9cc..12688f0939a26 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -373,8 +373,8 @@ bool Preprocessor::CheckMacroName(Token &MacroNameTok, MacroUse isDefineUndef, // Macro names with reserved identifiers are accepted if built-in or passed // through the command line (the later may be present if -dD was used to // generate the preprocessed file). - if (!SourceMgr.isInPredefinedFile(MacroNameLoc) && - !SourceMgr.isInSystemHeader(MacroNameLoc)) { + if (!SourceMgr.isInSystemHeader(MacroNameLoc) && + !SourceMgr.isInPredefinedFile(MacroNameLoc)) { MacroDiag D = MD_NoWarn; if (isDefineUndef == MU_Define) { D = shouldWarnOnMacroDef(*this, II); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits