Index: clang/lib/Lex/PPDirectives.cpp =================================================================== --- clang/lib/Lex/PPDirectives.cpp +++ clang/lib/Lex/PPDirectives.cpp @@ -164,6 +164,7 @@ "_THREAD_SAFE", "_XOPEN_SOURCE", "_XOPEN_SOURCE_EXTENDED", + "__GCC_HAVE_DWARF2_CFI_ASM", "__STDCPP_WANT_MATH_SPEC_FUNCS__", "__STDC_FORMAT_MACROS", }; @@ -352,8 +353,9 @@ SourceLocation MacroNameLoc = MacroNameTok.getLocation(); if (ShadowFlag) *ShadowFlag = false; - if (!SourceMgr.isInSystemHeader(MacroNameLoc) && - (SourceMgr.getBufferName(MacroNameLoc) != "")) { + PresumedLoc PL = SourceMgr.getPresumedLoc(MacroNameLoc); + if (!SourceMgr.isInSystemHeader(MacroNameLoc) && PL.isValid() && + strcmp(PL.getFilename(), "")) { MacroDiag D = MD_NoWarn; if (isDefineUndef == MU_Define) { D = shouldWarnOnMacroDef(*this, II);