================
@@ -415,6 +416,28 @@ class LifetimeChecker {
     }
   }
 
+  void reportMisplacedLifetimebound() {
+    const FunctionDecl *FDef = dyn_cast<FunctionDecl>(FD);
+    if (!FDef)
+      return;
+
+    const FunctionDecl *FDecl = FDef->getPreviousDecl();
----------------
Xazax-hun wrote:

We might have a long chain of redeclarations. Do we want to warn only for one 
redeclaration? 

Also, I wonder if we only care about redeclarations in the header files.

E.g.:
```
// foo.h
int* f(int *);

// foo.cpp
int* f(int *);
#include foo.h
int* f(int *);

// later

int *f(int* p [[clang::lifetimebound]]) {
  return p;
}
```

The most value here is asking the user to put the annotation on the declaration 
in `foo.h`. Less value in adding it to the other redeclarations. 

https://github.com/llvm/llvm-project/pull/197753
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to