summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/ASTUnit.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* PCHReader doesn't implement classof so dyn_casting it will do really weird ↵Benjamin Kramer2010-01-301-1/+1
| | | | | | | | stuff. Use a static_cast instead. I don't know if this hack is the right fix. Doug, please take a look. llvm-svn: 94895
* ASTUnit: Don't check that input files exist when parsing ASTs from the commandDaniel Dunbar2010-01-251-0/+4
| | | | | | | line -- they may be remapped (fake) files. This is useful for testing parsing entirely from memory. llvm-svn: 94395
* Extend clang_createTranslationUnitFromSourceFile() to support creatingDouglas Gregor2010-01-231-2/+30
| | | | | | translation units that include unsaved files. llvm-svn: 94258
* Add -resource-dir to clang -cc1, this allows the base directory for compilerDaniel Dunbar2009-12-151-4/+2
| | | | | | | resources (e.g., /usr/lib/clang/1.1) to be passed on the command line instead of computed. llvm-svn: 91370
* Lift builtin-include-path logic out of ASTUnit::LoadFromCommandLine and fix ↵Daniel Dunbar2009-12-131-10/+7
| | | | | | CIndex to pass in the right directory (previously it was using the path to the main executable, which generally is wrong). llvm-svn: 91238
* CompilerInvocation: Move builtin-include-path logic out of ↵Daniel Dunbar2009-12-131-1/+7
| | | | | | CompilerInvocation::CreateFromArgs. llvm-svn: 91237
* Remove several .c_str() to be forward-compatible with StringRef.Jeffrey Yasskin2009-12-081-2/+2
| | | | llvm-svn: 90822
* ASTUnit/CIndex: Explicitly track the top-level decls when using an ASTUnit madeDaniel Dunbar2009-12-041-6/+24
| | | | | | | | from a source file. - This allows CIndex to avoid iterating over all the top-level decls when using a PCH, which means we deserialize far fewer decls. llvm-svn: 90559
* Fix ASTUnit to allows require a (persistent) Diagnostic object be provided; ↵Daniel Dunbar2009-12-031-18/+8
| | | | | | propogate and simplify. llvm-svn: 90379
* ASTUnit: Explicitly track whether the ASTUnit came from an actual AST or not.Daniel Dunbar2009-12-021-4/+7
| | | | llvm-svn: 90349
* ASTUnit: Fix initialization of OnlyLocalDecls variable, and honor ↵Daniel Dunbar2009-12-021-4/+4
| | | | | | UseBumpAllocator. llvm-svn: 90348
* Fix ASTUnit::getOriginalSourceFileName() when using ASTUnit's derived fromDaniel Dunbar2009-12-021-1/+6
| | | | | | source files. llvm-svn: 90311
* ASTUnit: Don't create an LLVMContext, it shouldn't be needed.Daniel Dunbar2009-12-021-2/+1
| | | | llvm-svn: 90310
* Add ASTUnit::LoadFromCommandLine, which creates an ASTUnit out of a list ofDaniel Dunbar2009-12-021-0/+55
| | | | | | | | | | | | | | (clang/driver) command line arguments (including the source file). - The arguments are expected to include the source file. - The idea is that even though this is a somewhat odd API, its the form which many tools can most easily use (for example, by interposing with the compiler). Also, switch index-test's -ast-from-source to use this entry point, and provide a -arg command line argument which can be used to test that the command line arguments are handled correctly. llvm-svn: 90288
* ASTUnit: Make sure to preserve the TargetInfo for later use.Daniel Dunbar2009-12-011-2/+3
| | | | llvm-svn: 90263
* Add ASTUnit::LoadFromCompilerInvocation, which does what it says.Daniel Dunbar2009-12-011-4/+95
| | | | | | | Also, add an -ast-from-source option to index-test which allows index-test to run on source files directly. llvm-svn: 90223
* Remove VISIBILITY_HIDDEN from anonymous namespaces in libFrontend.Benjamin Kramer2009-11-281-2/+1
| | | | llvm-svn: 90033
* Add TargetOptions and use it when constructing targets.Daniel Dunbar2009-11-151-1/+9
| | | | | | | | - This ended up being hard to factor, sorry for the large diff. - Some post-commit cleanup to come. llvm-svn: 88833
* Redo how PCH handles its implicit include. Instead of treating this specially inDaniel Dunbar2009-11-111-0/+1
| | | | | | | | | | | | | | | the front-end (as far as the preprocessor goes), follow the usual logic of inserting the (original include path) name into the predefines buffer. This pushes the responsibility for handling this to PCH instead of the front-end. In PCH this requires being a little more clever when we diff the predefines buffers. Neither of these solutions are particularly great, I think what we eventually should do is something like gcc where we insert a special marker to indicate the PCH file, but then run the preprocessor as usual. This would be clearer and would allow us to drop the overly clever predefines handling. llvm-svn: 86806
* StringRefify some PCH interfaces.Daniel Dunbar2009-11-111-3/+2
| | | | llvm-svn: 86775
* The constructor for ASTUnit now takes a DiagnosticClient*, allowing uses of ↵Ted Kremenek2009-10-191-4/+9
| | | | | | | | | | | | | | ASTUnit to specify alternate DiagnosticClients. To match this API, ASTUnit::LoadFromPCHFile() now takes a corresponding DiagnosticClient* argument as well. The DiagnosticClient object is destroyed when the ASTUnit object is destroyed. The CIndex library now uses this API to create a 'IgnoreDiagnosticsClient' that simply silences diagnostics when using the clang_createTranslationUnitFromSourceFile() function. This fixes <rdar://problem/7312058>. This API can change in the future as we add more flexibility for clients. llvm-svn: 84539
* Move Diagnostic/DiagClient/FileManager from Indexer => ASTUnit.Steve Naroff2009-10-191-10/+6
| | | | | | Removing this shared data should enable clang_createTranslationUnit/clang_createTranslationUnitFromSourceFile to be run from multiple threads (related to <rdar://problem/7303432>). llvm-svn: 84499
* Use sys::Path::eraseFromDisk instead of unlink as suggested by Chris.Benjamin Kramer2009-10-181-1/+2
| | | | llvm-svn: 84415
OpenPOWER on IntegriCloud