aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/test/clang-tidy/checkers/readability
diff options
context:
space:
mode:
authorEdwin Vane <revane@google.com>2024-05-21 14:51:50 -0400
committerGitHub <noreply@github.com>2024-05-21 20:51:50 +0200
commite67f2cc3fc38cec2041cfb197ac4688ed3d16e7e (patch)
tree9bba382a7b785860634e732fcff2e8f5369d749e /clang-tools-extra/test/clang-tidy/checkers/readability
parent67ae86d700b899979db39883f4063257513498d5 (diff)
downloadllvm-e67f2cc3fc38cec2041cfb197ac4688ed3d16e7e.zip
llvm-e67f2cc3fc38cec2041cfb197ac4688ed3d16e7e.tar.gz
llvm-e67f2cc3fc38cec2041cfb197ac4688ed3d16e7e.tar.bz2
[clang-tidy] Rename out-of-line function definitions (#91954)
Member function templates defined out-of-line were resulting in conflicting naming failures with overlapping usage sets. With this change, out-of-line definitions are treated as a usage of the failure which is the inline declaration.
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/checkers/readability')
-rw-r--r--clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-outofline.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-outofline.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-outofline.cpp
new file mode 100644
index 0000000..f807875
--- /dev/null
+++ b/clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-outofline.cpp
@@ -0,0 +1,30 @@
+// RUN: %check_clang_tidy %s readability-identifier-naming %t -std=c++20 \
+// RUN: --config='{CheckOptions: { \
+// RUN: readability-identifier-naming.MethodCase: CamelCase, \
+// RUN: }}'
+
+namespace SomeNamespace {
+namespace Inner {
+
+class SomeClass {
+public:
+ template <typename T>
+ int someMethod();
+// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for method 'someMethod' [readability-identifier-naming]
+// CHECK-FIXES: {{^}} int SomeMethod();
+};
+template <typename T>
+int SomeClass::someMethod() {
+// CHECK-FIXES: {{^}}int SomeClass::SomeMethod() {
+ return 5;
+}
+
+} // namespace Inner
+
+void someFunc() {
+ Inner::SomeClass S;
+ S.someMethod<int>();
+// CHECK-FIXES: {{^}} S.SomeMethod<int>();
+}
+
+} // namespace SomeNamespace