Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit 0141a6c

Browse files
AutomergerAutomerger
authored andcommitted
Propagating prior merge from 'llvm.org/master'.
2 parents a7af76c + 54f39e1 commit 0141a6c

File tree

65 files changed

+1996
-231
lines changed

Some content is hidden

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

65 files changed

+1996
-231
lines changed

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
1616
"--libdir"
1717
"--includedir"
1818
"--prefix"
19-
"--src-root")
19+
"--src-root"
20+
"--cmakedir")
2021
execute_process(
2122
COMMAND ${CONFIG_COMMAND}
2223
RESULT_VARIABLE HAD_ERROR
@@ -41,6 +42,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
4142
list(GET CONFIG_OUTPUT 3 INCLUDE_DIR)
4243
list(GET CONFIG_OUTPUT 4 LLVM_OBJ_ROOT)
4344
list(GET CONFIG_OUTPUT 5 MAIN_SRC_DIR)
45+
list(GET CONFIG_OUTPUT 6 LLVM_CMAKE_PATH)
4446

4547
if(NOT MSVC_IDE)
4648
set(LLVM_ENABLE_ASSERTIONS ${ENABLE_ASSERTIONS}
@@ -58,7 +60,6 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
5860
find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR}
5961
NO_DEFAULT_PATH)
6062

61-
set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
6263
set(LLVMCONFIG_FILE "${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
6364
if(EXISTS ${LLVMCONFIG_FILE})
6465
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")

include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8803,10 +8803,6 @@ def err_coroutine_invalid_func_context : Error<
88038803
"|a copy assignment operator|a move assignment operator|the 'main' function"
88048804
"|a constexpr function|a function with a deduced return type"
88058805
"|a varargs function}0">;
8806-
def ext_coroutine_without_co_await_co_yield : ExtWarn<
8807-
"'co_return' used in a function "
8808-
"that uses neither 'co_await' nor 'co_yield'">,
8809-
InGroup<DiagGroup<"coreturn-without-coawait">>;
88108806
def err_implied_std_coroutine_traits_not_found : Error<
88118807
"you need to include <experimental/coroutine> before defining a coroutine">;
88128808
def err_malformed_std_coroutine_traits : Error<

include/clang/Basic/LangOptions.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ LANGOPT(Modules , 1, 0, "modules extension to C")
146146
COMPATIBLE_LANGOPT(ModulesTS , 1, 0, "C++ Modules TS")
147147
BENIGN_ENUM_LANGOPT(CompilingModule, CompilingModuleKind, 2, CMK_None,
148148
"compiling a module interface")
149+
BENIGN_LANGOPT(CompilingPCH, 1, 0, "building a pch")
149150
COMPATIBLE_LANGOPT(ModulesDeclUse , 1, 0, "require declaration of module uses")
150151
BENIGN_LANGOPT(ModulesSearchAll , 1, 1, "searching even non-imported modules to find unresolved references")
151152
COMPATIBLE_LANGOPT(ModulesStrictDeclUse, 1, 0, "requiring declaration of module uses and all headers to be in modules")

include/clang/Basic/OpenMPKinds.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,6 @@ OPENMP_TARGET_PARALLEL_CLAUSE(reduction)
483483
OPENMP_TARGET_PARALLEL_CLAUSE(is_device_ptr)
484484

485485
// Clauses allowed for OpenMP directive 'target parallel for'.
486-
// TODO: add target clauses 'is_device_ptr'
487486
OPENMP_TARGET_PARALLEL_FOR_CLAUSE(if)
488487
OPENMP_TARGET_PARALLEL_FOR_CLAUSE(device)
489488
OPENMP_TARGET_PARALLEL_FOR_CLAUSE(map)
@@ -502,6 +501,7 @@ OPENMP_TARGET_PARALLEL_FOR_CLAUSE(collapse)
502501
OPENMP_TARGET_PARALLEL_FOR_CLAUSE(schedule)
503502
OPENMP_TARGET_PARALLEL_FOR_CLAUSE(ordered)
504503
OPENMP_TARGET_PARALLEL_FOR_CLAUSE(linear)
504+
OPENMP_TARGET_PARALLEL_FOR_CLAUSE(is_device_ptr)
505505

506506
// Clauses allowed for OpenMP directive 'target update'.
507507
// TODO More clauses for 'target update' directive.
@@ -633,7 +633,6 @@ OPENMP_DISTRIBUTE_SIMD_CLAUSE(simdlen)
633633
OPENMP_DISTRIBUTE_SIMD_CLAUSE(reduction)
634634

635635
// Clauses allowed for OpenMP directive 'target parallel for simd'.
636-
// TODO: add target clauses 'is_device_ptr'
637636
OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(if)
638637
OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(device)
639638
OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(map)
@@ -655,6 +654,7 @@ OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(linear)
655654
OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(safelen)
656655
OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(simdlen)
657656
OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(aligned)
657+
OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(is_device_ptr)
658658

659659
// Clauses allowed for OpenMP directive 'target simd'.
660660
OPENMP_TARGET_SIMD_CLAUSE(if)

include/clang/Frontend/FrontendActions.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ class GeneratePCHAction : public ASTFrontendAction {
8888
static std::unique_ptr<raw_pwrite_stream>
8989
ComputeASTConsumerArguments(CompilerInstance &CI, StringRef InFile,
9090
std::string &Sysroot, std::string &OutputFile);
91+
92+
bool BeginSourceFileAction(CompilerInstance &CI, StringRef Filename) override;
9193
};
9294

9395
class GenerateModuleAction : public ASTFrontendAction {

lib/AST/Expr.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -562,8 +562,7 @@ std::string PredefinedExpr::ComputeName(IdentType IT, const Decl *CurrentDecl) {
562562
FT = dyn_cast<FunctionProtoType>(AFT);
563563

564564
if (IT == FuncSig) {
565-
assert(FT && "We must have a written prototype in this case.");
566-
switch (FT->getCallConv()) {
565+
switch (AFT->getCallConv()) {
567566
case CC_C: POut << "__cdecl "; break;
568567
case CC_X86StdCall: POut << "__stdcall "; break;
569568
case CC_X86FastCall: POut << "__fastcall "; break;
@@ -587,12 +586,15 @@ std::string PredefinedExpr::ComputeName(IdentType IT, const Decl *CurrentDecl) {
587586
if (FT->isVariadic()) {
588587
if (FD->getNumParams()) POut << ", ";
589588
POut << "...";
589+
} else if ((IT == FuncSig || !Context.getLangOpts().CPlusPlus) &&
590+
!Decl->getNumParams()) {
591+
POut << "void";
590592
}
591593
}
592594
POut << ")";
593595

594596
if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) {
595-
const FunctionType *FT = MD->getType()->castAs<FunctionType>();
597+
assert(FT && "We must have a written prototype in this case.");
596598
if (FT->isConst())
597599
POut << " const";
598600
if (FT->isVolatile())

lib/AST/ExprConstant.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1627,8 +1627,17 @@ static bool CheckLiteralType(EvalInfo &Info, const Expr *E,
16271627
// C++1y: A constant initializer for an object o [...] may also invoke
16281628
// constexpr constructors for o and its subobjects even if those objects
16291629
// are of non-literal class types.
1630-
if (Info.getLangOpts().CPlusPlus14 && This &&
1631-
Info.EvaluatingDecl == This->getLValueBase())
1630+
//
1631+
// C++11 missed this detail for aggregates, so classes like this:
1632+
// struct foo_t { union { int i; volatile int j; } u; };
1633+
// are not (obviously) initializable like so:
1634+
// __attribute__((__require_constant_initialization__))
1635+
// static const foo_t x = {{0}};
1636+
// because "i" is a subobject with non-literal initialization (due to the
1637+
// volatile member of the union). See:
1638+
// http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1677
1639+
// Therefore, we use the C++1y behavior.
1640+
if (This && Info.EvaluatingDecl == This->getLValueBase())
16321641
return true;
16331642

16341643
// Prvalue constant expressions must be of literal types.

lib/AST/MicrosoftMangle.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,13 @@ static const DeclContext *getEffectiveParentContext(const DeclContext *DC) {
109109

110110
static const FunctionDecl *getStructor(const NamedDecl *ND) {
111111
if (const auto *FTD = dyn_cast<FunctionTemplateDecl>(ND))
112-
return FTD->getTemplatedDecl();
112+
return FTD->getTemplatedDecl()->getCanonicalDecl();
113113

114114
const auto *FD = cast<FunctionDecl>(ND);
115115
if (const auto *FTD = FD->getPrimaryTemplate())
116-
return FTD->getTemplatedDecl();
116+
return FTD->getTemplatedDecl()->getCanonicalDecl();
117117

118-
return FD;
118+
return FD->getCanonicalDecl();
119119
}
120120

121121
/// MicrosoftMangleContextImpl - Overrides the default MangleContext for the
@@ -312,6 +312,10 @@ class MicrosoftCXXNameMangler {
312312
void mangleNestedName(const NamedDecl *ND);
313313

314314
private:
315+
bool isStructorDecl(const NamedDecl *ND) const {
316+
return ND == Structor || getStructor(ND) == Structor;
317+
}
318+
315319
void mangleUnqualifiedName(const NamedDecl *ND) {
316320
mangleUnqualifiedName(ND, ND->getDeclName());
317321
}
@@ -898,7 +902,7 @@ void MicrosoftCXXNameMangler::mangleUnqualifiedName(const NamedDecl *ND,
898902
llvm_unreachable("Can't mangle Objective-C selector names here!");
899903

900904
case DeclarationName::CXXConstructorName:
901-
if (Structor == getStructor(ND)) {
905+
if (isStructorDecl(ND)) {
902906
if (StructorType == Ctor_CopyingClosure) {
903907
Out << "?_O";
904908
return;
@@ -912,7 +916,7 @@ void MicrosoftCXXNameMangler::mangleUnqualifiedName(const NamedDecl *ND,
912916
return;
913917

914918
case DeclarationName::CXXDestructorName:
915-
if (ND == Structor)
919+
if (isStructorDecl(ND))
916920
// If the named decl is the C++ destructor we're mangling,
917921
// use the type we were given.
918922
mangleCXXDtorType(static_cast<CXXDtorType>(StructorType));
@@ -1862,7 +1866,7 @@ void MicrosoftCXXNameMangler::mangleFunctionType(const FunctionType *T,
18621866
IsStructor = true;
18631867
IsCtorClosure = (StructorType == Ctor_CopyingClosure ||
18641868
StructorType == Ctor_DefaultClosure) &&
1865-
getStructor(MD) == Structor;
1869+
isStructorDecl(MD);
18661870
if (IsCtorClosure)
18671871
CC = getASTContext().getDefaultCallingConvention(
18681872
/*IsVariadic=*/false, /*IsCXXMethod=*/true);
@@ -1883,7 +1887,7 @@ void MicrosoftCXXNameMangler::mangleFunctionType(const FunctionType *T,
18831887
// <return-type> ::= <type>
18841888
// ::= @ # structors (they have no declared return type)
18851889
if (IsStructor) {
1886-
if (isa<CXXDestructorDecl>(D) && D == Structor &&
1890+
if (isa<CXXDestructorDecl>(D) && isStructorDecl(D) &&
18871891
StructorType == Dtor_Deleting) {
18881892
// The scalar deleting destructor takes an extra int argument.
18891893
// However, the FunctionType generated has 0 arguments.

lib/Basic/Targets.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2663,6 +2663,12 @@ class X86TargetInfo : public TargetInfo {
26632663
CK_BDVER4,
26642664
//@}
26652665

2666+
/// \name zen
2667+
/// Zen architecture processors.
2668+
//@{
2669+
CK_ZNVER1,
2670+
//@}
2671+
26662672
/// This specification is deprecated and will be removed in the future.
26672673
/// Users should prefer \see CK_K8.
26682674
// FIXME: Warn on this when the CPU is set to it.
@@ -2744,6 +2750,7 @@ class X86TargetInfo : public TargetInfo {
27442750
.Case("bdver2", CK_BDVER2)
27452751
.Case("bdver3", CK_BDVER3)
27462752
.Case("bdver4", CK_BDVER4)
2753+
.Case("znver1", CK_ZNVER1)
27472754
.Case("x86-64", CK_x86_64)
27482755
.Case("geode", CK_Geode)
27492756
.Default(CK_Generic);
@@ -2943,6 +2950,7 @@ class X86TargetInfo : public TargetInfo {
29432950
case CK_BDVER2:
29442951
case CK_BDVER3:
29452952
case CK_BDVER4:
2953+
case CK_ZNVER1:
29462954
case CK_x86_64:
29472955
return true;
29482956
}
@@ -3190,6 +3198,33 @@ bool X86TargetInfo::initFeatureMap(
31903198
setFeatureEnabledImpl(Features, "cx16", true);
31913199
setFeatureEnabledImpl(Features, "fxsr", true);
31923200
break;
3201+
case CK_ZNVER1:
3202+
setFeatureEnabledImpl(Features, "adx", true);
3203+
setFeatureEnabledImpl(Features, "aes", true);
3204+
setFeatureEnabledImpl(Features, "avx2", true);
3205+
setFeatureEnabledImpl(Features, "bmi", true);
3206+
setFeatureEnabledImpl(Features, "bmi2", true);
3207+
setFeatureEnabledImpl(Features, "clflushopt", true);
3208+
setFeatureEnabledImpl(Features, "cx16", true);
3209+
setFeatureEnabledImpl(Features, "f16c", true);
3210+
setFeatureEnabledImpl(Features, "fma", true);
3211+
setFeatureEnabledImpl(Features, "fsgsbase", true);
3212+
setFeatureEnabledImpl(Features, "fxsr", true);
3213+
setFeatureEnabledImpl(Features, "lzcnt", true);
3214+
setFeatureEnabledImpl(Features, "mwaitx", true);
3215+
setFeatureEnabledImpl(Features, "movbe", true);
3216+
setFeatureEnabledImpl(Features, "pclmul", true);
3217+
setFeatureEnabledImpl(Features, "popcnt", true);
3218+
setFeatureEnabledImpl(Features, "prfchw", true);
3219+
setFeatureEnabledImpl(Features, "rdrnd", true);
3220+
setFeatureEnabledImpl(Features, "rdseed", true);
3221+
setFeatureEnabledImpl(Features, "sha", true);
3222+
setFeatureEnabledImpl(Features, "sse4a", true);
3223+
setFeatureEnabledImpl(Features, "xsave", true);
3224+
setFeatureEnabledImpl(Features, "xsavec", true);
3225+
setFeatureEnabledImpl(Features, "xsaveopt", true);
3226+
setFeatureEnabledImpl(Features, "xsaves", true);
3227+
break;
31933228
case CK_BDVER4:
31943229
setFeatureEnabledImpl(Features, "avx2", true);
31953230
setFeatureEnabledImpl(Features, "bmi2", true);
@@ -3741,6 +3776,9 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts,
37413776
case CK_BDVER4:
37423777
defineCPUMacros(Builder, "bdver4");
37433778
break;
3779+
case CK_ZNVER1:
3780+
defineCPUMacros(Builder, "znver1");
3781+
break;
37443782
case CK_Geode:
37453783
defineCPUMacros(Builder, "geode");
37463784
break;

lib/Driver/ToolChains.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3812,6 +3812,7 @@ ToolChain::CXXStdlibType NetBSD::GetDefaultCXXStdlibType() const {
38123812
if (Major >= 7 || Major == 0) {
38133813
switch (getArch()) {
38143814
case llvm::Triple::aarch64:
3815+
case llvm::Triple::aarch64_be:
38153816
case llvm::Triple::arm:
38163817
case llvm::Triple::armeb:
38173818
case llvm::Triple::thumb:

0 commit comments

Comments
 (0)