Issue 115540
Summary [clang-tidy] `bugprone-throw-keyword-missing` false negatives from `hasAncestor` skipping too much
Labels clang-tidy, false-negative
Assignees
Reporter 5chmidti
    The matcher is using `hasAncestor` and could be skipping many different issues, simply because they have an ancestor node (e.g., `VarDecl`) but that node is not closely related to the construct _expression_ itself.

```c++
struct RegularException {
 RegularException(int);
};
void foo() {
    const auto var = []() {
        RegularException{0};  // FN, ignored because of `hasAncestor(varDecl())`
        return 0;
    };
}

struct Bar {
    Bar() : v{0} {
        RegularException{0};  // FN, ignored because of `hasAncestor(cxxConstructorDecl())`
    }
    int v;
};
```

https://godbolt.org/z/6br6f91vc
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to