]> granicus.if.org Git - clang/log
clang
12 years agoUnify our computation of the type of a captured reference to a
Douglas Gregor [Sat, 18 Feb 2012 05:51:20 +0000 (05:51 +0000)]
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.

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

12 years agoFix a problem in the GCC testsuite, exposed by r150557. Compound literals
Richard Smith [Sat, 18 Feb 2012 04:58:18 +0000 (04:58 +0000)]
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.

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

12 years agoAdd a bunch of missing calls to DiagnoseSentinelCalls. <rdar://problem/10885993>.
Eli Friedman [Sat, 18 Feb 2012 04:48:30 +0000 (04:48 +0000)]
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.

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

12 years agoChange wording of warning about using __bridge casts in non-ARC.
Ted Kremenek [Sat, 18 Feb 2012 04:42:38 +0000 (04:42 +0000)]
Change wording of warning about using __bridge casts in non-ARC.

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

12 years agoDiagnose uses of deleted destructors and inaccessible defaulted destructors.
Richard Smith [Sat, 18 Feb 2012 04:13:32 +0000 (04:13 +0000)]
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.

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

12 years agoInitial refactoring of 'ShouldDeleteSpecialMember', in preparation for providing
Richard Smith [Sat, 18 Feb 2012 02:02:13 +0000 (02:02 +0000)]
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.

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

12 years agoFix comment.
Chad Rosier [Sat, 18 Feb 2012 01:20:35 +0000 (01:20 +0000)]
Fix comment.

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

12 years agoAdd in a caching mechanism so that forward declarations are replaced
Eric Christopher [Sat, 18 Feb 2012 00:50:17 +0000 (00:50 +0000)]
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

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

12 years agoFormatting.
Eric Christopher [Sat, 18 Feb 2012 00:50:14 +0000 (00:50 +0000)]
Formatting.

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

12 years agoRemove UpdateCompletedType from the debug info emission. We now
Eric Christopher [Sat, 18 Feb 2012 00:50:08 +0000 (00:50 +0000)]
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.

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

12 years agoRemove redundant check.
Chad Rosier [Sat, 18 Feb 2012 00:37:07 +0000 (00:37 +0000)]
Remove redundant check.

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

12 years agoHave conjured symbols depend on LocationContext, to add context sensitivity for funct...
Ted Kremenek [Fri, 17 Feb 2012 23:13:45 +0000 (23:13 +0000)]
Have conjured symbols depend on LocationContext, to add context sensitivity for functions called more than once.

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

12 years ago[analyzer] Malloc Checker more tests.
Anna Zaks [Fri, 17 Feb 2012 22:35:34 +0000 (22:35 +0000)]
[analyzer] Malloc Checker more tests.

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

12 years ago[analyzer] Fix another false positive in the Malloc Checker, by making
Anna Zaks [Fri, 17 Feb 2012 22:35:31 +0000 (22:35 +0000)]
[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

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

12 years ago[analyzer] Generalize function name checking in CString checker.
Anna Zaks [Fri, 17 Feb 2012 22:35:26 +0000 (22:35 +0000)]
[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.)

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

12 years agomodern objc translator: postpone writing of class definitions
Fariborz Jahanian [Fri, 17 Feb 2012 22:20:12 +0000 (22:20 +0000)]
modern objc translator: postpone writing of class definitions
until the end when all their ivars are known then.

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

12 years agomodern objc writer: more work for category metadata rewrite
Fariborz Jahanian [Fri, 17 Feb 2012 20:33:00 +0000 (20:33 +0000)]
modern objc writer: more work for category metadata rewrite
and some cleanup.

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

12 years agoDon't emit optimization-specific intrinsic at -O0.
Richard Smith [Fri, 17 Feb 2012 20:12:52 +0000 (20:12 +0000)]
Don't emit optimization-specific intrinsic at -O0.

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

12 years agomodern objc translator: category metadata related
Fariborz Jahanian [Fri, 17 Feb 2012 18:40:41 +0000 (18:40 +0000)]
modern objc translator: category metadata related
patch.

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

12 years agoOn Solaris, define some standard macros that the Solaris headers require in
David Chisnall [Fri, 17 Feb 2012 18:35:11 +0000 (18:35 +0000)]
On Solaris, define some standard macros that the Solaris headers require in
order to not be broken (by Solaris standards).

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

12 years agoDe-nest tentative parsing to disambiguate lambdas from designators; no
Douglas Gregor [Fri, 17 Feb 2012 16:41:16 +0000 (16:41 +0000)]
De-nest tentative parsing to disambiguate lambdas from designators; no
functionality change.

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

12 years agoDon't allow non-empty ParenListExprs as array-new initializers.
Sebastian Redl [Fri, 17 Feb 2012 08:42:32 +0000 (08:42 +0000)]
Don't allow non-empty ParenListExprs as array-new initializers.

Don't know what I was thinking there. Fixes PR12023.

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

12 years agoBasic code generation support for std::initializer_list.
Sebastian Redl [Fri, 17 Feb 2012 08:42:25 +0000 (08:42 +0000)]
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.

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

12 years ago[clang.py] Implement Type.element_count
Gregory Szorc [Fri, 17 Feb 2012 07:47:38 +0000 (07:47 +0000)]
[clang.py] Implement Type.element_count

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

12 years ago[clang.py] Implement Type.element_type
Gregory Szorc [Fri, 17 Feb 2012 07:44:46 +0000 (07:44 +0000)]
[clang.py] Implement Type.element_type

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

12 years agoThe clang half of r150794: after the construction of a global or static const
Richard Smith [Fri, 17 Feb 2012 07:31:37 +0000 (07:31 +0000)]
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.

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

12 years agoIndex "12" holds the vtable, not "9".
Eric Christopher [Fri, 17 Feb 2012 07:09:48 +0000 (07:09 +0000)]
Index "12" holds the vtable, not "9".

Fixes lots of gdb testsuite failures.

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

12 years agoBug fix: do not emit static const local variables with mutable members
Richard Smith [Fri, 17 Feb 2012 06:48:11 +0000 (06:48 +0000)]
Bug fix: do not emit static const local variables with mutable members
as constants.

Refactor and simplify all the separate checks for whether a type can be
emitted as a constant.

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

12 years agoWhen performing IRGen on a global, emit it as a constant if:
Richard Smith [Fri, 17 Feb 2012 04:54:50 +0000 (04:54 +0000)]
When performing IRGen on a global, emit it as a constant if:
 1) It has a const-qualified type, and
 2) It has no mutable members, and
 3) It has no dynamic initialization, and
 4) It has trivial destruction.
Remove the unnecessary requirement that the type be POD. This allows us to
mark all constexpr objects with no mutable members as 'constant'.

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

12 years agoOnly add 'const' to the type of variables captured in a lambda when
Douglas Gregor [Fri, 17 Feb 2012 04:02:59 +0000 (04:02 +0000)]
Only add 'const' to the type of variables captured in a lambda when
we're capturing it by value in a non-mutable lambda.

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

12 years agoDisambiguate between C++11 lambda expressions and C99 array
Douglas Gregor [Fri, 17 Feb 2012 03:49:44 +0000 (03:49 +0000)]
Disambiguate between C++11 lambda expressions and C99 array
designators in the parser. In the worst case, this disambiguation
requires tentative parsing just past the closing ']', but for most
cases we'll be able to tell by looking ahead just one token (without
going into the heavyweight tentative parsing machinery).

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

12 years agoMake sure all remaining parts of the constant evaluator are aware that an array
Richard Smith [Fri, 17 Feb 2012 03:35:37 +0000 (03:35 +0000)]
Make sure all remaining parts of the constant evaluator are aware that an array
can be represented by an LValue, and use that to simplify the code a little.

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

12 years agoWhether an argument is required (in contrast with being an
John McCall [Fri, 17 Feb 2012 03:33:10 +0000 (03:33 +0000)]
Whether an argument is required (in contrast with being an
optional argument passed through the variadic ellipsis)
potentially affects how we need to lower it.  Propagate
this information down to the various getFunctionInfo(...)
overloads on CodeGenTypes.  Furthermore, rename those
overloads to clarify their distinct purposes, and make
sure we're calling the right one in the right place.
This has a nice side-effect of making it easier to construct
a function type, since the 'variadic' bit is no longer
separable.

This shouldn't really change anything for our existing
platforms, with one minor exception --- we should now call
variadic ObjC methods with the ... in the "right place"
(see the test case), which I guess matters for anyone
running GNUStep on MIPS.  Mostly it's just a substantial
clean-up.

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

12 years agoBlock expressions always have a prototyped function type; expose this
John McCall [Fri, 17 Feb 2012 03:32:35 +0000 (03:32 +0000)]
Block expressions always have a prototyped function type; expose this
in the AST accessor and micro-optimize it very slightly.

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

12 years agoAdd a castAs<U> accessor to CanQual<T>.
John McCall [Fri, 17 Feb 2012 03:32:17 +0000 (03:32 +0000)]
Add a castAs<U> accessor to CanQual<T>.

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

12 years agoRework the Sema/AST/IRgen dance for the lambda closure type's
Douglas Gregor [Fri, 17 Feb 2012 03:02:34 +0000 (03:02 +0000)]
Rework the Sema/AST/IRgen dance for the lambda closure type's
conversion to function pointer. Rather than having IRgen synthesize
the body of this function, we instead introduce a static member
function "__invoke" with the same signature as the lambda's
operator() in the AST. Sema then generates a body for the conversion
to function pointer which simply returns the address of __invoke. This
approach makes it easier to evaluate a call to the conversion function
as a constant, makes the linkage of the __invoke function follow the
normal rules for member functions, and may make life easier down the
road if we ever want to constexpr'ify some of lambdas.

Note that IR generation is responsible for filling in the body of
__invoke (Sema just adds a dummy body), because the body can't
generally be expressed in C++.

Eli, please review!

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

12 years agoTests for the fixits which Doug added in r150727.
Richard Smith [Fri, 17 Feb 2012 01:39:04 +0000 (01:39 +0000)]
Tests for the fixits which Doug added in r150727.

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

12 years agoReject continue/break statements within members of local functions nested within
Richard Smith [Fri, 17 Feb 2012 01:35:32 +0000 (01:35 +0000)]
Reject continue/break statements within members of local functions nested within
loop and switch statements, by teaching Scope that a function scope never has
a continue/break parent for the purposes of control flow. Remove the hack in
block and lambda expressions which worked around this by pretending that such
expressions were continue/break scopes.

Remove Scope::ControlParent, since it's unused.

In passing, teach default statements to recover properly from a missing ';', and
add a fixit for same to both default and case labels (the latter already
recovered correctly).

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

12 years agoPR12012: Fix a regression in r150419 where we would try (and fail) to
Richard Smith [Fri, 17 Feb 2012 00:44:16 +0000 (00:44 +0000)]
PR12012: Fix a regression in r150419 where we would try (and fail) to
zero-initialize class types with virtual bases when constant-evaluating an
initializer.

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

12 years agoobjective-c translator. More stuff for modern meta-data.
Fariborz Jahanian [Fri, 17 Feb 2012 00:06:14 +0000 (00:06 +0000)]
objective-c translator. More stuff for modern meta-data.

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

12 years agoReapply r150631:
Eric Christopher [Thu, 16 Feb 2012 22:54:45 +0000 (22:54 +0000)]
Reapply r150631:

    "Add a completed/incomplete type difference. This allows us to have
    partial types for contexts and forward decls while allowing us to
    complete types later on for debug purposes.

    This piggy-backs on the metadata replacement and rauw changes
    for temporary nodes and takes advantage of the incremental
    support I added in earlier. This allows us to, if we decide,
    to limit adding methods and variables to structures in order
    to limit the amount of debug information output into a .o file.

    The caching is a bit complicated though so any thoughts on
    untangling that are welcome."

with a fix:

 - Remove all RAUW during type construction by adding stub versions
   of types that we later complete.

and some TODOs:

 - Add an RAUW cache for forward declared types so that we can replace
   them at the end of compilation.
 - Remove the code that updates on completed types because we no
   longer need to have that happen. We emit incomplete types on
   purpose and only want to know when we want to complete them.

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

12 years agoElide copy construction in new expressions. PR11757.
Eli Friedman [Thu, 16 Feb 2012 22:45:48 +0000 (22:45 +0000)]
Elide copy construction in new expressions.  PR11757.

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

12 years agoAvoid infinite mutual recursion in DiagnoseInvalidRedeclaration.
Kaelyn Uhrain [Thu, 16 Feb 2012 22:40:59 +0000 (22:40 +0000)]
Avoid infinite mutual recursion in DiagnoseInvalidRedeclaration.

Don't try to typo-correct a method redeclaration to declarations not in
the current record as it could lead to infinite recursion if CorrectTypo
finds more than one correction candidate in a parent record.

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

12 years ago[analyzer] MallocChecker: more tests.
Anna Zaks [Thu, 16 Feb 2012 22:26:15 +0000 (22:26 +0000)]
[analyzer] MallocChecker: more tests.

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

12 years ago[analyzer] Malloc Checker: Clean up bug naming:
Anna Zaks [Thu, 16 Feb 2012 22:26:12 +0000 (22:26 +0000)]
[analyzer] Malloc Checker: Clean up bug naming:
 - Rename the category "Logic Error" -> "Memory Error".
 - Shorten all the messages.

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

12 years ago[analyzer] Malloc Checker: Make the diagnostic visitor handle the case
Anna Zaks [Thu, 16 Feb 2012 22:26:07 +0000 (22:26 +0000)]
[analyzer] Malloc Checker: Make the diagnostic visitor handle the case
of failing realloc. + Minor cleanups.

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

12 years agoPacify gcc's -Wreturn-type
Matt Beaumont-Gay [Thu, 16 Feb 2012 22:15:50 +0000 (22:15 +0000)]
Pacify gcc's -Wreturn-type

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

12 years agofix the property list metadata name.
Fariborz Jahanian [Thu, 16 Feb 2012 21:57:59 +0000 (21:57 +0000)]
fix the property list metadata name.

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

12 years agoImprove recovery for lambda expressions that have 'mutable' or a
Douglas Gregor [Thu, 16 Feb 2012 21:53:36 +0000 (21:53 +0000)]
Improve recovery for lambda expressions that have 'mutable' or a
trailing return type but not a '()'. Recover by inserting the
parentheses. Thanks to Xeo on IRC for the example.

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

12 years agomodern objective-c translator: write the root class meta-data.
Fariborz Jahanian [Thu, 16 Feb 2012 21:37:05 +0000 (21:37 +0000)]
modern objective-c translator: write the root class meta-data.

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

12 years agoLambda closure types are always considered to be like "local" classes,
Douglas Gregor [Thu, 16 Feb 2012 21:36:18 +0000 (21:36 +0000)]
Lambda closure types are always considered to be like "local" classes,
even if they are not within a function scope. Teach template
instantiation to treat them as such, and make sure that we have a
local instantiation scope when instantiating default arguments and
static data members.

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

12 years agoMake sure we still reject static data members in anonymous unions in C++11.
Richard Smith [Thu, 16 Feb 2012 21:23:54 +0000 (21:23 +0000)]
Make sure we still reject static data members in anonymous unions in C++11.

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

12 years agoAdd checker visitation hooks in ExprEngine::Visit() for common no-op expressions...
Ted Kremenek [Thu, 16 Feb 2012 20:56:01 +0000 (20:56 +0000)]
Add checker visitation hooks in ExprEngine::Visit() for common no-op expressions.  To be used later.

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

12 years agoRevert "Move ExplodedNode reclaimation out of ExprEngine and into CoreEngine. Also...
Ted Kremenek [Thu, 16 Feb 2012 20:48:04 +0000 (20:48 +0000)]
Revert "Move ExplodedNode reclaimation out of ExprEngine and into CoreEngine.  Also have it based on adding predecessors/successors, not node allocation.  No measurable performance change."

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

12 years agoC++11 allows unions to have static data members. Remove the corresponding
Richard Smith [Thu, 16 Feb 2012 20:41:22 +0000 (20:41 +0000)]
C++11 allows unions to have static data members. Remove the corresponding
restriction and add some tests.

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

12 years agoMove ExplodedNode reclaimation out of ExprEngine and into CoreEngine. Also have...
Ted Kremenek [Thu, 16 Feb 2012 20:19:30 +0000 (20:19 +0000)]
Move ExplodedNode reclaimation out of ExprEngine and into CoreEngine.  Also have it based on adding predecessors/successors, not node allocation.  No measurable performance change.

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

12 years agoMinor cleanup to node data structures in ExplodedGraph. No functionality change.
Ted Kremenek [Thu, 16 Feb 2012 20:19:25 +0000 (20:19 +0000)]
Minor cleanup to node data structures in ExplodedGraph.  No functionality change.

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

12 years agoTweak the comment on the 'q' length modifier again.
Hans Wennborg [Thu, 16 Feb 2012 18:58:32 +0000 (18:58 +0000)]
Tweak the comment on the 'q' length modifier again.

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

12 years agomodern objc translator: meta-data generation for first
Fariborz Jahanian [Thu, 16 Feb 2012 18:54:09 +0000 (18:54 +0000)]
modern objc translator: meta-data generation for first
part of class meta-data.

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

12 years agoFix this test to work with and without Asserts mode.
Dan Gohman [Thu, 16 Feb 2012 18:51:05 +0000 (18:51 +0000)]
Fix this test to work with and without Asserts mode.

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

12 years agoUpdate comment as per Joerg's comment on r150697.
Hans Wennborg [Thu, 16 Feb 2012 18:19:51 +0000 (18:19 +0000)]
Update comment as per Joerg's comment on r150697.

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

12 years agoIn Objective-C++, allow the keyword 'class' to be used as a property
Douglas Gregor [Thu, 16 Feb 2012 18:19:22 +0000 (18:19 +0000)]
In Objective-C++, allow the keyword 'class' to be used as a property
name for dot syntax, e.g., NSObject.class or foo.class. For other
C++-keywords-as-method-names, use message send syntax. Fixes
<rdar://problem/10794452>.

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

12 years agoIf code completion patterns are not enabled, use simpler else/else if
Douglas Gregor [Thu, 16 Feb 2012 17:49:04 +0000 (17:49 +0000)]
If code completion patterns are not enabled, use simpler else/else if
completions that don't insert braces. Fixes <rdar://problem/10764168>.

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

12 years agoAdd fixits for ARC casting errors for implicit conversions as well. rdar://10289283
Argyrios Kyrtzidis [Thu, 16 Feb 2012 17:31:07 +0000 (17:31 +0000)]
Add fixits for ARC casting errors for implicit conversions as well. rdar://10289283

Also fix the fixit (oh the irony) when it uses CFBridgingRetain/CFBridgingRelease;
they are supposed to be calls with the casted expression as parameter, they should
not be inserted into the cast like the __bridge keywords.

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

12 years agoMinor fix to template instantiation, which properly instantiates
DeLesley Hutchins [Thu, 16 Feb 2012 17:30:51 +0000 (17:30 +0000)]
Minor fix to template instantiation, which properly instantiates
dependent attributes on static members of templatized classes.

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

12 years agoThread safety analysis: Don't check for lockable on undefined types.
DeLesley Hutchins [Thu, 16 Feb 2012 17:15:51 +0000 (17:15 +0000)]
Thread safety analysis: Don't check for lockable on undefined types.

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

12 years agoThread-safety analysis: Disable checking inside constructors, destructors, lock,...
DeLesley Hutchins [Thu, 16 Feb 2012 17:13:43 +0000 (17:13 +0000)]
Thread-safety analysis: Disable checking inside constructors, destructors, lock, and unlock functions

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

12 years agoThread-Safety: added support for 'this' as a lock expression.
DeLesley Hutchins [Thu, 16 Feb 2012 17:03:24 +0000 (17:03 +0000)]
Thread-Safety: added support for 'this' as a lock expression.

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

12 years agoAllow thread safety attributes on function definitions.
DeLesley Hutchins [Thu, 16 Feb 2012 16:50:43 +0000 (16:50 +0000)]
Allow thread safety attributes on function definitions.
For compatibility with gcc, clang will now parse gcc attributes on
function definitions, but issue a warning if the attribute is not a
thread safety attribute.  Warning controlled by -Wgcc-compat.

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

12 years agoFormat string analysis: give 'q' its own enumerator.
Hans Wennborg [Thu, 16 Feb 2012 16:34:54 +0000 (16:34 +0000)]
Format string analysis: give 'q' its own enumerator.

This is in preparation for being able to warn about 'q' and other
non-standard format string features.

It also allows us to print its name correctly.

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

12 years agoTweak link order on Solaris so that global ctors work.
David Chisnall [Thu, 16 Feb 2012 16:00:47 +0000 (16:00 +0000)]
Tweak link order on Solaris so that global ctors work.

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

12 years agoProper checking of list-initializers for array new expressions.
Sebastian Redl [Thu, 16 Feb 2012 12:59:47 +0000 (12:59 +0000)]
Proper checking of list-initializers for array new expressions.

This finishes generalized initializer support in Sema.

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

12 years agoRevert "Revert "Make CXXNewExpr contain only a single initialier, and not hold the...
Sebastian Redl [Thu, 16 Feb 2012 12:22:20 +0000 (12:22 +0000)]
Revert "Revert "Make CXXNewExpr contain only a single initialier, and not hold the used constructor itself.""

This reintroduces commit r150682 with a fix for the Bullet benchmark crash.

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

12 years agoRevert "Make CXXNewExpr contain only a single initialier, and not hold the used const...
Sebastian Redl [Thu, 16 Feb 2012 11:35:52 +0000 (11:35 +0000)]
Revert "Make CXXNewExpr contain only a single initialier, and not hold the used constructor itself."
It leads to a compiler crash in the Bullet benchmark.

This reverts commit r12014.

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

12 years agoMake CXXNewExpr contain only a single initialier, and not hold the used constructor...
Sebastian Redl [Thu, 16 Feb 2012 10:58:10 +0000 (10:58 +0000)]
Make CXXNewExpr contain only a single initialier, and not hold the used constructor itself.

Holding the constructor directly makes no sense when list-initialized arrays come into play. The constructor is now held in a CXXConstructExpr, if construction is what is done. The new design can also distinguish properly between list-initialization and direct-initialization, as well as implicit default-initialization constructors and explicit value-initialization constructors. Finally, doing it this way removes redundance from the AST because CXXNewExpr doesn't try to handle both the allocation and the initialization responsibilities.

This breaks the static analysis of new expressions. I've filed PR12014 to track this.

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

12 years agoFix test to not depend upon metadata numbers.
Bill Wendling [Thu, 16 Feb 2012 08:58:11 +0000 (08:58 +0000)]
Fix test to not depend upon metadata numbers.

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

12 years agotest/CodeGenObjC/arc-no-arc-exceptions.m: Disable it at -Asserts for now.
NAKAMURA Takumi [Thu, 16 Feb 2012 08:12:12 +0000 (08:12 +0000)]
test/CodeGenObjC/arc-no-arc-exceptions.m: Disable it at -Asserts for now.

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

12 years agoShift Microsoft enum extensions from -fms-extensions to -fms-compatibility, so -fms...
Eli Friedman [Thu, 16 Feb 2012 05:20:44 +0000 (05:20 +0000)]
Shift Microsoft enum extensions from -fms-extensions to -fms-compatibility, so -fms-extensions doesn't affect enum semantics in incompatible ways. <rdar://problem/10657186>.

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

12 years agoInitial implementation of IRGen for the lambda conversion-to-function-pointer operator.
Eli Friedman [Thu, 16 Feb 2012 03:47:28 +0000 (03:47 +0000)]
Initial implementation of IRGen for the lambda conversion-to-function-pointer operator.

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

12 years ago[analyzer] Diagnostics: Ensure that the default end of diagnostic path
Anna Zaks [Thu, 16 Feb 2012 03:41:01 +0000 (03:41 +0000)]
[analyzer] Diagnostics: Ensure that the default end of diagnostic path
piece can always be generated.

The default end of diagnostic path piece was failing to generate on a
BlockEdge that was outgoing from a basic block without a terminator,
resulting in a very simple diagnostic being rendered (ex: no path
highlighting or custom visitors). Reuse another function, which is
essentially doing the same thing and correct it not to fail when a block
has no terminator.

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

12 years ago[analyzer] Malloc Checker: Give up when a pointer escapes into a struct.
Anna Zaks [Thu, 16 Feb 2012 03:40:57 +0000 (03:40 +0000)]
[analyzer] Malloc Checker: Give up when a pointer escapes into a struct.

We are not properly handling the memory regions that escape into struct
fields, which led to a bunch of false positives. Be conservative here
and give up when a pointer escapes into a struct.

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

12 years agoconstexpr tidyups:
Richard Smith [Thu, 16 Feb 2012 02:46:34 +0000 (02:46 +0000)]
constexpr tidyups:
  * Fix bug when determining whether && / || are potential constant expressions
  * Try harder when determining whether ?: is a potential constant expression
  * Produce a diagnostic on sizeof(VLA) to provide a better source location

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

12 years agoAdd a few minor items to the 3.1 release notes.
Nico Weber [Thu, 16 Feb 2012 02:35:03 +0000 (02:35 +0000)]
Add a few minor items to the 3.1 release notes.

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

12 years agoFix the RecursiveASTVisitor to not traverse C++ default parameters twice.
Argyrios Kyrtzidis [Thu, 16 Feb 2012 02:02:14 +0000 (02:02 +0000)]
Fix the RecursiveASTVisitor to not traverse C++ default parameters twice.

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

12 years agoFix test for r150648.
Chad Rosier [Thu, 16 Feb 2012 01:56:55 +0000 (01:56 +0000)]
Fix test for r150648.

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

12 years agoStart of IRGen for lambda conversion operators.
Eli Friedman [Thu, 16 Feb 2012 01:37:33 +0000 (01:37 +0000)]
Start of IRGen for lambda conversion operators.

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

12 years agoUse the new method for specifying garbage collection metadata in the module.
Bill Wendling [Thu, 16 Feb 2012 01:13:30 +0000 (01:13 +0000)]
Use the new method for specifying garbage collection metadata in the module.

The garbage collection metadata needs to be merged "intelligently", when two or
more modules are linked together, and not merely appended. (Appending creates a
section which is too large.) The module flags metadata method is the way to do
this.
<rdar://problem/8198537>

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

12 years ago[libclang] Do index statements inside a type source info. rdar://10872758
Argyrios Kyrtzidis [Thu, 16 Feb 2012 01:12:04 +0000 (01:12 +0000)]
[libclang] Do index statements inside a type source info. rdar://10872758

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

12 years agoImplicitly define a lambda's conversion functions (to function
Douglas Gregor [Thu, 16 Feb 2012 01:06:16 +0000 (01:06 +0000)]
Implicitly define a lambda's conversion functions (to function
pointers and block pointers). We use dummy definitions to keep the
invariant that an implicit, used definition has a body; IR generation
will substitute the actual contents, since they can't be represented
as C++.

For the block pointer case, compute the copy-initialization needed to
capture the lambda object in the block, which IR generation will need
later.

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

12 years agoTeach clang to add metadata tags to calls and invokes in ObjC with
Dan Gohman [Thu, 16 Feb 2012 00:57:37 +0000 (00:57 +0000)]
Teach clang to add metadata tags to calls and invokes in ObjC with
-fno-objc-arc-exceptions. This will allow the optimizer to perform
optimizations which are only safe under that flag.

This is a part of rdar://10803830.

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

12 years agoMark the parenthesized array member initialization diagnostic as DefaultError,
Richard Smith [Thu, 16 Feb 2012 00:54:02 +0000 (00:54 +0000)]
Mark the parenthesized array member initialization diagnostic as DefaultError,
and move it out of -Wgnu so that -Wno-gnu leaves it enabled. As requested by
Eli.

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

12 years agoStart off release notes for clang 3.1 with reference to C11 anonymous structs
Richard Smith [Thu, 16 Feb 2012 00:32:27 +0000 (00:32 +0000)]
Start off release notes for clang 3.1 with reference to C11 anonymous structs
and unions, and C++11 generalized constant expressions.

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

12 years agoobjc-arc: For arc's ivar layout, treat __unsafe_unretained ivars
Fariborz Jahanian [Thu, 16 Feb 2012 00:15:02 +0000 (00:15 +0000)]
objc-arc: For arc's ivar layout, treat __unsafe_unretained ivars
as unscanned. // rdar://10832643

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

12 years agoRevert "Add a completed/incomplete type difference. This allows us to have"
Eric Christopher [Wed, 15 Feb 2012 23:51:20 +0000 (23:51 +0000)]
Revert "Add a completed/incomplete type difference. This allows us to have"

This reverts commit 9a68d4584afcd0853b930bd80235b58736e785b4.

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

12 years agoAdd a completed/incomplete type difference. This allows us to have
Eric Christopher [Wed, 15 Feb 2012 23:25:18 +0000 (23:25 +0000)]
Add a completed/incomplete type difference. This allows us to have
partial types for contexts and forward decls while allowing us to
complete types later on for debug purposes.

This piggy-backs on the metadata replacement and rauw changes
for temporary nodes and takes advantage of the incremental
support I added in earlier. This allows us to, if we decide,
to limit adding methods and variables to structures in order
to limit the amount of debug information output into a .o file.

The caching is a bit complicated though so any thoughts on
untangling that are welcome.

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

12 years agoSilence a valgrind warning, and remove an unused var.
Kaelyn Uhrain [Wed, 15 Feb 2012 22:59:03 +0000 (22:59 +0000)]
Silence a valgrind warning, and remove an unused var.

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

12 years agoSupport GCC's bug^Wextension allowing class array members to be initalized by a
Richard Smith [Wed, 15 Feb 2012 22:38:09 +0000 (22:38 +0000)]
Support GCC's bug^Wextension allowing class array members to be initalized by a
parenthesized braced-init-list in the base/member initialization list.

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

12 years agoImprove typo correction involving nested name specifiers.
Kaelyn Uhrain [Wed, 15 Feb 2012 22:14:18 +0000 (22:14 +0000)]
Improve typo correction involving nested name specifiers.

Snooping in other namespaces when the identifier being corrected is
already qualified (i.e. a valid CXXScopeSpec is passed to CorrectTypo)
and ranking synthesized namespace qualifiers relative to the existing
qualifier is now performed. Support for disambiguating the string
representation of synthesized namespace qualifers has also been added
(the change to test/Parser/cxx-using-directive.cpp is an example of an
ambiguous relative qualifier).

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

12 years agoLambda closure types have a conversion function to a block pointer
Douglas Gregor [Wed, 15 Feb 2012 22:08:38 +0000 (22:08 +0000)]
Lambda closure types have a conversion function to a block pointer
with the same parameter types and return type as the function call
operator. This is the real answer to

  http://stackoverflow.com/questions/4148242/is-it-possible-to-convert-a-c0x-lambda-to-a-clang-block

:)

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

12 years agoobjective-c translator: fixes an obscure rewriting bug
Fariborz Jahanian [Wed, 15 Feb 2012 22:01:47 +0000 (22:01 +0000)]
objective-c translator: fixes an obscure rewriting bug
which attempted to rewrite the same meta-data twice.

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