carlosgalvezp added inline comments.

================
Comment at: 
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/rvalue-reference-param-not-moved.cpp:1
+// RUN: %check_clang_tidy -std=c++14-or-later %s 
cppcoreguidelines-rvalue-reference-param-not-moved %t -- -- 
-fno-delayed-template-parsing
+
----------------
ccotter wrote:
> carlosgalvezp wrote:
> > ccotter wrote:
> > > ccotter wrote:
> > > > carlosgalvezp wrote:
> > > > > You specified C++11 in the LangOpts, but test against C++14 or later 
> > > > > in the test, maybe change it here to c++11-or-later?
> > > > The test uses generalize lambda capture, so it needs 14. Should I split 
> > > > the tests that use C++14 features to a separate file, and update this 
> > > > test file to use 11?
> > > Ah, and use of `auto` parameters in other lambdas. So there are a few 
> > > tests that would need to be split out to a separate file, use an `ifdef 
> > > __cplusplus` check (I see one other cppcoreguidelines test does this).
> > Oops I forgot to submit my comment. Yes I think we could keep everything in 
> > one test file running `c++11-or-later`, and `#ifdef` the C++14 parts.
> This didn't actually end up working. The test failed looking for expected 
> CHECK-MESSAGES, e.g.,
> 
> ```
> #if __cplusplus >= 201402L
> /* bad code */
> // CHECK-MESSAGES
> #endif
> ```
> 
> I'll go the separate file route then?
Hmm right.

What about 2 `RUN` commands in the same file? One of them you run it for 
`c++11` and the other for `c++14-or-later`. You can add a `check-prefix` for 
the C++14 case, then use `CHECK-MESSAGES-SOMEPREFIX` such that it only applies 
to that test invocation. No need to duplicate `CHECK-MESSAGES` for both runs - 
if no prefix is specified, it will apply to all runs. 

Something like:

```
#if __cplusplus >= 201402L
/* bad code */
// CHECK-MESSAGES-CXX14
#endif
```

If it gets too messy maybe a separate test file is the better option, I'm 
hoping there's not much duplication that needs to be maintaned.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141569

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to