Skip to content

Commit 15a960c

Browse files
author
Doug Wyatt
committed
Fix cleanup in Type.h.
Add tests for multi-dimensional and variable-length arrays.
1 parent f16a012 commit 15a960c

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

clang/include/clang/AST/Type.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8838,14 +8838,12 @@ void FixedPointValueToString(SmallVectorImpl<char> &Str, llvm::APSInt Val,
88388838
inline FunctionEffectsRef FunctionEffectsRef::get(QualType QT) {
88398839
const Type *TypePtr = QT.getTypePtr();
88408840
while (true) {
8841-
if (QualType Pointee = TypePtr->getPointeeType())
8841+
if (QualType Pointee = TypePtr->getPointeeType(); !Pointee.isNull())
88428842
TypePtr = Pointee.getTypePtr();
88438843
else if (TypePtr->isArrayType())
88448844
TypePtr = TypePtr->getBaseElementTypeUnsafe();
88458845
else
88468846
break;
8847-
}
8848-
TypePtr = Pointee.getTypePtr();
88498847
}
88508848
if (const auto *FPT = TypePtr->getAs<FunctionProtoType>())
88518849
return FPT->getFunctionEffects();

clang/test/Sema/attr-nonblocking-constraints.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,15 @@ void nb14(unsigned idx) [[clang::nonblocking]]
255255

256256
FPArray src{ nb, nullptr };
257257
FP f = src[idx]; // This should not generate a warning.
258+
259+
FP twoDim[2][2] = {};
260+
FP g = twoDim[1][1];
261+
262+
#pragma clang diagnostic push
263+
#pragma clang diagnostic ignored "-Wvla-extension"
264+
FP vla[idx];
265+
#pragma clang diagnostic pop
266+
FP h = vla[0];
258267
}
259268

260269
// Block variables

0 commit comments

Comments
 (0)