]> granicus.if.org Git - clang/commitdiff
make "call foo.dump()" and "call foo->dump()" work in GDB,
authorChris Lattner <sabre@nondot.org>
Sun, 27 Jul 2008 00:48:22 +0000 (00:48 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 27 Jul 2008 00:48:22 +0000 (00:48 +0000)
with QualTypes and Types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54116 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Type.h
lib/AST/Type.cpp
lib/Sema/SemaExpr.cpp

index 40d550a0acf3831b823d9b3317798b1a959ab237..952a5dd9baeb7d24b312d78d24183c36d6c41e1b 100644 (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; }
   
index d5bef07ca96d39716a443a11a501f7e26b4dcd2d..d32f963acb1905734165d0bc1030832a913a3d81 100644 (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.
index 37e4ec715bd85a4f9c560cab982e021135b03543..56632d1d772655fdb332dee885d83693be470f40 100644 (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());
 }