diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-10-19 22:15:20 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-10-19 22:15:20 +0000 |
commit | 9714a2385cb66b6efa373fc668641de602dd9adb (patch) | |
tree | 263ec08a6f2762158b26333921142a155915ec6b /include/clang/Lex/Preprocessor.h | |
parent | a1194775dc3bc3c9471e089797ca08fdbe773794 (diff) |
Really^2 fix <rdar://problem/8361834>, this time without crashing.
Now MICache is a linked list (per the FIXME), where we tradeoff between MacroInfo objects being in MICache
and MIChainHead. MacroInfo objects in the MICache chain are already "Destroy()'ed", so they can be reused. When
inserting into MICache, we need to remove them from the regular linked list so that they aren't destroyed more than
once.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116869 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Lex/Preprocessor.h')
-rw-r--r-- | include/clang/Lex/Preprocessor.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h index a1a68dce45..42e2daac2f 100644 --- a/include/clang/Lex/Preprocessor.h +++ b/include/clang/Lex/Preprocessor.h @@ -195,11 +195,6 @@ class Preprocessor { /// to the actual definition of the macro. llvm::DenseMap<IdentifierInfo*, MacroInfo*> Macros; - /// MICache - A "freelist" of MacroInfo objects that can be reused for quick - /// allocation. - /// FIXME: why not use a singly linked list? - std::vector<MacroInfo*> MICache; - /// MacroArgCache - This is a "freelist" of MacroArg objects that can be /// reused for quick allocation. MacroArgs *MacroArgCache; @@ -255,12 +250,17 @@ private: // Cached tokens state. struct MacroInfoChain { MacroInfo MI; MacroInfoChain *Next; + MacroInfoChain *Prev; }; /// MacroInfos are managed as a chain for easy disposal. This is the head /// of that list. MacroInfoChain *MIChainHead; + /// MICache - A "freelist" of MacroInfo objects that can be reused for quick + /// allocation. + MacroInfoChain *MICache; + public: Preprocessor(Diagnostic &diags, const LangOptions &opts, const TargetInfo &target, |