diff options
| author | Vassil Vassilev <v.g.vassilev@gmail.com> | 2016-07-08 21:09:08 +0000 |
|---|---|---|
| committer | Vassil Vassilev <v.g.vassilev@gmail.com> | 2016-07-08 21:09:08 +0000 |
| commit | 1002373946a7c8452cd1a75b4f67515b49b43e3f (patch) | |
| tree | e705462fd7607678859988867b61aaa635542015 /clang/lib/AST | |
| parent | 5246482c7aa5507cfe1ef8756262d06a9f45a7d4 (diff) | |
| download | bcm5719-llvm-1002373946a7c8452cd1a75b4f67515b49b43e3f.tar.gz bcm5719-llvm-1002373946a7c8452cd1a75b4f67515b49b43e3f.zip | |
Teach -ast-print to print constexpr variables.
Patch reviewed by Richard Smith (D22168).
llvm-svn: 274930
Diffstat (limited to 'clang/lib/AST')
| -rw-r--r-- | clang/lib/AST/DeclPrinter.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp index bfdb47b90d8..7e786990bec 100644 --- a/clang/lib/AST/DeclPrinter.cpp +++ b/clang/lib/AST/DeclPrinter.cpp @@ -715,6 +715,11 @@ void DeclPrinter::VisitLabelDecl(LabelDecl *D) { void DeclPrinter::VisitVarDecl(VarDecl *D) { prettyPrintPragmas(D); + + QualType T = D->getTypeSourceInfo() + ? D->getTypeSourceInfo()->getType() + : D->getASTContext().getUnqualifiedObjCPointerType(D->getType()); + if (!Policy.SuppressSpecifiers) { StorageClass SC = D->getStorageClass(); if (SC != SC_None) @@ -736,11 +741,13 @@ void DeclPrinter::VisitVarDecl(VarDecl *D) { if (D->isModulePrivate()) Out << "__module_private__ "; + + if (D->isConstexpr()) { + Out << "constexpr "; + T.removeLocalConst(); + } } - QualType T = D->getTypeSourceInfo() - ? D->getTypeSourceInfo()->getType() - : D->getASTContext().getUnqualifiedObjCPointerType(D->getType()); printDeclType(T, D->getName()); Expr *Init = D->getInit(); if (!Policy.SuppressInitializers && Init) { |

