37 #include <clang/AST/ASTContext.h>
38 #include <clang/Tooling/Tooling.h>
40 #include <llvm/Support/raw_ostream.h>
42 #include <google/protobuf/text_format.h>
46 using namespace clang;
47 using namespace tesla;
53 TeslaConsumer::TeslaConsumer(llvm::StringRef In, llvm::StringRef Out)
54 : InFile(In), OutFile(Out)
61 if (!Visitor.TraverseDecl(Context.getTranslationUnitDecl()))
62 panic(
"error analysing '" + InFile +
"'");
65 llvm::raw_fd_ostream Out(OutFile.str().c_str(), ErrorInfo);
67 panic(
"unable to open '" + OutFile +
"': " + ErrorInfo);
71 *Result.add_automaton() = *A;
74 *Result.add_root() = *U;
77 google::protobuf::TextFormat::PrintToString(Result, &ProtobufText);
83 llvm::StringRef InFile)