[cfe-commits] r69019 - in /cfe/trunk: include/clang/AST/Decl.h lib/AST/Decl.cpp

Daniel Dunbar daniel at zuster.org
Mon Apr 13 19:08:49 PDT 2009


Author: ddunbar
Date: Mon Apr 13 21:08:49 2009
New Revision: 69019

URL: http://llvm.org/viewvc/llvm-project?rev=69019&view=rev
Log:
Add VarDecl::getStorageClassSpecifierString (StorageClass -> const char*).
 - No functionality change.

Modified:
    cfe/trunk/include/clang/AST/Decl.h
    cfe/trunk/lib/AST/Decl.cpp

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=69019&r1=69018&r2=69019&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Mon Apr 13 21:08:49 2009
@@ -221,6 +221,13 @@
   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.

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=69019&r1=69018&r2=69019&view=diff

==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Mon Apr 13 21:08:49 2009
@@ -60,6 +60,20 @@
   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,





More information about the cfe-commits mailing list