NoQ added inline comments.
================
Comment at: test/Analysis/dangling-internal-buffer.cpp:175
std::string s;
- {
- c = s.c_str();
- }
- consume(c); // no-warning
+ c = s.c_str(); // expected-note {{Pointer to dangling buffer was obtained
here}}
+ s.clear(); // expected-note {{Method call is allowed to invalidate the
internal buffer}}
----------------
rnkovacs wrote:
> dcoughlin wrote:
> > In other parts of clang we use the term "inner pointer" to mean a pointer
> > that will be invalidated if its containing object is destroyed
> > https://clang.llvm.org/docs/AutomaticReferenceCounting.html#interior-pointers.
> > There are existing attributes that use this term to specify that a method
> > returns an inner pointer.
> >
> > I think it would be good to use the same terminology here. So the
> > diagnostic could be something like "Dangling inner pointer obtained here".
> I feel like I should also retitle the checker to `DanglingInnerBuffer` to
> remain consistent. What do you think?
My intuition suggests that we should remove the word "Dangling" from the
checker name, because our checker names are usually indicating what they check,
not what bugs they find. Eg., `MallocChecker` doesn't find all mallocs, it
checks that mallocs are used correctly. This checker checks that pointers to
inner buffers are used correctly, so we may call it `InnerPointerChecker` or
something like that.
https://reviews.llvm.org/D49360
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits