make "call foo.dump()" and "call foo->dump()" work in GDB,

with QualTypes and Types.

llvm-svn: 54116
This commit is contained in:
Chris Lattner
2008-07-27 00:48:22 +00:00
parent e80159da05
commit 872eb55f5e
3 changed files with 15 additions and 1 deletions

View File

@@ -161,7 +161,8 @@ public:
}
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 @@ private:
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; }

View File

@@ -810,6 +810,17 @@ void QualType::dump(const char *msg) const {
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.

View File

@@ -2052,6 +2052,7 @@ QualType Sema::CheckAddressOfOperand(Expr *op, SourceLocation OpLoc) {
} 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());
}