summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/ASTUnit.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* - Make ObjCInterfaceDecl redeclarable, and create separate decl nodes for ↵Sebastian Redl2010-08-091-0/+3
| | | | | | | | | | forward declarations and the definition. - Eagerly create ObjCInterfaceTypes for declarations. - The two above changes lead to a 0.5% increase in memory use and no speed regression when parsing Cocoa.h. On the other hand, now chained PCH works when there's a forward declaration in one PCH and the interface definition in another. - Add HandleInterestingDecl to ASTConsumer. PCHReader passes the "interesting" decls it finds to this function instead of HandleTopLevelDecl. The default implementation forwards to HandleTopLevelDecl, but ASTUnit's handler for example ignores them. This fixes a potential crash when lazy loading of PCH data would cause ASTUnit's "top level" declaration collection to change while being iterated. llvm-svn: 110610
* Use precompiled preambles for in-process code completion.Douglas Gregor2010-08-091-12/+91
| | | | llvm-svn: 110596
* Add an environment variable that makes libclang use chaining for PCH.Sebastian Redl2010-08-061-1/+3
| | | | llvm-svn: 110414
* Give clang_codeCompleteAt() an "options" parameter, and add a newDouglas Gregor2010-08-051-3/+11
| | | | | | | | | flags enumeration + default-generating function that allows code-completion to be customized via the libclang API. Plus, turn on spell-checking when performing code completion. llvm-svn: 110319
* When performing in-process code completion, don't free the remappedDouglas Gregor2010-08-041-0/+1
| | | | | | | file buffers until the code completion results are destroyed; diagnostics may end up referring into the source. llvm-svn: 110216
* Add code-completion support directly to ASTUnit, which performs codeDouglas Gregor2010-08-041-16/+102
| | | | | | | | | | | | | | completion within the translation unit using the same command-line arguments for parsing the translation unit. Eventually, we'll reuse the precompiled preamble to improve code-completion performance, and this also gives us a place to cache results. Expose this function via the new libclang function clang_codeCompleteAt(), which performs the code completion within a CXTranslationUnit. The completion occurs in-process (clang_codeCompletion() runs code completion out-of-process). llvm-svn: 110210
* When we try (but fail) to build a precompiled preamble, wait for aDouglas Gregor2010-08-041-8/+31
| | | | | | | | | short "cooling off" period (defaulting to 5 reparses) before trying to build a precompiled preamble again. Previously, if we failed to build the precompiled preamble at any time, we just gave up the whole charade any never tried again. llvm-svn: 110187
* When using a precompiled preamble, keep track of the top-levelDouglas Gregor2010-08-031-7/+47
| | | | | | | | | | declarations that we saw when creating the precompiled preamble, and provide those declarations in addition to the declarations parsed in the main source file when traversing top-level declarations. This makes the use of precompiled preambles a pure optimization, rather than changing the semantics of the parsed translation unit. llvm-svn: 110131
* Reshuffle the PCH generator action and consumer, so that we can re-useDouglas Gregor2010-08-031-3/+52
| | | | | | it while generating precompiled preambles. No functionality change. llvm-svn: 110108
* When using a precompiled preamble, save the diagnostics produced whenDouglas Gregor2010-08-021-15/+41
| | | | | | | | creating the preamble and "replay" them when reusing the preamble. Also, fix a thinko in the copying of the preamble when building the precompiled preamble. llvm-svn: 110061
* Implement dependency analysis for the precompiled preamble. If any ofDouglas Gregor2010-07-311-14/+91
| | | | | | | the files in the precompiled preamble have changed since it was build, force the preamble to be rebuilt. llvm-svn: 109937
* Add some timers to ASTUnit that are only enabled when the LIBCLANG_TIMING ↵Douglas Gregor2010-07-301-15/+55
| | | | | | environment variable is set. llvm-svn: 109890
* Turn off precompiled preamble support for C++Douglas Gregor2010-07-281-1/+2
| | | | llvm-svn: 109680
* Fix use-after-free with precompiled preamblesDouglas Gregor2010-07-271-3/+9
| | | | llvm-svn: 109505
* Implement -fno-validate-pch at the -cc1 level, which suppresses mostDouglas Gregor2010-07-271-2/+7
| | | | | | | | | | | | | | | of the usual consistency checks used to determine when a precompiled header is incompatible with the translation unit it's being loaded into. Enable this option when loading a precompiled preamble, because the preamble loader will be performing all of this checking itself. Enable the preamble-based test now that it's working. This option is also useful for debugging Clang's PCH (<rdar://problem/7532213>). llvm-svn: 109475
* Introduce basic support for loading a precompiled preamble whileDouglas Gregor2010-07-261-16/+56
| | | | | | | | | | | | | | | | | | | | | | | reparsing an ASTUnit. When saving a preamble, create a buffer larger than the actual file we're working with but fill everything from the end of the preamble to the end of the file with spaces (so the lexer will quickly skip them). When we load the file, create a buffer of the same size, filling it with the file and then spaces. Then, instruct the lexer to start lexing after the preamble, therefore continuing the parse from the spot where the preamble left off. It's now possible to perform a simple preamble build + parse (+ reparse) with ASTUnit. However, one has to disable a bunch of checking in the PCH reader to do so. That part isn't committed; it will likely be handled with some other kind of flag (e.g., -fno-validate-pch). As part of this, fix some issues with null termination of the memory buffers created for the preamble; we were trying to explicitly NULL-terminate them, even though they were also getting implicitly NULL terminated, leading to excess warnings about NULL characters in source files. llvm-svn: 109445
* Make ASTContext always use the BumpPtrAllocator.Douglas Gregor2010-07-251-1/+0
| | | | llvm-svn: 109375
* Put a newline at the end of the padded buffers used for theDouglas Gregor2010-07-241-4/+6
| | | | | | | precompiled preamble. This will suppress the -pedantic "no newline at end of file" warning. llvm-svn: 109301
* Once we've built (or reused) a precompiled preamble, create theDouglas Gregor2010-07-241-31/+45
| | | | | | | | appropriately-padded main file buffer (that has spaces in the extra "reserved" space) and thread that buffer through to the parsing function. This still does nothing. llvm-svn: 109299
* Once we've built a precompiled preamble, keep track of the details ofDouglas Gregor2010-07-231-42/+164
| | | | | | | | | | | | that preamble (the preamble text, preamble file, reserved main file size). Check these details when we try to rebuild the precompiled preamble, and when nothing has changed, re-use the precompiled preamble. This code is still very much a WIP, and can't even properly be tested because we have no way to use the precompiled preamble yet. "Trust me" llvm-svn: 109294
* Fix build on Ubuntu 10.04.Zhongxing Xu2010-07-231-0/+1
| | | | llvm-svn: 109208
* Basic plumbing for generating a precompiled preamble for anDouglas Gregor2010-07-231-4/+197
| | | | | | | ASTUnit/CXTranslationUnit. We can't actually use this preamble yet, however. llvm-svn: 109202
* Introduce a new libclang API, clang_reparseTranslationUnit(), whichDouglas Gregor2010-07-191-50/+102
| | | | | | | | reparses an already-parsed translation unit. At the moment it's just a convenience function, but we hope to use it for performance optimizations. llvm-svn: 108756
* Driver: Change the driver to take the path to the main executable, instead ofDaniel Dunbar2010-07-191-1/+1
| | | | | | | | | taking it in pieces. - Fixes a problem where the Clang executable path was not initialized properly on Win32, because sys::Path::getBasename() doesn't do what I always think it does. Imagine that, a sys::Path interface that is confusing! llvm-svn: 108667
* There is another implementation of PCHReaderListener around. Update it to ↵Sebastian Redl2010-07-141-3/+5
| | | | | | the new interface. llvm-svn: 108377
* Add an option to specify the target C++ ABI to the frontend. Use it toCharles Davis2010-06-111-0/+1
| | | | | | select either the default Itanium ABI or the new, experimental Microsoft ABI. llvm-svn: 105804
* Frontend: Add FrontendAction support for handling LLVM IR inputs.Daniel Dunbar2010-06-071-0/+2
| | | | | | - These inputs follow an abbreviated execution path, but are still worth handling by FrontendAction so they reuse all the other clang -cc1 features. llvm-svn: 105582
* Frontend: Move some initialization from CompilerInstance to FrontendAction, ↵Daniel Dunbar2010-06-071-3/+0
| | | | | | to parallel what is done for AST inputs. llvm-svn: 105579
* Frontend: Change FrontendAction::BeginSourceFile to take the input kind ↵Daniel Dunbar2010-06-071-1/+1
| | | | | | instead of an IsAST bool. llvm-svn: 105578
* Frontend: Lift InputKind enumeration to top level.Daniel Dunbar2010-06-071-1/+1
| | | | llvm-svn: 105577
* Workaround: Don't add ObjCMethodDecls to the vector of TopLevelDecls since ↵Ted Kremenek2010-05-031-2/+10
| | | | | | | | | they don't go in the DeclContext for the translation unit. This is to workaround a fundamental issue in how ObjC decls (within an @implementation) are parsed before the ObjCContainerDecl is available. llvm-svn: 102944
* Fix -Wcast-qual warnings.Dan Gohman2010-04-191-2/+4
| | | | llvm-svn: 101786
* Make Diagnostic reference-counted, which is simpler than jugglingDouglas Gregor2010-04-051-16/+11
| | | | | | maybe-ownership vs. ownership. llvm-svn: 100498
* Clarify the ownership semantics of the Diagnostic object used byDouglas Gregor2010-04-051-23/+52
| | | | | | | | | ASTUnit. Previously, we would end up with use-after-free errors because the Diagnostic object would be creating in one place (say, CIndex) and its ownership would not be transferred into the ASTUnit. Fixes <rdar://problem/7818608>. llvm-svn: 100464
* Minor ASTUnit cleanups:Douglas Gregor2010-04-051-3/+5
| | | | | | | | - Rename "Diagnostics" and related to "StoredDiagnostics", to better capture what we're actually storing. - Move SourceManager and FileManager to the heap. llvm-svn: 100441
* Driver: Add support for a CLANGXX_IS_PRODUCTION build variable, which enableDaniel Dunbar2010-04-011-1/+1
| | | | | | Clang++ support, even in "Production" mode (for testing purposes). llvm-svn: 100119
* Optionally store a PreprocessingRecord in the preprocessor itself, andDouglas Gregor2010-03-191-15/+3
| | | | | | tie its creation to a CC1 flag -detailed-preprocessing-record. llvm-svn: 98963
* Introduce the notion of a "preprocessing record", which keeps track ofDouglas Gregor2010-03-181-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | the macro definitions and macro instantiations that are found during preprocessing. Preprocessing records are *not* generated by default; rather, we provide a PPCallbacks subclass that hooks into the existing callback mechanism to record this activity. The only client of preprocessing records is CIndex, which keeps track of macro definitions and instantations so that they can be exposed via cursors. At present, only token annotation uses these facilities, and only for macro instantiations; both will change in the near future. However, with this change, token annotation properly annotates macro instantiations that do not produce any tokens and instantiations of macros that are later undef'd, improving our consistency. Preprocessing directives that are not macro definitions are still handled by clang_annotateTokens() via re-lexing, so that we don't have to track every preprocessing directive in the preprocessing record. Performance impact of preprocessing records is still TBD, although it is limited to CIndex and therefore out of the path of the main compiler. llvm-svn: 98836
* Don't "take" the file manager and source manager whenDouglas Gregor2010-03-171-2/+0
| | | | | | | ASTUnit::LoadFromCompilerInvocation() fails to create target information. llvm-svn: 98697
* Make sure we actually override ReadHeaderFileInfo when we meant toDouglas Gregor2010-03-161-1/+1
| | | | llvm-svn: 98655
* Give SourceManager a Diagnostic object with which to report errors,Douglas Gregor2010-03-161-4/+5
| | | | | | and start simplifying the interfaces in SourceManager that can fail. llvm-svn: 98594
* The Windows build is just too weird; there's no real cost to doing the ↵Douglas Gregor2010-03-051-2/+0
| | | | | | concurrency checks for ASTUnit in all builds llvm-svn: 97840
* Switch from NDEBUG to _DEBUG, since our Windows build is funnyDouglas Gregor2010-03-051-1/+1
| | | | llvm-svn: 97835
* A little hack to identify unwanted concurrency in CIndexDouglas Gregor2010-03-051-1/+4
| | | | llvm-svn: 97831
* When given unsaved files in clang_createTranslationUnitFromSourceFile,Douglas Gregor2010-02-271-0/+1
| | | | | | | | | | copy the source buffers provided rather than referencing them directly, so that the caller can free those buffers immediately after calling clang_createTranslationUnitFromSourceFile(). Otherwise, we risk hitting those buffers later (when building source ranges, forming diagnostics, etc.). llvm-svn: 97296
* Teach ASTUnit to keep track of temporary files, then delete them whenDouglas Gregor2010-02-181-3/+3
| | | | | | the ASTUnit itself is destroyed. Fixes <rdar://problem/7649385>. llvm-svn: 96628
* Rework how CIndex handles diagnostics. Rather than using a callback,Douglas Gregor2010-02-181-7/+62
| | | | | | | | | | | | | | | | | | we attach diagnostics to translation units and code-completion results, so they can be queried at any time. To facilitate this, the new StoredDiagnostic class stores a diagnostic in a serializable/deserializable form, and ASTUnit knows how to capture diagnostics in this stored form. CIndex's CXDiagnostic is a thin wrapper around StoredDiagnostic, providing a C interface to stored or de-serialized diagnostics. I've XFAIL'd one test case temporarily, because currently we end up storing diagnostics in an ASTUnit that's never returned to the user (because it contains errors). I'll introduce a temporary fix for this soon; the real fix will be to allow us to return and query invalid ASTs. llvm-svn: 96592
* ASTUnit: Constant fold UseBumpAllocator to true, we don't care to support ↵Daniel Dunbar2010-02-161-5/+3
| | | | | | this as an argument. llvm-svn: 96316
* ASTUnit::LoadFromCompilerInvocation - Take ownership of the provided invocation.Daniel Dunbar2010-02-161-7/+4
| | | | llvm-svn: 96315
* ASTUnit: Ensure the CompilerInvocation object used in LoadFromCommandLine isDaniel Dunbar2010-01-301-7/+12
| | | | | | | | | live as long as the ASTUnit. This is useful for clients which want to maintain pointers to the LangOptions object which ultimately lives in the CompilerInvocation, although it would be nice to make all of this ownership stuff more explicit and obvious. llvm-svn: 94924
OpenPOWER on IntegriCloud