Граф коммитов

147 Коммитов

Автор SHA1 Сообщение Дата
Nico Weber 40d8e971a3 Revert r154981, because it caused PR12674.
Add a test for PR12674.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155666 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-26 21:39:46 +00:00
Seth Cantrell 3acf764931 fix display of source lines with null characters
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154981 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-18 02:44:48 +00:00
Seth Cantrell 6749dd5086 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154980 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-18 02:44:46 +00:00
Seth Cantrell 9591697707 Revert "Nicer display of unprintable source, and fix caret display for non-ascii text"
This reverts commit e9a3b76ba5.

Revert "fix display of source lines with null characters"

This reverts commit 70712b276e.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154950 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-17 20:59:59 +00:00
Seth Cantrell 70712b276e fix display of source lines with null characters
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154947 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-17 20:06:06 +00:00
Seth Cantrell e9a3b76ba5 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154946 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-17 20:06:03 +00:00
Douglas Gregor 105047124c Remove the -cc1-level option "-pubnames-dump". Such things should stay
out of the tree and use the tooling infrastructure.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154668 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-13 16:03:00 +00:00
Richard Smith ff34d401ff 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++.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154579 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-12 05:08:17 +00:00
Ted Kremenek 78d5d3bb93 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154567 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-12 00:03:31 +00:00
Douglas Gregor 978fc9c485 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>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153522 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-27 18:06:49 +00:00
Ted Kremenek 3739b32a01 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
2012-03-20 20:49:45 +00:00
Ted Kremenek 9ace587fe5 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152886 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-16 01:03:40 +00:00
David Blaikie 1d23c42195 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152776 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-15 05:09:31 +00:00
Nico Weber 7d613bf783 Move int<->pointer conversion warnings behind -Wint-conversions.
This is consistent with -Wbool-conversion. Let me know if you prefer
a different flag name.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151934 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 20:23:08 +00:00
James Molloy 16f1f717af 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.

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




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151712 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 10:24:19 +00:00
Argyrios Kyrtzidis 32a9a7543f 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151667 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-28 23:39:14 +00:00
James Molloy fbcf0405b7 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151638 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-28 18:12:11 +00:00
Richard Smith 0f163e9642 Support GCC's bug^Wextension allowing class array members to be initalized by a
parenthesized braced-init-list in the base/member initialization list.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150625 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-15 22:38:09 +00:00
Dmitri Gribenko 684a8e471b Remove unused diagnostics from include/clang/Basic/Diagnostic*.td files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150409 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-13 20:13:24 +00:00
Ted Kremenek 34a2c42ba8 Per discussion on cfe-dev, remove '#error' and '#warning' from diagnostic text.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149566 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-02 00:16:13 +00:00
Ted Kremenek cf2362b76b Fix -fmacro-backtrace-limit=0 to show the entire macro backtrace.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148930 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-25 06:07:15 +00:00
Sebastian Pop 9ec60dfe77 rename -ccc-host-triple into -target
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148582 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 22:01:23 +00:00
Richard Smith 244ee7b89a 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148209 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-15 03:51:30 +00:00
Eli Friedman 31cbe68430 Revert r148138; it's causing test failures.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148141 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-13 21:33:06 +00:00
Sebastian Pop edd4f3c391 rename -ccc-host-triple into -target
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148138 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-13 20:37:02 +00:00
Richard Smith cb7709c060 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147599 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-05 04:12:21 +00:00
Richard Smith d7c56e1114 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147357 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-29 21:57:33 +00:00
Roman Divacky d7f02c6c05 Let the KNR promotion warning be disabled.
Patch by Dimitry Andric!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146982 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-20 18:35:44 +00:00
Ted Kremenek 2a76410c0a Refactor SerializeDiagnosticsPrinter to using DiagnosticRenderer. This gives us comparative diagnostics
to TextDiagnosticPrinter.

This certainly can be cleaned up a bit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146820 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-17 05:26:11 +00:00
Richard Smith 80d39bf55f 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146755 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-16 20:58:01 +00:00
Richard Trieu 2fe9b7fb07 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)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146619 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-15 00:38:15 +00:00
Argyrios Kyrtzidis 29f2787b6d 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
2011-12-07 05:52:12 +00:00
Ted Kremenek 13eee19646 Tweak serialized diagnostics to support errors with no categories. Fixes <rdar://problem/10538300>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146011 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-07 02:08:00 +00:00
Hans Wennborg 122de3e131 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145930 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-06 09:46:12 +00:00
Ted Kremenek 2cbe84dd36 Place "use @dynamic or provide a method implementation" warnings under a -W flag.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145418 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-29 19:18:47 +00:00
Ted Kremenek 952538d48d Fix serialized diagnostics to handle FixIts that only remove text. Fixes <rdar://problem/10473903>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145339 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-29 00:30:52 +00:00
Fariborz Jahanian 0b69d13258 Remove one group'ed warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144678 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-15 19:25:38 +00:00
Richard Trieu ecb912e8a2 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144558 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-14 19:39:25 +00:00
Rafael Espindola e2d4f4ed44 Fix the signature of the getcontext builtin. Patch by Dimitry Andric.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144505 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-13 21:51:09 +00:00
NAKAMURA Takumi 40f6975af8 libclang/CXLoadedDiagnostic.cpp: Work around not to miss the string terminator on fixit.
FixIts might be exposed as C string via clang_getCString(), though the zero terminator is not allocated in CXLoadedDiagnosticSetImpl::makeString.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144379 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-11 07:27:33 +00:00
NAKAMURA Takumi 6edae59e75 test/Misc/serialized-diags.c: Tweak FileCheck expressions to be tolerant to DOSish output.
FIXME: For now, " = 0Parse Issueexpected ';' after expression{{XXX}}" would not be matched due to unexpected garbage{{XXX} on some hosts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144374 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-11 05:12:45 +00:00
Ted Kremenek cc1af78010 Place 'argument unused during compilation' under a -W flag. Fixes <rdar://problem/10403653>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144365 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-11 03:58:21 +00:00
Ted Kremenek a7e8a8394c [serialized diagnostics]: add test cases for serialized diagnostics, including a test case for no issues, multiple issues, and
a single issue.  Along the way, tweak c-index-test -read-diagnostics output so it is easier to tell what diagnostics are
child diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144349 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-11 00:46:43 +00:00
Douglas Gregor b31dd8ff34 Put ext_offsetof_extended_field_designator under the warning flag
-Wextended-offsetof, from Jeff Walden!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144160 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-09 03:01:42 +00:00
Richard Trieu 8da270e644 Remove test with int128 printing since it breaks on some platforms.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143997 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-07 19:30:35 +00:00
Richard Trieu 11cbe2a7fb Add support for printing integer literals of type short, unsigned short,
__int128_t and __uint128_t.  Short and unsigned short integer literals support
is only to work around a crasher as reported in PR11179 and will be removed
once Clang no longer builds short integer literals.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143977 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-07 18:40:31 +00:00
Chandler Carruth 9875c6020f Switch to a more natural formatting of the macro name printing.
Suggested by John McCall.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142836 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-24 18:51:08 +00:00
Ted Kremenek 66d5ce11b9 Move about 20 random diagnostics under -W flags. Patch by Ahmed Charles!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142284 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-17 21:47:53 +00:00
Chandler Carruth 4c3fd511a6 Add a testcase for r142121 based on an idea from Richard Smith. Thanks!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142160 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-16 21:33:06 +00:00
David Blaikie e40923835d Remove the leftover partial comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142138 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-16 14:41:13 +00:00