Skip to content

Commit 119a156

Browse files
committed
draft unittest not ready
1 parent f8ee577 commit 119a156

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,10 @@ Improvements to Clang's diagnostics
642642
#GH69470, #GH59391, #GH58172, #GH46215, #GH45915, #GH45891, #GH44490,
643643
#GH36703, #GH32903, #GH23312, #GH69874.
644644

645+
- Improved the performance of static assertions envolving large integers by
646+
using hex format instead of string.
647+
648+
Fixes #GH71675
645649

646650
Improvements to Clang's time-trace
647651
----------------------------------

clang/lib/Sema/SemaDeclCXX.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#include "clang/Sema/SemaOpenMP.h"
4848
#include "clang/Sema/Template.h"
4949
#include "clang/Sema/TemplateDeduction.h"
50+
#include "llvm/ADT/APSInt.h"
5051
#include "llvm/ADT/ArrayRef.h"
5152
#include "llvm/ADT/STLExtras.h"
5253
#include "llvm/ADT/StringExtras.h"
@@ -17575,7 +17576,14 @@ static bool ConvertAPValueToString(const APValue &V, QualType T,
1757517576
break;
1757617577
}
1757717578
}
17578-
V.getInt().toString(Str);
17579+
17580+
llvm::APSInt vInt = V.getInt();
17581+
if (vInt > std::numeric_limits<uint64_t>::max() ||
17582+
vInt < std::numeric_limits<int64_t>::min()) {
17583+
vInt.toString(Str,16);
17584+
} else {
17585+
vInt.toString(Str);
17586+
}
1757917587
}
1758017588

1758117589
break;

clang/test/CXX/dcl.decl/dcl.decl.general/p4-20.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ struct S {
3535
void member() requires(sizeof(T) > 1);
3636
};
3737

38+
namespace GH71675 {
39+
constexpr unsigned _BitInt(__BITINT_MAXWIDTH__ >> 6) F = ~0;
40+
static_assert(F == 1); // no-error
41+
}
42+
3843
template<typename T>
3944
void ContainingFunction() {
4045
// expected-error@+1 {{non-templated function cannot have a requires clause}}

0 commit comments

Comments
 (0)