Adding support for #pragma include_alias in MS compatibility mode. This implements PR 10705.
llvm-svn: 151949
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index b08bcff..3825681 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -1274,6 +1274,7 @@
return;
}
+ StringRef OriginalFilename = Filename;
bool isAngled =
GetIncludeFilenameSpelling(FilenameTok.getLocation(), Filename);
// If GetIncludeFilenameSpelling set the start ptr to null, there was an
@@ -1304,6 +1305,15 @@
PragmaARCCFCodeAuditedLoc = SourceLocation();
}
+ if (HeaderInfo.HasIncludeAliasMap()) {
+ // Map the filename with the brackets still attached. If the name doesn't
+ // map to anything, fall back on the filename we've already gotten the
+ // spelling for.
+ StringRef NewName = HeaderInfo.MapHeaderToIncludeAlias(OriginalFilename);
+ if (!NewName.empty())
+ Filename = NewName;
+ }
+
// Search include directories.
const DirectoryLookup *CurDir;
SmallString<1024> SearchPath;