visitor

How a .h file can parse as c++ in ClangTool

梦想与她 提交于 2020-08-10 19:15:26
问题 Base RecursiveASTVisitor If input file is test.cpp it can run to VisitRecordDecl. When I modify file name to test.h it can't . #include "clang/AST/ASTConsumer.h" #include "clang/AST/RecursiveASTVisitor.h" #include "clang/AST/Stmt.h" #include "clang/Frontend/CompilerInstance.h" #include "clang/Frontend/FrontendAction.h" #include "clang/Tooling/Tooling.h" #include "llvm/Support/raw_ostream.h" #include "clang/Tooling/CommonOptionsParser.h" #include "clang/Tooling/Tooling.h" #include "llvm

How a .h file can parse as c++ in ClangTool

北城以北 提交于 2020-08-10 19:15:08
问题 Base RecursiveASTVisitor If input file is test.cpp it can run to VisitRecordDecl. When I modify file name to test.h it can't . #include "clang/AST/ASTConsumer.h" #include "clang/AST/RecursiveASTVisitor.h" #include "clang/AST/Stmt.h" #include "clang/Frontend/CompilerInstance.h" #include "clang/Frontend/FrontendAction.h" #include "clang/Tooling/Tooling.h" #include "llvm/Support/raw_ostream.h" #include "clang/Tooling/CommonOptionsParser.h" #include "clang/Tooling/Tooling.h" #include "llvm

Why do I need to Cast Visitor Object to Dynamic for Double Dispatch?

痴心易碎 提交于 2020-05-14 08:54:29
问题 I'd like to know why I need to cast both my visitable object and my visitor to dynamics in order for double dispatch to work without repeated overloads of the Accept method. If I cast either to dynamic but not the other, the generic base class's visit method is called. But if I cast both, then sub-classes' visit methods are called. I have implemented the standard visitor pattern with generics. I have a visitor interface as follows: public interface ITreeVisitorVoid<TPayload> { void Visit

Why do I need to Cast Visitor Object to Dynamic for Double Dispatch?

China☆狼群 提交于 2020-05-14 08:49:10
问题 I'd like to know why I need to cast both my visitable object and my visitor to dynamics in order for double dispatch to work without repeated overloads of the Accept method. If I cast either to dynamic but not the other, the generic base class's visit method is called. But if I cast both, then sub-classes' visit methods are called. I have implemented the standard visitor pattern with generics. I have a visitor interface as follows: public interface ITreeVisitorVoid<TPayload> { void Visit

Robot Framework - Visitor Interface - How do I get keyword children of keywords?

浪尽此生 提交于 2020-04-11 04:03:09
问题 After implementing Robot's SuiteVisitor Interface the functions def start_suite(self, suite) , def start_test(self, test) and def start_keyword(self, keyword) are being called as expected. But when I try to list the keyword children of keywords, I get empty lists: def start_suite(self, suite): logger.console("Event Start Suite: {}".format(suite.name)) for x in suite.tests: logger.console("-> Test Name: {}".format(x)) for y in x.keywords: logger.console("---> Keyword: {}".format(y)) for z in y

Antlr4 Javascript Visitor

血红的双手。 提交于 2020-04-07 02:56:35
问题 I'm currently trying to develope a JavaScript Compiler with the help of an Antlr4 Visitor. I've got this already implemented with Java but cannot figure out how to do this in JavaScript. Probably somebody can answer me a few questions? 1: In Java there is a Visitor.visit function. If im right this isn't possibile with Javascript. Is there a work around for this? 2: My Javascript Visitor got all the generated visiting functions but when I use console.log(ctx) the context is undefined. Any idea

How to correctly use the visitor pattern with different Shapes for an Editor

五迷三道 提交于 2020-03-27 06:33:42
问题 I am creating a editor for different Shape Objects. I stumbled upon the visitor pattern which actually fits my needs I think. I have a Element class which holds a field named attrs public class Element { ... private Shape attrs; ... } My Shape class looks like this with the visitor design pattern. public abstract class Shape { public abstract void accept(ShapeVisitor v); public interface ShapeVisitor{ public void visit(CircleObject circle); public void visit(RectangleObject rectangle); } }