Skip to content

Commit 0827923

Browse files
committed
fixup! don't cache nullptrs
1 parent 78369ca commit 0827923

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

clang/lib/CodeGen/CGDebugInfo.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -5593,8 +5593,8 @@ void CGDebugInfo::EmitGlobalVariable(const VarDecl *VD) {
55935593
if (VD->hasAttr<NoDebugAttr>())
55945594
return;
55955595

5596-
auto &GV = DeclCache[VD];
5597-
if (GV)
5596+
const auto CacheIt = DeclCache.find(VD);
5597+
if (CacheIt != DeclCache.end())
55985598
return;
55995599

56005600
auto const *InitVal = VD->evaluateValue();
@@ -5614,7 +5614,7 @@ void CGDebugInfo::EmitGlobalVariable(const VarDecl *VD) {
56145614
llvm::DINodeArray Annotations = CollectBTFDeclTagAnnotations(VD);
56155615
llvm::DIExpression *InitExpr = createConstantValueExpression(VD, *InitVal);
56165616

5617-
GV.reset(DBuilder.createGlobalVariableExpression(
5617+
DeclCache[VD].reset(DBuilder.createGlobalVariableExpression(
56185618
TheCU, DeclName, LinkageName, Unit, LineNo, getOrCreateType(T, Unit),
56195619
true, true, InitExpr, getOrCreateStaticDataMemberDeclarationOrNull(VD),
56205620
TemplateParameters, Align, Annotations));

0 commit comments

Comments
 (0)