Skip to content

Commit 02f1fc7

Browse files
author
Doug Wyatt
committed
Review feedback: Check for no-prototype. Simplify test.
1 parent a0b6093 commit 02f1fc7

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

clang/lib/Sema/SemaFunctionEffects.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -996,10 +996,10 @@ class Analyzer {
996996
// will be traversed as part of the function -- unless we capture it
997997
// here and have TraverseStmt skip it.
998998
if (TypeSourceInfo *TSI = FD->getTypeSourceInfo()) {
999-
FunctionProtoTypeLoc TL =
1000-
TSI->getTypeLoc().getAs<FunctionProtoTypeLoc>();
1001-
if (const FunctionProtoType *FPT = TL.getTypePtr())
1002-
NoexceptExpr = FPT->getNoexceptExpr();
999+
if (FunctionProtoTypeLoc TL =
1000+
TSI->getTypeLoc().getAs<FunctionProtoTypeLoc>())
1001+
if (const FunctionProtoType *FPT = TL.getTypePtr())
1002+
NoexceptExpr = FPT->getNoexceptExpr();
10031003
}
10041004
}
10051005

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,6 @@ class expected {
422422

423423
// This is a deliberate corruption of the real implementation for simplicity.
424424
constexpr expected(const expected&)
425-
noexcept(is_copy_constructible_v<_Tp> && is_copy_constructible_v<_Err>)
426425
requires(is_copy_constructible_v<_Tp> && is_copy_constructible_v<_Err>)
427426
= default;
428427
};
@@ -435,9 +434,12 @@ void test() [[clang::nonblocking]]
435434

436435
} // namespace ExpectedTest
437436

438-
// Make sure that simple type traits don't cause violations.
437+
// Make sure a function call in a noexcept() clause is ignored.
438+
constexpr bool foo() [[clang::nonblocking(false)]] { return true; }
439+
void nb27() noexcept(foo()) [[clang::nonblocking]] {}
439440

440-
void nb27() [[clang::nonblocking]] {
441+
// Make sure that simple type traits don't cause violations.
442+
void nb28() [[clang::nonblocking]] {
441443
bool x = __is_constructible(int, const int&);
442444
}
443445

0 commit comments

Comments
 (0)