Commit Graph

60174 Commits

Author SHA1 Message Date
Naomi Musgrave bf8f00586a Updating docs for MSan to describe poison-in-dtor.
Summary:
Describe the compile and runtime flags to enable MemorySanitizer
detection of use-after-destroy.

Reviewers: eugenis

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D12914

Revise doc description of use-after-dtor.

Change wording to specify memory no longer readable.

llvm-svn: 247871
2015-09-17 00:10:59 +00:00
NAKAMURA Takumi d1aa0681d7 analyzer-plugin/MainCallChecker.cpp: s/generateSink/generateErrorNode/, corresponding to r247859.
llvm-svn: 247862
2015-09-16 22:57:23 +00:00
Gabor Horvath 3ef9ef2227 [Static Analyzer] Generics Checker: When an ObjC method returns a specialized object, track it properly.
Differential Revision: http://reviews.llvm.org/D12889

llvm-svn: 247861
2015-09-16 22:44:36 +00:00
Devin Coughlin e39bd407ba [analyzer] Add generateErrorNode() APIs to CheckerContext.
The analyzer trims unnecessary nodes from the exploded graph before reporting
path diagnostics. However, in some cases it can trim all nodes (including the
error node), leading to an assertion failure (see
https://llvm.org/bugs/show_bug.cgi?id=24184).

This commit addresses the issue by adding two new APIs to CheckerContext to
explicitly create error nodes. Unless the client provides a custom tag, these
APIs tag the node with the checker's tag -- preventing it from being trimmed.
The generateErrorNode() method creates a sink error node, while
generateNonFatalErrorNode() creates an error node for a path that should
continue being explored.

The intent is that one of these two methods should be used whenever a checker
creates an error node.

This commit updates the checkers to use these APIs. These APIs
(unlike addTransition() and generateSink()) do not take an explicit Pred node.
This is because there are not any error nodes in the checkers that were created
with an explicit different than the default (the CheckerContext's Pred node).

It also changes generateSink() to require state and pred nodes (previously
these were optional) to reduce confusion.

Additionally, there were several cases where checkers did check whether a
generated node could be null; we now explicitly check for null in these places.

This commit also includes a test case written by Ying Yi as part of
http://reviews.llvm.org/D12163 (that patch originally addressed this issue but
was reverted because it introduced false positive regressions).

Differential Revision: http://reviews.llvm.org/D12780

llvm-svn: 247859
2015-09-16 22:03:05 +00:00
Reid Kleckner 8be1847b09 [WinEH] Fix a build issue in CGException.cpp
I was constructing an object without filling in all the fields.

llvm-svn: 247851
2015-09-16 21:06:09 +00:00
Reid Kleckner 10aa77032d [WinEH] Pass the catch adjectives to catchpad directly
This avoids building a fake LLVM IR global variable just to ferry an i32
down into LLVM codegen. It also puts a nail in the coffin of using MS
ABI C++ EH with landingpads, since now we'll assert in the lpad code
when flags are present.

llvm-svn: 247843
2015-09-16 20:15:55 +00:00
Argyrios Kyrtzidis 6d0a767685 [tooling] Add unit tests for change in r247468.
llvm-svn: 247832
2015-09-16 18:28:42 +00:00
Anton Yartsev c647a6df72 [analyzer] Improved behavior if Clang was not found, part II
- scan-build help: display 'Could not query Clang for the list of available checkers.' + the reason why it happened so if clang was not found.
- display requested/forced help in case of --use-analyzer=Xcode.

llvm-svn: 247828
2015-09-16 18:12:15 +00:00
Adhemerval Zanella 567b9260fa [sanitizers] Enable memory sanitizer on clang
This patch enables MSan for aarch64/linux

llvm-svn: 247808
2015-09-16 15:11:21 +00:00
NAKAMURA Takumi ee82b497f8 CGClass.cpp: Fix a warning in -Asserts. [-Wunused-private-field]
llvm-svn: 247778
2015-09-16 06:26:56 +00:00
Devin Coughlin f3695c87cd [analyzer] SATestBuild.py: Move additional checkers logic so SATestAdd.py can use it as well.
Move the logic looking for additional checkers in the SA_ADDITIONAL_CHECKERS
environmental variable from SATestBuild's main() to runScanBuild(). This allows
SATestAdd.py to use the variable as well. Without it, we won't include
additional checkers when building reference results for the build bot.

Differential Revision: http://reviews.llvm.org/D12891

llvm-svn: 247767
2015-09-16 01:52:32 +00:00
Richard Smith 938d701fad [modules] Fix a corner case in the macro override rules: properly handle overridden leaf module macros.
llvm-svn: 247765
2015-09-16 00:55:50 +00:00
Naomi Musgrave 703835c7f3 Implementation and testing for poisoning vtable
ptr in dtor.

Summary:
After destruction, invocation of virtual functions prevented
by poisoning vtable pointer.

Reviewers: eugenis, kcc

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D12712

Fixed testing callback emission order to account for vptr.
Poison vtable in either complete or base dtor, depending on
if virtual bases exist. If virtual bases exist, poison in
complete dtor. Otherwise, poison in base.
Remove commented-out block.

llvm-svn: 247762
2015-09-16 00:38:22 +00:00
NAKAMURA Takumi c9ca73336d clang/test/CodeGenCXX/exceptions-cxx-new.cpp: Don't assume the label "entry:".
Seems it would be redundant.

llvm-svn: 247761
2015-09-16 00:33:59 +00:00
Nico Weber 8d8fc3f1ca Remove accidental superfluous newline added in r247750.
llvm-svn: 247752
2015-09-15 23:51:08 +00:00
Nico Weber 4f11349028 clang-format: In Java, `assert` is followed by an expression.
Before: assert a&& b;
Now:    assert a && b;
llvm-svn: 247750
2015-09-15 23:48:17 +00:00
David Majnemer 778ac14dfb Try to appease the build bots
llvm-svn: 247743
2015-09-15 23:34:59 +00:00
David Majnemer 834c5128d8 [MS ABI] Add a C++ test for -fnew-ms-eh
llvm-svn: 247742
2015-09-15 23:30:42 +00:00
Nico Weber 9677562c8f Don't crash when passing &@selector to a _Nonnull parameter. Fixes PR24774.
The root cause here is that ObjCSelectorExpr is an rvalue, yet it can have its
address taken.  That's kind of awkward, but fixing this is awkward in other
ways, see https://llvm.org/bugs/show_bug.cgi?id=24774#c16 .  For now, just
fix the crash.

llvm-svn: 247740
2015-09-15 23:17:17 +00:00
Gabor Horvath 6864cbced6 [Static Analyzer] Added an XFAIL test for inlining when the type inference involves generic types.
llvm-svn: 247739
2015-09-15 23:14:01 +00:00
Piotr Padlewski 08bd7bf00c invariant.group-for-vptrs test fix
llvm-svn: 247733
2015-09-15 23:04:47 +00:00
Chris Bieneman ea7ecde87c [CMake] Add cache scripts for Apple-style clang builds.
Summary:
These CMake cache scripts are my first pass at replicating Apple's packaging logic from autoconf. They can be used on any Darwin machine to approximate an Apple Clang build.

The included README file includes documentation and a sample CMake invocation.

Reviewers: chandlerc, echristo

Subscribers: echristo, cfe-commits

Differential Revision: http://reviews.llvm.org/D12817

llvm-svn: 247726
2015-09-15 21:52:42 +00:00
Piotr Padlewski 4b1ac72cd4 Decorating vptr load & stores with !invariant.group
Adding !invariant.group to vptr load/stores for devirtualization purposes.
For more goto:
http://lists.llvm.org/pipermail/cfe-dev/2015-July/044227.html

http://reviews.llvm.org/D12026

llvm-svn: 247725
2015-09-15 21:46:55 +00:00
Piotr Padlewski 9d0ecf27a7 Added llvm.module flag for strict vtable pointers
It is dangerous to do LTO on code with strict-vtable-pointers, because
one module has invariant.group.barriers, and the other one not.

In the future I want to just strip all invariant.group metadata from
vptrs loads/stores and get rid of invariant.group.barrier calls.

http://reviews.llvm.org/D12580

llvm-svn: 247724
2015-09-15 21:46:50 +00:00
Piotr Padlewski 338c9d0ade Emiting llvm.invariant.group.barrier when dynamic type changes
For more goto:
http://lists.llvm.org/pipermail/cfe-dev/2015-July/044227.html

http://reviews.llvm.org/D12312

llvm-svn: 247723
2015-09-15 21:46:47 +00:00
Hans Wennborg 5869ec4c6c MS ABI: Don't allow dllexport/import on lambdas
This is to follow up on David's comment in
http://reviews.llvm.org/D12422#235509

llvm-svn: 247718
2015-09-15 21:05:30 +00:00
Nico Weber 3df1840cfc Add test coverage for @encode(SEL); completely untested until now.
llvm-svn: 247717
2015-09-15 20:05:20 +00:00
Kelvin Li 4eea8c6b82 Allow static local variables specified on data-sharing attribute clauses.
http://reviews.llvm.org/D11619

llvm-svn: 247715
2015-09-15 18:56:58 +00:00
Richard Smith ec4ad5ac9b [modules] Make sure we make hidden UsingShadowDecls visible to redeclaration
lookup for the UsingShadowDecls themselves.

llvm-svn: 247714
2015-09-15 18:51:56 +00:00
Nico Weber cfb6f45168 Rebase tests after LLVM r247707.
llvm-svn: 247712
2015-09-15 18:49:51 +00:00
Alexey Bataev ecb156aba2 [OPENMP] Emit an additional note during analysis of 'if' clause.
Patch adds emission of additional note for 'if' clauses with name modifiers in case if 'if' clause without name modified was specified or 'if' clause with the same name modifier was specified.

llvm-svn: 247706
2015-09-15 17:23:56 +00:00
Daniel Sanders 50f17235dd Revert r247692: Replace Triple with a new TargetTuple in MCTargetDesc/* and related. NFC.
Eric has replied and has demanded the patch be reverted.

llvm-svn: 247702
2015-09-15 16:17:27 +00:00
Yury Gribov daace1bb6b Mention that libcxx is required to build Compiler-RT tests on OS X.
llvm-svn: 247696
2015-09-15 15:05:47 +00:00
Aaron Ballman 02c6abc5dc Silencing a -Wreturn-type warning; NFC.
llvm-svn: 247693
2015-09-15 14:11:32 +00:00
Daniel Sanders 153010c52d Re-commit r247683: Replace Triple with a new TargetTuple in MCTargetDesc/* and related. NFC.
Summary:
This is the first patch in the series to migrate Triple's (which are ambiguous)
to TargetTuple's (which aren't).

For the moment, TargetTuple simply passes all requests to the Triple object it
holds. Once it has replaced Triple, it will start to implement the interface in
a more suitable way.

This change makes some changes to the public C++ API. In particular,
InitMCSubtargetInfo(), createMCRelocationInfo(), and createMCSymbolizer()
now take TargetTuples instead of Triples. The other public C++ API's have
been left as-is for the moment to reduce patch size.

This commit also contains a trivial patch to clang to account for the C++ API
change. Thanks go to Pavel Labath for fixing LLDB for me.

Reviewers: rengolin

Subscribers: jyknight, dschuff, arsenm, rampitec, danalbert, srhines, javed.absar, dsanders, echristo, emaste, jholewinski, tberghammer, ted, jfb, llvm-commits, rengolin

Differential Revision: http://reviews.llvm.org/D10969

llvm-svn: 247692
2015-09-15 14:08:28 +00:00
Daniel Sanders c40de48041 Revert r247684 - Replace Triple with a new TargetTuple ...
LLDB needs to be updated in the same commit.

llvm-svn: 247686
2015-09-15 13:46:21 +00:00
Daniel Sanders 18d4b0dab7 Replace Triple with a new TargetTuple in MCTargetDesc/* and related. NFC.
Summary:
This is the first patch in the series to migrate Triple's (which are ambiguous)
to TargetTuple's (which aren't).

For the moment, TargetTuple simply passes all requests to the Triple object it
holds. Once it has replaced Triple, it will start to implement the interface in
a more suitable way.

This change makes some changes to the public C++ API. In particular,
InitMCSubtargetInfo(), createMCRelocationInfo(), and createMCSymbolizer()
now take TargetTuples instead of Triples. The other public C++ API's have
been left as-is for the moment to reduce patch size.

This commit also contains a trivial patch to clang to account for the C++ API
change.

Reviewers: rengolin

Subscribers: jyknight, dschuff, arsenm, rampitec, danalbert, srhines, javed.absar, dsanders, echristo, emaste, jholewinski, tberghammer, ted, jfb, llvm-commits, rengolin

Differential Revision: http://reviews.llvm.org/D10969

llvm-svn: 247683
2015-09-15 13:17:40 +00:00
Alexey Bataev 25e5b44654 [OPENMP] Emit __kmpc_cancel_barrier() and code for 'cancellation point' only if 'cancel' is found.
Patch improves codegen for OpenMP constructs. If the OpenMP region does not have internal 'cancel' construct, a call to 'void __kmpc_barrier()' runtime function is generated for all implicit/explicit barriers. If the region has inner 'cancel' directive, then
```
if (__kmpc_cancel_barrier())
  exit from outer construct;
```
code is generated.
Also, the code for 'canellation point' directive is not generated if parent directive does not have 'cancel' directive.

llvm-svn: 247681
2015-09-15 12:52:43 +00:00
Alexey Bader bdf7c846f9 Run clang-format to unify the switch statement style as suggest here: http://reviews.llvm.org/D12855#246073.
NFC.

llvm-svn: 247678
2015-09-15 12:18:29 +00:00
Alexey Bader 9c8453fb4b [OpenCL] Add new types for OpenCL 2.0.
Patch by Pedro Ferreira.
Reviewers: pekka.jaaskelainen
Differential Revision: http://reviews.llvm.org/D12855

llvm-svn: 247676
2015-09-15 11:18:52 +00:00
Ismail Donmez a8d3a2e9a1 Doxygen fix InitializeBuiltins -> initializeBuiltins
llvm-svn: 247668
2015-09-15 09:53:14 +00:00
NAKAMURA Takumi f9c52dc3e7 Make clang/test/CodeGen/catch-undef-behavior.c* capable of -Asserts with "opt -instnamer".
It reverts r231717.

llvm-svn: 247667
2015-09-15 09:50:24 +00:00
Devin Coughlin 676a58c9b2 [analyzer] Restore behavior change introduced by r247657.
r247657 fixed warnings about unused variables when compiling without asserts
but changed behavior. This commit restores the old behavior but still suppresses
the warnings.

llvm-svn: 247660
2015-09-15 03:28:27 +00:00
David Majnemer 1cbe80408d [MS ABI] Restore our warning for overwide bitfields using the MS ABI
This restores a diagnostic lost in r247651.

llvm-svn: 247659
2015-09-15 02:36:41 +00:00
NAKAMURA Takumi f14c2508e4 ExprEngineObjC.cpp: Fix warnings. [-Wunused-variable]
llvm-svn: 247657
2015-09-15 01:53:27 +00:00
NAKAMURA Takumi e9621040e5 ItaniumCXXABI.cpp: Fix a warning. [-Wunused-variable]
llvm-svn: 247655
2015-09-15 01:39:27 +00:00
Richard Smith f091e129db [modules] A using-declaration doesn't introduce a new entity, just a new name
for an existing entity, and as such a using-declaration doesn't need to
conflict with a hidden entity (nor vice versa).

llvm-svn: 247654
2015-09-15 01:28:55 +00:00
Devin Coughlin ca5ab2b0d4 [analyzer] Skip Pre/Post handlers for ObjC calls when receiver is nil.
In Objective-C, method calls with nil receivers are essentially no-ops. They
do not fault (although the returned value may be garbage depending on the
declared return type and architecture). Programmers are aware of this
behavior and will complain about a false alarm when the analyzer
diagnoses API violations for method calls when the receiver is known to
be nil.

Rather than require each individual checker to be aware of this behavior
and suppress a warning when the receiver is nil, this commit
changes ExprEngineObjC so that VisitObjCMessage skips calling checker
pre/post handlers when the receiver is definitely nil. Instead, it adds a
new event, ObjCMessageNil, that is only called in that case.

The CallAndMessageChecker explicitly cares about this case, so I've changed it
to add a callback for ObjCMessageNil and moved the logic in PreObjCMessage
that handles nil receivers to the new callback.

rdar://problem/18092611

Differential Revision: http://reviews.llvm.org/D12123

llvm-svn: 247653
2015-09-15 01:13:53 +00:00
David Majnemer d558aa8627 [MS ABI] Overwide bool bitfields should be permitted
Overwide bool bitfields have eight bits of storage size, make sure we
take the padding into account when determining whether or not they are
problematic.

llvm-svn: 247651
2015-09-15 01:00:55 +00:00
Piotr Padlewski d128fff5df small test bugfix
llvm-svn: 247650
2015-09-15 00:55:29 +00:00