Index: include/clang/Basic/SourceManager.h =================================================================== --- include/clang/Basic/SourceManager.h +++ include/clang/Basic/SourceManager.h @@ -1453,7 +1453,11 @@ /// Returns whether \p Loc is expanded from a macro in a system header. bool isInSystemMacro(SourceLocation loc) const { - return loc.isMacroID() && isInSystemHeader(getSpellingLoc(loc)); + return loc.isMacroID() && + (isInSystemHeader(getSpellingLoc(loc)) || + // This happens when the macro is the result of a paste, in that case + // its spelling is the scratch memory, so we take the parent context. + isInSystemHeader(getSpellingLoc(getImmediateMacroCallerLoc(loc)))); } /// The size of the SLocEntry that \p FID represents.