forked from OSchip/llvm-project
Allow force updating the NumCreatedFIDsForFileID.
Our internal clients implement parsing cache based on FileID. In order for the Preprocessor to reenter the cached FileID it needs to reset its NumCreatedFIDsForFileID. Differential Revision: https://reviews.llvm.org/D51295 llvm-svn: 347304
This commit is contained in:
parent
ee8b96f253
commit
6fbb3e08d7
|
@ -1024,13 +1024,14 @@ public:
|
|||
|
||||
/// Set the number of FileIDs (files and macros) that were created
|
||||
/// during preprocessing of \p FID, including it.
|
||||
void setNumCreatedFIDsForFileID(FileID FID, unsigned NumFIDs) const {
|
||||
void setNumCreatedFIDsForFileID(FileID FID, unsigned NumFIDs,
|
||||
bool Force = false) const {
|
||||
bool Invalid = false;
|
||||
const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &Invalid);
|
||||
if (Invalid || !Entry.isFile())
|
||||
return;
|
||||
|
||||
assert(Entry.getFile().NumCreatedFIDs == 0 && "Already set!");
|
||||
assert((Force || Entry.getFile().NumCreatedFIDs == 0) && "Already set!");
|
||||
const_cast<SrcMgr::FileInfo &>(Entry.getFile()).NumCreatedFIDs = NumFIDs;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue