Skip to content

Commit

Permalink
Merged main:772b1b0cb26c66804d0a7e416dc7a5742b7f8db2 into amd-gfx:431…
Browse files Browse the repository at this point in the history
…25be5ad0d

Local branch amd-gfx 43125be Merged main:f97f039e0bb7bb60c9cc437f678059c5ee19c8da into amd-gfx:ce126627c1f0
Remote branch main 772b1b0 [scudo] Move the chunk update into functions (llvm#83493)
  • Loading branch information
SC llvm team authored and SC llvm team committed May 16, 2024
2 parents 43125be + 772b1b0 commit d3020e4
Show file tree
Hide file tree
Showing 53 changed files with 873 additions and 251 deletions.
6 changes: 5 additions & 1 deletion clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ C++ Specific Potentially Breaking Changes
- The behavior controlled by the `-frelaxed-template-template-args` flag is now
on by default, and the flag is deprecated. Until the flag is finally removed,
it's negative spelling can be used to obtain compatibility with previous
versions of clang.
versions of clang. The deprecation warning for the negative spelling can be
disabled with `-Wno-deprecated-no-relaxed-template-template-args`.

- Clang now rejects pointer to member from parenthesized expression in unevaluated context such as ``decltype(&(foo::bar))``. (#GH40906).

Expand Down Expand Up @@ -713,6 +714,9 @@ Bug Fixes to C++ Support
- Correctly treat the compound statement of an ``if consteval`` as an immediate context. Fixes (#GH91509).
- When partial ordering alias templates against template template parameters,
allow pack expansions when the alias has a fixed-size parameter list. Fixes (#GH62529).
- Clang now ignores template parameters only used within the exception specification of candidate function
templates during partial ordering when deducing template arguments from a function declaration or when
taking the address of a function template.

Bug Fixes to AST Handling
^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
3 changes: 3 additions & 0 deletions clang/include/clang/Basic/DiagnosticDriverKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,9 @@ def warn_drv_clang_unsupported : Warning<
"the clang compiler does not support '%0'">;
def warn_drv_deprecated_arg : Warning<
"argument '%0' is deprecated%select{|, use '%2' instead}1">, InGroup<Deprecated>;
def warn_drv_deprecated_arg_no_relaxed_template_template_args : Warning<
"argument '-fno-relaxed-template-template-args' is deprecated">,
InGroup<DeprecatedNoRelaxedTemplateTemplateArgs>;
def warn_drv_deprecated_custom : Warning<
"argument '%0' is deprecated, %1">, InGroup<Deprecated>;
def warn_drv_assuming_mfloat_abi_is : Warning<
Expand Down
2 changes: 2 additions & 0 deletions clang/include/clang/Basic/DiagnosticGroups.td
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def EnumConversion : DiagGroup<"enum-conversion",
[EnumEnumConversion,
EnumFloatConversion,
EnumCompareConditional]>;
def DeprecatedNoRelaxedTemplateTemplateArgs : DiagGroup<"deprecated-no-relaxed-template-template-args">;
def ObjCSignedCharBoolImplicitIntConversion :
DiagGroup<"objc-signed-char-bool-implicit-int-conversion">;
def Shorten64To32 : DiagGroup<"shorten-64-to-32">;
Expand Down Expand Up @@ -228,6 +229,7 @@ def Deprecated : DiagGroup<"deprecated", [DeprecatedAnonEnumEnumConversion,
DeprecatedLiteralOperator,
DeprecatedPragma,
DeprecatedRegister,
DeprecatedNoRelaxedTemplateTemplateArgs,
DeprecatedThisCapture,
DeprecatedType,
DeprecatedVolatile,
Expand Down
4 changes: 3 additions & 1 deletion clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -6647,7 +6647,9 @@ def fdebug_unparse : Flag<["-"], "fdebug-unparse">, Group<Action_Group>,
DocBrief<[{Run the parser and the semantic checks. Then unparse the
parse-tree and output the generated Fortran source file.}]>;
def fdebug_unparse_with_symbols : Flag<["-"], "fdebug-unparse-with-symbols">, Group<Action_Group>,
HelpText<"Unparse and stop.">;
HelpText<"Unparse with symbols and stop.">;
def fdebug_unparse_with_modules : Flag<["-"], "fdebug-unparse-with-modules">, Group<Action_Group>,
HelpText<"Unparse with dependent modules and stop.">;
def fdebug_dump_symbols : Flag<["-"], "fdebug-dump-symbols">, Group<Action_Group>,
HelpText<"Dump symbols after the semantic analysis">;
def fdebug_dump_parse_tree : Flag<["-"], "fdebug-dump-parse-tree">, Group<Action_Group>,
Expand Down
8 changes: 8 additions & 0 deletions clang/lib/CodeGen/CoverageMappingGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1439,6 +1439,10 @@ struct CounterCoverageMappingBuilder
terminateRegion(S);
}

void VisitCoroutineSuspendExpr(const CoroutineSuspendExpr *E) {
Visit(E->getOperand());
}

void VisitCXXThrowExpr(const CXXThrowExpr *E) {
extendRegion(E);
if (E->getSubExpr())
Expand Down Expand Up @@ -2173,6 +2177,10 @@ struct CounterCoverageMappingBuilder
// propagate counts into them.
}

void VisitArrayInitLoopExpr(const ArrayInitLoopExpr *AILE) {
Visit(AILE->getCommonExpr()->getSourceExpr());
}

void VisitPseudoObjectExpr(const PseudoObjectExpr *POE) {
// Just visit syntatic expression as this is what users actually write.
VisitStmt(POE->getSyntacticForm());
Expand Down
10 changes: 7 additions & 3 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7253,10 +7253,14 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (Arg *A =
Args.getLastArg(options::OPT_frelaxed_template_template_args,
options::OPT_fno_relaxed_template_template_args)) {
D.Diag(diag::warn_drv_deprecated_arg)
<< A->getAsString(Args) << /*hasReplacement=*/false;
if (A->getOption().matches(options::OPT_fno_relaxed_template_template_args))
if (A->getOption().matches(
options::OPT_fno_relaxed_template_template_args)) {
D.Diag(diag::warn_drv_deprecated_arg_no_relaxed_template_template_args);
CmdArgs.push_back("-fno-relaxed-template-template-args");
} else {
D.Diag(diag::warn_drv_deprecated_arg)
<< A->getAsString(Args) << /*hasReplacement=*/false;
}
}

// -fsized-deallocation is off by default, as it is an ABI-breaking change for
Expand Down
36 changes: 28 additions & 8 deletions clang/lib/Sema/SemaTemplateDeduction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5453,7 +5453,7 @@ static bool isAtLeastAsSpecializedAs(Sema &S, SourceLocation Loc,
// is used.
if (DeduceTemplateArgumentsByTypeMatch(
S, TemplateParams, FD2->getType(), FD1->getType(), Info, Deduced,
TDF_None,
TDF_AllowCompatibleFunctionType,
/*PartialOrdering=*/true) != TemplateDeductionResult::Success)
return false;
break;
Expand Down Expand Up @@ -5485,20 +5485,40 @@ static bool isAtLeastAsSpecializedAs(Sema &S, SourceLocation Loc,
switch (TPOC) {
case TPOC_Call:
for (unsigned I = 0, N = Args2.size(); I != N; ++I)
::MarkUsedTemplateParameters(S.Context, Args2[I], false,
TemplateParams->getDepth(),
UsedParameters);
::MarkUsedTemplateParameters(S.Context, Args2[I], /*OnlyDeduced=*/false,
TemplateParams->getDepth(), UsedParameters);
break;

case TPOC_Conversion:
::MarkUsedTemplateParameters(S.Context, Proto2->getReturnType(), false,
::MarkUsedTemplateParameters(S.Context, Proto2->getReturnType(),
/*OnlyDeduced=*/false,
TemplateParams->getDepth(), UsedParameters);
break;

case TPOC_Other:
::MarkUsedTemplateParameters(S.Context, FD2->getType(), false,
TemplateParams->getDepth(),
UsedParameters);
// We do not deduce template arguments from the exception specification
// when determining the primary template of a function template
// specialization or when taking the address of a function template.
// Therefore, we do not mark template parameters in the exception
// specification as used during partial ordering to prevent the following
// from being ambiguous:
//
// template<typename T, typename U>
// void f(U) noexcept(noexcept(T())); // #1
//
// template<typename T>
// void f(T*) noexcept; // #2
//
// template<>
// void f<int>(int*) noexcept; // explicit specialization of #2
//
// Although there is no corresponding wording in the standard, this seems
// to be the intended behavior given the definition of
// 'deduction substitution loci' in [temp.deduct].
::MarkUsedTemplateParameters(
S.Context,
S.Context.getFunctionTypeWithExceptionSpec(FD2->getType(), EST_None),
/*OnlyDeduced=*/false, TemplateParams->getDepth(), UsedParameters);
break;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// expected-no-diagnostics

template<bool B>
struct A { };

constexpr A<false> a;
constexpr A<false> b;

constexpr int* x = nullptr;
constexpr short* y = nullptr;

namespace ExplicitArgs {
template<typename T, typename U>
constexpr int f(U) noexcept(noexcept(T())) {
return 0;
}

template<typename T>
constexpr int f(T*) noexcept {
return 1;
}

template<>
constexpr int f<int>(int*) noexcept {
return 2;
}

static_assert(f<int>(1) == 0);
static_assert(f<short>(y) == 1);
static_assert(f<int>(x) == 2);

template<typename T, typename U>
constexpr int g(U*) noexcept(noexcept(T())) {
return 3;
}

template<typename T>
constexpr int g(T) noexcept {
return 4;
}

template<>
constexpr int g<int>(int*) noexcept {
return 5;
}

static_assert(g<int>(y) == 3);
static_assert(g<short>(1) == 4);
static_assert(g<int>(x) == 5);
} // namespace ExplicitArgs

namespace DeducedArgs {
template<typename T, bool B>
constexpr int f(T, A<B>) noexcept(B) {
return 0;
}

template<typename T, bool B>
constexpr int f(T*, A<B>) noexcept(B && B) {
return 1;
}

template<>
constexpr int f(int*, A<false>) {
return 2;
}

static_assert(f<int*>(x, a) == 0);
static_assert(f<short>(y, a) == 1);
static_assert(f<int>(x, a) == 2);
} // namespace DeducedArgs
19 changes: 19 additions & 0 deletions clang/test/CoverageMapping/coroutine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ struct std::coroutine_traits<int, int> {
suspend_always final_suspend() noexcept;
void unhandled_exception() noexcept;
void return_value(int);
suspend_always yield_value(int);
};
};

Expand All @@ -45,3 +46,21 @@ int f1(int x) { // CHECK-NEXT: File 0, [[@LINE]]:15 -> [[@LINE+8]]:2 = #0
} // CHECK-NEXT: File 0, [[@LINE-2]]:10 -> [[@LINE]]:4 = (#0 - #1)
co_return x; // CHECK-NEXT: Gap,File 0, [[@LINE-1]]:4 -> [[@LINE]]:3 = #1
} // CHECK-NEXT: File 0, [[@LINE-1]]:3 -> [[@LINE-1]]:14 = #1

// CHECK-LABEL: _Z2f2i:
// CHECK-NEXT: File 0, [[@LINE+1]]:15 -> [[@LINE+15]]:2 = #0
int f2(int x) {
// CHECK-NEXT: File 0, [[@LINE+5]]:13 -> [[@LINE+5]]:18 = #0
// CHECK-NEXT: Branch,File 0, [[@LINE+4]]:13 -> [[@LINE+4]]:18 = #1, (#0 - #1)
// CHECK-NEXT: Gap,File 0, [[@LINE+3]]:20 -> [[@LINE+3]]:21 = #1
// CHECK-NEXT: File 0, [[@LINE+2]]:21 -> [[@LINE+2]]:37 = #1
// CHECK-NEXT: File 0, [[@LINE+1]]:40 -> [[@LINE+1]]:56 = (#0 - #1)
co_await (x > 0 ? suspend_always{} : suspend_always{});
// CHECK-NEXT: File 0, [[@LINE+5]]:12 -> [[@LINE+5]]:17 = #0
// CHECK-NEXT: Branch,File 0, [[@LINE+4]]:12 -> [[@LINE+4]]:17 = #2, (#0 - #2)
// CHECK-NEXT: Gap,File 0, [[@LINE+3]]:19 -> [[@LINE+3]]:20 = #2
// CHECK-NEXT: File 0, [[@LINE+2]]:20 -> [[@LINE+2]]:21 = #2
// CHECK-NEXT: File 0, [[@LINE+1]]:24 -> [[@LINE+1]]:25 = (#0 - #2)
co_yield x > 0 ? 1 : 2;
co_return 0;
}
15 changes: 15 additions & 0 deletions clang/test/CoverageMapping/decomposition.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -triple %itanium_abi_triple -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only %s | FileCheck %s

// CHECK-LABEL: _Z19array_decompositioni:
// CHECK-NEXT: File 0, [[@LINE+6]]:32 -> {{[0-9]+}}:2 = #0
// CHECK-NEXT: File 0, [[@LINE+8]]:20 -> [[@LINE+8]]:25 = #0
// CHECK-NEXT: Branch,File 0, [[@LINE+7]]:20 -> [[@LINE+7]]:25 = #1, (#0 - #1)
// CHECK-NEXT: Gap,File 0, [[@LINE+6]]:27 -> [[@LINE+6]]:28 = #1
// CHECK-NEXT: File 0, [[@LINE+5]]:28 -> [[@LINE+5]]:29 = #1
// CHECK-NEXT: File 0, [[@LINE+4]]:32 -> [[@LINE+4]]:33 = (#0 - #1)
int array_decomposition(int i) {
int a[] = {1, 2, 3};
int b[] = {4, 5, 6};
auto [x, y, z] = i > 0 ? a : b;
return x + y + z;
}
4 changes: 3 additions & 1 deletion clang/test/Driver/frelaxed-template-template-args.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// RUN: %clang -fsyntax-only -### %s 2>&1 | FileCheck --check-prefix=CHECK-DEF %s
// RUN: %clang -fsyntax-only -frelaxed-template-template-args %s 2>&1 | FileCheck --check-prefix=CHECK-ON %s
// RUN: %clang -fsyntax-only -fno-relaxed-template-template-args %s 2>&1 | FileCheck --check-prefix=CHECK-OFF %s
// RUN: %clang -fsyntax-only -fno-relaxed-template-template-args -Wno-deprecated-no-relaxed-template-template-args %s 2>&1 | FileCheck --check-prefix=CHECK-DIS --allow-empty %s

// CHECK-DEF-NOT: "-cc1"{{.*}} "-fno-relaxed-template-template-args"
// CHECK-ON: warning: argument '-frelaxed-template-template-args' is deprecated [-Wdeprecated]
// CHECK-OFF: warning: argument '-fno-relaxed-template-template-args' is deprecated [-Wdeprecated]
// CHECK-OFF: warning: argument '-fno-relaxed-template-template-args' is deprecated [-Wdeprecated-no-relaxed-template-template-args]
// CHECK-DIS-NOT: warning: argument '-fno-relaxed-template-template-args' is deprecated
Loading

0 comments on commit d3020e4

Please sign in to comment.