summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/ASTUnit.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Teach ASTUnit to save the specified target features, sinceDouglas Gregor2011-01-271-0/+6
| | | | | | | TargetInfo::CreateTargetInfo() mangles the target options in a way that is not idempotent. Fixes <rdar://problem/8807535>. llvm-svn: 124382
* Don't silently drop warning flags passed in toDouglas Gregor2011-01-191-5/+9
| | | | | | clang_createTranslationUnitFromSourceFile(). llvm-svn: 123793
* Gather cached code completions after the first reparse, not after theDouglas Gregor2010-12-091-8/+8
| | | | | | second reparse. llvm-svn: 121413
* Use atomic operations for libclang's object count tracking.Douglas Gregor2010-12-071-3/+4
| | | | llvm-svn: 121073
* When using a precompiled preamble with detailed preprocessing records,Douglas Gregor2010-11-301-2/+68
| | | | | | | | | | trap the serialized preprocessing records (macro definitions, macro instantiations, macro definitions) from the generation of the precompiled preamble, then replay those when walking the list of preprocessed entities. This eliminates a bug where clang_getCursor() wasn't able to find preprocessed-entity cursors in the preamble. llvm-svn: 120396
* Merge System into Support.Michael J. Spencer2010-11-291-2/+2
| | | | llvm-svn: 120297
* When performing code completion within ASTUnit, allocate the ↵Douglas Gregor2010-11-291-6/+6
| | | | | | AugmentedCodeCompleteConsumer on the heap, so it's always cleaned up properly llvm-svn: 120290
* tidy up. Split FileManager::getBufferForFile intoChris Lattner2010-11-231-3/+2
| | | | | | | | | | two copies, since they are fundamentally different operations and the StringRef one should go away (it shouldn't be part of FileManager at least). Remove some dead arguments. llvm-svn: 120013
* now the FileManager has a FileSystemOpts ivar, stop threadingChris Lattner2010-11-231-17/+13
| | | | | | | | | FileSystemOpts through a ton of apis, simplifying a lot of code. This also fixes a latent bug in ASTUnit where it would invoke methods on FileManager without creating one in some code paths in cindextext. llvm-svn: 120010
* give FileManager a 'FileSystemOptions' ivar, which will be usedChris Lattner2010-11-231-3/+3
| | | | | | | to simplify a bunch of code in it. It should ultimately get inlined into FileManager. llvm-svn: 120007
* Partially revert Doug's PCH validation patch (r98585).Chris Lattner2010-11-231-3/+2
| | | | | | | | | | | | | | | | | | | | | | This patch completely defeated the "passing in a prestat'd size to MemoryBuffer" optimization, leading to an extra fstat call for every buffer opened, in order to find out if the datestamp and size of the file on disk matches what is in the stat cache. I fully admit that I don't completely understand what is going on here: why punish code when a stat cache isn't in use? what is the point of a stat cache if you have to turn around and stat stuff to validate it? To resolve both these issues, just drop the modtime check and check the file size, which is the important thing anyway. This should also resolve PR6812, because presumably windows is stable when it comes to file sizes. If the modtime is actually important, we should get it and keep it on the first stat. This eliminates 833 fstat syscalls when processing Cocoa.h, speeding up system time on -Eonly Cocoa.h from 0.041 to 0.038s. llvm-svn: 120001
* Since multiple diagnostics can share one diagnostic client, have the client ↵Argyrios Kyrtzidis2010-11-181-0/+3
| | | | | | | | keeping track of the total number of warnings/errors reported. llvm-svn: 119731
* Fix source-range information for Objective-C properties. Previously,Douglas Gregor2010-11-171-0/+14
| | | | | | | | | | | | we were just getting a range covering only the property name, which is certainly not correct (and broke token annotation, among other things). Also, teach libclang about the relationship between @synthesize/@dynamic and @property, so we get property name and cursor-reference information for @synthesize and @dynamic. llvm-svn: 119409
* 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
OpenPOWER on IntegriCloud