summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/ASTUnit.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [libclang] Make sure Preprocessor is set in ASTUnit during indexing.Argyrios Kyrtzidis2012-01-171-0/+2
| | | | llvm-svn: 148319
* Eliminate ObjCForwardProtocolDecl, which is redundant now thatDouglas Gregor2012-01-011-11/+1
| | | | | | ObjCProtocolDecl modules forward declarations properly. llvm-svn: 147415
* Implement support for module requirements, which indicate the languageDouglas Gregor2011-12-311-1/+2
| | | | | | | | | features needed for a particular module to be available. This allows mixed-language modules, where certain headers only work under some language variants (e.g., in C++, std.tuple might only be available in C++11 mode). llvm-svn: 147387
* Eliminate ObjCClassDecl, which is redundant now that ObjCInterfaceDeclDouglas Gregor2011-12-271-5/+0
| | | | | | | covers both declarations (@class) and definitions (@interface) of an Objective-C class. llvm-svn: 147299
* Remove unused variables.Rafael Espindola2011-12-251-1/+1
| | | | llvm-svn: 147260
* Promote ModuleMap::Module to a namespace-scope class in the BasicDouglas Gregor2011-11-301-1/+1
| | | | | | | | | library, since modules cut across all of the libraries. Rename serialization::Module to serialization::ModuleFile to side-step the annoying naming conflict. Prune a bunch of ModuleMap.h includes that are no longer needed (most files only needed the Module type). llvm-svn: 145538
* When writing a module file, pass the module through to the ASTDouglas Gregor2011-11-301-2/+2
| | | | | | writer. No functionality change. llvm-svn: 145479
* Initialize NumWarningsInPreamble in ASTUnit's constructor, for safety.Argyrios Kyrtzidis2011-11-291-0/+1
| | | | llvm-svn: 145412
* [libclang] Indexing API: If the client requested to get a CXTranslationUnit ↵Argyrios Kyrtzidis2011-11-281-6/+29
| | | | | | | | after indexing, honor all the TU options. llvm-svn: 145229
* [libclang] Indexing API: Capture diagnostics during indexing.Argyrios Kyrtzidis2011-11-281-2/+3
| | | | llvm-svn: 145228
* [libclang] Fix operations (token annotation, getting cursor, etc.) with a ↵Argyrios Kyrtzidis2011-11-231-0/+7
| | | | | | | | | | | | | | | file region inside an objc container that "contains" other file-level declarations. When getting the array of file-level declarations that overlap with a file region, we failed to report that the region overlaps with an objc container, if the container had other file-level declarations declared lexically inside it. Fix this by marking such declarations as "isTopLevelDeclInObjCContainer" in the AST and handling them appropriately. llvm-svn: 145109
* Change ASTConsumer::HandleTopLevelDecl to return true for the parser to continueArgyrios Kyrtzidis2011-11-181-2/+4
| | | | | | parsing or false to abort parsing. llvm-svn: 144943
* Make 'LangOptions' in CompilerInvocation a heap-allocated, reference counted ↵Ted Kremenek2011-11-171-2/+3
| | | | | | | | | | | | | | | | | object. I discovered that llvm::RefCountedBase<T> has a bug where the reference count is copied in the copy constructor, which means that there were cases when the CompilerInvocation objects created by ASTUnit were actually leaked. When I fixed that bug locally, it showed that a whole bunch of code assumed that the LangOptions object that was part of CompilerInvocation was still alive. By making it heap-allocated and reference counted, we can keep it around after the CompilerInvocation object goes away. As part of this change, change CompilerInvocation:getLangOptions() to return a pointer, acting as another clue that this object may outlive the CompilerInvocation object. This commit doesn't fix the CompilerInvocation leak itself. That will come when I commit the fix to llvm::RefCountedBase<T> to mainline LLVM. llvm-svn: 144930
* Simplify crash cleanup logic in ASTUnit::LoadFromCommandLine() by zeroing ↵Ted Kremenek2011-11-171-7/+2
| | | | | | out two IntrusiveRefCnt pointers after we have assigned their respective values into fields of ASTUnit. llvm-svn: 144929
* [libclang] Fix crash on invalid code. Fixes rdar://10451854Argyrios Kyrtzidis2011-11-161-0/+3
| | | | llvm-svn: 144766
* I predict that HeaderSearch will need the ability to generateDouglas Gregor2011-11-111-1/+2
| | | | | | diagnostics in the future. Make it so. llvm-svn: 144347
* ASTConsumer::handleTopLevelDecl will end up getting called forDouglas Gregor2011-11-071-1/+4
| | | | | | function template instantiations. Fixes <rdar://problem/10398005> / PR11312. llvm-svn: 143984
* After resetting the diagnostic state, set the number of warning occurring in ↵Argyrios Kyrtzidis2011-11-031-0/+2
| | | | | | the preamble. llvm-svn: 143647
* [libclang] Fix crash when a #pragma diagnostic is included in the preamble.Argyrios Kyrtzidis2011-11-031-7/+3
| | | | | | | | | | | A PCH file keeps track of #pragma diagnostics state; when loading the preamble, they conflicted with the #pragma diagnostic state already present in the DiagnosticsEngine object due to parsing the preamble. Fix this by clearing the state of the DiagnosticsEngine object. Fixes rdar://10363572 && http://llvm.org/PR11254. llvm-svn: 143644
* [libclang] Add infrastructure to be able to only deserialize decls in a file ↵Argyrios Kyrtzidis2011-11-031-0/+36
| | | | | | | | region and use it for clang_getCursor. llvm-svn: 143605
* Put a reference of the ASTReader in the ASTUnit.Argyrios Kyrtzidis2011-11-011-1/+6
| | | | | | | This is intended for direct access of the ASTReader for uses that make little sense to try to shoehorn in the ExternalASTSource interface. llvm-svn: 143465
* Revert r143342. Caching of code-completion results was intentionally placed ↵Argyrios Kyrtzidis2011-10-311-6/+6
| | | | | | | | | | | | in "reparse" because we don't want to take this performance hit when doing code completion Log of r143342: Move caching of code-completion results from ASTUnit::Reparse to ASTUnit::CodeComplete, so that it will happen when we are doing code-completion, not reparsing. llvm-svn: 143367
* Move caching of code-completion results from ASTUnit::Reparse to ↵Argyrios Kyrtzidis2011-10-311-6/+6
| | | | | | | | ASTUnit::CodeComplete, so that it will happen when we are doing code-completion, not reparsing. llvm-svn: 143342
* Have the ASTUnit associate the local declarations that get parsed with the fileArgyrios Kyrtzidis2011-10-311-12/+85
| | | | | | that contains them. llvm-svn: 143338
* Add mutex for accessing ASTUnit's global OnDisk data. This may be an issue ↵Ted Kremenek2011-10-271-0/+13
| | | | | | as libclang could be processing multiple ASTUnit's at once. llvm-svn: 143138
* Move ASTUnit's handling of temporary files and the preamble file into a ↵Ted Kremenek2011-10-271-22/+108
| | | | | | lazily-created static DenseMap. This DenseMap is cleared (and the files erased) via an atexit routine in the case an ASTUnit is not destroyed. Fixes <rdar://problem/10293367>. llvm-svn: 143115
* [PCH] When visiting preprocessed entities, make it possible to avoid ↵Argyrios Kyrtzidis2011-10-251-0/+44
| | | | | | | | | | | | | | | deserializing preprocessed entities that are #included in the range that we are interested. This is useful when we are interested in preprocessed entities of a specific file, e.g when we are annotating tokens. There is also an optimization where we cache the last result of PreprocessingRecord::getPreprocessedEntitiesInRange and we re-use it if there is a call with the same range as before. rdar://10313365 llvm-svn: 142887
* [libclang] Make sure we don't try to erase past the StoredDiagnostics vector.Argyrios Kyrtzidis2011-10-241-13/+7
| | | | | | Ted came upon the bug but I couldn't make a test out of it. llvm-svn: 142805
* Allow calling ASTUnit::LoadFromCompilerInvocationAction with a previously ↵Argyrios Kyrtzidis2011-10-141-13/+16
| | | | | | created ASTUnit. llvm-svn: 142004
* [libclang] Implement ConcurrencyCheck using a recursive mutex to allow ↵Argyrios Kyrtzidis2011-10-101-2/+28
| | | | | | | | re-entrancy in the same thread. The checks are performed only in DEBUG, it becomes no-op in release mode. llvm-svn: 141582
* Introduce a pure virtual clone() method to DiagnosticConsumer, so thatDouglas Gregor2011-09-291-0/+6
| | | | | | | | | we have the ability to create a new, distict diagnostic consumer when we go off and build a module. This avoids the currently horribleness where the same diagnostic consumer sees diagnostics for multiple translation units (and multiple SourceManagers!) causing all sorts of havok. llvm-svn: 140743
* Don't map a file:line:col triplet that is inside the preamble range toArgyrios Kyrtzidis2011-09-261-12/+44
| | | | | | | | | | | | | | a "loaded" location of the precompiled preamble. Instead, handle specially locations of preprocessed entities: -When looking up for preprocessed entities, map main file locations inside the preamble range to a preamble loaded location. -When getting the source range of a preprocessing cursor, map preamble loaded locations back to main file locations. Fixes rdar://10175093 & http://llvm.org/PR10999 llvm-svn: 140519
* Rename DiagnosticInfo to Diagnostic as per issue 5397David Blaikie2011-09-261-2/+2
| | | | llvm-svn: 140493
* Rename StoredDiagnosticClient to StoredDiagnosticConsumer as per issue 5397David Blaikie2011-09-261-6/+6
| | | | llvm-svn: 140483
* Rename DiagnosticClient to DiagnosticConsumer as per issue 5397David Blaikie2011-09-251-4/+4
| | | | llvm-svn: 140479
* Rename Diagnostic to DiagnosticsEngine as per issue 5397David Blaikie2011-09-251-19/+19
| | | | llvm-svn: 140478
* In libclang, when visiting preprocessed entities in a source range, useArgyrios Kyrtzidis2011-09-191-61/+1
| | | | | | | | | | PreprocessingRecord's getPreprocessedEntitiesInRange. Also remove all the stuff that were added in ASTUnit that are unnecessary now that we do a binary search for preprocessed entities and deserialize only what is necessary. llvm-svn: 140063
* Introduce local_begin()/local_end() methods in PreprocessingRecord whichArgyrios Kyrtzidis2011-09-191-1/+1
| | | | | | return iterators for local, non-loaded, preprocessed entities. llvm-svn: 140062
* [libclang] When getting a source location from a file:line:col tripletArgyrios Kyrtzidis2011-09-191-2/+42
| | | | | | | check whether the requested location points inside the precompiled preamble, in which case the returned source location will be a "loaded" one. llvm-svn: 140060
* [libclang] In ASTUnit::Parse copy the CompilerInvocation object instead ofArgyrios Kyrtzidis2011-09-121-16/+4
| | | | | | | | | | | | modifying directly for the preamble. This avoids an awful, hard to find, bug where "PreprocessorOpts.DisablePCHValidation = true" would be persistent for subsequent reparses of the translation unit which would result in defines, present in command-line but not in the PCH, being ignored. Fixes rdar://9615399. llvm-svn: 139512
* Kill of the Decl::PCHLevel field entirely. We now only need to knowDouglas Gregor2011-09-101-7/+0
| | | | | | whether a Decl was deserialized from an AST file (any AST file). llvm-svn: 139438
* Fix Lexer::ComputePreamble when MaxLines parameter is non-zero.Argyrios Kyrtzidis2011-09-041-1/+2
| | | | | | | | The function was only counting lines that included tokens and not empty lines, but MaxLines (mainly initiated to the line where the code-completion point resides) is a count of overall lines (even empty ones). llvm-svn: 139085
* Always construct an ASTReader with a non-NULL ASTContext andDouglas Gregor2011-09-021-6/+1
| | | | | | | | | Preprocessor, eliminating the constructor that was used by ASTUnit (which didn't provide an ASTContext or Prepreprocessor). Ensuring that both objects are non-NULL will simplify module loading (but none of that is done yet). llvm-svn: 138986
* Extend the ASTContext constructor to delay the initialization ofDouglas Gregor2011-09-021-22/+25
| | | | | | | | builtin types (When requested). This is another step toward making ASTUnit build the ASTContext as needed when loading an AST file, rather than doing so after the fact. No actual functionality change (yet). llvm-svn: 138985
* Allow the preprocessor to be constructed without performing target-Douglas Gregor2011-09-011-24/+39
| | | | | | | | and language-specific initialization. Use this to allow ASTUnit to create a preprocessor object *before* loading the AST file. No actual functionality change. llvm-svn: 138983
* Teach ASTContext and Preprocessor to hold on to references to the sameDouglas Gregor2011-09-011-6/+6
| | | | | | | | | LangOptions, rather than making distinct copies of LangOptions. Granted, LangOptions doesn't actually get modified, but this will eventually make it easier to construct ASTContext and Preprocessor before we know all of the LangOptions. llvm-svn: 138959
* Modules hide macro definitions by default, so that silly things likeDouglas Gregor2011-09-011-2/+3
| | | | | | | | | | | include guards don't show up as macro definitions in every translation unit that imports a module. Macro definitions can, however, be exported with the intentionally-ugly #__export_macro__ directive. Implement this feature by not even bothering to serialize non-exported macros to a module, because clients of that module need not (should not) know that these macros even exist. llvm-svn: 138943
* objective-c: Treat top-level objective-c declarationsFariborz Jahanian2011-08-271-3/+1
| | | | | | | | | | , such as list of forward @class decls, in a DeclGroup node. Deal with its consequence throught clang. This is in preparation for more Sema work ahead. // rdar://8843851. Feel free to reverse if it breaks something important and I am unavailable. llvm-svn: 138709
* Introduce support for a simple module import declaration, whichDouglas Gregor2011-08-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | loads the named module. The syntax itself is intentionally hideous and will be replaced at some later point with something more palatable. For now, we're focusing on the semantics: - Module imports are handled first by the preprocessor (to get macro definitions) and then the same tokens are also handled by the parser (to get declarations). If both happen (as in normal compilation), the second one is redundant, because we currently have no way to hide macros or declarations when loading a module. Chris gets credit for this mad-but-workable scheme. - The Preprocessor now holds on to a reference to a module loader, which is responsible for loading named modules. CompilerInstance is the only important module loader: it now knows how to create and wire up an AST reader on demand to actually perform the module load. - We search for modules in the include path, using the module name with the suffix ".pcm" (precompiled module) for the file name. This is a temporary hack; we hope to improve the situation in the future. llvm-svn: 138679
* Eliminate the -chained-pch flag and all of the frontend and libclang options ↵Douglas Gregor2011-08-251-13/+0
| | | | | | associated with it. Chained PCH is the only way to build a PCH file that includes another PCH file llvm-svn: 138597
OpenPOWER on IntegriCloud