Ted Kremenek [Tue, 25 Jan 2011 19:13:42 +0000 (19:13 +0000)]
Tweak wording of static analyzer diagnostic
for a block capturing the value of an uninitialized
variable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124212
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Tue, 25 Jan 2011 19:13:18 +0000 (19:13 +0000)]
Teach TemplateSpecializationTypeLoc::initializeArgLocs() to actually
generate meaningful [*] template argument location information.
[*] Well, as meaningful as possible, given that this entire code path
is a hack for when we've lost type-source information.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124211
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Tue, 25 Jan 2011 19:10:24 +0000 (19:10 +0000)]
Move unnamed_addr after the function arguments on Sabre's request.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124210
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Tue, 25 Jan 2011 18:11:52 +0000 (18:11 +0000)]
Add test for PR8629
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124204
91177308-0d34-0410-b5e6-
96231b3b80d8
Anders Carlsson [Tue, 25 Jan 2011 18:08:22 +0000 (18:08 +0000)]
Don't insert class templates into the DynamicClasses vector.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124201
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Tue, 25 Jan 2011 17:51:48 +0000 (17:51 +0000)]
Be a bit more defensive about setting the temporary base location
during template instantiation. This code needs to eventually die, but
this little tweak fixes PR8629, where bad location information slipped
through to the location of a class template instantiation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124199
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Tue, 25 Jan 2011 17:19:08 +0000 (17:19 +0000)]
Implement the rvalue-reference deduction transformation (from T&& ->
T) when taking the address of an overloaded function or matching a
specialization to a template (C++0x [temp.deduct.type]p10). Fixes
PR9044.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124197
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Tue, 25 Jan 2011 16:13:26 +0000 (16:13 +0000)]
When performing a glvalue-to-xvalue static_cast that involves a
derived-to-base conversion, set the cast kind and base path
appropriately.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124189
91177308-0d34-0410-b5e6-
96231b3b80d8
John McCall [Tue, 25 Jan 2011 04:26:21 +0000 (04:26 +0000)]
Document the ns_returns_retained, ns_consumed, etc. attributes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124176
91177308-0d34-0410-b5e6-
96231b3b80d8
John McCall [Tue, 25 Jan 2011 03:51:08 +0000 (03:51 +0000)]
Change the wording of the bad-decl-for-attribute warning and error
to make it clear that we're talking about the declarations and not the types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124175
91177308-0d34-0410-b5e6-
96231b3b80d8
John McCall [Tue, 25 Jan 2011 03:31:58 +0000 (03:31 +0000)]
Add the ns_consumes_self, ns_consumed, cf_consumed, and ns_returns_autoreleased
attributes for the benefit of the static analyzer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124174
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Tue, 25 Jan 2011 02:17:32 +0000 (02:17 +0000)]
Downgrade the error about rvalue references to an extension warning
and turn on __has_feature(cxx_rvalue_references). The core rvalue
references proposal seems to be fully implemented now, pending lots
more testing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124169
91177308-0d34-0410-b5e6-
96231b3b80d8
Argyrios Kyrtzidis [Tue, 25 Jan 2011 00:04:03 +0000 (00:04 +0000)]
[analyzer] Handle the dot syntax for properties in the ExprEngine.
We translate property accesses to obj-c messages by simulating "loads" or "stores" to properties
using a pseudo-location SVal kind (ObjCPropRef).
Checkers can now reason about obj-c messages for both explicit message expressions and implicit
messages due to property accesses.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124161
91177308-0d34-0410-b5e6-
96231b3b80d8
Argyrios Kyrtzidis [Tue, 25 Jan 2011 00:03:57 +0000 (00:03 +0000)]
[analyzer] Introduce ExprEngine::VisitObjCMessage for handling general ObjCMessages (both message expressions and property access)
and use it in ExprEngine::VisitObjCMessageExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124160
91177308-0d34-0410-b5e6-
96231b3b80d8
Argyrios Kyrtzidis [Tue, 25 Jan 2011 00:03:53 +0000 (00:03 +0000)]
[analyzer] Introduce ObjCMessage which represents both explicit ObjC message expressions and implicit
messages that are sent for handling properties in dot syntax.
Replace all direct uses of ObjCMessageExpr in the checkers and checker interface with ObjCMessage.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124159
91177308-0d34-0410-b5e6-
96231b3b80d8
Argyrios Kyrtzidis [Tue, 25 Jan 2011 00:03:48 +0000 (00:03 +0000)]
In a ObjCMessageExpr with the super class as receiver, 'super' is actually a ObjCInterfaceType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124158
91177308-0d34-0410-b5e6-
96231b3b80d8
Argyrios Kyrtzidis [Tue, 25 Jan 2011 00:03:45 +0000 (00:03 +0000)]
[analyzer] Simplify GetReceiverType function in BasicObjCFoundationChecks.cpp; no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124157
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Mon, 24 Jan 2011 23:07:03 +0000 (23:07 +0000)]
Revert r124146 for now. It appears to be failing on a few platforms.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124153
91177308-0d34-0410-b5e6-
96231b3b80d8
Anton Yartsev [Mon, 24 Jan 2011 20:55:22 +0000 (20:55 +0000)]
pre/post increase/decrease for AltiVec vectors
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124146
91177308-0d34-0410-b5e6-
96231b3b80d8
Nick Lewycky [Mon, 24 Jan 2011 19:01:04 +0000 (19:01 +0000)]
Enhance the diagnostic for referring to a typedef with an elaborated name to be
as useful in a templated context as it is without templates. Fixes PR8755!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124136
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Mon, 24 Jan 2011 18:54:39 +0000 (18:54 +0000)]
Disallow function template partial specializations, from Hans
Wennborg! Fixes PR8295.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124135
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Mon, 24 Jan 2011 18:44:28 +0000 (18:44 +0000)]
Eliminate the use of getTypeForDecl from clang_getCursorType() and
clang_getDeclObjCTypeEncoding(); use ASTContext's methods instead,
which will (lazily) create the type as needed. Otherwise, we can end
up with null QualTypes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124133
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Mon, 24 Jan 2011 18:04:58 +0000 (18:04 +0000)]
Note the need for --param=build_config=whatever in the Hacking Clang document, from Yuri Gribov
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124130
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Mon, 24 Jan 2011 17:25:03 +0000 (17:25 +0000)]
Improve the printing of C++ construction expressions, from Yuri Gribov!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124123
91177308-0d34-0410-b5e6-
96231b3b80d8
Anders Carlsson [Mon, 24 Jan 2011 16:26:15 +0000 (16:26 +0000)]
Use attributes for all the override control specifiers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124122
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Mon, 24 Jan 2011 16:14:37 +0000 (16:14 +0000)]
Re-instate r123977/r123978, my updates of the reference-binding
implementation used by overload resolution to support rvalue
references. The original commits caused PR9026 and some
hard-to-reproduce self-host breakage.
The only (crucial!) difference between this commit and the previous
commits is that we now properly check the SuppressUserConversions flag
before attempting to perform a second user-defined conversion in
reference binding, breaking the infinite recursion chain of
user-defined conversions.
Rvalue references should be working a bit better now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124121
91177308-0d34-0410-b5e6-
96231b3b80d8
Axel Naumann [Mon, 24 Jan 2011 15:44:00 +0000 (15:44 +0000)]
Check whether DependentScopeDeclRefExpr's NestedNameSpecifier exists before accessing it, both for consistency (see StmtPrinter::VisitDeclRefExpr()) and for other use cases of dependent types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124119
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Mon, 24 Jan 2011 15:22:41 +0000 (15:22 +0000)]
Eliminate the last reference to concepts, from Jean-Daniel Dupas
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124118
91177308-0d34-0410-b5e6-
96231b3b80d8
Anders Carlsson [Mon, 24 Jan 2011 03:54:51 +0000 (03:54 +0000)]
Fix the __has_attribute example; we don't have an override attribute anymore.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124106
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 24 Jan 2011 03:47:59 +0000 (03:47 +0000)]
fix some typos, patch by Jonathan Wakely!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124105
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 24 Jan 2011 03:47:34 +0000 (03:47 +0000)]
fix a broken example, PR9005, patch by Jonathan Wakely!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124104
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 24 Jan 2011 02:53:58 +0000 (02:53 +0000)]
remove some crazy leftover thing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124098
91177308-0d34-0410-b5e6-
96231b3b80d8
Anders Carlsson [Mon, 24 Jan 2011 02:12:11 +0000 (02:12 +0000)]
When building a type info struct for EH, we always want it to have linkonce_odr linkage.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124096
91177308-0d34-0410-b5e6-
96231b3b80d8
Anders Carlsson [Mon, 24 Jan 2011 02:04:33 +0000 (02:04 +0000)]
Change CodeGenModule::getVTableLinkage to be a non-static member function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124095
91177308-0d34-0410-b5e6-
96231b3b80d8
Anders Carlsson [Mon, 24 Jan 2011 01:59:49 +0000 (01:59 +0000)]
"Name" a bool parameter.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124094
91177308-0d34-0410-b5e6-
96231b3b80d8
Ken Dyck [Mon, 24 Jan 2011 01:55:39 +0000 (01:55 +0000)]
Use CharUnits for the offset amount of RegionRawOffset.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124093
91177308-0d34-0410-b5e6-
96231b3b80d8
Ken Dyck [Mon, 24 Jan 2011 01:28:50 +0000 (01:28 +0000)]
Remove private toCharUnits() helper method, replacing with calls to
ASTContext::toCharUnitsFromBits().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124092
91177308-0d34-0410-b5e6-
96231b3b80d8
Anders Carlsson [Mon, 24 Jan 2011 00:46:19 +0000 (00:46 +0000)]
Mark VTables and RTTI data linkonce_odr instead of weak_odr, with the exception of explicit template instantiations, which have to be weak_odr.
This fixes PR6996.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124089
91177308-0d34-0410-b5e6-
96231b3b80d8
Anders Carlsson [Sun, 23 Jan 2011 21:33:18 +0000 (21:33 +0000)]
Get rid of [[hiding]], [[override]] and [[base_check]].
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124087
91177308-0d34-0410-b5e6-
96231b3b80d8
Anders Carlsson [Sun, 23 Jan 2011 21:07:30 +0000 (21:07 +0000)]
Get rid of the [[final]] C++0x attribute.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124083
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Sun, 23 Jan 2011 17:58:26 +0000 (17:58 +0000)]
Add support for the --noexecstack option. Fixes PR8762.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124078
91177308-0d34-0410-b5e6-
96231b3b80d8
Ted Kremenek [Sun, 23 Jan 2011 17:53:04 +0000 (17:53 +0000)]
Teach -Wuninitialized-experimental about sizeof().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124076
91177308-0d34-0410-b5e6-
96231b3b80d8
Ted Kremenek [Sun, 23 Jan 2011 17:21:34 +0000 (17:21 +0000)]
Tweak diagnostic:
error: no super class declared in @interface for 'XXX'
to be:
error: 'X' cannot use 'super' because it is a root class
The latter explains what the user actually did wrong.
Fixes: <rdar://problem/8904409>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124074
91177308-0d34-0410-b5e6-
96231b3b80d8
Ted Kremenek [Sun, 23 Jan 2011 17:04:59 +0000 (17:04 +0000)]
Null initialize a few variables flagged by
clang's -Wuninitialized-experimental warning.
While these don't look like real bugs, clang's
-Wuninitialized-experimental analysis is stricter
than GCC's, and these fixes have the benefit
of being general nice cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124072
91177308-0d34-0410-b5e6-
96231b3b80d8
Anders Carlsson [Sat, 22 Jan 2011 23:01:49 +0000 (23:01 +0000)]
Accept the C++0x override control keywords as an extension in C++98. This is OK since the new syntax is unambiguous and can't be confused with C++98 syntax. If anyone disagrees, please shout!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124048
91177308-0d34-0410-b5e6-
96231b3b80d8
Anders Carlsson [Sat, 22 Jan 2011 22:23:37 +0000 (22:23 +0000)]
Implement [class.derived]p8.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124047
91177308-0d34-0410-b5e6-
96231b3b80d8
Anders Carlsson [Sat, 22 Jan 2011 18:11:02 +0000 (18:11 +0000)]
Serialize and deserialize IsMarkedFinal/IsMarkedExplicit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124041
91177308-0d34-0410-b5e6-
96231b3b80d8
Anders Carlsson [Sat, 22 Jan 2011 18:07:06 +0000 (18:07 +0000)]
Mark classes final and/or explicit during class template instantiation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124040
91177308-0d34-0410-b5e6-
96231b3b80d8
Anders Carlsson [Sat, 22 Jan 2011 17:51:53 +0000 (17:51 +0000)]
Mark classes as final or explicit. Diagnose when a class marked 'final' is used as a base.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124039
91177308-0d34-0410-b5e6-
96231b3b80d8
Anders Carlsson [Sat, 22 Jan 2011 17:22:48 +0000 (17:22 +0000)]
Add final/explicit getters and setters to CXXRecordDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124037
91177308-0d34-0410-b5e6-
96231b3b80d8
Anders Carlsson [Sat, 22 Jan 2011 16:56:46 +0000 (16:56 +0000)]
Parse class-virt-specifier-seqs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124036
91177308-0d34-0410-b5e6-
96231b3b80d8
Anders Carlsson [Sat, 22 Jan 2011 15:58:16 +0000 (15:58 +0000)]
More work on ClassVirtSpecifiers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124035
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Sat, 22 Jan 2011 15:34:07 +0000 (15:34 +0000)]
Add test from PR9026.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124034
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Sat, 22 Jan 2011 15:32:35 +0000 (15:32 +0000)]
revert r123977 and r123978 to fix PR9026.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124033
91177308-0d34-0410-b5e6-
96231b3b80d8
Anders Carlsson [Sat, 22 Jan 2011 15:11:37 +0000 (15:11 +0000)]
Start stubbing out a ClassVirtSpecifiers class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124032
91177308-0d34-0410-b5e6-
96231b3b80d8
Anders Carlsson [Sat, 22 Jan 2011 14:43:56 +0000 (14:43 +0000)]
A member function template cannot be virtual.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124031
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Sat, 22 Jan 2011 12:15:57 +0000 (12:15 +0000)]
Use a FunctionType::get overload that doesn't require an empty vector.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124029
91177308-0d34-0410-b5e6-
96231b3b80d8
John McCall [Sat, 22 Jan 2011 09:28:32 +0000 (09:28 +0000)]
Improve our parse recovery on 'case blah;' and 'default;'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124025
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Sat, 22 Jan 2011 02:44:21 +0000 (02:44 +0000)]
Send code generation for xvalues down the same path as lvalues
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124023
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Sat, 22 Jan 2011 01:58:15 +0000 (01:58 +0000)]
Debug info generation for rvalue references
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124020
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Sat, 22 Jan 2011 00:19:52 +0000 (00:19 +0000)]
Update const_cast semantics for rvalue references. Add tests for
reinterpret_cast and const_cast using rvalue references.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124007
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Sat, 22 Jan 2011 00:06:57 +0000 (00:06 +0000)]
Teach static_cast and dynamic_cast about rvalue references.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124006
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Fri, 21 Jan 2011 22:52:47 +0000 (22:52 +0000)]
Add a test for "perfect" forwarding
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124005
91177308-0d34-0410-b5e6-
96231b3b80d8
Ted Kremenek [Fri, 21 Jan 2011 22:49:49 +0000 (22:49 +0000)]
Provide -Wuninitialized-experimental fixits
for floats, and also check if 'nil' is declared
when suggesting it for initializing ObjC pointers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124004
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Fri, 21 Jan 2011 22:46:35 +0000 (22:46 +0000)]
When throwing an elidable object, first try to treat the subexpression
as an rvalue per C++0x [class.copy]p33. If that fails, try again with
the original subexpression.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124002
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Fri, 21 Jan 2011 21:08:57 +0000 (21:08 +0000)]
Generalize the NRVO move-construction-based initialization routine. No functionality change
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123996
91177308-0d34-0410-b5e6-
96231b3b80d8
Ted Kremenek [Fri, 21 Jan 2011 19:41:46 +0000 (19:41 +0000)]
Add basic fixits for -Wuninitialized-experimental
to suggest initializations for pointer and
ObjC pointer types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123995
91177308-0d34-0410-b5e6-
96231b3b80d8
Ted Kremenek [Fri, 21 Jan 2011 19:41:41 +0000 (19:41 +0000)]
Enhance -Wuninitialized-experimental diagnostics
to issue the warning at an uninitialized variable's
declaration, but to issue notes at possible
uninitialized uses (which could be multiple).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123994
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Fri, 21 Jan 2011 19:38:21 +0000 (19:38 +0000)]
Implement the preference for move-construction over copy-construction
when returning an NRVO candidate expression. For example, this
properly picks the move constructor when dealing with code such as
MoveOnlyType f() { MoveOnlyType mot; return mot; }
The previously-XFAIL'd rvalue-references test case now works, and has
been moved into the appropriate paragraph-specific test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123992
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Fri, 21 Jan 2011 18:20:49 +0000 (18:20 +0000)]
We love parentheses
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123983
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Fri, 21 Jan 2011 18:05:27 +0000 (18:05 +0000)]
Promote the static getNRVOCandidate() function, which computed the
NRVO candidate for a return statement, to
Sema::getCopyElisionCandidate(), and teach it enough to also determine
the NRVO candidate for a throw expression. We still don't use the
latter information, however.
Along the way, implement core issue 1148, which eliminates copy
elision from catch parameters and clarifies that copy elision cannot
occur from function parameters (which we already implemented).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123982
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Fri, 21 Jan 2011 17:29:42 +0000 (17:29 +0000)]
Implement core issue 1164, which concerns the partial ordering of
f(T&) and f(T&&).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123981
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Fri, 21 Jan 2011 17:06:29 +0000 (17:06 +0000)]
Add unique_ptr example to test the use of rvalue references. I'll grow
this example further as more rvalue-reference features come online.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123980
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Fri, 21 Jan 2011 16:48:38 +0000 (16:48 +0000)]
Add test for overload resolution's preference for binding an rvalue
reference to an rvalue rather than binding a const-qualified lvalue
reference to that rvalue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123979
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Fri, 21 Jan 2011 16:37:29 +0000 (16:37 +0000)]
Eliminate an unused variable
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123978
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Fri, 21 Jan 2011 16:36:05 +0000 (16:36 +0000)]
Update the reference-binding implementation used for overload
resolution to match the latest C++0x working paper's semantics. The
implementation now matching up with the reference-binding
implementation used for initialization.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123977
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Fri, 21 Jan 2011 05:24:25 +0000 (05:24 +0000)]
More testing to C++0x [temp.deduct.call]p3
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123967
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Fri, 21 Jan 2011 05:18:22 +0000 (05:18 +0000)]
Implement the special template argument deduction rule for T&& in a
call (C++0x [temp.deduct.call]p3).
As part of this, start improving the reference-binding implementation
used in the computation of implicit conversion sequences (for overload
resolution) to reflect C++0x semantics. It still needs more work and
testing, of course.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123966
91177308-0d34-0410-b5e6-
96231b3b80d8
Peter Collingbourne [Fri, 21 Jan 2011 02:08:54 +0000 (02:08 +0000)]
Sema: process non-inheritable attributes on function declarations early
This allows us to simplify the handling for the overloadable attribute,
removing a number of FIXMEs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123961
91177308-0d34-0410-b5e6-
96231b3b80d8
Peter Collingbourne [Fri, 21 Jan 2011 02:08:45 +0000 (02:08 +0000)]
Sema: support for processing non-inheritable declaration attributes early
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123960
91177308-0d34-0410-b5e6-
96231b3b80d8
Peter Collingbourne [Fri, 21 Jan 2011 02:08:36 +0000 (02:08 +0000)]
Generalise support for non-inheritable attributes
Inheritable attributes on declarations may be inherited by any later
redeclaration at merge time. By contrast, a non-inheritable attribute
will not be inherited by later redeclarations. Non-inheritable
attributes may be semantically analysed early, allowing them to
influence the redeclaration/overloading process.
Before this change, the "overloadable" attribute received special
handling to be treated as non-inheritable, while all other attributes
were treated as inheritable. This patch generalises the concept,
while removing a FIXME. Some CUDA location attributes are also marked
as non-inheritable in order to support special overloading semantics
(to be introduced in a later patch).
The patch introduces a new Attr subclass, InheritableAttr, from
which all inheritable attributes derive. Non-inheritable attributes
simply derive from Attr.
N.B. I did not review every attribute to determine whether it should
be marked non-inheritable. This can be done later on an incremental
basis, as this change does not affect default functionality.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123959
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Fri, 21 Jan 2011 01:11:43 +0000 (01:11 +0000)]
Add more reference-binding examples from the C++0x working paper, all of which seem to be working fine
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123955
91177308-0d34-0410-b5e6-
96231b3b80d8
Fariborz Jahanian [Fri, 21 Jan 2011 01:04:41 +0000 (01:04 +0000)]
Move cheking of kext into canDevirtualizeMemberFunctionCalls().
Improve on test case. Per Doug's comment. wip.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123954
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Fri, 21 Jan 2011 01:04:33 +0000 (01:04 +0000)]
Improve the diagnostic that complains about binding an rvalue
reference to an lvalue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123953
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Fri, 21 Jan 2011 00:52:42 +0000 (00:52 +0000)]
More work to bring reference binding up to the latest C++0x
specification. In particular, an rvalue reference can bind to an
initializer expression that is an lvalue if the referent type and the
initializer expression type are not reference-related. This is a newer
formulation to the previous "rvalue references can never bind to
lvalues" rule.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123952
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Fri, 21 Jan 2011 00:27:08 +0000 (00:27 +0000)]
When performing reference binding via a conversion function, perform
type checking based on the actual reference type we're trying to bind
the result to, rather than stripping the reference.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123950
91177308-0d34-0410-b5e6-
96231b3b80d8
Fariborz Jahanian [Thu, 20 Jan 2011 23:34:25 +0000 (23:34 +0000)]
Initialize a variable, found by Ted.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123948
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Thu, 20 Jan 2011 23:15:49 +0000 (23:15 +0000)]
Fix a use of uninitialized variables, found by Ted!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123947
91177308-0d34-0410-b5e6-
96231b3b80d8
Ted Kremenek [Thu, 20 Jan 2011 21:25:34 +0000 (21:25 +0000)]
Removing debug printing logic from UninitializedValuesV2.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123944
91177308-0d34-0410-b5e6-
96231b3b80d8
Ted Kremenek [Thu, 20 Jan 2011 21:25:31 +0000 (21:25 +0000)]
Relax CFG assertions in UninitializedValuesV2 when
handling pseudo-path sensitivity, and instead
use those assertion conditions as dynamic checks.
These assertions would be violated when analyzing
a CFG where some branches where optimized away
during CFG construction because their branch
conditions could be trivially determined.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123943
91177308-0d34-0410-b5e6-
96231b3b80d8
Ted Kremenek [Thu, 20 Jan 2011 19:45:14 +0000 (19:45 +0000)]
Add test case for <rdar://problem/
8891119>. In
earlier revisions Clang was incorrectly warning
about an incomplete @implementation when a property
was getting synthesized. This got fixed somewhere
down the line.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123939
91177308-0d34-0410-b5e6-
96231b3b80d8
Ted Kremenek [Thu, 20 Jan 2011 17:37:17 +0000 (17:37 +0000)]
Add rudimentary path-sensitivity to UnintializedValuesV2
analysis for short-circuited operations. For branch written like "if (x && y)",
we maintain two sets of dataflow values for the outgoing
branches. This suppresses some common false positives
for -Wuninitialized-experimental.
This change introduces some assertion failures
when running on the LLVM codebase. WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123923
91177308-0d34-0410-b5e6-
96231b3b80d8
Fariborz Jahanian [Thu, 20 Jan 2011 17:19:02 +0000 (17:19 +0000)]
apple kext abi requires all vf calls, including qualified
vf calls, be made indirect. This patch is towards that goal.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123922
91177308-0d34-0410-b5e6-
96231b3b80d8
Ted Kremenek [Thu, 20 Jan 2011 17:09:48 +0000 (17:09 +0000)]
Enhance AnalysisConsumer to also visit functions
and methods defined within 'namespace X { ... }'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123921
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Thu, 20 Jan 2011 17:04:36 +0000 (17:04 +0000)]
More tests for reference binding in the presence of rvalue
references. Note that we're currently failing reference binding to a
function lvalue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123920
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Thu, 20 Jan 2011 16:44:54 +0000 (16:44 +0000)]
Start refactoring reference binding to more closely match the C++0x
working paper's structure. The only functional change here is that we
now handling binding to array rvalues, which we would previously reject.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123918
91177308-0d34-0410-b5e6-
96231b3b80d8
Anders Carlsson [Thu, 20 Jan 2011 16:25:36 +0000 (16:25 +0000)]
Diagnose when a virtual member function marked final is overridden.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123916
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Thu, 20 Jan 2011 16:11:21 +0000 (16:11 +0000)]
Merge test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123914
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Thu, 20 Jan 2011 16:08:06 +0000 (16:08 +0000)]
Add some tests for reference-collapsing and referencing binding
involving rvalue references, to start scoping out what is and what
isn't implemented. In the process, tweak some standards citations,
type desugaring, and teach the tentative parser about && in
ptr-operator.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123913
91177308-0d34-0410-b5e6-
96231b3b80d8
John McCall [Thu, 20 Jan 2011 07:57:12 +0000 (07:57 +0000)]
Fix the computation of alignment for fields of packed+aligned structs.
Part of the fix for PR8413.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123904
91177308-0d34-0410-b5e6-
96231b3b80d8