Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Add notes for function call evaluation #85

Open
Xazax-hun opened this issue Dec 27, 2019 · 0 comments
Open

Add notes for function call evaluation #85

Xazax-hun opened this issue Dec 27, 2019 · 0 comments

Comments

@Xazax-hun
Copy link
Collaborator

After looking at the (filtered) results on some real world code I think sometimes the current error messages are rather hard to grok. One of the main reason is that the reader have no idea how the calls are evaluated.

Consider the following code:

std::string_view v = p->getAttribute("AttributeName");
use(v); // warning

We might get a warning about v dangling, but we have no idea why would it dangle. In this case having a note like Assuming getAttribute returns an object with the same lifetime as its argument would help a lot. Because the code above is false positive, the lifetime of the returned pointer is tied to p and not to the argument. Having a note like this makes the problem quite apparent, and gives a hint to the user how to annotate getAttribute to get rid of the warning.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant