Commit Graph

258 Commits

Author SHA1 Message Date
Dmitri Gribenko efc6dfb446 AST dumping: dump template instantiations only once
Fixes infinite loop in PR15220.

Patch by Philip Craig.

llvm-svn: 175805
2013-02-21 22:01:10 +00:00
Jordan Rose 00d1b59184 StmtPrinter: Write large char values using \u or \U.
This may not always be valid, but we were previously just
emitting them raw.

While here, s/isprint/isPrintable/ (using the new CharInfo).

llvm-svn: 174766
2013-02-08 22:30:27 +00:00
Richard Smith f5f43546b3 AST dumping: indicate the previous declaration for a redeclaration, and
indicate the semantic DC if it's not the lexical DC. In passing, correct
the ascii-art child marker for a child of a FriendDecl.

llvm-svn: 174570
2013-02-07 01:35:44 +00:00
Richard Trieu e673d71a07 When comparing two template template arguments in the template differ, consider
them the same if they are actually the same; having the same name isn't enough.

Similar to r174013, template template arguments were also mistakenly considered
the same when they had the same name but were in different namespaces.
In addition, when printing template template arguments, use the qualified name
if the regular name is the same.

llvm-svn: 174029
2013-01-31 02:47:46 +00:00
Richard Trieu de5cc7d3d8 Add indents to AST dumping and removed parenthesis from AST nodes.
Indents were given the color blue when outputting with color.
AST dumping now looks like this:

Node
|-Node
| `-Node
`-Node
  `-Node

Compared to the previous:

(Node
  (Node
    (Node))
  (Node
    (Node)))

llvm-svn: 174022
2013-01-31 01:44:26 +00:00
Douglas Gregor 8e9f55ff13 When comparing two templates in the template differ, consider them the
same if they are actually the same; having the same name isn't
enough. Fixes <rdar://problem/12931988>.

llvm-svn: 174013
2013-01-31 01:08:35 +00:00
Jordan Rose 2da0d1cfd3 Diagnostics: if a line is longer than 4096 characters, don't print it.
Specifically, don't print snippets, caret diagnostics, or ranges for
lines over 4096 characters. We copy the line around a few times in our
diagnostics machinery, and we have to print a caret line that's just as
long. This uses a lot of memory just to create a poor user experience as
we print out a line much too long for anyone to read...or spend extra
energy trying to fit it to -fmessage-length.

<rdar://problem/13106850>

llvm-svn: 173976
2013-01-30 21:41:07 +00:00
Richard Trieu 90c31f51c6 Handle passing non-Qualtypes to %diff better. Instead of asserting, fall back
to printing the default case.  This is a fix for PR15023.

llvm-svn: 173965
2013-01-30 20:04:31 +00:00
NAKAMURA Takumi 12b1d5d8a4 clang/test/Misc/diag-template-diffing-color.cpp: Symbolize color sequences in FileCheck.
llvm-svn: 173561
2013-01-26 06:13:05 +00:00
NAKAMURA Takumi 6350e07ecd clang/test/Misc/ast-dump-color.cpp: Symbolize color sequences in FileCheck.
FIXME: If FileCheck had expressions something predefined well-known...
llvm-svn: 173558
2013-01-26 03:48:55 +00:00
Richard Trieu d006f6eb5f Fix test case by being more lenient on what to accept as a path name.
llvm-svn: 173553
2013-01-26 01:54:31 +00:00
Richard Trieu d215b8d557 Highlight various parts of the AST dump with color. Colors are controlled by
-f(no-)color-diagnostics.  In addition, dumpColor() function calls are added
to force color printing.  No structural changes to -ast-dump.

llvm-svn: 173548
2013-01-26 01:31:20 +00:00
Nick Lewycky 29bcacd79d Add missing InGroup for this warning.
llvm-svn: 173429
2013-01-25 07:31:12 +00:00
Nick Lewycky 4db15f5101 Give warn_redecl_library_builtin a flag name: -Wincompatible-library-redeclaration.
llvm-svn: 173319
2013-01-24 03:43:15 +00:00
Jordan Rose 1eb342920b Format strings: don't ever convert %+d to %lu.
Presumably, if the printf format has the sign explicitly requested, the user
wants to treat the data as signed.

This is a fix-up for r172739, and also includes several test changes that
didn't make it into that commit.

llvm-svn: 172762
2013-01-17 22:34:10 +00:00
Matt Beaumont-Gay 978cca9f49 Suppress all -Wunused-value warnings from macro body expansions.
This is inspired by a number of false positives in real code, including
PR14968. I've added test cases reduced from these false positives to
test/Sema/unused-expr.c, as well as corresponding test cases that pass the
offending expressions as arguments to a no-op macro to ensure that we do warn
there.

This also removes my previous tweak from r166522/r166534, so that we warn on
unused cast expressions in macro arguments.

There were several test cases that were using -Wunused-value to test general
diagnostic emission features; I changed those to use other warnings or warn on
a macro argument expression. I stared at the test case for PR14399 for a while
with Richard Smith and we believe the new test case exercises the same
codepaths as before.

llvm-svn: 172696
2013-01-17 02:06:08 +00:00
Alexander Kornienko ebc17b5b87 Dump comments in -ast-dump.
http://llvm-reviews.chandlerc.com/D269

"Added dumping of declaration comments in ASTDumper. This required moving the
comment dumping code from CommentDumper so that the indentation is correct."

Patch by Philip Craig!

llvm-svn: 172409
2013-01-14 14:07:11 +00:00
Rafael Espindola fe95841630 add a triple
llvm-svn: 171808
2013-01-07 23:04:04 +00:00
Alexander Kornienko 5bc364eb05 Implement Attr dumping for -ast-dump.
http://llvm-reviews.chandlerc.com/D234

Patch by Philip Craig!

llvm-svn: 171760
2013-01-07 17:53:08 +00:00
Douglas Gregor 2d5a5613ce Use a safe default width for template-diff'ing integral arguments, in
case we can't find an exact width to use. Fixes crash in
<rdar://problem/12456626>.

llvm-svn: 170951
2012-12-21 23:03:27 +00:00
NAKAMURA Takumi df3cf71dd7 clang/test/Misc/ast-dump-decl.c: Add triple. __thread is not supported on all targets.
llvm-svn: 170645
2012-12-20 03:30:30 +00:00
Richard Smith 5bb4cdfaa9 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.

llvm-svn: 170636
2012-12-20 02:22:15 +00:00
Alexander Kornienko 90ff607894 Implement AST dumper for Decls.
http://llvm-reviews.chandlerc.com/D52

Patch by Philip Craig!

llvm-svn: 170634
2012-12-20 02:09:13 +00:00
Eli Friedman 40ea264c25 Fix a crash in diagnostic printing when a template class type is diff'ed
against itself. PR14489.

llvm-svn: 170474
2012-12-18 23:32:47 +00:00
NAKAMURA Takumi 7174e90078 test/Misc/dev-fd-fs.c: Mark this as XFAIL:freebsd (since r169831).
I don't want to suppress this to be excluded with the feature "dev-fd-fs". This should work also on freebsd.

llvm-svn: 170411
2012-12-18 05:14:30 +00:00
Eli Friedman 672845bcde More conservative fix for <rdar://problem/12847524> (a crash printing diagnostic ranges).
I'm not really happy with this fix, but I'm confident it's correct.

llvm-svn: 170397
2012-12-18 00:52:36 +00:00
Nadav Rotem b89373430a Revert 170049 because it fails with an assertion on one of the spec2000 workloads.
llvm-svn: 170143
2012-12-13 19:58:10 +00:00
Rafael Espindola 0f207edaa5 Initial support for FreeBSD on ARM.
Patch by Andrew Turner.

llvm-svn: 170096
2012-12-13 04:17:14 +00:00
Eli Friedman cdb135a96b More hacking on mapDiagnosticRanges to make it handle more cases.
This still isn't quite right, but it fixes a crash.

I factored out findCommonParent because we need it on the result of 
getImmediateExpansionRange: for a function macro, the beginning
and end of an expansion range can come out of different
macros/macro arguments, which means the resulting range is a complete
mess to handle consistently.

I also made some changes to how findCommonParent works; it works somewhat
better in some cases, and somewhat worse in others, but I think overall
it's a better balance.  I'm coming to the conclusion that mapDiagnosticRanges
isn't using the right algorithm, though: chasing the caret is fundamentally
more complicated than any algorithm which only considers one FileID for the
caret can handle because each SourceLocation doesn't really have a single parent.
We need to follow the same path of choosing expansion locations and spelling
locations which the caret used to come up with the correct range
in the general case.

Fixes <rdar://problem/12847524>.

llvm-svn: 170049
2012-12-13 00:14:59 +00:00
Richard Smith 48f244ac2c More workarounds for PR10867.
llvm-svn: 169437
2012-12-05 22:33:14 +00:00
Richard Smith f89e2e2583 PR14049: Don't say "expanded from macro 'foo'" when 'foo' just happens to be
the LHS of a token paste. Use "expanded from here" instead when we're not sure
it's actually a macro.

llvm-svn: 169373
2012-12-05 11:04:55 +00:00
Eli Friedman fe9d110f3a Try to make the source location information for token pastes a bit more consistent.
Fixes a crash printing diagnostics on the gcc testsuite, and also makes
diagnostic range printing print nicer results for token pastes.

llvm-svn: 169068
2012-12-01 01:15:54 +00:00
Eli Friedman dea98de3fb Fix the computation of highlight ranges so we produce something sane when
the beginning and end of the range are in different macro arguments.
PR14399.

llvm-svn: 168984
2012-11-30 06:19:40 +00:00
Daniel Dunbar db0745ab86 Frontend: Create a virtual file for named pipe inputs.
- This ensures we see the right buffer size for the file.

llvm-svn: 168636
2012-11-27 00:04:16 +00:00
Benjamin Kramer 3d3ddcec70 SemaCXX: an enumeral type can be of character or boolean type in a C++11 enum class. Make sure we create a literal of the right type.
Fixes PR14386.

llvm-svn: 168441
2012-11-21 17:42:47 +00:00
Daniel Dunbar c61fae4205 tests: Mark the /dev/fd test as requiring Darwin until I can test on other OSes.
llvm-svn: 168095
2012-11-15 21:31:13 +00:00
Daniel Dunbar d9cb0ba660 tests: Check that we can output to /dev/fd filesystem.
- An LLVM unique_file() bug could cause us to infinite loop on the later test
   case.

llvm-svn: 168082
2012-11-15 20:24:58 +00:00
Daniel Dunbar 523855929b tests: Add a test for reading from named pipes.
- Realized I could use the /dev/fd filesystem to make a simple portable test.

llvm-svn: 168079
2012-11-15 20:06:10 +00:00
Eli Friedman c2c982c78b Make template diffing handle integral expressions of various widths correctly.
PR14342.

llvm-svn: 168005
2012-11-14 23:57:08 +00:00
Richard Smith 0b50cb79ad Add -cc1 option -fno-diagnostics-use-presumed-location, a handy mode for
working with preprocessed testcases. This causes source locations in
diagnostics to point at the spelling location instead of the presumed location,
while still keeping the semantic effects of the line directives (entering and
leaving system-header mode, primarily).

llvm-svn: 168004
2012-11-14 23:55:25 +00:00
Benjamin Kramer 7d574e269d LiteralSupport: Don't overflow the temporary buffer when decoding invalid string parts.
Instead just use a dummy buffer, we're not going to use the decoded string anyways.
Fixes PR14292.

llvm-svn: 167594
2012-11-08 19:22:31 +00:00
Ted Kremenek 514fc6fa0f Add -Wmismatched-return-types flag for existing warning on conflicting return types.
llvm-svn: 167518
2012-11-07 01:43:44 +00:00
Ted Kremenek c6d8efd041 Add -Wmismatched-parameter-types flag for existing warning on conflicting parameter types.
llvm-svn: 167515
2012-11-07 01:25:56 +00:00
Manuel Klimek 874030e684 Create helper functions in StmtDumper for outputting the indentation, newlines, and brackets.
This is preparation for adding Decl dumping.

Patch by Philip Craig.

llvm-svn: 167509
2012-11-07 00:33:12 +00:00
Seth Cantrell 40f87b1d53 only truncate source lines in text diagnostics when
the ellipsis is shorter than the text it replaces

llvm-svn: 167364
2012-11-03 23:56:43 +00:00
Seth Cantrell d38c708dc1 fix bug in SourceColumnMap::startOfPreviousColumn
llvm-svn: 167360
2012-11-03 21:21:14 +00:00
Eli Friedman 34ff0ea522 Add a proper algorithm to compute accurate source ranges for diagnostics with
caret locations and source ranges in macros.  Makes ranges more accurate
in some cases, and fixes an assertion failure.

Fixes <rdar://problem/12472249>.

llvm-svn: 167353
2012-11-03 03:36:51 +00:00
Eli Friedman 960755bafd Add missing diagnostic group to format string warning.
llvm-svn: 167279
2012-11-02 02:14:44 +00:00
Eli Friedman 8f88f06dd2 Tweak wording and add diagnostic groups to misc diagnostics.
llvm-svn: 167274
2012-11-02 01:40:23 +00:00
Richard Trieu 6df8945f04 Fix the template type diffing to handle integral template arguments.
llvm-svn: 167252
2012-11-01 21:29:28 +00:00