Skip to content

[analyzer] Handle [[assume(cond)]] as __builtin_assume(cond) #100762

Closed
@steakhal

Description

@steakhal

We already handle __builtin_assume calls inside the BuiltinFunctionChecker.
We should also handle the attribute variant of this, e.g.:
https://compiler-explorer.com/z/oq6nY7eqE

void clang_analyzer_printState();
extern int arr[10];

void using_assume_attr(int x) {
    [[assume(x > 100)]]; // NullStmt with an attribute
    //clang_analyzer_printState();
    arr[x] = 404; // FIXME: we don't raise this!
}

void using_builtin(int x) {
    __builtin_assume(x > 100); // CallExpr
    //clang_analyzer_printState();
    arr[x] = 404; // caught!
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions