summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
Commit message (Collapse)AuthorAgeFilesLines
...
* Move the message printing to a class-static function so that it can beChandler Carruth2011-10-151-28/+45
| | | | | | part of the TextDiagnostic interface without requiring a full instance. llvm-svn: 142085
* Move the diagnostic level printing into a class static helper. This willChandler Carruth2011-10-151-31/+38
| | | | | | | allow the TextDiagnosticPrinter to continue using it even if TextDiagnostic is implemented in a separate file. llvm-svn: 142084
* Rationalize the last bit of "arbitrary" state that is carried betweenChandler Carruth2011-10-151-9/+23
| | | | | | | | | | | | | diagnostics to control suppression of redundant information. It now follows the same model as all the other state, and has a bit more clear semantics. This is making the duality of the state a bit annoying, and I've added a FIXME to resolve it. The problem is that I need to lift the TextDiagnostic up into an externally visible layer before that can happen. llvm-svn: 142083
* Neither 'Warning' nor 'NonNote' was a good name for this location...Chandler Carruth2011-10-151-13/+14
| | | | | | | It's the last include-stack-root we tried to walk up. Use a better name and better doxyments for it. llvm-svn: 142071
* Nuke a bunch of FIXMEs that are now fixed. =] Also, remove the now-deadChandler Carruth2011-10-151-8/+3
| | | | | | | | | TextDiagnosticPrinter argument to the TextDiagnostic helper class. This cements the proper ordering of things: TextDiagnostic is now a viable stand-alone class for emitting pretty-printed textual diagnostics to a terminal. llvm-svn: 142070
* Sink the include stack printing into the generic text diagnosticChandler Carruth2011-10-151-52/+50
| | | | | | | | | | | | | | | utility. This is a particularly nice win because it removes a pile of parameters from these routines. Also name them a bit better. I'm trying to follow the pattern of 'emit' routines writing directly to what is expected to be the final output, while 'print' routines take a output stream argument and can be used to build up intermediate buffers, etc. Also, fix a bug I spotted by inspection from my last commit where 'LastLoc' and 'LastNonNoteLoc' were reversed. It's really scary that this didn't trigger a single test failure. Will be working on tests for more of this functionality now. llvm-svn: 142069
* Rationalize some of how the locations of prior diagnostics are trackedChandler Carruth2011-10-151-12/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | across emissions. 1) The include stack printing is conditioned on non-note diagnostics, not just on warning diagnostics. 2) Those should be full source locations as they're tied to a source manager. 3) We should pass in the prior state to the TextDiagnostic constructor, allow it to mutate as diagnostics are emitted, and then cache the final state before tearing it down. Some of this remains incomplete, specifically #3 isn't finished for the non-note location. That'll come when the include stack printing sinks down a level. This also highlights how *completely* bug-ridden this code is. For example, we currently do all these comparisons of a FullSourceLoc and a SourceLocation... which silently does a SourceLocation to SourceLocation comparison, completely disregarding the source manager from whence one of the arguments came. Oops! Good thing in practice this wasn't important, but it could in theory be suppressing caret diagnostics in a second TU on a single clang invocation. I'm hoping to hammer these bugs out as the refactorings occur, although for so many of them it's really unlikely I can dream up a test case that would show the potentially buggy behavior. llvm-svn: 142067
* Sink the EmitDiagnosticLoc method down to the generic TextDiagnosticChandler Carruth2011-10-151-110/+108
| | | | | | interface now that its only caller is there. llvm-svn: 142065
* Sink the non-caret diagnostic logic down and out of the diagnosticChandler Carruth2011-10-151-270/+276
| | | | | | | | | | | | | consumer. The TextDiagnostic interface now has a generic entry point for emitting a diagnostic which uses a minimal interface that should be compatible with StoredDiagnostics such as are available in libclang etc. Some unfortunate shuffling of static functions as things get relocated. Also some unfortunate public interface points added to TextDiagnosticPrinter, but those are the next bits to get moved so they won't last long. llvm-svn: 142064
* Simplify the interface of a helper method in the TextDiagnosticPrinterChandler Carruth2011-10-151-17/+18
| | | | | | | | | | | to operate directly on the source location and ranges associated with a diagnostic rather than digging them out of the diagnostic. This had a side benefit of cleaning up its code a tiny bit by using the ArrayRef interface. No functionality changed. llvm-svn: 142063
* Change 'Emit' to 'EmitCaret' which sums up what it *should* be doing.Chandler Carruth2011-10-151-6/+9
| | | | | | | | Also note that it is actually doing much more than it should. This paves the way for building a more generic 'Emit' routine that is the real entry point here. llvm-svn: 142035
* Allow calling ASTUnit::LoadFromCompilerInvocationAction with a previously ↵Argyrios Kyrtzidis2011-10-141-13/+16
| | | | | | created ASTUnit. llvm-svn: 142004
* Change operator<< for raw_ostream and NamedDecl to take a reference instead ↵Benjamin Kramer2011-10-141-24/+24
| | | | | | | | of a pointer. Passing a pointer was a bad idea as it collides with the overload for void*. llvm-svn: 141971
* Frontend: Replace -nostdinc by -nostdsysteminc (which is just system includeDaniel Dunbar2011-10-112-24/+33
| | | | | | paths). The -nostdinc behavior is now -nostdsysteminc + -nobuiltininc. llvm-svn: 141691
* For the FileChanged Preprocessor callback, when exiting a file, pass its FileID.Argyrios Kyrtzidis2011-10-113-6/+12
| | | | llvm-svn: 141681
* [libclang] Implement ConcurrencyCheck using a recursive mutex to allow ↵Argyrios Kyrtzidis2011-10-101-2/+28
| | | | | | | | re-entrancy in the same thread. The checks are performed only in DEBUG, it becomes no-op in release mode. llvm-svn: 141582
* Revert r140009, about disabling clang's builtin in -fms-compatibility mode. Francois Pichet2011-10-101-2/+1
| | | | llvm-svn: 141577
* When an included non-system directory duplicates a system directory the clang Chad Rosier2011-10-101-4/+10
| | | | | | | | frontend removes the non-system directory to maintain gcc compatibility. When this happens NumAngled needs to be updated. PR11097 llvm-svn: 141565
* OpenCL: add driver/frontend support for precompiled headersPeter Collingbourne2011-10-091-0/+1
| | | | llvm-svn: 141516
* lib/Frontend/CompilerInstance.cpp: Suppress a "Comparision of unsigned and ↵NAKAMURA Takumi2011-10-081-1/+1
| | | | | | signed" warning on Cygwin gcc-4.3.4. llvm-svn: 141488
* WhitespaceNAKAMURA Takumi2011-10-081-87/+87
| | | | llvm-svn: 141486
* Rename TagDecl::isDefinition -> isCompleteDefinitionJohn McCall2011-10-071-3/+3
| | | | | | | for better self-documenting code, since the semantics are subtly different from getDefinition(). llvm-svn: 141355
* CUDA: add -fcuda-is-device flagPeter Collingbourne2011-10-061-0/+3
| | | | | | | This frontend-only flag is used by the IR generator to determine whether to filter CUDA declarations for the host or for the device. llvm-svn: 141301
* Driver & AST: Implement support for -fpack-struct and -fpack-struct= commandDaniel Dunbar2011-10-051-0/+1
| | | | | | | line options. - <rdar://problem/10120602>, PR9631 llvm-svn: 141211
* Seriously ugly hack, part 2Douglas Gregor2011-10-051-1/+7
| | | | llvm-svn: 141181
* Seriously ugly hack to try to get the Windows builders back onlineDouglas Gregor2011-10-051-2/+15
| | | | llvm-svn: 141180
* Introduce a simple file-based locking protocol for on-demand moduleDouglas Gregor2011-10-051-0/+259
| | | | | | | | | | | creation, so that only a single Clang instance will rebuild a given module at once (and the others will wait). We still don't clean up the lock files when we crash, which is a rather unfortunate problem. I'll handle that next, and there is certainly a *lot* of room for further improvements. llvm-svn: 141179
* Fix include path detection on Fedora 15 with GCC 4.6.1. Patch by Arthur Haas.Justin Holewinski2011-10-041-1/+6
| | | | llvm-svn: 141086
* Rip out flags for controlling C++ "production mode" separately.Bob Wilson2011-10-041-1/+1
| | | | | | | This is old leftover cruft from the days when C++ was not yet ready for prime time. llvm-svn: 141063
* When build a module on demand, run the module-building job on aDouglas Gregor2011-10-041-3/+21
| | | | | | | separate thread with the "suitably large" stack, so we don't blow the stack when building modules recursively. llvm-svn: 141051
* Make -fobjc-nonfragile-abi the -cc1 default, since it's theJohn McCall2011-10-021-6/+4
| | | | | | | | | | | | | | | | | | | increasingly prevailing case to the point that new features like ARC don't even support the fragile ABI anymore. This required a little bit of reshuffling with exceptions because a check was assuming that ObjCNonFragileABI was only being set in ObjC mode, and that's actually a bit obnoxious to do. Most, though, it involved a perl script to translate a ton of test cases. Mostly no functionality change for driver users, although there are corner cases with disabling language-specific exceptions that we should handle more correctly now. llvm-svn: 140957
* [analyzer] Add -analyzer-purge option which can take on multiple values, ↵Anna Zaks2011-09-301-3/+29
| | | | | | remove -analyzer-purge=none. (Small refactor as well: move the work of constructing AnalysisManager from the callers to the class itself.) llvm-svn: 140838
* Basic/Diagnostics: Add an isDefaultMappingAsError method, and switch ↵Daniel Dunbar2011-09-291-9/+13
| | | | | | | | TextDiagnosticPrinter to use that instead of extracting the current mapping via getDiagnosticLevel, which fixes one class of corner cases w.r.t. printing the "-Werror" diagnostic option marker. - The TextDiagnosticPrinter code is still fragile as it is just "reverse engineering" what the diagnostic engine is doing. Not my current priority to fix though. llvm-svn: 140752
* Basic/Diagnostic: Factor outDaniel Dunbar2011-09-291-14/+22
| | | | | | | | | DiagnosticsEngine::setDiagnosticGroup{ErrorAsFatal,WarningAsError} methods which more accurately model the correct API -- no internal change to the diagnostics engine yet though. - Also, stop honoring -Werror=everything (etc.) as a valid (but oddly behaved) option. llvm-svn: 140747
* Introduce an opt-in warning when a module is being implicitly builtDouglas Gregor2011-09-291-0/+2
| | | | | | from sources. llvm-svn: 140746
* Introduce a pure virtual clone() method to DiagnosticConsumer, so thatDouglas Gregor2011-09-296-13/+42
| | | | | | | | | we have the ability to create a new, distict diagnostic consumer when we go off and build a module. This avoids the currently horribleness where the same diagnostic consumer sees diagnostics for multiple translation units (and multiple SourceManagers!) causing all sorts of havok. llvm-svn: 140743
* [driver] Add basic support for escaping XML characters in CC_LOG_DIAGNOSTICSChad Rosier2011-09-281-5/+30
| | | | | | | strings. rdar://9696709 llvm-svn: 140732
* Remove the egregious hack that made Objective-C++ ARC work with olderDouglas Gregor2011-09-271-70/+1
| | | | | | | versions of libc++. Newer versions of libc++ know how to deal with ARC properly. Fixes <rdar://problem/10062179>. llvm-svn: 140651
* When 'bool' is not a built-in type but is defined as a macro, printDouglas Gregor2011-09-271-1/+1
| | | | | | | 'bool' rather than '_Bool' within types, to make things a bit more readable. Fixes <rdar://problem/10063263>. llvm-svn: 140650
* Add back support for a manually formatted section of the diagnosticChandler Carruth2011-09-261-1/+4
| | | | | | | | | | | message. Specifically, we now only line-wrap the first line of te diagnostic message and assume the remainder is manually formatted. While adding it back, simplify the logic for doing this. Finally, add a test that ensures we actually preserve this feature. =D *Now* its not dead code. Thanks to Doug for the test case. llvm-svn: 140538
* Hoist and beef up the asserts about the level of infrastructure expectedChandler Carruth2011-09-261-5/+10
| | | | | | | | | | | | | | | | | when working with a diagnostic attached to a source location. Also comment more thoroughly why its important to handle non-location diagnostic messages separately. Finally, hoist the creation of the TextDiagnostic object up to the beginning of the location-based diagnostics. This paves the way for sinking more and more of the logic into this class. When everything below this constructor is sunk into the TextDiagnostic class it should be sufficiently "feature complete" to accomplish my two goals: 1) Have the printing of a macro expansion note use the exact same code as any other note. 2) Be able to implement clang_formatDiagnostic in terms of this class. llvm-svn: 140526
* Switch the emission of diagnostics without a source location toChandler Carruth2011-09-261-22/+32
| | | | | | | | | | | | | | | | | | | | | a dedicated path. The logic for such diagnostics is much simpler than for others. This begins to make an important separation in this routine. We expect most (and most interesting) textual diagnostics to be made in the presence of at least *some* source locations and a source manager. However the DiagnosticConsumer must be prepared to diagnose errors even when the source manager doesn't (yet) exist or when there is no location information at all. In order to sink more and more logic into the TextDiagnostic class while minimizing its complexity, my plan is to force the DiagnosticConsumer to special case diagnosing any locationless messages and then hand the rest to the TextDiagnostic class. I'd appreciate any comments on this design. It requires a bit of code duplication in order to keep interfaces simple. Alternatively, if we really need TextDiagnostic to be capable of handling diagnostics even in the absence of a viable SourceManager, then this split isn't necessary. llvm-svn: 140525
* Extract the actual printing of the message string into a helperChandler Carruth2011-09-261-32/+33
| | | | | | | | | function. Doing this conveniently requires moving the word wrapping to use a StringRef which seems generally an improvement. There is a lot that could be simplified in the word wrapping by using StringRef that I haven't looked at yet... llvm-svn: 140524
* Group the helpers for word wrapping with the primary routine. NoChandler Carruth2011-09-261-92/+92
| | | | | | functionality changed. llvm-svn: 140523
* Don't map a file:line:col triplet that is inside the preamble range toArgyrios Kyrtzidis2011-09-261-12/+44
| | | | | | | | | | | | | | a "loaded" location of the precompiled preamble. Instead, handle specially locations of preprocessed entities: -When looking up for preprocessed entities, map main file locations inside the preamble range to a preamble loaded location. -When getting the source range of a preprocessing cursor, map preamble loaded locations back to main file locations. Fixes rdar://10175093 & http://llvm.org/PR10999 llvm-svn: 140519
* Don't print a stray ] at the end of diagnostics.Benjamin Kramer2011-09-261-3/+4
| | | | | | Also remove an obsolete utostr call. llvm-svn: 140511
* Remove support for splitting word-wrapped diagnostic messages on newlineChandler Carruth2011-09-261-18/+2
| | | | | | | | | | | | characters. I could find no newline character in a diagnostic message, and adding an assert to this code never fires in the testsuite. I think this code is essentially dead, and was previously used for a different purpose. If I just don't understand how it is we can end up with a newline here please let me know (with a test case?) and I'll revert. llvm-svn: 140497
* Move the word wrapped printing routine down to all the other helperChandler Carruth2011-09-261-82/+77
| | | | | | | printing routines, clean up its doxyments and switch it to a camelCase name as well. No functionality changed here. llvm-svn: 140496
* Switch some of my recently added helper functions to use the properChandler Carruth2011-09-261-6/+19
| | | | | | style, and add doxyments. llvm-svn: 140495
* Rewrite the printing of diagnostic options, categories, etc to actuallyChandler Carruth2011-09-261-35/+29
| | | | | | use the ostream interface and avoid lots of temporary strings. llvm-svn: 140494
OpenPOWER on IntegriCloud