Add printName to DeclarationName which prints the human-readable name on a
raw_ostream. Use it in getAsString and NamedDecl's raw_ostream operator.
llvm-svn: 101633
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h
index e3e16d3..d409fdb 100644
--- a/clang/include/clang/AST/Decl.h
+++ b/clang/include/clang/AST/Decl.h
@@ -217,7 +217,11 @@
static bool classofKind(Kind K) { return K >= NamedFirst && K <= NamedLast; }
};
-llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const NamedDecl *ND);
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+ const NamedDecl *ND) {
+ ND->getDeclName().printName(OS);
+ return OS;
+}
/// NamespaceDecl - Represent a C++ namespace.
class NamespaceDecl : public NamedDecl, public DeclContext {