Skip to content

Detect misuse of [[clang::noescape]] annotation #170417

@usx95

Description

@usx95
std::string_view foo(const std::string& in [[clang::noescape]]) {
  return in;
}

e.g.: in escapes through return but is marked noescape.

After #169767, the placeholder loans can help detect when parameters escape. Currently we suggest to add lifetimebound to such params. But when the param is annotated with clang::noescape, we should diagnose a misuse.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:temporal-safetyIssue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions