diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2011-11-08 02:52:52 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2011-11-08 02:52:52 +0000 |
commit | 13330c4e85993b348b94958197f9a5be9b778741 (patch) | |
tree | 9a75b6bc6989e7ad3d3da8dd624f8375f086087f /lib/AST/DeclPrinter.cpp | |
parent | aa9aa3bfcd843caf2612726aa9115b30e7006348 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144062 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclPrinter.cpp')
-rw-r--r-- | lib/AST/DeclPrinter.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/AST/DeclPrinter.cpp b/lib/AST/DeclPrinter.cpp index d3c9c7a1ec..1553af1b13 100644 --- a/lib/AST/DeclPrinter.cpp +++ b/lib/AST/DeclPrinter.cpp @@ -376,7 +376,7 @@ void DeclPrinter::VisitEnumConstantDecl(EnumConstantDecl *D) { 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::VisitLabelDecl(LabelDecl *D) { 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 "; |