Juan Manuel Martinez =?utf-8?q?Caamaño?= <juama...@amd.com> Message-ID: In-Reply-To: <llvm.org/llvm/llvm-project/pull/137...@github.com>
================ @@ -371,8 +371,12 @@ bool Preprocessor::CheckMacroName(Token &MacroNameTok, MacroUse isDefineUndef, SourceLocation MacroNameLoc = MacroNameTok.getLocation(); if (ShadowFlag) *ShadowFlag = false; - if (!SourceMgr.isInSystemHeader(MacroNameLoc) && - (SourceMgr.getBufferName(MacroNameLoc) != "<built-in>")) { + // 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). + bool IsBuiltinOrCmd = SourceMgr.isWrittenInBuiltinFile(MacroNameLoc) || + SourceMgr.isWrittenInCommandLineFile(MacroNameLoc); ---------------- nikic wrote: Can at least combine these to avoid the duplicate getPresumedLoc(), but possibly these can be more efficient in general? E.g. isInSystemHeader has a much more optimized implementation. https://github.com/llvm/llvm-project/pull/137306 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits