[ClavaWeaver] Add mapping between for common jps: Field, FieldRef
@@ -17,19 +17,26 @@ import pt.up.fe.specs.clava.ClavaNode;
import pt.up.fe.specs.clava.ast.decl.CXXMethodDecl;
import pt.up.fe.specs.clava.ast.decl.CXXRecordDecl;
import pt.up.fe.specs.clava.ast.decl.Decl;
+import pt.up.fe.specs.clava.ast.decl.EnumConstantDecl;
+import pt.up.fe.specs.clava.ast.decl.FieldDecl;
import pt.up.fe.specs.clava.ast.decl.FunctionDecl;
+import pt.up.fe.specs.clava.ast.decl.VarDecl;
import pt.up.fe.specs.clava.ast.expr.CXXMemberCallExpr;
import pt.up.fe.specs.clava.ast.expr.CallExpr;
import pt.up.fe.specs.clava.ast.expr.Expr;
+import pt.up.fe.specs.clava.ast.expr.MemberExpr;
import pt.up.fe.specs.clava.ast.extra.App;
import pt.up.fe.specs.clava.ast.extra.TranslationUnit;
import pt.up.fe.specs.util.classmap.FunctionClassMap;
+
public class ClavaCommonLanguage {
private static final FunctionClassMap<ClavaNode, String> JOINPOINT_MAPPER;
static {
JOINPOINT_MAPPER = new FunctionClassMap<>();
+ JOINPOINT_MAPPER.put(MemberExpr.class, ClavaCommonLanguage::memberExpr);
+ JOINPOINT_MAPPER.put(FieldDecl.class, node -> "FieldJp");
JOINPOINT_MAPPER.put(CXXMemberCallExpr.class, node -> "MemberCallJp");
JOINPOINT_MAPPER.put(CallExpr.class, node -> "CallJp");
JOINPOINT_MAPPER.put(Expr.class, node -> "ExprJp");
@@ -47,16 +54,34 @@ public class ClavaCommonLanguage {
}
private static String cxxRecordDecl(CXXRecordDecl node) {
+
switch (node.getTagKind()) {
case CLASS:
return "ClassJp";
/*
- case STRUCT:
- return "StructJp";
+ * case STRUCT: return "StructJp";
*/
default:
return "JoinPoint";
}
}
+ private static String memberExpr(MemberExpr node) {
+
+ if (node.getMemberDecl() instanceof FieldDecl)
+ return "FieldRefJp";
+ /*
+ if (node.getMemberDecl() instanceof VarDecl)
+ return "JoinPoint";
+
+ if (node.getMemberDecl() instanceof CXXMethodDecl)
+ return "JoinPoint";
+
+ if (node.getMemberDecl() instanceof EnumConstantDecl)
+ return "JoinPoint";
+ */
+
+ return "JoinPoint";
+
+ }
}
