From: Michal Sojka Date: Wed, 11 Jul 2012 15:16:43 +0000 (+0200) Subject: Update to compile with llvm-3.1 X-Git-Url: http://rtime.felk.cvut.cz/gitweb/boost-statechart-viewer.git/commitdiff_plain/6024472d63f45c6700b10faac6a54d56938881fe Update to compile with llvm-3.1 --- diff --git a/src/Makefile b/src/Makefile index 0c8f736..12d4085 100644 --- a/src/Makefile +++ b/src/Makefile @@ -5,7 +5,7 @@ LLVM_CONFIG ?= llvm-config LLVM_FLAGS := $(shell $(LLVM_CONFIG) --cxxflags --ldflags --libs jit core) visualizer: visualizer.cpp stringoper.h iooper.h - $(CXX) $< -o $@ -g -Wall -lclangParse -lclangFrontend -lclangSerialization \ + $(CXX) $< -o $@ -g -fno-rtti -Wall -lclangParse -lclangFrontend -lclangSerialization \ -lclangDriver -lclangCodeGen -lclangSema \ - -lclangAnalysis -lclangRewrite -lclangAST -lclangLex -lclangBasic \ + -lclangAnalysis -lclangRewrite -lclangAST -lclangLex -lclangBasic -lclangEdit \ $(LLVM_FLAGS) diff --git a/src/visualizer.cpp b/src/visualizer.cpp index bcdfe0d..39191d3 100644 --- a/src/visualizer.cpp +++ b/src/visualizer.cpp @@ -72,7 +72,7 @@ class MyDiagnosticClient : public TextDiagnosticPrinter /** * This method prints diagnostic and counts diagnostic types. */ - virtual void HandleDiagnostic(Diagnostic::Level DiagLevel, const DiagnosticInfo &Info) + virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const Diagnostic &Info) { TextDiagnosticPrinter::HandleDiagnostic(DiagLevel, Info); // print diagnostic information using library implementation switch (DiagLevel) // count number of all diagnostic information @@ -163,7 +163,7 @@ class FindStates : public ASTConsumer * Traverse global decls using DeclGroupRef for handling all global decls. But only interesting decls are processed. Interesting decls are Struct, Class, C++ methods and Namespace. * When Namespace is found it recursively traverse all decls inside this Namespace using method recursive_visit. */ - virtual void HandleTopLevelDecl(DeclGroupRef DGR) + virtual bool HandleTopLevelDecl(DeclGroupRef DGR) { SourceLocation loc; string line, output, event; @@ -195,6 +195,7 @@ class FindStates : public ASTConsumer } output = ""; } + return true; } /** @@ -437,20 +438,18 @@ int main(int argc, char **argv) dopts.ShowColors=1; MyDiagnosticClient *mdc = new MyDiagnosticClient(llvm::errs(), dopts); llvm::IntrusiveRefCntPtr dis(new DiagnosticIDs()); - Diagnostic diag(dis,mdc); + DiagnosticsEngine diag(dis,mdc); FileManager fm( * new FileSystemOptions()); SourceManager sm (diag, fm); - HeaderSearch *headers = new HeaderSearch(fm); - Driver TheDriver(LLVM_BINDIR, llvm::sys::getHostTriple(), "", false, false, diag); + Driver TheDriver(LLVM_BINDIR, llvm::sys::getDefaultTargetTriple(), "", false, diag); TheDriver.setCheckInputsExist(true); TheDriver.CCCIsCXX = 1; TheDriver.ResourceDir = LLVM_PREFIX "/lib/clang/" CLANG_VERSION_STRING; CompilerInvocation compInv; llvm::SmallVector Args(argv, argv + argc); - llvm::OwningPtr C(TheDriver.BuildCompilation(Args.size(), - Args.data())); + llvm::OwningPtr C(TheDriver.BuildCompilation(Args)); const driver::JobList &Jobs = C->getJobs(); const driver::Command *Cmd = cast(*Jobs.begin()); const driver::ArgStringList &CCArgs = Cmd->getArguments(); @@ -474,29 +473,33 @@ int main(int argc, char **argv) diag); HeaderSearchOptions hsopts = compInv.getHeaderSearchOpts(); - LangOptions lang = compInv.getLangOpts(); - CompilerInvocation::setLangDefaults(lang, IK_ObjCXX); + LangOptions *lang = compInv.getLangOpts(); + CompilerInvocation::setLangDefaults(*lang, IK_ObjCXX); TargetInfo *ti = TargetInfo::CreateTargetInfo(diag, compInv.getTargetOpts()); FrontendOptions f = compInv.getFrontendOpts(); - inputFilename = f.Inputs[0].second; + inputFilename = f.Inputs[0].File; + HeaderSearch *headers = new HeaderSearch(fm, diag, *lang, ti); cout<<"Input filename: "<BeginSourceFile(lang, &pp);//start using diagnostic - ParseAST(pp, &c, ctx, false, false); + ASTContext ctx(*lang, sm, ti, tab, * new SelectorTable(), builtins,0); + mdc->BeginSourceFile(*lang, &pp);//start using diagnostic + ParseAST(pp, &c, ctx, false, TU_Complete); mdc->EndSourceFile(); //end using diagnostic IO_operations *io = new IO_operations(outputFilename, c.getStateMachine(), c.getNameOfFirstState(), c.getTransitions(), c.getStates(), c.getEvents()); io->save_to_file();