[PATCH] D11784: [PATCH] clang-tidy check for incorrect move constructor initializers
Alexander Kornienko via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 14 05:19:34 PDT 2015
alexfh added a comment.
In http://reviews.llvm.org/D11784#224421, @aaron.ballman wrote:
> In http://reviews.llvm.org/D11784#224386, @alexfh wrote:
> > > One thing I am not certain of in this patch is how to test it. I have some rudimentary tests, but am unable to test the "note:" diagnostics from
> > > FileCheck (attempting to add any cause the "warning:" diagnostics to not be found).
> > Can you give an example of what you do and what results do you get?
> I put "CHECK: :[[@LINE+1]]:3: note: copy constructor being called" into the source file, and tests no longer pass because it cannot find the matching "warning: " diagnostic. If I then remove the warning diagnostic, the tests pass again. So it seems I can test one or the other, but not both. Specifically (with note and warning):
Might it be that you got the line offsets in @LINE incorrectly? A test like this should work, if both the warning and the note are on the same line:
// CHECK: :[[@LINE+2]]:...: warning: ....
// CHECK: :[[@LINE+1]]:...: note: ....
If your note is generated on a different line than the warning (e.g. class declaration vs. the incorrect use of a variable), then you may have to use @LINE+x for the warning and the line number verbatim for the note check.
More information about the cfe-commits