[clang-tools-extra] [clang-tidy] insert ``static`` keyword in correct position for misc-use-internal-linkage (PR #108792)
Julian Schmidt via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 9 12:41:48 PDT 2024
================
@@ -110,10 +113,36 @@ static constexpr StringRef Message =
"%0 %1 can be made static or moved into an anonymous namespace "
"to enforce internal linkage";
+static SourceLocation getQualifiedTypeStartLoc(SourceLocation L,
----------------
5chmidti wrote:
You could use `FD/VD->getInnerLocStart()` instead of implementing this function. `getInnerLocStart` will return the first location after the things related to templates.
```diff
-void func_cpp_inc();
+static void func_cpp_inc(); //
//
#define NDS [[nodiscard]]
#define NNDS
-[[nodiscard]] void func_cpp_inc2();
+[[nodiscard]] static void func_cpp_inc2();
//
//
-NDS void func_cpp_inc3();
+NDS static void func_cpp_inc3();
//
//
-NNDS void func_cpp_inc4();
+NNDS static void func_cpp_inc4();
//
//
```
Admittedly, this depends on attribute locations not being modeled right now, so this could break in the future (maybe add the above examples to the tests).
https://github.com/llvm/llvm-project/pull/108792
More information about the cfe-commits
mailing list