From owner-svn-src-vendor@freebsd.org Sun Nov 4 14:42:14 2018 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3545110D8CDE; Sun, 4 Nov 2018 14:42:14 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C4B6E73E9E; Sun, 4 Nov 2018 14:42:11 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 03E191CA8; Sun, 4 Nov 2018 14:42:07 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wA4Eg7Fj060972; Sun, 4 Nov 2018 14:42:07 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA4Eg2wB060950; Sun, 4 Nov 2018 14:42:02 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201811041442.wA4Eg2wB060950@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 4 Nov 2018 14:42:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r340118 - in vendor/clang/dist-release_70: bindings/python/tests/cindex include/clang/AST include/clang/Driver include/clang/Sema lib/Basic lib/CodeGen lib/Driver lib/Driver/ToolChains ... X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/clang/dist-release_70: bindings/python/tests/cindex include/clang/AST include/clang/Driver include/clang/Sema lib/Basic lib/CodeGen lib/Driver lib/Driver/ToolChains lib/Sema test/CodeGen tes... X-SVN-Commit-Revision: 340118 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C4B6E73E9E X-Spamd-Result: default: False [-0.89 / 200.00]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; DMARC_NA(0.00)[FreeBSD.org]; RCVD_COUNT_THREE(0.00)[4]; MX_GOOD(-0.01)[cached: mx1.FreeBSD.org]; NEURAL_HAM_SHORT(-0.78)[-0.782,0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; RCVD_TLS_LAST(0.00)[] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Nov 2018 14:42:14 -0000 Author: dim Date: Sun Nov 4 14:42:02 2018 New Revision: 340118 URL: https://svnweb.freebsd.org/changeset/base/340118 Log: Vendor import of clang release_70 branch r346007: https://llvm.org/svn/llvm-project/cfe/branches/release_70@346007 Added: vendor/clang/dist-release_70/test/PCH/Inputs/pch-through-use3c.cpp (contents, props changed) vendor/clang/dist-release_70/test/PCH/Inputs/pch-through3c.h (contents, props changed) vendor/clang/dist-release_70/test/PCH/pch-through3c.cpp (contents, props changed) Modified: vendor/clang/dist-release_70/bindings/python/tests/cindex/test_code_completion.py vendor/clang/dist-release_70/include/clang/AST/Decl.h vendor/clang/dist-release_70/include/clang/Driver/Options.td vendor/clang/dist-release_70/include/clang/Sema/Sema.h vendor/clang/dist-release_70/lib/Basic/Version.cpp vendor/clang/dist-release_70/lib/CodeGen/CGBuiltin.cpp vendor/clang/dist-release_70/lib/Driver/Driver.cpp vendor/clang/dist-release_70/lib/Driver/ToolChains/Gnu.cpp vendor/clang/dist-release_70/lib/Sema/SemaDecl.cpp vendor/clang/dist-release_70/lib/Sema/SemaOverload.cpp vendor/clang/dist-release_70/lib/Sema/SemaTemplate.cpp vendor/clang/dist-release_70/test/CodeGen/attr-target-mv.c vendor/clang/dist-release_70/test/CodeGen/builtin-cpu-supports.c vendor/clang/dist-release_70/test/Driver/cl-options.c vendor/clang/dist-release_70/test/Driver/cl-pch.cpp vendor/clang/dist-release_70/test/Driver/linux-ld.c vendor/clang/dist-release_70/test/SemaCXX/cxx1y-deduced-return-type.cpp vendor/clang/dist-release_70/test/SemaCXX/friend.cpp Modified: vendor/clang/dist-release_70/bindings/python/tests/cindex/test_code_completion.py ============================================================================== --- vendor/clang/dist-release_70/bindings/python/tests/cindex/test_code_completion.py Sun Nov 4 14:41:54 2018 (r340117) +++ vendor/clang/dist-release_70/bindings/python/tests/cindex/test_code_completion.py Sun Nov 4 14:42:02 2018 (r340118) @@ -61,11 +61,11 @@ void f(P x, Q y) { cr = tu.codeComplete('fake.cpp', 12, 5, unsaved_files=files) expected = [ - "{'const', TypedText} || Priority: 40 || Availability: Available || Brief comment: None", - "{'volatile', TypedText} || Priority: 40 || Availability: Available || Brief comment: None", + "{'const', TypedText} || Priority: 50 || Availability: Available || Brief comment: None", + "{'volatile', TypedText} || Priority: 50 || Availability: Available || Brief comment: None", "{'operator', TypedText} || Priority: 40 || Availability: Available || Brief comment: None", - "{'P', TypedText} | {'::', Text} || Priority: 75 || Availability: Available || Brief comment: None", - "{'Q', TypedText} | {'::', Text} || Priority: 75 || Availability: Available || Brief comment: None" + "{'P', TypedText} || Priority: 50 || Availability: Available || Brief comment: None", + "{'Q', TypedText} || Priority: 50 || Availability: Available || Brief comment: None" ] self.check_completion_results(cr, expected) Modified: vendor/clang/dist-release_70/include/clang/AST/Decl.h ============================================================================== --- vendor/clang/dist-release_70/include/clang/AST/Decl.h Sun Nov 4 14:41:54 2018 (r340117) +++ vendor/clang/dist-release_70/include/clang/AST/Decl.h Sun Nov 4 14:42:02 2018 (r340118) @@ -2269,8 +2269,7 @@ class FunctionDecl : public DeclaratorDecl, public Dec unsigned getMinRequiredArguments() const; QualType getReturnType() const { - assert(getType()->getAs() && "Expected a FunctionType!"); - return getType()->getAs()->getReturnType(); + return getType()->castAs()->getReturnType(); } /// Attempt to compute an informative source range covering the @@ -2278,14 +2277,22 @@ class FunctionDecl : public DeclaratorDecl, public Dec /// limited representation in the AST. SourceRange getReturnTypeSourceRange() const; + /// Get the declared return type, which may differ from the actual return + /// type if the return type is deduced. + QualType getDeclaredReturnType() const { + auto *TSI = getTypeSourceInfo(); + QualType T = TSI ? TSI->getType() : getType(); + return T->castAs()->getReturnType(); + } + /// Attempt to compute an informative source range covering the /// function exception specification, if any. SourceRange getExceptionSpecSourceRange() const; /// Determine the type of an expression that calls this function. QualType getCallResultType() const { - assert(getType()->getAs() && "Expected a FunctionType!"); - return getType()->getAs()->getCallResultType(getASTContext()); + return getType()->castAs()->getCallResultType( + getASTContext()); } /// Returns the WarnUnusedResultAttr that is either declared on this Modified: vendor/clang/dist-release_70/include/clang/Driver/Options.td ============================================================================== --- vendor/clang/dist-release_70/include/clang/Driver/Options.td Sun Nov 4 14:41:54 2018 (r340117) +++ vendor/clang/dist-release_70/include/clang/Driver/Options.td Sun Nov 4 14:42:02 2018 (r340118) @@ -802,7 +802,7 @@ def fconstexpr_backtrace_limit_EQ : Joined<["-"], "fco Group; def fno_crash_diagnostics : Flag<["-"], "fno-crash-diagnostics">, Group, Flags<[NoArgumentUnused]>, HelpText<"Disable auto-generation of preprocessed source files and a script for reproduction during a clang crash">; -def fcrash_diagnostics_dir : Joined<["-"], "fcrash-diagnostics-dir=">, Group, Flags<[NoArgumentUnused]>; +def fcrash_diagnostics_dir : Joined<["-"], "fcrash-diagnostics-dir=">, Group, Flags<[NoArgumentUnused, CoreOption]>; def fcreate_profile : Flag<["-"], "fcreate-profile">, Group; def fcxx_exceptions: Flag<["-"], "fcxx-exceptions">, Group, HelpText<"Enable C++ exceptions">, Flags<[CC1Option]>; Modified: vendor/clang/dist-release_70/include/clang/Sema/Sema.h ============================================================================== --- vendor/clang/dist-release_70/include/clang/Sema/Sema.h Sun Nov 4 14:41:54 2018 (r340117) +++ vendor/clang/dist-release_70/include/clang/Sema/Sema.h Sun Nov 4 14:42:02 2018 (r340118) @@ -1950,6 +1950,8 @@ class Sema { (public) FunctionDecl *NewFD, LookupResult &Previous, bool IsMemberSpecialization); bool shouldLinkDependentDeclWithPrevious(Decl *D, Decl *OldDecl); + bool canFullyTypeCheckRedeclaration(ValueDecl *NewD, ValueDecl *OldD, + QualType NewT, QualType OldT); void CheckMain(FunctionDecl *FD, const DeclSpec &D); void CheckMSVCRTEntryPoint(FunctionDecl *FD); Attr *getImplicitCodeSegOrSectionAttrForFunction(const FunctionDecl *FD, bool IsDefinition); Modified: vendor/clang/dist-release_70/lib/Basic/Version.cpp ============================================================================== --- vendor/clang/dist-release_70/lib/Basic/Version.cpp Sun Nov 4 14:41:54 2018 (r340117) +++ vendor/clang/dist-release_70/lib/Basic/Version.cpp Sun Nov 4 14:42:02 2018 (r340118) @@ -36,7 +36,7 @@ std::string getClangRepositoryPath() { // If the SVN_REPOSITORY is empty, try to use the SVN keyword. This helps us // pick up a tag in an SVN export, for example. - StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_700/final/lib/Basic/Version.cpp $"); + StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/branches/release_70/lib/Basic/Version.cpp $"); if (URL.empty()) { URL = SVNRepository.slice(SVNRepository.find(':'), SVNRepository.find("/lib/Basic")); Modified: vendor/clang/dist-release_70/lib/CodeGen/CGBuiltin.cpp ============================================================================== --- vendor/clang/dist-release_70/lib/CodeGen/CGBuiltin.cpp Sun Nov 4 14:41:54 2018 (r340117) +++ vendor/clang/dist-release_70/lib/CodeGen/CGBuiltin.cpp Sun Nov 4 14:42:02 2018 (r340118) @@ -8952,9 +8952,9 @@ llvm::Value *CodeGenFunction::EmitX86CpuSupports(uint3 Builder.CreateAlignedLoad(CpuFeatures, CharUnits::fromQuantity(4)); // Check the value of the bit corresponding to the feature requested. - Value *Bitset = Builder.CreateAnd( - Features, llvm::ConstantInt::get(Int32Ty, FeaturesMask)); - return Builder.CreateICmpNE(Bitset, llvm::ConstantInt::get(Int32Ty, 0)); + Value *Mask = Builder.getInt32(FeaturesMask); + Value *Bitset = Builder.CreateAnd(Features, Mask); + return Builder.CreateICmpEQ(Bitset, Mask); } Value *CodeGenFunction::EmitX86CpuInit() { Modified: vendor/clang/dist-release_70/lib/Driver/Driver.cpp ============================================================================== --- vendor/clang/dist-release_70/lib/Driver/Driver.cpp Sun Nov 4 14:41:54 2018 (r340117) +++ vendor/clang/dist-release_70/lib/Driver/Driver.cpp Sun Nov 4 14:42:02 2018 (r340118) @@ -2998,9 +2998,10 @@ void Driver::BuildActions(Compilation &C, DerivedArgLi Args.eraseArg(options::OPT__SLASH_Yc); YcArg = nullptr; } - if (Args.hasArg(options::OPT__SLASH_Y_)) { - // /Y- disables all pch handling. Rather than check for it everywhere, - // just remove clang-cl pch-related flags here. + if (FinalPhase == phases::Preprocess || Args.hasArg(options::OPT__SLASH_Y_)) { + // If only preprocessing or /Y- is used, all pch handling is disabled. + // Rather than check for it everywhere, just remove clang-cl pch-related + // flags here. Args.eraseArg(options::OPT__SLASH_Fp); Args.eraseArg(options::OPT__SLASH_Yc); Args.eraseArg(options::OPT__SLASH_Yu); Modified: vendor/clang/dist-release_70/lib/Driver/ToolChains/Gnu.cpp ============================================================================== --- vendor/clang/dist-release_70/lib/Driver/ToolChains/Gnu.cpp Sun Nov 4 14:41:54 2018 (r340117) +++ vendor/clang/dist-release_70/lib/Driver/ToolChains/Gnu.cpp Sun Nov 4 14:42:02 2018 (r340118) @@ -237,7 +237,7 @@ static const char *getLDMOption(const llvm::Triple &T, case llvm::Triple::aarch64: return "aarch64linux"; case llvm::Triple::aarch64_be: - return "aarch64_be_linux"; + return "aarch64linuxb"; case llvm::Triple::arm: case llvm::Triple::thumb: return "armelf_linux_eabi"; Modified: vendor/clang/dist-release_70/lib/Sema/SemaDecl.cpp ============================================================================== --- vendor/clang/dist-release_70/lib/Sema/SemaDecl.cpp Sun Nov 4 14:41:54 2018 (r340117) +++ vendor/clang/dist-release_70/lib/Sema/SemaDecl.cpp Sun Nov 4 14:42:02 2018 (r340118) @@ -3249,20 +3249,15 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedD // Redeclarations or specializations of a function or function template // with a declared return type that uses a placeholder type shall also // use that placeholder, not a deduced type. - QualType OldDeclaredReturnType = - (Old->getTypeSourceInfo() - ? Old->getTypeSourceInfo()->getType()->castAs() - : OldType)->getReturnType(); - QualType NewDeclaredReturnType = - (New->getTypeSourceInfo() - ? New->getTypeSourceInfo()->getType()->castAs() - : NewType)->getReturnType(); + QualType OldDeclaredReturnType = Old->getDeclaredReturnType(); + QualType NewDeclaredReturnType = New->getDeclaredReturnType(); if (!Context.hasSameType(OldDeclaredReturnType, NewDeclaredReturnType) && - !((NewQType->isDependentType() || OldQType->isDependentType()) && - New->isLocalExternDecl())) { + canFullyTypeCheckRedeclaration(New, Old, NewDeclaredReturnType, + OldDeclaredReturnType)) { QualType ResQT; if (NewDeclaredReturnType->isObjCObjectPointerType() && OldDeclaredReturnType->isObjCObjectPointerType()) + // FIXME: This does the wrong thing for a deduced return type. ResQT = Context.mergeObjCGCQualifiers(NewQType, OldQType); if (ResQT.isNull()) { if (New->isCXXClassMember() && New->isOutOfLine()) @@ -3427,13 +3422,11 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedD if (OldQTypeForComparison == NewQType) return MergeCompatibleFunctionDecls(New, Old, S, MergeTypeWithOld); - if ((NewQType->isDependentType() || OldQType->isDependentType()) && - New->isLocalExternDecl()) { - // It's OK if we couldn't merge types for a local function declaraton - // if either the old or new type is dependent. We'll merge the types - // when we instantiate the function. + // If the types are imprecise (due to dependent constructs in friends or + // local extern declarations), it's OK if they differ. We'll check again + // during instantiation. + if (!canFullyTypeCheckRedeclaration(New, Old, NewQType, OldQType)) return false; - } // Fall through for conflicting redeclarations and redefinitions. } @@ -9336,6 +9329,39 @@ Attr *Sema::getImplicitCodeSegOrSectionAttrForFunction } return nullptr; } + +/// Determines if we can perform a correct type check for \p D as a +/// redeclaration of \p PrevDecl. If not, we can generally still perform a +/// best-effort check. +/// +/// \param NewD The new declaration. +/// \param OldD The old declaration. +/// \param NewT The portion of the type of the new declaration to check. +/// \param OldT The portion of the type of the old declaration to check. +bool Sema::canFullyTypeCheckRedeclaration(ValueDecl *NewD, ValueDecl *OldD, + QualType NewT, QualType OldT) { + if (!NewD->getLexicalDeclContext()->isDependentContext()) + return true; + + // For dependently-typed local extern declarations and friends, we can't + // perform a correct type check in general until instantiation: + // + // int f(); + // template void g() { T f(); } + // + // (valid if g() is only instantiated with T = int). + if (NewT->isDependentType() && + (NewD->isLocalExternDecl() || NewD->getFriendObjectKind())) + return false; + + // Similarly, if the previous declaration was a dependent local extern + // declaration, we don't really know its type yet. + if (OldT->isDependentType() && OldD->isLocalExternDecl()) + return false; + + return true; +} + /// Checks if the new declaration declared in dependent context must be /// put in the same redeclaration chain as the specified declaration. /// @@ -9346,20 +9372,30 @@ Attr *Sema::getImplicitCodeSegOrSectionAttrForFunction /// belongs to. /// bool Sema::shouldLinkDependentDeclWithPrevious(Decl *D, Decl *PrevDecl) { - // Any declarations should be put into redeclaration chains except for - // friend declaration in a dependent context that names a function in - // namespace scope. + if (!D->getLexicalDeclContext()->isDependentContext()) + return true; + + // Don't chain dependent friend function definitions until instantiation, to + // permit cases like // - // This allows to compile code like: + // void func(); + // template class C1 { friend void func() {} }; + // template class C2 { friend void func() {} }; // - // void func(); - // template class C1 { friend void func() { } }; - // template class C2 { friend void func() { } }; + // ... which is valid if only one of C1 and C2 is ever instantiated. // - // This code snippet is a valid code unless both templates are instantiated. - return !(D->getLexicalDeclContext()->isDependentContext() && - D->getDeclContext()->isFileContext() && - D->getFriendObjectKind() != Decl::FOK_None); + // FIXME: This need only apply to function definitions. For now, we proxy + // this by checking for a file-scope function. We do not want this to apply + // to friend declarations nominating member functions, because that gets in + // the way of access checks. + if (D->getFriendObjectKind() && D->getDeclContext()->isFileContext()) + return false; + + auto *VD = dyn_cast(D); + auto *PrevVD = dyn_cast(PrevDecl); + return !VD || !PrevVD || + canFullyTypeCheckRedeclaration(VD, PrevVD, VD->getType(), + PrevVD->getType()); } namespace MultiVersioning { Modified: vendor/clang/dist-release_70/lib/Sema/SemaOverload.cpp ============================================================================== --- vendor/clang/dist-release_70/lib/Sema/SemaOverload.cpp Sun Nov 4 14:41:54 2018 (r340117) +++ vendor/clang/dist-release_70/lib/Sema/SemaOverload.cpp Sun Nov 4 14:42:02 2018 (r340118) @@ -1105,7 +1105,8 @@ bool Sema::IsOverload(FunctionDecl *New, FunctionDecl (!TemplateParameterListsAreEqual(NewTemplate->getTemplateParameters(), OldTemplate->getTemplateParameters(), false, TPL_TemplateMatch) || - OldType->getReturnType() != NewType->getReturnType())) + !Context.hasSameType(Old->getDeclaredReturnType(), + New->getDeclaredReturnType()))) return true; // If the function is a class member, its signature includes the Modified: vendor/clang/dist-release_70/lib/Sema/SemaTemplate.cpp ============================================================================== --- vendor/clang/dist-release_70/lib/Sema/SemaTemplate.cpp Sun Nov 4 14:41:54 2018 (r340117) +++ vendor/clang/dist-release_70/lib/Sema/SemaTemplate.cpp Sun Nov 4 14:42:02 2018 (r340118) @@ -8304,6 +8304,8 @@ Sema::CheckMemberSpecialization(NamedDecl *Member, Loo QualType Adjusted = Function->getType(); if (!hasExplicitCallingConv(Adjusted)) Adjusted = adjustCCAndNoReturn(Adjusted, Method->getType()); + // This doesn't handle deduced return types, but both function + // declarations should be undeduced at this point. if (Context.hasSameType(Adjusted, Method->getType())) { FoundInstantiation = *I; Instantiation = Method; Modified: vendor/clang/dist-release_70/test/CodeGen/attr-target-mv.c ============================================================================== --- vendor/clang/dist-release_70/test/CodeGen/attr-target-mv.c Sun Nov 4 14:41:54 2018 (r340117) +++ vendor/clang/dist-release_70/test/CodeGen/attr-target-mv.c Sun Nov 4 14:42:02 2018 (r340118) @@ -70,6 +70,22 @@ void bar4() { // CHECK: ret void ()* @foo_decls.sse4.2 // CHECK: ret void ()* @foo_decls +// CHECK: define void @bar4() +// CHECK: call void @foo_multi.ifunc() + +// CHECK: define void ()* @foo_multi.resolver() comdat +// CHECK: and i32 %{{.*}}, 4352 +// CHECK: icmp eq i32 %{{.*}}, 4352 +// CHECK: ret void ()* @foo_multi.fma4_sse4.2 +// CHECK: icmp eq i32 %{{.*}}, 12 +// CHECK: and i32 %{{.*}}, 4352 +// CHECK: icmp eq i32 %{{.*}}, 4352 +// CHECK: ret void ()* @foo_multi.arch_ivybridge_fma4_sse4.2 +// CHECK: and i32 %{{.*}}, 768 +// CHECK: icmp eq i32 %{{.*}}, 768 +// CHECK: ret void ()* @foo_multi.avx_sse4.2 +// CHECK: ret void ()* @foo_multi + // CHECK: declare i32 @foo.arch_sandybridge() // CHECK: define available_externally i32 @foo_inline.sse4.2() @@ -88,4 +104,3 @@ void bar4() { // CHECK: define available_externally void @foo_multi.avx_sse4.2() // CHECK: define available_externally void @foo_multi.fma4_sse4.2() // CHECK: define available_externally void @foo_multi.arch_ivybridge_fma4_sse4.2() - Modified: vendor/clang/dist-release_70/test/CodeGen/builtin-cpu-supports.c ============================================================================== --- vendor/clang/dist-release_70/test/CodeGen/builtin-cpu-supports.c Sun Nov 4 14:41:54 2018 (r340117) +++ vendor/clang/dist-release_70/test/CodeGen/builtin-cpu-supports.c Sun Nov 4 14:42:02 2018 (r340118) @@ -14,7 +14,7 @@ int main() { // CHECK: [[LOAD:%[^ ]+]] = load i32, i32* getelementptr inbounds ({ i32, i32, i32, [1 x i32] }, { i32, i32, i32, [1 x i32] }* @__cpu_model, i32 0, i32 3, i32 0) // CHECK: [[AND:%[^ ]+]] = and i32 [[LOAD]], 256 - // CHECK: = icmp ne i32 [[AND]], 0 + // CHECK: = icmp eq i32 [[AND]], 256 return 0; } Modified: vendor/clang/dist-release_70/test/Driver/cl-options.c ============================================================================== --- vendor/clang/dist-release_70/test/Driver/cl-options.c Sun Nov 4 14:41:54 2018 (r340117) +++ vendor/clang/dist-release_70/test/Driver/cl-options.c Sun Nov 4 14:42:02 2018 (r340118) @@ -566,6 +566,7 @@ // RUN: %clang_cl \ // RUN: --driver-mode=cl \ // RUN: -fblocks \ +// RUN: -fcrash-diagnostics-dir=/foo \ // RUN: -fno-blocks \ // RUN: -fbuiltin \ // RUN: -fno-builtin \ Modified: vendor/clang/dist-release_70/test/Driver/cl-pch.cpp ============================================================================== --- vendor/clang/dist-release_70/test/Driver/cl-pch.cpp Sun Nov 4 14:41:54 2018 (r340117) +++ vendor/clang/dist-release_70/test/Driver/cl-pch.cpp Sun Nov 4 14:42:02 2018 (r340118) @@ -345,3 +345,24 @@ // CHECK-NoSourceTP: pchfile.pch // CHECK-NoSourceTP: -x // CHECK-NoSourceTP: "c++" + +// If only preprocessing, PCH options are ignored. +// RUN: %clang_cl /P /Ycpchfile.h /FIpchfile.h /c -### -- %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-YC-P %s +// CHECK-YC-P-NOT: -emit-pch +// CHECK-YC-P-NOT: -include-pch + +// RUN: %clang_cl /E /Ycpchfile.h /FIpchfile.h /c -### -- %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-YC-E %s +// CHECK-YC-E-NOT: -emit-pch +// CHECK-YC-E-NOT: -include-pch + +// RUN: %clang_cl /P /Ycpchfile.h /FIpchfile.h /c -### -- %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-YU-P %s +// CHECK-YU-P-NOT: -emit-pch +// CHECK-YU-P-NOT: -include-pch + +// RUN: %clang_cl /E /Ycpchfile.h /FIpchfile.h /c -### -- %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-YU-E %s +// CHECK-YU-E-NOT: -emit-pch +// CHECK-YU-E-NOT: -include-pch Modified: vendor/clang/dist-release_70/test/Driver/linux-ld.c ============================================================================== --- vendor/clang/dist-release_70/test/Driver/linux-ld.c Sun Nov 4 14:41:54 2018 (r340117) +++ vendor/clang/dist-release_70/test/Driver/linux-ld.c Sun Nov 4 14:42:02 2018 (r340118) @@ -1648,6 +1648,14 @@ // CHECK-ARMV7EB: "--be8" // CHECK-ARMV7EB: "-m" "armelfb_linux_eabi" +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=aarch64_be-unknown-linux \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-AARCH64BE %s +// CHECK-AARCH64BE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-AARCH64BE: "-m" "aarch64linuxb" + // Check dynamic-linker for musl-libc // RUN: %clang %s -### -o %t.o 2>&1 \ // RUN: --target=i386-pc-linux-musl \ Added: vendor/clang/dist-release_70/test/PCH/Inputs/pch-through-use3c.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist-release_70/test/PCH/Inputs/pch-through-use3c.cpp Sun Nov 4 14:42:02 2018 (r340118) @@ -0,0 +1,2 @@ +int a = A; +// expected-no-diagnostics Added: vendor/clang/dist-release_70/test/PCH/Inputs/pch-through3c.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist-release_70/test/PCH/Inputs/pch-through3c.h Sun Nov 4 14:42:02 2018 (r340118) @@ -0,0 +1 @@ +#define A 1 Added: vendor/clang/dist-release_70/test/PCH/pch-through3c.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist-release_70/test/PCH/pch-through3c.cpp Sun Nov 4 14:42:02 2018 (r340118) @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -I %S -emit-pch \ +// RUN: -include Inputs/pch-through3c.h \ +// RUN: -pch-through-header=Inputs/pch-through3c.h -o %t.3c %s + +// RUN: %clang_cc1 -verify -I %S -include-pch %t.3c \ +// RUN: -include Inputs/pch-through3c.h \ +// RUN: -pch-through-header=Inputs/pch-through3c.h \ +// RUN: %S/Inputs/pch-through-use3c.cpp 2>&1 Modified: vendor/clang/dist-release_70/test/SemaCXX/cxx1y-deduced-return-type.cpp ============================================================================== --- vendor/clang/dist-release_70/test/SemaCXX/cxx1y-deduced-return-type.cpp Sun Nov 4 14:41:54 2018 (r340117) +++ vendor/clang/dist-release_70/test/SemaCXX/cxx1y-deduced-return-type.cpp Sun Nov 4 14:42:02 2018 (r340118) @@ -552,3 +552,73 @@ namespace PR24989 { void forinit_decltypeauto() { for (decltype(auto) forinit_decltypeauto_inner();;) {} // expected-warning {{interpreted as a function}} expected-note {{replace}} } + +namespace PR33222 { + auto f1(); + auto f2(); + + template decltype(auto) g0(T x) { return x.n; } + template decltype(auto) g1(T); + template decltype(auto) g2(T); + + struct X { + static auto f1(); + static auto f2(); + + template static decltype(auto) g0(T x) { return x.n; } // FIXME (PR38883): expected-error {{private}} + template static decltype(auto) g1(T); + template static decltype(auto) g2(T); + }; + + template class A { + friend auto f1(); + friend auto f2(); + + // FIXME (PR38883): This friend declaration doesn't actually work, because + // we fail to look up the named function properly during instantiation. + friend decltype(auto) g0<>(A); + template friend decltype(auto) g1(T); + template friend decltype(auto) g2(T); + + friend auto X::f1(); + friend auto X::f2(); + + // FIXME (PR38882): 'A' names the class template not the injected-class-name here! + friend decltype(auto) X::g0<>(A); + // FIXME (PR38882): ::T hides the template parameter if both are named T here! + template friend decltype(auto) X::g1(T_); + template friend decltype(auto) X::g2(T_); + + int n; // FIXME: expected-note {{here}} + }; + + auto f1() { return A().n; } + template decltype(auto) g1(T x) { return A().n; } + + auto X::f1() { return A().n; } + template decltype(auto) X::g1(T x) { return A().n; } + + A ai; + int k1 = g0(ai); + int k2 = X::g0(ai); // FIXME: expected-note {{in instantiation of}} + + int k3 = g1(ai); + int k4 = X::g1(ai); + + auto f2() { return A().n; } + template decltype(auto) g2(T x) { return A().n; } + + auto X::f2() { return A().n; } + template decltype(auto) X::g2(T x) { return A().n; } + + int k5 = g2(ai); + int k6 = X::g2(ai); + + template struct B { + auto *q() { return (float*)0; } // expected-note 2{{previous}} + }; + template<> auto *B::q() { return (int*)0; } + template<> auto B::q() { return (int*)0; } // expected-error {{return type}} + // FIXME: suppress this follow-on error: expected-error@-1 {{cannot initialize}} + template<> int B::q() { return 0; } // expected-error {{return type}} +} Modified: vendor/clang/dist-release_70/test/SemaCXX/friend.cpp ============================================================================== --- vendor/clang/dist-release_70/test/SemaCXX/friend.cpp Sun Nov 4 14:41:54 2018 (r340117) +++ vendor/clang/dist-release_70/test/SemaCXX/friend.cpp Sun Nov 4 14:42:02 2018 (r340118) @@ -388,3 +388,26 @@ namespace default_arg { friend void f(void *p = 0) {} // expected-error {{must be the only}} }; } + +namespace PR33222 { + int f(); + template struct X { + friend T f(); + }; + X xi; + + int g(); // expected-note {{previous}} + template struct Y { + friend T g(); // expected-error {{return type}} + }; + Y yf; // expected-note {{instantiation}} + + int h(); + template struct Z { + // FIXME: The note here should point at the non-friend declaration, not the + // instantiation in Z. + friend T h(); // expected-error {{return type}} expected-note {{previous}} + }; + Z zi; + Z zf; // expected-note {{instantiation}} +}