[clang] cb98fd9 - Fix use of an uninitialized variable; NFC intended
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 17 06:39:32 PDT 2024
Author: Aaron Ballman
Date: 2024-09-17T09:39:19-04:00
New Revision: cb98fd977a25d3d778244da4012fd34acf7fab45
URL: https://github.com/llvm/llvm-project/commit/cb98fd977a25d3d778244da4012fd34acf7fab45
DIFF: https://github.com/llvm/llvm-project/commit/cb98fd977a25d3d778244da4012fd34acf7fab45.diff
LOG: Fix use of an uninitialized variable; NFC intended
This was causing debug builds with Visual Studio to fail a number of
HLSL tests.
Added:
Modified:
clang/lib/Sema/SemaHLSL.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaHLSL.cpp b/clang/lib/Sema/SemaHLSL.cpp
index 98c9d25327270e..67792be994fa89 100644
--- a/clang/lib/Sema/SemaHLSL.cpp
+++ b/clang/lib/Sema/SemaHLSL.cpp
@@ -573,7 +573,7 @@ bool clang::CreateHLSLAttributedResourceType(
assert(AttrList.size() && "expected list of resource attributes");
QualType ContainedTy = QualType();
- TypeSourceInfo *ContainedTyInfo;
+ TypeSourceInfo *ContainedTyInfo = nullptr;
SourceLocation LocBegin = AttrList[0]->getRange().getBegin();
SourceLocation LocEnd = AttrList[0]->getRange().getEnd();
@@ -641,7 +641,7 @@ bool clang::CreateHLSLAttributedResourceType(
ResType = S.getASTContext().getHLSLAttributedResourceType(
Wrapped, ContainedTy, ResAttrs);
- if (LocInfo) {
+ if (LocInfo && ContainedTyInfo) {
LocInfo->Range = SourceRange(LocBegin, LocEnd);
LocInfo->ContainedTyInfo = ContainedTyInfo;
}
More information about the cfe-commits
mailing list