diff options
author | Manuel Klimek <klimek@google.com> | 2014-08-12 08:25:57 +0000 |
---|---|---|
committer | Manuel Klimek <klimek@google.com> | 2014-08-12 08:25:57 +0000 |
commit | 9af34aeac196631c4743f872dfd8eeaf211e0086 (patch) | |
tree | 0c24728e1eaf5074a04653bd3fefc2df6cafb3f4 /clang/lib/Frontend/Rewrite | |
parent | ce40dbcbaa3871671d0bb6d4131e9bbd99061ba7 (diff) | |
download | bcm5719-llvm-9af34aeac196631c4743f872dfd8eeaf211e0086.tar.gz bcm5719-llvm-9af34aeac196631c4743f872dfd8eeaf211e0086.zip |
Correctly implement -include search logic.
According to the gcc docs, -include uses the current working directory
for the lookup instead of the main source file.
This patch gets rid of NormalizeIncludePath (which relied on an
implementation detail of FileManager / FileEntry for the include path
logic to work), and instead hands the correct lookup information down to
LookupFile.
This will allow us to change the FileEntry's behavior regarding its Name
caching.
llvm-svn: 215433
Diffstat (limited to 'clang/lib/Frontend/Rewrite')
-rw-r--r-- | clang/lib/Frontend/Rewrite/InclusionRewriter.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp b/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp index aa7017baee2..5b33307cbb2 100644 --- a/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp +++ b/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp @@ -333,10 +333,13 @@ bool InclusionRewriter::HandleHasInclude( // FIXME: Subframeworks aren't handled here. Do we care? bool isAngled = PP.GetIncludeFilenameSpelling(Tok.getLocation(), Filename); const DirectoryLookup *CurDir; + const FileEntry *FileEnt = PP.getSourceManager().getFileEntryForID(FileId); + SmallVector<std::pair<const FileEntry *, const DirectoryEntry *>, 1> + Includers; + Includers.push_back(std::make_pair(FileEnt, FileEnt->getDir())); const FileEntry *File = PP.getHeaderSearchInfo().LookupFile( - Filename, SourceLocation(), isAngled, nullptr, CurDir, - PP.getSourceManager().getFileEntryForID(FileId), nullptr, nullptr, - nullptr, false); + Filename, SourceLocation(), isAngled, nullptr, CurDir, Includers, nullptr, + nullptr, nullptr, false); FileExists = File != nullptr; return true; |