summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/ASTUnit.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove the Chaining argument from the PCH/module generator. It's no longer usedDouglas Gregor2011-08-251-7/+5
| | | | llvm-svn: 138596
* Introduce a -cc1 option "-emit-module", that creates a binary moduleDouglas Gregor2011-08-251-10/+9
| | | | | | | | | from the given source. -emit-module behaves similarly to -emit-pch, except that Sema is somewhat more strict about the contents of -emit-module. In the future, there are likely to be more interesting differences. llvm-svn: 138595
* Make Lexer::ComputePreamble accept a LangOptions parameter, otherwise it may beArgyrios Kyrtzidis2011-08-251-1/+3
| | | | | | out-of-sync how a file is compiled. Patch by Matthias Kleine! llvm-svn: 138580
* In the AST file format, eliminate the CHAINED_METADATA record. Instead,Douglas Gregor2011-08-171-5/+0
| | | | | | | | | | | | | all AST files have a normal METADATA record that has the same form regardless of whether we refer to a chained PCH or any other kind of AST file. Introduce the IMPORTS record, which describes all of the AST files that are imported by this AST file, and how (as a module, a PCH file, etc.). Currently, we emit at most one entry to this record, to support chained PCH. llvm-svn: 137869
* [MSVC] Fix a warning C4334 "'operator' : result of 32-bit shift implicitly ↵NAKAMURA Takumi2011-08-171-2/+1
| | | | | | converted to 64 bits (was 64-bit shift intended?)". llvm-svn: 137803
* Add a new libclang API to return a CXCompletionString for an arbitraryDouglas Gregor2011-08-041-0/+4
| | | | | | cursor, from Connor Wakamo! Addresses <rdar://problem/9087798>. llvm-svn: 136911
* When performing code completion after at @interface, allow bothDouglas Gregor2011-07-301-2/+2
| | | | | | | | already-defined and forward-declared results. Already-defined results are fine because they could be the start of a category. Fixes <rdar://problem/9811691>. llvm-svn: 136559
* Cut down the number of open/close system calls for output files.Argyrios Kyrtzidis2011-07-281-13/+7
| | | | | | | | | For PCH files, have only one open/close for temporary + rename to be safe from race conditions. For all other output files open/close the output file directly. Depends on llvm r136310. rdar://9082880 & http://llvm.org/PR9374. llvm-svn: 136315
* This patch extends the previous patch by starting to incorporate more ↵Jonathan D. Turner2011-07-261-1/+1
| | | | | | functionality, like lookup-by-name and exporting lookup tables, into the module manager. Methods now have documentation. A few more functions have been switched over to the new iterator style and away from manual/explicit iteration. Ultimately we want to move away from name lookup here, as symlinks make filenames not a safe unique value, but we use it here as a stopgap before better measures are in place (namely instead using FileEntry* from a global FileManager). llvm-svn: 136107
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-30/+30
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Remove prepending of '$' to module names.Jonathan D. Turner2011-07-221-2/+2
| | | | llvm-svn: 135775
* Switch all of the "isysroot" const char*'s throughout the AST readerDouglas Gregor2011-07-221-5/+6
| | | | | | and writer to StringRef or std::string, as appropriate. llvm-svn: 135769
* Rename ASTReader::PerFileData to serialization::Module, pulling it outDouglas Gregor2011-07-221-2/+2
| | | | | | | of ASTReader so it can become its own full-fledged class (eventually). No functionality change. llvm-svn: 135767
* For ASTUnit::Save, write the AST to a temporary and then rename it to the ↵Argyrios Kyrtzidis2011-07-211-4/+26
| | | | | | | | actual filename. Should avoid race conditions. Addresses rdar://9788943. llvm-svn: 135691
* Cut down one open/close pair of system calls by using Path's makeUnique ↵Argyrios Kyrtzidis2011-07-211-1/+1
| | | | | | instead of createTemporaryFileOnDisk. llvm-svn: 135690
* Rework the detailed preprocessing record to separate preprocessingDouglas Gregor2011-07-211-9/+1
| | | | | | | | | | | | | | | entities generated directly by the preprocessor from those loaded from the external source (e.g., the ASTReader). By separating these two sets of entities into different vectors, we allow both to grow independently, and eliminate the need for preallocating all of the loaded preprocessing entities. This is similar to the way the recent SourceManager refactoring treats FileIDs and the source location address space. As part of this, switch over to building a continuous range map to track preprocessing entities. llvm-svn: 135646
* Revamp the SourceManager to separate the representation of parsedDouglas Gregor2011-07-191-19/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | source locations from source locations loaded from an AST/PCH file. Previously, loading an AST/PCH file involved carefully pre-allocating space at the beginning of the source manager for the source locations and FileIDs that correspond to the prefix, and then appending the source locations/FileIDs used for parsing the remaining translation unit. This design forced us into loading PCH files early, as a prefix, whic has become a rather significant limitation. This patch splits the SourceManager space into two parts: for source location "addresses", the lower values (growing upward) are used to describe parsed code, while upper values (growing downward) are used for source locations loaded from AST/PCH files. Similarly, positive FileIDs are used to describe parsed code while negative FileIDs are used to file/macro locations loaded from AST/PCH files. As a result, we can load PCH/AST files even during parsing, making various improvemnts in the future possible, e.g., teaching #include <foo.h> to look for and load <foo.h.gch> if it happens to be already available. This patch was originally written by Sebastian Redl, then brought forward to the modern age by Jonathan Turner, and finally polished/finished by me to be committed. llvm-svn: 135484
* Migrate LLVM and Clang to use the new makeArrayRef(...) functions where ↵Frits van Bommel2011-07-181-2/+2
| | | | | | | | previously explicit non-default constructors were used. Mostly mechanical with some manual reformatting. llvm-svn: 135390
* NestedMacroInstantiations -> NestedMacroExpansionsChandler Carruth2011-07-141-7/+7
| | | | | | | | | | | | | | | | This is switches all the interfaces points (and most of the commenst / local variables I saw on my way through) regarding the NestedMacroInstantiations bit. The libclang enums corresponding to this state were renamed, but a legacy enum was added with the old name, and the same value to keep existing clients working. I've added a documentation blurb for it, but let me know if there is a canonical way to document legacy elemenst of the libclang interface. No functionality changed here, even in tests. llvm-svn: 135141
* Introduce a new libclang aPI function,Douglas Gregor2011-07-071-16/+30
| | | | | | | | | clang_codeCompleteGetContexts(), that provides the client with information about the context in which code completion has occurred and what kinds of entities make sense as completions at that point. Patch by Connor Wakamo! llvm-svn: 134615
* Keep track of when "unrecoverable" errors occur, then allowDouglas Gregor2011-07-061-1/+1
| | | | | | | clang_saveTranslationUnit() to save a PCH file if the only errors it contains are recoverable errors. Fixes <rdar://problem/9727804>. llvm-svn: 134503
* libclang: Allow callers of clang_saveTranslationUnit() to distinguishDouglas Gregor2011-07-061-4/+4
| | | | | | | between different classes of errors. Addresses most of <rdar://problem/9660328>. llvm-svn: 134495
* When we create a precompiled preamble, don't copy theDouglas Gregor2011-07-011-6/+9
| | | | | | | | | | | CompilerInvocation on the stack, because other objects (e.g., the CompilerInstance) maintain an intrusive reference-counted pointer to the CompilerInvocation. This doesn't matter in the normal case, because we take back the CompilerInvocation. However, during crash recovery, this leads to us trying to free an object on the stack, and hilarity ensues. Fixes <rdar://problem/9652540>. llvm-svn: 134245
* Introduce a new libclang parsing flag,Douglas Gregor2011-05-061-2/+12
| | | | | | | | | | | | | CXTranslationUnit_NestedMacroInstantiations, which indicates whether we want to see "nested" macro instantiations (e.g., those that occur inside other macro instantiations) within the detailed preprocessing record. Many clients (e.g., those that only care about visible tokens) don't care about this information, and in code that uses preprocessor metaprogramming, this information can have a very high cost. Addresses <rdar://problem/9389320>. llvm-svn: 130990
* ASTUnit::LoadFromASTFile(): recover the resources from an ASTReader if it ↵Ted Kremenek2011-05-041-0/+10
| | | | | | crashes during PCH validation. llvm-svn: 130886
* Introduce ASTUnit::LoadFromCompilerInvocationAction that allows one to ↵Argyrios Kyrtzidis2011-05-031-0/+113
| | | | | | | | | create an ASTUnit from a CompilerInvocation along with an ASTFrontendAction to invoke, and without all the goo about the precompiled preamble. llvm-svn: 130805
* Move Driver::createInvocationFromArgs function to Frontend library to avoid ↵Argyrios Kyrtzidis2011-04-041-1/+1
| | | | | | | | dependency cycle between libFrontend and libDriver. llvm-svn: 128852
* Introduce Driver::createInvocationFromArgs used to create a ↵Argyrios Kyrtzidis2011-04-041-52/+4
| | | | | | CompilerInvocation from command-line args. llvm-svn: 128848
* switch a few Driver APIs to use llvm::ArrayRef, cleaning up code.Chris Lattner2011-03-231-4/+2
| | | | llvm-svn: 128142
* std::vector::data() is not portable to VS. Use a gross hack instead.Ted Kremenek2011-03-231-1/+3
| | | | llvm-svn: 128138
* Rework crash recovery cleanup in ASTUnit and CIndex to recover more memory ↵Ted Kremenek2011-03-221-25/+46
| | | | | | | | during a Sema crash (we have just a handful of leaks left) and to use the simplified cleanup registration API. llvm-svn: 128059
* Improve crash recovery cleanup to recovery CompilerInstances during crash ↵Ted Kremenek2011-03-211-64/+53
| | | | | | | | | | recovery. This was a huge resource "root" during crashes. This change requires making a bunch of fundamental Clang structures (optionally) reference counted to allow correct ownership semantics of these objects (e.g., ASTContext) to play out between an active ASTUnit and CompilerInstance object. llvm-svn: 128011
* Use CrashRecoveryContextCleanup objects to reclaim resources from ↵Ted Kremenek2011-03-211-72/+90
| | | | | | CompilerInstance objects. llvm-svn: 128009
* Use the newly added FileManager::getNoncachedStatValue when trying to ↵Anders Carlsson2011-03-181-2/+2
| | | | | | determine if any files in the preamble have changed. llvm-svn: 127894
* Correctly store and keep track of the FileSystemOptions in ASTUnit and in ↵Anders Carlsson2011-03-181-4/+6
| | | | | | clang_codeCompleteAt. llvm-svn: 127890
* Use CrashRecoveryContextCleanup objects to recover an ASTUnit if we crash in ↵Ted Kremenek2011-03-181-0/+18
| | | | | | ASTUnit::LoadFromCommandLine() and ASTUnit::LoadFromCompilerInvocation(). llvm-svn: 127851
* Introduce '-chain-include' option to specify headers that will be converted ↵Argyrios Kyrtzidis2011-03-091-5/+28
| | | | | | | | | | to chained PCHs in memory without having to use multiple runs and intermediate files. Intended for testing & debugging of chained PCH. llvm-svn: 127339
* Add 'OverridenFilesKeepOriginalName' field in SourceManager which if true ↵Argyrios Kyrtzidis2011-03-081-0/+3
| | | | | | | | | | | the SourceManager should report the original file name for contents of files that were overriden by other files, otherwise it should report the name of the new file. Default is true. Also add similar field in PreprocessorOptions and pass similar parameter in ASTUnit::LoadFromCommandLine. llvm-svn: 127289
* Allow passing '-###' to ASTUnit::LoadFromCommandLine to print out the cc1 ↵Argyrios Kyrtzidis2011-03-071-0/+8
| | | | | | options. llvm-svn: 127183
* Currently we can only remap a file by creating a MemoryBuffer and replacing ↵Argyrios Kyrtzidis2011-03-051-25/+75
| | | | | | | | | the file contents with it. Allow remapping a file by specifying another filename whose contents should be loaded if the original file gets loaded. This allows to override files without having to create & load buffers in advance. llvm-svn: 127052
* Introduce OwnsRemappedFileBuffers field in ASTUnit, indicating whether the ↵Argyrios Kyrtzidis2011-03-051-1/+2
| | | | | | ASTUnit should delete the remapped buffers. llvm-svn: 127051
* Preserve what the user passed to -include when emitting .d files. Fixes PR8974!Nick Lewycky2011-02-231-1/+2
| | | | llvm-svn: 126334
* When code-completing a case statement for a switch on a value ofDouglas Gregor2011-02-181-2/+3
| | | | | | | enumeration type, prioritize the enumeration constants and don't provide completions for any other expressions. Fixes <rdar://problem/7283668>. llvm-svn: 125991
* Teach the CXCodeCompleteResults results structure, which storesDouglas Gregor2011-02-161-5/+6
| | | | | | | | | code-completion results accessed via libclang, to extend the lifetime of the allocator used for cached global code-completion results at least until these completion results are destroyed. Fixes <rdar://problem/8997369>. llvm-svn: 125678
* Improve the invalidation logic for the cache of global codeDouglas Gregor2011-02-161-21/+98
| | | | | | | | completions. We now compute a hash of the names of all top-level declarations and macro definitions, and invalidate the cache when the hash value changes. llvm-svn: 125670
* Allow resolving headers from a PCH even after headers+PCH were moved to ↵Argyrios Kyrtzidis2011-02-151-3/+5
| | | | | | | | | | | another path. Store in PCH the directory that the PCH was originally created in. If a header file is not found at the path that we expect it to be and the PCH file was moved from its original location, try to resolve the file by assuming that header+PCH were moved together and the header is in the same place relative to the PCH. llvm-svn: 125576
* Rename the operation that loads a preprocessed entity from a given offset to ↵Douglas Gregor2011-02-111-1/+2
| | | | | | indicate that we're loading from an offset, not an index, lest one be confused. No functionality change. llvm-svn: 125394
* Improve our uniquing of file entries when files are re-saved or areDouglas Gregor2011-02-051-0/+2
| | | | | | | | | | | | | | overridden via remapping. Thus, when we create a "virtual" file in the file manager, we still stat() the real file that lives behind it so that we can provide proper uniquing based on inodes. This helps keep the file manager much more consistent. To take advantage of this when reparsing files in libclang, we disable the use of the stat() cache when reparsing or performing code completion, since the stat() cache is very likely to be out of date in this use case. llvm-svn: 124971
* Create a special allocator class for code completion, so that all ofDouglas Gregor2011-02-011-1/+1
| | | | | | | the string copying goes through a single place that can have associated state. llvm-svn: 124698
* Allocate CodeCompletionString and all of its components in aDouglas Gregor2011-02-011-14/+18
| | | | | | | | | | | | BumpPtrAllocator, rather than manually new/delete'ing them. This optimization also allows us to avoid allocating memory for and copying constant strings (e.g., "return", "class"). This also required embedding the priority and availability of results within the code completion string, to avoid extra memory allocation within libclang. llvm-svn: 124673
OpenPOWER on IntegriCloud