summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/ASTUnit.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Use an OwningPtr for the preamble buffer in ASTUnit. This plugs a leakDouglas Gregor2010-11-161-15/+5
| | | | | | | where we failed to free this buffer along one of the paths, and detangles the code a little. llvm-svn: 119379
* Tweak libclang's heuristics for building precompiled preambles andDouglas Gregor2010-11-151-8/+3
| | | | | | | | caching global code-completion results. In particular, don't perform either operation the first time we parse, but do both after the first reparse. llvm-svn: 119285
* Improve ASTUnit's capture of diagnostics so that theDouglas Gregor2010-11-111-39/+31
| | | | | | | | | | diagnostic-capturing client lives as long as the ASTUnit itself does. Otherwise, we can end up with crashes when we get a diagnostic outside of parsing/code completion. The circumstances under which this happen are really hard to reproduce, because a file needs to change from under us. llvm-svn: 118751
* Simplify code.Benjamin Kramer2010-11-091-28/+10
| | | | llvm-svn: 118619
* Change the StringSet used by CalculateHiddenNames() to use a BumpPtrAllocator.Ted Kremenek2010-11-071-6/+6
| | | | llvm-svn: 118372
* Implement -working-directory.Argyrios Kyrtzidis2010-11-031-8/+25
| | | | | | | | | | | | | | | | | | | When -working-directory is passed in command line, file paths are resolved relative to the specified directory. This helps both when using libclang (where we can't require the user to actually change the working directory) and to help reproduce test cases when the reproduction work comes along. --FileSystemOptions is introduced which controls how file system operations are performed (currently it just contains the working directory value if set). --FileSystemOptions are passed around to various interfaces that perform file operations. --Opening & reading the content of files should be done only through FileManager. This is useful in general since file operations will be abstracted in the future for the reproduction mechanism. FileSystemOptions is independent of FileManager so that we can have multiple translation units sharing the same FileManager but with different FileSystemOptions. Addresses rdar://8583824. llvm-svn: 118203
* Disable some timing codeDouglas Gregor2010-11-011-1/+1
| | | | llvm-svn: 117910
* Simplify ASTUnit's internal timers, by not trying to keep a pile ofDouglas Gregor2010-10-281-66/+64
| | | | | | | | timers to be dumped whenever the ASTUnit is destroyed. Instead, just print the time elapsed for each operation after we perform the operation. llvm-svn: 117550
* Introduce libclang-level options for C++ precompiled preambles,Douglas Gregor2010-10-271-3/+14
| | | | | | separating out chaining precompiled preambles from non-chaining ones. llvm-svn: 117457
* Parse default arguments within member functions in source order, fromDouglas Gregor2010-10-121-0/+1
| | | | | | Manuel Klimek! Fixes PR7715. llvm-svn: 116311
* When we load an ASTUnit from command-line arguments, hold on to theDouglas Gregor2010-10-121-72/+111
| | | | | | | | | diagnostics produced by the driver itself. Previously, we were allowing these to either be dropped or to slip through to stderr. Fixes <rdar://problem/7595339>. llvm-svn: 116285
* Switch c-index-test from clang_codeComplete() over toDouglas Gregor2010-10-111-1/+10
| | | | | | | | | | clang_codeCompleteAt(). This uncovered a few issues with the latter: - ASTUnit wasn't saving/restoring diagnostic state appropriately between reparses and code completions. - "Overload" completions weren't being passed through to the client llvm-svn: 116241
* Fix three related, wily issues with the recompilation of precompiledDouglas Gregor2010-10-081-14/+5
| | | | | | | | | | | | | | | | | | | | | | | preambles: - When we rebuild a precompiled preamble, make sure to disable skipping anything in the main file; we may have had leftover preamble-skipping values in the lexer, which leads to very empty preamble. This is a correctness issue. - When we rebuild a precompiled preamble, clear out any prior state in the Diagnostic object. Otherwise, we might think that there were errors when we were building the preamble itself, and therefore reject the resulting preamble. This is mainly a performance issue. - Don't remove old remappings when digging out the remapping for the main file. Having the old mappings around does not hurt in the common case (later remappings will just overwrite them), and is important when we fail to find a preamble: we don't want to have removed the remapping, because we'll need it later. llvm-svn: 116041
* Don't force spell checking when code-completing. Let the client decideDouglas Gregor2010-10-071-7/+0
| | | | llvm-svn: 115931
* Fix a double-free error that can occur in rare cases where loadingDouglas Gregor2010-10-061-0/+1
| | | | | | | of the precompiled preamble (or any PCH file it depends on) fails during reparsing. llvm-svn: 115838
* Give every file that ASTReader loads a type: module, PCH, precompiled ↵Sebastian Redl2010-10-051-5/+2
| | | | | | preamble or main file. Base Decls' PCHLevel on this to make it more sane. llvm-svn: 115626
* Enable chained precompiled headers for use with precompiled preamblesDouglas Gregor2010-10-011-3/+1
| | | | llvm-svn: 115260
* Remove libclang logging codeDouglas Gregor2010-09-271-32/+2
| | | | llvm-svn: 114836
* When setting the globally-visible declarations for a particularDouglas Gregor2010-09-241-2/+32
| | | | | | | | | | | | | identifier, we may have a Sema object but no translation unit scope (because parsing is finished). In this case, we still need to update the IdResolver, which might still be used when writing a PCH containing another PCH (without chaining). This bug manifested as a failure with precompiled preambles. Also, add a little environment-variable-sensitive logging for libclang. llvm-svn: 114774
* Teach libclang to enable multithreading in LLVM, since libclang clients are ↵Douglas Gregor2010-09-241-0/+3
| | | | | | likely to be multithreaded. Also move the printing of timers to somewhere better for multithreaded libclang clients llvm-svn: 114760
* Synchronize globally-cached code completion results with the resultsDouglas Gregor2010-09-231-4/+6
| | | | | | | | | | | | | | provided when the optimization is disabled. In particular, split the completion context CCC_Other into two contexts: CCC_Other, which means that it's an undisclosed context for which any other results are unwelcome, and CCC_Recovery, which is used in recovery cases. Since we're now using the completion context within the completion results builder, make sure that it's always set to something. Fixes <rdar://problem/8470644>. llvm-svn: 114704
* Tweak priorities for some types and macros:Douglas Gregor2010-09-201-0/+1
| | | | | | | | | | - In Objective-C, we prefer BOOL to bool for historic reasons; slightly penalize "bool". - Treat Nil macro as a NULL pointer constant. - Treat YES, NO, true, and false macros as constants. - Treat the bool macro as a type. llvm-svn: 114356
* Introduce a new code-completion context for a parenthesizedDouglas Gregor2010-09-141-5/+12
| | | | | | | | expression, e.g., after the '(' that could also be a type cast. Here, we provide types as code-completion results in C/Objective-C (C++ already had them), although we wouldn't in a normal expression context. llvm-svn: 113904
* The two libclang crash-recovery tests that involve precompiledDouglas Gregor2010-09-111-0/+7
| | | | | | | | | | preambles end up leaving the precompiled preambles around. This is by design, since we do minimal cleanup during crash recovery. However, it's unfortunate for testing, so introduce a hook that allows these two tests to put the precompiled preamble somewhere where we can delete them after testing. llvm-svn: 113698
* If we fail to create a temporary file for the precompiled preamble,Douglas Gregor2010-09-111-1/+10
| | | | | | | | | just abort creation of the precompiled preamble rather than doing silly things. This is the second part of the fix for the weird preamble-related failures on Windows. Big thanks to Francois Pichet for the great detective work! llvm-svn: 113697
* Tweak GetPreamblePCHPath() to more closely match the behavior of theDouglas Gregor2010-09-111-0/+5
| | | | | | | | Windows GetTempPath() function, and be sure to create the directory in which the precompiled preamble will reside before creating the temporary file itself. llvm-svn: 113695
* Suggest "const" and "volatile" code completions after a functionDouglas Gregor2010-08-271-0/+1
| | | | | | declarator, the very definition of "low-hanging fruit". llvm-svn: 112274
* Implement code completion for @selector expressionsDouglas Gregor2010-08-261-0/+1
| | | | llvm-svn: 112186
* Move the sorting of code-completion results out of the main path andDouglas Gregor2010-08-261-3/+1
| | | | | | | | | | | into the clients, e.g., the printing code-completion consumer and c-index-test. Clients may want to re-sort the results anyway. Provide a libclang function that sorts the results. 3rd try. How embarrassing. llvm-svn: 112180
* Revert r112149, "Move the sorting of code-completion results out of the mainDaniel Dunbar2010-08-261-1/+3
| | | | | | path and ...", it is failing tests. llvm-svn: 112161
* Move the sorting of code-completion results out of the main path andDouglas Gregor2010-08-261-3/+1
| | | | | | | | | into the clients, e.g., the printing code-completion consumer and c-index-test. Clients may want to re-sort the results anyway. Provide a libclang function that sorts the results. llvm-svn: 112149
* Revert "Move the sorting of code-completion results out of the main path andDouglas Gregor2010-08-261-1/+3
| | | | | | | into the clients", because the C standard library sucks. Where's my stable sort, huh? llvm-svn: 112121
* Move the sorting of code-completion results out of the main path andDouglas Gregor2010-08-251-3/+1
| | | | | | | into the clients, e.g., the printing code-completion consumer and c-index-test. Clients may want to re-sort the results anyway. llvm-svn: 112095
* When combining the code-completion results from Sema long with theDouglas Gregor2010-08-251-2/+6
| | | | | | | | code-completion results cached by ASTUnit, sort the resulting result set. This makes testing far, far easier, so this commit also includes tests for the previous few fixes. llvm-svn: 112070
* Add a missing caseDouglas Gregor2010-08-251-0/+1
| | | | llvm-svn: 112065
* Fix an off-by-one error when computing the precompiled preamble forDouglas Gregor2010-08-251-1/+2
| | | | | | | code completion. We were allowing the preamble to include the line that we're code-completing on. Again, testcase is forthcoming. llvm-svn: 112064
* Make the cursor kind of macro-name-only completions produced byDouglas Gregor2010-08-251-1/+4
| | | | | | | ASTUnit match those produced directly by code completion. Test case is forthcoming. llvm-svn: 112063
* Teach Sema to live without CodeCompleteConsumer.h.John McCall2010-08-251-6/+6
| | | | llvm-svn: 112028
* Implement code completion for preprocessor expressions and in macroDouglas Gregor2010-08-241-1/+3
| | | | | | arguments. llvm-svn: 111976
* Implement preprocessor code completion where a macro name is expected,Douglas Gregor2010-08-241-5/+22
| | | | | | | e.g., after #ifdef/#ifndef or #undef, or inside a defined <macroname> expression in a preprocessor conditional. llvm-svn: 111954
* Introduce new libclang API functions that determine the availabilityDouglas Gregor2010-08-231-1/+4
| | | | | | | of a cursor or code-completion result, e.g., whether that result refers to an unavailable, deleted, or deprecated declaration. llvm-svn: 111858
* Don't include macro results when we're completing a declarator.Douglas Gregor2010-08-231-3/+1
| | | | llvm-svn: 111830
* Introduce a new code-completion point when we're parsing aDouglas Gregor2010-08-231-2/+8
| | | | | | | | | declarator. Here, we can only see a few things (e.g., cvr-qualifiers, nested name specifiers) and we do not want to provide other non-macro completions. Previously, we would end up in recovery mode and would provide a large number of non-relevant completions. llvm-svn: 111818
* Abstract out member-pointer creation. I'm really unhappy about the currentJohn McCall2010-08-221-1/+1
| | | | | | | | duplication between the constant and non-constant paths in all of this. Implement ARM ABI semantics for member pointer constants and conversion. llvm-svn: 111772
* When performing code-completion in the presence of a preamble, makeDouglas Gregor2010-08-201-8/+13
| | | | | | | | | sure to (1) actually use the remapped files we were given rather than old data, and (2) keep the remapped files alive until the code-completion results are destroyed. Big thanks to Daniel for the test case. llvm-svn: 111597
* When we decide not to reuse a precompiled preamble, clear out theDouglas Gregor2010-08-201-2/+18
| | | | | | previous precompiled preamble completely. Fixes <rdar://problem/8330950>. llvm-svn: 111590
* Fix a loop overrun in ComputePreamble when the last remapped file was erased,Daniel Dunbar2010-08-191-0/+4
| | | | | | | | and reenable crash recovery test. - Reparsing is still very crashy / weird, so I had to sprinkle random code into the remapped input to get it to do what I want (i.e., crash!). llvm-svn: 111550
* Plug a leak when precompiling the preamble in ASTUnit.Douglas Gregor2010-08-191-7/+21
| | | | llvm-svn: 111504
* Make sure to initialize ASTUnit::UnsafeToFreeDouglas Gregor2010-08-191-1/+2
| | | | llvm-svn: 111490
* Rename the ASTReader header files.Sebastian Redl2010-08-181-1/+1
| | | | llvm-svn: 111474
OpenPOWER on IntegriCloud