Commit Graph

16832 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis b7b89b5ebc [arcmt] Don't error if an autoreleased variable is returned after the -autorelease.
rdar://12952025

llvm-svn: 171482
2013-01-04 18:29:59 +00:00
Douglas Gregor 2060482ece Remove -Wmodule-build; it was a dumb idea anyway. <rdar://problem/12957525>
llvm-svn: 171478
2013-01-04 18:22:19 +00:00
Rafael Espindola d2ecc139f2 Warn on unused auto variables.
To do so we have to wait until we know that the type of a variable has been
deduced. Sema::FinalizeDeclaration is the first callback that is used for
decl with or without initializers.

llvm-svn: 171458
2013-01-03 04:29:20 +00:00
Argyrios Kyrtzidis 6ba7afb8e1 [arcmt] Rewrite uses of Block_copy/Block_release macros.
c = Block_copy(b);
  Block_release(c);
 ---->
  c = [b copy];
  <removed>

rdar://9408211

llvm-svn: 171454
2013-01-03 03:17:17 +00:00
Ted Kremenek 1d6aac5b6a Fix capitalization of Objective-C in diagnostic.
llvm-svn: 171440
2013-01-03 01:30:20 +00:00
Eli Friedman 33accdf602 Don't assert/crash on reference variables in lambdas bound to a
static local variable from the parent scope.  PR14773.

llvm-svn: 171433
2013-01-03 00:39:26 +00:00
Anna Zaks 3fdcc0bda3 [analyzer] Rename callback EndPath -> EndFunction
This better reflects when callback is called and what the checkers
are relying on. (Both names meant the same pre-IPA.)

llvm-svn: 171432
2013-01-03 00:25:29 +00:00
Dmitri Gribenko 1654035a3b hexagon-target-basic.c test: add REQUIRES line for hexagon target
llvm-svn: 171422
2013-01-02 22:30:14 +00:00
Anshuman Dasgupta 89730ce9ee Correct Hexagon DataLayout string. Fixes bug 14744.
Patch by Krzysztof Parzyszek!

llvm-svn: 171415
2013-01-02 21:25:57 +00:00
Dmitri Gribenko 154e6e53ad Type safety attributes: add tests for enumerations (users are actually doing
this, ensure we don't regress)

llvm-svn: 171412
2013-01-02 21:12:03 +00:00
Daniel Jasper ac5c1c286c Prefer splitting after "template <...>" and fix indentation.
This addresses llvm.org/PR14699

Before:
template <typename T>
    void looooooooooooooooooooooongFunction(int Param1, int Param2);
template <typename T> void looooooooooooooooooooongFunction(
    int Paaaaaaaaaaaaaaaaaaaaram1, int Paaaaaaaaaaaaaaaaaaaaram2);

After:
template <typename T>
void looooooooooooooooooooooongFunction(int Param1, int Param2);
template <typename T>
void looooooooooooooooooooongFunction(int Paaaaaaaaaaaaaaaaaaaaram1,
                                      int Paaaaaaaaaaaaaaaaaaaaram2);

llvm-svn: 171388
2013-01-02 15:08:56 +00:00
Richard Smith 89645bc888 s/CXX0X/CXX11/g, except for __GNU_EXPERIMENTAL_CXX0X__, and update a few nearby 'C++0x' comments.
llvm-svn: 171372
2013-01-02 12:01:23 +00:00
Rafael Espindola aadd30ec52 Silence some warnings and allow passing down some feature flags to the linker.
Patch by Brad Smith.

llvm-svn: 171329
2012-12-31 22:41:36 +00:00
Rafael Espindola ea7537f2a2 Don't warn on unused member functions that are extern because of a typedef.
llvm-svn: 171267
2012-12-30 21:42:26 +00:00
Will Dietz 3676d56b71 [ubsan] Recover by default, use -fno-sanitize-recover to disable.
llvm-svn: 171264
2012-12-30 20:53:28 +00:00
Rafael Espindola a5c892058c Use hasCLanguageLinkage when warning about non C return types.
llvm-svn: 171263
2012-12-30 20:40:41 +00:00
Rafael Espindola 5cab029e4b Don't get confused if a extern "C" builtin function is redeclared without
the extern "C".

llvm-svn: 171260
2012-12-30 17:23:09 +00:00
Rafael Espindola 9463dce9bf Don't warn for undefined but used decls that are external because of a typedef.
This fixes pr14736. It is fairly ugly, but I don't think we can do much better
as we have to wait at least until the end of the typedef to know if the
function will have external linkage or not.

llvm-svn: 171240
2012-12-29 23:43:00 +00:00
Rafael Espindola 576127d90e Reject overloading of two static extern C functions.
This patch moves hasCLanguageLinkage to be VarDecl and FunctionDecl methods
so that they can be used from SemaOverload.cpp and then fixes the logic
in Sema::IsOverload.

llvm-svn: 171193
2012-12-28 14:21:58 +00:00
Richard Smith 74fc72143a PR14729: Fix typo in CheckICE for BinaryConditionalOperators.
llvm-svn: 171191
2012-12-28 12:53:55 +00:00
Richard Smith de1a487402 Improve diagnostic wording for when an implicitly-deleted special member
function is selected by overload resolution.

llvm-svn: 171190
2012-12-28 12:23:24 +00:00
David Blaikie bf18725d11 Change this to an IR test instead of an assembly test (as per comment in r171134).
This makes the test not dependent on LLVM & won't vary/break based on LLVM
codegen related changes. Appropriately testing at the Clang level what was
fixed at the Clang level originally (in r124210).

llvm-svn: 171175
2012-12-28 01:16:31 +00:00
Rafael Espindola cffa95d73f Implement dcl.link paragraph 5.
The language linkage of redeclarations must match. GCC was already reporting
an error for this.

llvm-svn: 171139
2012-12-27 03:56:20 +00:00
Eric Christopher a487035ca9 Update test for backend change.
TODO: This test should be moved to the backend.
llvm-svn: 171134
2012-12-27 02:20:24 +00:00
Rafael Espindola 1779760cb4 Fix a regression from the previous commit.
Template instantiation can set the canonical decl to used after subsequent
decls have been chained, so we have to check that too.

llvm-svn: 171088
2012-12-26 04:38:44 +00:00
Rafael Espindola dfa5f9b511 Use the most recent redecl to decide if it is needed.
This fixes pr14691, which I think is a regression from r168519.

llvm-svn: 171077
2012-12-26 00:13:29 +00:00
Richard Smith 940a6d73ce Produce an actual error before attempting to attach notes to it when bailing out
due to FORCE_CLANG_DIAGNOSTICS_CRASH=1. Also add a test for that env var.

llvm-svn: 171074
2012-12-25 21:56:27 +00:00
Guy Benyei f0a014bbb7 Add intel_ocl_bicc calling convention as a function attribute to clang. The calling convention is already implemented in LLVM.
llvm-svn: 171056
2012-12-25 08:53:55 +00:00
Rafael Espindola 54606d57a2 Add 171048 back but invalidate the cache of all redeclarations when setting
the body of a functions. The problem was that hasBody looks at the entire chain
and causes problems to -fvisibility-inlines-hidden if the cache was not
invalidated.

Original message:

Cache visibility of decls.

This unifies the linkage and visibility caching. I first implemented this when
working on pr13844, but the previous fixes removed the performance advantage of
this one.
This is still a step in the right direction for making linkage and visibility
cheap to use.

llvm-svn: 171053
2012-12-25 07:31:49 +00:00
Nick Lewycky a5d914196c Simplify RUN lines. No functionality change.
llvm-svn: 171045
2012-12-24 21:45:14 +00:00
Evgeniy Stepanov ad8ab3d9ea Support -fsanitize-memory-track-origins.
llvm-svn: 171020
2012-12-24 08:42:34 +00:00
NAKAMURA Takumi 6cebf7f8c0 test/Index/preamble_macro_template.cpp: Tweak for win32.
Using the file immediately after "> file 2>&1" causes weird behavior on win32.
For example, "foo > %t 2>&1; FileCheck --input-file=%t"

Use "foo 2>&1 | tee %t" instead.

Note, mixing stdout and stderr to the same handle might cause unexpected behavior, due to buffering.

llvm-svn: 171009
2012-12-24 01:23:48 +00:00
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