- Mar 26, 2009
-
-
Douglas Gregor authored
templates, including in-class initializers. For example: template<typename T, T Divisor> class X { public: static const T value = 10 / Divisor; }; instantiated with, e.g., X<int, 5>::value to get the value '2'. llvm-svn: 67715
-
- Mar 25, 2009
-
-
Douglas Gregor authored
llvm-svn: 67710
-
Douglas Gregor authored
the declarations of member classes are instantiated when the owning class template is instantiated. The definitions of such member classes are instantiated when a complete type is required. This change also introduces the injected-class-name into a class template specialization. llvm-svn: 67707
-
Anders Carlsson authored
class C { C() { } int a; }; C::C() : a(10) { } We also diagnose when initializers are used on declarations that aren't constructors: t.cpp:1:10: error: only constructors take base initializers void f() : a(10) { } ^ Doug and/or Sebastian: I'd appreciate a review, especially the nested-name-spec test results (from the looks of it we now match gcc in that test.) llvm-svn: 67672
-
Douglas Gregor authored
failure to perform a declaration. Instead, explicitly note semantic failures that occur during template parsing with a DeclResult. Fixes PR3872. llvm-svn: 67659
-
- Mar 24, 2009
-
-
Sebastian Redl authored
llvm-svn: 67653
-
Anders Carlsson authored
Fix the bug that Eli noticed where we wouldn't look at function decls outside the class declaration. llvm-svn: 67627
-
Anders Carlsson authored
class C { void g(C c); virtual void f() = 0; }; In this case, C is not known to be abstract when doing semantic analysis on g. This is done by recursively traversing the abstract class and checking the types of member functions. llvm-svn: 67594
-
Douglas Gregor authored
a class template. At present, we can only instantiation normal methods, but not constructors, destructors, or conversion operators. As ever, this contains a bit of refactoring in Sema's type-checking. In particular: - Split ActOnFunctionDeclarator into ActOnFunctionDeclarator (handling the declarator itself) and CheckFunctionDeclaration (checking for the the function declaration), the latter of which is also used by template instantiation. - We were performing the adjustment of function parameter types in three places; collect those into a single new routine. - When the type of a parameter is adjusted, allocate an OriginalParmVarDecl to keep track of the type as it was written. - Eliminate a redundant check for out-of-line declarations of member functions; hide more C++-specific checks on function declarations behind if(getLangOptions().CPlusPlus). llvm-svn: 67575
-
- Mar 23, 2009
-
-
Ted Kremenek authored
llvm-svn: 67569
-
Anders Carlsson authored
llvm-svn: 67542
-
Eli Friedman authored
incompatibilities in assignments from other pointer incompatibilities. Based off of the patch in PR3342. (This doesn't implement -Wno-pointer-sign, but I don't know the driver code very well.) llvm-svn: 67494
-
- Mar 22, 2009
-
-
Anders Carlsson authored
llvm-svn: 67476
-
- Mar 21, 2009
-
-
Douglas Gregor authored
simplify the parsing and action interface for designated initializers. llvm-svn: 67415
-
- Mar 20, 2009
-
-
Douglas Gregor authored
variant of DiagnosticBuilder that emits the template instantiation backtrace when needed. llvm-svn: 67413
-
rdar://problem/6704086Ted Kremenek authored
allow non-literal format strings that are variables that (a) permanently bind to a string constant and (b) whose string constants are resolvable within the same translation unit. llvm-svn: 67404
-
- Mar 19, 2009
-
-
Douglas Gregor authored
dependent qualified-ids such as Fibonacci<N - 1>::value where N is a template parameter. These references are "unresolved" because the name is dependent and, therefore, cannot be resolved to a declaration node (as we would do for a DeclRefExpr or QualifiedDeclRefExpr). UnresolvedDeclRefExprs instantiate to DeclRefExprs, QualifiedDeclRefExprs, etc. Also, be a bit more careful about keeping only a single set of specializations for a class template, and instantiating from the definition of that template rather than a previous declaration. In general, we need a better solution for this for all TagDecls, because it's too easy to accidentally look at a declaration that isn't the definition. We can now process a simple Fibonacci computation described as a template metaprogram. llvm-svn: 67308
-
Douglas Gregor authored
specialization names. This way, we keep track of sugared types like std::vector<Real> I believe we are now using QualifiedNameTypes everywhere we can. Next step: QualifiedDeclRefExprs. llvm-svn: 67268
-
Douglas Gregor authored
qualified name, e.g., foo::x so that we retain the nested-name-specifier as written in the source code and can reproduce that qualified name when printing the types back (e.g., in diagnostics). This is PR3493, which won't be complete until finished the other tasks mentioned near the end of this commit. The parser's representation of nested-name-specifiers, CXXScopeSpec, is now a bit fatter, because it needs to contain the scopes that precede each '::' and keep track of whether the global scoping operator '::' was at the beginning. For example, we need to keep track of the leading '::', 'foo', and 'bar' in ::foo::bar::x The Action's CXXScopeTy * is no longer a DeclContext *. It's now the opaque version of the new NestedNameSpecifier, which contains a single component of a nested-name-specifier (either a DeclContext * or a Type *, bitmangled). The new sugar type QualifiedNameType composes a sequence of NestedNameSpecifiers with a representation of the type we're actually referring to. At present, we only build QualifiedNameType nodes within Sema::getTypeName. This will be extended to other type-constructing actions (e.g., ActOnClassTemplateId). Also on the way: QualifiedDeclRefExprs will also store a sequence of NestedNameSpecifiers, so that we can print out the property nested-name-specifier. I expect to also use this for handling dependent names like Fibonacci<I - 1>::value. llvm-svn: 67265
-
- Mar 18, 2009
-
-
Fariborz Jahanian authored
whose sema decl is at the translation unit. llvm-svn: 67249
-
Douglas Gregor authored
Type pointer. This allows our nested-name-specifiers to retain more information about the actual spelling (e.g., which typedef did the user name, or what exact template arguments were used in the template-id?). It will also allow us to have dependent nested-name-specifiers that don't map to any DeclContext. llvm-svn: 67140
-
- Mar 17, 2009
-
-
Douglas Gregor authored
cleaner visitor framework. Added a visitor for declarations, which is quite similar to the visitor for statatements. llvm-svn: 67104
-
Douglas Gregor authored
quite as great as it sounds, because, while we can refer to the enumerator values outside the template, e.g., adder<long, 3, 4>::value we can't yet refer to them with dependent names, so no Fibonacci (yet). InstantiateClassTemplateSpecialization is getting messy; next commit will put it into a less-ugly state. llvm-svn: 67092
-
Sebastian Redl authored
Almost complete implementation of rvalue references. One bug, and a few unclear areas. Maybe Doug can shed some light on some of the fixmes. llvm-svn: 67059
-
- Mar 15, 2009
-
-
Anders Carlsson authored
llvm-svn: 67031
-
Anders Carlsson authored
Add the ability to clone integer and string literals. Use it when instantiating template expressions. llvm-svn: 67030
-
Sebastian Redl authored
Convert a bunch of actions to smart pointers, and also bring PrintParserCallbacks a bit more in line with reality. llvm-svn: 67029
-
- Mar 14, 2009
-
-
Anders Carlsson authored
More static_assert work. Check that the assert expr is valid and show an error if it's false. Create the declaration and add it to the current context. llvm-svn: 66995
-
Douglas Gregor authored
always, refactored the existing logic to tease apart the parser action and the semantic analysis shared by the parser and template instantiation. llvm-svn: 66987
-
- Mar 13, 2009
-
-
Douglas Gregor authored
- C++ function casts, e.g., T(foo) - sizeof(), alignof() More importantly, this allows us to verify that we're performing overload resolution during template instantiation, with argument-dependent lookup and the "cached" results of name lookup from the template definition. llvm-svn: 66947
-
Douglas Gregor authored
instantiation for binary operators. This change moves most of the operator-overloading code from the parser action ActOnBinOp to a new, parser-independent semantic checking routine CreateOverloadedBinOp. Of particular importance is the fact that CreateOverloadedBinOp does *not* perform any name lookup based on the current parsing context (it doesn't take a Scope*), since it has to be usable during template instantiation, when there is no scope information. Rather, it takes a pre-computed set of functions that are visible from the context or via argument-dependent lookup, and adds to that set any member operators and built-in operator candidates. The set of functions is computed in the parser action ActOnBinOp based on the current context (both operator name lookup and argument-dependent lookup). Within a template, the set computed by ActOnBinOp is saved within the type-dependent AST node and is augmented with the results of argument-dependent name lookup at instantiation time (see TemplateExprInstantiator::VisitCXXOperatorCallExpr). Sadly, we can't fully test this yet. I'll follow up with template instantiation for sizeof so that the real fun can begin. llvm-svn: 66923
-
rdar://problem/6451399Steve Naroff authored
This solution is much simpler (and doesn't add any per-scope overhead, which concerned Chris). The only downside is the LabelMap is now declared in two places (Sema and BlockSemaInfo). My original fix tried to unify the LabelMap in "Scope" (which would support nested functions in general). In any event, this fixes the bug given the current language definition. If/when we decide to support GCC style nested functions, this will need to be tweaked. llvm-svn: 66896
-
Steve Naroff authored
Remove ActiveScope (revert http://llvm.org/viewvc/llvm-project?view=rev&revision=65694 and http://llvm.org/viewvc/llvm-project?view=rev&revision=66741). Will replace with something better today... llvm-svn: 66893
-
Douglas Gregor authored
C++ templates. In particular, keep track of the overloaded operators that are visible from the template definition, so that they can be merged with those operators visible via argument-dependent lookup at instantiation time. Refactored the lookup routines for argument-dependent lookup and for operator name lookup, so they can be called without immediately adding the results to an overload set. Instantiation of these expressions is completely wrong. I'll work on that next. llvm-svn: 66851
-
- Mar 12, 2009
-
-
Douglas Gregor authored
llvm-svn: 66835
-
Douglas Gregor authored
width of bitfields. I'll be burning this down and replacing it with a properly-dispatched implementation like the one used for types. llvm-svn: 66796
-
- Mar 11, 2009
-
-
Douglas Gregor authored
Make sure that we set the access specifier for an instantiated FieldDecl, and that the aggregate and POD flags for an instantiated class template are updated based on instantiation of a FieldDecl llvm-svn: 66701
-
Douglas Gregor authored
for FieldDecls so that the parser and the template instantiation make use of the same semantic checking module. llvm-svn: 66685
-
Douglas Gregor authored
template. More importantly, start to sort out the issues regarding complete types and nested-name-specifiers, especially the question of: when do we instantiate a class template specialization that occurs to the left of a '::' in a nested-name-specifier? llvm-svn: 66662
-
Douglas Gregor authored
translation unit. Thread the various declarations of variables via VarDecl::getPreviousDeclaration. llvm-svn: 66601
-