[clang] [Parser][ObjC] Add -Wobjc-prefix-length warning option. (PR #97597)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 17 08:34:00 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 48f55ba9d8e51cf976a8789521dd0763dea1e2d1 4980fcd7f274bba007c48aedb3b85c15c5796e3d --extensions cpp,h -- clang/include/clang/Basic/LangOptions.h clang/include/clang/Sema/SemaObjC.h clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Parse/ParseObjc.cpp clang/lib/Sema/SemaDeclObjC.cpp clang/lib/Sema/SemaObjCProperty.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 60de53c968..fcbe98d96c 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -167,11 +167,10 @@ SemaObjC::ValidateObjCPublicName(StringRef Name) {
static inline bool ObjCSelNameMatchesPrefix(StringRef Name, StringRef Prefix) {
size_t NameLen = Name.size();
size_t PrefixLen = Prefix.size();
- return (NameLen >= PrefixLen &&
- Name.starts_with_insensitive(Prefix) &&
- (NameLen <= PrefixLen
- || (isUppercase(Name[0]) && !isUppercase(Name[PrefixLen]))
- || (isLowercase(Name[0]) && !isLowercase(Name[PrefixLen]))));
+ return (NameLen >= PrefixLen && Name.starts_with_insensitive(Prefix) &&
+ (NameLen <= PrefixLen ||
+ (isUppercase(Name[0]) && !isUppercase(Name[PrefixLen])) ||
+ (isLowercase(Name[0]) && !isLowercase(Name[PrefixLen]))));
}
SemaObjC::ObjCNameValidationResult
``````````
</details>
https://github.com/llvm/llvm-project/pull/97597
More information about the cfe-commits
mailing list