[PATCH] D30691: [analyzer] Support for naive cross translational unit analysis
Gábor Horváth via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 25 05:05:14 PDT 2017
xazax.hun added a comment.
In https://reviews.llvm.org/D30691#878830, @r.stahl wrote:
> For my purposes I replaced the return statement of the compareCrossTUSourceLocs function with:
> return XL.getFileID() < YL.getFileID();
> A more correct fix would create only one unique diagnostic for both cases.
Thank you for the report, I could reproduce this after modifying the null dereference checker. My fear of using file IDs is that I don't know whether they are stable. So in subsequent runs, different paths might be chosen by the analyzer and this could be confusing to the user. I will think about a workaround that both stable and solves this assertion.
I see two possible ways to do the proper fix. One is to check explicitly for this case when the same function appears in multiple translation units. A better approach would be to have the ASTImporter handle this case. I think the proper fix is better addressed in a separate patch.
More information about the cfe-commits