[PATCH] D55134: [CTU] Add triple/lang mismatch handling
Gábor Horváth via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 4 07:06:03 PST 2018
xazax.hun requested changes to this revision.
xazax.hun added inline comments.
This revision now requires changes to proceed.
================
Comment at: include/clang/Basic/DiagnosticCrossTUKinds.td:19
+
+def err_ctu_incompat_triple : Error<
+ "imported AST from '%0' had been generated for a different target, current: %1, imported: %2">;
----------------
I am not sure if we want this to be an error. The analysis could continue without any problems if we do not actually merge the two ASTs. So maybe having a warning only is better. My concern is that once we have this error, there would be no way to analyze mixed language (C/C++) projects cleanly using CTU.
================
Comment at: lib/CrossTU/CrossTranslationUnit.cpp:212
+ // diagnostics.
+ Context.getDiagnostics().Report(diag::err_ctu_incompat_triple)
+ << Unit->getMainFileName() << TripleTo.str() << TripleFrom.str();
----------------
I think we should not emit an error here. It should be up to the caller (the user of the library) to decide if she wants to handle this as an error, warnings, or just suppress these kinds of problems. I would rather extend `emitCrossTUDiagnostics` as a shorthand for the user if emitting an error is the desired behavior.
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55134/new/
https://reviews.llvm.org/D55134
More information about the cfe-commits
mailing list