[cfe-commits] r54116 - in /cfe/trunk: include/clang/AST/Type.h lib/AST/Type.cpp lib/Sema/SemaExpr.cpp
Chris Lattner
sabre at nondot.org
Sat Jul 26 17:48:22 PDT 2008
Author: lattner
Date: Sat Jul 26 19:48:22 2008
New Revision: 54116
URL: http://llvm.org/viewvc/llvm-project?rev=54116&view=rev
Log:
make "call foo.dump()" and "call foo->dump()" work in GDB,
with QualTypes and Types.
Modified:
cfe/trunk/include/clang/AST/Type.h
cfe/trunk/lib/AST/Type.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=54116&r1=54115&r2=54116&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Sat Jul 26 19:48:22 2008
@@ -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; }
Modified: cfe/trunk/lib/AST/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=54116&r1=54115&r2=54116&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Type.cpp (original)
+++ cfe/trunk/lib/AST/Type.cpp Sat Jul 26 19:48:22 2008
@@ -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.
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=54116&r1=54115&r2=54116&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Sat Jul 26 19:48:22 2008
@@ -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());
}
More information about the cfe-commits
mailing list