[PATCH] D60539: Add -std=c++14 language standard option to tests that require C++14 default

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 12 05:05:34 PDT 2019


sammccall requested changes to this revision.
sammccall added a comment.
This revision now requires changes to proceed.
Herald added a subscriber: jsji.

I don't think this is a suitable fix :-(

There are lots of places where we construct command-lines in tests, it may be true today that this is the only one that fails with `gnucxx11`, but there are other possible values for `CLANG_DEFAULT_STD_CXX` and also code changes over time. So if we want to be robust to this we need a general approach to this that can be used in `SymbolCollectorTest`, `TestTU`, and others.

Adding `-std=c++14` doesn't work in general as it has side-effects: `clang -std=c++14 foo.c` is a warning, `clang -std=c++14 -x c-header foo.h` is an error. It would be nice if clang had a flag to specify the default c++ language version without also forcing the file to be parsed as C++, but AFAIK it does not.

> In our case, we set the default to be gnucxx11. However, doing so will cause the test cases in this patch to fail as they rely on the C++14 default.

Do you need to build clangd? We explicitly don't aim to support building everywhere clang can be built, maybe we should just disable in this case?


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

https://reviews.llvm.org/D60539





More information about the cfe-commits mailing list