forked from qt-creator/qt-creator
CPlusPlus: Make (sub-)languague selection more generic
Change-Id: I4e2df6992b446adec662ab07671acd41715e41fd Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
12
src/libs/3rdparty/cplusplus/Bind.cpp
vendored
12
src/libs/3rdparty/cplusplus/Bind.cpp
vendored
@@ -347,7 +347,8 @@ FullySpecifiedType Bind::declarator(DeclaratorAST *ast, const FullySpecifiedType
|
||||
|
||||
std::swap(_declaratorId, declaratorId);
|
||||
bool isAuto = false;
|
||||
if (translationUnit()->cxx0xEnabled())
|
||||
const bool cxx11Enabled = translationUnit()->languageFeatures().cxx11Enabled;
|
||||
if (cxx11Enabled)
|
||||
isAuto = type.isAuto();
|
||||
|
||||
for (SpecifierListAST *it = ast->attribute_list; it; it = it->next) {
|
||||
@@ -369,8 +370,7 @@ FullySpecifiedType Bind::declarator(DeclaratorAST *ast, const FullySpecifiedType
|
||||
}
|
||||
if (!type->isFunctionType()) {
|
||||
ExpressionTy initializer = this->expression(ast->initializer);
|
||||
if (translationUnit()->cxx0xEnabled() && isAuto) {
|
||||
|
||||
if (cxx11Enabled && isAuto) {
|
||||
type = initializer;
|
||||
type.setAuto(true);
|
||||
}
|
||||
@@ -1249,7 +1249,7 @@ bool Bind::visit(ForeachStatementAST *ast)
|
||||
DeclaratorIdAST *declaratorId = 0;
|
||||
type = this->declarator(ast->declarator, type, &declaratorId);
|
||||
const StringLiteral *initializer = 0;
|
||||
if (type.isAuto() && translationUnit()->cxx0xEnabled()) {
|
||||
if (type.isAuto() && translationUnit()->languageFeatures().cxx11Enabled) {
|
||||
ExpressionTy exprType = this->expression(ast->expression);
|
||||
|
||||
ArrayType* arrayType = 0;
|
||||
@@ -1299,7 +1299,7 @@ bool Bind::visit(RangeBasedForStatementAST *ast)
|
||||
DeclaratorIdAST *declaratorId = 0;
|
||||
type = this->declarator(ast->declarator, type, &declaratorId);
|
||||
const StringLiteral *initializer = 0;
|
||||
if (type.isAuto() && translationUnit()->cxx0xEnabled()) {
|
||||
if (type.isAuto() && translationUnit()->languageFeatures().cxx11Enabled) {
|
||||
ExpressionTy exprType = this->expression(ast->expression);
|
||||
|
||||
ArrayType* arrayType = 0;
|
||||
@@ -2722,7 +2722,7 @@ bool Bind::visit(SimpleSpecifierAST *ast)
|
||||
break;
|
||||
|
||||
case T_AUTO:
|
||||
if (!translationUnit()->cxx0xEnabled()) {
|
||||
if (!translationUnit()->languageFeatures().cxx11Enabled) {
|
||||
if (_type.isAuto())
|
||||
translationUnit()->error(ast->specifier_token, "duplicate `%s'", spell(ast->specifier_token));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user