[cfe-commits] r39556 - /cfe/cfe/trunk/AST/StmtPrinter.cpp
clattner at cs.uiuc.edu
clattner at cs.uiuc.edu
Wed Jul 11 09:45:34 PDT 2007
Author: clattner
Date: Wed Jul 11 11:45:33 2007
New Revision: 39556
URL: http://llvm.org/viewvc/llvm-project?rev=39556&view=rev
Log:
Pretty print storage classes for vardecls.
Modified:
cfe/cfe/trunk/AST/StmtPrinter.cpp
Modified: cfe/cfe/trunk/AST/StmtPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/StmtPrinter.cpp?rev=39556&r1=39555&r2=39556&view=diff
==============================================================================
--- cfe/cfe/trunk/AST/StmtPrinter.cpp (original)
+++ cfe/cfe/trunk/AST/StmtPrinter.cpp Wed Jul 11 11:45:33 2007
@@ -98,9 +98,22 @@
Indent() << "typedef " << localType->getUnderlyingType().getAsString();
OS << " " << localType->getName() << ";\n";
} else if (ValueDecl *VD = dyn_cast<ValueDecl>(Node->getDecl())) {
+ Indent();
+ // Emit storage class for vardecls.
+ if (VarDecl *V = dyn_cast<VarDecl>(VD)) {
+ switch (V->getStorageClass()) {
+ default: assert(0 && "Unknown storage class!");
+ case VarDecl::None: break;
+ case VarDecl::Extern: OS << "extern "; break;
+ case VarDecl::Static: OS << "static "; break;
+ case VarDecl::Auto: OS << "auto "; break;
+ case VarDecl::Register: OS << "register "; break;
+ }
+ }
+
std::string Name = VD->getName();
VD->getType().getAsStringInternal(Name);
- Indent() << Name << ";\n";
+ OS << Name << ";\n";
} else
// FIXME: "struct x;"
assert(0 && "Unexpected decl");
More information about the cfe-commits
mailing list