From: Vassil Vassilev Date: Tue, 20 Nov 2018 13:53:20 +0000 (+0000) Subject: Allow force updating the NumCreatedFIDsForFileID. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d8ea6e585d1553fb64ae55c27264c0459957bbee;p=clang 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@347304 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h index 914225a5c2..dcc4a37e23 100644 --- a/include/clang/Basic/SourceManager.h +++ b/include/clang/Basic/SourceManager.h @@ -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(Entry.getFile()).NumCreatedFIDs = NumFIDs; }