r231655 - InheritViz: Hide implementation details

Benjamin Kramer benny.kra at googlemail.com
Mon Mar 9 08:03:20 PDT 2015


Author: d0k
Date: Mon Mar  9 10:03:20 2015
New Revision: 231655

URL: http://llvm.org/viewvc/llvm-project?rev=231655&view=rev
Log:
InheritViz: Hide implementation details

NFC.

Modified:
    cfe/trunk/lib/AST/InheritViz.cpp

Modified: cfe/trunk/lib/AST/InheritViz.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/InheritViz.cpp?rev=231655&r1=231654&r2=231655&view=diff
==============================================================================
--- cfe/trunk/lib/AST/InheritViz.cpp (original)
+++ cfe/trunk/lib/AST/InheritViz.cpp Mon Mar  9 10:03:20 2015
@@ -22,11 +22,9 @@
 #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
@@ -44,7 +42,8 @@ public:
     : 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";
   }
@@ -59,6 +58,7 @@ protected:
   /// (only) virtual base.
   raw_ostream& WriteNodeReference(QualType Type, bool FromVirtual);
 };
+} // namespace
 
 void InheritanceHierarchyWriter::WriteNode(QualType Type, bool FromVirtual) {
   QualType CanonType = Context.getCanonicalType(Type);
@@ -78,7 +78,7 @@ void InheritanceHierarchyWriter::WriteNo
 
   // 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
@@ -139,9 +139,8 @@ void CXXRecordDecl::viewInheritance(ASTC
 
   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;
   }
@@ -159,5 +158,3 @@ void CXXRecordDecl::viewInheritance(ASTC
   // Display the graph
   DisplayGraph(Filename);
 }
-
-}





More information about the cfe-commits mailing list