[cfe-commits] r144062 - /cfe/trunk/lib/AST/DeclPrinter.cpp
Peter Collingbourne
peter at pcc.me.uk
Mon Nov 7 18:52:53 PST 2011
Author: pcc
Date: Mon Nov 7 20:52:52 2011
New Revision: 144062
URL: http://llvm.org/viewvc/llvm-project?rev=144062&view=rev
Log:
DeclPrinter: print the declaration's storage class specifier as
written, instead of the resolved storage class, which might not be
legal to specify on the declaration (such as out-of-line definitions
of static class members in C++, and __local variables in OpenCL).
Initial patch by Richard Membarth.
Modified:
cfe/trunk/lib/AST/DeclPrinter.cpp
Modified: cfe/trunk/lib/AST/DeclPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclPrinter.cpp?rev=144062&r1=144061&r2=144062&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclPrinter.cpp (original)
+++ cfe/trunk/lib/AST/DeclPrinter.cpp Mon Nov 7 20:52:52 2011
@@ -376,7 +376,7 @@
void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {
if (!Policy.SuppressSpecifiers) {
- switch (D->getStorageClass()) {
+ switch (D->getStorageClassAsWritten()) {
case SC_None: break;
case SC_Extern: Out << "extern "; break;
case SC_Static: Out << "static "; break;
@@ -596,8 +596,9 @@
void DeclPrinter::VisitVarDecl(VarDecl *D) {
- if (!Policy.SuppressSpecifiers && D->getStorageClass() != SC_None)
- Out << VarDecl::getStorageClassSpecifierString(D->getStorageClass()) << " ";
+ StorageClass SCAsWritten = D->getStorageClassAsWritten();
+ if (!Policy.SuppressSpecifiers && SCAsWritten != SC_None)
+ Out << VarDecl::getStorageClassSpecifierString(SCAsWritten) << " ";
if (!Policy.SuppressSpecifiers && D->isThreadSpecified())
Out << "__thread ";
More information about the cfe-commits
mailing list