summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PPDirectives.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2012-03-02 22:51:54 +0000
committerAaron Ballman <aaron@aaronballman.com>2012-03-02 22:51:54 +0000
commit611306eae6c901916443b528b4fe789fd1574a90 (patch)
tree5b7d409d7ac2f88e1614ea499fbe910e2c72b7ab /clang/lib/Lex/PPDirectives.cpp
parentba3c8df4d9e9c11937d2c7623ec37a440f5429cb (diff)
downloadbcm5719-llvm-611306eae6c901916443b528b4fe789fd1574a90.tar.gz
bcm5719-llvm-611306eae6c901916443b528b4fe789fd1574a90.zip
Adding support for #pragma include_alias in MS compatibility mode. This implements PR 10705.
llvm-svn: 151949
Diffstat (limited to 'clang/lib/Lex/PPDirectives.cpp')
-rw-r--r--clang/lib/Lex/PPDirectives.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index b08bcffd202..38256815ef9 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -1274,6 +1274,7 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc,
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 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc,
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;
OpenPOWER on IntegriCloud