[cfe-dev] Comparing C++ dialects

Gábor Márton via cfe-dev cfe-dev at lists.llvm.org
Tue Feb 26 09:36:51 PST 2019


Hi,

In the cross translation unit lib, I'd like to compare the C++
language dialects of two TUs. If they are different then CrossTU
should be disabled (https://reviews.llvm.org/D57906)
However, comparing the dialects is prone for errors in the future:
```
  if (LangTo.CPlusPlus11 != LangFrom.CPlusPlus11 ||
      LangTo.CPlusPlus14 != LangFrom.CPlusPlus14 ||
      LangTo.CPlusPlus17 != LangFrom.CPlusPlus17 ||
      LangTo.CPlusPlus2a != LangFrom.CPlusPlus2a) {
    ++NumLangDialectMismatch;
    return llvm::make_error<IndexError>(
        index_error_code::lang_dialect_mismatch);
  }
```
Ideally, we should have a test case which fails when CPlusPlus23 (2b
or whatever) is introduced.
Do you guys could advise how to achieve this?

Thanks for your help,
Gabor



More information about the cfe-dev mailing list