[clang] [Analyzer][CFG] Correctly handle rebuilt default arg and default init expression (PR #117437)
Hans Wennborg via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 3 12:25:50 PST 2025
zmodem wrote:
creduce'd reproducer:
```
$ cat /tmp/a.cc
class Location {
public:
static Location Current(int = __builtin_LINE());
};
class DOMMatrix;
class BasicMember {
public:
BasicMember(DOMMatrix *);
};
template <typename> using Member = BasicMember;
class ExceptionState {
public:
ExceptionState &ReturnThis();
ExceptionState(Location);
};
class NonThrowableExceptionState : public ExceptionState {
public:
NonThrowableExceptionState(Location location = Location::Current())
: ExceptionState(location) {}
};
class DOMMatrix {
public:
static DOMMatrix *
Create(int *, ExceptionState & = (NonThrowableExceptionState().ReturnThis()));
};
class CSSMatrixComponent {
int CSSMatrixComponent_matrix;
CSSMatrixComponent()
: matrix_(DOMMatrix::Create(&CSSMatrixComponent_matrix)) {}
Member<DOMMatrix> matrix_;
};
$ clang -c -Wunreachable-code-aggressive /tmp/a.cc
clang: /work/llvm-project/clang/lib/Analysis/CFG.cpp:822: void (anonymous namespace)::CFGBuilder::appendStmt(CFGBlock *, const Stmt *): Assertion `!isa<Expr>(S) || cast<Expr>(S)->IgnoreParens() == S' failed.
```
https://github.com/llvm/llvm-project/pull/117437
More information about the cfe-commits
mailing list