r347304 - Allow force updating the NumCreatedFIDsForFileID.
Vassil Vassilev via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 20 05:53:20 PST 2018
Author: vvassilev
Date: Tue Nov 20 05:53:20 2018
New Revision: 347304
URL: http://llvm.org/viewvc/llvm-project?rev=347304&view=rev
Log:
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
Modified:
cfe/trunk/include/clang/Basic/SourceManager.h
Modified: cfe/trunk/include/clang/Basic/SourceManager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceManager.h?rev=347304&r1=347303&r2=347304&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/SourceManager.h (original)
+++ cfe/trunk/include/clang/Basic/SourceManager.h Tue Nov 20 05:53:20 2018
@@ -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;
}
More information about the cfe-commits
mailing list