forked from qt-creator/qt-creator
C++: Support noexcept operator
The code model failed to parse the noexcept operator which is often used in noexcept specifiers, e.g.: "void f() noexcept(noexcept(g()));" Consequently some c++11 headers such as unordered_map, array and unordered_set could not be parsed and no code completition was available. I have created the NoExceptOperatorExpressionAST class which is created whenever a noexcept token is found in an expression with operator precedence. The noExcept test case in the cplusplus/cxx11 test now contains a function that uses the noexcept operator. Fixed noexcept operator parsing Added the test requested by Sergey Shambir, which then revealed that i had not implemeneted the noexpect operator parsing according to the c++ specification. As stated here http://cpp0x.centaur.ath.cx/expr.unary.noexcept.html the noexcept operator is a unary-expression that contains an expression (and not a constant-expression). This should now be fixed. Change-Id: Id4a99a43b660bd83e7680274491d99a698b57094 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
@@ -1381,6 +1381,12 @@ bool FindUsages::visit(ThrowExpressionAST *ast)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FindUsages::visit(NoExceptOperatorExpressionAST* ast)
|
||||
{
|
||||
this->expression(ast->expression);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FindUsages::visit(TypeIdAST *ast)
|
||||
{
|
||||
for (SpecifierListAST *it = ast->type_specifier_list; it; it = it->next) {
|
||||
|
||||
@@ -205,6 +205,7 @@ protected:
|
||||
virtual bool visit(NestedExpressionAST *ast);
|
||||
virtual bool visit(StringLiteralAST *ast);
|
||||
virtual bool visit(ThrowExpressionAST *ast);
|
||||
virtual bool visit(NoExceptOperatorExpressionAST *ast);
|
||||
virtual bool visit(TypeIdAST *ast);
|
||||
virtual bool visit(UnaryExpressionAST *ast);
|
||||
virtual bool visit(ObjCMessageExpressionAST *ast);
|
||||
|
||||
Reference in New Issue
Block a user