forked from qt-creator/qt-creator
C++: Recognize C++11 nullptr
Change-Id: I5b7ac8f9b2137ffe9439ada4ec4aeb9cee8e249d Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
This commit is contained in:
17
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
17
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
@@ -3865,6 +3865,18 @@ bool Parser::parseNumericLiteral(ExpressionAST *&node)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Parser::parsePointerLiteral(ExpressionAST *&node)
|
||||
{
|
||||
DEBUG_THIS_RULE();
|
||||
if (LA() == T_NULLPTR) {
|
||||
PointerLiteralAST *ast = new (_pool) PointerLiteralAST;
|
||||
ast->literal_token = consumeToken();
|
||||
node = ast;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Parser::parseThisExpression(ExpressionAST *&node)
|
||||
{
|
||||
DEBUG_THIS_RULE();
|
||||
@@ -3885,6 +3897,11 @@ bool Parser::parsePrimaryExpression(ExpressionAST *&node)
|
||||
case T_WIDE_STRING_LITERAL:
|
||||
return parseStringLiteral(node);
|
||||
|
||||
case T_NULLPTR:
|
||||
if (_cxx0xEnabled)
|
||||
return parsePointerLiteral(node);
|
||||
// fall-through
|
||||
|
||||
case T_CHAR_LITERAL: // ### FIXME don't use NumericLiteral for chars
|
||||
case T_WIDE_CHAR_LITERAL:
|
||||
case T_NUMERIC_LITERAL:
|
||||
|
Reference in New Issue
Block a user