Douglas Gregor [Wed, 14 Oct 2009 23:50:59 +0000 (23:50 +0000)]
CheckTemplateSpecializationScope isn't going to be used for explicit
instantiations, since the requirements are too different from those
for template specializations. Simplify it slightly.
Douglas Gregor [Wed, 14 Oct 2009 23:41:34 +0000 (23:41 +0000)]
Additional semantic checking for explicit template instantiations,
focusing on the scope- and qualifier-related semantic requirements in
C++ [temp.explicit]p2.
Mike Stump [Wed, 14 Oct 2009 18:14:51 +0000 (18:14 +0000)]
Shift the vcall slots for non-virtual bases of a virtual base, up into
the virtual base so they can be reused properly. Don't reuse vcall
slots across a virtual boundary. WIP. I have a testcase, but there
are still things that need to be fixed before the testcase can go in.
Douglas Gregor [Wed, 14 Oct 2009 17:30:58 +0000 (17:30 +0000)]
When mapping from an injected-class-name to its corresponding
template, make sure to get the template that corresponds to *this*
declaration of the class template or specialization, rather than the
canonical specialization. Fixes PR5187.
Rafael Espindola [Wed, 14 Oct 2009 17:09:44 +0000 (17:09 +0000)]
Add support for having different c++ search dirs with -m32 and -m64. So far
this is only used in darwin10, 64 bit ubuntu 9.10 and 64 bit openSUSE 11.1.
Douglas Gregor [Wed, 14 Oct 2009 16:50:13 +0000 (16:50 +0000)]
Implement support for overloaded operator uses that result to a call
to a member operator template. We missed updating this call site when
adding support for function templates; bug exposed by a test for
PR5072.
Sebastian Redl [Wed, 14 Oct 2009 14:59:48 +0000 (14:59 +0000)]
Use partial diagnostics properly in call to RequireCompleteType. Among other things, this means we get a note on the declaration of the incomplete type when it is used in an exception specification.
Chris Lattner [Wed, 14 Oct 2009 05:55:45 +0000 (05:55 +0000)]
fix some cfstring related issues:
1) -fwritable-string does affect the non-utf16 version of cfstrings
just not the utf16 ones.
2) utf16 strings should always be marked constant, as the __TEXT segment
is readonly.
3) The name of the global doesn't matter, remove it from TargetInfo.
4) Trust the asmprinter to drop cstrings into the right section, like llvmgcc does now.
Ted Kremenek [Wed, 14 Oct 2009 00:27:24 +0000 (00:27 +0000)]
retain/release checker: Recognize that calls to
'CVPixelBufferCreateWithPlanarBytes()' and
'CVPixelBufferCreateWithBytes' (Core Video API) can indirectly release
a pixel buffer object via a callback.
Douglas Gregor [Tue, 13 Oct 2009 23:27:22 +0000 (23:27 +0000)]
Improve diagnostics when the parser encounters a declarator with an
unknown type name, e.g.,
foo::bar x;
when "bar" does not refer to a type in "foo".
With this change, the parser now calls into the action to perform
diagnostics and can try to recover by substituting in an appropriate
type. For example, this allows us to easily diagnose some missing
"typename" specifiers, which we now do:
test/SemaCXX/unknown-type-name.cpp:29:1: error: missing 'typename'
prior to dependent type name 'A<T>::type'
A<T>::type A<T>::f() { return type(); }
^~~~~~~~~~
typename
Douglas Gregor [Tue, 13 Oct 2009 21:16:44 +0000 (21:16 +0000)]
Unify our diagnostic printing for errors of the form, "we didn't like
what we found when we looked into <blah>", where <blah> is a
DeclContext*. We can now format DeclContext*'s in nice ways, e.g.,
"namespace N", "the global namespace", "'class Foo'".
This is part of PR3990, but we're not quite there yet.
Anders Carlsson [Tue, 13 Oct 2009 21:02:07 +0000 (21:02 +0000)]
Pass the right SourceLocation to Actions.ActOnOverloadedOperatorReferenceExpr and Actions.ActOnConversionOperatorReferenceExpr. Update incomplete-call.cpp test.
-funit-at-a-time is the default however some current makefiles pass -fno-unit-at-a-time which is ignored by GCC, we should warn about this not error out.
template<> template<typename T>
struct X<int>::Inner {
T member;
};
We need to treat templates that are member specializations as special
in two contexts:
- When looking for a definition of a member template, we look
through the instantiation chain until we hit the primary template
*or a member specialization*. This allows us to distinguish
between the primary "Inner" definition and the X<int>::Inner
definition, above.
- When computing all of the levels of template arguments needed to
instantiate a member template, don't add template arguments
from contexts outside of the instantiation of a member
specialization, since the user has already manually substituted
those arguments.
Fix up the existing test for p18, which was actually wrong (but we
didn't diagnose it because of our poor handling of member
specializations of templates), and add a new test for member
specializations of templates.
Douglas Gregor [Tue, 13 Oct 2009 14:39:41 +0000 (14:39 +0000)]
Improve the internal representation and semantic analysis of friend
function templates.
This commit ensures that friend function templates are constructed as
FunctionTemplateDecls rather than partial FunctionDecls (as they
previously were). It then implements template instantiation for friend
function templates, injecting the friend function template only when
no previous declaration exists at the time of instantiation.
Oh, and make sure that explicit specialization declarations are not
friends.
Chris Lattner [Tue, 13 Oct 2009 07:14:16 +0000 (07:14 +0000)]
Teach sema and codegen about the difference between address of labels,
which is a common idiom to improve PIC'ness of code using the addr of
label extension. This implementation is a gross hack, but the only other
alternative would be to teach evalutate about this horrid combination.
While GCC allows things like "&&foo - &&bar + 1", people don't use this
in practice. This implements PR5131.
Chris Lattner [Tue, 13 Oct 2009 06:55:33 +0000 (06:55 +0000)]
reimplement codegen for indirect goto with the following advantages:
1. CGF now has fewer bytes of state (one pointer instead of a vector).
2. The generated code is determinstic, instead of getting labels in
'map order' based on pointer addresses.
3. Clang now emits one 'indirect goto switch' for each function, instead
of one for each indirect goto. This fixes an M*N = N^2 IR size issue
when there are lots of address-taken labels and lots of indirect gotos.
4. This also makes the default cause do something useful, reducing the
size of the jump table needed (by one).
Chris Lattner [Tue, 13 Oct 2009 06:04:29 +0000 (06:04 +0000)]
number address-taken labels from 1. This allows 0 to be used as a sentinel
for a null pointer. In other words, "&&foo != NULL" will always work out to
true.
Douglas Gregor [Mon, 12 Oct 2009 23:11:44 +0000 (23:11 +0000)]
When declaring a class template whose name is qualified, make sure
that the scope in which it is being declared is complete. Also, when
instantiating a member class template's ClassTemplateDecl, be sure to
delay type creation so that the resulting type is dependent. Ick.
Douglas Gregor [Mon, 12 Oct 2009 22:27:17 +0000 (22:27 +0000)]
Permit explicit specialization of member functions of class templates
that are declarations (rather than definitions). Also, be sure to set
the access specifiers properly when instantiating the declarations of
member function templates.
John McCall [Mon, 12 Oct 2009 21:59:07 +0000 (21:59 +0000)]
Implement -Wparentheses: warn about using assignments in contexts that require
conditions. Add a fixit to insert the parentheses. Also fix a very minor
possible memory leak in 'for' conditions.
Ted Kremenek [Mon, 12 Oct 2009 20:55:07 +0000 (20:55 +0000)]
Use a BumpPtrAllocator to allocate all aspects of CFG, including CFGBlocks, successor and predecessor vectors, etc.
Speedup: when doing 'clang-cc -analyze -dump-cfg' (without actual printing, just
CFG building) on the amalgamated SQLite source (all of SQLite in one source
file), runtime reduced by 9%.
Douglas Gregor [Mon, 12 Oct 2009 20:18:28 +0000 (20:18 +0000)]
Diagnose the declaration of explicit specializations after an implicit
instantiation has already been required. To do so, keep track of the
point of instantiation for anything that can be instantiated.