summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/FrontendAction.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [libclang] Allow building a precompiled preamble with compiler errorsArgyrios Kyrtzidis2013-06-111-3/+7
| | | | | | | | | | | A while ago we allowed libclang to build a PCH that had compiler errors; this was to retain the performance afforded by a PCH even if the user's code is in an intermediate state. Extend this for the precompiled preamble as well. rdar://14109828 llvm-svn: 183717
* [frontend] Make -chain-include work when used with modules.Argyrios Kyrtzidis2013-04-261-0/+2
| | | | llvm-svn: 180633
* [Preprocessor] Remove PPMutationListener.Argyrios Kyrtzidis2013-03-271-2/+0
| | | | | | It's not used anymore. llvm-svn: 178106
* [frontend] Initialize the diagnostic client before loading an ast file.Argyrios Kyrtzidis2013-03-181-0/+4
| | | | | | | Issue reported by Tom Honermann! http://llvm.org/bugs/show_bug.cgi?id=15377 llvm-svn: 177336
* [frontend] Don't put a PCH/PTH filename into the set of includes in the ↵Argyrios Kyrtzidis2013-02-051-10/+2
| | | | | | | | | | | | | preprocessor options; since only one of them is allowed in command-line, process them separately. Otherwise, if more than one is specified in the command-line, one is processed normally and the others are going to be treated and included as header files. Related to radar://13140508 llvm-svn: 174385
* Rename the -cc1 option "-generate-module-index" toDouglas Gregor2013-01-251-4/+3
| | | | | | | "-fmodules-global-index" and expand its behavior to include both the use and generation of the global module index. llvm-svn: 173404
* Implement the writer side of the global module index. Douglas Gregor2013-01-231-0/+11
| | | | | | | | | | | | | | | | | | | | The global module index is a "global" index for all of the module files within a particular subdirectory in the module cache, which keeps track of all of the "interesting" identifiers and selectors known in each of the module files. One can perform a fast lookup in the index to determine which module files will have more information about entities with a particular name/selector. This information can help eliminate redundant lookups into module files (a serious performance problem) and help with creating auto-import/auto-include Fix-Its. The global module index is created or updated at the end of a translation unit that has triggered a (re)build of a module by scraping all of the .pcm files out of the module cache subdirectory, so it catches everything. As with module rebuilds, we use the file system's atomicity to synchronize. llvm-svn: 173301
* Documentation cleanup: fixing documentation for FrontendAction.James Dennett2013-01-231-3/+3
| | | | | | | | | | | | | | * Fix a typo, s/BeginSourceAction/BeginSourceFile/, so that the documentation for FrontendAction::BeginSourceFileAction links correctly to BeginSourceFile; * Add some basic \file documentation for FrontendAction.h; * More use of "\brief" instead of repeating the name of the entity being documented; * Stop using Doxygen-style "///" comments in FrontendAction.cpp, as they were polluting the documentation for BeginSourceFile; * Drop incorrect "\see" markup that broke Doxygen's formatting; * Other minor documentation fixes. llvm-svn: 173213
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-3/+3
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Turn FrontendInputFile into an immutable class and have it also acceptArgyrios Kyrtzidis2012-11-091-9/+10
| | | | | | a memory buffer instead of only a filename. llvm-svn: 167627
* Make CompilerInstance::InitializeSourceManager accept a FrontendInputFile,Argyrios Kyrtzidis2012-11-091-4/+1
| | | | | | no functionality change. llvm-svn: 167626
* [PCH] Remove the stat cache from the PCH file.Argyrios Kyrtzidis2012-10-311-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The stat cache became essentially useless ever since we started validating all file entries in the PCH. But the motivating reason for removing it now is that it also affected correctness in this situation: -You have a header without include guards (using "#pragma once" or #import) -When creating the PCH: -The same header is referenced in an #include with different filename cases. -In the PCH, of course, we record only one file entry for the header file -But we cache in the PCH file the stat info for both filename cases -Then the source files are updated and the header file is updated in a way that its size and modification time are the same but its inode changes -When using the PCH: -We validate the headers, we check that header file and we create a file entry with its current inode -There's another #include with a filename with different case than the previously created file entry -In order to get its stat info we go through the cached stat info of the PCH and we receive the old inode -because of the different inodes, we think they are different files so we go ahead and include its contents. Removing the stat cache will potentially break clients that are attempting to use the stat cache as a way of avoiding having the actual input files available. If that use case is important, patches are welcome to bring it back in a way that will actually work correctly (i.e., emit a PCH that is self-contained, coping with literal strings, line/column computations, etc.). This fixes rdar://5502805 llvm-svn: 167172
* Teach the PCH validator to check the preprocessor options, especiallyDouglas Gregor2012-10-241-1/+2
| | | | | | | | | | | | | | | the macros that are #define'd or #undef'd on the command line. This checking happens much earlier than the current macro-definition checking and is far cleaner, because it does a direct comparison rather than a diff of the predefines buffers. Moreover, it allows us to use the result of this check to skip over PCH files within a directory that have non-matching -D's or -U's on the command line. Finally, it improves the diagnostics a bit for mismatches, fixing <rdar://problem/8612222>. The old predefines-buffer diff'ing will go away in a subsequent commit. llvm-svn: 166641
* If the precompiled header named by "-include" is actually a directory,Douglas Gregor2012-10-231-2/+43
| | | | | | | | | check each of the files within that directory to determine if any of them is an AST file that matches the language and target options. If so, the first matching AST file is loaded. This fixes a longstanding discrepency with GCC's precompiled header implementation. llvm-svn: 166469
* Delete temporary output files when an error occurs during PCH reading.Benjamin Kramer2012-10-141-0/+1
| | | | | | | | This reduces the spam make test leaves behind in /tmp. The assert isn't particularly useful because it's not run with -disable-free (the default when using the clang driver) but should cover all -cc1 tests. llvm-svn: 165910
* Rework the (de-)serialization of macros, as stored inDouglas Gregor2012-10-091-1/+3
| | | | | | | | | | | | | | | | MacroInfo*. Instead of simply dumping an offset into the current file, give each macro definition a proper ID with all of the standard modules-remapping facilities. Additionally, when a macro is modified in a subsequent AST file (e.g., #undef'ing a macro loaded from another module or from a precompiled header), provide a macro update record rather than rewriting the entire macro definition. This gives us greater consistency with the way we handle declarations, and ties together macro definitions much more cleanly. Note that we're still not actually deserializing macro history (we never were), but it's far easy to do properly now. llvm-svn: 165560
* Make sure to call EndSourceFile even if we can't continue compiling.Jordan Rose2012-08-101-1/+5
| | | | | | Patch by Andy Gibbs! llvm-svn: 161649
* [libclang] Don't crash when saving a PCH from a prefix headerArgyrios Kyrtzidis2012-06-081-2/+4
| | | | | | | | that does not exist. rdar://11607033 llvm-svn: 158193
* Fix indenting.David Blaikie2012-05-291-25/+25
| | | | llvm-svn: 157628
* Added a flag to the parser to skip method bodies.Erik Verbruggen2012-04-121-1/+2
| | | | llvm-svn: 154584
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-1/+1
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* [PCH] Mark a PCH file with a flag to indicate if the serialized AST hadArgyrios Kyrtzidis2012-03-071-0/+1
| | | | | | | | | | | | | | | | compiler errors or not. -Control whether ASTReader should reject such a PCH by a boolean flag at ASTReader's creation time. By default, such a PCH file will be rejected with an error when trying to load it. [libclang] Allow clang_saveTranslationUnit to create a PCH file even if compiler errors occurred. -Have libclang API calls accept a PCH that had compiler errors. The general idea is that we want libclang to stay functional even if a PCH had a compiler error. rdar://10976363. llvm-svn: 152192
* Basic: import IntrusiveRefCntPtr<> into clang namespaceDylan Noblesmith2012-02-201-1/+1
| | | | | | | The class name is long enough without the llvm:: added. Also bring in RefCountedBase and RefCountedBaseVPTR. llvm-svn: 150958
* Print NamedDecls directly to a raw_ostream where possible.Benjamin Kramer2012-02-071-1/+1
| | | | llvm-svn: 149982
* Basic: import OwningPtr<> into clang namespaceDylan Noblesmith2012-02-051-4/+4
| | | | llvm-svn: 149798
* Introduce module attributes into the module map grammar, along with aDouglas Gregor2012-01-271-1/+4
| | | | | | | | | | | | | single attribute ("system") that allows us to mark a module as being a "system" module. Each of the headers that makes up a system module is considered to be a system header, so that we (for example) suppress warnings there. If a module is being inferred for a framework, and that framework directory is within a system frameworks directory, infer it as a system framework. llvm-svn: 149143
* Extend the ExternalASTSource interface to allow the AST source toDouglas Gregor2012-01-261-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | provide the layout of records, rather than letting Clang compute the layout itself. LLDB provides the motivation for this feature: because various layout-altering attributes (packed, aligned, etc.) don't get reliably get placed into DWARF, the record layouts computed by LLDB from the reconstructed records differ from the actual layouts, and badness occurs. This interface lets the DWARF data drive layout, so we don't need the attributes preserved to get the answer write. The testing methodology for this change is fun. I've introduced a variant of -fdump-record-layouts called -fdump-record-layouts-simple that always has the simple C format and provides size/alignment/field offsets. There is also a -cc1 option -foverride-record-layout=<file> to take the output of -fdump-record-layouts-simple and parse it to produce a set of overridden layouts, which is introduced into the AST via a testing-only ExternalASTSource (called LayoutOverrideSource). Each test contains a number of records to lay out, which use various layout-changing attributes, and then dumps the layouts. We then run the test again, using the preprocessor to eliminate the layout-changing attributes entirely (which would give us different layouts for the records), but supplying the previously-computed record layouts. Finally, we diff the layouts produced from the two runs to be sure that they are identical. Note that this code makes the assumption that we don't *have* to provide the offsets of bases or virtual bases to get the layout right, because the alignment attributes don't affect it. I believe this assumption holds, but if it does not, we can extend LayoutOverrideSource to also provide base offset information. Fixes the Clang side of <rdar://problem/10169539>. llvm-svn: 149055
* Extract the (InputKind, std::string) pair used to describe inputs toDouglas Gregor2012-01-201-20/+18
| | | | | | | the front end into its own class, FrontendInputFile, to make it easier to introduce new per-input data. No functionality change. llvm-svn: 148546
* When loading an AST file, set SourceManager::MainFileID to the main file of ↵Argyrios Kyrtzidis2012-01-051-10/+1
| | | | | | | | the AST file, as suggested by Tom Honermann. llvm-svn: 147612
* Unweaken vtables as per ↵David Blaikie2011-12-201-0/+2
| | | | | | http://llvm.org/docs/CodingStandards.html#ll_virtual_anch llvm-svn: 146959
* Move ChainedIncludesSource into the Frontend library. This never reallyChandler Carruth2011-12-091-1/+1
| | | | | | | | | | belonged in the Serialization library, it's setting up a compilation, not just deserializing. This should fix PR11512, making Serialization actually be layered below Frontend, a long standing layering violation in Clang. llvm-svn: 146233
* Make -error-on-deserialized-decl work correctly by correctly delegating toArgyrios Kyrtzidis2011-10-281-10/+42
| | | | | | the previous ASTDeserializationListener. llvm-svn: 143241
* Rename Diagnostic to DiagnosticsEngine as per issue 5397David Blaikie2011-09-251-2/+2
| | | | llvm-svn: 140478
* Eliminate the list of modules from the preprocessor options. This wasDouglas Gregor2011-09-151-24/+0
| | | | | | | used back when we had an -import-module command-line option, but it's no longer used (or useful). llvm-svn: 139829
* Introduce a -cc1 option "-emit-module", that creates a binary moduleDouglas Gregor2011-08-251-3/+3
| | | | | | | | | from the given source. -emit-module behaves similarly to -emit-pch, except that Sema is somewhat more strict about the contents of -emit-module. In the future, there are likely to be more interesting differences. llvm-svn: 138595
* Wire up -import-module to run ReadAST for each module loaded.Jonathan D. Turner2011-08-051-1/+26
| | | | llvm-svn: 136987
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-6/+6
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Revamp the SourceManager to separate the representation of parsedDouglas Gregor2011-07-191-3/+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
* [arcmt] Fix the ARC migrator. -arcmt-modify requires running before the ↵Argyrios Kyrtzidis2011-06-181-0/+8
| | | | | | | | initialization of SourceManager because it is going to modify the input file. llvm-svn: 133323
* Raise the ARCMT functionality in Clang into proper FrontendActions.Chandler Carruth2011-06-161-0/+38
| | | | | | | | | | | | | | | | | | | | | 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
* Improve crash recovery cleanup to recovery CompilerInstances during crash ↵Ted Kremenek2011-03-211-9/+9
| | | | | | | | | | 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
* Introduce '-chain-include' option to specify headers that will be converted ↵Argyrios Kyrtzidis2011-03-091-2/+11
| | | | | | | | | | to chained PCHs in memory without having to use multiple runs and intermediate files. Intended for testing & debugging of chained PCH. llvm-svn: 127339
* Finish up the diagnostic client before we've torn down the ASTReader,Douglas Gregor2011-02-091-3/+3
| | | | | | | since the diagnostic client might poke at source locations that have not yet been deserialized. llvm-svn: 125204
* Improve our uniquing of file entries when files are re-saved or areDouglas Gregor2011-02-051-0/+1
| | | | | | | | | | | | | | 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
* Support for -plugin-arg- with -add-pluginNico Weber2011-01-291-1/+1
| | | | llvm-svn: 124551
* Add -add-plugin flag, which runs plugins in addition to codegen.Nico Weber2011-01-251-2/+39
| | | | llvm-svn: 124227
* Such function decls,as objc's objc_msgSend, builtins in Fariborz Jahanian2010-11-301-1/+1
| | | | | | | | | a specific language. We are adding such language info. by extensing Builtins.def and via a language flag added to LIBBUILTIN/BUILTIN and check for that when deciding a name is builtin or not. Implements //rdar://8689273. llvm-svn: 120429
* now the FileManager has a FileSystemOpts ivar, stop threadingChris Lattner2010-11-231-1/+1
| | | | | | | | | 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
* Use hasErrorOccurred() instead of getNumErrors() where it makes sense.Argyrios Kyrtzidis2010-11-181-1/+1
| | | | llvm-svn: 119746
* Implement -working-directory.Argyrios Kyrtzidis2010-11-031-2/+3
| | | | | | | | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud