[PATCH] D28299: Module: use PCMCache to manage memory buffers for pcm files.

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 6 10:47:36 PST 2017


dexonsmith updated this revision to Diff 87257.
dexonsmith added a comment.
Herald added subscribers: mgorny, nemanjai.

Rebased on top of the current https://reviews.llvm.org/D27689.  This also has some substantive changes:

- Renamed the data structure PCMCache to MemoryBufferCache, and split it out into its own files with tests.

- Simplified logic around whether a MemoryBuffer has already been used.  Tracking of what has already been validated now takes O(1) memory instead of O(n^2).

- Moved FileManager::BufferMgr (the instance of PCMCache) to CompilerInstance::PCMCache and ModuleManager::PCMCache (instances of IntrusiveRefCntPtr<MemoryBufferCache>).  This took some work to thread through, but since the PCMCache isn't related to the FileManager, this seemed like a cleaner result.

- Added some testcases for bugs we've found in the meantime (thanks to Adrian Prantl).  Primarily, we no longer error or cause a use-after-free if a MemoryBuffer was validated by an ancestor.


https://reviews.llvm.org/D28299

Files:
  clang/include/clang/Basic/DiagnosticSerializationKinds.td
  clang/include/clang/Basic/MemoryBufferCache.h
  clang/include/clang/Frontend/ASTUnit.h
  clang/include/clang/Frontend/CompilerInstance.h
  clang/include/clang/Lex/Preprocessor.h
  clang/include/clang/Serialization/ASTReader.h
  clang/include/clang/Serialization/ASTWriter.h
  clang/include/clang/Serialization/Module.h
  clang/include/clang/Serialization/ModuleManager.h
  clang/lib/Basic/CMakeLists.txt
  clang/lib/Basic/MemoryBufferCache.cpp
  clang/lib/Frontend/ASTUnit.cpp
  clang/lib/Frontend/CompilerInstance.cpp
  clang/lib/Lex/Preprocessor.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/lib/Serialization/GeneratePCH.cpp
  clang/lib/Serialization/ModuleManager.cpp
  clang/test/Modules/Inputs/outofdate-rebuild/AppKit.h
  clang/test/Modules/Inputs/outofdate-rebuild/Cocoa.h
  clang/test/Modules/Inputs/outofdate-rebuild/CoreText.h
  clang/test/Modules/Inputs/outofdate-rebuild/CoreVideo.h
  clang/test/Modules/Inputs/outofdate-rebuild/Foundation.h
  clang/test/Modules/Inputs/outofdate-rebuild/module.modulemap
  clang/test/Modules/Inputs/system-out-of-date/X.h
  clang/test/Modules/Inputs/system-out-of-date/Y.h
  clang/test/Modules/Inputs/system-out-of-date/Z.h
  clang/test/Modules/Inputs/system-out-of-date/module.map
  clang/test/Modules/Inputs/warning-mismatch/Mismatch.h
  clang/test/Modules/Inputs/warning-mismatch/System.h
  clang/test/Modules/Inputs/warning-mismatch/module.modulemap
  clang/test/Modules/outofdate-rebuild.m
  clang/test/Modules/system-out-of-date-test.m
  clang/test/Modules/warning-mismatch.m
  clang/unittests/Basic/CMakeLists.txt
  clang/unittests/Basic/MemoryBufferCacheTest.cpp
  clang/unittests/Basic/SourceManagerTest.cpp
  clang/unittests/Lex/LexerTest.cpp
  clang/unittests/Lex/PPCallbacksTest.cpp
  clang/unittests/Lex/PPConditionalDirectiveRecordTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28299.87257.patch
Type: text/x-patch
Size: 48252 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170206/2de37416/attachment-0001.bin>


More information about the cfe-commits mailing list