Teach clang-query to dump types. I couldn't find any existing tests for clang-query's dumping functionality. =(

llvm-svn: 285869
This commit is contained in:
Richard Smith 2016-11-02 23:57:18 +00:00
parent f12918d218
commit 14d0484a16
4 changed files with 14 additions and 4 deletions

View File

@ -985,6 +985,7 @@ public:
void dump(const char *s) const;
void dump() const;
void dump(llvm::raw_ostream &OS) const;
void Profile(llvm::FoldingSetNodeID &ID) const {
ID.AddPointer(getAsOpaquePtr());
@ -2005,6 +2006,7 @@ public:
}
CanQualType getCanonicalTypeUnqualified() const; // in CanonicalType.h
void dump() const;
void dump(llvm::raw_ostream &OS) const;
friend class ASTReader;
friend class ASTWriter;

View File

@ -183,7 +183,7 @@ def ext_hex_constant_invalid : Extension<
def ext_hex_literal_invalid : Extension<
"hexadecimal floating literals are a C++1z feature">, InGroup<CXX1z>;
def warn_cxx1z_hex_literal : Warning<
"hexidecimal floating literals are incompatible with "
"hexadecimal floating literals are incompatible with "
"C++ standards before C++1z">,
InGroup<CXXPre1zCompatPedantic>, DefaultIgnore;
def ext_binary_literal : Extension<

View File

@ -2466,12 +2466,18 @@ void QualType::dump(const char *msg) const {
dump();
}
LLVM_DUMP_METHOD void QualType::dump() const {
ASTDumper Dumper(llvm::errs(), nullptr, nullptr);
LLVM_DUMP_METHOD void QualType::dump() const { dump(llvm::errs()); }
LLVM_DUMP_METHOD void QualType::dump(llvm::raw_ostream &OS) const {
ASTDumper Dumper(OS, nullptr, nullptr);
Dumper.dumpTypeAsChild(*this);
}
LLVM_DUMP_METHOD void Type::dump() const { QualType(this, 0).dump(); }
LLVM_DUMP_METHOD void Type::dump() const { dump(llvm::errs()); }
LLVM_DUMP_METHOD void Type::dump(llvm::raw_ostream &OS) const {
QualType(this, 0).dump(OS);
}
//===----------------------------------------------------------------------===//
// Decl method implementations

View File

@ -135,6 +135,8 @@ void DynTypedNode::dump(llvm::raw_ostream &OS, SourceManager &SM) const {
D->dump(OS);
else if (const Stmt *S = get<Stmt>())
S->dump(OS, SM);
else if (const Type *T = get<Type>())
T->dump(OS);
else
OS << "Unable to dump values of type " << NodeKind.asStringRef() << "\n";
}