Commit Graph

258 Commits

Author SHA1 Message Date
Seth Cantrell d7beb4a10a add test for r167063
llvm-svn: 167089
2012-10-31 01:03:35 +00:00
Rafael Espindola 74c5fd93b9 Remove ccc-no-clang-cpp, which is also dead now.
llvm-svn: 167062
2012-10-30 23:49:11 +00:00
David Blaikie a0613170b4 Handle string encoding diagnostics when there are too many invalid ranges.
llvm-svn: 167059
2012-10-30 23:22:22 +00:00
Rafael Espindola 84619411eb In the past "production" clang builds would not be used for c++, and
we had the -ccc-clang-cxx and -ccc-no-clang-cxx options to force them
on or off for testing.

Clang c++ support is now production quality and these options are dead.

llvm-svn: 166986
2012-10-30 00:13:16 +00:00
Seth Cantrell 4cfc817a9a improve highlighting of invalid string encodings
limit highlight to exactly the bad encoding, and highlight every
bad encoding in a string.

llvm-svn: 166900
2012-10-28 18:24:46 +00:00
Daniel Dunbar 197157613c tests: Tweak unprintable.c to try another character which is hopefully even more
unprintable.

llvm-svn: 166798
2012-10-26 19:15:56 +00:00
Douglas Gregor 79ae600e8f Update warning-flag test
llvm-svn: 166656
2012-10-25 00:34:38 +00:00
Bill Wendling d75987dde9 Revert r166647 to rethink the patch...
llvm-svn: 166655
2012-10-25 00:32:44 +00:00
Bill Wendling 753c8782df Add some support for diagnosing possibly mismatched constraint, type size and
modifiers. (From an idea by Eric...)
<rdar://problem/12284092>

llvm-svn: 166647
2012-10-25 00:05:55 +00:00
Andy Gibbs c6e68daac0 Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive.
llvm-svn: 166280
2012-10-19 12:44:48 +00:00
Fariborz Jahanian 3ce7e04a53 Adds couple of missing warning flags so warnings can be turned
off. // rdar://12501960

llvm-svn: 166150
2012-10-17 23:19:22 +00:00
David Blaikie 5fa05fc438 Make -Wshift-op-parentheses a subgroup of -Wparentheses
llvm-svn: 165653
2012-10-10 20:30:36 +00:00
Rafael Espindola fc3fc0c936 The clang driver has a fairly fancy support for executing gcc instead of
clang itself. This dates back to clang's early days and while it looks like
some of it is still used (for kext for example), other parts are probably dead.

Remove the -ccc-clang-archs option and associated code. I don't think there
is any remaining setup where clang doesn't support an architecture but it can
expect an working gcc cross compiler to be available.

A nice side effect is that tests no longer need to differentiate architectures
that are included in production builds of clang and those that are not.

llvm-svn: 165545
2012-10-09 20:46:28 +00:00
Ted Kremenek 40a69600af Add regression test to check if -Wenum-conversion is a subgroup of -Wconversion.
llvm-svn: 165459
2012-10-08 23:45:09 +00:00
Eli Friedman 68be1649ee Permanently end the whole "pragma got handled by the parser too early"
mess by handling all pragmas which the parser touches uniformly.
<rdar://problem/12248901>, etc.

llvm-svn: 165195
2012-10-04 02:36:51 +00:00
Richard Trieu b7243855d9 Update template type diffing to handle qualifiers. Differing qualifiers will
now be printed with highlighting.

llvm-svn: 164843
2012-09-28 20:32:51 +00:00
Richard Smith 6e0605d654 Teach Type::getAs<TemplateSpecializationType> that a TemplateSpecializationType
for a type alias template can appear as sugar at any level of desugaring, just
like a TypedefType.

llvm-svn: 164655
2012-09-26 02:18:13 +00:00
Richard Smith b6d516e7bd PR13881: Add -Wzero-length-array for zero length array extension, and move it into -Wgnu.
llvm-svn: 164272
2012-09-20 01:02:05 +00:00
Douglas Gregor 43bc036e8a Promote the warning about extra qualification on a declaration from a
warning to an error. C++ bans it, and both GCC and EDG diagnose it as
an error. Microsoft allows it, so we still warn in Microsoft
mode. Fixes <rdar://problem/11135644>.

llvm-svn: 163831
2012-09-13 20:16:20 +00:00
Richard Smith 659d38bcd5 Use a "better" unicode character, to avoid buildbot breakage on bots which can print some unicode characters.
llvm-svn: 163825
2012-09-13 19:10:51 +00:00
Richard Smith fab4b1a40c Make TextDiagnostic more robust against SourceLocations which point into the
middle of UTF-8 characters, and avoid walking to such positions when adjusting
column ranges for display. Fixes a couple of hangs when rendering diagnostics.

llvm-svn: 163820
2012-09-13 18:37:50 +00:00
Richard Smith 639b8d05dd When a bad UTF-8 encoding or bogus escape sequence is encountered in a
string literal, produce a diagnostic pointing at the erroneous character
range, not at the start of the literal.

llvm-svn: 163459
2012-09-08 07:16:20 +00:00
Aaron Ballman 3731b33009 Splitting the duplicated decl spec extension warning into two: one is an ExtWarn and the other a vanilla warning. This addresses PR13705, where const char const * wouldn't warn unless -pedantic was specified under the right conditions.
llvm-svn: 162793
2012-08-28 20:55:40 +00:00
Ted Kremenek 5d858cb916 Fix horrible regression in control of warnings caused by introduction of -Wpedantic.
While -Wpedantic was reasonable, -Wno-pedantic would turn off a bunch of warnings that
are on by default.  This counters the intention of this warning flag.

To fix this, -Wpedantic now includes extentions that are not on by default.  The
remaining warnings will manifest anyway, and won't accidentally get turned off
by -Wno-pedantic.

Fixes <rdar://problem/12076105>

llvm-svn: 161695
2012-08-10 20:50:00 +00:00
Richard Smith 403f76ee02 PR13529: Don't crash if the driver sees an unused input file when running as
'clang-cpp'.

For now, the test uses "REQUIRES: shell" to determine if the host system
supports "ln -s", which it uses to create a 'clang-cpp' symlink. This is a bit
hacky and should likely be directly supported by lit.cfg.

llvm-svn: 161317
2012-08-06 04:09:06 +00:00
Ted Kremenek 2b619662ee Promote warn_unknown_analyzer_checker to an error. Addresses <rdar://problem/10987863>.
llvm-svn: 160706
2012-07-25 07:12:13 +00:00
Richard Smith 87f5dc53b2 Add diagnostics for comma at end of enum and for extra semicolon at namespace
scope to -Wc++11-extensions. Move extra semicolon after member function
definition diagnostic out of -pedantic, since C++ allows a single semicolon
there. Keep it in -Wextra-semi, though, since it's still questionable.

llvm-svn: 160618
2012-07-23 05:45:25 +00:00
Tanya Lattner 72db6d04e1 Move a bunch of the attribute warnings under the IgnoreAttributes group. Cleaned up test case.
llvm-svn: 160190
2012-07-13 20:45:35 +00:00
NAKAMURA Takumi b59973e6cd clang/test/Misc/diag-template-diffing-color.cpp: Introduce the feature 'ansi-escape-sequences'.
llvm-svn: 160043
2012-07-11 11:44:00 +00:00
Tanya Lattner 724eaea271 TEMPORARY. I will fix this properly shortly.
Silence buildbot so I can figure out the right flag to put this warning under.

llvm-svn: 159967
2012-07-09 23:01:07 +00:00
Ted Kremenek 30105f67b4 Enhance 'diagtool list-warnings' to report number of diagnostics covered directly under -Wpedantic, and enhance warning-flags.c test to test that this set does not grow.
llvm-svn: 159893
2012-07-07 06:30:31 +00:00
Ted Kremenek b22ea2acea Re-apply r159875 with fixes.
- Split pedantic driver flag test into separate test file, and XFAIL on cygwin,mingw32
- Fix bug in tablegen logic where a missing '{' caused errors to be included in -Wpedantic.

llvm-svn: 159892
2012-07-07 05:53:30 +00:00
NAKAMURA Takumi eec53e4069 Revert rr159875, "Implement -Wpedantic and --no-pedantic to complement -Weverything." It broke several builds.
I suspect FileCheck might match assertion failure, even if clang/test/Misc/warning-flags.c passed the test.

> 0. Program arguments: bin/./clang -### -pedantic -Wpedantic clang/test/Driver/warning-options.cpp

llvm-svn: 159886
2012-07-07 02:48:02 +00:00
Ted Kremenek 9877f689f2 Implement -Wpedantic and --no-pedantic to complement -Weverything.
This patch introduces some magic in tablegen to create a "Pedantic" diagnostic
group which automagically includes all warnings that are extensions.  This
allows a user to suppress specific warnings traditionally under -pedantic used
an ordinary warning flag.  This also allows users to use #pragma to silence
specific -pedantic warnings, or promote them to errors, within blocks of text
(just like any other warning).

-Wpedantic is NOT an alias for -pedantic.  Instead, it provides another way
to (a) activate -pedantic warnings and (b) disable them.  Where they differ
is that -pedantic changes the behavior of the preprocessor slightly, whereas
-Wpedantic does not (it just turns on the warnings).

The magic in the tablegen diagnostic emitter has to do with computing the minimal
set of diagnostic groups and diagnostics that should go into -Wpedantic, as those
diagnostics that already members of groups that themselves are (transitively) members
of -Wpedantic do not need to be included in the Pedantic group directly.  I went
back and forth on whether or not to magically generate this group, and the invariant
was that we always wanted extension warnings to be included in -Wpedantic "some how",
but the bookkeeping would be very onerous to manage by hand.

-no-pedantic (and --no-pedantic) is included for completeness, and matches many of the
same kind of flags the compiler already supports.  It does what it says: cancels out
-pedantic.  One discrepancy is that if one specifies --no-pedantic and -Weverything or
-Wpedantic the pedantic warnings are still enabled (essentially the -W flags win).  We
can debate the correct behavior here.

Along the way, this patch nukes some code in TextDiagnosticPrinter.cpp and CXStoredDiagnostic.cpp
that determine whether to include the "-pedantic" flag in the warning output.  This is
no longer needed, as all extensions now have a -W flag.

This patch also significantly reduces the number of warnings not under flags from 229
to 158 (all extension warnings).  That's a 31% reduction.

llvm-svn: 159875
2012-07-06 23:07:31 +00:00
Matt Beaumont-Gay f019075271 Add a warning flag for "'extern' variable has an initializer".
llvm-svn: 159600
2012-07-02 21:58:14 +00:00
Richard Trieu db96a42eba Fix typos from r159463 and update tests. Added Matt Beaumont-Gay's suggestion
to improve wording of a diagnostic message.

llvm-svn: 159473
2012-06-29 23:11:10 +00:00
Richard Trieu c605844510 Update the %diff modifer to have an alternate string print when a template tree
is selected.  This will allow more flexibility when converting diagnostics to
use template type diffing.

Also updated the internal manual and test cases for correctly keeping the bold
attribute and for tree printing.

llvm-svn: 159463
2012-06-29 21:12:16 +00:00
NAKAMURA Takumi e791a7ae36 clang/test/Misc/diag-template-diffing-color.cpp: Remove XFAIL:cygwin. Cygwin has some terminal emulation of escape sequences.
llvm-svn: 159428
2012-06-29 14:14:25 +00:00
David Blaikie 9e55d74074 Fix template type diffing coloring (r159216) when forcing color output to a file (not a terminal)
Reviewed (over the shoulder) by Richard Trieu.

llvm-svn: 159381
2012-06-28 21:46:07 +00:00
Matt Beaumont-Gay 1571652af9 Only print a semicolon after "no known conversion for Nth argument" if there
is a following clause.

llvm-svn: 159369
2012-06-28 19:20:41 +00:00
Richard Smith 608c0b65d7 Add warning flag -Winvalid-pp-token for preprocessing-tokens which have
undefined behaviour, and move the diagnostic for '' from an Error into
an ExtWarn in this group. This is important for some users of the preprocessor,
and is necessary for gcc compatibility.

llvm-svn: 159335
2012-06-28 07:51:56 +00:00
Richard Trieu 9184423984 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.

llvm-svn: 159216
2012-06-26 18:18:47 +00:00
Fariborz Jahanian 513b3681de objc: adds diagnostic group to several old objc warnings.
// rdar://11741435 pr13184

llvm-svn: 159213
2012-06-26 17:47:42 +00:00
Jordan Rose 473e877c43 [diagtool] Add a new "tree" command to shows warnings activated by a flag.
% diagtool tree -Wunused-value
-Wunused-value
  -Wunused-comparison
    warn_unused_comparison
  -Wunused-result
    warn_unused_result
  warn_unused_call
  warn_unused_container_subscript_expr
  warn_unused_expr
  warn_unused_property_expr
  warn_unused_voidptr

llvm-svn: 159093
2012-06-24 00:07:45 +00:00
Richard Smith 19b02cd7fc Minor improvements to some C99 variadic-macro-related diagnostics.
llvm-svn: 159054
2012-06-22 23:59:08 +00:00
Jordan Rose b820709144 [diagtool] Write to llvm::outs() by default instead of llvm::errs()
llvm-svn: 158954
2012-06-22 00:33:20 +00:00
Kaelyn Uhrain 9ea8f7e6c5 Improve the error message when a function overload candidate is rejected
because it expects a reference and receives a non-l-value.

For example, given:

  int foo(int &);
  template<int x> void b() { foo(x); }

clang will now print "expects an l-value for 1st argument" instead of
"no known conversion from 'int' to 'int &' for 1st argument". The change
in wording (and associated code to detect the case) was prompted by
comment #5 in PR3104, and should be the last bit of work needed for the
bug.

llvm-svn: 158691
2012-06-19 00:37:47 +00:00
Richard Trieu 5767093dce Add triples to keep make test work on Windows, where wchar_t is only 16
bits wide.

llvm-svn: 158425
2012-06-13 23:15:33 +00:00
Richard Trieu bc4b4ba5de Remove unnecessary output redirection in a test.
llvm-svn: 158424
2012-06-13 22:31:48 +00:00
Richard Trieu dc3559106b Moved the StringLiteral printing code from StmtPrinter into the StringLiteral
class and have StmtPrinter and StmtDumper refer to it.  This fixes an
assertion failure when dumping wchar string literals.

llvm-svn: 158417
2012-06-13 20:25:24 +00:00
Jordan Rose de1a29277e Disable _Pragma during HTML macro rewriting to keep from crashing.
The preprocessor's handling of diagnostic push/pops is stateful, so
encountering pragmas during a re-parse causes problems. HTMLRewrite
already filters out normal # directives including #pragma, so it's
clear it's not expected to be interpreting pragmas in this mode.

This fix adds a flag to Preprocessor to explicitly disable pragmas.
The "right" fix might be to separate pragma lexing from pragma
parsing so that we can throw away pragmas like we do preprocessor
directives, but right now it's important to get the fix in.

Note that this has nothing to do with the "hack" of re-using the
input preprocessor in HTMLRewrite. Even if we someday copy the
preprocessor instead of re-using it, the copy would (and should) include
the diagnostic level tables and have the same problems.

llvm-svn: 158214
2012-06-08 18:06:21 +00:00
Jordan Rose ccf43ca05c Add pedantic warning -Wempty-translation-unit (C11 6.9p1).
In standard C since C89, a 'translation-unit' is syntactically defined to have
at least one "external-declaration", which is either a decl or a function
definition. In Clang the latter gives us a declaration as well.

The tricky bit about this warning is that our predefines can contain external
declarations (__builtin_va_list and the 128-bit integer types). Therefore our
AST parser now makes sure we have at least one declaration that doesn't come
from the predefines buffer.

Also, remove bogus warning about empty source files. This doesn't catch source
files that only contain comments, and never fired anyway because of our
predefines.

PR12665 and <rdar://problem/9165548>

llvm-svn: 158085
2012-06-06 17:25:21 +00:00
Jordan Rose 2fe20dca2a [diagtool] Re-add show-enabled, minimizing the code pulled in from Frontend.
Now correctly builds with both GNU make and CMake.

llvm-svn: 157932
2012-06-04 16:57:50 +00:00
Nico Weber cdfb1ae7f7 Improve fixit for comparison operator on lhs of bitwise operator.
Before:
test.cc:2:18: note: place parentheses around the == expression to silence this warning
  if (0 == flags & 0xdd)
                 ^
                   (   )

Now:
test.cc:2:18: note: place parentheses around the == expression to silence this warning
  if (0 == flags & 0xdd)
                 ^
      (         )

llvm-svn: 157897
2012-06-03 07:07:00 +00:00
Jordan Rose 573649eb8b [diagtool] Pull show-enabled back out for now.
Need to figure out how to get Frontend's warning parsing without bringing
in all of Frontend.

llvm-svn: 157847
2012-06-01 22:23:02 +00:00
Jordan Rose d617e06997 [diagtool] Add 'show-enabled', which displays which warnings are enabled.
show-enabled uses the command line you give it to build a CompilerInstance,
so any flags you pass will be processed as if running clang proper.

llvm-svn: 157842
2012-06-01 21:23:17 +00:00
Richard Trieu 2f7dc46a58 Move the warnings for extra semi-colons under -Wextra-semi. Also, added
a warning for an extra semi-colon after function definitions.  Added logic
so that a block of semi-colons on a line will only get one warning instead
of a warning for each semi-colon.

llvm-svn: 156934
2012-05-16 19:04:59 +00:00
Argyrios Kyrtzidis b16ff5d1ce Fix an assertion hit when the serialized diagnostics writer receive a diagnostic
from the frontend when the location is invalid and the SourceManager null.

Instead of keeping the SourceManager object in DiagnosticRenderer, propagate it
to the calls accordingly (as reference when it is expected to not be null, or pointer
when it may be null).
This effectively makes DiagnosticRenderer not tied to a specific SourceManager,
removing a hack from TextDiagnosticPrinter.

rdar://11386874

llvm-svn: 156536
2012-05-10 05:03:45 +00:00
Rafael Espindola d8b1b908b5 Put the availability warnings in a group.
llvm-svn: 156261
2012-05-06 16:49:20 +00:00
Ted Kremenek 124066c5cb Place several uncovered warnings under warning flags, and tweak diagnostic output including the term "gc" (in lowercase).
llvm-svn: 155892
2012-05-01 05:56:02 +00:00
Douglas Gregor f4fc4dff7d Move warn_cxx0x_right_shift_in_template_arg to CXX11Compat group, from
Dmitri Gribenko!

llvm-svn: 155872
2012-05-01 01:32:13 +00:00
Nico Weber 35131221e7 Revert r154981, because it caused PR12674.
Add a test for PR12674.

llvm-svn: 155666
2012-04-26 21:39:46 +00:00
Seth Cantrell 01d61b0ae4 fix display of source lines with null characters
llvm-svn: 154981
2012-04-18 02:44:48 +00:00
Seth Cantrell 99e2fa87f8 Nicer display of unprintable source, and fix caret display for non-ascii text
Unprintable source in diagnostics is transformed to a printable form and then
displayed with reversed colors if possible. Unprintable characters are
displayed as <U+NNNN> while bytes that do not represent valid characters are
shown as <XX>.

Column adjustments to diagnostic carets, highlighted ranges, and fixups are
made both for characters escaped as above and for characters which are
printable but take up more than a single column.

llvm-svn: 154980
2012-04-18 02:44:46 +00:00
Seth Cantrell 14dc87fccc Revert "Nicer display of unprintable source, and fix caret display for non-ascii text"
This reverts commit e9a3b76ba589a8a884e978273beaed0d97cf9861.

Revert "fix display of source lines with null characters"

This reverts commit 70712b276e40bbe11e5063dfc7e82ce3209929cd.

llvm-svn: 154950
2012-04-17 20:59:59 +00:00
Seth Cantrell f504f99c7d fix display of source lines with null characters
llvm-svn: 154947
2012-04-17 20:06:06 +00:00
Seth Cantrell fae205811e Nicer display of unprintable source, and fix caret display for non-ascii text
Unprintable source in diagnostics is transformed to a printable form and then
displayed with reversed colors if possible. Unprintable characters are
displayed as <U+NNNN> while bytes that do not represent valid characters are
shown as <XX>.

Column adjustments to diagnostic carets, highlighted ranges, and fixups are
made both for characters escaped as above and for characters which are
printable but take up more than a single column.

llvm-svn: 154946
2012-04-17 20:06:03 +00:00
Douglas Gregor adfb842fc1 Remove the -cc1-level option "-pubnames-dump". Such things should stay
out of the tree and use the tooling infrastructure.

llvm-svn: 154668
2012-04-13 16:03:00 +00:00
Richard Smith feea883de4 Implement support for 18 of the GNU-compatible __atomic builtins.
This is not quite sufficient for libstdc++'s <atomic>: we still need
__atomic_test_and_set and __atomic_clear, and may need a more complete
__atomic_is_lock_free implementation.

We are also missing an implementation of __atomic_always_lock_free,
__atomic_nand_fetch, and __atomic_fetch_nand, but those aren't needed
for libstdc++.

llvm-svn: 154579
2012-04-12 05:08:17 +00:00
Ted Kremenek 26a6d498ee Implement clang_getDiagnosticCategoryText() to provide a way for a client of libclang to accurately
get the diagnostic category name from a serialized diagnostic when the version of libclang used
to read the diagnostic file is newer than the clang that emitted the diagnostic file.

llvm-svn: 154567
2012-04-12 00:03:31 +00:00
Douglas Gregor 41ab2899b2 Introduce a -cc1-level option -pubnames-dump, which simply dumps the
list of identifiers that that 'public' names at the end of the
translation unit, e.g., defined macros or identifiers with top-level
names, in sorted order. Meant to support <rdar://problem/10921596>.

llvm-svn: 153522
2012-03-27 18:06:49 +00:00
Ted Kremenek 4a64230ee7 Don't include FixIts with a null replacement range. Fixes <rdar://problem/11040133>.
llvm-svn: 153122
2012-03-20 20:49:45 +00:00
Ted Kremenek 519db2ea2b Add warning flag for '#import is a language extension', -W#import-pedantic.
Don't know if it is an anathema to include '#' in the warning name.  I'm fine
with changing it, but this was the most obvious name.

llvm-svn: 152886
2012-03-16 01:03:40 +00:00
David Blaikie aeef2ae8f9 Unpluralize -Wfoo-conversions warnings for consistency.
Err on the side of brevity and rename (while providing aliases for the original
name) -Wbool-conversions, -Wint-conversions, and -Wvector-conversions for
consistency with constant, literal, string, and sign conversion warnings. And
name the diagnostic groups explicitly while I'm here rather than rewriting the
string in the groups and sema td files.

Curiously, vector-conversion is not under -Wconversion. Perhaps it should be.

llvm-svn: 152776
2012-03-15 05:09:31 +00:00
Nico Weber 99c07bc822 Move int<->pointer conversion warnings behind -Wint-conversions.
This is consistent with -Wbool-conversion. Let me know if you prefer
a different flag name.

llvm-svn: 151934
2012-03-02 20:23:08 +00:00
James Molloy 6f8780bed1 Reapply r151638 and r151641.
The bug that was caught by Apple's internal buildbots was valid and also showed another bug in my implementation.

These are now fixed, with regression tests added to catch them both (not Darwin-specific).

Original log:
====================

Revert r151638 because it causes assertion hit on PCH creation for Cocoa.h

Original log:
---------------------
Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped.

This fixes code such as:

enum e {x, y};
int f(enum {y, x} n) {
 return 0;
}

This finally fixes PR5464 and PR5477.
---------------------

I also reverted r151641 which was enhancement on top of r151638.

====================

llvm-svn: 151712
2012-02-29 10:24:19 +00:00
Argyrios Kyrtzidis 5929ef2ee7 Revert r151638 because it causes assertion hit on PCH creation for Cocoa.h
Original log:
---------------------
Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped.

This fixes code such as:

enum e {x, y};
int f(enum {y, x} n) {
 return 0;
}

This finally fixes PR5464 and PR5477.
---------------------

I also reverted r151641 which was enhancement on top of r151638.

llvm-svn: 151667
2012-02-28 23:39:14 +00:00
James Molloy 051390fffa Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped.
This fixes code such as:

enum e {x, y};
int f(enum {y, x} n) {
  return 0;
}

This finally fixes PR5464 and PR5477.

llvm-svn: 151638
2012-02-28 18:12:11 +00:00
Richard Smith ebeed41587 Support GCC's bug^Wextension allowing class array members to be initalized by a
parenthesized braced-init-list in the base/member initialization list.

llvm-svn: 150625
2012-02-15 22:38:09 +00:00
Dmitri Gribenko c233a545e8 Remove unused diagnostics from include/clang/Basic/Diagnostic*.td files.
llvm-svn: 150409
2012-02-13 20:13:24 +00:00
Ted Kremenek 7f4bd16b53 Per discussion on cfe-dev, remove '#error' and '#warning' from diagnostic text.
llvm-svn: 149566
2012-02-02 00:16:13 +00:00
Ted Kremenek a163d0b5de Fix -fmacro-backtrace-limit=0 to show the entire macro backtrace.
llvm-svn: 148930
2012-01-25 06:07:15 +00:00
Sebastian Pop 422377cfd3 rename -ccc-host-triple into -target
llvm-svn: 148582
2012-01-20 22:01:23 +00:00
Richard Smith 2ec4061e39 Pedantic diagnostic correction: in C++, we have integral constant expressions,
not integer constant expressions. In passing, fix the 'folding is an extension'
diagnostic to not claim we're accepting the code, since that's not true in
-pedantic-errors mode, and add this diagnostic to -Wgnu.

llvm-svn: 148209
2012-01-15 03:51:30 +00:00
Eli Friedman d749c6bf2e Revert r148138; it's causing test failures.
llvm-svn: 148141
2012-01-13 21:33:06 +00:00
Sebastian Pop 9a8d528ddf rename -ccc-host-triple into -target
llvm-svn: 148138
2012-01-13 20:37:02 +00:00
Richard Smith 69f90dce49 PR10828: Produce a warning when a no-arguments function is declared in block
scope, when no other indication is provided that the user intended to declare a
function rather than a variable.

Remove some false positives from the existing 'parentheses disambiguated as a
function' warning by suppressing it when the declaration is marked as 'typedef'
or 'extern'.

Add a new warning group -Wvexing-parse containing both of these warnings.

The new warning is enabled by default; despite a number of false positives (and
one bug) in clang's test-suite, I have only found genuine bugs with it when
running it over a significant quantity of real C++ code.

llvm-svn: 147599
2012-01-05 04:12:21 +00:00
Richard Smith e434590bd9 Change the diagnostics which said 'accepted as an extension' to instead say
'is an extension'. The former is inappropriate and confusing when building with
-Werror/-pedantic-errors.

llvm-svn: 147357
2011-12-29 21:57:33 +00:00
Roman Divacky fadb3bea6b Let the KNR promotion warning be disabled.
Patch by Dimitry Andric!

llvm-svn: 146982
2011-12-20 18:35:44 +00:00
Ted Kremenek 4548e04458 Refactor SerializeDiagnosticsPrinter to using DiagnosticRenderer. This gives us comparative diagnostics
to TextDiagnosticPrinter.

This certainly can be cleaned up a bit.

llvm-svn: 146820
2011-12-17 05:26:11 +00:00
Richard Smith 300237f00c Add a warning flag for ext_embedded_directive. gcc considers this undefined
behaviour to be an error, so it's useful to be able to make it an error in clang
too.

llvm-svn: 146755
2011-12-16 20:58:01 +00:00
Richard Trieu 553b2b2e5d Modify how the -verify flag works. Currently, the verification string and
diagnostic message are compared.  If either is a substring of the other, then
no error is given.  This gives rise to an unexpected case:

  // expect-error{{candidate function has different number of parameters}}

will match the following error messages from Clang:

  candidate function has different number of parameters (expected 1 but has 2)
  candidate function has different number of parameters

It will also match these other error messages:

  candidate function
  function has different number of parameters
  number of parameters

This patch will change so that the verification string must be a substring of
the diagnostic message before accepting.  Also, all the failing tests from this
change have been corrected.  Some stats from this cleanup:

87 - removed extra spaces around verification strings
70 - wording updates to diagnostics
40 - extra leading or trailing characters (typos, unmatched parens or quotes)
35 - diagnostic level was included (error:, warning:, or note:)
18 - flag name put in the warning (-Wprotocol)

llvm-svn: 146619
2011-12-15 00:38:15 +00:00
Argyrios Kyrtzidis 7910d7b72a 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.

llvm-svn: 146020
2011-12-07 05:52:12 +00:00
Ted Kremenek 9c9e81085f Tweak serialized diagnostics to support errors with no categories. Fixes <rdar://problem/10538300>.
llvm-svn: 146011
2011-12-07 02:08:00 +00:00
Hans Wennborg 2fb8b91f6f Suggest typo corrections for implicit function declarations.
A mistyped function call becomes an inmplicit function declaration in C.
Suggest typo correction when one can be found.

llvm-svn: 145930
2011-12-06 09:46:12 +00:00
Ted Kremenek 7623347f83 Place "use @dynamic or provide a method implementation" warnings under a -W flag.
llvm-svn: 145418
2011-11-29 19:18:47 +00:00
Ted Kremenek 6cdff0a82b Fix serialized diagnostics to handle FixIts that only remove text. Fixes <rdar://problem/10473903>.
llvm-svn: 145339
2011-11-29 00:30:52 +00:00
Fariborz Jahanian 197a895e75 Remove one group'ed warning.
llvm-svn: 144678
2011-11-15 19:25:38 +00:00
Richard Trieu 5d1aff049e Change the checks in the type aka printing. A confusing case where the string
of the first type is the same as the aka string of the second type, but both
types are different.  Update the logic to print an aka for the first type to
show that they are different.

llvm-svn: 144558
2011-11-14 19:39:25 +00:00
Rafael Espindola 6cfa82bc5f Fix the signature of the getcontext builtin. Patch by Dimitry Andric.
llvm-svn: 144505
2011-11-13 21:51:09 +00:00