aaron.ballman added inline comments.

================
Comment at: clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp:42-46
+/// Remove all '_' characters at the beginning of the identifier. Only reserved
+/// identifiers are allowed to start with these.
+static StringRef dropLeadingUnderscores(StringRef Identifier) {
+  return Identifier.drop_while([](char c) { return c == '_'; });
+}
----------------
whisperity wrote:
> Is this true? At least in C++ (and perhaps in C) I believe `_foo` is a 
> non-reserved identifier, only `__foo` or `_Foo` would be reserved.
`_foo` is reserved if its an external identifier in both C and C++: 
https://godbolt.org/z/GnG4v33vK

However, the issue here is that header guards are capitalized, so a file name 
like `_foo` still should drop the leading underscore so it doesn't get turned 
into `_FOO` which is always reserved.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114149

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

Reply via email to