aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInstance.cpp
AgeCommit message (Collapse)AuthorFilesLines
2011-07-23remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner1-17/+17
LLVM.h imports them into the clang namespace. llvm-svn: 135852
2011-07-22Switch all of the "isysroot" const char*'s throughout the AST readerDouglas Gregor1-1/+1
and writer to StringRef or std::string, as appropriate. llvm-svn: 135769
2011-07-22Rename ASTReader::PerFileData to serialization::Module, pulling it outDouglas Gregor1-2/+3
of ASTReader so it can become its own full-fledged class (eventually). No functionality change. llvm-svn: 135767
2011-07-21Cut down one open/close pair of system calls by using Path's makeUnique ↵Argyrios Kyrtzidis1-1/+1
instead of createTemporaryFileOnDisk. llvm-svn: 135690
2011-07-19Revamp the SourceManager to separate the representation of parsedDouglas Gregor1-1/+2
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
2011-07-14NestedMacroInstantiations -> NestedMacroExpansionsChandler Carruth1-1/+1
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
2011-06-23avoid using config.h in public headersDylan Noblesmith1-0/+1
This is the only usage in clang's headers, and it's for a define that only exists on CMake builds for the sake of the MSVC compiler, so just use an ifdef instead. Also add an include for config.h in a file that actually needs it, and was picking it up by accident indirectly. llvm-svn: 133710
2011-06-16Raise the ARCMT functionality in Clang into proper FrontendActions.Chandler Carruth1-29/+0
These are somewhat special in that they wrap any other FrontendAction, running various ARC transformations or checks prior to the standard action's run. To implement them easily, this extends FrontendAction to have a WrapperFrontendAction utility class which forwards all calls by default to an inner action setup at construction time. This is then subclassed to override the specific behavior needed by the different ARCMT tools. Finally, FrontendTool is taught how to create these wrapper actions from the existing flags and options structures. The result is that clangFrontend no longer depends on clangARCMigrate. This is very important, as clangARCMigrate *heavily* depends on clangFrontend. Fundamentally ARCMigrate is at the same layer as a library like Rewrite, sitting firmly on top of the Frontend, but tied together with the FrontendTool when building the clang binary itself. llvm-svn: 133161
2011-06-15The ARC Migration Tool. All the credit goes to Argyrios and FariborzJohn McCall1-0/+29
for this. llvm-svn: 133104
2011-05-06Introduce a new libclang parsing flag,Douglas Gregor1-1/+2
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
2011-04-07Frontend/CC_LOG_DIAGNOSTICS: Fix thinko and open diag log in append mode.Daniel Dunbar1-1/+1
llvm-svn: 129103
2011-04-07Fronted/CC_LOG_DIAGNOSTICS: Wire up dwarf-debug-flags support.Daniel Dunbar1-5/+10
llvm-svn: 129095
2011-04-07Frontend: Sketch a LogDiagnosticPrinter object, and wire CC_LOG_DIAGNOSTICS toDaniel Dunbar1-0/+32
it. llvm-svn: 129089
2011-03-21Frontend: Change CC_PRINT_HEADERS to not print header depth markers, these don'tDaniel Dunbar1-1/+2
really make any sense in this environment. llvm-svn: 128014
2011-03-21Improve crash recovery cleanup to recovery CompilerInstances during crash ↵Ted Kremenek1-22/+18
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
2011-03-14Get rid of the static FileManager::FixupRelativePath.Anders Carlsson1-1/+1
llvm-svn: 127573
2011-03-06Convert FileManager::FixupRelativePath over to using PathV2.Anders Carlsson1-9/+12
llvm-svn: 127133
2011-02-19Re-instate r125819 and r125820 with no functionality changePeter Collingbourne1-5/+0
llvm-svn: 126060
2011-02-19Revert 125820 and 125819 to fix PR9266.Rafael Espindola1-0/+5
llvm-svn: 126050
2011-02-18Move CompilerInstance::LLVMContext and LLVMContext ownership to CodeGenActionPeter Collingbourne1-5/+0
This removes the final dependency edge from any lib outside of CodeGen to core. As a result we can, and do, trim the dependency on core from libclang, PrintFunctionNames, the unit tests and c-index-test. While at it, review and trim other unneeded dependencies. llvm-svn: 125820
2011-02-05Improve our uniquing of file entries when files are re-saved or areDouglas Gregor1-2/+5
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
2011-02-02Frontend: Add -header-include-file option, for allowing saving header includeDaniel Dunbar1-0/+6
information to a file. llvm-svn: 124750
2011-02-02Frontend: Factor out header include dumping (-H) into its own preprocessorDaniel Dunbar1-0/+4
callbacks class. - Aside from being generally cleaner, this also allows -H to work correctly in modes other than standard preprocessing (e.g., -c, -MM, etc.) llvm-svn: 124723
2011-01-31Frontend: Add an explicit RemoveFileOnSignal flag argument, to control theDaniel Dunbar1-3/+6
automatic behavior (which is undesirable in a multithreaded context). llvm-svn: 124612
2011-01-10Replace all uses of PathV1::exists with PathV2::fs::exists.Michael J. Spencer1-1/+3
llvm-svn: 123150
2010-12-16MemoryBuffer API update.Michael J. Spencer1-4/+3
llvm-svn: 121956
2010-12-09Use error_code instead of std::string* for MemoryBuffer.Michael J. Spencer1-1/+4
llvm-svn: 121378
2010-11-30When loading a precompiled preamble, use the file ID of theDouglas Gregor1-2/+5
precompiled preamble as the "main" source file's file ID within the source manager. This makes compiling with a precompiled preamble produce the same source locations as when compiling without the precompiled preamble; prior to this change, we ended up with different file IDs for source locations within the precompiled preamble vs. those after the precompiled preamble, even for entities (e.g., preprocessing entities) in the same file. llvm-svn: 120390
2010-11-29Merge System into Support.Michael J. Spencer1-4/+4
llvm-svn: 120297
2010-11-23don't allow remapping PTH file paths with -fworking-directory, theChris Lattner1-1/+1
client should just pass in absolute paths. llvm-svn: 120012
2010-11-23now the FileManager has a FileSystemOpts ivar, stop threadingChris Lattner1-16/+10
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
2010-11-23give FileManager a 'FileSystemOptions' ivar, which will be usedChris Lattner1-1/+1
to simplify a bunch of code in it. It should ultimately get inlined into FileManager. llvm-svn: 120007
2010-11-18Remove the hack where, to get the return status, we had special case for ↵Argyrios Kyrtzidis1-9/+1
VerifyDiagnosticsClient and just check the number of errors from the DiagnosticClient. llvm-svn: 119736
2010-11-18Since multiple diagnostics can share one diagnostic client, have the client ↵Argyrios Kyrtzidis1-3/+4
keeping track of the total number of warnings/errors reported. llvm-svn: 119731
2010-11-18Refactoring of Diagnostic class.Argyrios Kyrtzidis1-1/+2
-Move the stuff of Diagnostic related to creating/querying diagnostic IDs into a new DiagnosticIDs class. -DiagnosticIDs can be shared among multiple Diagnostics for multiple translation units. -The rest of the state in Diagnostic object is considered related and tied to one translation unit. -Have Diagnostic point to the SourceManager that is related with. Diagnostic can now accept just a SourceLocation instead of a FullSourceLoc. -Reflect the changes to various interfaces. llvm-svn: 119730
2010-11-11Improve ASTUnit's capture of diagnostics so that theDouglas Gregor1-5/+9
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
2010-11-03Implement -working-directory.Argyrios Kyrtzidis1-11/+21
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
2010-10-26Add support for code completion on stdin.Dan Gohman1-1/+4
llvm-svn: 117414
2010-10-26Simplify this code: don't check for the same error twoDan Gohman1-4/+6
different ways. Check once, and use an assert to handle consistency checking. llvm-svn: 117397
2010-10-11Eliminate the (de-)serialization of code completion results, now thatDouglas Gregor1-7/+1
libclang does not support out-of-process code completion. llvm-svn: 116253
2010-10-11Eliminate -fdiagnostics-binary and all of the infrastructure forDouglas Gregor1-33/+1
emitting diagnostics in a binary form to be consumed by libclang, since libclang no longer does any of its work out-of-process, making this code dead. Besides, this stuff never worked at 100% anyway. llvm-svn: 116250
2010-10-11Tighten up constness of argv parameters to allow for string literals as ↵Axel Naumann1-3/+3
argumants and to reflect actual (non-modifying) use. llvm-svn: 116199
2010-10-05Give every file that ASTReader loads a type: module, PCH, precompiled ↵Sebastian Redl1-3/+7
preamble or main file. Base Decls' PCHLevel on this to make it more sane. llvm-svn: 115626
2010-09-17Use a temporary file for output which gets renamed after all the writing is ↵Argyrios Kyrtzidis1-14/+52
finished. This mainly prevents failures and/or crashes when multiple processes try to read/write the same PCH file. (rdar://8392711&8294781); suggestion & review by Daniel! llvm-svn: 114187
2010-08-27createMainFileID doesn't need its IncludePos argument, sinceDan Gohman1-1/+1
the main file isn't an included file, and the IncludePos is always SourceLocation(). llvm-svn: 112269
2010-08-18Rename the ASTReader header files.Sebastian Redl1-1/+1
llvm-svn: 111474
2010-08-18Rename various classes from PCH to AST.Sebastian Redl1-2/+2
llvm-svn: 111471
2010-08-18Rename PCHReader to ASTReader.Sebastian Redl1-5/+5
llvm-svn: 111467
2010-08-18Simplify the ownership model for DiagnosticClients, which was reallyDouglas Gregor1-14/+5
convoluted and a bit leaky. Now, the Diagnostic object owns its DiagnosticClient. llvm-svn: 111437
2010-08-17Reintroduce the serialization library, with fixed dependencies.Sebastian Redl1-1/+1
llvm-svn: 111279