Commit e9197468 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

C++: Store template typename argument declarator type

Differentiate class from typename. Used by a follow-up commit for pretty
printing, preserving the original declarator.

Change-Id: I496505f5062abb69d5552e5422db256d49d164c4
Reviewed-by: Nikolai Kosjar's avatarNikolai Kosjar <nikolai.kosjar@qt.io>
parent e920921f
......@@ -2388,9 +2388,11 @@ bool Bind::visit(TypenameTypeParameterAST *ast)
// unsigned dot_dot_dot_token = ast->dot_dot_dot_token;
const Name *name = this->name(ast->name);
ExpressionTy type_id = this->expression(ast->type_id);
CPlusPlus::Kind classKey = translationUnit()->tokenKind(ast->classkey_token);
TypenameArgument *arg = control()->newTypenameArgument(sourceLocation, name);
arg->setType(type_id);
arg->setClassDeclarator(classKey == T_CLASS);
ast->symbol = arg;
_scope->addMember(arg);
return false;
......
......@@ -171,11 +171,13 @@ void Argument::visitSymbol0(SymbolVisitor *visitor)
TypenameArgument::TypenameArgument(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
: Symbol(translationUnit, sourceLocation, name)
, _isClassDeclarator(false)
{ }
TypenameArgument::TypenameArgument(Clone *clone, Subst *subst, TypenameArgument *original)
: Symbol(clone, subst, original)
, _type(clone->type(original->_type, subst))
, _isClassDeclarator(original->_isClassDeclarator)
{ }
TypenameArgument::~TypenameArgument()
......
......@@ -187,6 +187,8 @@ public:
virtual ~TypenameArgument();
void setType(const FullySpecifiedType &type);
void setClassDeclarator(bool isClassDecl) { _isClassDeclarator = isClassDecl; }
bool isClassDeclarator() const { return _isClassDeclarator; }
// Symbol's interface
virtual FullySpecifiedType type() const;
......@@ -202,6 +204,7 @@ protected:
private:
FullySpecifiedType _type;
bool _isClassDeclarator;
};
class CPLUSPLUS_EXPORT Block: public Scope
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment