Commit Graph

36052 Commits

Author SHA1 Message Date
Sebastian Redl 1d197174a2 Add a testcase to show that temporaries from the initializer list are destroyed correctly.
llvm-svn: 150924
2012-02-19 12:27:51 +00:00
Sebastian Redl ca89d6841a Add a testcase for start+end implementations of std::initializer_list.
llvm-svn: 150923
2012-02-19 12:27:47 +00:00
Sebastian Redl 4f28b58b7b Fix a crash for nested initializer list initialization. Still does the wrong thing in CodeGen, in that it never destructs anything.
llvm-svn: 150922
2012-02-19 12:27:43 +00:00
Ahmed Charles 289896d2f3 Remove dead code.
llvm-svn: 150919
2012-02-19 11:57:29 +00:00
Rafael Espindola 322d2f4032 Don't check for /lib and /usr/lib.
llvm-svn: 150907
2012-02-19 02:43:03 +00:00
Rafael Espindola 1c4bd44052 Our handling of variables in FileCheck looks really broken on windws. Just
give up on matching the path prefix for the libraries.

llvm-svn: 150906
2012-02-19 02:33:09 +00:00
Rafael Espindola 8c53669a2d Add an extra CHECK line to make sure TOOLCHAIN2 matches just the path
prefix.

llvm-svn: 150905
2012-02-19 02:23:50 +00:00
Rafael Espindola 7c3e065573 Looks like we use forward slashes for header search but back slashes for
libraries on windows. Use two variables to make this test pass.

llvm-svn: 150903
2012-02-19 02:03:47 +00:00
Rafael Espindola c499573145 Try to match the linker being named ld.exe. Second try at fixing the windows bots.
llvm-svn: 150901
2012-02-19 01:52:23 +00:00
Rafael Espindola 70f2ad1afb Don't assume a path starts with a /. Should fix the windows bot.
llvm-svn: 150900
2012-02-19 01:47:01 +00:00
Rafael Espindola 1af7c219c7 Implement a -gcc-toolchain command line option that does the same as
configure's --with-gcc-toolchain. The configure option is now just a default
value for the command line one.

llvm-svn: 150898
2012-02-19 01:38:32 +00:00
Ted Kremenek 1c95ef4e94 Teach analyzer that blocks with no captures are globals. Fixes <rdar://problem/10348049>.
llvm-svn: 150896
2012-02-18 22:41:01 +00:00
Richard Smith 66c9699ac3 Implement constant expression support for __real__ and __imag__ on lvalue
complex numbers. Treat complex numbers as arrays of the corresponding component
type, in order to make std::complex behave properly if implemented in terms of
_Complex T.

Apparently libstdc++'s std::complex is implemented this way, and we were
rejecting a member like this:

  constexpr double real() { return __real__ val; }

because it was marked constexpr but unable to produce a constant expression.

llvm-svn: 150895
2012-02-18 22:04:06 +00:00
Ted Kremenek b0d37508d0 Fix crash in analyzer diagnostic generation involving subexpressions of OpaqueValueExpr not appearing in the ParentMap. Fixes <rdar://problem/10797980>.
llvm-svn: 150894
2012-02-18 22:02:57 +00:00
Ted Kremenek e8a5ba89ec Teach analyzer about NSAutoreleasePool -allocWithZone:. Fixes <rdar://problem/10640253>.
llvm-svn: 150892
2012-02-18 21:37:48 +00:00
Ted Kremenek 3d64453f9d Add analyzer test for using of C++ references with ObjC object pointers, reported in <rdar://problem/10569024>.
llvm-svn: 150891
2012-02-18 21:27:25 +00:00
Richard Smith 0b6b8e490c Fix wrong-code bug: __imag on a scalar lvalue should produce a zero rvalue,
rather than an lvalue referring to the scalar.

llvm-svn: 150889
2012-02-18 20:53:32 +00:00
Ted Kremenek e98d63a823 Adopt ExprEngine and checkers to ObjC property refactoring. Everything was working, but now diagnostics are aware of message expressions implied by uses of properties. Fixes <rdar://problem/9241180>.
llvm-svn: 150888
2012-02-18 20:53:30 +00:00
David Chisnall c616e95162 Default to not using __cxa_atexit on Solaris.
llvm-svn: 150883
2012-02-18 17:00:56 +00:00
David Chisnall cb5e468106 Remove a debugging line accidentally left in the last commit.
llvm-svn: 150882
2012-02-18 16:20:35 +00:00
David Chisnall 0867d9cfbc Implement #pragma redefine_extname.
This fixes PR5172 and allows clang to compile C++ programs on Solaris using the system headers.

llvm-svn: 150881
2012-02-18 16:12:34 +00:00
Dmitri Gribenko e72fa2c113 Add -Wstrncat-size and -Wempty-body to release notes.
llvm-svn: 150879
2012-02-18 14:13:26 +00:00
Benjamin Kramer 26538e8cc5 Remove unused but set variable.
llvm-svn: 150877
2012-02-18 11:35:28 +00:00
Douglas Gregor fdf598eaf3 Rewrite variable capture within lambda expressions and blocks,
eliminating a bunch of redundant code and properly modeling how the
captures of outside blocks/lambdas affect the types seen by inner
captures.

This new scheme makes two passes over the capturing scope stack. The
first pass goes up the stack (from innermost to outermost), assessing
whether the capture looks feasible and stopping when it either hits
the scope where the variable is declared or when it finds an existing
capture. The second pass then walks down the stack (from outermost to
innermost), capturing the variable at each step and updating the
captured type and the type that an expression referring to that
captured variable would see. It also checks type-specific
restrictions, such as the inability to capture an array within a
block. Note that only the first odr-use of each
variable needs to do the full walk; subsequent uses will find the
capture immediately, so multiple walks need not occur.

The same routine that builds the captures can also compute the type of
the captures without signaling errors and without actually performing
the capture. This functionality is used to determine the type of
declaration references as well as implementing the weird decltype((x))
rule within lambda expressions.

The capture code now explicitly takes sides in the debate over C++
core issue 1249, which concerns the type of captures within nested
lambdas. We opt to use the more permissive, more useful definition
implemented by GCC rather than the one implemented by EDG.

llvm-svn: 150875
2012-02-18 09:37:24 +00:00
Douglas Gregor 812d8f6387 Unify our computation of the type of a captured reference to a
variable; it was previously duplicated, and one of the copies failed
to account for outer non-mutable lambda captures.

llvm-svn: 150872
2012-02-18 05:51:20 +00:00
Richard Smith 0dea49e324 Fix a problem in the GCC testsuite, exposed by r150557. Compound literals
are represented as prvalues in C++; don't be fooled into thinking they're
global lvalues.

llvm-svn: 150870
2012-02-18 04:58:18 +00:00
Eli Friedman ff4b407009 Add a bunch of missing calls to DiagnoseSentinelCalls. <rdar://problem/10885993>.
This should probably be refactored... but it isn't completely obvious what refactoring is best.

llvm-svn: 150869
2012-02-18 04:48:30 +00:00
Ted Kremenek 084e1b48a1 Change wording of warning about using __bridge casts in non-ARC.
llvm-svn: 150868
2012-02-18 04:42:38 +00:00
Richard Smith eec915d686 Diagnose uses of deleted destructors and inaccessible defaulted destructors.
We had two separate issues here: firstly, varions functions were assuming that
they did not need to perform semantic checks on trivial destructors (this is
not true in C++11, where a trivial destructor can nonetheless be private or
deleted), and a bunch of DiagnoseUseOfDecl calls were missing for uses of
destructors.

llvm-svn: 150866
2012-02-18 04:13:32 +00:00
Richard Smith d951a1d9c8 Initial refactoring of 'ShouldDeleteSpecialMember', in preparation for providing
decent diagnostics. Finish the work of combining all the 'ShouldDelete'
functions into one. In unifying the code, fix a minor bug where an anonymous
union with a deleted default constructor as a member of a union wasn't being
considered as making the outer union's default constructor deleted.

llvm-svn: 150862
2012-02-18 02:02:13 +00:00
Chad Rosier 1d9cdb6c42 Fix comment.
llvm-svn: 150859
2012-02-18 01:20:35 +00:00
Eric Christopher 1c3785aae9 Add in a caching mechanism so that forward declarations are replaced
with full types if they exist.

rdar://10809898 and rdar://10209967 and rdar://10400981

llvm-svn: 150858
2012-02-18 00:50:17 +00:00
Eric Christopher 1a0c882a22 Formatting.
llvm-svn: 150857
2012-02-18 00:50:14 +00:00
Eric Christopher 71006f2378 Remove UpdateCompletedType from the debug info emission. We now
emit less than complete types on purpose on occasion and so
our caches aren't useful for this kind of lazy emitting.

llvm-svn: 150856
2012-02-18 00:50:08 +00:00
Chad Rosier f0cccf5bdb Remove redundant check.
llvm-svn: 150855
2012-02-18 00:37:07 +00:00
Ted Kremenek d519cae8aa Have conjured symbols depend on LocationContext, to add context sensitivity for functions called more than once.
llvm-svn: 150849
2012-02-17 23:13:45 +00:00
Anna Zaks 1fdedc99f2 [analyzer] Malloc Checker more tests.
llvm-svn: 150847
2012-02-17 22:35:34 +00:00
Anna Zaks e56167e8f8 [analyzer] Fix another false positive in the Malloc Checker, by making
it aware of CString APIs that return the input parameter.

Malloc Checker needs to know how the 'strcpy' function is
evaluated. Introduce the dependency on CStringChecker for that.
CStringChecker knows all about these APIs.

Addresses radar://10864450

llvm-svn: 150846
2012-02-17 22:35:31 +00:00
Anna Zaks 6348a810fe [analyzer] Generalize function name checking in CString checker.
(Ex: It was not treating __inline_strcpy as strcpy. Will add tests that
rely on this later on.)

llvm-svn: 150845
2012-02-17 22:35:26 +00:00
Fariborz Jahanian d268b0caba modern objc translator: postpone writing of class definitions
until the end when all their ivars are known then.

llvm-svn: 150844
2012-02-17 22:20:12 +00:00
Fariborz Jahanian 320c88afce modern objc writer: more work for category metadata rewrite
and some cleanup.

llvm-svn: 150839
2012-02-17 20:33:00 +00:00
Richard Smith 132bea96ad Don't emit optimization-specific intrinsic at -O0.
llvm-svn: 150838
2012-02-17 20:12:52 +00:00
Fariborz Jahanian f20550543f modern objc translator: category metadata related
patch.

llvm-svn: 150825
2012-02-17 18:40:41 +00:00
David Chisnall 0c1941cb05 On Solaris, define some standard macros that the Solaris headers require in
order to not be broken (by Solaris standards).

llvm-svn: 150822
2012-02-17 18:35:11 +00:00
Douglas Gregor 23b05417c9 De-nest tentative parsing to disambiguate lambdas from designators; no
functionality change.

llvm-svn: 150817
2012-02-17 16:41:16 +00:00
Sebastian Redl eb54f08aee Don't allow non-empty ParenListExprs as array-new initializers.
Don't know what I was thinking there. Fixes PR12023.

llvm-svn: 150804
2012-02-17 08:42:32 +00:00
Sebastian Redl c83ed8248e Basic code generation support for std::initializer_list.
We now generate temporary arrays to back std::initializer_list objects
initialized with braces. The initializer_list is then made to point at
the array. We support both ptr+size and start+end forms, although
the latter is untested.

Array lifetime is correct for temporary std::initializer_lists (e.g.
call arguments) and local variables. It is untested for new expressions
and member initializers.

Things left to do:
Massively increase the amount of testing. I need to write tests for
start+end init lists, temporary objects created as a side effect of
initializing init list objects, new expressions, member initialization,
creation of temporary objects (e.g. std::vector) for initializer lists,
and probably more.
Get lifetime "right" for member initializers and new expressions. Not
that either are very useful.
Implement list-initialization of array new expressions.

llvm-svn: 150803
2012-02-17 08:42:25 +00:00
Gregory Szorc dd19169988 [clang.py] Implement Type.element_count
llvm-svn: 150800
2012-02-17 07:47:38 +00:00
Gregory Szorc e1e9ec1082 [clang.py] Implement Type.element_type
llvm-svn: 150799
2012-02-17 07:44:46 +00:00
Richard Smith 08a5144621 The clang half of r150794: after the construction of a global or static const
variable ends, if the variable has a trivial destructor and no mutable
subobjects then emit an llvm.invariant.start call for it. globalopt knows to
make the variable const when evaluating this.

llvm-svn: 150798
2012-02-17 07:31:37 +00:00