Douglas Gregor [Thu, 27 Aug 2009 16:57:43 +0000 (16:57 +0000)]
Implement instantiation of the declarations of member function
templates within class templates, producing a member function template
of a class template specialization. If you can parse that, I'm
sorry. Example:
When we instantiate X<int>, we now instantiate the declaration
X<int>::f, which looks like this:
template<typename U> void X<int>::f(int, U);
The path this takes through
TemplateDeclInstantiator::VisitCXXMethodDecl is convoluted and
ugly, but I don't know how to improve it yet. I'm resting my hopes on
the multi-level substitution required to instantiate definitions of
nested templates, which may simplify this code as well.
Anders Carlsson [Thu, 27 Aug 2009 03:53:50 +0000 (03:53 +0000)]
In ActOnCXXTypeConstructExpr, check that the type is complete and non-abstract before creating any expressions. This assures that any templates are instantiated if necessary.
Ted Kremenek [Thu, 27 Aug 2009 01:39:13 +0000 (01:39 +0000)]
Simplify 'Environment' to contain only one map from 'const Stmt*' to SVals, greatly simplifying the logic of the analyzer in many places. We now only distinguish between block-level expressions and subexpressions in Environment::RemoveDeadBindings and GRState pretty-printing.
Douglas Gregor [Wed, 26 Aug 2009 22:36:53 +0000 (22:36 +0000)]
When a member reference expression includes a qualifier on the member
name, e.g.,
x->Base::f()
retain the qualifier (and its source range information) in a new
subclass of MemberExpr called CXXQualifiedMemberExpr. Provide
construction, transformation, profiling, printing, etc., for this new
expression type.
When a virtual function is called via a qualified name, don't emit a
virtual call. Instead, call that function directly. Mike, could you
add a CodeGen test for this, too?
Anders Carlsson [Wed, 26 Aug 2009 22:33:56 +0000 (22:33 +0000)]
Add a RequireCompleteType variant that takes a PartialDiagnostic. The old RequireCompleteType now creates a PartialDiagnostic and calls the new function.
Mike Stump [Wed, 26 Aug 2009 20:46:33 +0000 (20:46 +0000)]
Implement virtual dispatch. :-) This is self-consistent with clang,
but not yet necessarily perfectly consistent with gcc. Also addressed
Doug and John's comments.
Eli Friedman [Wed, 26 Aug 2009 20:01:39 +0000 (20:01 +0000)]
Make address-space qualification work correctly for compound literals.
Issue reported on cfe-dev.
Also fixed the code to use isConstant to determine whether to generate a
constant global, to be consistent with CodeGenModule. This probably
needs to be refactored to deal with C++, though.
Douglas Gregor [Wed, 26 Aug 2009 18:27:52 +0000 (18:27 +0000)]
When we know that we are parsing a class-name, implicitly construct a
TypenameType if getTypeName is looking at a member of an unknown
specialization. This allows us to properly parse class templates that
derived from type that could only otherwise be described by a typename type,
e.g.,
template<class T> struct X {};
template<typename T> struct Y : public X<T>::X { };
Douglas Gregor [Wed, 26 Aug 2009 00:04:55 +0000 (00:04 +0000)]
Improve diagnostics and recovery when the nested-name-specifier of a
qualified name does not actually refer into a class/class
template/class template partial specialization.
Improve printing of nested-name-specifiers to eliminate redudant
qualifiers. Also, make it possible to output a nested-name-specifier
through a DiagnosticBuilder, although there are relatively few places
that will use this leeway.
Ted Kremenek [Tue, 25 Aug 2009 23:29:04 +0000 (23:29 +0000)]
Fix regression in BasicStoreManager caused by implicitly casting loaded values and trying to load/store from arrays. RegionStoreManager already properly handles these cases well; we just need to gracefully not handle this case in BasicStoreManager. This fixes PR 4781.
Ted Kremenek [Tue, 25 Aug 2009 22:55:09 +0000 (22:55 +0000)]
Handle pointer arithmetic in RegionStoreManager involving Objective-C pointers
when using the non-fragile Objective-C ABI. This fixes <rdar://problem/7168531>.
Douglas Gregor [Tue, 25 Aug 2009 22:51:20 +0000 (22:51 +0000)]
Improve support for out-of-line definitions of nested templates and
their members, including member class template, member function
templates, and member classes and functions of member templates.
To actually parse the nested-name-specifiers that qualify the name of
an out-of-line definition of a member template, e.g.,
template<typename X> template<typename Y>
X Outer<X>::Inner1<Y>::foo(Y) {
return X();
}
we need to look for the template names (e.g., "Inner1") as a member of
the current instantiation (Outer<X>), even before we have entered the
scope of the current instantiation. Since we can't do this in general
(i.e., we should not be looking into all dependent
nested-name-specifiers as if they were the current instantiation), we
rely on the parser to tell us when it is parsing a declaration
specifier sequence, and, therefore, when we should consider the
current scope specifier to be a current instantiation.
Printing of complicated, dependent nested-name-specifiers may be
somewhat broken by this commit; I'll add tests for this issue and fix
the problem (if it still exists) in a subsequent commit.
Ted Kremenek [Tue, 25 Aug 2009 20:51:30 +0000 (20:51 +0000)]
Fix crash reported in <rdar://problem/7124210> by "back-porting" some of the
implicit cast logic in RegionStoreManager to BasicStoreManager. This involved
moving CastRetriedVal from RegionStoreManager to StoreManager.
John McCall [Tue, 25 Aug 2009 17:53:59 +0000 (17:53 +0000)]
Modify an assert to capture the restriction on friend declarations more
accurately. Prevents the assert from triggering incorrectly when friending
functions first declared in extern "C" contexts. Fixes bug 4757.
Douglas Gregor [Tue, 25 Aug 2009 17:23:04 +0000 (17:23 +0000)]
Implement out-of-line definitions of nested class templates. Most of
the logic is there for out-of-line definitions with multiple levels of
nested templates, but this is still a work-in-progress: we're having
trouble determining when we should look into a dependent
nested-name-specifier.
Anders Carlsson [Tue, 25 Aug 2009 13:46:13 +0000 (13:46 +0000)]
If a parameter has a default argument expression, make sure to instantiate the parameter type before checking that the expression is a valid initializer.
Zhongxing Xu [Tue, 25 Aug 2009 06:51:30 +0000 (06:51 +0000)]
Remove CodeDecl and CFG from GRExprEngine and GRStateManager.
Now AnalysisManager is the only place we can get CodeDecl.
This leads to an API change: GRState::bindExpr() now takes the CFG argument.
Douglas Gregor [Mon, 24 Aug 2009 23:03:25 +0000 (23:03 +0000)]
Keep track of the template parameter depth properly when we have
member templates declared inside other templates. This allows us to
match out-of-line definitions of member function templates within
class templates to the declarations within the class template. We
still can't handle out-of-line definitions for member class templates,
however.
Ted Kremenek [Mon, 24 Aug 2009 22:47:34 +0000 (22:47 +0000)]
ConstraintManager::AssumeDual now accepts a 'DefinedSVal' instead of 'SVal' for
the condition. This eliminates a source of bugs where the client doesn't
correctly reason about undefined or unknown values. This fixes PR 4759.