summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Now that macro expansion notes are real notes and go through the sameChandler Carruth2011-10-161-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | formatting as any other diagnostic, they will be properly line wrapped and otherwise pretty printed. Let's take advantage of that and the new factoring to add some helpful information to them (much like template backtrace notes and other notes): the name of the macro whose expansion is being noted. This makes a world of difference if caret diagnostics are disabled, making the expansion notes actually useful in this case. It also helps ensure that in edge cases the information the user needs is present. Consider: % nl -ba t5.cc 1 #define M(x, y, z) \ 2 y 3 4 M( 5 1, 6 2, 7 3); We now produce: % ./bin/clang -fsyntax-only t5.cc t5.cc:6:3: error: expected unqualified-id 2, ^ t5.cc:2:3: note: expanded from macro: M y ^ 1 error generated. Without the added information in the note, the name of the macro being expanded would never be shown. This also deletes a FIXME to use the diagnostic formatting. It's not yet clear to me that we *can* do this reasonably, and the production of this message was my primary goal here anyways. I'd love any comments or suggestions on improving these notes, their wording, etc. Currently, I need to make them provide more helpful information in the presence of a token-pasting buffer, and I'm pondering adding something along the lines of "expanded from argument N of macro: ...". llvm-svn: 142127
* Fix the original bug in our diagnostic printing that got me started onChandler Carruth2011-10-161-29/+12
| | | | | | | | | | | | | this long quest: actually use the note printing machinery for each macro expansion note rather than a hacky version of it. This will colorize and format the notes the same as any other. There is still some stuff to fix here, but it's one step closer. No test case changes because currently we don't do anything differently that I can FileCheck for -- I don't really want to try matching the color escape codes... Suggestions for how to test this are welcome. =] llvm-svn: 142121
* Now that the structure of this is more reasonably laid out, fix a longChandler Carruth2011-10-161-27/+35
| | | | | | | | | | | | | | | standing deficiency: we were providing no macro backtrace information whenever caret diagnostics were turned off. This sinks the logic for suppressing the code snippet and caret to the code that actually prints tho code snippet and caret. Along the way, clean up the naming of functions, remove some now fixed FIXMEs, and generally improve the wording and logic of this process. Add a test case exerecising this functionality. It is notable that the resulting messages are extremely low quality. I'm working on a follow-up patch that should address this and have left a FIXME in the test case. llvm-svn: 142120
* Add proper doxyments to the entry point routine, and remove a dead parameter.Chandler Carruth2011-10-161-2/+1
| | | | llvm-svn: 142109
* Persist the TextDiagnostic object across multiple diagnostics as long asChandler Carruth2011-10-162-29/+26
| | | | | | | | | the SourceManager doesn't change, and the source files don't change. This greatly simplifies the interfaces and interactions. The lifetime of the TextDiagnostic object forms the 'session' over which we attempt to condense and deduplicate information in diagnostics. llvm-svn: 142104
* Clean up the names of all the TextDiagnostic methods (and even a staticChandler Carruth2011-10-152-27/+29
| | | | | | | function) to agree with the coding conventions, and in one case have a bit more information in it. llvm-svn: 142088
* Move two functions out of the public interface that shouldn't have everChandler Carruth2011-10-151-206/+206
| | | | | | | | | | been there. Also delete their redundant doxyments in favor of those in the source file. I'm putting the doxyments for private and static helpers into the implementation file, and only the public interface doxyments into the header. If folks have strong opinions about this type of split, feel free to chime in, I'm happy to re-organize. llvm-svn: 142087
* Graduate the TextDiagnostic interface to its own header and source file,Chandler Carruth2011-10-153-1155/+1100
| | | | | | | | | | making it accessible to anyone from the Frontend library. Still a good bit of cleanup to do here, but its a good milestone. This ensures that *all* of the functionality needed to implement the DiagnosticConsumer is exposed via the generic interface in some form. No sneaky re-use of static functions. llvm-svn: 142086
OpenPOWER on IntegriCloud