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
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user