History log of /external/clang/include/clang/Basic/Diagnostic.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
ef8225444452a1486bd721f3285301fe84643b00 21-Jul-2014 Stephen Hines <srhines@google.com> Update Clang for rebase to r212749.

This also fixes a small issue with arm_neon.h not being generated always.

Includes a cherry-pick of:
r213450 - fixes mac-specific header issue
r213126 - removes a default -Bsymbolic on Android

Change-Id: I2a790a0f5d3b2aab11de596fc3a74e7cbc99081d
6bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89 29-May-2014 Stephen Hines <srhines@google.com> Update Clang for 3.5 rebase (r209713).

Change-Id: I8c9133b0f8f776dc915f270b60f94962e771bc83
651f13cea278ec967336033dd032faef0e9fc2ec 24-Apr-2014 Stephen Hines <srhines@google.com> Updated to Clang 3.5a.

Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
9568d1c45feef22713afa551d06d60a05dc07133 21-Oct-2013 Rafael Espindola <rafael.espindola@gmail.com> Cleanup redundant include.

Patch by Daniel Marjamäki.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193093 91177308-0d34-0410-b5e6-96231b3b80d8
5940bf33061844c9a61d4d5c1230df9cf9e90342 23-Jul-2013 Richard Trieu <rtrieu@google.com> Add new diagnostic messages when too many arguments are presented to a
function-like macro. Clang will attempt to correct the arguments by detecting
braced initializer lists:

1) If possible, suggest parentheses around arguments
containing braced lists which will give the proper number of arguments.
2) If a braced list is detected at the start of a macro argument, it cannot be
corrected by parentheses. Instead, just point out the location of these
braced lists.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186971 91177308-0d34-0410-b5e6-96231b3b80d8
cbc820af7193e3ad9c71fbe6e3c8bd3c1166e540 22-Jul-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement DR257 / fix PR16659:
A constructor for an abstract class does not call constructors for virtual
base classes, so it is not an error if no initializer is present for the
virtual base and the virtual base cannot be default initialized.

Also provide a (disabled by default, for now) warning for the case where a
virtual base class's initializer is ignored in an abstract class's constructor,
and address a defect in DR257 where it was not carried through to C++11's rules
for implicit deletion of special member functions.

Based on a patch by Maurice Bos.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186803 91177308-0d34-0410-b5e6-96231b3b80d8
7247c88d1e41514a41085f83ebf03dd5220e054a 15-May-2013 David Blaikie <dblaikie@gmail.com> Use only explicit bool conversion operator

The most common (non-buggy) case are where such objects are used as
return expressions in bool-returning functions or as boolean function
arguments. In those cases I've used (& added if necessary) a named
function to provide the equivalent (or sometimes negative, depending on
convenient wording) test.

DiagnosticBuilder kept its implicit conversion operator owing to the
prevalent use of it in return statements.

One bug was found in ExprConstant.cpp involving a comparison of two
PointerUnions (PointerUnion did not previously have an operator==, so
instead both operands were converted to bool & then compared). A test
is included in test/SemaCXX/constant-expression-cxx1y.cpp for the fix
(adding operator== to PointerUnion in LLVM).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181869 91177308-0d34-0410-b5e6-96231b3b80d8
d99990df0b4aca43a0315b2928ff1b8baf704052 04-May-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> Revert r177218.

Per discussion in cfe-commits, asserting may be a better way than introducing a special test flag.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181073 91177308-0d34-0410-b5e6-96231b3b80d8
cc2b653c319599f502425d2c3de29865d47bb9e4 04-May-2013 Douglas Gregor <dgregor@apple.com> Remove DiagnosticConsumer::clone(), a bad idea that is now unused.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181070 91177308-0d34-0410-b5e6-96231b3b80d8
a4a90cabfa15c900016a7cfaea51a6d4e8ebf4db 04-May-2013 Douglas Gregor <dgregor@apple.com> When building a module, forward diagnostics to the outer diagnostic consumer.

Previously, we would clone the current diagnostic consumer to produce
a new diagnostic consumer to use when building a module. The problem
here is that we end up losing diagnostics for important diagnostic
consumers, such as serialized diagnostics (where we'd end up with two
diagnostic consumers writing the same output file). With forwarding,
the diagnostics from all of the different modules being built get
forwarded to the one serialized-diagnostic consumer and are emitted in
a sane way.

Fixes <rdar://problem/13663996>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181067 91177308-0d34-0410-b5e6-96231b3b80d8
04863a86d15cb8de3361f8c77cedfd025819f174 31-Mar-2013 Benjamin Kramer <benny.kra@googlemail.com> Fix typo. This method isn't used anywhere.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178453 91177308-0d34-0410-b5e6-96231b3b80d8
6aa240c03dd68ab413106d6af7a18af1c9b4e872 16-Mar-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> Remove -Wspellcheck and replace it with a diagnostic option.

Thanks to Richard S. for pointing out that the warning would show up
with -Weverything.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177218 91177308-0d34-0410-b5e6-96231b3b80d8
fc09336a5965040736f9bc63a70416003972364e 01-Mar-2013 Stefanus Du Toit <stefanus.dutoit@rapidmind.com> Fix typos: [Dd]iagnosic -> [Dd]iagnostic

These all appear in comments or (ironically) diagnostics output.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176383 91177308-0d34-0410-b5e6-96231b3b80d8
4a2ef80d896c1bac38ce113ec19a8d509a619288 07-Jan-2013 Nico Weber <nicolasweber@gmx.de> Simplify. No behavior change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171680 91177308-0d34-0410-b5e6-96231b3b80d8
5b9268f26ac53a74d2c504279fe577d988d5615d 20-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix code that attempted to produce a diagnostic with one DiagnosticEngine, then
produce a note for that diagnostic either with a different DiagnosticEngine or
after calling DiagnosticEngine::Reset(). That didn't make any sense, and did the
wrong thing if the original diagnostic was suppressed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170636 91177308-0d34-0410-b5e6-96231b3b80d8
12f37e411462b8388eb1309357bd62257debacac 07-Dec-2012 DeLesley Hutchins <delesley@google.com> Fix analysis based warnings so that all warnings are emitted when compiling
with -Werror. Previously, compiling with -Werror would emit only the first
warning in a compilation unit, because clang assumes that once an error occurs,
further analysis is unlikely to return valid results. However, warnings that
have been upgraded to errors should not be treated as "errors" in this sense.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169649 91177308-0d34-0410-b5e6-96231b3b80d8
30a2e16f6c27f888dd11eba6bbbae1e980078fcb 04-Dec-2012 Chandler Carruth <chandlerc@gmail.com> Sort #include lines for all files under include/...

This is a simpler sort, entirely automatic with the help of
llvm/utils/sort_includes.py -- no manual edits here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169238 91177308-0d34-0410-b5e6-96231b3b80d8
82c6dc72adc30e785ce5bc6e8b43ae92070d2e08 31-Oct-2012 David Blaikie <dblaikie@gmail.com> Handle string encoding diagnostics when there are too many invalid ranges.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167059 91177308-0d34-0410-b5e6-96231b3b80d8
dc7b641574a733624489bd87fc7061771edf2113 24-Oct-2012 Douglas Gregor <dgregor@apple.com> Use a .def file for most of the diagnostic options.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166520 91177308-0d34-0410-b5e6-96231b3b80d8
02c23ebf41ae2f70da0ba7337e05c51fbfe35f7f 24-Oct-2012 Douglas Gregor <dgregor@apple.com> Make DiagnosticOptions intrusively reference-counted, and make sure
the various stakeholders bump up the reference count. In particular,
the diagnostics engine now keeps the DiagnosticOptions object alive.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166508 91177308-0d34-0410-b5e6-96231b3b80d8
4def70d3040e73707c738f7c366737a986135edf 09-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> -fcatch-undefined-behavior: emit calls to the runtime library whenever one of the checks fails.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165536 91177308-0d34-0410-b5e6-96231b3b80d8
f3477c13eeaf11b32a41f181398fb5deffd0dd73 27-Sep-2012 Sylvestre Ledru <sylvestre@debian.org> Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. See: http://en.wikipedia.org/wiki/If_and_only_if Commit 164766

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164769 91177308-0d34-0410-b5e6-96231b3b80d8
94ff8e1f57c6382d91d0de981a4f311509d83e37 27-Sep-2012 Sylvestre Ledru <sylvestre@debian.org> Fix a typo 'iff' => 'if'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164766 91177308-0d34-0410-b5e6-96231b3b80d8
5d99a252c63a7745bcd71231ca5240d2a65e4f1d 22-Sep-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix bug which sometimes resulted in further diagnostics being produced after a
fatal error. Previously, if a fatal error was followed by a diagnostic which
was suppressed due to a SFINAETrap, we'd forget that we'd seen a fatal error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164437 91177308-0d34-0410-b5e6-96231b3b80d8
f56faa01936b9cf909623d7f06e3c2569ca4a78e 15-Sep-2012 Dmitri Gribenko <gribozavr@gmail.com> Use LLVM_DELETED_FUNCTION in place of 'DO NOT IMPLEMENT' comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163983 91177308-0d34-0410-b5e6-96231b3b80d8
00aae5243d965aa7bcee81a39ba0900c7869be21 14-Aug-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix undefined behavior: don't bind a dereferenced null pointer to a reference.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161832 91177308-0d34-0410-b5e6-96231b3b80d8
c6d64a26c28bbeee50e06c94c4f4c08e610327b7 11-Jul-2012 Jordan Rose <jordan_rose@apple.com> Emit -verify diagnostics even when we have a fatal error.

Previously we'd halt at the fatal error as expected, but not actually emit
any -verify-related diagnostics. This lets us catch cases that emit a
/different/ fatal error from the one we expected.

This is implemented by adding a "force emit" mode to DiagnosticBuilder, which
will cause diagnostics to immediately be emitted regardless of current
suppression. Needless to say this should probably be used /very/ sparingly.

Patch by Andy Gibbs! Tests for all of Andy's -verify patches coming soon.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160053 91177308-0d34-0410-b5e6-96231b3b80d8
5409d28b6167032696f4915bb765a6f7db579f3f 10-Jul-2012 Richard Trieu <rtrieu@google.com> Properly update the FormattedArgs vector when the template type diffing falls
back to regular type printing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159976 91177308-0d34-0410-b5e6-96231b3b80d8
af50aab0c317462129d73ae8000c6394c718598d 03-Jul-2012 James Dennett <jdennett@google.com> Documentation cleanup:
* Primarily, added \brief to most of include/clang/Basic, instead of prefixing
the comments with "DeclaredName - ";
* Made some brief summaries significantly briefer;
* Fixed up some erroneous uses of \see and \arg;
* Fixed up some extraneous backslashes in \code...\endcode blocks;
* Fixed up some typos/spelling errors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159616 91177308-0d34-0410-b5e6-96231b3b80d8
2f7f5b1f5ff023cb8c4008ae53a12b09e3ea2622 02-Jul-2012 James Dennett <jdennett@google.com> Documentation cleanup: reformatting/fixing up file comments so that they have
\file and \brief markup and appear in Doxygen's summaries (and eventually at
http://clang.llvm.org/doxygen/files.html). Fixed up another couple of minor
glitches in the docs at the same time.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159517 91177308-0d34-0410-b5e6-96231b3b80d8
246b6aa6763de8c617d564ef33123a8f3293a80e 26-Jun-2012 Richard Trieu <rtrieu@google.com> Add template type diffing to Clang. This feature will provide a better
comparison between two templated types when they both appear in a diagnostic.
Type elision will remove indentical template arguments, which can be disabled
with -fno-elide-type. Cyan highlighting is applied to the differing types.

For more formatting, -fdiagnostic-show-template-tree will output the template
type as an indented text tree, with differences appearing inline. Template
tree works with or without type elision.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159216 91177308-0d34-0410-b5e6-96231b3b80d8
efce31f51d6e7e31e125f96c20f6cdab3ead0a47 22-Jun-2012 James Dennett <jdennett@google.com> Documentation cleanup:
* Primarily fixed \param commands with names not matching any actual
parameters of the documented functions. In many cases this consists
just of fixing up the parameter name in the \param to match the code,
in some it means deleting obsolete documentation and occasionally it
means documenting the parameter that has replaced the older one that
was documented, which sometimes means some simple reverse-engineering
of the docs from the implementation;
* Fixed \param ParamName [out] to the correct format with [out] before
the parameter name;
* Fixed some \brief summaries.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158980 91177308-0d34-0410-b5e6-96231b3b80d8
697c7a8af6d090bff2b572553da0957de1724e1e 22-Jun-2012 James Dennett <jdennett@google.com> Documentation cleanup:
* Made \brief documentation be brief, mostly by adding a blank line to make
the rest of the text be part of the detailed description only;
* Removed "FunctionOrClassName - " and other redundant text from the start
of Doxygen comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158964 91177308-0d34-0410-b5e6-96231b3b80d8
ab41fe914f63bb470dfa7e400876ada72f57a931 05-May-2012 Douglas Gregor <dgregor@apple.com> Move Sema::VerifyIntegerConstantExpression() and
Sema::ConvertToIntegralOrEnumerationType() from PartialDiagnostics to
abstract "diagnoser" classes. Not much of a win here, but we're
-several PartialDiagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156217 91177308-0d34-0410-b5e6-96231b3b80d8
3739b32a01b9778176757425e62252c288b85383 20-Mar-2012 Ted Kremenek <kremenek@apple.com> Don't include FixIts with a null replacement range. Fixes <rdar://problem/11040133>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153122 91177308-0d34-0410-b5e6-96231b3b80d8
7059a1cbc29444bec19380059a62db085eb92964 14-Mar-2012 Daniel Dunbar <daniel@zuster.org> [Basic] Change DiagnosticBuilder to use a separate status variable to track whether the builder is active.
- This may seem superflous, but actually this allows the optimizer to more
easily eliminate the isActive() checks needed by the SemaDiagnosticBuilder
and DiagnosticBuilder dtors. And by more easily, I mean the current LLVM is
actually able to do one and not the other. :)

This is good for another 20k code size reduction.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152709 91177308-0d34-0410-b5e6-96231b3b80d8
393eed7fb901e49085c8583ff0439d1273b6f2fe 14-Mar-2012 Daniel Dunbar <daniel@zuster.org> [Sema] Fix SemaDiagnosticBuilder to be inline.
- As with DiagnosticBuilder, it is very important that SemaDiagnosticBuilder be
completely inline to ensure that the compiler can rip it apart and sink it to

This is good for another 30k reduction in code size.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152708 91177308-0d34-0410-b5e6-96231b3b80d8
3054f097f813d19090bdb23645dcd48df71d1a89 13-Mar-2012 Daniel Dunbar <daniel@zuster.org> [Basic] Fix up DiagnosticBuilder::{FlushCounts,Emit} to be inline.

- This is much more important than it appears at first glance...

The intended design of DiagnosticBuilder was that it never escape and that all
its members would get lowered to registers by the compiler. By fixing Emit here,
the compiler can completely eliminate the DiagnosticBuilder object and never
need to push those registers back into it.

Unfortunately, Sema has broken DiagnosticBuilder in other ways (by introducing
SemaDiagnosticBuilder), so we don't get the fill impact of this, but it is still
good for 30k reduction in code size. I'll work on fixing the
SemaDiagnosticBuilder problems next.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152669 91177308-0d34-0410-b5e6-96231b3b80d8
cefcbef6f3b1e34f31ce0e47214c8b90fedfb9ac 13-Mar-2012 Daniel Dunbar <daniel@zuster.org> [Basic] Make DiagnosticBuilder::{Clear,Emit} protected.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152643 91177308-0d34-0410-b5e6-96231b3b80d8
243d7abb0f09c616781627b864ebde6ee8d0cdc1 13-Mar-2012 Daniel Dunbar <daniel@zuster.org> [Basic] Eliminate DiagnosticBuilder::Suppress and matching ctor, this stuff is
not used anymore (good thing we are still paying for it!).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152642 91177308-0d34-0410-b5e6-96231b3b80d8
06265bd82073c06294a02a0bd891951fafb484a5 13-Mar-2012 Daniel Dunbar <daniel@zuster.org> [Basic] Make DiagnosticBuilder::{isActive,getLocation,getDiagID} protected.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152641 91177308-0d34-0410-b5e6-96231b3b80d8
53c83b32550b3f29db2419160fa2e3684e420556 13-Mar-2012 Daniel Dunbar <daniel@zuster.org> [Basic] Fix ~Diagnostic() to not call Emit() when there is no diag obj (most
commonly when the diag has been copied).
- This eliminates a completely spurious call to Emit() which was in
Sema::Diag(). Sob.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152640 91177308-0d34-0410-b5e6-96231b3b80d8
981e279b95f3a71e2268124b1abaae050ec200dc 13-Mar-2012 Daniel Dunbar <daniel@zuster.org> [Basic] Stop using a SmallVector<> for Diagnostic. This drops Clang binary size
by ~%.3/~100k in my build -- simply by eliminating the horrible code bloat coming
from the .clear() of the SmallVector<FixItHint>, which does a std::~string, etc.
- My understanding is we don't ever emit arbitrary numbers of fixits, so I just
moved us to using a statically sized array like we do for arguments and

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152639 91177308-0d34-0410-b5e6-96231b3b80d8
30660a898545416f0fea2d717f16f75640001e38 06-Mar-2012 Ted Kremenek <kremenek@apple.com> Add new code migrator support for migrating existing Objective-C code to use
the new Objective-C NSArray/NSDictionary/NSNumber literal syntax.

This introduces a new library, libEdit, which provides a new way to support
migration of code that improves on the original ARC migrator. We now believe
that most of its functionality can be refactored into the existing libraries,
and thus this new library may shortly disappear.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152141 91177308-0d34-0410-b5e6-96231b3b80d8
341785ec52f87c0803ba52dc88faac4e136f8593 22-Feb-2012 Bill Wendling <isanbard@gmail.com> More ArrayRef-ification of methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151152 91177308-0d34-0410-b5e6-96231b3b80d8
c93dc7889644293e318e19d82830ea2acc45b678 20-Feb-2012 Dylan Noblesmith <nobled@dreamwidth.org> Basic: import IntrusiveRefCntPtr<> into clang namespace

The class name is long enough without the llvm:: added.
Also bring in RefCountedBase and RefCountedBaseVPTR.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150958 91177308-0d34-0410-b5e6-96231b3b80d8
6700d67925abd674ecddfc56948967f49b25bf39 14-Feb-2012 Ted Kremenek <kremenek@apple.com> Add helper methods to StoredDiagnostic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150454 91177308-0d34-0410-b5e6-96231b3b80d8
d7a3e2c5f61cd4893f95b69a424fe4def3aa0f69 07-Feb-2012 Benjamin Kramer <benny.kra@googlemail.com> Revert my patches which removed Diagnostic.h includes by moving some operator overloads out of line.

This seems to negatively affect compile time onsome ObjC tests
(which use a lot of partial diagnostics I assume). I have to come
up with a way to keep them inline without including Diagnostic.h
everywhere. Now adding a new diagnostic requires a full rebuild
of e.g. the static analyzer which doesn't even use those diagnostics.

This reverts commit 6496bd10dc3a6d5e3266348f08b6e35f8184bc99.
This reverts commit 7af19b817ba964ac560b50c1ed6183235f699789.
This reverts commit fdd15602a42bbe26185978ef1e17019f6d969aa7.
This reverts commit 00bd44d5677783527d7517c1ffe45e4d75a0f56f.
This reverts commit ef9b60ffed980864a8db26ad30344be429e58ff5.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150006 91177308-0d34-0410-b5e6-96231b3b80d8
3f22509ebf91aa96658ca6e5c5c0b926d8d62e34 07-Feb-2012 Chad Rosier <mcrosier@apple.com> In r149662, setDiagnosticMapping was modified to not allow warnings mapped to
MAP_ERROR to be remapped to MAP_WARNING. These new APIs are being added to
allow the diagnostic mapping's "no Werror" bit to be set, and potentially
downgrade anything already mapped to be a warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150001 91177308-0d34-0410-b5e6-96231b3b80d8
ef9b60ffed980864a8db26ad30344be429e58ff5 04-Feb-2012 Benjamin Kramer <benny.kra@googlemail.com> Move Storage and StorageAllocator out of the PartialDiagnostic class so we can forward declare them.

Let ASTContext allocate the storage in its BumpPtrAllocator.
This will help us remove ASTContext's depedency on PartialDiagnostic.h soon.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149780 91177308-0d34-0410-b5e6-96231b3b80d8
cbf46a0b2bb2b47d6e13437e0d52cc583c5ce539 03-Feb-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Change the fixed array of FixitHints to a SmallVector to lift off
the limit on the number of fixits.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149676 91177308-0d34-0410-b5e6-96231b3b80d8
82e6411d004064a29f03a3ea8b8919f297bfa843 28-Jan-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> DiagnosticsEngine::setMappingToAllDiagnostics() does not need to return bool,
caught by Chad.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149173 91177308-0d34-0410-b5e6-96231b3b80d8
11583c757bac6ce5c342f2eb572055dd2619a657 27-Jan-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Due to a bug, -Wno-everything works like -Weverything. Fix the bug by having
-Wno-everything remap all warnings to ignored.

We can now use "-Wno-everything -W<warning>" to ignore all warnings except
specific ones.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149121 91177308-0d34-0410-b5e6-96231b3b80d8
61d679ab2831b161c857cf3f974312fbd4ef1efd 26-Jan-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce 3 new fixit options:

applies fixits and recompiles the result
applies fixits to temporary files
applies fixits for warnings only, not errors

Combining "-fixit-recompile -fixit-to-temporary" allows testing the result of fixits
without touching the original sources.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149027 91177308-0d34-0410-b5e6-96231b3b80d8
99ba9e3bd70671f3441fb974895f226a83ce0e66 20-Dec-2011 David Blaikie <dblaikie@gmail.com> Unweaken vtables as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146959 91177308-0d34-0410-b5e6-96231b3b80d8
08d6e032a2a0a8656d12b3b7b93942987bb12eb7 16-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> C++11 constexpr: Add note stacks containing backtraces if constant evaluation
fails within a call to a constexpr function. Add -fconstexpr-backtrace-limit
argument to driver and frontend, to control the maximum number of notes so
produced (default 10). Fix APValue printing to be able to pretty-print all
APValue types, and move the testing for this functionality from a unittest to
a -verify test now that it's visible in clang's output.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146749 91177308-0d34-0410-b5e6-96231b3b80d8
29f2787b6da552018a7716f18f5bd8f67bd6edb5 07-Dec-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Make changes to SDiagsWriter to make it work in combination with the ARC migrator:

-Allow it to be used with multiple BeginSourceFile/EndSourceFile calls; for this introduce
a "finish" callback method in the DiagnosticConsumer. SDiagsWriter finishes up the serialization
file inside this method.
-Make it independent of any particular DiagnosticsEngine; make it use the SourceManager of the
Diagnostic object.
-Ignore null source ranges.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146020 91177308-0d34-0410-b5e6-96231b3b80d8
87429a05ff66fe6460eaa4855fd0da574e26bf7b 09-Nov-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] Fix reading from PCH of diagnostic pragmas.

In certain cases ASTReader would call the normal DiagnosticsEngine API to initialize
the state of diagnostic pragmas but DiagnosticsEngine would try to compare source locations
leading to crash because the main FileID was not yet initialized.

Yet another case of the ASTReader trying to use the normal APIs and inadvertently breaking
invariants. Fix this by having the ASTReader set up the internal state directly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144153 91177308-0d34-0410-b5e6-96231b3b80d8
77faa365cb2322cfc8edf58a4f5d68f2370cc39a 19-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> -Wc++98-compat: warn if a SFINAE substitution in C++11 suppresses an access
control diagnostic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142463 91177308-0d34-0410-b5e6-96231b3b80d8
28409289193afca1a3178a9796f8e8aebcb76896 15-Oct-2011 Chandler Carruth <chandlerc@gmail.com> Add an accessor for all of the ranges in a diagnostic as an ArrayRef.
This will simplify a number of calls in the diagnostic printing going

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142062 91177308-0d34-0410-b5e6-96231b3b80d8
7035f310f5cfedb35ee4422bcab98e9f18f4ce63 03-Oct-2011 Matt Beaumont-Gay <matthewbg@google.com> Don't crash when trying to emit too many fixits. Also, keep some constants in
sync between DiagnosticsEngine and PartialDiagnostic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141006 91177308-0d34-0410-b5e6-96231b3b80d8
aeacae523a1c6e5bb99d12754415bbbc3ccb86c9 29-Sep-2011 Daniel Dunbar <daniel@zuster.org> Basic/Diagnostic: Kill off a few unnecessary functions now that refactoring is done, and add a note that the new setDiagnosticGroup{...} methods only operate on the current diagnostic state.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140771 91177308-0d34-0410-b5e6-96231b3b80d8
3f8394669673451061f57ced81f0a2cae087f119 29-Sep-2011 Daniel Dunbar <daniel@zuster.org> Basic/Diagnostics: Add a DiagnosticIDs::getDiagnosticsInGroup method, and use
that in DiagnosticEngine instead of the convoluted calling into DiagnosticIDs
which then calls back into the DiagnosticsEngine.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140766 91177308-0d34-0410-b5e6-96231b3b80d8
ba494c64365d78b1cdb6baea4d1e79263389fda9 29-Sep-2011 Daniel Dunbar <daniel@zuster.org> Basic/Diagnostic: Add a DiagSate::getOrAddMappingInfo method.
- Also, spell const_iterator as const_iterator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140765 91177308-0d34-0410-b5e6-96231b3b80d8
09ea68d17bc0fc0b16d287ad4d3f61fe7def4f17 29-Sep-2011 Daniel Dunbar <daniel@zuster.org> Basic/Diagnostics: Move setDiagnosticMapping() to using DiagnosticMappingInfo
and eliminate setDiagnosticMappingInternal.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140763 91177308-0d34-0410-b5e6-96231b3b80d8
b1c99c679adb53be8f478d08be83af6c9c22ae4b 29-Sep-2011 Daniel Dunbar <daniel@zuster.org> Basic/Diagnostics: Add a DiagnosticMappingInfo helper class, and switch to
storing mappings with that instead of straying some magic constants about the

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140760 91177308-0d34-0410-b5e6-96231b3b80d8
c3c4a89747e12ebc2eabe57265c8b69ab720ecbf 29-Sep-2011 Daniel Dunbar <daniel@zuster.org> Basic/Diagnostics: Eliminate getDiagnosticMappingInfo method, which wasn't worth methodizing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140759 91177308-0d34-0410-b5e6-96231b3b80d8
1656aaec223949245fdbebf306b719cba0b687ca 29-Sep-2011 Daniel Dunbar <daniel@zuster.org> Basic/Diagnostic: Eliminate the extra "mapping" out-parameter now that I killed the sole client.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140756 91177308-0d34-0410-b5e6-96231b3b80d8
4aa8f2bce0f498152d624f748712a991adc23fdd 29-Sep-2011 Daniel Dunbar <daniel@zuster.org> Basic/Diagnostic: Factor out
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140747 91177308-0d34-0410-b5e6-96231b3b80d8
aee526e77657afd1600276450e9c346953ad51d7 29-Sep-2011 Douglas Gregor <dgregor@apple.com> Introduce a pure virtual clone() method to DiagnosticConsumer, so that
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140743 91177308-0d34-0410-b5e6-96231b3b80d8
40847cfb58acc3cac7d68727df9455ac45f2e118 26-Sep-2011 David Blaikie <dblaikie@gmail.com> Rename DiagnosticInfo to Diagnostic as per issue 5397

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140493 91177308-0d34-0410-b5e6-96231b3b80d8
78ad0b98848c17a0a11847fa1d456e2dfec8aa2f 26-Sep-2011 David Blaikie <dblaikie@gmail.com> Rename DiagnosticClient to DiagnosticConsumer as per issue 5397

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140479 91177308-0d34-0410-b5e6-96231b3b80d8
d6471f7c1921c7802804ce3ff6fe9768310f72b9 26-Sep-2011 David Blaikie <dblaikie@gmail.com> Rename Diagnostic to DiagnosticsEngine as per issue 5397

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140478 91177308-0d34-0410-b5e6-96231b3b80d8
78243658c533168d51fd076fba328437932ba6f1 13-Sep-2011 Douglas Gregor <dgregor@apple.com> When compiling a module on-demand, re-use the diagnostics client
already provided. This required a little bit of clean-up in the way
that VerifyDiagnosticsClient managed ownership of its underlying
"primary" client, because now it will no longer always take ownership.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139570 91177308-0d34-0410-b5e6-96231b3b80d8
1e473ccb0e0f6fd1954bef330f7193c1a3fb3ba1 18-Aug-2011 Ted Kremenek <kremenek@apple.com> Implement '-Weverything', which enables all warnings except those explicitly mapped to be ignored.

Currently this includes -pedantic warnings as well; we'll need to consider whether these should
be included.

This works as expected with -Werror.

Test cases were added to Sema/warn-unused-parameters.c, but they should probably be broken off into
their own test file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137910 91177308-0d34-0410-b5e6-96231b3b80d8
c0a575f9b791a25c94b1c3c832dd73ec564646bb 29-Jul-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Make DiagnosticErrorTrap keep a count of the errors that occurred so multiple
DiagnosticErrorTraps can be composed (e.g. a trap inside another trap).

Fixes http://llvm.org/PR10462 & rdar://9852007.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136447 91177308-0d34-0410-b5e6-96231b3b80d8
2d3ba4f5a923a90c3fc290ddfba5e36c2d0a9b46 23-Jul-2011 Chris Lattner <sabre@nondot.org> Move ArrayRef to LLVM.h and eliminate now-redundant qualifiers, patch by Jon Mulder!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135855 91177308-0d34-0410-b5e6-96231b3b80d8
686775deca8b8685eb90801495880e3abdd844c2 20-Jul-2011 Chris Lattner <sabre@nondot.org> now that we have a centralized place to do so, add some using declarations for
some common llvm types: stringref and smallvector. This cleans up the codebase
quite a bit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135576 91177308-0d34-0410-b5e6-96231b3b80d8
b89fe6b04c5b8a2d080c1c5605b72f809fc9ee68 19-Jul-2011 Anna Zaks <ganna@apple.com> Add FixItHints in case a C++ function call is missing * or & operators on one/several of it's parameters (addresses http://llvm.org/PR5941).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135509 91177308-0d34-0410-b5e6-96231b3b80d8
f62d43d2afe1960755a1b5813cae1e5983bcac1b 19-Jul-2011 Douglas Gregor <dgregor@apple.com> Revamp the SourceManager to separate the representation of parsed
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135484 91177308-0d34-0410-b5e6-96231b3b80d8
0673cb30340aadaede7b795c763b00f6b64e611c 11-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Apply patch from Richard Trieu to fix PR9548:

When two different types has the same text representation in the same
diagnostic message, print an a.k.a. after the type if the a.k.a. gives extra
information about the type.

class versa_string;

typedef versa_string string;

namespace std {template <typename T> class vector;}

using std::vector;

void f(vector<string> v);

namespace std {
class basic_string;
typedef basic_string string;
template <typename T> class vector {};
void g() {
vector<string> v;

Old message:
test.cc:15:3: error: no matching function for call to 'f'
test.cc:7:6: note: candidate function not viable: no known conversion from
'vector<string>' to 'vector<string>' for 1st argument
void f(vector<string> v);
1 error generated.

New message:
test.cc:15:3: error: no matching function for call to 'f'
test.cc:7:6: note: candidate function not viable: no known conversion from
'vector<string>' (aka 'std::vector<std::basic_string>') to
'vector<string>' (aka 'std::vector<versa_string>') for 1st argument
void f(vector<string> v);
1 error generated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134904 91177308-0d34-0410-b5e6-96231b3b80d8
85bea9777d444ccbcc086d98f075fe666c2e865d 06-Jul-2011 Douglas Gregor <dgregor@apple.com> Keep track of when "unrecoverable" errors occur, then allow
clang_saveTranslationUnit() to save a PCH file if the only errors it
contains are recoverable errors. Fixes <rdar://problem/9727804>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134503 91177308-0d34-0410-b5e6-96231b3b80d8
add80bb3957dba1d9389304453c0a4c975768bd7 16-Jun-2011 John McCall <rjmccall@apple.com> Missing files.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133096 91177308-0d34-0410-b5e6-96231b3b80d8
477aab6782795e7472055a54108d2df270ce1a89 25-May-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> A StringRef-ication of the DiagnosticIDs API and internals.

Patch by Matthieu Monrocq with tweaks by me to avoid StringRefs in the static
diagnostic data structures, which resulted in a huge global-var-init function.

Depends on llvm commit r132046.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132047 91177308-0d34-0410-b5e6-96231b3b80d8
c1b5fa41f09512c74030b9a2a0d1564535e22a76 13-May-2011 Peter Collingbourne <peter@pcc.me.uk> Introduce __has_extension macro

__has_extension is a function-like macro which takes the same set
of feature identifiers as __has_feature. It evaluates to 1 if the
feature is supported by Clang in the current language (either as a
language extension or a standard language feature) or 0 if not.

At the same time, add support for the C1X feature identifiers
c_generic_selections (renamed from generic_selections) and
c_static_assert, and document them.

Patch by myself and Jean-Daniel Dupas.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131308 91177308-0d34-0410-b5e6-96231b3b80d8
e59abb56ce0e1c206fb80bd945a0c358b0abe1ef 05-May-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce a Diagnostic::Report function that accepts and emits a StoredDiagnostic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130919 91177308-0d34-0410-b5e6-96231b3b80d8
fc8f0e14ad142ed811e90fbd9a30e419e301c717 15-Apr-2011 Chris Lattner <sabre@nondot.org> fix a bunch of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129559 91177308-0d34-0410-b5e6-96231b3b80d8
dde5557e87e1163ad792471e0bdbb2cd17894576 14-Apr-2011 Eli Friedman <eli.friedman@gmail.com> Re-fix r129481 and r129465 properly. Nulls fixits shouldn't be dropped in
DiagnosticBuilder::AddFixItHint: they will be dropped along with any
other (possibly valid) fixits later.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129495 91177308-0d34-0410-b5e6-96231b3b80d8
7decebfc7b9dc841f228c93cc2e41e3e62911ff8 25-Feb-2011 Ted Kremenek <kremenek@apple.com> Teach TextDiagnosticPrinter to print out '-Werror' in addition to the warning flag for a warning mapped to an error.

For example:

t.c:7:9: error: using the result of an assignment as a condition without parentheses [-Werror,-Wparentheses]

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126466 91177308-0d34-0410-b5e6-96231b3b80d8
4f5e21e24fb9e6ec473a13f83b5c9a2c41501a70 31-Jan-2011 Douglas Gregor <dgregor@apple.com> Teach Diagnostic::setClient() to free the existing, owned
client. Fixes a libclang leak.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124614 91177308-0d34-0410-b5e6-96231b3b80d8
3efd52cf8f4e57c5571bd8cc3168264c3bc46a1e 14-Jan-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Properly propagate #pragma diagnostic mappings from PCH but not command-line warning flags.
Addresses rdar://8435969&8852495

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123462 91177308-0d34-0410-b5e6-96231b3b80d8
0827408865e32789e0ec4b8113a302ccdc531423 15-Dec-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix diagnostic pragmas.

Diagnostic pragmas are broken because we don't keep track of the diagnostic state changes and we only check the current/latest state.
Problems manifest if a diagnostic is emitted for a source line that has different diagnostic state than the current state; this can affect
a lot of places, like C++ inline methods, template instantiations, the lexer, etc.

Fix the issue by having the Diagnostic object keep track of the source location of the pragmas so that it is able to know what is the diagnostic state at any given source location.

Fixes rdar://8365684.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121873 91177308-0d34-0410-b5e6-96231b3b80d8
aa5f135f8db82b5e5fb1640fd51f8078e0b2d82d 19-Nov-2010 Douglas Gregor <dgregor@apple.com> Extend the libclang diagnostic API to provide information about the
option name, category ID, and category name corresponding to a diagnostic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119802 91177308-0d34-0410-b5e6-96231b3b80d8
3ffe6293123b8fe59bd9d6ed8e3ec755d68e7fac 19-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Remove Diagnostic's get/setNumErrors() and getNumErrorsSuppressed().

Anyone wanting to use it should probably use DiagnosticClient's getNumErrors() instead.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119766 91177308-0d34-0410-b5e6-96231b3b80d8
9c4eb1f3438370355f51dc8c62f2ca4803e3338d 19-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Refactoring.
Move ErrorTrap from clang/Sema to clang/Basic as DiagnosticErrorTrap and use it in Scope.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119763 91177308-0d34-0410-b5e6-96231b3b80d8
ab41b97c3cddf1bcdd8bf82ab09ed3ceafcd05b1 18-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Remove the hack where, to get the return status, we had special case for VerifyDiagnosticsClient
and just check the number of errors from the DiagnosticClient.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119736 91177308-0d34-0410-b5e6-96231b3b80d8
f2224d89a6ae65a3839529e26d0f6d025d83d6bb 18-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Since multiple diagnostics can share one diagnostic client, have the client keeping track
of the total number of warnings/errors reported.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119731 91177308-0d34-0410-b5e6-96231b3b80d8
33e4e70c8c0a17e0ccb7465d96556b077a68ecb1 18-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Refactoring of Diagnostic class.

-Move the stuff of Diagnostic related to creating/querying diagnostic IDs into a new DiagnosticIDs class.
-DiagnosticIDs can be shared among multiple Diagnostics for multiple translation units.
-The rest of the state in Diagnostic object is considered related and tied to one translation unit.
-Have Diagnostic point to the SourceManager that is related with. Diagnostic can now accept just a
SourceLocation instead of a FullSourceLoc.
-Reflect the changes to various interfaces.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119730 91177308-0d34-0410-b5e6-96231b3b80d8
19ddda83f9c3a7f1029740047b06035bda5fbb81 09-Nov-2010 Rafael Espindola <rafael.espindola@gmail.com> Include System/DataTypes.h in Diagnostic.h to get intptr_t.
Set Haiku's UserLabelPrefix to "".
Patch by Paul Davey.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118510 91177308-0d34-0410-b5e6-96231b3b80d8
bdacf3c64867a132917386ac1c8df77e617d41fc 06-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add a comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118345 91177308-0d34-0410-b5e6-96231b3b80d8
f41d3be39980d40849850d3fb90403623cc8459e 05-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Read/write from/to PCH the diagnostic mappings that the user set so that e.g. #pragma clang diagnostic can be used in a PCH.
Fixes rdar://8435969.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118303 91177308-0d34-0410-b5e6-96231b3b80d8
2e57494445747c911f48b853015b784e292fefe4 05-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Initialize the array with the "C++ way".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118302 91177308-0d34-0410-b5e6-96231b3b80d8
b535041ee33c5eff255832bc5541c8d52aae8254 13-Oct-2010 Douglas Gregor <dgregor@apple.com> Fix a silly bug in the suppression of non-error diagnostics in a
SFINAE context, where we weren't getting the right diagnostic argument
count. I blame DiagnosticBuilder's weirdness. Fixes PR8372.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116411 91177308-0d34-0410-b5e6-96231b3b80d8
9b623639378d53a675921ddfa7316034d571881e 13-Oct-2010 Douglas Gregor <dgregor@apple.com> Introduce support for emitting diagnostics (warnings + their notes)
that are suppressed during template argument deduction. This change
queues diagnostics computed during template argument deduction. Then,
if the resulting function template specialization or partial
specialization is chosen by overload resolution or partial ordering
(respectively), we will emit the queued diagnostics at that point.

This addresses most of PR6784. However, the check for unnamed/local
template arguments (which existed before this change) is still only
skin-deep, and needs to be extended to look deeper into types. It must
be improved to finish PR6784.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116373 91177308-0d34-0410-b5e6-96231b3b80d8
d3ab63e0f66429abf2a3e4cde889e420e41e8790 12-Oct-2010 Douglas Gregor <dgregor@apple.com> Eliminate -fdiagnostics-binary and all of the infrastructure for
emitting diagnostics in a binary form to be consumed by libclang,
since libclang no longer does any of its work out-of-process, making
this code dead. Besides, this stuff never worked at 100% anyway.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116250 91177308-0d34-0410-b5e6-96231b3b80d8
bdbb004f38978da0c4a75af3294d1c7b5ff84af1 19-Aug-2010 Douglas Gregor <dgregor@apple.com> Simplify the ownership model for DiagnosticClients, which was really
convoluted and a bit leaky. Now, the Diagnostic object owns its

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111437 91177308-0d34-0410-b5e6-96231b3b80d8
783c56f47745f719590b17afd7ed937bf2407b53 18-Aug-2010 Douglas Gregor <dgregor@apple.com> Simplify FixItHint by eliminated the unnecessary InsertionLoc
location. Patch by Eelis van der Weegen!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111362 91177308-0d34-0410-b5e6-96231b3b80d8
c0659ec614c428c7d15746fcad15d50a2703751d 02-Aug-2010 Douglas Gregor <dgregor@apple.com> When using a precompiled preamble, save the diagnostics produced when
creating the preamble and "replay" them when reusing the
preamble. Also, fix a thinko in the copying of the preamble when
building the precompiled preamble.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110061 91177308-0d34-0410-b5e6-96231b3b80d8
3c2d3016adec79c81c4efff64e208fd3ecdd92ae 25-Jul-2010 Benjamin Kramer <benny.kra@googlemail.com> Wrap bit mangling logic for DiagMappings in its own class so it doesn't leak
into other code. Make it an array instead of a constant-length vector.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109384 91177308-0d34-0410-b5e6-96231b3b80d8
abc563f554951259bbe0315055cad92ee14d87e4 19-Jul-2010 Douglas Gregor <dgregor@apple.com> Introduce a new libclang API, clang_reparseTranslationUnit(), which
reparses an already-parsed translation unit. At the moment it's just a
convenience function, but we hope to use it for performance

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108756 91177308-0d34-0410-b5e6-96231b3b80d8
0a76aae8c03cb7dd7bdbe683485560afaf695959 19-Jun-2010 Chris Lattner <sabre@nondot.org> introduce a new CharSourceRange class, and enhance the diagnostics routines
to use them instead of SourceRange. CharSourceRange is just a SourceRange
plus a bool that indicates whether the range has the end character resolved
or whether the end location is the start of the end token. While most of
the compiler wants to think of ranges that have ends that are the start of
the end token, the printf diagnostic stuff wants to highlight ranges within

This is transparent to the diagnostic stuff. To start taking advantage of
the new capabilities, you can do something like this:
Diag(..) << CharSourceRange::getCharRange(Begin,End)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106338 91177308-0d34-0410-b5e6-96231b3b80d8
5edbdcc62098e305cd55654814dcf783a3f3c477 11-Jun-2010 Jeffrey Yasskin <jyasskin@google.com> Add an option -fshow-overloads=best|all to limit the number of overload
candidates printed. We default to 'all'. At the moment, 'best' prints only
the first 4 overloads, but we'll improve that over time.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105815 91177308-0d34-0410-b5e6-96231b3b80d8
c9b889044c8e1e2d6ab194e34e8b74f6998094fa 04-May-2010 Chris Lattner <sabre@nondot.org> When -fdiagnostics-print-source-range-info is specified,
print the diagnostic category number in the [] at the end
of the line. For example:

$ cat t.c
#include <stdio.h>
void foo() {
printf("%s", 4);
$ clang t.c -fsyntax-only -fdiagnostics-print-source-range-info
t.c:3:11:{3:10-3:12}{3:15-3:16}: warning: conversion specifies type 'char *' but the argument has type 'int' [-Wformat,1]
printf("%s", 4);
~^ ~
1 warning generated.

Clients that want category information can now pick the number
out of the output, rdar://7928231.

More coming.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103053 91177308-0d34-0410-b5e6-96231b3b80d8
27b0f510d1d4f9ed5668eec1195f04b4a74a4426 04-May-2010 Chris Lattner <sabre@nondot.org> add the ability to associate 'category' names with diagnostics
and diagnostic groups. This allows the compiler to group
diagnostics together (e.g. "Logic Warning",
"Format String Warning", etc) like the static analyzer does.
This is not exposed through anything in the compiler yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103051 91177308-0d34-0410-b5e6-96231b3b80d8
6c1cb9916e9988dcdd65b9266dbe24afd173427a 04-May-2010 Douglas Gregor <dgregor@apple.com> Introduce a limit on the depth of the macro instantiation backtrace
printed in a diagnostic, similar to the limit we already have on the
depth of the template instantiation backtrace. The macro instantiation
backtrace is limited to 10 "instantiated from:" diagnostics; when it's
longer than that, we'll show the first half, then say how many were
suppressed, then show the second half. The limit can be changed with
-fmacro-instantiation-limit=N, and turned off with N=0.

This eliminates a lot of note spew with libraries making use of the
Boost.Preprocess library.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103014 91177308-0d34-0410-b5e6-96231b3b80d8
575cf3791216c33770ba950430493cdd43099f8f 20-Apr-2010 Douglas Gregor <dgregor@apple.com> Introduce a limit on the depth of the template instantiation backtrace
we will print with each error that occurs during template
instantiation. When the backtrace is longer than that, we will print
N/2 of the innermost backtrace entries and N/2 of the outermost
backtrace entries, then skip the middle entries with a note such as:

note: suppressed 2 template instantiation contexts; use
-ftemplate-backtrace-limit=N to change the number of template
instantiation entries shown

This should eliminate some excessively long backtraces that aren't
providing any value.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101882 91177308-0d34-0410-b5e6-96231b3b80d8
d0fe3e9a97459477e64ad1df312fd29b86a3c3cb 16-Apr-2010 Chris Lattner <sabre@nondot.org> allow mapping fatal errors to errors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101516 91177308-0d34-0410-b5e6-96231b3b80d8
1864f2eb59471d07db51adfc3e5b1a229eed631a 15-Apr-2010 Douglas Gregor <dgregor@apple.com> Once we've emitted a fatal diagnostic, keep counting errors but with a
separate count of "suppressed" errors. This way, semantic analysis
bits that depend on the error count to determine whether problems
occured (e.g., some template argument deduction failures, jump-scope
checking) will not get confused.

The actual problem here is that a missing #include (which is a fatal
error) could cause the jump-scope checker to run on invalid code,
which it is not prepared to do. Trivial fix for both
<rdar://problem/7775941> and <rdar://problem/7775709>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101297 91177308-0d34-0410-b5e6-96231b3b80d8
04e442714c292d9381cad2ac14087991132bddca 12-Apr-2010 Chris Lattner <sabre@nondot.org> fix PR6814 - Only print [-pedantic] on a diagnostic if -pedantic
actually turned it on. If a diag is produced by a warning which
is an extension but defaults to on, and has no warning group, don't
print any option info.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101071 91177308-0d34-0410-b5e6-96231b3b80d8
c100214fdc41a7ea215f75d433eb1cb829fd4330 07-Apr-2010 Chris Lattner <sabre@nondot.org> add clang -cc1 level support for "-ferror-limit 42"

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100687 91177308-0d34-0410-b5e6-96231b3b80d8
b205ac9fcd22b87b41697172d1983c5ae9dabaaf 07-Apr-2010 Chris Lattner <sabre@nondot.org> add capabilities to stop emitting errors after some limit.
Right now the limit is 0 (aka disabled)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100684 91177308-0d34-0410-b5e6-96231b3b80d8
53eee7ba970d21ff15bbd4334164037a3b4cc4b8 07-Apr-2010 Chris Lattner <sabre@nondot.org> Instead of counting totally diagnostics, split the count into a count
of errors and warnings. This allows us to emit something like this:

2 warnings and 1 error generated.

instead of:

3 diagnostics generated.

This also stops counting 'notes' because they are just follow-on information
about the previous diag, not a diagnostic in themselves.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100675 91177308-0d34-0410-b5e6-96231b3b80d8
28019772db70d4547be05a042eb950bc910f134f 06-Apr-2010 Douglas Gregor <dgregor@apple.com> Make Diagnostic reference-counted, which is simpler than juggling
maybe-ownership vs. ownership.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100498 91177308-0d34-0410-b5e6-96231b3b80d8
849b243d4065f56742a4677d6dc8277609a151f8 31-Mar-2010 Douglas Gregor <dgregor@apple.com> Reinstate my CodeModificationHint -> FixItHint renaming patch, without
the C-only "optimization".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100022 91177308-0d34-0410-b5e6-96231b3b80d8
275313cbb0847f1f117f60d144d113804d4fa42d 31-Mar-2010 Douglas Gregor <dgregor@apple.com> Revert r100008, which inexplicably breaks the clang-i686-darwin10 builder

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100018 91177308-0d34-0410-b5e6-96231b3b80d8
d0ebe080eee7c37e73754068b47fd90cc506e128 31-Mar-2010 Douglas Gregor <dgregor@apple.com> Rename CodeModificationHint to FixItHint, since we've been using the
term "fix-it" everywhere and even *I* get tired of long names
sometimes. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100008 91177308-0d34-0410-b5e6-96231b3b80d8
5800f7ea9cf5621280089d690f677bd28064d6b5 27-Mar-2010 Ted Kremenek <kremenek@apple.com> Fix comparison in isDiagnosticInFlight().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99667 91177308-0d34-0410-b5e6-96231b3b80d8
eab5d1eaaa662c849f1f9920dc8c6a31d7c32d47 25-Mar-2010 Douglas Gregor <dgregor@apple.com> Teach the diagnostic engine to provide more detailed information about
how to handle a diagnostic during template argument deduction, which
may be "substitution failure", "suppress", or "report". This keeps us
from, e.g., emitting warnings while performing template argument

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99560 91177308-0d34-0410-b5e6-96231b3b80d8
93ea5cb0edf8e509c5113e70cb05ee247c9bdf6b 22-Mar-2010 Douglas Gregor <dgregor@apple.com> Introduce the notion of a single "delayed" diagnostic into the
Diagnostic subsystem, which is used in the rare case where we find a
serious problem (i.e., an inconsistency in the file system) while
we're busy formatting another diagnostic. In this case, the delayed
diagnostic will be emitted after we're done with the other
diagnostic. This is only to be used for fatal conditions detected at
very inconvenient times, where we can neither stop the current
diagnostic in flight nor can we suppress the second error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99175 91177308-0d34-0410-b5e6-96231b3b80d8
a88084b78fd4ca5d3d858c14b02414f8cc399f02 18-Feb-2010 Douglas Gregor <dgregor@apple.com> Rework how CIndex handles diagnostics. Rather than using a callback,
we attach diagnostics to translation units and code-completion
results, so they can be queried at any time.

To facilitate this, the new StoredDiagnostic class stores a diagnostic
in a serializable/deserializable form, and ASTUnit knows how to
capture diagnostics in this stored form. CIndex's CXDiagnostic is a
thin wrapper around StoredDiagnostic, providing a C interface to
stored or de-serialized diagnostics.

I've XFAIL'd one test case temporarily, because currently we end up
storing diagnostics in an ASTUnit that's never returned to the user
(because it contains errors). I'll introduce a temporary fix for this
soon; the real fix will be to allow us to return and query invalid ASTs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96592 91177308-0d34-0410-b5e6-96231b3b80d8
51c6d384551674facc19f745ecf6e289d28dc55f 29-Jan-2010 Douglas Gregor <dgregor@apple.com> When printing diagnostics in c-index-test, also print source ranges
and fix-it information, so we can see everything in one place. Along
the way, fix a few bugs with deserialization and query of diagnostics
in CIndex.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94768 91177308-0d34-0410-b5e6-96231b3b80d8
d93256e55673a17d18543397ec462416acb13792 28-Jan-2010 Douglas Gregor <dgregor@apple.com> Introduce serialization and deserialization of diagnostic information
so that CIndex can report diagnostics through the normal mechanisms
even when executing Clang in a separate process. This applies both
when performing code completion and when using ASTs as an intermediary
for clang_createTranslationUnitFromSourceFile().

The serialized format is not perfect at the moment, because it does
not encapsulate macro-instantiation information. Instead, it maps all
source locations back to the instantiation location. However, it does
maintain source-range and fix-it information. To get perfect fidelity
from the serialized format would require serializing a large chunk of
the source manager; at present, it isn't clear if this code will live
long enough for that to matter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94740 91177308-0d34-0410-b5e6-96231b3b80d8
9f28614bf1a8387000d8df57a713fcf69e198145 14-Jan-2010 John McCall <rjmccall@apple.com> Perform format-expansion on %select results.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93377 91177308-0d34-0410-b5e6-96231b3b80d8
bb092bafa984e9fa05136b5cef40fd4374dea0f6 31-Dec-2009 Douglas Gregor <dgregor@apple.com> Implement typo correction for id-expressions, e.g.,

typo.cpp:22:10: error: use of undeclared identifier 'radious'; did
you mean 'radius'?
return radious * pi;

This was super-easy, since we already had decent recovery by looking
for names in dependent base classes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92341 91177308-0d34-0410-b5e6-96231b3b80d8
e663c720063fc9ff9f75bcbe38cd070c73c78b0e 23-Dec-2009 Chris Lattner <sabre@nondot.org> implement -W[no-]fatal-errors, patch by Christian Adåker!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91938 91177308-0d34-0410-b5e6-96231b3b80d8
0304c6cb7fd3b2137213858b1e5ae85ef3f4f8e2 05-Dec-2009 Steve Naroff <snaroff@apple.com> Remove 'LangOpts' from Diagnostic (added in http://llvm.org/viewvc/llvm-project?view=rev&revision=90642).

Simply use the 'LangOpts' member already present in TextDiagnosticPrinter.

Sorry for the confusion!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90664 91177308-0d34-0410-b5e6-96231b3b80d8
e0c4d895ffe4320aa4e29485711ad7d154f2cc2b 05-Dec-2009 Steve Naroff <snaroff@apple.com> Integrate the following from the 'objective-rewrite' branch:


Note - This commit only includes the fix for:

<rdar://problem/6309338> slightly different error message format for Visual Studio.

The fix for <rdar://problem/6845623> from protocol to template. is separate/forthcoming.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90642 91177308-0d34-0410-b5e6-96231b3b80d8
32d4d80c26e8c4c1922cff4661e0b9f44a3aabfc 01-Dec-2009 Daniel Dunbar <daniel@zuster.org> Convert Diagnostic::getCustomDiagID to take a StringRef.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90244 91177308-0d34-0410-b5e6-96231b3b80d8
6f776b0c943c0065b5148297e61afbe29d54cc51 19-Nov-2009 Daniel Dunbar <daniel@zuster.org> Remove extra ';', found by clang++.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89304 91177308-0d34-0410-b5e6-96231b3b80d8
7d90199f109290e9d587479a481a2850d390b552 14-Nov-2009 Daniel Dunbar <daniel@zuster.org> Pass Preprocessor through DiagnosticClient::BeginSourceFile.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88744 91177308-0d34-0410-b5e6-96231b3b80d8
0f9fed70cea107b3f79df554e38bd8e98d48fe47 11-Nov-2009 Daniel Dunbar <daniel@zuster.org> Add Diagnostic::Report method for reporting diagnostics without a location.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86760 91177308-0d34-0410-b5e6-96231b3b80d8
2f019aadc96f8fa3185c684c7150bd596d045064 10-Nov-2009 Anders Carlsson <andersca@mac.com> Don't try to emit null fixit hints.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86664 91177308-0d34-0410-b5e6-96231b3b80d8
efcbe9475348ecab6b85153baa21d0e894e39607 05-Nov-2009 Daniel Dunbar <daniel@zuster.org> Replace DiagnosticClient::setLangOptions with {Begin,End}SourceFile, and clarify
invariants (diagnostics with source informations must occur between

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86113 91177308-0d34-0410-b5e6-96231b3b80d8
4a27d7061ee2fe0e2b71aa470c323e76afb95917 21-Oct-2009 Douglas Gregor <dgregor@apple.com> Improve diagnostics and template instantiation behavior when calling
an overloaded function call operator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84745 91177308-0d34-0410-b5e6-96231b3b80d8
b54d8af9a66cc20a6a9a9219c7eaea8df7ee7fd4 20-Oct-2009 Chris Lattner <sabre@nondot.org> teach FormatDiagnostic to aggregate previously formatted arguments and
pass them down into the ArgToStringFn implementation. This allows
redundancy across operands to a diagnostic to be eliminated.

This isn't used yet, so no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84602 91177308-0d34-0410-b5e6-96231b3b80d8
eaea925e70e3ee85809e572aa8474b8dfc491af7 18-Oct-2009 Daniel Dunbar <daniel@zuster.org> StringRefize some parts of Diagnostic API.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84377 91177308-0d34-0410-b5e6-96231b3b80d8
3f09327b26033d0a9676d52d80cf92c48f581aff 13-Oct-2009 Douglas Gregor <dgregor@apple.com> Unify our diagnostic printing for errors of the form, "we didn't like
what we found when we looked into <blah>", where <blah> is a
DeclContext*. We can now format DeclContext*'s in nice ways, e.g.,
"namespace N", "the global namespace", "'class Foo'".

This is part of PR3990, but we're not quite there yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84028 91177308-0d34-0410-b5e6-96231b3b80d8
0b60d9e0097e2d6a1a5e62396967e207c4a772f2 26-Sep-2009 Douglas Gregor <dgregor@apple.com> Use explicitly-specified template argument lists to help naming
explicit template specializations, when available.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82824 91177308-0d34-0410-b5e6-96231b3b80d8
81b747b7fcc91c2fba9a3183d8fac80adbfc1d3e 17-Sep-2009 Douglas Gregor <dgregor@apple.com> Initial implementation of a code-completion interface in Clang. In
essence, code completion is triggered by a magic "code completion"
token produced by the lexer [*], which the parser recognizes at
certain points in the grammar. The parser then calls into the Action
object with the appropriate CodeCompletionXXX action.

Sema implements the CodeCompletionXXX callbacks by performing minimal
translation, then forwarding them to a CodeCompletionConsumer
subclass, which uses the results of semantic analysis to provide
code-completion results. At present, only a single, "printing" code
completion consumer is available, for regression testing and
debugging. However, the design is meant to permit other
code-completion consumers.

This initial commit contains two code-completion actions: one for
member access, e.g., "x." or "p->", and one for
nested-name-specifiers, e.g., "std::". More code-completion actions
will follow, along with improved gathering of code-completion results
for the various contexts.

[*] In the current -code-completion-dump testing/debugging mode, the
file is truncated at the completion point and EOF is translated into
"code completion".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82166 91177308-0d34-0410-b5e6-96231b3b80d8
1eb4433ac451dc16f4133a88af2d002ac26c58ef 09-Sep-2009 Mike Stump <mrs@apple.com> Remove tabs, and whitespace cleanups.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
b2153946fff330e54abfdc740c0a83aedd485b33 26-Aug-2009 Anders Carlsson <andersca@mac.com> Add the partially implemented PartialDiagnostic class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80106 91177308-0d34-0410-b5e6-96231b3b80d8
91a2886d558ea6ca7a0bed73ab5acea5ae78eac2 26-Aug-2009 Douglas Gregor <dgregor@apple.com> Fix bug in __extension__ handling for declarations, from Abramo
Bagnara with a fix from Enea Zaffanella!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80094 91177308-0d34-0410-b5e6-96231b3b80d8
dacd434c49658286c380c7b4c357d76d53cb4aa1 26-Aug-2009 Douglas Gregor <dgregor@apple.com> Improve diagnostics and recovery when the nested-name-specifier of a
qualified name does not actually refer into a class/class
template/class template partial specialization.

Improve printing of nested-name-specifiers to eliminate redudant
qualifiers. Also, make it possible to output a nested-name-specifier
through a DiagnosticBuilder, although there are relatively few places
that will use this leeway.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80056 91177308-0d34-0410-b5e6-96231b3b80d8
04ae2df026b275aae5dddfc0db5ca55ff4e62179 12-Jul-2009 Chris Lattner <sabre@nondot.org> add push/pop semantics for diagnostics. Patch by Louis Gerbarg!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75431 91177308-0d34-0410-b5e6-96231b3b80d8
5e9f35c7cb61aea46f56d46c77cbcf47c0cf28ba 14-Jun-2009 Douglas Gregor <dgregor@apple.com> Update LLVM.

Implement support for C++ Substitution Failure Is Not An Error
(SFINAE), which says that errors that occur during template argument
deduction do *not* produce diagnostics and do not necessarily make a
program ill-formed. Instead, template argument deduction silently
fails. This is currently implemented for template argument deduction
during matching of class template partial specializations, although
the mechanism will also apply to template argument deduction for
function templates. The scheme is simple:

- If we are in a template argument deduction context, any diagnostic
that is considered a SFINAE error (or warning) will be
suppressed. The error will be propagated up the call stack via the
normal means.
- By default, all warnings and errors are SFINAE errors. Add the
NoSFINAE class to a diagnostic in the .td file to make it a hard
error (e.g., for access-control violations).

Note that, to make this fully work, every place in Sema that emits an
error *and then immediately recovers* will need to check
Sema::isSFINAEContext() to determine whether it must immediately
return an error rather than recovering.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73332 91177308-0d34-0410-b5e6-96231b3b80d8
3bc172bc6a787842db6fea351cf6929539fca70d 20-Apr-2009 Chris Lattner <sabre@nondot.org> move group twiddling options into Diagnostic.cpp instead of
Warnings.cpp. Warnings.cpp now doesn't need to #include
tblgen produced output directly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69559 91177308-0d34-0410-b5e6-96231b3b80d8
40469651a3f8379dc0f32df69e9bade06a2aad36 17-Apr-2009 Chris Lattner <sabre@nondot.org> add a virtual method to DiagnosticClient to get rid of some fragile
casting in clang-cc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69377 91177308-0d34-0410-b5e6-96231b3b80d8
19cbb44e3c4f2181dafa2ab92d3e3a26619b71d9 16-Apr-2009 Chris Lattner <sabre@nondot.org> tblgen is now passing diagnostic group information in the .inc file, ignore it everywhere.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69269 91177308-0d34-0410-b5e6-96231b3b80d8
d51d74a3e89c5e5fc9bfd2814996a5feab6dc932 16-Apr-2009 Chris Lattner <sabre@nondot.org> implement framework for -fdiagnostics-show-option, but tblgen isn't
passing down the right info yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69268 91177308-0d34-0410-b5e6-96231b3b80d8
b54b276a920246c595a0498da281821eb9d22996 16-Apr-2009 Chris Lattner <sabre@nondot.org> move handling of -pedantic and -pedantic-errors into Diagnostics,
out of Warnings.cpp. This simplifies warnings.cpp and makes it more

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69266 91177308-0d34-0410-b5e6-96231b3b80d8
2b07d8fe9e8a8ba12d64066632e17a9a5308a12e 16-Apr-2009 Chris Lattner <sabre@nondot.org> arrange for -Wno-error=foo warnings to be immune to -Werror as
they are supposed to be.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69265 91177308-0d34-0410-b5e6-96231b3b80d8
691f1ae7164ba78c3dd7ac20c487399935b9544b 16-Apr-2009 Chris Lattner <sabre@nondot.org> change mappings to distinguish between "unset", "set by the user" and
"set to the default value".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69264 91177308-0d34-0410-b5e6-96231b3b80d8
e29cc89f82261ad899791f47d1c1d9ef91e172b6 16-Apr-2009 Chris Lattner <sabre@nondot.org> switch DiagMappings *back* to 4 bits per diag.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69260 91177308-0d34-0410-b5e6-96231b3b80d8
4ac072aceb9c68f7a023050e2ab9ccacb4fe6e5b 15-Apr-2009 Chris Lattner <sabre@nondot.org> Tblgen now passes the default mapping explicitly, instead of having it
be tied to the diag class. This requires an LLVM tree update.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69175 91177308-0d34-0410-b5e6-96231b3b80d8
9faf50e62ddcd2535b472abc8daafd7042120caa 15-Apr-2009 Chris Lattner <sabre@nondot.org> this should be private

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69158 91177308-0d34-0410-b5e6-96231b3b80d8
27ceb9d77d929f02a8a811d189a96885629c7c0c 15-Apr-2009 Chris Lattner <sabre@nondot.org> Rejigger how -pedantic and -pedantic-errors work and their interaction
with other diagnostic mapping. In the new scheme, -Wfoo or -Wno-foo or
-Werror=foo all override the -pedantic options, and __extension__
robustly silences all extension diagnostics in their scope.

An added bonus of this change is that MAP_DEFAULT goes away, meaning that
per-diagnostic mapping information can now be stored in 2 bits, doubling
the density of the Diagnostic::DiagMapping array. This also
substantially simplifies Diagnostic::getDiagnosticLevel.

OTOH, this temporarily introduces some "macro intensive" code in
Diagnostic.cpp. This will be addressed in a later patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69154 91177308-0d34-0410-b5e6-96231b3b80d8
de4bf6a63219c5b9d3bce1fed3dfe075568098a0 02-Apr-2009 Douglas Gregor <dgregor@apple.com> Provide FIX-IT notes to describe what fix-it is doing behind the
scenes, using the underlying diagnostic client to format the

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68324 91177308-0d34-0410-b5e6-96231b3b80d8
5bf17cd277db2a253f6012968471064c4f4537a3 27-Mar-2009 Anders Carlsson <andersca@mac.com> I said _fix_ the build, don't break it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67797 91177308-0d34-0410-b5e6-96231b3b80d8
f569cc5d933750bcc4e005280457f111beec5ac1 27-Mar-2009 Anders Carlsson <andersca@mac.com> Fix build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67796 91177308-0d34-0410-b5e6-96231b3b80d8
05bf2c79770927c66ca725e9bb589048ed3f069e 27-Mar-2009 Anders Carlsson <andersca@mac.com> Add

const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
AccessSpecifier AS);

so we can easily add access specifiers to diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67795 91177308-0d34-0410-b5e6-96231b3b80d8
25a88bbf042317976f0d9cbfa87dfe89426e8393 20-Mar-2009 Douglas Gregor <dgregor@apple.com> Eliminate post-diagnostic hooks. Instead, implement a Sema-specific
variant of DiagnosticBuilder that emits the template instantiation
backtrace when needed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67413 91177308-0d34-0410-b5e6-96231b3b80d8
4d7a089144f336b11e5e8ce437b3b27bce2b310d 20-Mar-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Bindir and Win32 builds work, so switch to .inc files. Leave the .def files in the tree for a day or so longer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67346 91177308-0d34-0410-b5e6-96231b3b80d8
e89b6b272f9f3b15afa56a701a4d7a6b1001ed34 14-Mar-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Revert the switch to the tablegen diags. It fails for seperate objdir builds and cmake builds, and I have no clue what to do about it. Revisit this after someone with a clue about the build systems has looked at it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67009 91177308-0d34-0410-b5e6-96231b3b80d8
3801d71fbeb6e74a22cdd6a858e10d887bc29c7a 14-Mar-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Switch diagnostics from .def to tablegen files. Please validate the Windows build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67007 91177308-0d34-0410-b5e6-96231b3b80d8
50f4f469024928670f2d634c445686d00eeb89b7 12-Mar-2009 Daniel Dunbar <daniel@zuster.org> Add Diagnostic files for Frontend and move a couple errors over.
- Notably, clang now exits with an error if it can't find a
file. This flushed out a bug in the CGColorSpace.c test case. :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66789 91177308-0d34-0410-b5e6-96231b3b80d8
4ad4b3ebbe5769143389dccfcfadb666a4ba5940 12-Mar-2009 Daniel Dunbar <daniel@zuster.org> Driver: Use standard Diagnostic interface for diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66786 91177308-0d34-0410-b5e6-96231b3b80d8
ee1828a6b5ae1bc4ea300e48f3840ac1ec5be295 10-Mar-2009 Douglas Gregor <dgregor@apple.com> Add a notion of "post-diagnostic hooks", which are callbacks attached
to a diagnostic that will be invoked after the diagnostic (if it is
not suppressed). The hooks are allowed to produce additional
diagnostics (typically notes) that provide more information. We should
be able to use this to help diagnostic clients link notes back to the
diagnostic they clarify. Comments welcome; I'll write up documentation
and convert other clients (e.g., overload resolution failures) if
there are no screams of protest.

As the first client of post-diagnostic hooks, we now produce a
template instantiation backtrace when a failure occurs during template
instantiation. There's still more work to do to make this output
pretty, if that's even possible.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66557 91177308-0d34-0410-b5e6-96231b3b80d8
d42ffbd22fc7eb61321f6a88173ee424991f01c6 07-Mar-2009 Ted Kremenek <kremenek@apple.com> Revert my last couple patches until I can get them to not make the tests fail.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66317 91177308-0d34-0410-b5e6-96231b3b80d8
b9eb3afc9eafbb1c6815c8b63633065f370be6a5 07-Mar-2009 Ted Kremenek <kremenek@apple.com> Teach Diagnostic about Selector.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66314 91177308-0d34-0410-b5e6-96231b3b80d8
c3b401d314c21f9561c4411d23956d76aece6133 05-Mar-2009 Chris Lattner <sabre@nondot.org> remove unneeded forward decl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66151 91177308-0d34-0410-b5e6-96231b3b80d8
b2fb6de9070fea9abc56c8e8d5469066e964cefe 27-Feb-2009 Douglas Gregor <dgregor@apple.com> Clean up and document code modification hints.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65641 91177308-0d34-0410-b5e6-96231b3b80d8
4b2d3f7bcc4df31157df443af1b80bcaa9b58bba 26-Feb-2009 Douglas Gregor <dgregor@apple.com> Introduce code modification hints into the diagnostics system. When we
know how to recover from an error, we can attach a hint to the
diagnostic that states how to modify the code, which can be one of:

- Insert some new code (a text string) at a particular source
- Remove the code within a given range
- Replace the code within a given range with some new code (a text

Right now, we use these hints to annotate diagnostic information. For
example, if one uses the '>>' in a template argument in C++98, as in
this code:

template<int I> class B { };
B<1000 >> 2> *b1;

we'll warn that the behavior will change in C++0x. The fix is to
insert parenthese, so we use code insertion annotations to illustrate
where the parentheses go:

test.cpp:10:10: warning: use of right-shift operator ('>>') in template
argument will require parentheses in C++0x
B<1000 >> 2> *b1;
( )

Use of these annotations is partially implemented for HTML
diagnostics, but it's not (yet) producing valid HTML, which may be
related to PR2386, so it has been #if 0'd out.

In this future, we could consider hooking this mechanism up to the
rewriter to actually try to fix these problems during compilation (or,
after a compilation whose only errors have fixes). For now, however, I
suggest that we use these code modification hints whenever we can, so
that we get better diagnostics now and will have better coverage when
we find better ways to use this information.

This also fixes PR3410 by placing the complaint about missing tokens
just after the previous token (rather than at the location of the next

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65570 91177308-0d34-0410-b5e6-96231b3b80d8
92dd386e3f05d176b45a638199d51f536bd9d1c4 20-Feb-2009 Chris Lattner <sabre@nondot.org> replace a dirty hack with a clean solution. Too bad we can't
use Blocks for our callbacks ;-)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65083 91177308-0d34-0410-b5e6-96231b3b80d8
f5d2328fc849288c3a62e43d065685f516d57091 17-Feb-2009 Chris Lattner <sabre@nondot.org> fix notes so that they are always filtered with the same logic
as the last non-note diagnostic that preceeded them. This ensures
that diagnostics in main files which have notes with locations in
system headers get all the bits and pieces emitted or not in a
unit. This fixes PR3215.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64746 91177308-0d34-0410-b5e6-96231b3b80d8
15221422eda7bac679e38b07512feda49715ef66 06-Feb-2009 Chris Lattner <sabre@nondot.org> don't emit any diagnostics after a fatal one.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63914 91177308-0d34-0410-b5e6-96231b3b80d8
7fc24e2d47e1cdf03e655ed212d282635d755591 05-Feb-2009 Chris Lattner <sabre@nondot.org> allow mapping errors to fatal.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63896 91177308-0d34-0410-b5e6-96231b3b80d8
da0cbc1ad4a553c4de111c1181ec7b42c5ddefce 05-Feb-2009 Chris Lattner <sabre@nondot.org> add support to the diagnostics machinery for mapping warnings and
errors to 'fatal' error severity.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63894 91177308-0d34-0410-b5e6-96231b3b80d8
47b9a1ca55e61e37f5a368740e29de190345acc6 04-Feb-2009 Douglas Gregor <dgregor@apple.com> Some name-lookup-related fixes, from Piotr Rak!

- Changes Lookup*Name functions to return NamedDecls, instead of
Decls. Unfortunately my recent statement that it will simplify lot of
code, was not quite right, but it simplifies some...
- Makes MergeLookupResult SmallPtrSet instead of vector, following
Douglas suggestions.
- Adds %qN format for printing qualified names to Diagnostic.
- Avoids searching for using-directives in Scopes, which are not
DeclScope, during unqualified name lookup.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63739 91177308-0d34-0410-b5e6-96231b3b80d8
19e8e2cffc19606d0f44e7c2897cd126ffd3f9b0 29-Jan-2009 Chris Lattner <sabre@nondot.org> next round of diagnostics cleanups, moving some
diags around, eliminating #defines, etc. Patch by
Anders Johnsen!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63318 91177308-0d34-0410-b5e6-96231b3b80d8
88eccaf06f9d88191723e71bdf5ca68409393be6 29-Jan-2009 Chris Lattner <sabre@nondot.org> Fix -Wimplicit-function-declaration, which required some refactoring and
changes in various diagnostics code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63282 91177308-0d34-0410-b5e6-96231b3b80d8
509355e982d15da4f8f3939493516379665f6275 28-Jan-2009 Ted Kremenek <kremenek@apple.com> Tweak doxygen comment. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63228 91177308-0d34-0410-b5e6-96231b3b80d8
20c6b3b85e186cd52d5d99489132d71d498159eb 27-Jan-2009 Chris Lattner <sabre@nondot.org> Split the single monolithic DiagnosticKinds.def file into one
.def file for each library. This means that adding a diagnostic
to sema doesn't require all the other libraries to be rebuilt.

Patch by Anders Johnsen!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63111 91177308-0d34-0410-b5e6-96231b3b80d8
cabe66811fe43835b8c5a0854552768fc53261e3 23-Jan-2009 Ted Kremenek <kremenek@apple.com> Added virtual method DiagnosticClient::IncludeInDiagnosticCounts(). This is used by Diagnostics to determine if a diagnostic sent to a given DiagnosticClient should be included in the count of diagnostics. The default implementation of this method returns 'true'.

Implemented DiagCollector::IncludeInDiagnosticCounts() to return 'false' so that the batching of diagnostics for use with BugReporter doesn't mess up the count of real diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62873 91177308-0d34-0410-b5e6-96231b3b80d8
3bf4a79712fb30dc27692ef2d4214ee7fa6681be 26-Nov-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add an overload for operator<<(const DiagnosticBuilder &DB,bool I).
Fixes building error on MSVC where passing bool couldn't resolve to one of the overloads.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60116 91177308-0d34-0410-b5e6-96231b3b80d8
011bb4edf731d529da1cbf71c7c2696aaf5a054f 23-Nov-2008 Chris Lattner <sabre@nondot.org> add support for inserting a DeclarationName into a diagnostic directly
without calling getAsString(). This implicitly puts quotes around the
name, so diagnostics need to be tweaked to accommodate this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59916 91177308-0d34-0410-b5e6-96231b3b80d8
3fdf4b071dc79fae778fb5f376485480756c76a3 23-Nov-2008 Chris Lattner <sabre@nondot.org> Genericize the qualtype formating callback to support any diag argument.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59908 91177308-0d34-0410-b5e6-96231b3b80d8
22caddc91d2f6186739c6b20ec58ed38cd68e595 23-Nov-2008 Chris Lattner <sabre@nondot.org> Add support for sending QualType's directly into diags and convert two
diags over to use this. QualTypes implicitly print single quotes around
them for uniformity and future extension.

Doing this requires a little function pointer dance to prevent libbasic
from depending on libast.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59907 91177308-0d34-0410-b5e6-96231b3b80d8
32b939b51b3cc5e4c4d61e31a59aa902de2525b8 22-Nov-2008 Chris Lattner <sabre@nondot.org> remove a dead enum

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59879 91177308-0d34-0410-b5e6-96231b3b80d8
74d15dfd183b2082e8a5d4dfbf66bd861b220901 22-Nov-2008 Chris Lattner <sabre@nondot.org> Change the Lexer::Diag method to not magically silence warnings,
force the caller to check instead. This eliminates the need (and the
risk!) of weird null DiagnosticBuilder's floating around.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59856 91177308-0d34-0410-b5e6-96231b3b80d8
9634379265855f1628190e926d9aaf1fb4a5d90e 22-Nov-2008 Chris Lattner <sabre@nondot.org> fit in 80 cols

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59851 91177308-0d34-0410-b5e6-96231b3b80d8
3cbfe2c4159e0a219ae660d50625c013aa4afbd0 22-Nov-2008 Chris Lattner <sabre@nondot.org> Split the DiagnosticInfo class into two disjoint classes:
one for building up the diagnostic that is in flight (DiagnosticBuilder)
and one for pulling structured information out of the diagnostic when
formatting and presenting it.

There is no functionality change with this patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59849 91177308-0d34-0410-b5e6-96231b3b80d8
730e0fdbbf9b315ef834074054ac55af3a4fcc0c 21-Nov-2008 Chris Lattner <sabre@nondot.org> rearrange some fields.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59832 91177308-0d34-0410-b5e6-96231b3b80d8
b7fc3b87d065041a10eaa0603d738df21ff7af3a 21-Nov-2008 Chris Lattner <sabre@nondot.org> move the diagnostic location and ID out of DiagnosticInfo and store it in
the Diagnostic class. Since we can already only have one diagnostic in
flight at a time, this shrinks DiagnosticInfo.

This reduces DiagnosticInfo to being basically a rather crazy smart pointer
to a DiagnosticInfo :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59798 91177308-0d34-0410-b5e6-96231b3b80d8
2cb836eb16afea6a7e07109bdec37e85c44d7bd7 21-Nov-2008 Chris Lattner <sabre@nondot.org> move diagnostic insertion methods to be free methods instead of
in the DiagnosticInfo class. This requires marking them as taking
a const DiagnosticInfo, which is bogus (they logically mutate DI),
but works with the C++ type system.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59797 91177308-0d34-0410-b5e6-96231b3b80d8
43b628cd47ecdc3caf640d79b3ad7ecef0f2c285 19-Nov-2008 Chris Lattner <sabre@nondot.org> Allow sending IdentifierInfo*'s into Diagnostics without turning them into strings
first. This should allow removal of a bunch of II->getName() calls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59601 91177308-0d34-0410-b5e6-96231b3b80d8
30bc96544346bea42921cf6837e66cef80d664b4 19-Nov-2008 Chris Lattner <sabre@nondot.org> add direct support for signed and unsigned integer arguments to diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59598 91177308-0d34-0410-b5e6-96231b3b80d8
f4c839657742b823cea1a95b18422f1ba74d3ddd 19-Nov-2008 Chris Lattner <sabre@nondot.org> rewrite FormatDiagnostic to be less gross and a lot more efficient.
This also makes it illegal to have bare '%'s in diagnostics. If you
want a % in a diagnostic, use %%.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59596 91177308-0d34-0410-b5e6-96231b3b80d8
73d2a1b05bb04ab0136af374ddaa5d4602d4c939 19-Nov-2008 Chris Lattner <sabre@nondot.org> implement a transparent optimization with the diagnostics stuff:
const char*'s are now not converted to std::strings when the diagnostic
is formed, we just hold onto their pointer and format as needed.

This commit makes DiagnosticClient::FormatDiagnostic even more of a
mess, I'll fix it in the next commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59593 91177308-0d34-0410-b5e6-96231b3b80d8
cfa96326158c32a0e08d3985a050f46bf7c6132d 19-Nov-2008 Chris Lattner <sabre@nondot.org> Address Sebastian and Doug's objections with taking pointers to temporaries.
Instead of doing that, copy the strings into the diagnostic info.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59590 91177308-0d34-0410-b5e6-96231b3b80d8
95d1ba492c3191f49392e53acbf878e39fc8ba0a 18-Nov-2008 Chris Lattner <sabre@nondot.org> Allow diagnostics to be used in bool context, like:

return Diag(...);

when the function returns bool. This always evaluates to true.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59555 91177308-0d34-0410-b5e6-96231b3b80d8
aabb54e1ee8e2c2ef89e7c5cbbb9a89872e96f67 18-Nov-2008 Chris Lattner <sabre@nondot.org> don't dereference a null pointer

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59533 91177308-0d34-0410-b5e6-96231b3b80d8
520987fc4e5e60c80bcce613b0f8813ffb2fdca0 18-Nov-2008 Chris Lattner <sabre@nondot.org> Give DiagnosticInfo a real copy constructor, even though it
is destructive.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59507 91177308-0d34-0410-b5e6-96231b3b80d8
0a14eee528a901c16f0e288fbc10a3abc1660d87 18-Nov-2008 Chris Lattner <sabre@nondot.org> This reworks some of the Diagnostic interfaces a bit to change how diagnostics
are formed. In particular, a diagnostic with all its strings and ranges is now
packaged up and sent to DiagnosticClients as a DiagnosticInfo instead of as a
ton of random stuff. This has the benefit of simplifying the interface, making
it more extensible, and allowing us to do more checking for things like access
past the end of the various arrays passed in.

In addition to introducing DiagnosticInfo, this also substantially changes how
Diagnostic::Report works. Instead of being passed in all of the info required
to issue a diagnostic, Report now takes only the required info (a location and
ID) and returns a fresh DiagnosticInfo *by value*. The caller is then free to
stuff strings and ranges into the DiagnosticInfo with the << operator. When
the dtor runs on the DiagnosticInfo object (which should happen at the end of
the statement), the diagnostic is actually emitted with all of the accumulated
information. This is a somewhat tricky dance, but it means that the
accumulated DiagnosticInfo is allowed to keep pointers to other expression
temporaries without those pointers getting invalidated.

This is just the minimal change to get this stuff working, but this will allow
us to eliminate the zillions of variant "Diag" methods scattered throughout
(e.g.) sema. For example, instead of calling:

Diag(BuiltinLoc, diag::err_overload_no_match, typeNames,
SourceRange(BuiltinLoc, RParenLoc));

We will soon be able to just do:

Diag(BuiltinLoc, diag::err_overload_no_match)
<< typeNames << SourceRange(BuiltinLoc, RParenLoc));

This scales better to support arbitrary types being passed in (not just
strings) in a type-safe way. Go operator overloading?!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59502 91177308-0d34-0410-b5e6-96231b3b80d8
5917fe1189ee7cbb6f61b804b1f1ab6ef16a94cb 18-Nov-2008 Chris Lattner <sabre@nondot.org> remove a helper method with only one call site.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59495 91177308-0d34-0410-b5e6-96231b3b80d8
2383b7f6aea2cb2bf2b5bfc0ec730f9354fecbbf 18-Nov-2008 Chris Lattner <sabre@nondot.org> Change the diagnostics interface to take an array of pointers to
strings instead of array of strings. This reduces string copying
in some not-very-important cases, but paves the way for future

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59494 91177308-0d34-0410-b5e6-96231b3b80d8
2fe0997427d92388e66e7573f4b043e7ba285ef0 12-Sep-2008 Daniel Dunbar <daniel@zuster.org> Add --suppress-system-warnings (on by default, use =0 to disable)
- For investigating warnings in system headers / builtins.
- Currently also enables the behavior that allows silent redefinition
of types in system headers. Conceptually these are separate but I
didn't feel it was worth two options (or changing LangOptions).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56163 91177308-0d34-0410-b5e6-96231b3b80d8
7bfaaaecb3113f955db31e8d8a51acffd1bc0c27 10-Aug-2008 Nico Weber <nicolasweber@gmx.de> * Remove isInSystemHeader() from DiagClient, move it to SourceManager
* Move FormatError() from TextDiagnostic up to DiagClient, remove now
empty class TextDiagnostic
* Make DiagClient optional for Diagnostic

This fixes the following problems:

* -html-diags (and probably others) does now output the same set of
warnings as console clang does
* nothing crashes if one forgets to call setHeaderSearch() on
* some code duplication is removed

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54620 91177308-0d34-0410-b5e6-96231b3b80d8
b4398aa27da4d6919c3ae448d1ae66ba6cafc048 07-Aug-2008 Ted Kremenek <kremenek@apple.com> Fix --html-diags in driver by delaying the construction of an HTMLDiagnosticClient until after we have created the Preprocessor object.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54472 91177308-0d34-0410-b5e6-96231b3b80d8
5b4681c8ef65808ec4d72ab6081efd24d53d4969 29-May-2008 Chris Lattner <sabre@nondot.org> Implement support for -w, which silences all warnings. PR2384.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51683 91177308-0d34-0410-b5e6-96231b3b80d8
2bf78fba7a37a42d4295999706053fdf4c9625e2 14-Apr-2008 Ted Kremenek <kremenek@apple.com> Added version of "getClient()" for class Diagnostic that returns a non-const
reference to the DiagnosticClient. This is useful for DiagnosticClients
that have internal state when processing diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49656 91177308-0d34-0410-b5e6-96231b3b80d8
615f5177095e62b36bf88f1b1b7b644295e4097b 31-Mar-2008 Ted Kremenek <kremenek@apple.com> Added variation of the "Report" method in the class Diagnostic that takes
an optional DiagnosticClient argument that differs from the client stored
internally in the Diagnostic object.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48986 91177308-0d34-0410-b5e6-96231b3b80d8
7097d9167dc6b5d6ab5ebf149b296a43939d4b36 03-Feb-2008 Chris Lattner <sabre@nondot.org> Fix PR1966 by ignoring non-error diagnostics from system headers even if they are
*mapped* onto errors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46686 91177308-0d34-0410-b5e6-96231b3b80d8
0bc735ffcfb223c0186419547abaa5c84482663e 29-Dec-2007 Chris Lattner <sabre@nondot.org> Don't attribute in file headers anymore. See llvmdev for the
discussion of this change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45410 91177308-0d34-0410-b5e6-96231b3b80d8
9c728dc4d8da89c73fcae74c9e72d7a83ffd7b6d 12-Dec-2007 Ted Kremenek <kremenek@apple.com> TargetInfo no longer includes a reference to SourceManager.

Moved all clients of Diagnostics to use FullSourceLoc instead of SourceLocation.
Added many utility methods to FullSourceLoc to provide shorthand for:


instead we have:


Modified TextDiagnostics (and related classes) to use this short-hand.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44957 91177308-0d34-0410-b5e6-96231b3b80d8
2eefd8657c233bc7c9330acfe475fc270bbe7cab 11-Dec-2007 Ted Kremenek <kremenek@apple.com> Modified the internals of Diagnostic and DiagnosticClient to use
SourceManager*'s instead of SourceManager&'s. This allows the client specify a
NULL SourceManager when using a default constructed SourceLocation. Thus the
SourceManager can be NULL when the SourceLocation's isValid() == false.

The interface to most clients of Diagnostic remains the same.
Diagnostic::Report() is overload to either accept a SourceLocation and a
SourceManager&, or neither. Thus clients that do not have a SourceManager
cannot specify a SourceLocation.

Modified TextDiagnostics* to use this new interface.
Modified the driver to not passed in SourceManager when warning about "-I-".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44887 91177308-0d34-0410-b5e6-96231b3b80d8
7a9d49fd2bfac00e905b361ba76d26ab5b6c3b09 11-Dec-2007 Ted Kremenek <kremenek@apple.com> Mega-patch: ripped SourceManager out of Diagnostic/DiagnosticClient. Now
SourceManager is passed by reference, allowing the SourceManager to be
associated with a specific translation unit, and not the entire execution
of the driver.

Modified all users of Diagnostics to comply with this new interface.

Integrated SourceManager as a member variable of TargetInfo. TargetInfo will
eventually be associated with a single translation unit (just like

Made the SourceManager reference in ASTContext private. Provided accessor
getSourceManager() for clients to use instead. Modified clients to comply with
new interface.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44878 91177308-0d34-0410-b5e6-96231b3b80d8
182745ae7892bca0842d9c023370ade5f8d1c6e8 02-Dec-2007 Chris Lattner <sabre@nondot.org> add support for custom client-specific diagnostics. As a testcase, make the
rewriter emit this error if it fails to rewrite an @encode:

t.m:17:9: error: rewriter could not replace sub-expression due to macros
c = ENC(char *)[2] + 4;

... where ENC is: #define ENC @encode

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44498 91177308-0d34-0410-b5e6-96231b3b80d8
0750618b0beacdc9b0a9e210a661e4746823ced7 30-Nov-2007 Chris Lattner <sabre@nondot.org> start partitioning the diagnostics into two classes: those
that are builtin and those that are aren't. This is a bunch
of API refactoring that will make this possible, but there is
no functionality change yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44473 91177308-0d34-0410-b5e6-96231b3b80d8
3936c585cc07361a69cdf0c2c66c72f482b39dbe 06-Sep-2007 Chris Lattner <sabre@nondot.org> remove sorry.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41734 91177308-0d34-0410-b5e6-96231b3b80d8
f86638365f4801ec2d2970f7c0663e94590618b8 12-Jul-2007 Chris Lattner <sabre@nondot.org> Allow this to compile on compilers where <string>
doesn't imply <cassert>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39778 91177308-0d34-0410-b5e6-96231b3b80d8
5f016e2cb5d11daeb237544de1c5d59f20fe1a6e 11-Jul-2007 Reid Spencer <rspencer@reidspencer.com> Stage two of getting CFE top correct.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39734 91177308-0d34-0410-b5e6-96231b3b80d8