Skip to content

Commit 9048c2d

Browse files
authored
Revert "[analyzer] Make it a noop when initializing a field of empty record" (#138951)
Reverts #138594 Crashes, see: https://lab.llvm.org/buildbot/#/builders/144/builds/24534
1 parent 7f4e36e commit 9048c2d

File tree

2 files changed

+1
-56
lines changed

2 files changed

+1
-56
lines changed

clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#include "clang/AST/ASTContext.h"
1413
#include "clang/AST/AttrIterator.h"
1514
#include "clang/AST/DeclCXX.h"
1615
#include "clang/AST/ParentMap.h"
@@ -716,11 +715,7 @@ void ExprEngine::handleConstructor(const Expr *E,
716715
// actually make things worse. Placement new makes this tricky as well,
717716
// since it's then possible to be initializing one part of a multi-
718717
// dimensional array.
719-
const CXXRecordDecl *TargetHeldRecord =
720-
cast<CXXRecordDecl>(CE->getType()->getAsRecordDecl());
721-
722-
if (!TargetHeldRecord || !TargetHeldRecord->isEmpty())
723-
State = State->bindDefaultZero(Target, LCtx);
718+
State = State->bindDefaultZero(Target, LCtx);
724719
}
725720

726721
Bldr.generateNode(CE, N, State, /*tag=*/nullptr,

clang/test/Analysis/issue-137252.cpp

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)