forked from qt-creator/qt-creator
Set and propagate the `auto' specifier.
This commit is contained in:
@@ -231,6 +231,8 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast)
|
|||||||
|
|
||||||
if (ty.isFriend())
|
if (ty.isFriend())
|
||||||
symbol->setStorage(Symbol::Friend);
|
symbol->setStorage(Symbol::Friend);
|
||||||
|
else if (ty.isAuto())
|
||||||
|
symbol->setStorage(Symbol::Auto);
|
||||||
else if (ty.isRegister())
|
else if (ty.isRegister())
|
||||||
symbol->setStorage(Symbol::Register);
|
symbol->setStorage(Symbol::Register);
|
||||||
else if (ty.isStatic())
|
else if (ty.isStatic())
|
||||||
@@ -241,7 +243,8 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast)
|
|||||||
symbol->setStorage(Symbol::Mutable);
|
symbol->setStorage(Symbol::Mutable);
|
||||||
else if (ty.isTypedef())
|
else if (ty.isTypedef())
|
||||||
symbol->setStorage(Symbol::Typedef);
|
symbol->setStorage(Symbol::Typedef);
|
||||||
else if (ty.isDeprecated())
|
|
||||||
|
if (ty.isDeprecated())
|
||||||
symbol->setDeprecated(true);
|
symbol->setDeprecated(true);
|
||||||
|
|
||||||
if (it->value && it->value->initializer) {
|
if (it->value && it->value->initializer) {
|
||||||
|
|||||||
@@ -140,6 +140,13 @@ bool CheckSpecifier::visit(SimpleSpecifierAST *ast)
|
|||||||
_fullySpecifiedType.setFriend(true);
|
_fullySpecifiedType.setFriend(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case T_AUTO:
|
||||||
|
if (_fullySpecifiedType.isAuto())
|
||||||
|
translationUnit()->error(ast->specifier_token,
|
||||||
|
"duplicate `%s'", spell(ast->specifier_token));
|
||||||
|
_fullySpecifiedType.setAuto(true);
|
||||||
|
break;
|
||||||
|
|
||||||
case T_REGISTER:
|
case T_REGISTER:
|
||||||
if (_fullySpecifiedType.isRegister())
|
if (_fullySpecifiedType.isRegister())
|
||||||
translationUnit()->error(ast->specifier_token,
|
translationUnit()->error(ast->specifier_token,
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ FullySpecifiedType FullySpecifiedType::qualifiedType() const
|
|||||||
{
|
{
|
||||||
FullySpecifiedType ty = *this;
|
FullySpecifiedType ty = *this;
|
||||||
ty.setFriend(false);
|
ty.setFriend(false);
|
||||||
|
ty.setAuto(false);
|
||||||
ty.setRegister(false);
|
ty.setRegister(false);
|
||||||
ty.setStatic(false);
|
ty.setStatic(false);
|
||||||
ty.setExtern(false);
|
ty.setExtern(false);
|
||||||
@@ -119,6 +120,12 @@ bool FullySpecifiedType::isFriend() const
|
|||||||
void FullySpecifiedType::setFriend(bool isFriend)
|
void FullySpecifiedType::setFriend(bool isFriend)
|
||||||
{ f._isFriend = isFriend; }
|
{ f._isFriend = isFriend; }
|
||||||
|
|
||||||
|
bool FullySpecifiedType::isAuto() const
|
||||||
|
{ return f._isAuto; }
|
||||||
|
|
||||||
|
void FullySpecifiedType::setAuto(bool isAuto)
|
||||||
|
{ f._isAuto = isAuto; }
|
||||||
|
|
||||||
bool FullySpecifiedType::isRegister() const
|
bool FullySpecifiedType::isRegister() const
|
||||||
{ return f._isRegister; }
|
{ return f._isRegister; }
|
||||||
|
|
||||||
@@ -225,6 +232,7 @@ void FullySpecifiedType::copySpecifiers(const FullySpecifiedType &type)
|
|||||||
{
|
{
|
||||||
// class storage specifiers
|
// class storage specifiers
|
||||||
f._isFriend = type.f._isFriend;
|
f._isFriend = type.f._isFriend;
|
||||||
|
f._isAuto = type.f._isAuto;
|
||||||
f._isRegister = type.f._isRegister;
|
f._isRegister = type.f._isRegister;
|
||||||
f._isStatic = type.f._isStatic;
|
f._isStatic = type.f._isStatic;
|
||||||
f._isExtern = type.f._isExtern;
|
f._isExtern = type.f._isExtern;
|
||||||
|
|||||||
@@ -83,6 +83,9 @@ public:
|
|||||||
bool isFriend() const;
|
bool isFriend() const;
|
||||||
void setFriend(bool isFriend);
|
void setFriend(bool isFriend);
|
||||||
|
|
||||||
|
bool isAuto() const;
|
||||||
|
void setAuto(bool isAuto);
|
||||||
|
|
||||||
bool isRegister() const;
|
bool isRegister() const;
|
||||||
void setRegister(bool isRegister);
|
void setRegister(bool isRegister);
|
||||||
|
|
||||||
@@ -141,6 +144,7 @@ private:
|
|||||||
|
|
||||||
// storage class specifiers
|
// storage class specifiers
|
||||||
unsigned _isFriend: 1;
|
unsigned _isFriend: 1;
|
||||||
|
unsigned _isAuto: 1;
|
||||||
unsigned _isRegister: 1;
|
unsigned _isRegister: 1;
|
||||||
unsigned _isStatic: 1;
|
unsigned _isStatic: 1;
|
||||||
unsigned _isExtern: 1;
|
unsigned _isExtern: 1;
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ public:
|
|||||||
enum Storage {
|
enum Storage {
|
||||||
NoStorage = 0,
|
NoStorage = 0,
|
||||||
Friend,
|
Friend,
|
||||||
|
Auto,
|
||||||
Register,
|
Register,
|
||||||
Static,
|
Static,
|
||||||
Extern,
|
Extern,
|
||||||
|
|||||||
Reference in New Issue
Block a user