make "call foo.dump()" and "call foo->dump()" work in GDB,
with QualTypes and Types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54116 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h
index 40d550a..952a5dd 100644
--- a/include/clang/AST/Type.h
+++ b/include/clang/AST/Type.h
@@ -161,7 +161,8 @@
}
void getAsStringInternal(std::string &Str) const;
- void dump(const char *s = 0) const;
+ void dump(const char *s) const;
+ void dump() const;
void Profile(llvm::FoldingSetNodeID &ID) const {
ID.AddPointer(getAsOpaquePtr());
@@ -394,6 +395,7 @@
QualType getCanonicalTypeInternal() const { return CanonicalType; }
friend class QualType;
public:
+ void dump() const;
virtual void getAsStringInternal(std::string &InnerString) const = 0;
static bool classof(const Type *) { return true; }
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index d5bef07..d32f963 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -810,6 +810,17 @@
else
fprintf(stderr, "%s\n", R.c_str());
}
+void QualType::dump() const {
+ dump("");
+}
+
+void Type::dump() const {
+ std::string S = "identifier";
+ getAsStringInternal(S);
+ fprintf(stderr, "%s\n", S.c_str());
+}
+
+
static void AppendTypeQualList(std::string &S, unsigned TypeQuals) {
// Note: funkiness to ensure we get a space only between quals.
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 37e4ec7..56632d1 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -2052,6 +2052,7 @@
} else
assert(0 && "Unknown/unexpected decl type");
}
+
// If the operand has type "type", the result has type "pointer to type".
return Context.getPointerType(op->getType());
}