diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2011-03-16 18:34:36 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2011-03-16 18:34:36 +0000 |
commit | 3cc331a160cf5f318c532ca96f2e6b0821ced87c (patch) | |
tree | 935fd835dc9a47972aeac0c90e622e232e899c23 /clang/lib/Lex/HeaderMap.cpp | |
parent | d4346f2388921b5b75cd19e64a0b3f797eaf0cd7 (diff) | |
download | bcm5719-llvm-3cc331a160cf5f318c532ca96f2e6b0821ced87c.tar.gz bcm5719-llvm-3cc331a160cf5f318c532ca96f2e6b0821ced87c.zip |
Add a 'RawPath' parameter to the PPCallbacks interface. This allows
clients to observe the exact path through which an #included file was
located. This is very useful when trying to record and replay inclusion
operations without it beind influenced by the aggressive caching done
inside the FileManager to avoid redundant system calls and filesystem
operations.
The work to compute and return this is only done in the presence of
callbacks, so it should have no effect on normal compilation.
Patch by Manuel Klimek.
llvm-svn: 127742
Diffstat (limited to 'clang/lib/Lex/HeaderMap.cpp')
-rw-r--r-- | clang/lib/Lex/HeaderMap.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Lex/HeaderMap.cpp b/clang/lib/Lex/HeaderMap.cpp index e424f916551..90ed184a570 100644 --- a/clang/lib/Lex/HeaderMap.cpp +++ b/clang/lib/Lex/HeaderMap.cpp @@ -199,8 +199,9 @@ void HeaderMap::dump() const { /// LookupFile - Check to see if the specified relative filename is located in /// this HeaderMap. If so, open it and return its FileEntry. -const FileEntry *HeaderMap::LookupFile(llvm::StringRef Filename, - FileManager &FM) const { +const FileEntry *HeaderMap::LookupFile( + llvm::StringRef Filename, FileManager &FM, + llvm::SmallVectorImpl<char> *RawPath) const { const HMapHeader &Hdr = getHeader(); unsigned NumBuckets = getEndianAdjustedWord(Hdr.NumBuckets); @@ -223,6 +224,8 @@ const FileEntry *HeaderMap::LookupFile(llvm::StringRef Filename, llvm::SmallString<1024> DestPath; DestPath += getString(B.Prefix); DestPath += getString(B.Suffix); + if (RawPath != NULL) + *RawPath = DestPath; return FM.getFile(DestPath.str()); } } |