Commit Graph

34368 Commits

Author SHA1 Message Date
Douglas Gregor ee78d3e020 If we can't write the temporary module map file when compiling a
module, at least have the decency to complain about it.

llvm-svn: 146002
2011-12-07 00:54:14 +00:00
Richard Smith 42d3af9d95 When folding the size of a global scope VLA to a constant, require the array
bound to not have side effects(!). Add constant-folding support for expressions
of void type, to ensure that we can still fold ((void)0, 1) as an array bound.

llvm-svn: 146000
2011-12-07 00:43:50 +00:00
Fariborz Jahanian 6bdeb14d5d objc: issue deprecated/unavailable diagnostic when
methods with these attributes are sent to receivers
of 'id' type too. // rdar://10459930

llvm-svn: 145999
2011-12-07 00:30:00 +00:00
Richard Smith 1e1f5abf77 DeadStoresChecker: when whitelisting dead initializations with constants, look
for a foldable constant rather than an IR-level constant. This is still far too
liberal, but is a step in the right direction.

llvm-svn: 145990
2011-12-06 23:25:15 +00:00
Anna Zaks 52fb9c08fc [analyzer] Add comments related to symbol_iterator
llvm-svn: 145987
2011-12-06 23:12:38 +00:00
Anna Zaks ee1a43533b [analyzer] Refactor: Move symbol_iterator from SVal to SymExpr, use it
for finding dependent symbols for taint.

llvm-svn: 145986
2011-12-06 23:12:33 +00:00
Anna Zaks c25efccc8b [analyzer] Propagate taint through NonLoc to NonLoc casts.
- Created a new SymExpr type - SymbolCast.
 - SymbolCast is created when we don't know how to simplify a NonLoc to
NonLoc casts.
 - A bit of code refactoring: introduced dispatchCast to have better
code reuse, remove a goto.
 - Updated the test case to showcase the new taint flow.

llvm-svn: 145985
2011-12-06 23:12:27 +00:00
Anna Zaks 8629c0a4d0 [analyzer] Remove an unnecessary check.
llvm-svn: 145984
2011-12-06 23:12:17 +00:00
Douglas Gregor 2f554c4c1b Add a FIXME to provide a sensible error message here
llvm-svn: 145983
2011-12-06 23:04:08 +00:00
Richard Smith 161f09abd7 Move vector bitcast handling in constant expressions from the expression
evaluator into constant initializer handling / IRGen. The practical consequence
of this is that the bitcast now lives in the constant's definition, rather than
in its uses.

The code in the constant expression evaluator was producing vectors of the wrong
type and size (and possibly of the wrong value for a big-endian int-to-vector
bitcast). We were getting away with this only because we don't yet support
constant-folding of any expressions which inspect vector values.

llvm-svn: 145981
2011-12-06 22:44:34 +00:00
Douglas Gregor 19f9f7bc6d Use absolute paths for temporary module map files
llvm-svn: 145973
2011-12-06 22:05:29 +00:00
Argyrios Kyrtzidis 66f433a746 [libclang] API enhancements by Joe Groff!
- Exposes a CXType_Vector type kind for vector types.
- Adds generalized versions of the clang_getArrayElementType and clang_getArraySize functions, named clang_getElementType and clang_getNumElements, which work on array, vector, or complex types.
- Adds additional functions for querying function types. clang_isFunctionTypeVariadic returns true if a function type is variadic. clang_getFunctionCallingConv returns an enumeration value indicating the calling convention of the function type. clang_getNumArgTypes returns the number of static argument types, and clang_getArgType gets the type of an argument.
- Adds a clang_getTypedefDeclUnderlyingType function to get the underlying type from a TypedefDecl cursor.
- Adds a clang_getEnumDeclIntegerType function to get the integer type from an EnumDecl cursor.
- Adds clang_getEnumConstantDeclValue and clang_getEnumConstantDeclUnsignedValue functions to get the value of an EnumConstantDecl as a signed or unsigned long long, respectively.
- Exposes a CXCursor_AsmLabelAttr cursor kind for __asm__("label") attributes.
- Alters clang_getCursorSpelling to return the label value for AsmLabelAttr-kind cursors.

llvm-svn: 145972
2011-12-06 22:05:01 +00:00
Douglas Gregor 158764bbe2 Rename Objective-C-only tests to .m
llvm-svn: 145959
2011-12-06 20:51:42 +00:00
Douglas Gregor d6343c99d6 Remove misleading error message
llvm-svn: 145958
2011-12-06 19:57:48 +00:00
Douglas Gregor e89dbc1d98 When inferring a module map for a framework, infer subframework
modules for each of its subframeworks.

llvm-svn: 145957
2011-12-06 19:39:29 +00:00
Benjamin Kramer 1594618c39 Remove unused member to appease valgrind.
llvm-svn: 145956
2011-12-06 19:26:57 +00:00
Kostya Serebryany 0b692ce7ca [asan] Mac: do not link dynamic libs with the asan-rt, use -undefined dynamic_lookup for dynamic libs. Style fixes. Patch by glider@google.com
llvm-svn: 145955
2011-12-06 19:18:44 +00:00
Douglas Gregor dd005f69f0 Allow inferred submodules for any (sub)module that has an umbrella header
llvm-svn: 145945
2011-12-06 17:34:58 +00:00
Douglas Gregor 356f3d4b53 When suggesting a module import for a #include or #import, suggest the
most specific (sub)module based on the actual file we find, rather
than always importing the top-level module. This means
that #include'ing <Foo/Blah.h> should give us the submodule Foo.Blah.

llvm-svn: 145942
2011-12-06 17:31:28 +00:00
Douglas Gregor f2161a70aa Implement modules support for subframeworks (aka embedded
frameworks). A submodule can now be labeled as a "framework", and
header search will look into the appropriate Headers/PrivateHeaders
subdirectories for named headers.

llvm-svn: 145941
2011-12-06 17:16:41 +00:00
Douglas Gregor e5626c4119 When building the main file to parse given a module map, don't skip
explicit submodules or umbrella headers from submodules. Instead,
build the entire module at once, and let the name-hiding mechanisms
hide the contents of explicit submodules at load time.

llvm-svn: 145940
2011-12-06 17:15:11 +00:00
Daniel Dunbar e946e361ab Headers: wmmintrin.h only needs xmmintrin.h.
- Fixes <rdar://problem/10261246> clang -maes option is not sufficient to
   include <wmmintrin.h>

llvm-svn: 145939
2011-12-06 16:17:54 +00:00
Douglas Gregor 930a85cc2d Minor tweak to prepare for submodules with umbrella headers. No actual
functionality change yet.

llvm-svn: 145938
2011-12-06 16:17:15 +00:00
Rafael Espindola 488ea473db Install cpuid.h when building with cmake too.
llvm-svn: 145935
2011-12-06 15:46:47 +00:00
Hans Wennborg 2fb8b91f6f Suggest typo corrections for implicit function declarations.
A mistyped function call becomes an inmplicit function declaration in C.
Suggest typo correction when one can be found.

llvm-svn: 145930
2011-12-06 09:46:12 +00:00
Erik Verbruggen c6c8d9356d Extend warnings for missing '@end'.
Fixes PR2709.

llvm-svn: 145928
2011-12-06 09:25:23 +00:00
Richard Trieu 5f623229ec Switch a cast to a dyn_cast and check the pointer before using. Fixes a crash
in the following code:

void test4(bool (&x)(void)) {
  while (x);
}

llvm-svn: 145918
2011-12-06 04:48:01 +00:00
Nick Lewycky 32275b9739 Fix test for unrelated changes.
llvm-svn: 145915
2011-12-06 03:46:28 +00:00
Nick Lewycky f4d3f7a0b9 Stack realignment is a tristate. Add -mno-stackrealign to turn off all stack
realignment, even with locals with alignment exceeding the ABI guarantee.

llvm-svn: 145909
2011-12-06 03:33:03 +00:00
Eli Friedman b8e45b28da Minor comment update.
llvm-svn: 145905
2011-12-06 03:08:26 +00:00
John McCall e5e1b88bbc Fix an extremely stupid bug causing terrible miscompilations
of &= on pseudo-objects.

llvm-svn: 145904
2011-12-06 02:56:18 +00:00
Douglas Gregor a89c5ac4a6 Implement inferred submodules support, which (when requested)
implicitly generates submodules corresponding to the headers that fall
within a module.

llvm-svn: 145887
2011-12-06 01:10:29 +00:00
Eli Friedman 7c6515a653 Make sure we perform lvalue-to-rvalue conversions for enum initializers. PR11484.
llvm-svn: 145874
2011-12-06 00:10:34 +00:00
Fariborz Jahanian 56f326e7f2 objc: put out more coherent warning when method definition
attributes don't match its declaration. // rdar://10529259.

llvm-svn: 145872
2011-12-06 00:02:41 +00:00
Joerg Sonnenberger db66ed0e4c Add -mstack-alignment=X and fix -mstackrealign handling now that the
backend options are gone.

llvm-svn: 145868
2011-12-05 23:05:23 +00:00
Fariborz Jahanian 7b1866930e More refactoring of objc rewriter.
llvm-svn: 145867
2011-12-05 22:59:54 +00:00
Douglas Gregor 734410916a Parse inferred submodules in module maps, track their contents in
Module, and (de-)serialize this information. Semantics of inferred
submodules to follow.

llvm-svn: 145864
2011-12-05 22:27:44 +00:00
Eli Friedman 6d694a38fd Make EmitAggregateCopy take an alignment argument. Make EmitFinalDestCopy pass in the correct alignment when known.
The test includes a FIXME for a related case involving calls; it's a bit more complicated to fix because the RValue class doesn't keep track of alignment.

<rdar://problem/10463337>
  

llvm-svn: 145862
2011-12-05 22:23:28 +00:00
Argyrios Kyrtzidis 1a10f29b2f [libclang] When indexing a field in a C++ class, return an entity
of kind CXIdxEntity_CXXInstanceVariable. rdar://10522503.

llvm-svn: 145859
2011-12-05 22:05:28 +00:00
Anna Zaks 02a1fc1da6 [analyzer] Rely on LLVM Dominators in Clang dominator computation.
(Previously, Clang used it's implementation of dominators.)

The patch is contributed by Guoping Long!

llvm-svn: 145858
2011-12-05 21:33:11 +00:00
Anna Zaks 5c10794254 [analyzer] Mark ConstraintManager::canReasonAbout as protected.
llvm-svn: 145857
2011-12-05 21:33:06 +00:00
Anna Zaks 2d2999821b [analyzer] Simplify the condition.
This is a fixup for r145832.

The extra clauses do not matter after we remove the dependency on canReasonAbout(InitVal) in r145832.

llvm-svn: 145856
2011-12-05 21:33:01 +00:00
Anna Zaks d624f60a89 [analyzer] Simplify the expected-warning statement.
llvm-svn: 145855
2011-12-05 21:32:58 +00:00
Lang Hames df5c121f8e Add a warning for implicit conversion from function literals (and static
methods) to bool. E.g.

void foo() {}
if (f) { ... // <- Warns here.
}

Only applies to non-weak functions, and does not apply if the function address
is taken explicitly with the addr-of operator.

llvm-svn: 145849
2011-12-05 20:49:50 +00:00
Lang Hames d42bb47782 Make isWeakDecl available as a method on ValueDecl.
llvm-svn: 145845
2011-12-05 20:16:26 +00:00
Fariborz Jahanian 8efef60f69 More objc rewriter refactoring.
llvm-svn: 145841
2011-12-05 19:50:04 +00:00
Anna Zaks 004695b56e [analyzer] Add a missing taint tester warning.
llvm-svn: 145834
2011-12-05 18:58:33 +00:00
Anna Zaks d066f79c80 [analyzer] Unify SymbolVal and SymExprVal under a single SymbolVal
class.

We are going into the direction of handling SymbolData and other SymExpr
uniformly, so it makes less sense to keep two different SVal classes.
For example, the checkers would have to take an extra step to reason
about each type separately.

The classes have the same members, we were just using the SVal kind
field for easy differentiation in 3 switch statements. The switch
statements look more ugly now, but we can make the code more readable in
other ways, for example, moving some code into separate functions.

llvm-svn: 145833
2011-12-05 18:58:30 +00:00
Anna Zaks a636fbe73f [analyzer] Remove all uses of ConstraintManager::canResonAbout() from
ExprEngine.

Teach SimpleConstraintManager::assumeSymRel() to propagate constraints
to symbolic expressions.

+ One extra warning (real bug) is now generated due to enhanced
assumeSymRel().

llvm-svn: 145832
2011-12-05 18:58:25 +00:00
Anna Zaks 51090d5f7f [analyzer] First step toward removing
ConstraintManager::canReasonAbout() from the ExprEngine.

ExprEngine should not care if the constraint solver can reason about
something or not. The solver should be able to handle all the SymExprs.

To do this, the solver should be able to keep track of not only the
SymbolData but of all SymExprs. This is why we change SymbolRef to be an
alias of SymExpr*. When encountering an expression it cannot simplify,
the solver should just add the constraints to it.

llvm-svn: 145831
2011-12-05 18:58:19 +00:00