================
@@ -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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to