summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/ASTUnit.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* unique_ptr-ify CompilerInstance::takeSemaDavid Blaikie2014-08-101-1/+1
| | | | llvm-svn: 215321
* std::unique_ptr-ify the result of ASTUnit::LoadFromASTFileDavid Blaikie2014-08-101-10/+7
| | | | llvm-svn: 215320
* unique_ptr-ify ASTReaderListener in the ASTReaderDavid Blaikie2014-08-101-4/+3
| | | | llvm-svn: 215317
* Revert "unique_ptr-ify ownership of ASTConsumers"David Blaikie2014-07-171-17/+15
| | | | | | | | | This reverts commit r213307. Reverting to have some on-list discussion/confirmation about the ongoing direction of smart pointer usage in the LLVM project. llvm-svn: 213325
* unique_ptr-ify ownership of ASTConsumersDavid Blaikie2014-07-171-15/+17
| | | | | | | | | (after fixing a bug in MultiplexConsumer I noticed the ownership of the nested consumers was implemented with raw pointers - so this fixes that... and follows the source back to its origin pushing unique_ptr ownership up through there too) llvm-svn: 213307
* Remove unused sys/stat.h includesAlp Toker2014-07-071-1/+0
| | | | | | The facility was abstracted to LLVM in r187364. llvm-svn: 212441
* Peel away old-style file remapping typedefs and cruftAlp Toker2014-07-071-52/+30
| | | | llvm-svn: 212438
* Use non-intrusive refcounting for TargetOptionsAlp Toker2014-07-061-21/+18
| | | | llvm-svn: 212388
* Use non-intrusive refcounting for LangOptionsAlp Toker2014-07-061-2/+2
| | | | | | | This type is only refcounted in a couple of places so making ownership explicit improves clarity. llvm-svn: 212387
* Constify a read-only parameter and give function a better nameAlp Toker2014-07-061-5/+5
| | | | | | | This makes it clear that TargetInfo doesn't capture the LangOptions object, rather uses it to apply adjustments. llvm-svn: 212386
* Track IntrusiveRefCntPtr::get() changes from LLVM r212366Alp Toker2014-07-051-7/+7
| | | | llvm-svn: 212369
* Consider module depedencies when checking a preamble in libclangBen Langmuir2014-06-301-15/+9
| | | | | | | | | | | | | Add module dependencies (header files, module map files) to the list of files to check when deciding whether to rebuild a preamble. That fixes using preambles with module imports so long as they are in non-overridden files. My intent is to use to unify the existing dependency collectors to the new “DependencyCollectory” interface from this commit, starting with the DependencyFileGenerator. llvm-svn: 212060
* Stop sharing the FileManager in ASTUnit::ParseBen Langmuir2014-06-231-1/+7
| | | | | | | | | | We were using old stat values for any files that had previously been looked up, leading to badness. There might be a more elegant solution in invalidating the cache for those file (since we already know which ones they are), but it seems too likely there are existing references to them hiding somewhere. llvm-svn: 211504
* [C++11] Use 'nullptr'. Frontend edition.Craig Topper2014-05-221-65/+65
| | | | llvm-svn: 209389
* Eliminate ASTContext's DelayInitialization flagAlp Toker2014-05-031-8/+3
| | | | | | | | | Having various possible states of initialization following construction doesn't add value here. Also remove the unused size_reserve parameter. llvm-svn: 207897
* Reformat code following Preprocessor constructor updatesAlp Toker2014-05-021-6/+5
| | | | | | Landing this separately to make the previous commits easy to follow at home. llvm-svn: 207826
* Factor TargetInfo pointer/DelayInitialization bool pair out of Preprocessor ctorAlp Toker2014-05-021-3/+2
| | | | | | | | The Preprocessor::Initialize() function already offers a clear interface to achieve this, further reducing the confusing number of states a newly constructed preprocessor can have. llvm-svn: 207825
* Remove unused using statement.Nico Weber2014-04-281-1/+0
| | | | llvm-svn: 207427
* Push unique_ptr ownership of ASTUnits further back into their factories.David Blaikie2014-04-251-13/+10
| | | | llvm-svn: 207237
* Attempt to fix null ASTContext in ASTUnit error pathBen Langmuir2014-04-221-1/+4
| | | | | | | | | We don't need the ASTContext for the diagnostics, only the language options, which we can get from the compiler invocation. It worries me how many categorically different states the ASTUnit class can be in depending on how it is being constructed/used. llvm-svn: 206909
* Don't read CompilerInstance fields that don't exist in ASTUnitBen Langmuir2014-04-181-3/+6
| | | | | | | When transferring data from a CompilerInstance in an error path we need to consider cases where the various fields are uninitialized. llvm-svn: 206644
* Honour -ivfsoverlay in ASTUnit to match clangBen Langmuir2014-04-151-8/+27
| | | | | | | This allows code indexing, etc. to use the VFS in the same way as the compiler. llvm-svn: 206309
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-131-41/+41
| | | | | | class. llvm-svn: 203758
* [libclang] Don't pad the main buffer for the preamble.Argyrios Kyrtzidis2014-03-091-40/+6
| | | | | | | | | Padding does not seem to be useful currently, and it leads to bogus location if an error points to the end of the file. rdar://15836513 llvm-svn: 203370
* [C++11] Replacing EnumDecl iterators enumerator_begin() and enumerator_end() ↵Aaron Ballman2014-03-081-4/+3
| | | | | | with iterator_range enumerators(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203353
* Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-071-49/+36
| | | | | | This compiles cleanly with lldb/lld/clang-tools-extra/llvm. llvm-svn: 203279
* [C++11] Replacing DeclBase iterators decls_begin() and decls_end() with ↵Aaron Ballman2014-03-071-3/+2
| | | | | | iterator_range decls(). The same is true for the noload versions of these APIs. Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203278
* Change OwningPtr::take() to OwningPtr::release().Ahmed Charles2014-03-071-5/+6
| | | | | | This is a precursor to moving to std::unique_ptr. llvm-svn: 203275
* [C++11] Use std::atomic instead of LLVM's.Benjamin Kramer2014-03-021-10/+6
| | | | | | No intended functionality change. llvm-svn: 202652
* [C++11] Replace llvm::tie with std::tie.Benjamin Kramer2014-03-021-2/+2
| | | | llvm-svn: 202639
* [ASTUnit] Don't let the preamble diagnostics out-live the CompilerInstance ↵Argyrios Kyrtzidis2014-02-281-51/+93
| | | | | | | | | | that created them, this is inherently unsafe. Instead get the diagnostic info into a SourceManager-independent form. llvm-svn: 202471
* [ASTUnit] Fix use-after-free bug in ↵Argyrios Kyrtzidis2014-02-271-22/+8
| | | | | | | | | | | | | | | ASTUnit::getMainBufferWithPrecompiledPreamble(). With r197755 we started reading the contents of buffer file entries, but the buffers may point to ASTReader blobs that have been disposed. Fix this by having the CompilerInstance object keep a reference to the ASTReader as well as having the ASTContext keep reference to the ExternalASTSource. This was very difficult to construct a test case for. rdar://16149782 llvm-svn: 202346
* Recommit virtual file systemBen Langmuir2014-02-201-3/+3
| | | | | | | | | | | Previously reverted in r201755 due to causing an assertion failure. I've removed the offending assertion, and taught the CompilerInstance to create a default virtual file system inside createFileManager. In the future, we should be able to reach into the CompilerInvocation to customize this behaviour without breaking clients that don't care. llvm-svn: 201818
* Reverting the virtual file system implementation, because it triggers an ↵Juergen Ributzka2014-02-201-3/+3
| | | | | | | | | | assertion in our internal build bots. This reverts commits 201618, 201635, 201636, 201639, 201685, 201691, and 201696. llvm-svn: 201755
* Use llvm::DeleteContainerSeconds when possibleReid Kleckner2014-02-191-4/+1
| | | | llvm-svn: 201739
* Initial implementation of virtual file systemBen Langmuir2014-02-191-3/+3
| | | | | | | | | | | | This adds the minimum virtual file system support to start migrating FileManager onto the VFS. Originally discussed here: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-February/035188.html Differential Revision: http://llvm-reviews.chandlerc.com/D2745 llvm-svn: 201618
* Fix memory leak introduced by r201010.Daniel Jasper2014-02-121-0/+1
| | | | llvm-svn: 201220
* ASTUnit: simplify remapping files by using the exact same logic in PreprocessorDmitri Gribenko2014-02-101-16/+4
| | | | llvm-svn: 201082
* ASTUnit: remove dead code in remapping filesDmitri Gribenko2014-02-081-73/+22
| | | | | | | ASTUnit contains code to remap files to other files on disk. This code is not used. We only remap files to MemoryBuffers. llvm-svn: 201010
* ASTUnit: ArrayRef'ize RemappedFilesDmitri Gribenko2014-02-071-11/+8
| | | | llvm-svn: 200975
* Fix a -Wformat warning in ASTUnit.cppReid Kleckner2014-02-031-2/+2
| | | | | | | | | | llvm::sys::cas_flag is 'long' instead of 'uint32_t' on win32, because that's what InterlockedIncrement is defined to accept. I still don't know if we should be calling fprintf from ASTUnit.cpp behind a getenv check. llvm-svn: 200718
* Use the simpler version of llvm::sys::fs::remove when possible.Rafael Espindola2014-01-101-2/+1
| | | | llvm-svn: 198957
* Remove obsolete preamble FIXMEAlp Toker2013-12-201-2/+0
| | | | | | | The MD5 is checked since r197755 which is as good as comparing buffer contents in this context. llvm-svn: 197842
* Correctly compute the size in bytes of PreambleFileHash.MD5Dmitri Gribenko2013-12-201-2/+2
| | | | llvm-svn: 197762
* ASTUnit::getMainBufferWithPrecompiledPreamble: use MD5 hash of the remappedDmitri Gribenko2013-12-201-12/+51
| | | | | | | | | | | files to tell if they were changed since the last time we have computed the preamble We used to check only the buffer size, so if the new remapped buffer has the same size as the previous one, we would think that the buffer did not change, and we did not rebuild the preambule, which sometimes caused us to crash. llvm-svn: 197755
* Simplify codeDmitri Gribenko2013-12-191-1/+1
| | | | llvm-svn: 197748
* Make ASTUnit structure stable with NDEBUGAlp Toker2013-11-221-1/+1
| | | | | | | | | ASTUnit instances are allocated infrequently so it's fine to keep this field around in all build configurations. Assigns null to silence -Wunused-private-field in Release. llvm-svn: 195419
* Use the same SourceManager for ModuleMaps and compilations.Manuel Klimek2013-10-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows using virtual file mappings on the original SourceManager to map in virtual module.map files. Without this patch, the ModuleMap search will find a module.map file (as the FileEntry exists in the FileManager), but will be unable to get the content from the SourceManager (as ModuleMap previously created its own SourceManager). Two problems needed to be fixed which this patch exposed: 1. Storing the inferred module map When writing out a module, the ASTWriter stores the names of the files in the main source manager; when loading the AST again, the ASTReader errs out if such a file is found missing, unless it is overridden. Previously CompilerInstance's compileModule method would store the inferred module map to a temporary file; the problem with this approach is that now that the module map is handled by the main source manager, the ASTWriter stores the name of the temporary module map as source to the compilation; later, when the module is loaded, the temporary file has already been deleted, which leads to a compilation error. This patch changes the inferred module map to instead inject a virtual file into the source manager. This both saves some disk IO, and works with how the ASTWriter/ASTReader handle overridden source files. 2. Changing test input in test/Modules/Inputs/* Now that the module map file is handled by the main source manager, the VerifyDiagnosticConsumer will not ignore diagnostics created while parsing the module map file. The module test test/Modules/renamed.m uses -I test/Modules/Inputs and triggers recursive loading of all module maps in test/Modules/Inputs, some of which had conflicting names, thus leading errors while parsing the module maps. Those diagnostics already occur on trunk, but before this patch they would not break the test, as they were ignored by the VerifyDiagnosticConsumer. This patch thus changes the module maps that have been recently introduced which broke the invariant of compatible modules maps in test/Modules/Inputs. llvm-svn: 193314
* [libclang] For an unscoped enum include the enumerators in the top-level ↵Argyrios Kyrtzidis2013-10-151-0/+12
| | | | | | | | code-completion hash since they enter the top-level namespace. rdar://14703327 llvm-svn: 192720
* Remove unnecessary inclusion of Sema.hDavid Blaikie2013-09-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let me tell you a tale... Within some twisted maze of debug info I've ended up implementing an insane man's Include What You Use device. When the debugger emits debug info it really shouldn't, I find out why & then realize the code could be improved too. In this instance CIndexDiagnostics.cpp had a lot more debug info with Clang than GCC. Upon inspection a major culprit was all the debug info describing clang::Sema. This was emitted because clang::Sema is befriended by DiagnosticEngine which was rightly required, but GCC doesn't emit debug info for friends so it never emitted anything for Clang. Clang does emit debug info for friends (will be fixed/changed to reduce debug info size). But why didn't Clang just emit a declaration of Sema if this entire TU didn't require a definition? 1) Diagnostic.h did the right thing, only using a declaration of Sema and not including Sema.h at all. 2) Some other dependency of CIndexDiagnostics.cpp didn't do the right thing. ASTUnit.h, only needing a declaration, still included Sema.h (hence this commit which removes that include and adds the necessary includes to the cpp files that were relying on this) 3) -flimit-debug-info didn't save us because of EnterExpressionEvaluationContext, defined inline in Sema.h which fires the "requiresCompleteType" check/flag (since it uses nested types from Sema and calls Sema member functions) and thus, if debug info is ever emitted for the type, the whole type is emitted and not just a declaration. Improving -flimit-debug-info to account for this would be... hard. Modifying the code so that's not 'required to be complete' might be possible, but probably only by moving EnterExpressionEvaluationContext either into Sema, or out of Sema.h. That might be a bit too much of a contortion to be bothered with. Also, this is only one of the cases where emitting debug info for friends caused us to emit a lot more debug info (this change reduces Clang's DWO size by 0.93%, dropping friends entirely reduces debug info by 3.2%) - I haven't hunted down the other cases, but I assume they might be similar (Sema or something like it). IWYU or a similar tool might help us reduce build times a bit, but analyzing debug info to find these differences isn't worthwhile. I'll take the 3.2% win, provide this small improvement to the code itself, and move on. llvm-svn: 190715
OpenPOWER on IntegriCloud