Skip to content

[clang][docs] Update the gsl::Pointer/Owner attr doc #96908

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions clang/include/clang/Basic/AttrDocs.td
Original file line number Diff line number Diff line change
Expand Up @@ -6585,7 +6585,8 @@ like pointers to an object of type ``T``:
private:
int *valuePointer;
public:
int *getInt() { return &valuePointer; }
IntPointer(const IntOwner&);
int *getInt() { return valuePointer; }
};

The argument ``T`` is optional and is ignored.
Expand All @@ -6601,12 +6602,8 @@ When the Owner's lifetime ends, it will consider the Pointer to be dangling.
.. code-block:: c++

int f() {
IntPointer P;
if (true) {
IntOwner O(7);
P = IntPointer(O); // P "points into" O
} // P is dangling
return P.get(); // error: Using a dangling Pointer.
IntPointer P(IntOwner{}); // P "points into" a temporary IntOwner object
P.getInt(); // P is dangling
}

}];
Expand Down
Loading