Add VarDecl::getStorageClassSpecifierString (StorageClass -> const char*).

- No functionality change.

llvm-svn: 69019
This commit is contained in:
Daniel Dunbar 2009-04-14 02:08:49 +00:00
parent b866ce73b2
commit b76b745707
2 changed files with 21 additions and 0 deletions

View File

@ -221,6 +221,13 @@ public:
enum StorageClass {
None, Auto, Register, Extern, Static, PrivateExtern
};
/// getStorageClassSpecifierString - Return the string used to
/// specify the storage class \arg SC.
///
/// It is illegal to call this function with SC == None.
static const char *getStorageClassSpecifierString(StorageClass SC);
private:
Stmt *Init;
// FIXME: This can be packed into the bitfields in Decl.

View File

@ -60,6 +60,20 @@ ImplicitParamDecl *ImplicitParamDecl::Create(ASTContext &C, DeclContext *DC,
return new (C) ImplicitParamDecl(ImplicitParam, DC, L, Id, T);
}
const char *VarDecl::getStorageClassSpecifierString(StorageClass SC) {
switch (SC) {
case VarDecl::None: break;
case VarDecl::Auto: return "auto"; break;
case VarDecl::Extern: return "extern"; break;
case VarDecl::PrivateExtern: return "__private_extern__"; break;
case VarDecl::Register: return "register"; break;
case VarDecl::Static: return "static"; break;
}
assert(0 && "Invalid storage class");
return 0;
}
ParmVarDecl *ParmVarDecl::Create(ASTContext &C, DeclContext *DC,
SourceLocation L, IdentifierInfo *Id,
QualType T, StorageClass S,