[PATCH] D83717: [clang-tidy] Add check fo SEI CERT item ENV32-C

Endre Fülöp via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 16 01:31:57 PDT 2020


gamesh411 added a comment.

In D83717#2155066 <https://reviews.llvm.org/D83717#2155066>, @njames93 wrote:

> In D83717#2152762 <https://reviews.llvm.org/D83717#2152762>, @gamesh411 wrote:
>
> > In D83717#2150977 <https://reviews.llvm.org/D83717#2150977>, @njames93 wrote:
> >
> > > Alternatively you could do something like this, though it would be a pain https://github.com/llvm/llvm-project/blob/master/clang-tools-extra/test/clang-tidy/checkers/bugprone-argument-comment-gmock.cpp#L86
> >
> >
> > I have bitten the bullet, and have gone down this route. With relative numbering, the sections themselves are at least translation-invariant. Not the prettiest sight, tho.
> >  Thanks!
>
>
> I almost think it would be nice FileCheck supported some directive like:
>
>   // LINE-NAME: <LINENAME>
>
>
> And corresponding check lines:
>
>   [[<LINENAME>]]
>   [[<LINENAME>+N]] 
>   [[<LINENAME>-N]]
>
>
> Would result in the ability to write checks like this:
>
>   void longjmp_handler() {// LINE-NAME: LONGJMP
>       longjmp(env, 255); 
>   }
>  
>   ...
>  
>   void foo(){
>     atexit(longjmp_handler);
>      // CHECK-NOTES: :[[@LINE-1]]:3: warning: exit-handler potentially calls a jump function. Handlers should terminate by returning [cert-env32-c]
>     // CHECK-NOTES: :[[LONGJMP]]:1: note: handler function declared here
>     // CHECK-NOTES: :[[LONGJMP+1]]:3: note: jump function called here
>   }
>
>
> Anyway that's a story for another day.


My thoughts exactly! I also thought about anchor-points as a feature in file-check, as that would immensely increase the readability of the test-code in such cases.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83717





More information about the cfe-commits mailing list