#include "llvm/Support/raw_ostream.h"
#include <map>
#include <set>
+using namespace clang;
-using namespace llvm;
-
-namespace clang {
-
+namespace {
/// InheritanceHierarchyWriter - Helper class that writes out a
/// GraphViz file that diagrams the inheritance hierarchy starting at
/// a given C++ class type. Note that we do not use LLVM's
: Context(Context), Out(Out) { }
void WriteGraph(QualType Type) {
- Out << "digraph \"" << DOT::EscapeString(Type.getAsString()) << "\" {\n";
+ Out << "digraph \"" << llvm::DOT::EscapeString(Type.getAsString())
+ << "\" {\n";
WriteNode(Type, false);
Out << "}\n";
}
/// (only) virtual base.
raw_ostream& WriteNodeReference(QualType Type, bool FromVirtual);
};
+} // namespace
void InheritanceHierarchyWriter::WriteNode(QualType Type, bool FromVirtual) {
QualType CanonType = Context.getCanonicalType(Type);
// Give the node a label based on the name of the class.
std::string TypeName = Type.getAsString();
- Out << " [ shape=\"box\", label=\"" << DOT::EscapeString(TypeName);
+ Out << " [ shape=\"box\", label=\"" << llvm::DOT::EscapeString(TypeName);
// If the name of the class was a typedef or something different
// from the "real" class name, show the real class name in
int FD;
SmallString<128> Filename;
- std::error_code EC =
- sys::fs::createTemporaryFile(Self.getAsString(), "dot", FD, Filename);
- if (EC) {
+ if (std::error_code EC = llvm::sys::fs::createTemporaryFile(
+ Self.getAsString(), "dot", FD, Filename)) {
llvm::errs() << "Error: " << EC.message() << "\n";
return;
}
// Display the graph
DisplayGraph(Filename);
}
-
-}