Computer Laboratory

tesla::TeslaConsumer Class Reference

Detailed Description

Definition at line 52 of file AST.h.

#include "AST.h"

+ Inheritance diagram for tesla::TeslaConsumer:
+ Collaboration diagram for tesla::TeslaConsumer:

Public Member Functions

 TeslaConsumer (llvm::StringRef InFilename, llvm::StringRef OutFilename)
 
void HandleTranslationUnit (clang::ASTContext &Context)
 

Constructor & Destructor Documentation

tesla::TeslaConsumer::TeslaConsumer ( llvm::StringRef  InFilename,
llvm::StringRef  OutFilename 
)

Definition at line 53 of file AST.cpp.

54  : InFile(In), OutFile(Out)
55 {
56 }

Member Function Documentation

void tesla::TeslaConsumer::HandleTranslationUnit ( clang::ASTContext &  Context)

Definition at line 58 of file AST.cpp.

References tesla::TeslaVisitor::GetAutomata(), tesla::panic(), and tesla::TeslaVisitor::RootAutomata().

58  {
59  TeslaVisitor Visitor(InFile, &Context);
60 
61  if (!Visitor.TraverseDecl(Context.getTranslationUnitDecl()))
62  panic("error analysing '" + InFile + "'");
63 
64  string ErrorInfo;
65  llvm::raw_fd_ostream Out(OutFile.str().c_str(), ErrorInfo);
66  if (Out.has_error())
67  panic("unable to open '" + OutFile + "': " + ErrorInfo);
68 
69  ManifestFile Result;
70  for (const AutomatonDescription *A : Visitor.GetAutomata())
71  *Result.add_automaton() = *A;
72 
73  for (const Usage *U : Visitor.RootAutomata())
74  *Result.add_root() = *U;
75 
76  string ProtobufText;
77  google::protobuf::TextFormat::PrintToString(Result, &ProtobufText);
78  Out << ProtobufText;
79 }

+ Here is the call graph for this function:


The documentation for this class was generated from the following files: