OikawaKirie added a comment. I have confirmed that this problem is not due to this patch. Besides, on Mac, both m1 and intel, the on-demand-parsing as well as loading an AST file generated via driver argument `-emit-ast` will also trigger this problem. However, when loading an AST file generated via cc1 argument `-emit-pch`, the problem is not triggered.
--- See the example below, which is executed on an intel Mac laptop with clang 13.0.0. /tmp/test/test.c: void f(); void g() { f(); } /tmp/test/importee.c: void f() { } /tmp/test/odp/externalDefMap.txt: c:@F@f /tmp/test/importee.c /tmp/test/odp/invocations.yaml: "/tmp/test/importee.c": ["gcc", "-c", "/tmp/test/importee.c"] /tmp/test/ast/externalDefMap.txt: c:@F@f /tmp/test/ast/importee.c.ast When executing the analyzer with CTU analysis via on-demand-parsing: /tmp/test$ clang -cc1 -analyze -analyzer-checker=core -analyzer-config experimental-enable-naive-ctu-analysis=true,ctu-dir=odp,ctu-invocation-list=invocations.yaml test.c Or loading AST file generated via driver argument `-emit-ast`: /tmp/test$ clang -emit-ast importee.c -o ast/importee.c.ast /tmp/test$ clang -cc1 -analyze -analyzer-checker=core -analyzer-config experimental-enable-naive-ctu-analysis=true,ctu-dir=ast test.c The same diagnostic message is generated, though the triples are different from the ones for m1. warning: imported AST from '/tmp/test/importee.c' had been generated for a different target, current: x86_64-apple-darwin21.2.0, imported: x86_64-apple-macosx12.0.0 [-Wctu] --- However, the problem will not be triggered if triple is given: (On demand parsing: setting the triple of the entry file to the one of imported ASTUnit) /tmp/test$ clang -cc1 -analyze -analyzer-checker=core -analyzer-config experimental-enable-naive-ctu-analysis=true,ctu-dir=odp,ctu-invocation-list=invocations.yaml test.c -triple x86_64-apple-macosx12.0.0 (AST) /tmp/test$ clang -target arm-apple-macosx -emit-ast importee.c -o ast/importee.c.ast /tmp/test$ clang -cc1 -analyze -analyzer-checker=core -analyzer-config experimental-enable-naive-ctu-analysis=true,ctu-dir=ast test.c -triple arm-apple-macosx Or the AST file is generated via cc1 argument `-emit-pch`: /tmp/test$ clang -cc1 -emit-pch importee.c -o ast/importee.c.ast /tmp/test$ clang -cc1 -analyze -analyzer-checker=core -analyzer-config experimental-enable-naive-ctu-analysis=true,ctu-dir=ast test.c I think we can bypass the problem temporarily by loading the AST file generated by cc1 argument `-emit-pch`, just as shown in the last code snippet above. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D102669/new/ https://reviews.llvm.org/D102669 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits