preventing clang tool working on same file multiple times

hi,

I am invoking the clang tool once and I wish to run it on all files in compilation db.

CompilationDatabase& comDb = op.getCompilations();

vector files = comDb.getAllFiles();

RefactoringTool Tool(comDb, files);

This way I face a problem that it visits the same headers/files multiple times to apply the fixes.

So I wish to know if there is some way I can prevent the tool working on same file multiple times else I will need to write a script to read the compilation db and then run the tool on all files in db.

Regards,
-s

Hi,

FYI, that is currently broken. We're discussing it here:

  https://bugs.llvm.org/show_bug.cgi?id=38910

Thanks,

Stephen.

Thanks for your response.

No, I haven’t tried emitting replacements from tool and then running clang-apply-replacement over it. Though I was trying to create a set of all replacements.

Also seems I cannot try now, based on other response this workflow got some bug.

Anyway, now what I think is such approach may be time taking as tool will still need to process same files multiple times, just that the replacement will be written/executed only once. So for a large number of files it may take very long. right?

Btw, I am not blocked now, I followed the clang-tidy run script to run tool on every file.

Regards,
-s