[PATCH] D83223: [clang-tidy] Header guard check can skip past license comment

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 6 12:53:58 PDT 2020


njames93 created this revision.
njames93 added reviewers: aaron.ballman, alexfh, bkramer, gribozavr2.
Herald added subscribers: cfe-commits, xazax.hun.
Herald added a project: clang.

Add an option for header guard derived checks to control whether to skip past a license comment when adding a guard to file currently missing one.
Whats identified as a license comment is a block of comments right at the start of a file that is followed by an empty line.

All these examples are being interpreted as the first tokens in a file.

  // This is identified as a license comment.
  // It can span multiple lines too.
  
  // This is not part of the license comment as its detached.



  // This is not identified as a license comment as the
  // block is followed by code.
  void foo();



  // This is identified as a license comment as its followed by
  // an empty line
  
  void foo();


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83223

Files:
  clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
  clang-tools-extra/clang-tidy/utils/HeaderGuard.h
  clang-tools-extra/unittests/clang-tidy/LLVMModuleTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83223.275696.patch
Type: text/x-patch
Size: 9509 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200706/a3293e1a/attachment-0001.bin>


More information about the cfe-commits mailing list