Commit Graph

40245 Commits

Author SHA1 Message Date
Anna Zaks f6a5d793d2 [analyzer] Don't reimplement an existing function.
Thanks Jordan.

llvm-svn: 163762
2012-09-13 00:37:12 +00:00
Ted Kremenek edf22edca0 Teach -Wuninitialized to recognize common "noreturn" idioms in
Objective-C related to NSException.

Fixes <rdar://problem/12287498>

I debated whether or not this logic should be sunk into the CFG
itself.  It's not clear if we should, as different analyses may
wish to have different policies.  We can re-evaluate this in the
future.

llvm-svn: 163760
2012-09-13 00:21:35 +00:00
Ted Kremenek 8b3f938697 Refactor logic in ExprEngine for detecting 'noreturn' methods
in NSException to a helper object in libAnalysis that can also
be used by Sema.  Not sure if the predicate name 'isImplicitNoReturn'
is the best one, but we can massage that later.

No functionality change.

llvm-svn: 163759
2012-09-13 00:21:31 +00:00
Chad Rosier f83315fd4a Add a few FIXMEs.
llvm-svn: 163758
2012-09-13 00:20:37 +00:00
Chad Rosier b261a50b40 [ms-inline asm] Handle the enumeration of input and output expressions in a
more robust way to address a few FIXMEs.

The initial implementation, r163342, built the IR asm string and then tried to
patch things on the fly without enough context.  Specifically, it didn't skip
mnemonics nor did it track with assembly instruction an expression was related
to.  The new implementation patches the operands and then builds the final
IR string.

llvm-svn: 163756
2012-09-13 00:06:55 +00:00
Eric Christopher 31ce693f93 Reapply:
Make clang emit a flag for DW_AT_object_pointer for the artificial
    args where it should (implicit first arguments). FileCheck-ize a
    test as well and update tests to take into account the object
    pointer flag.

    rdar://9797999

llvm-svn: 163755
2012-09-12 23:36:49 +00:00
Richard Trieu a9fe99a174 Add two new functions to Qualifiers.
static Qualifiers removeCommonQualifiers(Qualifiers &L, Qualifiers &R)
Removes the common qualifiers from L and R and returns them in a new Qualifier.
This will be used in template diffing.

void removeQualifiers(Qualifiers Q)
Removes the qualifiers in Q from the current qualifier.
This replaces the current underlying implementation of operator- and
operator -= which only performed bit masking.

llvm-svn: 163752
2012-09-12 23:13:31 +00:00
Chad Rosier 24f3a14026 Whitespace.
llvm-svn: 163751
2012-09-12 23:03:48 +00:00
Anna Zaks 5d2964e770 [analyzer] Do not report use of undef on "return foo();" when the return type is void.
Fixes a false positive found by analyzing LLVM code base.

llvm-svn: 163750
2012-09-12 22:57:40 +00:00
Anna Zaks 75cfbb60a8 [analyzer] Fix another false positive in malloc realloc logic.
llvm-svn: 163749
2012-09-12 22:57:34 +00:00
Anna Zaks e663b80975 [analyzer] Teach UndefOrNullArgVisitor to track parent regions.
llvm-svn: 163748
2012-09-12 22:57:30 +00:00
Jordan Rose 5297748e3f [analyzer] Fix another use of the address of a temporary, like r163402.
Again, GCC is more aggressive about reusing temporary space than we are,
leading to Release build crashes for this undefined behavior.

PR13710 (though it may not be the only problem there)

llvm-svn: 163747
2012-09-12 22:48:08 +00:00
Jordan Rose 2010d437f9 [analyzer] Re-add reinterpret_cast virtual call test case from r163644.
We mostly just don't want to crash analyzing this test case; it's likely
the code found here will actually crash if compiled and run.

llvm-svn: 163746
2012-09-12 21:50:56 +00:00
Jordan Rose d44977ef64 [analyzer] Handle when the dynamic type is worse than the static type.
Currently we don't update the dynamic type of a C++ object when it is
cast. This can cause the situation above, where the static type of the
region is now known to be a subclass of the dynamic type.

Once we start updating DynamicTypeInfo in response to the various kinds
of casts in C++, we can re-add this assert to make sure we don't miss
any cases. This work is tracked by <rdar://problem/12287087>.

In -Asserts builds, we will simply not return any runtime definition
when our DynamicTypeInfo is known to be incorrect like this.

llvm-svn: 163745
2012-09-12 21:48:17 +00:00
Jordan Rose 99c6c2b4e2 Revert "[analyzer] Use the static type for a virtual call if the dynamic type is worse."
Using the static type may be inconsistent with later calls. We should just
report that there is no inlining definition available if the static type is
better than the dynamic type. See next commit.

This reverts r163644 / 19d5886d1704e24282c86217b09d5c6d35ba604d.

llvm-svn: 163744
2012-09-12 21:48:13 +00:00
Fariborz Jahanian 063df00cae objective-C++ test for my previous patch.
// rdar://12280826

llvm-svn: 163741
2012-09-12 21:27:26 +00:00
Daniel Jasper d6b82cba05 Rename isA to isSameOrDerivedFrom.
There are two evils we can choose from:
- Name overlap between isA-matcher and llvm::isa<>()
- Bad name for what the isA-matcher currently does

After some discussion we have agreed to go with the latter evil.

Review: http://llvm-reviews.chandlerc.com/D40
llvm-svn: 163740
2012-09-12 21:14:15 +00:00
Fariborz Jahanian 70b8bd8ad6 objective-C arc: don't issue no explicit ownership warning when
__autoreleasing is explicitely added to param type.
// rdar://12280826

llvm-svn: 163738
2012-09-12 20:34:47 +00:00
Chad Rosier e4e6424255 Fix test case for Release builds.
llvm-svn: 163737
2012-09-12 20:13:11 +00:00
Eric Christopher 48f782bbd2 Revert "Make clang emit a flag for DW_AT_object_pointer for the artificial"
this should be done on the subprogram, not the variable.

llvm-svn: 163733
2012-09-12 18:42:10 +00:00
Chad Rosier fb901cac60 [ms-inline asm] Add a test case.
llvm-svn: 163731
2012-09-12 18:34:34 +00:00
Chad Rosier bb8795e100 [ms-inline asm] Test case for r163729.
llvm-svn: 163730
2012-09-12 18:25:06 +00:00
Chad Rosier 57cd91f683 [ms-inline asm] If we have a single asm operand that maps to multiple
MCOperands then iterate over all of then when computing clobbers, inputs and
outputs.

On x86 the 1-to-many mapping is a memory operand that includes a BaseReg(reg),
MemScale(imm), MemIndexReg(reg), an Expr(MCExpr or imm) and a MemSegReg(reg).
Invalid register (Op.getReg() == 0) are not considered when computing clobber.

llvm-svn: 163728
2012-09-12 18:14:25 +00:00
Dmitri Gribenko 342cb7385c Comment parsing: recognize more Doxygen commands
llvm-svn: 163723
2012-09-12 17:02:40 +00:00
Dmitri Gribenko 00bcdd3192 Fix a couple of Doxygen issues pointed out by -Wdocumentation.
llvm-svn: 163722
2012-09-12 17:01:48 +00:00
Ted Kremenek 191ffd35a0 Revert "objective-C: warn under a flag if missing argument"
We plan on discussing this more, but we shouldn't have it in the compiler
in an incomplete state.

llvm-svn: 163720
2012-09-12 16:50:35 +00:00
Ted Kremenek 632a6432f5 Revert "objective-C: warn if selector has nothing but bare"
We plan on discussing this more.

llvm-svn: 163719
2012-09-12 16:50:30 +00:00
NAKAMURA Takumi cb0a08ac77 clang/test: [PR13820] Suppress LLP64-incompatible tests for ObjC with +Asserts.
llvm-svn: 163709
2012-09-12 14:26:42 +00:00
NAKAMURA Takumi bf05d8dd91 clang/test/CodeGen/2008-01-25-ZeroSizedAggregate.c: [PR8833] Add REQUIRES: LP64. It fails with +Asserts for Win64.
llvm-svn: 163708
2012-09-12 14:26:34 +00:00
Joerg Sonnenberger 85e2bbc3f8 Claim --param ssp-buffer-size, even if the stack protector is not
active.

llvm-svn: 163705
2012-09-12 13:51:14 +00:00
NAKAMURA Takumi f331aa9c00 clang/test/CodeGenObjC: [PR13820] Suppress LLP64-incompatible tests.
llvm-svn: 163701
2012-09-12 10:45:52 +00:00
NAKAMURA Takumi 6223834f1f clang/test/SemaCXX/dcl_ambig_res.cpp: [PR13819] It requires LP64 for now due to __SIZE_TYPE__.
llvm-svn: 163700
2012-09-12 10:45:46 +00:00
NAKAMURA Takumi fcd16e36c8 clang/test: [PR8833] Introduce the feature "LP64" to suppress LLP64-incompatible tests.
I think some of them could be rewritten to fit also LLP64.

llvm-svn: 163699
2012-09-12 10:45:40 +00:00
NAKAMURA Takumi efbb1ab92a clang/test/PCH/missing-file.cpp: Try to suppress accidental false on Windows.
%t.h might be touched by scanners as a hot file on Windows, to fail to remove %.h with single run.

llvm-svn: 163697
2012-09-12 10:38:08 +00:00
NAKAMURA Takumi 6bbc981d37 clang/test/lit.cfg: Fix a typo in comment.
llvm-svn: 163696
2012-09-12 10:38:03 +00:00
Evgeniy Stepanov ffeb6e0f77 Fix a test failure.
llvm-svn: 163691
2012-09-12 09:39:37 +00:00
Evgeniy Stepanov cac6aaab0d Make -faddress-sanitizer on Android link to the new-style runtime.
llvm-svn: 163689
2012-09-12 09:09:08 +00:00
Ted Kremenek 26774b15f6 Convert a few more getAs cases to castAs where we immediately call a member function.
llvm-svn: 163684
2012-09-12 06:50:29 +00:00
Ted Kremenek ba22a035ad Fix regression where "looping back to the head of" PathDiagnosticEvents
were not emitted.

Fixes <rdar://problem/12280665>.

llvm-svn: 163683
2012-09-12 06:22:18 +00:00
Ted Kremenek 7979ccf35a Teach -Wuninitialized to recognize __attribute__((analyzer_noreturn))
for halting the propagation of uninitialized value tracking along
a path.  Unlike __attribute__((noreturn)), this attribute (which
is used by clients of the static analyzer) can be used to annotate
functions that essentially never return, but in rare cares may be
allowed to return for (special) debugging purposes.  This attribute
has been shown in reducing false positives in the static analyzer
by pruning false postives, and is equally applicable here.

Handling this attribute in the CFG itself is another option, but
this is not something all clients (e.g., possibly -Wunreachable-code)
would want to see.

Addresses <rdar://problem/12281583>.

llvm-svn: 163681
2012-09-12 05:53:43 +00:00
Ted Kremenek b8cae9fddf Post new checker build.
llvm-svn: 163680
2012-09-12 05:11:29 +00:00
Chandler Carruth 66a34a6a45 Adjust some analyzer tests to place widely shared inputs inside of an
'Inputs' subdirectory.

The general desire has been to have essentially all of the non-test
input files live in such directories, with some exceptions for obvious
and common patterns like 'foo.c' using 'foo.h'.

This came up because our distributed test runner couldn't find some of
the headers, for example with stl.cpp.

No functionality changed, just shuffling around here.

llvm-svn: 163674
2012-09-12 01:11:10 +00:00
Chandler Carruth 575037f0de Fix up more "$t"s in this test that should be "%t"s.
llvm-svn: 163673
2012-09-12 01:11:05 +00:00
Richard Smith b15fe3a5e4 PR13811: Add a FunctionParmPackExpr node to handle references to function
parameter packs where the reference is not being expanded but the pack has
been. Previously, Clang would segfault in such cases.

llvm-svn: 163672
2012-09-12 00:56:43 +00:00
Eric Christopher 1d292e59d3 Make clang emit a flag for DW_AT_object_pointer for the artificial
args where it should (implicit first arguments). FileCheck-ize a
test as well and update tests to take into account the object
pointer flag.

rdar://9797999

llvm-svn: 163668
2012-09-12 00:27:32 +00:00
Chad Rosier a4f52e16a5 [ms-inline asm] isDef/NumDefs in this context only refer to register definitions, not memory definitions.
llvm-svn: 163666
2012-09-11 23:53:48 +00:00
Chad Rosier 911d50fe4e [ms-inline asm] As of r163657 this check is unnecessary.
llvm-svn: 163665
2012-09-11 23:48:00 +00:00
Chad Rosier ee94a2ebd5 [ms-inline asm] Don't consider tokens or immediates when computing clobbers, inputs and outputs.
llvm-svn: 163657
2012-09-11 23:13:15 +00:00
DeLesley Hutchins 138568b60a Thread-safety analysis: fix bug in expression matching code.
llvm-svn: 163656
2012-09-11 23:04:49 +00:00
Fariborz Jahanian 822ab6b2e4 objective-C: warn if selector has nothing but bare
':' in its name. // rdar://8366823

llvm-svn: 163650
2012-09-11 21:27:45 +00:00