Skip to content

Commit cb98fd9

Browse files
committed
Fix use of an uninitialized variable; NFC intended
This was causing debug builds with Visual Studio to fail a number of HLSL tests.
1 parent 34e16b6 commit cb98fd9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ bool clang::CreateHLSLAttributedResourceType(
573573
assert(AttrList.size() && "expected list of resource attributes");
574574

575575
QualType ContainedTy = QualType();
576-
TypeSourceInfo *ContainedTyInfo;
576+
TypeSourceInfo *ContainedTyInfo = nullptr;
577577
SourceLocation LocBegin = AttrList[0]->getRange().getBegin();
578578
SourceLocation LocEnd = AttrList[0]->getRange().getEnd();
579579

@@ -641,7 +641,7 @@ bool clang::CreateHLSLAttributedResourceType(
641641
ResType = S.getASTContext().getHLSLAttributedResourceType(
642642
Wrapped, ContainedTy, ResAttrs);
643643

644-
if (LocInfo) {
644+
if (LocInfo && ContainedTyInfo) {
645645
LocInfo->Range = SourceRange(LocBegin, LocEnd);
646646
LocInfo->ContainedTyInfo = ContainedTyInfo;
647647
}

0 commit comments

Comments
 (0)