Skip to content

Commit

Permalink
SymbolExternalizer: Rewrite to use RecursiveASTVisitor
Browse files Browse the repository at this point in the history
Before this commit clang-extract was interacting and handling nodes on
the AST manually. Now we use RecursiveASTVisitor that is able to
leverage on LLVM to visit each node recursively for us.

The speed should be improved when compared with the older approach.

Signed-off-by: Marcos Paulo de Souza <[email protected]>
  • Loading branch information
marcosps committed Jun 25, 2024
1 parent 4ee51e0 commit 125a5bb
Show file tree
Hide file tree
Showing 3 changed files with 262 additions and 452 deletions.
11 changes: 5 additions & 6 deletions libcextract/Passes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,12 +438,11 @@ class FunctionExternalizerPass : public Pass
{
/* Issue externalization. */
SymbolExternalizer externalizer(ctx->AST.get(), ctx->IA, ctx->Ibt, ctx->PatchObject, ctx->DumpPasses);
externalizer.Externalize_Symbols(ctx->Externalize);
if (ctx->RenameSymbols) {
/* The FuncExtractNames will be modified, as the function will be
renamed. */
externalizer.Rename_Symbols(ctx->FuncExtractNames);
}
if (ctx->RenameSymbols)
externalizer.Externalize_Symbols(ctx->Externalize, ctx->FuncExtractNames);
else
externalizer.Externalize_Symbols(ctx->Externalize);

externalizer.Commit_Changes_To_Source(ctx->OFS, ctx->MFS, ctx->HeadersToExpand);

/* Store the changed names. */
Expand Down
Loading

0 comments on commit 125a5bb

Please sign in to comment.