Richard Smith [Sat, 14 May 2011 15:04:18 +0000 (15:04 +0000)]
PR9908: Fix the broken fix for PR9902 to get the template argument lists in the right order.
Also, don't reject alias templates in all ElaboratedTypes: some ElaboratedTypes do not correspond to elaborated-type-specifiers.
John McCall [Sat, 14 May 2011 03:10:52 +0000 (03:10 +0000)]
Objective-C vtables are not taking the world by storm; call them
out as "v-table" message sends and stop calling normal messages "legacy"
message sends.
Also, fix some comments to reveal the true state of affairs.
__has_extension is a function-like macro which takes the same set
of feature identifiers as __has_feature. It evaluates to 1 if the
feature is supported by Clang in the current language (either as a
language extension or a standard language feature) or 0 if not.
At the same time, add support for the C1X feature identifiers
c_generic_selections (renamed from generic_selections) and
c_static_assert, and document them.
This introduces a generic base class for the expression evaluator
classes, which handles a few common expression types which were
previously handled separately in each class. Also, the expression
evaluator now uses ConstStmtVisitor.
ConstStmtVisitor is a constness-preserving variant of StmtVisitor.
ConstStmtVisitor and StmtVisitor share an implementation using a common
base class, StmtVisitorBase, which uses a template template parameter
to build pointer types.
Douglas Gregor [Fri, 13 May 2011 01:05:07 +0000 (01:05 +0000)]
When determining whether we can make a declaration into a global
constant, also consider whether it's a class type that has any mutable
fields. If so, it can't be a global constant.
Douglas Gregor [Fri, 13 May 2011 00:34:01 +0000 (00:34 +0000)]
Teach the template parameter dependency checker used when matching
template parameter lists to scope specifiers for friend declarations
about injected class name types. Fixes the
g++.dg/template/memfriend5.C regression in the GCC testsuite.
After issuing diagnostics on circular protocol list,
don't build circular AST in protocol's protocol list
when user code has introduced it. Indexer and other
clients may crash. // rdar://9221614
Bill Wendling [Thu, 12 May 2011 19:02:15 +0000 (19:02 +0000)]
LLVM doesn't always optimize away the four loads from this:
(__m128){ p[0], p[1], p[2], p[3] }
which produces really bad code. This could be done in instcombine, but it's
probably better to do it in the front-end instead.
<rdar://problem/9424836>
Sean Hunt [Thu, 12 May 2011 03:51:51 +0000 (03:51 +0000)]
Make it so that we actually generate definitions for explicitly
defaulted default constructors.
As it happens, making sure that we handle out-of-line defaulted
functions properly will involved making sure that we actually parse them
correctly, so that's coming after.
Richard Smith [Thu, 12 May 2011 00:06:17 +0000 (00:06 +0000)]
Fix PR9902: correctly substitute alias templates within the template in which they are defined: provide an empty list of arguments for each containing template context during substitution.
Douglas Gregor [Wed, 11 May 2011 23:45:11 +0000 (23:45 +0000)]
Implement CWG1170, which makes access-control errors into template
argument deduction failures. Only implemented in C++0x, since this is
a significant change in behavior from C++98/03.
Douglas Gregor [Wed, 11 May 2011 23:26:17 +0000 (23:26 +0000)]
When checking for the necessary 'template<>' headers based on the
nested of an out-of-line declaration, only require a 'template<>'
header for each enclosing class template that hasn't been previously
specialized; previously, we were requiring 'template<>' for enclosing
class templates and members of class templates that hadn't been
previously specialized. Fixes <rdar://problem/9422013>.
John McCall [Wed, 11 May 2011 07:19:11 +0000 (07:19 +0000)]
Teach CFG building how to deal with CXXMemberCallExprs and BoundMemberTy,
then teach -Wreturn-type to handle the same. Net effect: we now correctly
handle noreturn attributes on member calls in the CFG.
Douglas Gregor [Tue, 10 May 2011 21:23:31 +0000 (21:23 +0000)]
Tweak the diagnostics for the C++0x extensions to friend types to note
that they are C++0x extensions, and put them in the appropriate
group. We already support most of the semantics. Addresses
<rdar://problem/9407525>.
Change magic string "abc" to better magic string "qux".
Wait, what?
So, we run Clang (and LLVM) tests in an environment where the md5sum of the
input files becomes a component of the path. When testing the preprocessor,
the path becomes part of the output (in line directives). In this test, we
were grepping for the absence of "abc" in the output. When the stars aligned
properly, the md5sum component of the path contained "abc" and the test
failed. Oops.
Sean Hunt [Tue, 10 May 2011 19:08:14 +0000 (19:08 +0000)]
Re-do R131114 without breaking code.
I've edited one diagnostic which would print "copy constructor" for copy
constructors and "constructor" for any other constructor. If anyone is
extremely enamored with this, it can be reinstated with a simple boolean
flag rather than calling getSpecialMember, which is inappropriate.
Douglas Gregor [Tue, 10 May 2011 18:27:06 +0000 (18:27 +0000)]
Reimplement Sema::MatchTemplateParametersToScopeSpecifier() based on
the semantic context referenced by the nested-name-specifier rather
than the syntactic form of the nested-name-specifier. The previous
incarnation was based on my complete misunderstanding of C++
[temp.expl.spec]. The latest C++0x working draft clarifies the
requirements here, and this rewrite is intended to follow that.
Along the way, improve source location information in the
diagnostics. For example, if we report that a specific type needs or
doesn't need a 'template<>' header, we dig out that type in the
nested-name-specifier and highlight its range.
Fixes: PR5907, PR9421, PR8277, PR8708, PR9482, PR9668, PR9877, and
<rdar://problem/9135379>.
Sean Hunt [Tue, 10 May 2011 00:49:42 +0000 (00:49 +0000)]
Further implement defaulting constructors.
Focus is on default constructors for the time being. Currently the
exception specification and prototype are processed correctly. Codegen
might work but in all likelihood doesn't.
Note that due to an error, out-of-line defaulting of member functions is
currently impossible. It will continue to that until I muster up the
courage to admit that I secretly pray to epimetheus and that I need to
rework the way default gets from Parse -> Sema.
Douglas Gregor [Mon, 9 May 2011 20:45:16 +0000 (20:45 +0000)]
When determining whether we need to instantiate a function type,
also consider whether any of the parameter types (as written, prior to
decay) are dependent. Fixes PR9880 and <rdar://problem/9408413>.
Anders Carlsson [Sun, 8 May 2011 17:25:05 +0000 (17:25 +0000)]
Don't emit complete constructors for abstract classes. Also, don't emit
complete destructors for abstract classes unless the destructor is virtual
and thus needs to be in the vtable.
Douglas Gregor [Sun, 8 May 2011 06:09:53 +0000 (06:09 +0000)]
Relax the conversion rules for Objective-C GC qualifiers a
bit by allowing __weak and __strong to be added/dropped as part of
implicit conversions (qualification conversions in C++). A little
history: GCC lets one add/remove/change GC qualifiers just about
anywhere, implicitly. Clang did roughly the same before, but we
recently normalized the semantics of qualifiers across the board to
get a semantics that we could reason about (yay). Unfortunately, this
tightened the screws a bit too much for GC qualifiers, where it's
common to add/remove these qualifiers at will.
Overall, we're still in better shape than we were before: we don't
permit directly changing the GC qualifier (e.g., __weak -> __strong),
so type safety is improved. More importantly, we're internally
consistent in our handling of qualifiers, and the logic that allows
adding/removing GC qualifiers (but not adding/removing address
spaces!) only touches two obvious places.
Douglas Gregor [Sat, 7 May 2011 22:06:45 +0000 (22:06 +0000)]
In C++, allow us to emit a global as 'constant' even if it has class
type, so long as it is known to have a constant initializer and the
class type is a POD class. Fixes <rdar://problem/9306265>.
Francois Pichet [Sat, 7 May 2011 19:04:49 +0000 (19:04 +0000)]
Don't fail at parsing __declspec(property(get=get_func_name)). Just skip everything inside property() for now while we wait for the BoostPro people to provide a complete patch.