[PATCH] D57906: [CTU] Do not allow different CPP dialects in CTU

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 26 09:34:01 PST 2019


martong marked 2 inline comments as done.
martong added inline comments.


================
Comment at: lib/CrossTU/CrossTranslationUnit.cpp:255
+  // in the other unit it has none.
+  if (LangTo.CPlusPlus11 != LangFrom.CPlusPlus11 ||
+      LangTo.CPlusPlus14 != LangFrom.CPlusPlus14 ||
----------------
r.stahl wrote:
> This is likely to become a bug in the future, but I didn't see a better way to compare dialects.
> 
> Is there a way to add a test that lights up once there is a new dialect?
> 
> Would it be too pessimistic to compare the entire LangOpts? Some stuff in there should even still produce errors, right? For example "GnuMode". I skimmed over them and didn't find an obvious one that would differ between translation units of the same project. Maybe the template depth could be set selectively, but to fix that we could mask "COMPATIBLE_" and "BENIGN_" opts.
> This is likely to become a bug in the future, but I didn't see a better way to compare dialects.
> Is there a way to add a test that lights up once there is a new dialect?

`LANGOPTS` are defined as bitfields: `#define LANGOPT(Name, Bits, Default, Description) unsigned Name : Bits;`
I can't think of any solution to avoid the future bug, because there is no way to enumerate all the C++ dialects.
I am going to ask around about this on cfe-dev, maybe somebody will have an idea.

> Would it be too pessimistic to compare the entire LangOpts?
I think that would be too pessimistic.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57906/new/

https://reviews.llvm.org/D57906





More information about the cfe-commits mailing list