Commit Graph

16800 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis 9fd1571e7a [libclang] Fix crash when code-completing a macro invocation that
reached EOF and did not expand the argument into the source context.

llvm-svn: 170980
2012-12-22 04:48:10 +00:00
Argyrios Kyrtzidis 430a938fde [libclang] Don't try to translate diagnostics from the precompiled preamble to the
code-completion results, the SourceManager state may be slightly
different when code-completing.

And we don't even care for diagnostics when code-completing, anyway.

llvm-svn: 170979
2012-12-22 04:48:08 +00:00
Richard Smith 21bae43fab PR14695: Fix assert from bad cast<>. Not every namespace is a NamespaceDecl; it might instead be a TranslationUnitDecl.
llvm-svn: 170976
2012-12-22 02:46:14 +00:00
Ted Kremenek 6cae9ec643 Add back -Wduplicate-enum which I mistakenly removed.
This was removed with -Wunique-enum, which is still removed.  The
corresponding thread on cfe-comments for that warning is here:

  http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-September/024224.html

If we get specific user feedback for -Wduplicate-enum we can evaluate
whether or not to keep it.

llvm-svn: 170974
2012-12-22 01:34:09 +00:00
Ted Kremenek c632467e2b Fix typo: objc_no_direct_instance_variable_assignmemt => objc_no_direct_instance_variable_assignment.
Fixes <rdar://problem/12927551>.

llvm-svn: 170971
2012-12-22 00:34:48 +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
Matt Beaumont-Gay cab0f3131e Insulate this test from the whims of the random number generator.
Our internal buildbot just failed because the tempfile happened to be named
'nodefaultlib-lcGA7k.o', which contains the substring '-lc'.

llvm-svn: 170941
2012-12-21 22:43:20 +00:00
Ted Kremenek 44c2a2a26e Change checkUnsafeAssignLiteral() to use the new Sema::CheckLiteralKind().
Along the way, fix a bug in CheckLiteralKind(), previously in diagnoseObjCLiteralComparison, where we didn't ignore parentheses
in boxed expressions for purpose of classification.

In other words, both @42 and @(42) should be classified as numeric
literals.

llvm-svn: 170931
2012-12-21 21:59:39 +00:00
Fariborz Jahanian 7a16a02eec Fixes couple of friend declaration -ast-print bug
found by running -ast-print on all-std-headers.cpp
which caused it to go into infinite loop. Now
-ast-print prints all declarations found in 
all-std-headers.cpp.

llvm-svn: 170928
2012-12-21 21:43:05 +00:00
Quentin Colombet 9b14ebc355 Add a testcase for ARM cortex-r5 subtarget
llvm-svn: 170912
2012-12-21 18:00:32 +00:00
Anna Zaks 1ee76c1bae [analyzer] Re-apply r170826 and make the dumping of the GallGraph
deterministic.

Commit message for r170826:

[analyzer] Traverse the Call Graph in topological order.

Modify the call graph by removing the parentless nodes. Instead all
nodes are children of root to ensure they are all reachable. Remove the
tracking of nodes that are "top level" or global. This information is
not used and can be obtained from the Decls stored inside
CallGraphNodes.

Instead of existing ordering hacks, analyze the functions in topological
order over the Call Graph.

Together with the addition of devirtualizable ObjC message sends and
blocks to the call graph, this gives around 6% performance improvement
on several large ObjC benchmarks.

llvm-svn: 170906
2012-12-21 17:27:01 +00:00
Daniel Jasper 0ca819410d Temporary fix of tests to make buildbots happy.
Permanent solution coming up after checking back with Fariborz/Douglas.

llvm-svn: 170887
2012-12-21 12:10:20 +00:00
Richard Smith 38a549bc42 Fix regression in r170489: when instantiating a direct initializer which is a
CXXScalarValueInitExpr (or an ImplicitValueInitExpr), strip it back down to an
empty pair of parentheses so that the initialization code can tell that we're
performing value-initialization.

llvm-svn: 170867
2012-12-21 08:13:35 +00:00
Ted Kremenek 9304da9578 Extend checkUnsafeAssigns() to also handle assigning an object literal to a weak reference.
Thanks to Jordan Rose and John McCall for their sage code review.

Fixes <rdar://problem/12569201>.

llvm-svn: 170864
2012-12-21 08:04:28 +00:00
Richard Smith d82a2ce3a0 Reinstate r170806, reverted in r170835, with a fix use i1 instead of i8 for a value-initialized bool!
llvm-svn: 170837
2012-12-21 03:17:28 +00:00
NAKAMURA Takumi 3df909d030 Revert r170806, "Fix some bugs where we would sometimes use 0, not -1, when emitting a null constant of type pointer-to-data-member."
It broke stage2.

llvm-svn: 170835
2012-12-21 02:50:38 +00:00
Argyrios Kyrtzidis d4635d4865 [libclang] Follow-up to r170824, provide the correct number of arguments for
a not-fully-formed macro invocation during code-completion.

llvm-svn: 170833
2012-12-21 01:51:12 +00:00
Rafael Espindola e7ec558f25 Revert r170826. The output of
./bin/clang -cc1 -internal-isystem /home/espindola/llvm/build/lib/clang/3.3/include/ -analyze -analyzer-checker=debug.DumpCallGraph /home/espindola/llvm/clang/test/Analysis/debug-CallGraph.c -fblocks

changes in each run.

llvm-svn: 170829
2012-12-21 01:30:23 +00:00
Rafael Espindola 2be6b72ce0 Don't eagerly emit a global static merged with a local extern.
When we are visiting the extern declaration of 'i' in

static int i = 99;
int foo() {
  extern int i;
  return i;
}

We should not try to handle it as if it was an function static. That is, we
must consider the written storage class.

Fixing this then exposes that the assert in EmitGlobalVarDeclLValue and the
if leading to its call are not completely accurate. They were passing before
because the second decl was marked as having external storage. I changed them
to check the linkage, which I find easier to understand.

Last but not least, there is something strange going on with cuda and opencl.
My guess is that the linkage computation for these languages needs to be
audited, but I didn't want to change that in this patch so I just updated
the storage classes to keep the current behavior.

Thanks to Reed Kotler for reporting this.

llvm-svn: 170827
2012-12-21 01:21:33 +00:00
Anna Zaks 77ca7f1bbe [analyzer] Traverse the Call Graph in topological order.
Modify the call graph by removing the parentless nodes. Instead all
nodes are children of root to ensure they are all reachable. Remove the
tracking of nodes that are "top level" or global. This information is
not used and can be obtained from the Decls stored inside
CallGraphNodes.

Instead of existing ordering hacks, analyze the functions in topological
order over the Call Graph.

Together with the addition of devirtualizable ObjC message sends and
blocks to the call graph, this gives around 6% performance improvement
on several large ObjC benchmarks.

llvm-svn: 170826
2012-12-21 01:19:22 +00:00
Argyrios Kyrtzidis c1d9a67e2b [libclang] Make sure we can code-complete inside a macro argument even though
the macro invocation is not fully formed.

rdar://11290992

llvm-svn: 170824
2012-12-21 01:17:20 +00:00
Richard Smith 789ce142df Fix some bugs where we would sometimes use 0, not -1, when emitting a null constant of type pointer-to-data-member.
llvm-svn: 170806
2012-12-20 23:49:09 +00:00
Ted Kremenek 9453721985 Revert "Warn if a __weak variable is initialized with an Objective-C object literal."
Per code feedback, I want to see if there is a more general way to do this.

llvm-svn: 170777
2012-12-20 22:31:27 +00:00
Argyrios Kyrtzidis cbfd4d2483 Use some heuristics so that when a fixit removes a source range, we try
to also remove a trailing space if possible.

For example, removing '__bridge' from:

i = (__bridge I*)p;

should result in:

i = (I*)p;

not:

i = ( I*)p;

rdar://11314821

llvm-svn: 170764
2012-12-20 21:05:53 +00:00
Ted Kremenek b39cfd41f2 Warn if a __weak variable is initialized with an Objective-C object literal.
Such variables may immediately become nil or may have unpredictable
behavior.

Fixes <rdar://problem/12569201>.

llvm-svn: 170763
2012-12-20 20:55:03 +00:00
Fariborz Jahanian 68a542aea7 Add objective-C style formatting to clang format and
use it to format xml declaration tags. 
// rdar://12378714

llvm-svn: 170727
2012-12-20 19:54:13 +00:00
Ted Kremenek 89abaa3517 Update RetainCountChecker to understand attribute ns_returns_autoreleased.
Fixes <rdar://problem/12887356>.

llvm-svn: 170724
2012-12-20 19:36:22 +00:00
Evgeniy Stepanov a8df444a1c Add __has_feature(memory_sanitizer).
llvm-svn: 170686
2012-12-20 12:03:13 +00:00
NAKAMURA Takumi 712c3882f6 clang/test/Driver/warning-options.cpp: Appease MSYS bash.
llvm-svn: 170683
2012-12-20 11:08:13 +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
John McCall 393a78d4d3 Robustify the @encode code and add support for _Atomic.
Fixes PR14628.

llvm-svn: 170639
2012-12-20 02:45:14 +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
Argyrios Kyrtzidis 5e14925a35 [preprocessor] When "merging" macro argument tokens into one SLocEntry chunk,
make sure they came from the same kind of FileIDs.

Thanks to Abramo Bagnara for providing the test case.

llvm-svn: 170616
2012-12-19 23:55:44 +00:00
Chad Rosier 567fcd7da2 Typo.
llvm-svn: 170613
2012-12-19 23:47:16 +00:00
Chad Rosier 6c2b11cc50 [driver] Have -isysroot warn on nonexistent paths.
rdar://12282267

llvm-svn: 170611
2012-12-19 23:41:50 +00:00
Argyrios Kyrtzidis 2810e9dee0 [PCH/Modules] In ASTReader::completeVisibleDeclsMap, make sure to visit all
modules when getting the decls for a namespace or translation unit.

Otherwise the code-completion results will not be complete.

rdar://12889089

llvm-svn: 170596
2012-12-19 22:21:18 +00:00
Fariborz Jahanian a1f8571e84 objective-C: Don't warn of unimplemented property of protocols in
category, when those properties will be implemented in category's 
primary class or one of its super classes. // rdar://12568064

llvm-svn: 170573
2012-12-19 18:58:55 +00:00
Ted Kremenek 11d0b553bb Change test to dump Filecheck output to an intermediate file. This makes it easier to update this test.
llvm-svn: 170570
2012-12-19 18:30:38 +00:00
Dmitri Gribenko c55c6fc6e3 Fix PR14591: Windows newlines in doxygen comments cause failed assertion in
TextDiagnostic

Patch by Janusz Chorko.

llvm-svn: 170566
2012-12-19 17:34:55 +00:00
Richard Smith 4efa77fde4 Attempt to clarify a vexing-parse diagnostic.
llvm-svn: 170492
2012-12-19 03:15:32 +00:00
Richard Smith 503053a737 Fix assertion failure in self-host (and probably bogus template instantiation
too). When instantiating a direct-initializer, if we find it has zero
arguments, produce an empty ParenListExpr rather than returning a null
expression.

llvm-svn: 170490
2012-12-19 02:27:38 +00:00
Richard Smith d59b832320 PR13470: Ensure that copy-list-initialization isntantiates as
copy-list-initialization (and doesn't add an additional copy step):

Fill in the ListInitialization bit when creating a CXXConstructExpr. Use it
when instantiating initializers in order to correctly handle instantiation of
copy-list-initialization. Teach TreeTransform that function arguments are
initializations, and so need this special treatment too. Finally, remove some
hacks which were working around SubstInitializer's shortcomings.

llvm-svn: 170489
2012-12-19 01:39:02 +00:00
NAKAMURA Takumi 710c18329b test/Index/preamble_macro_template.cpp: Suppress this probably due to Lit/win32 issue. Investigating.
llvm-svn: 170484
2012-12-19 00:57:48 +00:00
Eli Friedman 39b685e4d1 Make sure CodeGen uses a value of the correct type as the result of
of assignment to a bool bitfield.  PR14638.

llvm-svn: 170480
2012-12-19 00:26:58 +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
Nadav Rotem b2b8d5bc86 Fix the fvectorize testcase
llvm-svn: 170469
2012-12-18 23:08:58 +00:00
Ted Kremenek e3713d3025 Have clang_getSpellingLocation() use the same logic as DiagnosticRenderer for plowing through macros.
This fixes a subtle bug reported in <rdar://problem/12584554> where a double-nested
macro could lead to an incorrect fixit location with live issues.

This fix also uncovers a bunch of subtle bugs in our indexer test cases which
are now fixed (mostly around source ranges for attributes).

llvm-svn: 170468
2012-12-18 23:07:30 +00:00
Fariborz Jahanian 9b7ab87738 This is the libclang patch providing minimal API to
use clang's formatter. Currently, formatter is used 
to format declaration tags for xml comments. Since formatter
is in flux and its change will break several of the clang comment
tests, only a single tests is formatted using this facility.
Doug has reviewed and approved it for check-in. 

llvm-svn: 170467
2012-12-18 23:02:59 +00:00
Bill Wendling f1c3191188 Add tests to check recent changes to some builtins.
llvm-svn: 170458
2012-12-18 21:09:25 +00:00