You've already forked linux-packaging-mono
acceptance-tests
data
debian
docs
external
Newtonsoft.Json
api-doc-tools
api-snapshot
aspnetwebstack
bdwgc
binary-reference-assemblies
bockbuild
boringssl
cecil
cecil-legacy
corefx
corert
helix-binaries
ikdasm
ikvm
illinker-test-assets
linker
llvm-project
clang
INPUTS
bindings
cmake
docs
examples
include
lib
ARCMigrate
AST
APValue.cpp
ASTConsumer.cpp
ASTContext.cpp.REMOVED.git-id
ASTDiagnostic.cpp
ASTDumper.cpp
ASTImporter.cpp.REMOVED.git-id
ASTStructuralEquivalence.cpp
ASTTypeTraits.cpp
AttrImpl.cpp
CMakeLists.txt
CXXABI.h
CXXInheritance.cpp
Comment.cpp
CommentBriefParser.cpp
CommentCommandTraits.cpp
CommentLexer.cpp
CommentParser.cpp
CommentSema.cpp
DataCollection.cpp
Decl.cpp.REMOVED.git-id
DeclBase.cpp
DeclCXX.cpp.REMOVED.git-id
DeclFriend.cpp
DeclGroup.cpp
DeclObjC.cpp
DeclOpenMP.cpp
DeclPrinter.cpp
DeclTemplate.cpp
DeclarationName.cpp
Expr.cpp.REMOVED.git-id
ExprCXX.cpp
ExprClassification.cpp
ExprConstant.cpp.REMOVED.git-id
ExprObjC.cpp
ExternalASTMerger.cpp
ExternalASTSource.cpp
InheritViz.cpp
ItaniumCXXABI.cpp
ItaniumMangle.cpp.REMOVED.git-id
Linkage.h
Mangle.cpp
MicrosoftCXXABI.cpp
MicrosoftMangle.cpp.REMOVED.git-id
NSAPI.cpp
NestedNameSpecifier.cpp
ODRHash.cpp
OpenMPClause.cpp
ParentMap.cpp
QualTypeNames.cpp
RawCommentList.cpp
RecordLayout.cpp
RecordLayoutBuilder.cpp.REMOVED.git-id
SelectorLocationsKind.cpp
Stmt.cpp
StmtCXX.cpp
StmtIterator.cpp
StmtObjC.cpp
StmtOpenMP.cpp
StmtPrinter.cpp
StmtProfile.cpp
StmtViz.cpp
TemplateBase.cpp
TemplateName.cpp
Type.cpp.REMOVED.git-id
TypeLoc.cpp
TypePrinter.cpp
VTTBuilder.cpp
VTableBuilder.cpp.REMOVED.git-id
ASTMatchers
Analysis
Basic
CodeGen
CrossTU
Driver
Edit
Format
Frontend
FrontendTool
Headers
Index
Lex
Parse
Rewrite
Sema
Serialization
StaticAnalyzer
Tooling
CMakeLists.txt
runtime
tools
unittests
utils
www
.arcconfig
.clang-format
.clang-tidy
.gitignore
CMakeLists.txt
CODE_OWNERS.TXT
INSTALL.txt
LICENSE.TXT
ModuleInfo.txt
NOTES.txt
README.txt
clang-tools-extra
compiler-rt
libcxx
libcxxabi
libunwind
lld
lldb
llvm
openmp
polly
nuget-buildtasks
nunit-lite
roslyn-binaries
rx
xunit-binaries
how-to-bump-roslyn-binaries.md
ikvm-native
llvm
m4
man
mcs
mk
mono
msvc
netcore
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h
63 lines
1.7 KiB
C++
63 lines
1.7 KiB
C++
![]() |
//===--- StmtViz.cpp - Graphviz visualization for Stmt ASTs -----*- C++ -*-===//
|
||
|
//
|
||
|
// The LLVM Compiler Infrastructure
|
||
|
//
|
||
|
// This file is distributed under the University of Illinois Open Source
|
||
|
// License. See LICENSE.TXT for details.
|
||
|
//
|
||
|
//===----------------------------------------------------------------------===//
|
||
|
//
|
||
|
// This file implements Stmt::viewAST, which generates a Graphviz DOT file
|
||
|
// that depicts the AST and then calls Graphviz/dot+gv on it.
|
||
|
//
|
||
|
//===----------------------------------------------------------------------===//
|
||
|
|
||
|
#include "clang/AST/StmtGraphTraits.h"
|
||
|
#include "clang/AST/Decl.h"
|
||
|
#include "llvm/Support/GraphWriter.h"
|
||
|
|
||
|
using namespace clang;
|
||
|
|
||
|
void Stmt::viewAST() const {
|
||
|
#ifndef NDEBUG
|
||
|
llvm::ViewGraph(this,"AST");
|
||
|
#else
|
||
|
llvm::errs() << "Stmt::viewAST is only available in debug builds on "
|
||
|
<< "systems with Graphviz or gv!\n";
|
||
|
#endif
|
||
|
}
|
||
|
|
||
|
namespace llvm {
|
||
|
template<>
|
||
|
struct DOTGraphTraits<const Stmt*> : public DefaultDOTGraphTraits {
|
||
|
DOTGraphTraits (bool isSimple=false) : DefaultDOTGraphTraits(isSimple) {}
|
||
|
|
||
|
static std::string getNodeLabel(const Stmt* Node, const Stmt* Graph) {
|
||
|
|
||
|
#ifndef NDEBUG
|
||
|
std::string OutSStr;
|
||
|
llvm::raw_string_ostream Out(OutSStr);
|
||
|
|
||
|
if (Node)
|
||
|
Out << Node->getStmtClassName();
|
||
|
else
|
||
|
Out << "<NULL>";
|
||
|
|
||
|
std::string OutStr = Out.str();
|
||
|
if (OutStr[0] == '\n') OutStr.erase(OutStr.begin());
|
||
|
|
||
|
// Process string output to make it nicer...
|
||
|
for (unsigned i = 0; i != OutStr.length(); ++i)
|
||
|
if (OutStr[i] == '\n') { // Left justify
|
||
|
OutStr[i] = '\\';
|
||
|
OutStr.insert(OutStr.begin()+i+1, 'l');
|
||
|
}
|
||
|
|
||
|
return OutStr;
|
||
|
#else
|
||
|
return "";
|
||
|
#endif
|
||
|
}
|
||
|
};
|
||
|
} // end namespace llvm
|