]> granicus.if.org Git - clang/log
clang
11 years ago[analyzer] Moving cplusplus.NewDelete to alpha.* for now.
Anton Yartsev [Tue, 2 Apr 2013 05:59:24 +0000 (05:59 +0000)]
[analyzer] Moving cplusplus.NewDelete to alpha.* for now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178529 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd -Wstatic-local-in-inline, which warns about using a static local
John McCall [Tue, 2 Apr 2013 02:48:58 +0000 (02:48 +0000)]
Add -Wstatic-local-in-inline, which warns about using a static local
variable in a C99 inline (but not static-inline or extern-inline)
function definition.

The standard doesn't actually say that this doesn't apply to
"extern inline" definitions, but that seems like a useful extension,
and it at least doesn't have the obvious flaw that a static
mutable variable in an externally-available definition does.

rdar://13535367

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178520 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Teach invalidateRegions that regions within LazyCompoundVal need to be...
Anna Zaks [Tue, 2 Apr 2013 01:28:24 +0000 (01:28 +0000)]
[analyzer] Teach invalidateRegions that regions within LazyCompoundVal need to be invalidated

Refactor invalidateRegions to take SVals instead of Regions as input and teach RegionStore
about processing LazyCompoundVal as a top-level “escaping” value.

This addresses several false positives that get triggered by the NewDelete checker, but the
underlying issue is reproducible with other checkers as well (for example, MallocChecker).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178518 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoun-break remaining gdb buildbot testcases.
Adrian Prantl [Tue, 2 Apr 2013 01:00:48 +0000 (01:00 +0000)]
un-break remaining gdb buildbot testcases.
Make sure we do not generate line info for debugging-related frame setup.
Follow-up to r178361 / rdar://problem/12767564

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178517 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] For now, don't inline [cd]tors of C++ containers.
Jordan Rose [Tue, 2 Apr 2013 00:26:35 +0000 (00:26 +0000)]
[analyzer] For now, don't inline [cd]tors of C++ containers.

This is a heuristic to make up for the fact that the analyzer doesn't
model C++ containers very well. One example is modeling that
'std::distance(I, E) == 0' implies 'I == E'. In the future, it would be
nice to model this explicitly, but for now it just results in a lot of
false positives.

The actual heuristic checks if the base type has a member named 'begin' or
'iterator'. If so, we treat the constructors and destructors of that type
as opaque, rather than inlining them.

This is intended to drastically reduce the number of false positives
reported with experimental destructor support turned on. We can tweak the
heuristic in the future, but we'd rather err on the side of false negatives
for now.

<rdar://problem/13497258>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178516 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Cache whether a function is generally inlineable.
Jordan Rose [Tue, 2 Apr 2013 00:26:29 +0000 (00:26 +0000)]
[analyzer] Cache whether a function is generally inlineable.

Certain properties of a function can determine ahead of time whether or not
the function is inlineable, such as its kind, its signature, or its
location. We can cache this value in the FunctionSummaries map to avoid
rechecking these static properties for every call.

Note that the analyzer may still decide not to inline a specific call to
a function because of the particular dynamic properties of the call along
the current path.

No intended functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178515 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Use inline storage in the FunctionSummary DenseMap.
Jordan Rose [Tue, 2 Apr 2013 00:26:26 +0000 (00:26 +0000)]
[analyzer] Use inline storage in the FunctionSummary DenseMap.

The summaries lasted for the lifetime of the map anyway; no reason to
include an extra allocation.

Also, use SmallBitVector instead of BitVector to track the visited basic
blocks -- most functions will have less than 64 basic blocks -- and
use bitfields for the other fields to reduce the size of the structure.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178514 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Allow suppressing diagnostics reported within the 'std' namespace
Jordan Rose [Tue, 2 Apr 2013 00:26:15 +0000 (00:26 +0000)]
[analyzer] Allow suppressing diagnostics reported within the 'std' namespace

This is controlled by the 'suppress-c++-stdlib' analyzer-config flag.
It is currently off by default.

This is more suppression than we'd like to do, since obviously there can
be user-caused issues within 'std', but it gives us the option to wield
a large hammer to suppress false positives the user likely can't work
around.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178513 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix typo in test
Matt Beaumont-Gay [Mon, 1 Apr 2013 22:58:48 +0000 (22:58 +0000)]
Fix typo in test

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178510 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUse the ASYContext::getTypeSizeInChars API to cleanup some ugliness, per John
Chad Rosier [Mon, 1 Apr 2013 22:02:05 +0000 (22:02 +0000)]
Use the ASYContext::getTypeSizeInChars API to cleanup some ugliness, per John
and Jordan's suggestion.  No functional change intendend.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178507 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoPR15633: Note that we are EnteringContext when parsing the nested name
Richard Smith [Mon, 1 Apr 2013 21:43:41 +0000 (21:43 +0000)]
PR15633: Note that we are EnteringContext when parsing the nested name
specifier for an enumeration. Also fix a crash-on-invalid if a non-dependent
name specifier is used to declare an enum template.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178502 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[arcmt] Copy the diagnostics so we don't have to worry about invaliding iterators...
Argyrios Kyrtzidis [Mon, 1 Apr 2013 21:12:30 +0000 (21:12 +0000)]
[arcmt] Copy the diagnostics so we don't have to worry about invaliding iterators from the diagnostic list.

Should fix http://llvm.org/PR15500

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178500 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoR600: Handle -mcpu option v3
Tom Stellard [Mon, 1 Apr 2013 20:56:53 +0000 (20:56 +0000)]
R600: Handle -mcpu option v3

v2:
  - Add a test case

v3:
  - Use the -### clang option in the tests

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178499 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoR600: Add missing Southern Islands GPU to setCPU() function
Tom Stellard [Mon, 1 Apr 2013 20:56:49 +0000 (20:56 +0000)]
R600: Add missing Southern Islands GPU to setCPU() function

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178498 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRevert r178079, it caused PR15637.
Nico Weber [Mon, 1 Apr 2013 20:33:18 +0000 (20:33 +0000)]
Revert r178079, it caused PR15637.

Also add a test for PR15637.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178497 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDon't eagerly deserialize every templated function (and every static data
Richard Smith [Mon, 1 Apr 2013 20:22:16 +0000 (20:22 +0000)]
Don't eagerly deserialize every templated function (and every static data
member inside a class template) when loading a PCH file or module.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178496 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago* Attempt to un-break gdb buildbot by emitting a lexical block end only
Adrian Prantl [Mon, 1 Apr 2013 19:02:06 +0000 (19:02 +0000)]
* Attempt to un-break gdb buildbot by emitting a lexical block end only
  when we actually end a lexical block.
* Added new test for line table / block cleanup.
* Follow-up to r177819 / rdar://problem/13115369

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178490 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoOnly merge down a variable type if the previous declaration was
John McCall [Mon, 1 Apr 2013 18:34:28 +0000 (18:34 +0000)]
Only merge down a variable type if the previous declaration was
visible.  There's a lot of potential badness in how we're modelling
these things, but getting this much correct is reasonably easy.

rdar://13535367

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178488 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdding parenType() and innerType() AST Matchers
Edwin Vane [Mon, 1 Apr 2013 18:33:34 +0000 (18:33 +0000)]
Adding parenType() and innerType() AST Matchers

Updated docs and tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178487 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoCleanup. No functional change intended.
Chad Rosier [Mon, 1 Apr 2013 17:58:03 +0000 (17:58 +0000)]
Cleanup.  No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178481 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoThread safety analysis: Turn on checking for non-scalar types by default.
DeLesley Hutchins [Mon, 1 Apr 2013 17:47:37 +0000 (17:47 +0000)]
Thread safety analysis:  Turn on checking for non-scalar types by default.
These were previously enabled as a "beta" feature, but they have now been
extensively tested.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178478 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd test for PR12527 (bug has apparently already been fixed).
Richard Smith [Mon, 1 Apr 2013 17:41:23 +0000 (17:41 +0000)]
Add test for PR12527 (bug has apparently already been fixed).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178476 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[libclang] Make clang_Cursor_getArgument work with call-exprs.
Argyrios Kyrtzidis [Mon, 1 Apr 2013 17:38:59 +0000 (17:38 +0000)]
[libclang] Make clang_Cursor_getArgument work with call-exprs.

Patch by Matthias Kleine!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178475 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoImprove formatting of function types.
Daniel Jasper [Mon, 1 Apr 2013 17:13:26 +0000 (17:13 +0000)]
Improve formatting of function types.

Before: void * (*a)(int *, SomeType *);
After:  void *(*a)(int *, SomeType *);

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178474 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoModifed debug-info-byval.cpp test to grep for .string or .asciz.
Jyotsna Verma [Mon, 1 Apr 2013 15:59:25 +0000 (15:59 +0000)]
Modifed debug-info-byval.cpp test to grep for .string or .asciz.
The assembly output for Hexagon contains ".string missing_arg".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178471 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix typo. This method isn't used anywhere.
Benjamin Kramer [Sun, 31 Mar 2013 20:14:24 +0000 (20:14 +0000)]
Fix typo. This method isn't used anywhere.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178453 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRemove unused default values.
Rafael Espindola [Sat, 30 Mar 2013 23:04:08 +0000 (23:04 +0000)]
Remove unused default values.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178435 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRemove old NVPTX cpus and add new NVPTX cpus
Justin Holewinski [Sat, 30 Mar 2013 14:38:26 +0000 (14:38 +0000)]
Remove old NVPTX cpus and add new NVPTX cpus

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178419 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUse kernel metadata to differentiate between kernel and device
Justin Holewinski [Sat, 30 Mar 2013 14:38:24 +0000 (14:38 +0000)]
Use kernel metadata to differentiate between kernel and device
functions for the NVPTX target.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178418 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd support for gcc-compatible -mfprnd -mno-fprnd PPC options
Hal Finkel [Sat, 30 Mar 2013 13:47:44 +0000 (13:47 +0000)]
Add support for gcc-compatible -mfprnd -mno-fprnd PPC options

gcc provides -mfprnd and -mno-fprnd for controlling the fprnd target
feature; support these options as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178414 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoSema: Don't crash when trying to emit a precedence warning on postinc/decrement.
Benjamin Kramer [Sat, 30 Mar 2013 11:56:00 +0000 (11:56 +0000)]
Sema: Don't crash when trying to emit a precedence warning on postinc/decrement.

Post-Inc can occur as a binary call (the infamous dummy int argument), but it's
not really a binary operator.

Fixes PR15628.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178412 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Restructure ExprEngine::VisitCXXNewExpr to do a bit less work.
Jordan Rose [Sat, 30 Mar 2013 01:31:48 +0000 (01:31 +0000)]
[analyzer] Restructure ExprEngine::VisitCXXNewExpr to do a bit less work.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178402 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Handle caching out while evaluating a C++ new expression.
Jordan Rose [Sat, 30 Mar 2013 01:31:42 +0000 (01:31 +0000)]
[analyzer] Handle caching out while evaluating a C++ new expression.

Evaluating a C++ new expression now includes generating an intermediate
ExplodedNode, and this node could very well represent a previously-
reachable state in the ExplodedGraph. If so, we can short-circuit the
rest of the evaluation.

Caught by the assertion a few lines later.

<rdar://problem/13510065>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178401 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Add debug helper LocationContext::dumpStack().
Jordan Rose [Sat, 30 Mar 2013 01:31:35 +0000 (01:31 +0000)]
[analyzer] Add debug helper LocationContext::dumpStack().

Sample output:
  #0 void construct(pointer __p, llvm::ImutAVLTree<llvm::ImutContainerInfo<clang::ento::BugType *> > *const &__val)
  #1 void push_back(const value_type &__x)
  #2 void destroy()
  #3 void release()
  #4 void ~ImmutableSet()

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178400 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Garbage removed
Anton Yartsev [Sat, 30 Mar 2013 01:24:21 +0000 (01:24 +0000)]
[analyzer] Garbage removed

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178398 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Test added
Anton Yartsev [Sat, 30 Mar 2013 01:22:45 +0000 (01:22 +0000)]
[analyzer] Test added

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178397 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Enabled unix.Malloc checker.
Anton Yartsev [Sat, 30 Mar 2013 00:50:37 +0000 (00:50 +0000)]
[analyzer] Enabled unix.Malloc checker.
+ Refactoring.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178388 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Tests for intersections with other checkers from MallocChecker.cpp factore...
Anton Yartsev [Sat, 30 Mar 2013 00:43:02 +0000 (00:43 +0000)]
[analyzer] Tests for intersections with other checkers from MallocChecker.cpp factored out to  NewDelete-intersections.mm

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178387 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agogeneralize testcase
Adrian Prantl [Fri, 29 Mar 2013 23:15:55 +0000 (23:15 +0000)]
generalize testcase

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178383 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Address Jordan’s review of r178309 - do not register an extra visitor...
Anna Zaks [Fri, 29 Mar 2013 22:32:38 +0000 (22:32 +0000)]
[analyzer] Address Jordan’s review of r178309 - do not register an extra visitor for nil receiver

We can check if the receiver is nil in the node that corresponds to the StmtPoint of the message send.
At that point, the receiver is guaranteed to be live. We will find at least one unreclaimed node due to
my previous commit (look for StmtPoint instead of PostStmt) and the fact that the nil receiver nodes are tagged.

+ a couple of extra tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178381 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Look for a StmtPoint node instead of PostStmt in trackNullOrUndefValue.
Anna Zaks [Fri, 29 Mar 2013 22:32:34 +0000 (22:32 +0000)]
[analyzer] Look for a StmtPoint node instead of PostStmt in trackNullOrUndefValue.

trackNullOrUndefValue tries to find the first node that matches the statement it is tracking.
Since we collect PostStmt nodes (in node reclamation), none of those might be on the
current path, so relax the search to look for any StmtPoint.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178380 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[libclang] Add test case for r178374.
Argyrios Kyrtzidis [Fri, 29 Mar 2013 22:16:32 +0000 (22:16 +0000)]
[libclang] Add test case for r178374.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178378 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoWhen looking for overridden ObjC methods, don't ignore 'hidden' ones.
Argyrios Kyrtzidis [Fri, 29 Mar 2013 21:51:48 +0000 (21:51 +0000)]
When looking for overridden ObjC methods, don't ignore 'hidden' ones.

When using modules we should not ignore overridden methods from
categories that are hidden because the module is not visible.
This will give more consistent results (when imports change) and it's more
correct since the methods are indeed overridden even if they are not "visible"
for lookup purposes.

rdar://13350796

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178374 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[libclang] If libclang logging is enabled, print all compiler diagnostics to stderr...
Argyrios Kyrtzidis [Fri, 29 Mar 2013 21:51:44 +0000 (21:51 +0000)]
[libclang] If libclang logging is enabled, print all compiler diagnostics to stderr instead of capturing them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178373 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[cmake] Add clang-headers as a dependency of libclang and if we have to copy them
Argyrios Kyrtzidis [Fri, 29 Mar 2013 21:51:40 +0000 (21:51 +0000)]
[cmake] Add clang-headers as a dependency of libclang and if we have to copy them
for the IDE case, also create a symlink inside the libclang.dylib directory.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178372 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoSema: Warn on sizeof on binary ops on decayed arrays.
Benjamin Kramer [Fri, 29 Mar 2013 21:43:21 +0000 (21:43 +0000)]
Sema: Warn on sizeof on binary ops on decayed arrays.

The array will decay into a pointer, creating an unexpected result.
sizeof(array + int) is an easy to make typo for sizeof(array) + int.

This was motivated by a NetBSD security bug, used sizeof(key - r) instead of
sizeof(key) - r, reducing entropy in a random number generator.
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/subr_cprng.c.diff?r1=1.14&r2=1.15&only_with_tag=MAIN&f=h

Differential Revision: http://llvm-reviews.chandlerc.com/D571

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178371 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoBugfix/Followup for r177086.
Adrian Prantl [Fri, 29 Mar 2013 19:20:35 +0000 (19:20 +0000)]
Bugfix/Followup for r177086.
* Store the .block_descriptor (instead of self) in the alloca so we
  can guarantee that all captured variables are available at -O0.
* Add the missing OpDeref for the alloca.
rdar://problem/12767564

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178361 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoImprovement on r177086.
Adrian Prantl [Fri, 29 Mar 2013 19:20:29 +0000 (19:20 +0000)]
Improvement on r177086.
* Let DIType for block-captured self to point to the completed cached
  interface type.
rdar://problem/12767564

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178360 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoHexagon: Set Hexagon tool-chain when configured as OSless target.
Jyotsna Verma [Fri, 29 Mar 2013 19:09:20 +0000 (19:09 +0000)]
Hexagon: Set Hexagon tool-chain when configured as OSless target.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178358 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRemove sign-compare warning on systems that still use 32 bit time_ts.
Benjamin Kramer [Fri, 29 Mar 2013 17:39:43 +0000 (17:39 +0000)]
Remove sign-compare warning on systems that still use 32 bit time_ts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178351 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix thinko (and the bots): We still want to warn in C.
Rafael Espindola [Fri, 29 Mar 2013 07:56:05 +0000 (07:56 +0000)]
Fix thinko (and the bots): We still want to warn in C.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178335 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDon't special case one line extern "C" decls.
Rafael Espindola [Fri, 29 Mar 2013 07:02:31 +0000 (07:02 +0000)]
Don't special case one line extern "C" decls.

We already avoided warning for

extern "C" const char *Version_string = "2.9";

now we also don't produce any warnings for

extern "C" {
  extern const char *Version_string2 = "2.9";
}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178333 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd RDSEED intrinsic support defined in AVX2 extension
Michael Liao [Fri, 29 Mar 2013 05:17:55 +0000 (05:17 +0000)]
Add RDSEED intrinsic support defined in AVX2 extension

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178331 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd XTEST intrinsic defined in TSX extension
Michael Liao [Fri, 29 Mar 2013 05:14:06 +0000 (05:14 +0000)]
Add XTEST intrinsic defined in TSX extension

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178330 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[cfg] Always guard (when AddStaticInitBranches == true) DeclStmts for static variable...
Ted Kremenek [Fri, 29 Mar 2013 00:42:56 +0000 (00:42 +0000)]
[cfg] Always guard (when AddStaticInitBranches == true) DeclStmts for static variables, not just ones with explicit initializers

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178322 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Add static initializer test case (from <rdar://problem/13227740>).
Ted Kremenek [Fri, 29 Mar 2013 00:32:36 +0000 (00:32 +0000)]
[analyzer] Add static initializer test case (from <rdar://problem/13227740>).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178321 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRevert r178273 as it broke the Linux bootstrap due to false positives
Timur Iskhodzhanov [Fri, 29 Mar 2013 00:22:03 +0000 (00:22 +0000)]
Revert r178273 as it broke the Linux bootstrap due to false positives

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178320 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd static analyzer support for conditionally executing static initializers.
Ted Kremenek [Fri, 29 Mar 2013 00:09:28 +0000 (00:09 +0000)]
Add static analyzer support for conditionally executing static initializers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178318 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd configuration plumbing to enable static initializer branching in the CFG for...
Ted Kremenek [Fri, 29 Mar 2013 00:09:22 +0000 (00:09 +0000)]
Add configuration plumbing to enable static initializer branching in the CFG for the analyzer.

This setting still isn't enabled yet in the analyzer.  This is
just prep work.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178317 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoObjective-C: Produce precise diagnostic when
Fariborz Jahanian [Thu, 28 Mar 2013 23:39:11 +0000 (23:39 +0000)]
Objective-C: Produce precise diagnostic when
'isa' ivar is accessed provided it is the first
ivar. Fixit hint will follow in another patch.
This is continuation of // rdar://13503456

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178313 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Document existence of ConstPointerEscape.
Anna Zaks [Thu, 28 Mar 2013 23:15:32 +0000 (23:15 +0000)]
[analyzer] Document existence of ConstPointerEscape.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178311 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Add support for escape of const pointers and use it to allow “newed” point...
Anna Zaks [Thu, 28 Mar 2013 23:15:29 +0000 (23:15 +0000)]
[analyzer] Add support for escape of const pointers and use it to allow “newed” pointers to escape

Add a new callback that notifies checkers when a const pointer escapes. Currently, this only works
for const pointers passed as a top level parameter into a function. We need to differentiate the const
pointers escape from regular escape since the content pointed by const pointer will not change;
if it’s a file handle, a file cannot be closed; but delete is allowed on const pointers.

This should suppress several false positives reported by the NewDelete checker on llvm codebase.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178310 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Apply the suppression rules to the nil receiver only if the value particip...
Anna Zaks [Thu, 28 Mar 2013 23:15:22 +0000 (23:15 +0000)]
[analyzer] Apply the suppression rules to the nil receiver only if the value participates in the computation of the nil we warn about.

We should only suppress a bug report if the IDCed or null returned nil value is directly related to the value we are warning about. This was
not the case for nil receivers - we would suppress a bug report that had an IDCed nil receiver on the path regardless of how it’s
related to the warning.

1) Thread EnableNullFPSuppression parameter through the visitors to differentiate between tracking the value which
is directly responsible for the bug and other values that visitors are tracking (ex: general tracking of nil receivers).
2) in trackNullOrUndef specifically address the case when a value of the message send is nil due to the receiver being nil.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178309 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[ms-cxxabi] Add more tests for r178297
Reid Kleckner [Thu, 28 Mar 2013 23:11:29 +0000 (23:11 +0000)]
[ms-cxxabi] Add more tests for r178297

This covers a few cases where the class of a member pointer is not a
CXXRecordDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178307 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[sema] Check the result of getAsCXXRecordDecl() to fix the build
Reid Kleckner [Thu, 28 Mar 2013 22:15:11 +0000 (22:15 +0000)]
[sema] Check the result of getAsCXXRecordDecl() to fix the build

I'm not 100% sure what should happen here to find the real
CXXRecordDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178297 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoWarn about more than the first unused variable when -Werror is set.
Matt Beaumont-Gay [Thu, 28 Mar 2013 21:46:45 +0000 (21:46 +0000)]
Warn about more than the first unused variable when -Werror is set.

To do this, thread DiagnosticErrorTrap's hasUnrecoverableErrorOccurred through
to Scope.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178294 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[sema] Remove unused variable from r178283
Reid Kleckner [Thu, 28 Mar 2013 20:54:13 +0000 (20:54 +0000)]
[sema] Remove unused variable from r178283

Wouldn't it be cool if we had a compiler for Windows that could warn
about these things?

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178289 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[ms-cxxabi] Correctly compute the size of member pointers
Reid Kleckner [Thu, 28 Mar 2013 20:02:56 +0000 (20:02 +0000)]
[ms-cxxabi] Correctly compute the size of member pointers

Summary:
This also relaxes the requirement on Windows that the member pointer
class type be a complete type (http://llvm.org/PR12070).  We still ask
for a complete type to instantiate any templates (MSVC does this), but
if that fails we continue as normal, relying on any inheritance
attributes on the declaration.

Reviewers: rjmccall

CC: triton, timurrrr, cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D568

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178283 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoObjective-C: Provide fixit suggestions when class object
Fariborz Jahanian [Thu, 28 Mar 2013 19:50:55 +0000 (19:50 +0000)]
Objective-C: Provide fixit suggestions when class object
is accessed via accessing 'isa' ivar to use
object_getClass/object_setClass apis.
// rdar://13503456

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178282 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoProvide a fixit to static_cast for reinterpret_casts within a class hierarchy.
Jordan Rose [Thu, 28 Mar 2013 19:09:40 +0000 (19:09 +0000)]
Provide a fixit to static_cast for reinterpret_casts within a class hierarchy.

The suggestion was already in the text of the note; this just adds the
actual fixit and the appropriate test cases.

Patch by Alexander Zinenko!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178274 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoImplemented a warning when an input several bitwise operations are
Sam Panzer [Thu, 28 Mar 2013 19:07:11 +0000 (19:07 +0000)]
Implemented a warning when an input several bitwise operations are
likely be implicitly truncated:

  * All forms of Bitwise-and, bitwise-or, and integer multiplication.
  * The assignment form of integer addition, subtraction, and exclusive-or
  * The RHS of the comma operator
  * The LHS of left shifts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178273 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRename clang::driver::tools::linuxtools to clang::driver::tools::gnutools.
Thomas Schwinge [Thu, 28 Mar 2013 19:04:25 +0000 (19:04 +0000)]
Rename clang::driver::tools::linuxtools to clang::driver::tools::gnutools.

This is about the GNU Binutils' assembler and linker, so reflect that in the
name.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178272 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRename LinuxDistro to Distro.
Thomas Schwinge [Thu, 28 Mar 2013 19:02:48 +0000 (19:02 +0000)]
Rename LinuxDistro to Distro.

The concept of such a software distribution is not tied to the Linux kernel;
for example Debian GNU/Linux, Debian GNU/Hurd, and Debian GNU/kFreeBSD all
share the same source packages and generally the same user-space configuration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178270 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUse early return in printing logic. Minor cleanup.
Ted Kremenek [Thu, 28 Mar 2013 18:43:18 +0000 (18:43 +0000)]
Use early return in printing logic.  Minor cleanup.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178264 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd CFG logic to create a conditional branch for modeling static initializers.
Ted Kremenek [Thu, 28 Mar 2013 18:43:15 +0000 (18:43 +0000)]
Add CFG logic to create a conditional branch for modeling static initializers.

This is an optional variant of the CFG.  This allows analyses to model whether
or not a static initializer has run, e.g.:

  static Foo x = bar();

For basic dataflow analysis in Sema we will just assume that the initializer
always runs.  For the static analyzer we can use this branch to accurately
track whether or not initializers are on.

This patch just adds the (opt-in) functionality to the CFG.  The
static analyzer still needs to be modified to adopt this feature.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178263 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFixed handling of comments before preprocessor directives.
Alexander Kornienko [Thu, 28 Mar 2013 18:40:55 +0000 (18:40 +0000)]
Fixed handling of comments before preprocessor directives.

Comments before preprocessor directives used to be stored with InPPDirective
flag set, which prevented correct comment splitting in this case. Fixed by
flushing comments before switching on InPPDirective. Added a new test and fixed
one of the existing tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178261 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix order of initialization warning.
Eric Christopher [Thu, 28 Mar 2013 18:22:58 +0000 (18:22 +0000)]
Fix order of initialization warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178255 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] These implements unix.MismatchedDeallocatorChecker checker.
Anton Yartsev [Thu, 28 Mar 2013 17:05:19 +0000 (17:05 +0000)]
[analyzer] These implements unix.MismatchedDeallocatorChecker checker.
+ Improved display names for allocators and deallocators

The checker checks if a deallocation function matches allocation one. ('free' for 'malloc', 'delete' for 'new' etc.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178250 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoThese are all simple pointer wrappers. Pass them by value.
Rafael Espindola [Thu, 28 Mar 2013 16:26:16 +0000 (16:26 +0000)]
These are all simple pointer wrappers. Pass them by value.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178247 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] For now assume all standard global 'operator new' functions allocate memor...
Anton Yartsev [Thu, 28 Mar 2013 16:10:38 +0000 (16:10 +0000)]
[analyzer] For now assume all standard global 'operator new' functions allocate memory in heap.
+ Improved test coverage for cplusplus.NewDelete checker.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178244 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd support for gcc-compatible -mpopcntd -mno-popcntd PPC options
Hal Finkel [Thu, 28 Mar 2013 13:51:36 +0000 (13:51 +0000)]
Add support for gcc-compatible -mpopcntd -mno-popcntd PPC options

gcc provides -mpopcntd and -mno-popcntd for controlling the popcntd target
feature; support these options as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178235 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUpdating LibASTMatchersReference
Edwin Vane [Thu, 28 Mar 2013 13:50:22 +0000 (13:50 +0000)]
Updating LibASTMatchersReference

The generator for LibASTMatchersReference.html didn't get run last time
ASTMatchers changes were made. Here are up-to-date docs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178234 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[Mips] Handle pseudo-target flags '-EL' and '-EB' and properly adjust
Simon Atanasyan [Thu, 28 Mar 2013 11:36:22 +0000 (11:36 +0000)]
[Mips] Handle pseudo-target flags '-EL' and '-EB' and properly adjust
toolchain flags for MIPS targets.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178232 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd support for gcc-compatible -mmfcrf -mno-mfcrf PPC options
Hal Finkel [Thu, 28 Mar 2013 08:38:53 +0000 (08:38 +0000)]
Add support for gcc-compatible -mmfcrf -mno-mfcrf PPC options

gcc provides -mmfcrf and -mno-mfcrf for controlling what we call
the mfocrf target feature. Also, PPC is now making use of the
static function AddTargetFeature used by the Mips Driver code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178227 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDefine __SIZE_MAX__ preprocessor macro.
Evgeniy Stepanov [Thu, 28 Mar 2013 08:36:54 +0000 (08:36 +0000)]
Define __SIZE_MAX__ preprocessor macro.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178226 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFor -Wignored-qualifiers, don't warn on qualifiers which we acquire via a
Richard Smith [Thu, 28 Mar 2013 03:27:52 +0000 (03:27 +0000)]
For -Wignored-qualifiers, don't warn on qualifiers which we acquire via a
typedef. Also don't warn on the _Atomic type specifier, just on the _Atomic
type qualifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178218 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoTeach -Wigored-qualifiers about exotic flavors of declarator and the _Atomic type...
Richard Smith [Thu, 28 Mar 2013 02:51:21 +0000 (02:51 +0000)]
Teach -Wigored-qualifiers about exotic flavors of declarator and the _Atomic type qualifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178217 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRevert "Update debug info test for schema change made to LLVM."
David Blaikie [Thu, 28 Mar 2013 02:44:15 +0000 (02:44 +0000)]
Revert "Update debug info test for schema change made to LLVM."

This reverts commit 5035c483b7fcbf0fa2a7afba24fa35a10995d195.

This schema change wasn't necessary after all. I'm going ith a different
solution that will hopefully use space more conservatively.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178213 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRemove outdated FIXME.
Richard Smith [Thu, 28 Mar 2013 01:56:34 +0000 (01:56 +0000)]
Remove outdated FIXME.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178211 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoSupport C11 _Atomic type qualifier. This is more-or-less just syntactic sugar for...
Richard Smith [Thu, 28 Mar 2013 01:55:44 +0000 (01:55 +0000)]
Support C11 _Atomic type qualifier. This is more-or-less just syntactic sugar for the _Atomic type specifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178210 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFold together the two implementations of 6.7.3p2 in SemaType. Fix two bugs, each...
Richard Smith [Thu, 28 Mar 2013 00:03:10 +0000 (00:03 +0000)]
Fold together the two implementations of 6.7.3p2 in SemaType. Fix two bugs, each of which was only present in one version:
 * Give the right diagnostic for 'restrict' applied to a non-pointer, non-reference type.
 * Don't reject 'restrict' applied indirectly to an Objective-C object pointer type (eg, through template instantiation).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178200 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[Parser] Don't code-complete twice.
Argyrios Kyrtzidis [Wed, 27 Mar 2013 23:58:17 +0000 (23:58 +0000)]
[Parser] Don't code-complete twice.

When we are consuming the current token just to enter a new token stream, we push
the current token in the back of the stream so that we get it again.

Unfortunately this had the effect where if the current token is a code-completion one,
we would code-complete once during consuming it and another time after the stream ended.

Fix this by making sure that, in this case, ConsumeAnyToken() will consume a code-completion
token without invoking code-completion.

rdar://12842503

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178199 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDon't reject __restrict applied to a dependent type; it might instantiate to a pointe...
Richard Smith [Wed, 27 Mar 2013 23:36:39 +0000 (23:36 +0000)]
Don't reject __restrict applied to a dependent type; it might instantiate to a pointer or reference type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178198 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoSimplify test to use a count for the number of notes expected.
Bill Wendling [Wed, 27 Mar 2013 23:26:09 +0000 (23:26 +0000)]
Simplify test to use a count for the number of notes expected.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178196 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUBSan: Don't diagnose inf/nan conversions between floating-point types. It's far...
Richard Smith [Wed, 27 Mar 2013 23:20:25 +0000 (23:20 +0000)]
UBSan: Don't diagnose inf/nan conversions between floating-point types. It's far from clear whether these have undefined behavior, and these checks are helping no-one. Keep the double->float overflow warnings, though, since those are useful in practice, even though it's unclear whether such operations have defined behavior.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178194 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRemove unnecessary attributes from test case.
Chad Rosier [Wed, 27 Mar 2013 21:54:09 +0000 (21:54 +0000)]
Remove unnecessary attributes from test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178188 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd a front-end test case for r178186.
Chad Rosier [Wed, 27 Mar 2013 21:50:39 +0000 (21:50 +0000)]
Add a front-end test case for r178186.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178187 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFixes a typo in my last patch.
Fariborz Jahanian [Wed, 27 Mar 2013 21:33:52 +0000 (21:33 +0000)]
Fixes a typo in my last patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178184 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRevert "[lib/Headers] Define NULL as __DARWIN_NULL when on __APPLE__."
Argyrios Kyrtzidis [Wed, 27 Mar 2013 21:22:45 +0000 (21:22 +0000)]
Revert "[lib/Headers] Define NULL as __DARWIN_NULL when on __APPLE__."

Per feedback by Doug, we should avoid platform-specific implementations
in lib/Headers as much as possible.

This reverts commit r178110.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178181 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoObjective-C: Issue more precise warning when user
Fariborz Jahanian [Wed, 27 Mar 2013 21:19:25 +0000 (21:19 +0000)]
Objective-C: Issue more precise warning when user
is accessing 'isa' as an object pointer.
// rdar://13503456. FixIt to follow in another patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178179 91177308-0d34-0410-b5e6-96231b3b80d8