Skip to content

Commit fc7f765

Browse files
committed
Merge from 'main' to 'sycl-web' (intel#80)
CONFLICT (content): Merge conflict in clang/lib/Frontend/CompilerInstance.cpp
2 parents a549cf8 + d412dbe commit fc7f765

File tree

283 files changed

+7859
-2085
lines changed

Some content is hidden

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

283 files changed

+7859
-2085
lines changed

clang/docs/ClangCommandLineReference.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,17 @@ Enable use-after-scope detection in AddressSanitizer
870870

871871
Enable ODR indicator globals to avoid false ODR violation reports in partially sanitized programs at the cost of an increase in binary size
872872

873+
.. option:: -fsanitize-address-destructor-kind=<arg>
874+
875+
Set the kind of module destructors emitted by AddressSanitizer instrumentation.
876+
These destructors are emitted to unregister instrumented global variables when
877+
code is unloaded (e.g. via `dlclose()`).
878+
879+
Valid options are:
880+
881+
* ``global`` - Emit module destructors that are called via a platform specific array (see `llvm.global_dtors`).
882+
* ``none`` - Do not emit module destructors.
883+
873884
.. option:: -fsanitize-blacklist=<arg>
874885

875886
Path to blacklist file for sanitizers

clang/docs/ClangFormatStyleOptions.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2360,6 +2360,33 @@ the configuration (without a prefix: ``Auto``).
23602360
``ClassImpl.hpp`` would not have the main include file put on top
23612361
before any other include.
23622362

2363+
**IndentAccessModifiers** (``bool``)
2364+
Specify whether access modifiers should have their own indentation level.
2365+
2366+
When ``false``, access modifiers are indented (or outdented) relative to
2367+
the record members, respecting the ``AccessModifierOffset``. Record
2368+
members are indented one level below the record.
2369+
When ``true``, access modifiers get their own indentation level. As a
2370+
consequence, record members are indented 2 levels below the record,
2371+
regardless of the access modifier presence. Value of the
2372+
``AccessModifierOffset`` is ignored.
2373+
2374+
.. code-block:: c++
2375+
2376+
false: true:
2377+
class C { vs. class C {
2378+
class D { class D {
2379+
void bar(); void bar();
2380+
protected: protected:
2381+
D(); D();
2382+
}; };
2383+
public: public:
2384+
C(); C();
2385+
}; };
2386+
void foo() { void foo() {
2387+
return 1; return 1;
2388+
} }
2389+
23632390
**IndentCaseBlocks** (``bool``)
23642391
Indent case label blocks one level from the case label.
23652392

clang/docs/ReleaseNotes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@ clang-format
196196
- ``BasedOnStyle: InheritParentConfig`` allows to use the ``.clang-format`` of
197197
the parent directories to overwrite only parts of it.
198198

199+
- Option ``IndentAccessModifiers`` has been added to be able to give access
200+
modifiers their own indentation level inside records.
201+
199202
libclang
200203
--------
201204

clang/include/clang/Basic/AttrDocs.td

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5092,9 +5092,8 @@ def NotTailCalledDocs : Documentation {
50925092
let Category = DocCatFunction;
50935093
let Content = [{
50945094
The ``not_tail_called`` attribute prevents tail-call optimization on statically
5095-
bound calls. It has no effect on indirect calls. Virtual functions, objective-c
5096-
methods, and functions marked as ``always_inline`` cannot be marked as
5097-
``not_tail_called``.
5095+
bound calls. Objective-c methods, and functions marked as ``always_inline``
5096+
cannot be marked as ``not_tail_called``.
50985097

50995098
For example, it prevents tail-call optimization in the following case:
51005099

@@ -5120,28 +5119,25 @@ However, it doesn't prevent tail-call optimization in this case:
51205119
return (*fn)(a);
51215120
}
51225121

5123-
Marking virtual functions as ``not_tail_called`` is an error:
5122+
Generally, marking an overriding virtual function as ``not_tail_called`` is
5123+
not useful, because this attribute is a property of the static type. Calls
5124+
made through a pointer or reference to the base class type will respect
5125+
the ``not_tail_called`` attribute of the base class's member function,
5126+
regardless of the runtime destination of the call:
51245127

51255128
.. code-block:: c++
51265129

5127-
class Base {
5128-
public:
5129-
// not_tail_called on a virtual function is an error.
5130-
[[clang::not_tail_called]] virtual int foo1();
5131-
5132-
virtual int foo2();
5133-
5134-
// Non-virtual functions can be marked ``not_tail_called``.
5135-
[[clang::not_tail_called]] int foo3();
5136-
};
5137-
5138-
class Derived1 : public Base {
5139-
public:
5140-
int foo1() override;
5141-
5142-
// not_tail_called on a virtual function is an error.
5143-
[[clang::not_tail_called]] int foo2() override;
5130+
struct Foo { virtual void f(); };
5131+
struct Bar : Foo {
5132+
[[clang::not_tail_called]] void f() override;
51445133
};
5134+
void callera(Bar& bar) {
5135+
Foo& foo = bar;
5136+
// not_tail_called has no effect on here, even though the
5137+
// underlying method is f from Bar.
5138+
foo.f();
5139+
bar.f(); // No tail-call optimization on here.
5140+
}
51455141
}];
51465142
}
51475143

clang/include/clang/Basic/BuiltinsAMDGPU.def

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ BUILTIN(__builtin_amdgcn_grid_size_z, "Ui", "nc")
4444
BUILTIN(__builtin_amdgcn_mbcnt_hi, "UiUiUi", "nc")
4545
BUILTIN(__builtin_amdgcn_mbcnt_lo, "UiUiUi", "nc")
4646

47+
TARGET_BUILTIN(__builtin_amdgcn_s_memtime, "LUi", "n", "s-memtime-inst")
48+
4749
//===----------------------------------------------------------------------===//
4850
// Instruction builtins.
4951
//===----------------------------------------------------------------------===//
@@ -105,7 +107,6 @@ BUILTIN(__builtin_amdgcn_cubeid, "ffff", "nc")
105107
BUILTIN(__builtin_amdgcn_cubesc, "ffff", "nc")
106108
BUILTIN(__builtin_amdgcn_cubetc, "ffff", "nc")
107109
BUILTIN(__builtin_amdgcn_cubema, "ffff", "nc")
108-
BUILTIN(__builtin_amdgcn_s_memtime, "LUi", "n")
109110
BUILTIN(__builtin_amdgcn_s_sleep, "vIi", "n")
110111
BUILTIN(__builtin_amdgcn_s_incperflevel, "vIi", "n")
111112
BUILTIN(__builtin_amdgcn_s_decperflevel, "vIi", "n")

clang/include/clang/Basic/CodeGenOptions.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ CODEGENOPT(SanitizeAddressGlobalsDeadStripping, 1, 0) ///< Enable linker dead st
214214
CODEGENOPT(SanitizeAddressUseOdrIndicator, 1, 0) ///< Enable ODR indicator globals
215215
CODEGENOPT(SanitizeMemoryTrackOrigins, 2, 0) ///< Enable tracking origins in
216216
///< MemorySanitizer
217+
ENUM_CODEGENOPT(SanitizeAddressDtorKind, llvm::AsanDtorKind, 2,
218+
llvm::AsanDtorKind::Global) ///< Set how ASan global
219+
///< destructors are emitted.
217220
CODEGENOPT(SanitizeMemoryUseAfterDtor, 1, 0) ///< Enable use-after-delete detection
218221
///< in MemorySanitizer
219222
CODEGENOPT(SanitizeCfiCrossDso, 1, 0) ///< Enable cross-dso support in CFI.

clang/include/clang/Basic/CodeGenOptions.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "llvm/Support/CodeGen.h"
2121
#include "llvm/Support/Regex.h"
2222
#include "llvm/Target/TargetOptions.h"
23+
#include "llvm/Transforms/Instrumentation/AddressSanitizerOptions.h"
2324
#include <map>
2425
#include <memory>
2526
#include <string>
@@ -173,7 +174,7 @@ class CodeGenOptions : public CodeGenOptionsBase {
173174
std::string DebugCompilationDir;
174175

175176
/// The string to embed in coverage mapping as the current working directory.
176-
std::string ProfileCompilationDir;
177+
std::string CoverageCompilationDir;
177178

178179
/// The string to embed in the debug information for the compile unit, if
179180
/// non-empty.
@@ -184,7 +185,7 @@ class CodeGenOptions : public CodeGenOptionsBase {
184185
std::string RecordCommandLine;
185186

186187
std::map<std::string, std::string> DebugPrefixMap;
187-
std::map<std::string, std::string> ProfilePrefixMap;
188+
std::map<std::string, std::string> CoveragePrefixMap;
188189

189190
/// The ABI to use for passing floating point arguments.
190191
std::string FloatABI;

clang/include/clang/Basic/Diagnostic.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,13 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
273273
// Which overload candidates to show.
274274
OverloadsShown ShowOverloads = Ovl_All;
275275

276+
// With Ovl_Best, the number of overload candidates to show when we encounter
277+
// an error.
278+
//
279+
// The value here is the number of candidates to show in the first nontrivial
280+
// error. Future errors may show a different number of candidates.
281+
unsigned NumOverloadsToShow = 32;
282+
276283
// Cap of # errors emitted, 0 -> no limit.
277284
unsigned ErrorLimit = 0;
278285

@@ -707,6 +714,36 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
707714
}
708715
OverloadsShown getShowOverloads() const { return ShowOverloads; }
709716

717+
/// When a call or operator fails, print out up to this many candidate
718+
/// overloads as suggestions.
719+
///
720+
/// With Ovl_Best, we set a high limit for the first nontrivial overload set
721+
/// we print, and a lower limit for later sets. This way the user has a
722+
/// chance of diagnosing at least one callsite in their program without
723+
/// having to recompile with -fshow-overloads=all.
724+
unsigned getNumOverloadCandidatesToShow() const {
725+
switch (getShowOverloads()) {
726+
case Ovl_All:
727+
// INT_MAX rather than UINT_MAX so that we don't have to think about the
728+
// effect of implicit conversions on this value. In practice we'll never
729+
// hit 2^31 candidates anyway.
730+
return std::numeric_limits<int>::max();
731+
case Ovl_Best:
732+
return NumOverloadsToShow;
733+
}
734+
}
735+
736+
/// Call this after showing N overload candidates. This influences the value
737+
/// returned by later calls to getNumOverloadCandidatesToShow().
738+
void overloadCandidatesShown(unsigned N) {
739+
// Current heuristic: Start out with a large value for NumOverloadsToShow,
740+
// and then once we print one nontrivially-large overload set, decrease it
741+
// for future calls.
742+
if (N > 4) {
743+
NumOverloadsToShow = 4;
744+
}
745+
}
746+
710747
/// Pretend that the last diagnostic issued was ignored, so any
711748
/// subsequent notes will be suppressed, or restore a prior ignoring
712749
/// state after ignoring some diagnostics and their notes, possibly in

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3130,6 +3130,8 @@ def err_only_annotate_after_access_spec : Error<
31303130

31313131
def err_attribute_section_invalid_for_target : Error<
31323132
"argument to %select{'code_seg'|'section'}1 attribute is not valid for this target: %0">;
3133+
def err_pragma_section_invalid_for_target : Error<
3134+
"argument to #pragma section is not valid for this target: %0">;
31333135
def warn_attribute_section_drectve : Warning<
31343136
"#pragma %0(\".drectve\") has undefined behavior, "
31353137
"use #pragma comment(linker, ...) instead">, InGroup<MicrosoftDrectveSection>;
@@ -7676,7 +7678,7 @@ def warn_condition_is_assignment : Warning<"using the result of an "
76767678
"assignment as a condition without parentheses">,
76777679
InGroup<Parentheses>;
76787680
def warn_free_nonheap_object
7679-
: Warning<"attempt to call %0 on non-heap object %1">,
7681+
: Warning<"attempt to call %0 on non-heap %select{object %2|object: block expression|object: lambda-to-function-pointer conversion}1">,
76807682
InGroup<FreeNonHeapObject>;
76817683

76827684
// Completely identical except off by default.

clang/include/clang/Basic/Sanitizers.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "clang/Basic/LLVM.h"
1818
#include "llvm/ADT/StringRef.h"
1919
#include "llvm/Support/MathExtras.h"
20+
#include "llvm/Transforms/Instrumentation/AddressSanitizerOptions.h"
2021
#include <cassert>
2122
#include <cstdint>
2223

@@ -193,6 +194,10 @@ inline SanitizerMask getPPTransparentSanitizers() {
193194
SanitizerKind::Undefined | SanitizerKind::FloatDivideByZero;
194195
}
195196

197+
StringRef AsanDtorKindToString(llvm::AsanDtorKind kind);
198+
199+
llvm::AsanDtorKind AsanDtorKindFromString(StringRef kind);
200+
196201
} // namespace clang
197202

198203
#endif // LLVM_CLANG_BASIC_SANITIZERS_H

0 commit comments

Comments
 (0)