From b6d42e34c27d79488e27db71466f4e5cece05910 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Mon, 26 Dec 2016 20:36:37 +0000 Subject: MFC r309124: Upgrade our copies of clang, llvm, lldb, compiler-rt and libc++ to 3.9.0 release, and add lld 3.9.0. Also completely revamp the build system for clang, llvm, lldb and their related tools. Please note that from 3.5.0 onwards, clang, llvm and lldb require C++11 support to build; see UPDATING for more information. Release notes for llvm, clang and lld are available here: Thanks to Ed Maste, Bryan Drewery, Andrew Turner, Antoine Brodin and Jan Beich for their help. Relnotes: yes MFC r309147: Pull in r282174 from upstream llvm trunk (by Krzysztof Parzyszek): [PPC] Set SP after loading data from stack frame, if no red zone is present Follow-up to r280705: Make sure that the SP is only restored after all data is loaded from the stack frame, if there is no red zone. This completes the fix for https://llvm.org/bugs/show_bug.cgi?id=26519. Differential Revision: https://reviews.llvm.org/D24466 Reported by: Mark Millard PR: 214433 MFC r309149: Pull in r283060 from upstream llvm trunk (by Hal Finkel): [PowerPC] Refactor soft-float support, and enable PPC64 soft float This change enables soft-float for PowerPC64, and also makes soft-float disable all vector instruction sets for both 32-bit and 64-bit modes. This latter part is necessary because the PPC backend canonicalizes many Altivec vector types to floating-point types, and so soft-float breaks scalarization support for many operations. Both for embedded targets and for operating-system kernels desiring soft-float support, it seems reasonable that disabling hardware floating-point also disables vector instructions (embedded targets without hardware floating point support are unlikely to have Altivec, etc. and operating system kernels desiring not to use floating-point registers to lower syscall cost are unlikely to want to use vector registers either). If someone needs this to work, we'll need to change the fact that we promote many Altivec operations to act on v4f32. To make it possible to disable Altivec when soft-float is enabled, hardware floating-point support needs to be expressed as a positive feature, like the others, and not a negative feature, because target features cannot have dependencies on the disabling of some other feature. So +soft-float has now become -hard-float. Fixes PR26970. Pull in r283061 from upstream clang trunk (by Hal Finkel): [PowerPC] Enable soft-float for PPC64, and +soft-float -> -hard-float Enable soft-float support on PPC64, as the backend now supports it. Also, the backend now uses -hard-float instead of +soft-float, so set the target features accordingly. Fixes PR26970. Reported by: Mark Millard PR: 214433 MFC r309212: Add a few missed clang 3.9.0 files to OptionalObsoleteFiles. MFC r309262: Fix packaging for clang, lldb and lld 3.9.0 During the upgrade of clang/llvm etc to 3.9.0 in r309124, the PACKAGE directive in the usr.bin/clang/*.mk files got dropped accidentally. Restore it, with a few minor changes and additions: * Correct license in clang.ucl to NCSA * Add PACKAGE=clang for clang and most of the "ll" tools * Put lldb in its own package * Put lld in its own package Reviewed by: gjb, jmallett Differential Revision: https://reviews.freebsd.org/D8666 MFC r309656: During the bootstrap phase, when building the minimal llvm library on PowerPC, add lib/Support/Atomic.cpp. This is needed because upstream llvm revision r271821 disabled the use of std::call_once, which causes some fallback functions from Atomic.cpp to be used instead. Reported by: Mark Millard PR: 214902 MFC r309835: Tentatively apply https://reviews.llvm.org/D18730 to work around gcc PR 70528 (bogus error: constructor required before non-static data member). This should fix buildworld with the external gcc package. Reported by: https://jenkins.freebsd.org/job/FreeBSD_HEAD_amd64_gcc/ MFC r310194: Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to 3.9.1 release. Please note that from 3.5.0 onwards, clang, llvm and lldb require C++11 support to build; see UPDATING for more information. Release notes for llvm, clang and lld will be available here: Relnotes: yes --- contrib/llvm/tools/clang/lib/AST/DeclBase.cpp | 68 ++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 13 deletions(-) (limited to 'contrib/llvm/tools/clang/lib/AST/DeclBase.cpp') diff --git a/contrib/llvm/tools/clang/lib/AST/DeclBase.cpp b/contrib/llvm/tools/clang/lib/AST/DeclBase.cpp index 72587e388e47..bfb7d02b2955 100644 --- a/contrib/llvm/tools/clang/lib/AST/DeclBase.cpp +++ b/contrib/llvm/tools/clang/lib/AST/DeclBase.cpp @@ -46,7 +46,7 @@ void Decl::updateOutOfDate(IdentifierInfo &II) const { } #define DECL(DERIVED, BASE) \ - static_assert(Decl::DeclObjAlignment >= \ + static_assert(llvm::AlignOf::Alignment >= \ llvm::AlignOf::Alignment, \ "Alignment sufficient after objects prepended to " #DERIVED); #define ABSTRACT_DECL(DECL) @@ -56,7 +56,7 @@ void *Decl::operator new(std::size_t Size, const ASTContext &Context, unsigned ID, std::size_t Extra) { // Allocate an extra 8 bytes worth of storage, which ensures that the // resulting pointer will still be 8-byte aligned. - static_assert(sizeof(unsigned) * 2 >= DeclObjAlignment, + static_assert(sizeof(unsigned) * 2 >= llvm::AlignOf::Alignment, "Decl won't be misaligned"); void *Start = Context.Allocate(Size + Extra + 8); void *Result = (char*)Start + 8; @@ -81,7 +81,8 @@ void *Decl::operator new(std::size_t Size, const ASTContext &Ctx, // Ensure required alignment of the resulting object by adding extra // padding at the start if required. size_t ExtraAlign = - llvm::OffsetToAlignment(sizeof(Module *), DeclObjAlignment); + llvm::OffsetToAlignment(sizeof(Module *), + llvm::AlignOf::Alignment); char *Buffer = reinterpret_cast( ::operator new(ExtraAlign + sizeof(Module *) + Size + Extra, Ctx)); Buffer += ExtraAlign; @@ -196,6 +197,17 @@ bool Decl::isTemplateDecl() const { return isa(this); } +TemplateDecl *Decl::getDescribedTemplate() const { + if (auto *FD = dyn_cast(this)) + return FD->getDescribedFunctionTemplate(); + else if (auto *RD = dyn_cast(this)) + return RD->getDescribedClassTemplate(); + else if (auto *VD = dyn_cast(this)) + return VD->getDescribedVarTemplate(); + + return nullptr; +} + const DeclContext *Decl::getParentFunctionOrMethod() const { for (const DeclContext *DC = getDeclContext(); DC && !DC->isTranslationUnit() && !DC->isNamespace(); @@ -329,25 +341,29 @@ unsigned Decl::getMaxAlignment() const { return Align; } -bool Decl::isUsed(bool CheckUsedAttr) const { - if (Used) +bool Decl::isUsed(bool CheckUsedAttr) const { + const Decl *CanonD = getCanonicalDecl(); + if (CanonD->Used) return true; - + // Check for used attribute. - if (CheckUsedAttr && hasAttr()) + // Ask the most recent decl, since attributes accumulate in the redecl chain. + if (CheckUsedAttr && getMostRecentDecl()->hasAttr()) return true; - return false; + // The information may have not been deserialized yet. Force deserialization + // to complete the needed information. + return getMostRecentDecl()->getCanonicalDecl()->Used; } void Decl::markUsed(ASTContext &C) { - if (Used) + if (isUsed(false)) return; if (C.getASTMutationListener()) C.getASTMutationListener()->DeclarationMarkedUsed(this); - Used = true; + setIsUsed(); } bool Decl::isReferenced() const { @@ -362,6 +378,18 @@ bool Decl::isReferenced() const { return false; } +bool Decl::hasDefiningAttr() const { + return hasAttr() || hasAttr(); +} + +const Attr *Decl::getDefiningAttr() const { + if (AliasAttr *AA = getAttr()) + return AA; + if (IFuncAttr *IFA = getAttr()) + return IFA; + return nullptr; +} + /// \brief Determine the availability of the given declaration based on /// the target platform. /// @@ -432,7 +460,7 @@ static AvailabilityResult CheckAvailability(ASTContext &Context, << VTI << HintMessage; } - return AR_NotYetIntroduced; + return A->getStrict() ? AR_Unavailable : AR_NotYetIntroduced; } // Make sure that this declaration hasn't been obsoleted. @@ -467,6 +495,9 @@ static AvailabilityResult CheckAvailability(ASTContext &Context, } AvailabilityResult Decl::getAvailability(std::string *Message) const { + if (auto *FTD = dyn_cast(this)) + return FTD->getTemplatedDecl()->getAvailability(Message); + AvailabilityResult Result = AR_Available; std::string ResultMessage; @@ -563,6 +594,7 @@ unsigned Decl::getIdentifierNamespaceForKind(Kind DeclKind) { case Function: case CXXMethod: case CXXConstructor: + case ConstructorUsingShadow: case CXXDestructor: case CXXConversion: case EnumConstant: @@ -630,6 +662,9 @@ unsigned Decl::getIdentifierNamespaceForKind(Kind DeclKind) { case TemplateTemplateParm: return IDNS_Ordinary | IDNS_Tag | IDNS_Type; + case OMPDeclareReduction: + return IDNS_OMPReduction; + // Never have names. case Friend: case FriendTemplate: @@ -638,6 +673,8 @@ unsigned Decl::getIdentifierNamespaceForKind(Kind DeclKind) { case FileScopeAsm: case StaticAssert: case ObjCPropertyImpl: + case PragmaComment: + case PragmaDetectMismatch: case Block: case Captured: case TranslationUnit: @@ -655,6 +692,7 @@ unsigned Decl::getIdentifierNamespaceForKind(Kind DeclKind) { case ObjCCategoryImpl: case Import: case OMPThreadPrivate: + case OMPCapturedExpr: case Empty: // Never looked up by name. return 0; @@ -957,6 +995,7 @@ DeclContext *DeclContext::getPrimaryContext() { case Decl::LinkageSpec: case Decl::Block: case Decl::Captured: + case Decl::OMPDeclareReduction: // There is only one DeclContext for these entities. return this; @@ -1549,9 +1588,12 @@ void DeclContext::makeDeclVisibleInContextWithFlags(NamedDecl *D, bool Internal, bool Recoverable) { assert(this == getPrimaryContext() && "expected a primary DC"); - // Skip declarations within functions. - if (isFunctionOrMethod()) + if (!isLookupContext()) { + if (isTransparentContext()) + getParent()->getPrimaryContext() + ->makeDeclVisibleInContextWithFlags(D, Internal, Recoverable); return; + } // Skip declarations which should be invisible to name lookup. if (shouldBeHidden(D)) -- cgit v1.2.3