summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
Commit message (Collapse)AuthorAgeFilesLines
* I predict that HeaderSearch will need the ability to generateDouglas Gregor2011-11-112-2/+4
| | | | | | diagnostics in the future. Make it so. llvm-svn: 144347
* serialized diagnostics: simplify code.Benjamin Kramer2011-11-101-5/+1
| | | | llvm-svn: 144277
* serialized diagnostics: implement full deserialization of clang diagnostics ↵Ted Kremenek2011-11-101-9/+26
| | | | | | | | via the libclang API. I've tested it on simple cases and it works. Test cases to follow as well as a few tweaks. llvm-svn: 144269
* serialized diagnostics: serialize the version info in a separate meta block.Ted Kremenek2011-11-081-20/+31
| | | | llvm-svn: 144115
* ASTConsumer::handleTopLevelDecl will end up getting called forDouglas Gregor2011-11-071-1/+4
| | | | | | function template instantiations. Fixes <rdar://problem/10398005> / PR11312. llvm-svn: 143984
* Rip out one of the features I added for the driver-include-management.Chandler Carruth2011-11-071-8/+3
| | | | | | | | | | | | | | | | We don't actually need a separate flag for non-sysrooted paths as the driver has to manage the sysroot anyways. The driver is not infrequently adding paths to the header search based on their existence on the filesystem. For that, it has to add the sysroot anyways, we should pass it on down to CC1 already joined. More importantly, the driver cannot in all cases distinguish between sysrooted paths and paths that are relative to the Clang binary's installation directory. Essentially, we always need to ignore the system root for these internal header search options. It turns out in most of the places we were already providing the system root in the driver, and then another one in CC1 so this fixes several bugs. llvm-svn: 143917
* Move the Linux header searching from the Frontend to the Driver. This isChandler Carruth2011-11-051-274/+7
| | | | | | | | | | | | | | | | the first (and diff-noisiest) step to making Linux header searching tremendously more principled and less brittle. Note that this step should have essentially no functional impact. We still search the exact same set of paths in the exact same order. The only change here is where the code implementing such a search lives. This has one obvious negative impact -- we now pass a ludicrous number of flags to the CC1 layer. That should go away as I re-base this logic on the logic to detect a GCC installation. I want to do this in two phases so the bots can tell me if this step alone breaks something, and so that the diffs of the refactoring make more sense. llvm-svn: 143822
* Fix a significant oversight in my move of MSVC includes to the driver:Chandler Carruth2011-11-051-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | actually manage the builtin header file includes as well as the system ones. This one is actually debatable whether it belongs in the driver or not, as the builtin includes are really an internal bit of implementation goop for Clang. However, they must be included at *exactly* the right point in the sequence of header files, which makes it essentially impossible to have this be managed by the Frontend and the rest by the Driver. I have terrible ideas that would "work", but I think they're worse than putting this in the driver and making the Frontend library even more ignorant of the environment and system on which it is being run. Also fix the fact that we weren't properly respecting the flags which suppress standard system include directories. Note that this still leaves all of the Clang tests which run CC1 directly and include builtin header files broken on Windows. I'm working on a followup patch to address that. llvm-svn: 143801
* Add two flags to the CC1 layer that I was hoping to avoid. We need toChandler Carruth2011-11-052-6/+21
| | | | | | | | | | | | | | | | | | | | encode the *exact* semantics which the header search paths internally built by the Frontend layer have had, which is both non-user-provided, and at times adding the implicit extern "C" bit to the directory entry. There are lots of CC1 options that are very close, but none do quite this, and they are all already overloaded for other purposes. In some senses this makes the command lines more clean as it clearly indicates which flags are exclusively used to implement internal detection of "standard" header search paths. Lots of the implementation of this is really crufty, due to the surrounding cruft. It doesn't seem worth investing lots of time cleaning this up as it isn't new, and hopefully *lots* of this code will melt away as header search inside of the frontend becomes increasingly trivial. llvm-svn: 143798
* serialized diagnostics: include FixIt information in serialized diagnostics.Ted Kremenek2011-11-051-6/+41
| | | | llvm-svn: 143776
* serialized diagnostics: pull emission of filenames into diagnostic block.Ted Kremenek2011-11-051-81/+56
| | | | llvm-svn: 143765
* serialized diagnostics: pull emission of diagnostic flag string into ↵Ted Kremenek2011-11-051-65/+62
| | | | | | diagnostics block. llvm-svn: 143764
* Serialized diagnostics: pull category name serialization into diagnostic ↵Ted Kremenek2011-11-051-24/+33
| | | | | | blocks. The goal is to remove BLOCK_STRINGS so that the bitcode file can potentially be streamed. llvm-svn: 143763
* serialized diagnostics: emit source ranges.Ted Kremenek2011-11-051-2/+55
| | | | llvm-svn: 143762
* Move definition of record/block IDs for serialized diagnostics to public header.Ted Kremenek2011-11-051-16/+1
| | | | llvm-svn: 143761
* Serialized diagnostics: encode a 24 bit version number as part of the "magic ↵Ted Kremenek2011-11-051-4/+2
| | | | | | number" of serialized diagnostics. llvm-svn: 143760
* serialized diagnostics: unique warning strings when emitting serialized ↵Ted Kremenek2011-11-051-25/+61
| | | | | | diagnostics. llvm-svn: 143759
* Serialized diagnostics: serialize "notes" as sub diagnostics of warnings and ↵Ted Kremenek2011-11-051-4/+27
| | | | | | errors. llvm-svn: 143758
* Also include file modification time and size in output of ↵Ted Kremenek2011-11-051-1/+5
| | | | | | SerializedDiagnosticPrinter. llvm-svn: 143757
* Begin the migration of header search logic to the driver, starting withChandler Carruth2011-11-041-244/+16
| | | | | | | | | Windows. There are still FIXMEs and lots of problems with this code. Some of them will be addressed shortly by my follow-up patches, but most are going to wait until we isolate this code and can fix it properly. This version should be no worse than what we had before. llvm-svn: 143752
* Enable -flimit-debug-info by default. Now, clang lazily emits debug info for ↵Devang Patel2011-11-041-1/+2
| | | | | | structs. Original behavior can be restored using -fno-limit-debug-info. llvm-svn: 143733
* Parse the warning options twice. The first pass sets diagnostic state, while Chad Rosier2011-11-031-70/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the second pass reports warnings/errors. This has the effect that we follow the more canonical "last option wins" paradigm when there are conflicting options. rdar://10383776 Previously, we parsed the warning options in order. This caused non-intuitive behavior: 1) clang test.c -Wnosuchwarning -Wno-unknown-warning-option Before: warning: unknown warning option '-Wnosuchwarning' [-Wunknown-warning-option] 1 warning generated. After: [0 warning generated.] 2) clang test.c -Wnosuchwarning -Werror=unknown-warning-option Before: warning: unknown warning option '-Wnosuchwarning' [-Wunknown-warning-option] 1 warning generated. After: error: unknown warning option '-Wnosuchwarning' [-Werror,-Wunknown-warning-option] 3) clang test.c -Werror=unknown-warning-option -Wnosuchwarning -Wno-error=unknown-warning-option -Wnosuchwarning Before: error: unknown warning option '-Wnosuchwarning' [-Werror,-Wunknown-warning-option] warning: unknown warning option '-Wnosuchwarning' [-Wunknown-warning-option] After: warning: unknown warning option '-Wnosuchwarning' [-Wunknown-warning-option] warning: unknown warning option '-Wnosuchwarning' [-Wunknown-warning-option] 2 warnings generated. 4) clang test.c -Werror=unknown-warning-option -Wnosuchwarning -Wno-error=unknown-warning-option -Wno-unknown-warning-option -Wnosuchwarning Before: error: unknown warning option '-Wnosuchwarning' [-Werror,-Wunknown-warning-option] After: [0 warning generated.] llvm-svn: 143657
* After resetting the diagnostic state, set the number of warning occurring in ↵Argyrios Kyrtzidis2011-11-031-0/+2
| | | | | | the preamble. llvm-svn: 143647
* [libclang] Fix crash when a #pragma diagnostic is included in the preamble.Argyrios Kyrtzidis2011-11-031-7/+3
| | | | | | | | | | | A PCH file keeps track of #pragma diagnostics state; when loading the preamble, they conflicted with the #pragma diagnostic state already present in the DiagnosticsEngine object due to parsing the preamble. Fix this by clearing the state of the DiagnosticsEngine object. Fixes rdar://10363572 && http://llvm.org/PR11254. llvm-svn: 143644
* [libclang] Add infrastructure to be able to only deserialize decls in a file ↵Argyrios Kyrtzidis2011-11-031-0/+36
| | | | | | | | region and use it for clang_getCursor. llvm-svn: 143605
* Fix various minor issues find via unreachable code warnings, fromDouglas Gregor2011-11-021-1/+2
| | | | | | Ahmed Charles! llvm-svn: 143569
* Add the newest Gentoo GCC version based on the reported installedChandler Carruth2011-11-021-0/+8
| | | | | | | | version in PR11298. I hear-by apologize for adding yet more code to this monstrosity. llvm-svn: 143567
* Add an option to emulate the strange Apple gcc behavior of #pragma pack.Eli Friedman2011-11-021-0/+3
| | | | | | <rdar://problem/10374763> llvm-svn: 143527
* rename getHostTriple into getDefaultTargetTriple in clangSebastian Pop2011-11-013-4/+4
| | | | llvm-svn: 143503
* Put a reference of the ASTReader in the ASTUnit.Argyrios Kyrtzidis2011-11-011-1/+6
| | | | | | | This is intended for direct access of the ASTReader for uses that make little sense to try to shoehorn in the ExternalASTSource interface. llvm-svn: 143465
* Revert r143342. Caching of code-completion results was intentionally placed ↵Argyrios Kyrtzidis2011-10-311-6/+6
| | | | | | | | | | | | in "reparse" because we don't want to take this performance hit when doing code completion Log of r143342: Move caching of code-completion results from ASTUnit::Reparse to ASTUnit::CodeComplete, so that it will happen when we are doing code-completion, not reparsing. llvm-svn: 143367
* Add "just one more" include path to the monstrosity that is our headerChandler Carruth2011-10-311-0/+1
| | | | | | | | | | | search logic. The Debian multiarch seems to have completely changed from when these were originally added, and I'd like to remove a bunch of them, but I'll be lazy and delay that until this logic is hoisted into the driver where it belongs. This should resolve PR11223. llvm-svn: 143345
* Move caching of code-completion results from ASTUnit::Reparse to ↵Argyrios Kyrtzidis2011-10-311-6/+6
| | | | | | | | ASTUnit::CodeComplete, so that it will happen when we are doing code-completion, not reparsing. llvm-svn: 143342
* Have the ASTUnit associate the local declarations that get parsed with the fileArgyrios Kyrtzidis2011-10-311-12/+85
| | | | | | that contains them. llvm-svn: 143338
* Add support for lazily linking bitcode files (using a newPeter Collingbourne2011-10-301-0/+1
| | | | | | | -mlink-bitcode-file flag), and more generally llvm::Modules, before running optimisations. llvm-svn: 143314
* Start work on SerializedDiagnosticPrinter, a new DiagnosticConsumer that ↵Ted Kremenek2011-10-294-0/+387
| | | | | | | | | | | | | | | serializes out the diagnostics for a given translation unit to a bit code file. This is a WIP. The motivation for this new DiagnosticConsumer is to provide a way for tools invoking the compiler to get its diagnostics via a libclang interface, rather than textually parsing the compiler output. This gives us flexibility to change the compiler's textual output, but have a structured data format for clients to use to get the diagnostics via a stable API. I have no tests for this, but llvm-bcanalyzer so far shows that the emitted file is well-formed. More work to follow. llvm-svn: 143259
* Give __STDC_VERSION__ the value 201001L when we're in C1x mode. TheDouglas Gregor2011-10-281-1/+6
| | | | | | | committee hasn't set a value for __STDC_VERSION__ yet, so this is a placeholder. But at least it's > 199901L. llvm-svn: 143245
* Make -error-on-deserialized-decl work correctly by correctly delegating toArgyrios Kyrtzidis2011-10-281-10/+42
| | | | | | the previous ASTDeserializationListener. llvm-svn: 143241
* Add mutex for accessing ASTUnit's global OnDisk data. This may be an issue ↵Ted Kremenek2011-10-271-0/+13
| | | | | | as libclang could be processing multiple ASTUnit's at once. llvm-svn: 143138
* Move ASTUnit's handling of temporary files and the preamble file into a ↵Ted Kremenek2011-10-271-22/+108
| | | | | | lazily-created static DenseMap. This DenseMap is cleared (and the files erased) via an atexit routine in the case an ASTUnit is not destroyed. Fixes <rdar://problem/10293367>. llvm-svn: 143115
* [PCH] When visiting preprocessed entities, make it possible to avoid ↵Argyrios Kyrtzidis2011-10-251-0/+44
| | | | | | | | | | | | | | | deserializing preprocessed entities that are #included in the range that we are interested. This is useful when we are interested in preprocessed entities of a specific file, e.g when we are annotating tokens. There is also an optimization where we cache the last result of PreprocessingRecord::getPreprocessedEntitiesInRange and we re-use it if there is a call with the same range as before. rdar://10313365 llvm-svn: 142887
* Switch to a more natural formatting of the macro name printing.Chandler Carruth2011-10-241-2/+2
| | | | | | Suggested by John McCall. llvm-svn: 142836
* [libclang] Make sure we don't try to erase past the StoredDiagnostics vector.Argyrios Kyrtzidis2011-10-241-13/+7
| | | | | | Ted came upon the bug but I couldn't make a test out of it. llvm-svn: 142805
* Make -fms-compatibility imply -fms-extensions. Fixes PR11204.Douglas Gregor2011-10-241-1/+4
| | | | llvm-svn: 142797
* Take DW_AT_comp_dir from $PWD when it's present and starts with a '/'. This isNick Lewycky2011-10-211-0/+5
| | | | | | | closer to what GCC does, except that GCC also checks that the inodes for $PWD and '.' match. llvm-svn: 142633
* Define __STDC__ in -fms-extensions mode; defining it is consistent with gcc, ↵Eli Friedman2011-10-191-1/+1
| | | | | | and not defining it causes the system headers on multiple platforms to break with -fms-extensions because they assume the lack of a definition of __STDC__ implies a traditional (pre-ANSI) preprocessor. PR10324 and <rdar://problem/10313809> . llvm-svn: 142554
* Frontend: Support -iframework.Daniel Dunbar2011-10-181-0/+4
| | | | llvm-svn: 142418
* Wire up support for the controlling the extended dwarf .file directive. WithNick Lewycky2011-10-171-0/+3
| | | | | | | r142300 but not this patch, clang -S may emit .s files that assemblers other than llvm-mc can't parse. llvm-svn: 142301
* When building a module, use the macro definitions on the command lineDouglas Gregor2011-10-171-0/+17
| | | | | | | | | as part of the hash rather than ignoring them. This means we'll end up building more module variants (overall), but it allows configuration macros such as NDEBUG to work so long as they're specified via command line. More to come in this space. llvm-svn: 142187
* Hoist the logic I added to compute the macro name into a helperChandler Carruth2011-10-161-16/+30
| | | | | | function. No functionality changed. llvm-svn: 142128
OpenPOWER on IntegriCloud