ctf: convert ctx_destroy to ~ctf_visitor_generate_ir
[babeltrace.git] / src / plugins / ctf / common / src / metadata / tsdl / visitor-generate-ir.cpp
index ce20624c8f3a067008e75c0728ec86d99cdad4a8..c1370c9f1f3d2f0e4088a8ac0f382c3d211aeb16 100644 (file)
@@ -440,20 +440,9 @@ static int ctx_decl_scope_register_variant(struct ctx_decl_scope *scope, const c
     return ctx_decl_scope_register_prefix_alias(scope, _PREFIX_VARIANT, name, &decl->base);
 }
 
-/**
- * Destroys a visitor context.
- *
- * @param ctx  Visitor context to destroy
- */
-static void ctx_destroy(struct ctf_visitor_generate_ir *ctx)
+ctf_visitor_generate_ir::~ctf_visitor_generate_ir()
 {
-    struct ctx_decl_scope *scope;
-
-    if (!ctx) {
-        goto end;
-    }
-
-    scope = ctx->current_scope;
+    struct ctx_decl_scope *scope = this->current_scope;
 
     /*
      * Destroy all scopes, from current one to the root scope.
@@ -465,14 +454,9 @@ static void ctx_destroy(struct ctf_visitor_generate_ir *ctx)
         scope = parent_scope;
     }
 
-    if (ctx->ctf_tc) {
-        ctf_trace_class_destroy(ctx->ctf_tc);
+    if (this->ctf_tc) {
+        ctf_trace_class_destroy(this->ctf_tc);
     }
-
-    delete ctx;
-
-end:
-    return;
 }
 
 /**
@@ -4432,16 +4416,6 @@ end:
     return ctx;
 }
 
-static void ctf_visitor_generate_ir_destroy(struct ctf_visitor_generate_ir *visitor)
-{
-    ctx_destroy(visitor);
-}
-
-void ctf_visitor_generate_ir_deleter::operator()(ctf_visitor_generate_ir *visitor)
-{
-    ctf_visitor_generate_ir_destroy(visitor);
-}
-
 bt2::TraceClass::Shared
 ctf_visitor_generate_ir_get_ir_trace_class(struct ctf_visitor_generate_ir *ctx)
 {
This page took 0.025131 seconds and 4 git commands to generate.