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

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 16 01:04:24 PDT 2020


njames93 added a comment.

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.


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