summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/FrontendActions.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Don't translate CRLF files into LF files. Fixes PR6870, from Aaron Ballman!Douglas Gregor2011-09-231-2/+43
| | | | llvm-svn: 140435
* Modules hide macro definitions by default, so that silly things likeDouglas Gregor2011-09-011-1/+2
| | | | | | | | | | | include guards don't show up as macro definitions in every translation unit that imports a module. Macro definitions can, however, be exported with the intentionally-ugly #__export_macro__ directive. Implement this feature by not even bothering to serialize non-exported macros to a module, because clients of that module need not (should not) know that these macros even exist. llvm-svn: 138943
* Remove the Chaining argument from the PCH/module generator. It's no longer usedDouglas Gregor2011-08-251-9/+3
| | | | llvm-svn: 138596
* Introduce a -cc1 option "-emit-module", that creates a binary moduleDouglas Gregor2011-08-251-2/+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
* Make Lexer::ComputePreamble accept a LangOptions parameter, otherwise it may beArgyrios Kyrtzidis2011-08-251-1/+1
| | | | | | out-of-sync how a file is compiled. Patch by Matthias Kleine! llvm-svn: 138580
* Cut down the number of open/close system calls for output files.Argyrios Kyrtzidis2011-07-281-1/+3
| | | | | | | | | For PCH files, have only one open/close for temporary + rename to be safe from race conditions. For all other output files open/close the output file directly. Depends on llvm r136310. rdar://9082880 & http://llvm.org/PR9374. llvm-svn: 136315
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-14/+14
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Switch all of the "isysroot" const char*'s throughout the AST readerDouglas Gregor2011-07-221-3/+4
| | | | | | and writer to StringRef or std::string, as appropriate. llvm-svn: 135769
* Remove the AST printer (-ast-print-xml), which is too incomplete andDouglas Gregor2011-03-071-7/+0
| | | | | | | | | | | | | | | too low-level to actually be useful but is just interesting enough for people to try to use it (which won't actually work beyond toy examples). To bring back the AST printer, it needs to be: - Complete, covering all of C/C++/Objective-C - Documented, with appropriate Schema against which we can validate the output - Designed for C/C++/Objective-C, not Clang's specific ASTs - Stable across Clang versions - Well-tested llvm-svn: 127141
* Eliminate the internal command-line option for viewing inheritance in C++ ↵Douglas Gregor2011-02-171-5/+0
| | | | | | classes, since it's only really worked for the trivial cases anyway due to lame pseudo-parsing of the class name. The viewInheritance() function is still available for use in the debugger, where this is far more useful llvm-svn: 125762
* Allow resolving headers from a PCH even after headers+PCH were moved to ↵Argyrios Kyrtzidis2011-02-151-2/+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
* libclang: Don't allow RemoveFileOnSignal to be called via libclang, badness canDaniel Dunbar2011-01-311-1/+4
| | | | | | ensue. llvm-svn: 124613
* Driver, Frontend: add CUDA language supportPeter Collingbourne2010-12-011-0/+1
| | | | llvm-svn: 120544
* Add -cc1 -ast-dump-xml, an excessively detailed XML dump of the internalsJohn McCall2010-11-241-0/+11
| | | | | | | | | | | | | of the ASTs. Only available in assertions builds. No stability guarantee. This is intended solely as a debugging tool. I'm not sure if the goals are sufficiently aligned with the XML printer to allow a common implementation. Currently just falls back on the StmtDumper to display statements, which means it doesn't produce valid XML in those cases. llvm-svn: 120088
* now the FileManager has a FileSystemOpts ivar, stop threadingChris Lattner2010-11-231-2/+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
* Implement -working-directory.Argyrios Kyrtzidis2010-11-031-1/+4
| | | | | | | | | | | | | | | | | | | 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
* Rename PCHWriter.h to ASTWriter.hSebastian Redl2010-08-181-1/+1
| | | | llvm-svn: 111466
* Reintroduce the serialization library, with fixed dependencies.Sebastian Redl2010-08-171-1/+1
| | | | llvm-svn: 111279
* Revert Sebastian's build-breaking patch.Douglas Gregor2010-08-171-1/+1
| | | | llvm-svn: 111265
* Create a new Serialization module that contains all the PCH code, and will ↵Sebastian Redl2010-08-171-1/+1
| | | | | | contain all the module code in the future. Update the Makefiles, CMake projects and the Xcode project. I hope I did everything right for Xcode. No functionality change. llvm-svn: 111258
* Fix a typo in a diag name.Sebastian Redl2010-08-171-1/+1
| | | | llvm-svn: 111257
* Reshuffle the PCH generator action and consumer, so that we can re-useDouglas Gregor2010-08-031-11/+25
| | | | | | it while generating precompiled preambles. No functionality change. llvm-svn: 110108
* Make macro weirdness in chained PCH work. This required changing the way ↵Sebastian Redl2010-07-301-3/+3
| | | | | | PCHReader and PCHWriter are initialized to correctly pick up all initializer. On the upside, this means that there is far less repetition in the dependent PCH now. llvm-svn: 109823
* Introduce basic support for loading a precompiled preamble whileDouglas Gregor2010-07-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | reparsing an ASTUnit. When saving a preamble, create a buffer larger than the actual file we're working with but fill everything from the end of the preamble to the end of the file with spaces (so the lexer will quickly skip them). When we load the file, create a buffer of the same size, filling it with the file and then spaces. Then, instruct the lexer to start lexing after the preamble, therefore continuing the parse from the spot where the preamble left off. It's now possible to perform a simple preamble build + parse (+ reparse) with ASTUnit. However, one has to disable a bunch of checking in the PCH reader to do so. That part isn't committed; it will likely be handled with some other kind of flag (e.g., -fno-validate-pch). As part of this, fix some issues with null termination of the memory buffers created for the preamble; we were trying to explicitly NULL-terminate them, even though they were also getting implicitly NULL terminated, leading to excess warnings about NULL characters in source files. llvm-svn: 109445
* Eliminate the "minimal" and printing parser actions, which only everDouglas Gregor2010-07-261-22/+0
| | | | | | | worked for C anyway. Also kills the -cc1 options -parse-noop and -parse-print-callbacks. llvm-svn: 109392
* Introduce a new lexer function to compute the "preamble" of a file,Douglas Gregor2010-07-201-0/+30
| | | | | | | | | which is the part of the file that contains all of the initial comments, includes, and preprocessor directives that occur before any of the actual code. Added a new -print-preamble cc1 action that is only used for testing. llvm-svn: 108913
* Add a callback interface that allows interested parties to get notified ↵Sebastian Redl2010-07-141-1/+1
| | | | | | whenever PCHReader deserializes a type or decl (and possibly other things in the future). Have PCHWriter implement these callbacks as noops and register to receive them if we're chaining PCHs. This will allow PCHWriter to track the IDs of these things, which it needs to write the dependent files. WIP llvm-svn: 108383
* Modify the pragma handlers to accept and use StringRefs instead of ↵Argyrios Kyrtzidis2010-07-131-1/+1
| | | | | | | | | | | IdentifierInfos. When loading the PCH, IdentifierInfos that are associated with pragmas cause declarations that use these identifiers to be deserialized (e.g. the "clang" pragma causes the "clang" namespace to be loaded). We can avoid this if we just use StringRefs for the pragmas. As a bonus, since we don't have to create and pass IdentifierInfos, the pragma interfaces get a bit more simplified. llvm-svn: 108237
* Really respect -chained-pch.Sebastian Redl2010-07-091-7/+5
| | | | llvm-svn: 107993
* Add a frontend option -chained-pch and don't pass an active PCH reader to ↵Sebastian Redl2010-07-091-1/+3
| | | | | | the PCH writer if it is not set, preventing creation of chained PCH files. Since the reader is so far unused, effectively no functionality change. llvm-svn: 107936
* Some preparatory work for chained PCH. No functionality change.Sebastian Redl2010-07-081-2/+3
| | | | llvm-svn: 107915
* Break Frontend's dependency on Rewrite, Checker and CodeGen in shared ↵Daniel Dunbar2010-06-151-83/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | library configuration Currently, all AST consumers are located in the Frontend library, meaning that in a shared library configuration, Frontend has a dependency on Rewrite, Checker and CodeGen. This is suboptimal for clients which only wish to make use of the frontend. CodeGen in particular introduces a large number of unwanted dependencies. This patch breaks the dependency by moving all AST consumers with dependencies on Rewrite, Checker and/or CodeGen to their respective libraries. The patch therefore introduces dependencies in the other direction (i.e. from Rewrite, Checker and CodeGen to Frontend). After applying this patch, Clang builds correctly using CMake and shared libraries ("cmake -DBUILD_SHARED_LIBS=ON"). N.B. This patch includes file renames which are indicated in the patch body. Changes in this revision of the patch: - Fixed some copy-paste mistakes in the header files - Modified certain aspects of the coding to comply with the LLVM Coding Standards llvm-svn: 106010
* Preprocessor: Ignore unknown pragmas in -E -dM and -Eonly modes.Daniel Dunbar2010-06-111-0/+4
| | | | llvm-svn: 105830
* Teach clang -fixit to modify files in-place, or -fixit=suffix to create newNick Lewycky2010-04-241-69/+21
| | | | | | files with the additional suffix in the middle. llvm-svn: 102230
* push some source location information down through the compiler,Chris Lattner2010-04-201-8/+4
| | | | | | | | into ContentCache::getBuffer. This allows it to produce diagnostics on the broken #include line instead of without a location. llvm-svn: 101939
* Teach -fixit to modify all of its inputs instead of just the main file, unlessNick Lewycky2010-04-151-1/+45
| | | | | | -fixit-at specified a particular fixit to fix, or the -o flag was used. llvm-svn: 101359
* Fronted: Kill overly specialized RecordLayoutDumper, just make ↵Daniel Dunbar2010-04-081-5/+0
| | | | | | -dump-record-layouts a bit that Sema honors. llvm-svn: 100747
* rename llvm::llvm_report_error -> llvm::report_fatal_errorChris Lattner2010-04-071-1/+1
| | | | llvm-svn: 100708
* clang -cc1: Kill off -empty-input only, and replace with -init-only which is anDaniel Dunbar2010-03-191-0/+12
| | | | | | | | actual action. - This is easier to use, and more reliable for timing the thing this was actually meant to be useful for. llvm-svn: 98978
* Entering the main source file in the preprocessor can fail if theDouglas Gregor2010-03-171-4/+8
| | | | | | source file has been changed. Handle that failure more gracefully. llvm-svn: 98727
* Frontend: Pull CodeGenAction out more, and eliminate CreateBackendConsumer.Daniel Dunbar2010-02-251-42/+0
| | | | | | | | | | This is the way I would like to move the frontend function towards -- distinct pieces of functionality should be exposed only via FrontendAction implementations which have clean and relatively-stable APIs. This also isolates the surface area in clang which depends on LLVM CodeGen. llvm-svn: 97110
* clang -cc1: Wire up -emit-obj, for emitting object files.Daniel Dunbar2010-02-031-0/+5
| | | | llvm-svn: 95182
* Fix <rdar://problem/7490212> clang rewriter: return of the mixed line ↵Steve Naroff2010-01-051-1/+3
| | | | | | | | | | endings, which is related to <rdar://problem/6596843> clang ObjC rewriter: Line endings still mixed in rewrite output This fix was dropped when I integrated the 'objective-rewrite' branch. llvm-svn: 92737
* Remove RewriteBlocks. It has been superseded by RewriteObjCKovarththanan Rajaratnam2009-12-231-5/+0
| | | | llvm-svn: 92014
* Fix CompilerInstance::createOutputFile to use proper diagnostics, and (try ↵Daniel Dunbar2009-12-031-12/+39
| | | | | | to) update all clients to be able to handle failure. llvm-svn: 90437
* Eliminate CodeGenOptions::TimePasses.Daniel Dunbar2009-11-301-1/+2
| | | | llvm-svn: 90118
* Fix PR5633 by making the preprocessor handle the case where we canChris Lattner2009-11-301-1/+2
| | | | | | | | | | stat a file but where mmaping it fails. In this case, we emit an error like: t.c:1:10: fatal error: error opening file '../../foo.h' instead of "cannot find file". llvm-svn: 90110
* Don't call exit(). llvm::llvm_report_error() will do just thatKovarththanan Rajaratnam2009-11-281-1/+0
| | | | llvm-svn: 90031
* typoGabor Greif2009-11-261-1/+1
| | | | llvm-svn: 89949
* issue a friendlier error if someone tries to send precompiled header to '-' ↵Gabor Greif2009-11-261-1/+1
| | | | | | | | | | | (stdout) this brings the error on clang -c foo.h -o - closer to clang -c foo.h -o /dev/null llvm-svn: 89948
OpenPOWER on IntegriCloud