forked from qt-creator/qt-creator
CPlusPlus: Store concept name as QualifiedNameAST
This simplifies the code and improves handling of nested template type parameters in some contexts. Fixes: QTCREATORBUG-32079 Change-Id: Ifb28fc19ab3cb1747df097589027bb8e33cf037a Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
2
src/libs/3rdparty/cplusplus/AST.cpp
vendored
2
src/libs/3rdparty/cplusplus/AST.cpp
vendored
@@ -4667,8 +4667,6 @@ int NoExceptOperatorExpressionAST::lastToken() const
|
|||||||
|
|
||||||
int TypeConstraintAST::firstToken() const
|
int TypeConstraintAST::firstToken() const
|
||||||
{
|
{
|
||||||
if (nestedName)
|
|
||||||
return nestedName->firstToken();
|
|
||||||
return conceptName->firstToken();
|
return conceptName->firstToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
3
src/libs/3rdparty/cplusplus/AST.h
vendored
3
src/libs/3rdparty/cplusplus/AST.h
vendored
@@ -646,8 +646,7 @@ protected:
|
|||||||
class CPLUSPLUS_EXPORT TypeConstraintAST: public AST
|
class CPLUSPLUS_EXPORT TypeConstraintAST: public AST
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NestedNameSpecifierListAST *nestedName = nullptr;
|
QualifiedNameAST *conceptName = nullptr;
|
||||||
NameAST *conceptName = nullptr;
|
|
||||||
int lessToken = 0;
|
int lessToken = 0;
|
||||||
ExpressionListAST *templateArgs = nullptr;
|
ExpressionListAST *templateArgs = nullptr;
|
||||||
int greaterToken = 0;
|
int greaterToken = 0;
|
||||||
|
3
src/libs/3rdparty/cplusplus/ASTClone.cpp
vendored
3
src/libs/3rdparty/cplusplus/ASTClone.cpp
vendored
@@ -144,9 +144,6 @@ DecltypeSpecifierAST *DecltypeSpecifierAST::clone(MemoryPool *pool) const
|
|||||||
TypeConstraintAST *TypeConstraintAST::clone(MemoryPool *pool) const
|
TypeConstraintAST *TypeConstraintAST::clone(MemoryPool *pool) const
|
||||||
{
|
{
|
||||||
const auto ast = new (pool) TypeConstraintAST;
|
const auto ast = new (pool) TypeConstraintAST;
|
||||||
for (NestedNameSpecifierListAST *iter = nestedName, **ast_iter = &ast->nestedName; iter;
|
|
||||||
iter = iter->next, ast_iter = &(*ast_iter)->next)
|
|
||||||
*ast_iter = new (pool) NestedNameSpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
|
|
||||||
if (conceptName)
|
if (conceptName)
|
||||||
ast->conceptName = conceptName->clone(pool);
|
ast->conceptName = conceptName->clone(pool);
|
||||||
ast->lessToken = lessToken;
|
ast->lessToken = lessToken;
|
||||||
|
4
src/libs/3rdparty/cplusplus/ASTMatcher.cpp
vendored
4
src/libs/3rdparty/cplusplus/ASTMatcher.cpp
vendored
@@ -218,10 +218,6 @@ bool ASTMatcher::match(DecltypeSpecifierAST *node, DecltypeSpecifierAST *pattern
|
|||||||
|
|
||||||
bool ASTMatcher::match(TypeConstraintAST *node, TypeConstraintAST *pattern)
|
bool ASTMatcher::match(TypeConstraintAST *node, TypeConstraintAST *pattern)
|
||||||
{
|
{
|
||||||
if (!pattern->nestedName)
|
|
||||||
pattern->nestedName = node->nestedName;
|
|
||||||
else if (!AST::match(node->nestedName, pattern->nestedName, this))
|
|
||||||
return false;
|
|
||||||
if (!pattern->conceptName)
|
if (!pattern->conceptName)
|
||||||
pattern->conceptName = node->conceptName;
|
pattern->conceptName = node->conceptName;
|
||||||
else if (!AST::match(node->conceptName, pattern->conceptName, this))
|
else if (!AST::match(node->conceptName, pattern->conceptName, this))
|
||||||
|
1
src/libs/3rdparty/cplusplus/ASTVisit.cpp
vendored
1
src/libs/3rdparty/cplusplus/ASTVisit.cpp
vendored
@@ -113,7 +113,6 @@ void DecltypeSpecifierAST::accept0(ASTVisitor *visitor)
|
|||||||
void TypeConstraintAST::accept0(ASTVisitor *visitor)
|
void TypeConstraintAST::accept0(ASTVisitor *visitor)
|
||||||
{
|
{
|
||||||
if (visitor->visit(this)) {
|
if (visitor->visit(this)) {
|
||||||
accept(nestedName, visitor);
|
|
||||||
accept(conceptName, visitor);
|
accept(conceptName, visitor);
|
||||||
accept(templateArgs, visitor);
|
accept(templateArgs, visitor);
|
||||||
}
|
}
|
||||||
|
5
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
5
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
@@ -1338,8 +1338,9 @@ bool Parser::parseTypeConstraint(TypeConstraintAST *&node)
|
|||||||
if (!parseUnqualifiedName(conceptName, false))
|
if (!parseUnqualifiedName(conceptName, false))
|
||||||
return false;
|
return false;
|
||||||
const auto typeConstraint = new (_pool) TypeConstraintAST;
|
const auto typeConstraint = new (_pool) TypeConstraintAST;
|
||||||
typeConstraint->nestedName = nestedName;
|
typeConstraint->conceptName = new (_pool) QualifiedNameAST;
|
||||||
typeConstraint->conceptName = conceptName;
|
typeConstraint->conceptName->nested_name_specifier_list = nestedName;
|
||||||
|
typeConstraint->conceptName->unqualified_name = conceptName;
|
||||||
if (LA() != T_LESS) {
|
if (LA() != T_LESS) {
|
||||||
node = typeConstraint;
|
node = typeConstraint;
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user