aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-05-29 20:38:28 +0000
committerDouglas Gregor <dgregor@apple.com>2009-05-29 20:38:28 +0000
commitd249e1d1f1498b81314459ceda19d6ff25c278ad (patch)
tree64980c7c4974845750bbfefa695204a8feff0861 /lib/AST/Decl.cpp
parente540858b289b23653bcb23646f135729203635cb (diff)
Create a new PrintingPolicy class, which we pass down through the AST
printing logic to help customize the output. For now, we use this rather than a special flag to suppress the "struct" when printing "struct X" and to print the Boolean type as "bool" in C++ but "_Bool" in C. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72590 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r--lib/AST/Decl.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index 063914092e..cb3ec1f487 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -18,6 +18,7 @@
#include "clang/AST/ASTContext.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/Expr.h"
+#include "clang/AST/PrettyPrinter.h"
#include "clang/Basic/IdentifierTable.h"
#include <vector>
@@ -224,10 +225,13 @@ std::string NamedDecl::getQualifiedNameAsString() const {
if (const ClassTemplateSpecializationDecl *Spec
= dyn_cast<ClassTemplateSpecializationDecl>(Ctx)) {
const TemplateArgumentList &TemplateArgs = Spec->getTemplateArgs();
+ PrintingPolicy Policy;
+ Policy.CPlusPlus = true;
std::string TemplateArgsStr
= TemplateSpecializationType::PrintTemplateArgumentList(
TemplateArgs.getFlatArgumentList(),
- TemplateArgs.flat_size());
+ TemplateArgs.flat_size(),
+ Policy);
Names.push_back(Spec->getIdentifier()->getName() + TemplateArgsStr);
} else if (const NamedDecl *ND = dyn_cast<NamedDecl>(Ctx))
Names.push_back(ND->getNameAsString());