Skip to content

Commit 094fb1d

Browse files
committed
merge main into amd-staging
revert: ongoign Ctx 960a210 [ctx_prof] Remove the dependency on the "name" GlobalVariable (llvm#105731) Change-Id: If937300a0217f863dda6dc71b62acc82e285d5fd
2 parents d75a822 + caa844e commit 094fb1d

File tree

163 files changed

+3428
-859
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+3428
-859
lines changed

bolt/test/X86/end-symbol.test

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# RUN: yaml2obj %p/Inputs/plt-sec.yaml &> %t.exe
22
# RUN: llvm-bolt %t.exe -o %t.out
3-
# RUN: (llvm-readelf --program-headers %t.out | grep LOAD | tail -n 1 ; llvm-nm %t.out) \
4-
# RUN: | FileCheck %s
3+
4+
# RUN: llvm-readelf --program-headers %t.out | grep LOAD | tail -n 1 > %t.load
5+
# RUN: llvm-nm %t.out >> %t.load
6+
# RUN: FileCheck %s < %t.load
57

68
## Check that llvm-bolt correctly updates _end symbol to match the end of the
79
## last loadable segment.

bolt/test/X86/instrumentation-eh_frame_hdr.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
// RUN: %clangxx %cxxflags -static -Wl,-q %s -o %t.exe -Wl,--entry=_start
77
// RUN: llvm-bolt %t.exe -o %t.instr -instrument \
88
// RUN: --instrumentation-file=%t.fdata -instrumentation-sleep-time=1
9-
// RUN: (llvm-readelf -SW %t.instr | grep -v bolt; llvm-readelf -lW %t.instr | \
10-
// RUN: grep LOAD | tail -n 1) | FileCheck %s
9+
// RUN: llvm-readelf -SW %t.instr | grep -v bolt > %t.sections
10+
// RUN: llvm-readelf -lW %t.instr | grep LOAD | tail -n 1 >> %t.sections
11+
// RUN: FileCheck %s < %t.sections
1112

1213
// CHECK: {{.*}} .eh_frame_hdr PROGBITS [[#%x, EH_ADDR:]]
1314
// CHECK: LOAD 0x[[#%x, LD_OFFSET:]] 0x[[#%x, LD_VADDR:]] 0x[[#%x, LD_FSIZE:]]

clang-tools-extra/clangd/TUScheduler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1838,7 +1838,7 @@ DebouncePolicy::compute(llvm::ArrayRef<clock::duration> History) const {
18381838
// Base the result on the median rebuild.
18391839
// nth_element needs a mutable array, take the chance to bound the data size.
18401840
History = History.take_back(15);
1841-
llvm::SmallVector<clock::duration, 15> Recent(History.begin(), History.end());
1841+
llvm::SmallVector<clock::duration, 15> Recent(History);
18421842
auto *Median = Recent.begin() + Recent.size() / 2;
18431843
std::nth_element(Recent.begin(), Median, Recent.end());
18441844

clang/docs/RealtimeSanitizer.rst

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
=================
2+
RealtimeSanitizer
3+
=================
4+
5+
.. contents::
6+
:local:
7+
8+
Introduction
9+
============
10+
RealtimeSanitizer (a.k.a. RTSan) is a real-time safety testing tool for C and C++
11+
projects. RTSan can be used to detect real-time violations, i.e. calls to methods
12+
that are not safe for use in functions with deterministic runtime requirements.
13+
RTSan considers any function marked with the ``[[clang::nonblocking]]`` attribute
14+
to be a real-time function. If RTSan detects a call to ``malloc``, ``free``,
15+
``pthread_mutex_lock``, or anything else that could have a non-deterministic
16+
execution time in a function marked ``[[clang::nonblocking]]``
17+
RTSan raises an error.
18+
19+
The runtime slowdown introduced by RealtimeSanitizer is negligible.
20+
21+
How to build
22+
============
23+
24+
Build LLVM/Clang with `CMake <https://llvm.org/docs/CMake.html>` and enable the
25+
``compiler-rt`` runtime. An example CMake configuration that will allow for the
26+
use/testing of RealtimeSanitizer:
27+
28+
.. code-block:: console
29+
30+
$ cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_RUNTIMES="compiler-rt" <path to source>/llvm
31+
32+
Usage
33+
=====
34+
35+
There are two requirements:
36+
37+
1. The code must be compiled with the ``-fsanitize=realtime`` flag.
38+
2. Functions that are subject to real-time constraints must be marked
39+
with the ``[[clang::nonblocking]]`` attribute.
40+
41+
Typically, these attributes should be added onto the functions that are entry
42+
points for threads with real-time priority. These threads are subject to a fixed
43+
callback time, such as audio callback threads or rendering loops in video game
44+
code.
45+
46+
.. code-block:: console
47+
48+
% cat example_realtime_violation.cpp
49+
#include <vector>
50+
51+
void violation() [[clang::nonblocking]]{
52+
std::vector<float> v;
53+
v.resize(100);
54+
}
55+
56+
int main() {
57+
violation();
58+
return 0;
59+
}
60+
# Compile and link
61+
% clang++ -fsanitize=realtime -g example_realtime_violation.cpp
62+
63+
If a real-time safety violation is detected in a ``[[clang::nonblocking]]``
64+
context, or any function invoked by that function, the program will exit with a
65+
non-zero exit code.
66+
67+
.. code-block:: console
68+
69+
% clang++ -fsanitize=realtime -g example_realtime_violation.cpp
70+
% ./a.out
71+
Real-time violation: intercepted call to real-time unsafe function `malloc` in real-time context! Stack trace:
72+
#0 0x000102893034 in __rtsan::PrintStackTrace() rtsan_stack.cpp:45
73+
#1 0x000102892e64 in __rtsan::Context::ExpectNotRealtime(char const*) rtsan_context.cpp:78
74+
#2 0x00010289397c in malloc rtsan_interceptors.cpp:286
75+
#3 0x000195bd7bd0 in operator new(unsigned long)+0x1c (libc++abi.dylib:arm64+0x16bd0)
76+
#4 0x5c7f00010230f07c (<unknown module>)
77+
#5 0x00010230f058 in std::__1::__libcpp_allocate[abi:ue170006](unsigned long, unsigned long) new:324
78+
#6 0x00010230effc in std::__1::allocator<float>::allocate[abi:ue170006](unsigned long) allocator.h:114
79+
... snip ...
80+
#10 0x00010230e4bc in std::__1::vector<float, std::__1::allocator<float>>::__append(unsigned long) vector:1162
81+
#11 0x00010230dcdc in std::__1::vector<float, std::__1::allocator<float>>::resize(unsigned long) vector:1981
82+
#12 0x00010230dc28 in violation() main.cpp:5
83+
#13 0x00010230dd64 in main main.cpp:9
84+
#14 0x0001958960dc (<unknown module>)
85+
#15 0x2f557ffffffffffc (<unknown module>)

clang/docs/ReleaseNotes.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,16 @@ C++2c Feature Support
123123

124124
- Implemented `P2893R3 Variadic Friends <https://wg21.link/P2893>`_
125125

126+
- Implemented `P2747R2 constexpr placement new <https://wg21.link/P2747R2>`_.
127+
126128
C++23 Feature Support
127129
^^^^^^^^^^^^^^^^^^^^^
128130
- Removed the restriction to literal types in constexpr functions in C++23 mode.
129131

130132
C++20 Feature Support
131133
^^^^^^^^^^^^^^^^^^^^^
132134

135+
133136
Resolutions to C++ Defect Reports
134137
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
135138

@@ -236,6 +239,8 @@ Improvements to Clang's diagnostics
236239

237240
- Clang now diagnoses when the result of a [[nodiscard]] function is discarded after being cast in C. Fixes #GH104391.
238241

242+
- Don't emit duplicated dangling diagnostics. (#GH93386).
243+
239244
- Improved diagnostic when trying to befriend a concept. (#GH45182).
240245

241246
Improvements to Clang's time-trace
@@ -449,6 +454,11 @@ Moved checkers
449454

450455
Sanitizers
451456
----------
457+
- Introduced Realtime Sanitizer, activated by using the -fsanitize=realtime
458+
flag. This sanitizer detects unsafe system library calls, such as memory
459+
allocations and mutex locks. If any such function is called during invocation
460+
of a function marked with the ``[[clang::nonblocking]]`` attribute, an error
461+
is printed to the console and the process exits non-zero.
452462

453463
- Added the ``-fsanitize-undefined-ignore-overflow-pattern`` flag which can be
454464
used to disable specific overflow-dependent code patterns. The supported

clang/docs/UsersManual.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,6 +2068,8 @@ are listed below.
20682068
integrity.
20692069
- ``-fsanitize=safe-stack``: :doc:`safe stack <SafeStack>`
20702070
protection against stack-based memory corruption errors.
2071+
- ``-fsanitize=realtime``: :doc:`RealtimeSanitizer`,
2072+
a real-time safety checker.
20712073

20722074
There are more fine-grained checks available: see
20732075
the :ref:`list <ubsan-checks>` of specific kinds of

clang/docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Using Clang as a Compiler
3232
UndefinedBehaviorSanitizer
3333
DataFlowSanitizer
3434
LeakSanitizer
35+
RealtimeSanitizer
3536
SanitizerCoverage
3637
SanitizerStats
3738
SanitizerSpecialCaseList

clang/include/clang/Basic/Attr.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4538,7 +4538,7 @@ def HLSLSV_GroupIndex: HLSLAnnotationAttr {
45384538

45394539
def HLSLResourceBinding: InheritableAttr {
45404540
let Spellings = [HLSLAnnotation<"register">];
4541-
let Subjects = SubjectList<[HLSLBufferObj, ExternalGlobalVar]>;
4541+
let Subjects = SubjectList<[HLSLBufferObj, ExternalGlobalVar], ErrorDiag>;
45424542
let LangOpts = [HLSL];
45434543
let Args = [StringArgument<"Slot">, StringArgument<"Space", 1>];
45444544
let Documentation = [HLSLResourceBindingDocs];
@@ -4622,7 +4622,7 @@ def HLSLROV : InheritableAttr {
46224622

46234623
def HLSLResourceClass : InheritableAttr {
46244624
let Spellings = [CXX11<"hlsl", "resource_class">];
4625-
let Subjects = SubjectList<[Struct]>;
4625+
let Subjects = SubjectList<[Field]>;
46264626
let LangOpts = [HLSL];
46274627
let Args = [
46284628
EnumArgument<"ResourceClass", "llvm::hlsl::ResourceClass",

clang/include/clang/Basic/DiagnosticASTKinds.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,8 @@ def note_constexpr_new : Note<
333333
def note_constexpr_new_non_replaceable : Note<
334334
"call to %select{placement|class-specific}0 %1">;
335335
def note_constexpr_new_placement : Note<
336-
"this placement new expression is not yet supported in constant expressions">;
336+
"this placement new expression is not supported in constant expressions "
337+
"%select{|before C++2c}0">;
337338
def note_constexpr_placement_new_wrong_type : Note<
338339
"placement new would change type of storage from %0 to %1">;
339340
def note_constexpr_new_negative : Note<

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1543,6 +1543,9 @@ def DXILValidation : DiagGroup<"dxil-validation">;
15431543
// Warning for HLSL API availability
15441544
def HLSLAvailability : DiagGroup<"hlsl-availability">;
15451545

1546+
// Warnings for legacy binding behavior
1547+
def LegacyConstantRegisterBinding : DiagGroup<"legacy-constant-register-binding">;
1548+
15461549
// Warnings and notes related to const_var_decl_type attribute checks
15471550
def ReadOnlyPlacementChecks : DiagGroup<"read-only-types">;
15481551

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12353,7 +12353,13 @@ def err_hlsl_missing_semantic_annotation : Error<
1235312353
def err_hlsl_init_priority_unsupported : Error<
1235412354
"initializer priorities are not supported in HLSL">;
1235512355

12356-
def err_hlsl_unsupported_register_type : Error<"invalid resource class specifier '%0' used; expected 'b', 's', 't', or 'u'">;
12356+
def warn_hlsl_user_defined_type_missing_member: Warning<"binding type '%select{t|u|b|s|c}0' only applies to types containing %select{SRV resources|UAV resources|constant buffer resources|sampler state|numeric types}0">, InGroup<LegacyConstantRegisterBinding>;
12357+
def err_hlsl_binding_type_mismatch: Error<"binding type '%select{t|u|b|s|c}0' only applies to %select{SRV resources|UAV resources|constant buffer resources|sampler state|numeric variables in the global scope}0">;
12358+
def err_hlsl_binding_type_invalid: Error<"binding type '%0' is invalid">;
12359+
def err_hlsl_duplicate_register_annotation: Error<"binding type '%select{t|u|b|s|c|i}0' cannot be applied more than once">;
12360+
def warn_hlsl_register_type_c_packoffset: Warning<"binding type 'c' ignored in buffer declaration. Did you mean 'packoffset'?">, InGroup<LegacyConstantRegisterBinding>, DefaultError;
12361+
def warn_hlsl_deprecated_register_type_b: Warning<"binding type 'b' only applies to constant buffers. The 'bool constant' binding type is no longer supported">, InGroup<LegacyConstantRegisterBinding>, DefaultError;
12362+
def warn_hlsl_deprecated_register_type_i: Warning<"binding type 'i' ignored. The 'integer constant' binding type is no longer supported">, InGroup<LegacyConstantRegisterBinding>, DefaultError;
1235712363
def err_hlsl_unsupported_register_number : Error<"register number should be an integer">;
1235812364
def err_hlsl_expected_space : Error<"invalid space specifier '%0' used; expected 'space' followed by an integer, like space1">;
1235912365
def warn_hlsl_packoffset_mix : Warning<"cannot mix packoffset elements with nonpackoffset elements in a cbuffer">,

clang/include/clang/Basic/Sanitizers.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ SANITIZER("thread", Thread)
7979
// Numerical stability sanitizer.
8080
SANITIZER("numerical", NumericalStability)
8181

82+
// RealtimeSanitizer
83+
SANITIZER("realtime", Realtime)
84+
8285
// LeakSanitizer
8386
SANITIZER("leak", Leak)
8487

clang/include/clang/Driver/SanitizerArgs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ class SanitizerArgs {
107107
bool needsNsanRt() const {
108108
return Sanitizers.has(SanitizerKind::NumericalStability);
109109
}
110+
bool needsRtsanRt() const { return Sanitizers.has(SanitizerKind::Realtime); }
110111

111112
bool hasMemTag() const {
112113
return hasMemtagHeap() || hasMemtagStack() || hasMemtagGlobals();

clang/include/clang/Parse/Parser.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3021,15 +3021,17 @@ class Parser : public CodeCompletionHandler {
30213021
SemaCodeCompletion::AttributeCompletion::None,
30223022
const IdentifierInfo *EnclosingScope = nullptr);
30233023

3024-
void MaybeParseHLSLAnnotations(Declarator &D,
3024+
bool MaybeParseHLSLAnnotations(Declarator &D,
30253025
SourceLocation *EndLoc = nullptr,
30263026
bool CouldBeBitField = false) {
30273027
assert(getLangOpts().HLSL && "MaybeParseHLSLAnnotations is for HLSL only");
30283028
if (Tok.is(tok::colon)) {
30293029
ParsedAttributes Attrs(AttrFactory);
30303030
ParseHLSLAnnotations(Attrs, EndLoc, CouldBeBitField);
30313031
D.takeAttributes(Attrs);
3032+
return true;
30323033
}
3034+
return false;
30333035
}
30343036

30353037
void MaybeParseHLSLAnnotations(ParsedAttributes &Attrs,

clang/lib/AST/ExprConstant.cpp

Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6691,7 +6691,9 @@ static bool HandleDestructionImpl(EvalInfo &Info, SourceRange CallRange,
66916691
if (Size && Size > Value.getArrayInitializedElts())
66926692
expandArray(Value, Value.getArraySize() - 1);
66936693

6694-
for (; Size != 0; --Size) {
6694+
// The size of the array might have been reduced by
6695+
// a placement new.
6696+
for (Size = Value.getArraySize(); Size != 0; --Size) {
66956697
APValue &Elem = Value.getArrayInitializedElt(Size - 1);
66966698
if (!HandleLValueArrayAdjustment(Info, &LocE, ElemLV, ElemT, -1) ||
66976699
!HandleDestructionImpl(Info, CallRange, ElemLV, Elem, ElemT))
@@ -10003,23 +10005,14 @@ bool PointerExprEvaluator::VisitCXXNewExpr(const CXXNewExpr *E) {
1000310005
return false;
1000410006

1000510007
FunctionDecl *OperatorNew = E->getOperatorNew();
10008+
QualType AllocType = E->getAllocatedType();
10009+
QualType TargetType = AllocType;
1000610010

1000710011
bool IsNothrow = false;
1000810012
bool IsPlacement = false;
10009-
if (OperatorNew->isReservedGlobalPlacementOperator() &&
10010-
Info.CurrentCall->isStdFunction() && !E->isArray()) {
10011-
// FIXME Support array placement new.
10012-
assert(E->getNumPlacementArgs() == 1);
10013-
if (!EvaluatePointer(E->getPlacementArg(0), Result, Info))
10014-
return false;
10015-
if (Result.Designator.Invalid)
10016-
return false;
10017-
IsPlacement = true;
10018-
} else if (!OperatorNew->isReplaceableGlobalAllocationFunction()) {
10019-
Info.FFDiag(E, diag::note_constexpr_new_non_replaceable)
10020-
<< isa<CXXMethodDecl>(OperatorNew) << OperatorNew;
10021-
return false;
10022-
} else if (E->getNumPlacementArgs()) {
10013+
10014+
if (E->getNumPlacementArgs() == 1 &&
10015+
E->getPlacementArg(0)->getType()->isNothrowT()) {
1002310016
// The only new-placement list we support is of the form (std::nothrow).
1002410017
//
1002510018
// FIXME: There is no restriction on this, but it's not clear that any
@@ -10030,22 +10023,38 @@ bool PointerExprEvaluator::VisitCXXNewExpr(const CXXNewExpr *E) {
1003010023
// (which should presumably be valid only if N is a multiple of
1003110024
// alignof(int), and in any case can't be deallocated unless N is
1003210025
// alignof(X) and X has new-extended alignment).
10033-
if (E->getNumPlacementArgs() != 1 ||
10034-
!E->getPlacementArg(0)->getType()->isNothrowT())
10035-
return Error(E, diag::note_constexpr_new_placement);
10036-
1003710026
LValue Nothrow;
1003810027
if (!EvaluateLValue(E->getPlacementArg(0), Nothrow, Info))
1003910028
return false;
1004010029
IsNothrow = true;
10030+
} else if (OperatorNew->isReservedGlobalPlacementOperator()) {
10031+
if (Info.CurrentCall->isStdFunction() || Info.getLangOpts().CPlusPlus26) {
10032+
if (!EvaluatePointer(E->getPlacementArg(0), Result, Info))
10033+
return false;
10034+
if (Result.Designator.Invalid)
10035+
return false;
10036+
TargetType = E->getPlacementArg(0)->getType();
10037+
IsPlacement = true;
10038+
} else {
10039+
Info.FFDiag(E, diag::note_constexpr_new_placement)
10040+
<< /*C++26 feature*/ 1 << E->getSourceRange();
10041+
return false;
10042+
}
10043+
} else if (E->getNumPlacementArgs()) {
10044+
Info.FFDiag(E, diag::note_constexpr_new_placement)
10045+
<< /*Unsupported*/ 0 << E->getSourceRange();
10046+
return false;
10047+
} else if (!OperatorNew->isReplaceableGlobalAllocationFunction()) {
10048+
Info.FFDiag(E, diag::note_constexpr_new_non_replaceable)
10049+
<< isa<CXXMethodDecl>(OperatorNew) << OperatorNew;
10050+
return false;
1004110051
}
1004210052

1004310053
const Expr *Init = E->getInitializer();
1004410054
const InitListExpr *ResizedArrayILE = nullptr;
1004510055
const CXXConstructExpr *ResizedArrayCCE = nullptr;
1004610056
bool ValueInit = false;
1004710057

10048-
QualType AllocType = E->getAllocatedType();
1004910058
if (std::optional<const Expr *> ArraySize = E->getArraySize()) {
1005010059
const Expr *Stripped = *ArraySize;
1005110060
for (; auto *ICE = dyn_cast<ImplicitCastExpr>(Stripped);
@@ -10139,9 +10148,17 @@ bool PointerExprEvaluator::VisitCXXNewExpr(const CXXNewExpr *E) {
1013910148
bool found(APValue &Subobj, QualType SubobjType) {
1014010149
// FIXME: Reject the cases where [basic.life]p8 would not permit the
1014110150
// old name of the object to be used to name the new object.
10142-
if (!Info.Ctx.hasSameUnqualifiedType(SubobjType, AllocType)) {
10143-
Info.FFDiag(E, diag::note_constexpr_placement_new_wrong_type) <<
10144-
SubobjType << AllocType;
10151+
unsigned SubobjectSize = 1;
10152+
unsigned AllocSize = 1;
10153+
if (auto *CAT = dyn_cast<ConstantArrayType>(AllocType))
10154+
AllocSize = CAT->getZExtSize();
10155+
if (auto *CAT = dyn_cast<ConstantArrayType>(SubobjType))
10156+
SubobjectSize = CAT->getZExtSize();
10157+
if (SubobjectSize < AllocSize ||
10158+
!Info.Ctx.hasSimilarType(Info.Ctx.getBaseElementType(SubobjType),
10159+
Info.Ctx.getBaseElementType(AllocType))) {
10160+
Info.FFDiag(E, diag::note_constexpr_placement_new_wrong_type)
10161+
<< SubobjType << AllocType;
1014510162
return false;
1014610163
}
1014710164
Value = &Subobj;

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
#include "llvm/Transforms/Instrumentation/MemorySanitizer.h"
7979
#include "llvm/Transforms/Instrumentation/NumericalStabilitySanitizer.h"
8080
#include "llvm/Transforms/Instrumentation/PGOInstrumentation.h"
81+
#include "llvm/Transforms/Instrumentation/RealtimeSanitizer.h"
8182
#include "llvm/Transforms/Instrumentation/SanitizerBinaryMetadata.h"
8283
#include "llvm/Transforms/Instrumentation/SanitizerCoverage.h"
8384
#include "llvm/Transforms/Instrumentation/ThreadSanitizer.h"
@@ -990,6 +991,13 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
990991
FPM.addPass(BoundsCheckingPass());
991992
});
992993

994+
if (LangOpts.Sanitize.has(SanitizerKind::Realtime))
995+
PB.registerScalarOptimizerLateEPCallback(
996+
[](FunctionPassManager &FPM, OptimizationLevel Level) {
997+
RealtimeSanitizerOptions Opts;
998+
FPM.addPass(RealtimeSanitizerPass(Opts));
999+
});
1000+
9931001
// Don't add sanitizers if we are here from ThinLTO PostLink. That already
9941002
// done on PreLink stage.
9951003
if (!IsThinLTOPostLink) {

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3614,6 +3614,7 @@ llvm::DIType *CGDebugInfo::CreateTypeDefinition(const EnumType *Ty) {
36143614

36153615
SmallVector<llvm::Metadata *, 16> Enumerators;
36163616
ED = ED->getDefinition();
3617+
assert(ED && "An enumeration definition is required");
36173618
for (const auto *Enum : ED->enumerators()) {
36183619
Enumerators.push_back(
36193620
DBuilder.createEnumerator(Enum->getName(), Enum->getInitVal()));

0 commit comments

Comments
 (0)