aaron.ballman added a comment.

In D61508#1491570 <https://reviews.llvm.org/D61508#1491570>, @JonasToth wrote:

> Hi trixirt and thanks for the patch!
>
> I would rather like to generalize the llvm check to allow different styles 
> and then alias the general version with different configurations. Introducing 
> this code duplication does not sound like a good idea to me.
>  The documentation fixes you make can be done in a separate patch to keep 
> things clean.


I'd probably reverse that -- have bugprone (not misc) carry a general check for 
header guards with configuration options, and have the llvm check defer to the 
general check with specific configuration options.



================
Comment at: clang-tidy/misc/HeaderGuardCheck.cpp:25-26
+  std::string Guard = llvm::sys::path::filename(Filename);
+  std::replace(Guard.begin(), Guard.end(), '.', '_');
+  std::replace(Guard.begin(), Guard.end(), '-', '_');
+  return StringRef(Guard).upper();
----------------
This replacement may generate a header guard that exhibits UB. Consider a 
filename like `foo-.cpp`, which will become `foo__cpp`


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D61508



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

Reply via email to