[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 10:34:20 PST 2018


xazax.hun added inline comments.


================
Comment at: lib/CrossTU/CrossTranslationUnit.cpp:212
+    // diagnostics.
+    Context.getDiagnostics().Report(diag::err_ctu_incompat_triple)
+        << Unit->getMainFileName() << TripleTo.str() << TripleFrom.str();
----------------
martong wrote:
> xazax.hun wrote:
> > 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.
>  I would prefer to exploit the capabilities of the `DiagEngine`, instead of extending the interface of `CrossTranslationUnitContext`.
> By using a `DiagGroup` we can upgrade the warning to be an error, so I just changed it to be like that.
You do not need the extend the interface. There is already a function for that below. Also, the user might not want to display a warning either but do something else, like generate a log message. 


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