Skip to content

Commit 0cdd9f8

Browse files
authored
Do not assert fail for unhandled decls with no origin
The assertion will be enabled once we have enough C++ coverage
1 parent 5f672e7 commit 0cdd9f8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

clang/lib/Analysis/LifetimeSafety.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,12 @@ class OriginManager {
148148

149149
OriginID get(const ValueDecl &D) {
150150
auto It = DeclToOriginID.find(&D);
151-
assert(It != DeclToOriginID.end());
151+
// TODO: This should be an assert(It != ExprToOriginID.end()). The current
152+
// implementation falls back to getOrCreate to avoid crashing on
153+
// yet-unhandled pointer expressions, creating an empty origin for them.
154+
if (It == DeclToOriginID.end())
155+
return getOrCreate(D);
156+
152157
return It->second;
153158
}
154159

0 commit comments

Comments
 (0)