Vendor import of clang release_80 branch r364487:

https://llvm.org/svn/llvm-project/cfe/branches/release_80@364487
This commit is contained in:
Dimitry Andric 2019-07-06 15:33:52 +00:00
parent 70198750b9
commit 6dcbd4ab23
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/clang/dist-release_80/; revision=349779
svn path=/vendor/clang/clang-release_80-r364487/; revision=349780; tag=vendor/clang/clang-release_80-r364487
7 changed files with 50 additions and 31 deletions

View File

@ -1937,8 +1937,9 @@ void MicrosoftCXXNameMangler::mangleType(const BuiltinType *T, Qualifiers,
// ::= _M # unsigned __int128
// ::= _N # bool
// _O # <array in parameter>
// ::= _T # __float80 (Intel)
// ::= _Q # char8_t
// ::= _S # char16_t
// ::= _T # __float80 (Intel)
// ::= _U # char32_t
// ::= _W # wchar_t
// ::= _Z # __float80 (Digital Mars)
@ -1999,6 +2000,9 @@ void MicrosoftCXXNameMangler::mangleType(const BuiltinType *T, Qualifiers,
case BuiltinType::Bool:
Out << "_N";
break;
case BuiltinType::Char8:
Out << "_Q";
break;
case BuiltinType::Char16:
Out << "_S";
break;
@ -2094,7 +2098,6 @@ void MicrosoftCXXNameMangler::mangleType(const BuiltinType *T, Qualifiers,
case BuiltinType::SatUShortFract:
case BuiltinType::SatUFract:
case BuiltinType::SatULongFract:
case BuiltinType::Char8:
case BuiltinType::Float128: {
DiagnosticsEngine &Diags = Context.getDiags();
unsigned DiagID = Diags.getCustomDiagID(

View File

@ -1817,32 +1817,24 @@ CGDebugInfo::CollectFunctionTemplateParams(const FunctionDecl *FD,
}
llvm::DINodeArray CGDebugInfo::CollectVarTemplateParams(const VarDecl *VL,
llvm::DIFile *Unit) {
if (auto *TS = dyn_cast<VarTemplateSpecializationDecl>(VL)) {
auto T = TS->getSpecializedTemplateOrPartial();
auto TA = TS->getTemplateArgs().asArray();
// Collect parameters for a partial specialization
if (T.is<VarTemplatePartialSpecializationDecl *>()) {
const TemplateParameterList *TList =
T.get<VarTemplatePartialSpecializationDecl *>()
->getTemplateParameters();
return CollectTemplateParams(TList, TA, Unit);
}
// Collect parameters for an explicit specialization
if (T.is<VarTemplateDecl *>()) {
const TemplateParameterList *TList = T.get<VarTemplateDecl *>()
->getTemplateParameters();
return CollectTemplateParams(TList, TA, Unit);
}
}
return llvm::DINodeArray();
llvm::DIFile *Unit) {
// Always get the full list of parameters, not just the ones from the
// specialization. A partial specialization may have fewer parameters than
// there are arguments.
auto *TS = dyn_cast<VarTemplateSpecializationDecl>(VL);
if (!TS)
return llvm::DINodeArray();
VarTemplateDecl *T = TS->getSpecializedTemplate();
const TemplateParameterList *TList = T->getTemplateParameters();
auto TA = TS->getTemplateArgs().asArray();
return CollectTemplateParams(TList, TA, Unit);
}
llvm::DINodeArray CGDebugInfo::CollectCXXTemplateParams(
const ClassTemplateSpecializationDecl *TSpecial, llvm::DIFile *Unit) {
// Always get the full list of parameters, not just the ones from
// the specialization.
// Always get the full list of parameters, not just the ones from the
// specialization. A partial specialization may have fewer parameters than
// there are arguments.
TemplateParameterList *TPList =
TSpecial->getSpecializedTemplate()->getTemplateParameters();
const TemplateArgumentList &TAList = TSpecial->getTemplateArgs();

View File

@ -116,7 +116,7 @@ ppc::ReadGOTPtrMode ppc::getPPCReadGOTPtrMode(const Driver &D, const llvm::Tripl
const ArgList &Args) {
if (Args.getLastArg(options::OPT_msecure_plt))
return ppc::ReadGOTPtrMode::SecurePlt;
if (Triple.isOSOpenBSD())
if (Triple.isOSNetBSD() || Triple.isOSOpenBSD())
return ppc::ReadGOTPtrMode::SecurePlt;
else
return ppc::ReadGOTPtrMode::Bss;

View File

@ -1,9 +1,11 @@
// RUN: %clang_cc1 -std=c++17 -emit-llvm -fchar8_t -triple x86_64-linux %s -o - | FileCheck %s
// RUN: %clang_cc1 -std=c++17 -emit-llvm -fchar8_t -triple x86_64-windows %s -o - -verify
// RUN: %clang_cc1 -std=c++17 -emit-llvm -fchar8_t -triple x86_64-linux %s -o - | FileCheck %s --check-prefix=ITANIUM
// RUN: %clang_cc1 -std=c++17 -emit-llvm -fchar8_t -triple x86_64-windows %s -o - | FileCheck %s --check-prefix=MSABI
// CHECK: define void @_Z1fDu(
void f(char8_t c) {} // expected-error {{cannot mangle this built-in char8_t type yet}}
// ITANIUM: define void @_Z1fDu(
// MSABI: define {{.*}}void @"?f@@YAX_Q@Z"(
void f(char8_t c) {}
// CHECK: define weak_odr void @_Z1gIiEvDTplplcvT__ELA4_KDuELDu114EE
// ITANIUM: define weak_odr void @_Z1gIiEvDTplplcvT__ELA4_KDuELDu114EE(
// MSABI: define weak_odr {{.*}}void @"??$g@H@@YAXPEB_Q@Z"(
template<typename T> void g(decltype(T() + u8"foo" + u8'r')) {}
template void g<int>(const char8_t*);

View File

@ -30,7 +30,7 @@ inline int add3(int x) {
// CHECK: {{![0-9]+}} = distinct !DIGlobalVariable(
// CHECK-SAME: name: "var"
// CHECK-SAME: templateParams: {{![0-9]+}}
// CHECK: !DITemplateTypeParameter(name: "P", type: {{![0-9]+}})
// CHECK: !DITemplateTypeParameter(name: "T", type: {{![0-9]+}})
// CHECK: {{![0-9]+}} = distinct !DIGlobalVariable(
// CHECK-SAME: name: "varray"
// CHECK-SAME: templateParams: {{![0-9]+}}

View File

@ -0,0 +1,17 @@
// RUN: %clang_cc1 -emit-llvm -triple x86_64-linux-gnu %s -o - -debug-info-kind=limited | FileCheck %s
template <typename LHS, typename RHS> constexpr bool is_same_v = false;
template <typename T> constexpr bool is_same_v<T, T> = true;
template constexpr bool is_same_v<int, int>;
static_assert(is_same_v<int, int>, "should get partial spec");
// Note that the template arguments for the instantiated variable use the
// parameter names from the primary template. The partial specialization might
// not have enough parameters.
// CHECK: distinct !DIGlobalVariable(name: "is_same_v", linkageName: "_ZL9is_same_vIiiE", {{.*}} templateParams: ![[PARAMS:[0-9]+]])
// CHECK: ![[PARAMS]] = !{![[LHS:[0-9]+]], ![[RHS:[0-9]+]]}
// CHECK: ![[LHS]] = !DITemplateTypeParameter(name: "LHS", type: ![[INT:[0-9]+]])
// CHECK: ![[INT]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
// CHECK: ![[RHS]] = !DITemplateTypeParameter(name: "RHS", type: ![[INT]])

View File

@ -446,3 +446,8 @@
// PTHREAD-NOT: _POSIX_THREADS
// PTHREAD: _REENTRANT
// PTHREAD-NOT: _POSIX_THREADS
// Check PowerPC for Secure PLT
// RUN: %clang -target powerpc-unknown-netbsd -### -c %s 2>&1 \
// RUN: | FileCheck -check-prefix=POWERPC-SECUREPLT %s
// POWERPC-SECUREPLT: "-target-feature" "+secure-plt"