[clang-tools-extra] [clang-tidy] Fix identifier-naming style lookup in macro arguments (PR #206809)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 3 01:58:58 PDT 2026


================
@@ -0,0 +1,23 @@
+// RUN: %check_clang_tidy %s readability-identifier-naming %t -- \
+// RUN:   -config='{CheckOptions: { \
+// RUN:     readability-identifier-naming.FunctionCase: camelBack, \
+// RUN:     readability-identifier-naming.ParameterCase: camelBack, \
+// RUN:     readability-identifier-naming.VariableCase: camelBack \
+// RUN:   }}'
+
+#define WRAP(E) E
+
+WRAP(int foo(int v) { return v; })
+
+void testLambdaInMacroArgument() {
+  WRAP([](int var) {
+    return var;
+  }(1));
+}
+
+int badFunction(int BadParam) {
+  // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: invalid case style for parameter 'BadParam' [readability-identifier-naming]
----------------
savchart wrote:

The behavior is indeed as you described. I tried to reduce this to a regression test, but it turned out to be less straightforward than I expected, so I need a bit more time to investigate the proper test setup.

The reproduction is: root .clang-tidy uses CamelCase, subdir/.clang-tidy uses camelBack. For a normal declaration in subdir, clang-tidy picks the subdir style, but for a declaration coming from a macro argument it appears to use the root style instead.

https://github.com/llvm/llvm-project/pull/206809


More information about the cfe-commits mailing list