ziqingluo-90 added inline comments.
================
Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:162
+ InnerMatcher)),
+ unless(callee(functionDecl(hasAttr(attr::UnsafeBufferUsage)))));
+ auto CastOperandMatcher =
----------------
jkorous wrote:
> I am just wondering how does the callee matcher work in situation with
> multiple re-declarations 🤔
>
> Something like this:
> ```
> void foo(int* ptr);
> [[clang::unsafe_buffer_usage]] void foo(int* ptr);
> void foo(int* ptr);
>
> void bar(int* ptr) {
> foo(ptr);
> }
> ```
I think we are fine. According to the doc of `FunctionDecl`:
```
/// Represents a function declaration or definition.
///
/// Since a given function can be declared several times in a program,
/// there may be several FunctionDecls that correspond to that
/// function. Only one of those FunctionDecls will be found when
/// traversing the list of declarations in the context of the
/// FunctionDecl (e.g., the translation unit); this FunctionDecl
/// contains all of the information known about the function. Other,
/// previous declarations of the function are available via the
/// getPreviousDecl() chain.
```
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143128/new/
https://reviews.llvm.org/D143128
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits