From owner-svn-src-vendor@freebsd.org Sun Jan 22 16:52:45 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23907CBD48D; Sun, 22 Jan 2017 16:52:45 +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 mx1.freebsd.org (Postfix) with ESMTPS id E0422FDF; Sun, 22 Jan 2017 16:52:44 +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 v0MGqij2022923; Sun, 22 Jan 2017 16:52:44 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MGqf6N022896; Sun, 22 Jan 2017 16:52:41 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701221652.v0MGqf6N022896@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 22 Jan 2017 16:52:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312627 - in vendor/clang/dist: bindings/python/clang docs include/clang/Basic lib/Basic lib/Frontend lib/Parse lib/Sema test/CXX/dcl.dcl/basic.namespace/namespace.udecl test/CXX/dcl.de... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 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, 22 Jan 2017 16:52:45 -0000 Author: dim Date: Sun Jan 22 16:52:41 2017 New Revision: 312627 URL: https://svnweb.freebsd.org/changeset/base/312627 Log: Vendor import of clang release_40 branch r292732: https://llvm.org/svn/llvm-project/cfe/branches/release_40@292732 Added: vendor/clang/dist/test/SemaTemplate/partial-order.cpp (contents, props changed) Modified: vendor/clang/dist/bindings/python/clang/__init__.py vendor/clang/dist/bindings/python/clang/cindex.py vendor/clang/dist/docs/AttributeReference.rst vendor/clang/dist/docs/ReleaseNotes.rst vendor/clang/dist/docs/UsersManual.rst vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td vendor/clang/dist/lib/Basic/Targets.cpp vendor/clang/dist/lib/Frontend/DependencyFile.cpp vendor/clang/dist/lib/Parse/ParseExpr.cpp vendor/clang/dist/lib/Sema/SemaOverload.cpp vendor/clang/dist/lib/Sema/SemaTemplate.cpp vendor/clang/dist/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p15.cpp vendor/clang/dist/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p1.cpp vendor/clang/dist/test/CXX/drs/dr16xx.cpp vendor/clang/dist/test/CXX/drs/dr19xx.cpp vendor/clang/dist/test/CXX/special/class.inhctor/p1.cpp vendor/clang/dist/test/CXX/special/class.inhctor/p3.cpp vendor/clang/dist/test/CXX/special/class.inhctor/p7.cpp vendor/clang/dist/test/CodeCompletion/member-access.cpp vendor/clang/dist/test/Driver/netbsd.c vendor/clang/dist/test/Preprocessor/dependencies-and-pp.c vendor/clang/dist/test/SemaCXX/cxx11-inheriting-ctors.cpp vendor/clang/dist/test/SemaTemplate/class-template-spec.cpp vendor/clang/dist/test/SemaTemplate/cxx1z-using-declaration.cpp vendor/clang/dist/test/SemaTemplate/temp_arg_nontype.cpp vendor/clang/dist/test/SemaTemplate/temp_arg_template_cxx1z.cpp Modified: vendor/clang/dist/bindings/python/clang/__init__.py ============================================================================== --- vendor/clang/dist/bindings/python/clang/__init__.py Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/bindings/python/clang/__init__.py Sun Jan 22 16:52:41 2017 (r312627) @@ -20,5 +20,13 @@ The available modules are: Bindings for the Clang indexing library. """ + +# Python 3 uses unicode for strings. The bindings, in particular the interaction +# with ctypes, need modifying to handle conversions between unicode and +# c-strings. +import sys +if sys.version_info[0] != 2: + raise Exception("Only Python 2 is supported.") + __all__ = ['cindex'] Modified: vendor/clang/dist/bindings/python/clang/cindex.py ============================================================================== --- vendor/clang/dist/bindings/python/clang/cindex.py Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/bindings/python/clang/cindex.py Sun Jan 22 16:52:41 2017 (r312627) @@ -554,8 +554,8 @@ class BaseEnumeration(object): if value >= len(self.__class__._kinds): self.__class__._kinds += [None] * (value - len(self.__class__._kinds) + 1) if self.__class__._kinds[value] is not None: - raise ValueError,'{0} value {1} already loaded'.format( - str(self.__class__), value) + raise ValueError('{0} value {1} already loaded'.format( + str(self.__class__), value)) self.value = value self.__class__._kinds[value] = self self.__class__._name_map = None @@ -577,7 +577,7 @@ class BaseEnumeration(object): @classmethod def from_id(cls, id): if id >= len(cls._kinds) or cls._kinds[id] is None: - raise ValueError,'Unknown template argument kind %d' % id + raise ValueError('Unknown template argument kind %d' % id) return cls._kinds[id] def __repr__(self): @@ -1777,7 +1777,7 @@ class StorageClass(object): if value >= len(StorageClass._kinds): StorageClass._kinds += [None] * (value - len(StorageClass._kinds) + 1) if StorageClass._kinds[value] is not None: - raise ValueError,'StorageClass already loaded' + raise ValueError('StorageClass already loaded') self.value = value StorageClass._kinds[value] = self StorageClass._name_map = None @@ -1798,7 +1798,7 @@ class StorageClass(object): @staticmethod def from_id(id): if id >= len(StorageClass._kinds) or not StorageClass._kinds[id]: - raise ValueError,'Unknown storage class %d' % id + raise ValueError('Unknown storage class %d' % id) return StorageClass._kinds[id] def __repr__(self): @@ -2729,9 +2729,9 @@ class TranslationUnit(ClangObject): # FIXME: It would be great to support an efficient version # of this, one day. value = value.read() - print value + print(value) if not isinstance(value, str): - raise TypeError,'Unexpected unsaved file contents.' + raise TypeError('Unexpected unsaved file contents.') unsaved_files_array[i].name = name unsaved_files_array[i].contents = value unsaved_files_array[i].length = len(value) @@ -2793,9 +2793,9 @@ class TranslationUnit(ClangObject): # FIXME: It would be great to support an efficient version # of this, one day. value = value.read() - print value + print(value) if not isinstance(value, str): - raise TypeError,'Unexpected unsaved file contents.' + raise TypeError('Unexpected unsaved file contents.') unsaved_files_array[i].name = name unsaved_files_array[i].contents = value unsaved_files_array[i].length = len(value) Modified: vendor/clang/dist/docs/AttributeReference.rst ============================================================================== --- vendor/clang/dist/docs/AttributeReference.rst Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/docs/AttributeReference.rst Sun Jan 22 16:52:41 2017 (r312627) @@ -456,6 +456,7 @@ warnings or errors at compile-time if ca certain user-defined criteria. For example: .. code-block:: c + void abs(int a) __attribute__((diagnose_if(a >= 0, "Redundant abs call", "warning"))); void must_abs(int a) Modified: vendor/clang/dist/docs/ReleaseNotes.rst ============================================================================== --- vendor/clang/dist/docs/ReleaseNotes.rst Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/docs/ReleaseNotes.rst Sun Jan 22 16:52:41 2017 (r312627) @@ -46,8 +46,35 @@ Major New Features clang to emit a warning or error if a function call meets one or more user-specified conditions. +- Enhanced devirtualization with + `-fstrict-vtable-pointers `_. + Clang devirtualizes across different basic blocks, like loops: + + .. code-block:: c++ + + struct A { + virtual void foo(); + }; + void indirect(A &a, int n) { + for (int i = 0 ; i < n; i++) + a.foo(); + } + void test(int n) { + A a; + indirect(a, n); + } + + - ... +Improvements to ThinLTO (-flto=thin) +------------------------------------ +- Integration with profile data (PGO). When available, profile data enables + more accurate function importing decisions, as well as cross-module indirect + call promotion. +- Significant build-time and binary-size improvements when compiling with debug + info (-g). + Improvements to Clang's diagnostics ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Modified: vendor/clang/dist/docs/UsersManual.rst ============================================================================== --- vendor/clang/dist/docs/UsersManual.rst Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/docs/UsersManual.rst Sun Jan 22 16:52:41 2017 (r312627) @@ -1097,6 +1097,14 @@ are listed below. the behavior of sanitizers in the ``cfi`` group to allow checking of cross-DSO virtual and indirect calls. + +.. option:: -fstrict-vtable-pointers + + Enable optimizations based on the strict rules for overwriting polymorphic + C++ objects, i.e. the vptr is invariant during an object's lifetime. + This enables better devirtualization. Turned off by default, because it is + still experimental. + .. option:: -ffast-math Enable fast-math mode. This defines the ``__FAST_MATH__`` preprocessor @@ -2645,7 +2653,7 @@ Execute ``clang-cl /?`` to see a list of (overridden by LLVM_PROFILE_FILE env var) -fprofile-instr-generate Generate instrumented code to collect execution counts into default.profraw file - (overriden by '=' form of option or LLVM_PROFILE_FILE env var) + (overridden by '=' form of option or LLVM_PROFILE_FILE env var) -fprofile-instr-use= Use instrumentation data for profile-guided optimization -fsanitize-blacklist= Modified: vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td Sun Jan 22 16:52:41 2017 (r312627) @@ -3337,8 +3337,8 @@ def note_ovl_candidate : Note<"candidate def note_ovl_candidate_inherited_constructor : Note< "constructor from base class %0 inherited here">; def note_ovl_candidate_inherited_constructor_slice : Note< - "constructor inherited from base class cannot be used to initialize from " - "an argument of the derived class type">; + "candidate %select{constructor|template}0 ignored: " + "inherited constructor cannot be used to %select{copy|move}1 object">; def note_ovl_candidate_illegal_constructor : Note< "candidate %select{constructor|template}0 ignored: " "instantiation %select{takes|would take}0 its own class type by value">; Modified: vendor/clang/dist/lib/Basic/Targets.cpp ============================================================================== --- vendor/clang/dist/lib/Basic/Targets.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/lib/Basic/Targets.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -512,7 +512,7 @@ protected: Builder.defineMacro("__unix__"); Builder.defineMacro("__ELF__"); if (Opts.POSIXThreads) - Builder.defineMacro("_POSIX_THREADS"); + Builder.defineMacro("_REENTRANT"); switch (Triple.getArch()) { default: Modified: vendor/clang/dist/lib/Frontend/DependencyFile.cpp ============================================================================== --- vendor/clang/dist/lib/Frontend/DependencyFile.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/lib/Frontend/DependencyFile.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -447,9 +447,9 @@ void DFGImpl::OutputDependencyFile() { // Create phony targets if requested. if (PhonyTarget && !Files.empty()) { // Skip the first entry, this is always the input file itself. - for (StringRef File : Files) { + for (auto I = Files.begin() + 1, E = Files.end(); I != E; ++I) { OS << '\n'; - PrintFilename(OS, File, OutputFormat); + PrintFilename(OS, *I, OutputFormat); OS << ":\n"; } } Modified: vendor/clang/dist/lib/Parse/ParseExpr.cpp ============================================================================== --- vendor/clang/dist/lib/Parse/ParseExpr.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/lib/Parse/ParseExpr.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -1652,9 +1652,10 @@ Parser::ParsePostfixExpressionSuffix(Exp if (Tok.is(tok::code_completion)) { // Code completion for a member access expression. - Actions.CodeCompleteMemberReferenceExpr( - getCurScope(), LHS.get(), OpLoc, OpKind == tok::arrow, - ExprStatementTokLoc == LHS.get()->getLocStart()); + if (Expr *Base = LHS.get()) + Actions.CodeCompleteMemberReferenceExpr( + getCurScope(), Base, OpLoc, OpKind == tok::arrow, + ExprStatementTokLoc == Base->getLocStart()); cutOffParsing(); return ExprError(); Modified: vendor/clang/dist/lib/Sema/SemaOverload.cpp ============================================================================== --- vendor/clang/dist/lib/Sema/SemaOverload.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/lib/Sema/SemaOverload.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -5944,6 +5944,28 @@ Sema::AddOverloadCandidate(FunctionDecl Candidate.FailureKind = ovl_fail_illegal_constructor; return; } + + // C++ [over.match.funcs]p8: (proposed DR resolution) + // A constructor inherited from class type C that has a first parameter + // of type "reference to P" (including such a constructor instantiated + // from a template) is excluded from the set of candidate functions when + // constructing an object of type cv D if the argument list has exactly + // one argument and D is reference-related to P and P is reference-related + // to C. + auto *Shadow = dyn_cast(FoundDecl.getDecl()); + if (Shadow && Args.size() == 1 && Constructor->getNumParams() >= 1 && + Constructor->getParamDecl(0)->getType()->isReferenceType()) { + QualType P = Constructor->getParamDecl(0)->getType()->getPointeeType(); + QualType C = Context.getRecordType(Constructor->getParent()); + QualType D = Context.getRecordType(Shadow->getParent()); + SourceLocation Loc = Args.front()->getExprLoc(); + if ((Context.hasSameUnqualifiedType(P, C) || IsDerivedFrom(Loc, P, C)) && + (Context.hasSameUnqualifiedType(D, P) || IsDerivedFrom(Loc, D, P))) { + Candidate.Viable = false; + Candidate.FailureKind = ovl_fail_inhctor_slice; + return; + } + } } unsigned NumParams = Proto->getNumParams(); @@ -6016,31 +6038,6 @@ Sema::AddOverloadCandidate(FunctionDecl } } - // C++ [over.best.ics]p4+: (proposed DR resolution) - // If the target is the first parameter of an inherited constructor when - // constructing an object of type C with an argument list that has exactly - // one expression, an implicit conversion sequence cannot be formed if C is - // reference-related to the type that the argument would have after the - // application of the user-defined conversion (if any) and before the final - // standard conversion sequence. - auto *Shadow = dyn_cast(FoundDecl.getDecl()); - if (Shadow && Args.size() == 1 && !isa(Args.front())) { - bool DerivedToBase, ObjCConversion, ObjCLifetimeConversion; - QualType ConvertedArgumentType = Args.front()->getType(); - if (Candidate.Conversions[0].isUserDefined()) - ConvertedArgumentType = - Candidate.Conversions[0].UserDefined.After.getFromType(); - if (CompareReferenceRelationship(Args.front()->getLocStart(), - Context.getRecordType(Shadow->getParent()), - ConvertedArgumentType, DerivedToBase, - ObjCConversion, - ObjCLifetimeConversion) >= Ref_Related) { - Candidate.Viable = false; - Candidate.FailureKind = ovl_fail_inhctor_slice; - return; - } - } - if (EnableIfAttr *FailedAttr = CheckEnableIf(Function, Args)) { Candidate.Viable = false; Candidate.FailureKind = ovl_fail_enable_if; @@ -10222,8 +10219,13 @@ static void NoteFunctionCandidate(Sema & return DiagnoseOpenCLExtensionDisabled(S, Cand); case ovl_fail_inhctor_slice: + // It's generally not interesting to note copy/move constructors here. + if (cast(Fn)->isCopyOrMoveConstructor()) + return; S.Diag(Fn->getLocation(), - diag::note_ovl_candidate_inherited_constructor_slice); + diag::note_ovl_candidate_inherited_constructor_slice) + << (Fn->getPrimaryTemplate() ? 1 : 0) + << Fn->getParamDecl(0)->getType()->isRValueReferenceType(); MaybeEmitInheritedConstructorNote(S, Cand->FoundDecl); return; Modified: vendor/clang/dist/lib/Sema/SemaTemplate.cpp ============================================================================== --- vendor/clang/dist/lib/Sema/SemaTemplate.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/lib/Sema/SemaTemplate.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -5127,18 +5127,22 @@ ExprResult Sema::CheckTemplateArgument(N if (CTAK == CTAK_Deduced && !Context.hasSameType(ParamType.getNonLValueExprType(Context), Arg->getType())) { - // C++ [temp.deduct.type]p17: (DR1770) - // If P has a form that contains , and if the type of i differs from - // the type of the corresponding template parameter of the template named - // by the enclosing simple-template-id, deduction fails. - // - // Note that CTAK will be CTAK_DeducedFromArrayBound if the form was [i] - // rather than . - // - // FIXME: We interpret the 'i' here as referring to the expression - // denoting the non-type template parameter rather than the parameter - // itself, and so strip off references before comparing types. It's - // not clear how this is supposed to work for references. + // FIXME: If either type is dependent, we skip the check. This isn't + // correct, since during deduction we're supposed to have replaced each + // template parameter with some unique (non-dependent) placeholder. + // FIXME: If the argument type contains 'auto', we carry on and fail the + // type check in order to force specific types to be more specialized than + // 'auto'. It's not clear how partial ordering with 'auto' is supposed to + // work. + if ((ParamType->isDependentType() || Arg->isTypeDependent()) && + !Arg->getType()->getContainedAutoType()) { + Converted = TemplateArgument(Arg); + return Arg; + } + // FIXME: This attempts to implement C++ [temp.deduct.type]p17. Per DR1770, + // we should actually be checking the type of the template argument in P, + // not the type of the template argument deduced from A, against the + // template parameter type. Diag(StartLoc, diag::err_deduced_non_type_template_arg_type_mismatch) << Arg->getType() << ParamType.getUnqualifiedType(); Modified: vendor/clang/dist/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p15.cpp ============================================================================== --- vendor/clang/dist/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p15.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p15.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -1,16 +1,16 @@ // RUN: %clang_cc1 -std=c++11 -verify %s -struct B1 { // expected-note 2{{candidate}} +struct B1 { B1(int); // expected-note {{candidate}} }; -struct B2 { // expected-note 2{{candidate}} +struct B2 { B2(int); // expected-note {{candidate}} }; struct D1 : B1, B2 { // expected-note 2{{candidate}} - using B1::B1; // expected-note 3{{inherited here}} - using B2::B2; // expected-note 3{{inherited here}} + using B1::B1; // expected-note {{inherited here}} + using B2::B2; // expected-note {{inherited here}} }; D1 d1(0); // expected-error {{ambiguous}} @@ -35,7 +35,7 @@ namespace default_ctor { operator D&&(); }; - struct A { // expected-note 4{{candidate}} + struct A { // expected-note 2{{candidate}} A(); // expected-note {{candidate}} A(C &&); // expected-note {{candidate}} @@ -47,7 +47,7 @@ namespace default_ctor { A(convert_to_D2); // expected-note {{candidate}} }; - struct B { // expected-note 4{{candidate}} + struct B { // expected-note 2{{candidate}} B(); // expected-note {{candidate}} B(C &&); // expected-note {{candidate}} @@ -66,9 +66,9 @@ namespace default_ctor { using B::operator=; }; struct D : A, B { - using A::A; // expected-note 5{{inherited here}} + using A::A; // expected-note 3{{inherited here}} using A::operator=; - using B::B; // expected-note 5{{inherited here}} + using B::B; // expected-note 3{{inherited here}} using B::operator=; D(int); @@ -93,13 +93,13 @@ namespace default_ctor { } struct Y; - struct X { // expected-note 2{{candidate}} + struct X { X(); - X(volatile Y &); // expected-note {{constructor inherited from base class cannot be used to initialize from an argument of the derived class type}} + X(volatile Y &); // expected-note 3{{inherited constructor cannot be used to copy object}} } x; - struct Y : X { using X::X; } volatile y; // expected-note 2{{candidate}} - struct Z : Y { using Y::Y; } volatile z; // expected-note 3{{candidate}} expected-note 5{{inherited here}} - Z z1(x); // ok - Z z2(y); // ok, Z is not reference-related to type of y + struct Y : X { using X::X; } volatile y; + struct Z : Y { using Y::Y; } volatile z; // expected-note 4{{no known conversion}} expected-note 2{{would lose volatile}} expected-note 3{{requires 0}} expected-note 3{{inherited here}} + Z z1(x); // expected-error {{no match}} + Z z2(y); // expected-error {{no match}} Z z3(z); // expected-error {{no match}} } Modified: vendor/clang/dist/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p1.cpp ============================================================================== --- vendor/clang/dist/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p1.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p1.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -134,13 +134,13 @@ ExplicitDefaultedAggr eda2{}; struct DefaultedBase { int n; - DefaultedBase() = default; // expected-note 0+ {{candidate}} - DefaultedBase(DefaultedBase const&) = default; // expected-note 0+ {{candidate}} - DefaultedBase(DefaultedBase &&) = default; // expected-note 0+ {{candidate}} + DefaultedBase() = default; + DefaultedBase(DefaultedBase const&) = default; + DefaultedBase(DefaultedBase &&) = default; }; struct InheritingConstructors : DefaultedBase { // expected-note 3 {{candidate}} - using DefaultedBase::DefaultedBase; // expected-note 2 {{inherited here}} + using DefaultedBase::DefaultedBase; }; InheritingConstructors ic = { 42 }; // expected-error {{no matching constructor}} Modified: vendor/clang/dist/test/CXX/drs/dr16xx.cpp ============================================================================== --- vendor/clang/dist/test/CXX/drs/dr16xx.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/CXX/drs/dr16xx.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -71,14 +71,14 @@ namespace dr1638 { // dr1638: yes namespace dr1645 { // dr1645: 3.9 #if __cplusplus >= 201103L - struct A { // expected-note 2{{candidate}} + struct A { constexpr A(int, float = 0); // expected-note 2{{candidate}} explicit A(int, int = 0); // expected-note 2{{candidate}} A(int, int, int = 0) = delete; // expected-note {{candidate}} }; struct B : A { // expected-note 2{{candidate}} - using A::A; // expected-note 7{{inherited here}} + using A::A; // expected-note 5{{inherited here}} }; constexpr B a(0); // expected-error {{ambiguous}} Modified: vendor/clang/dist/test/CXX/drs/dr19xx.cpp ============================================================================== --- vendor/clang/dist/test/CXX/drs/dr19xx.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/CXX/drs/dr19xx.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -138,18 +138,21 @@ namespace dr1959 { // dr1959: 3.9 struct c; struct a { a() = default; - a(const a &) = delete; // expected-note 2{{deleted}} + a(const a &) = delete; // expected-note {{deleted}} a(const b &) = delete; // not inherited - a(c &&) = delete; - template a(T) = delete; + a(c &&) = delete; // expected-note {{not viable}} + template a(T) = delete; // expected-note {{would take its own class type by value}} }; - struct b : a { // expected-note {{copy constructor of 'b' is implicitly deleted because base class 'dr1959::a' has a deleted copy constructor}} - using a::a; + struct b : a { // expected-note {{cannot bind}} expected-note {{deleted because}} + using a::a; // expected-note 2{{inherited here}} }; a x; - b y = x; // expected-error {{deleted}} + // FIXME: As a resolution to an open DR against P0136R0, we disallow + // use of inherited constructors to construct from a single argument + // where the base class is reference-related to the argument type. + b y = x; // expected-error {{no viable conversion}} b z = z; // expected-error {{deleted}} struct c : a { @@ -158,7 +161,7 @@ namespace dr1959 { // dr1959: 3.9 }; // FIXME: As a resolution to an open DR against P0136R0, we disallow // use of inherited constructors to construct from a single argument - // where the derived class is reference-related to its type. + // where the base class is reference-related to the argument type. c q(static_cast(q)); #endif } Modified: vendor/clang/dist/test/CXX/special/class.inhctor/p1.cpp ============================================================================== --- vendor/clang/dist/test/CXX/special/class.inhctor/p1.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/CXX/special/class.inhctor/p1.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -3,7 +3,7 @@ // Note: [class.inhctor] was removed by P0136R1. This tests the new behavior // for the wording that used to be there. -struct A { // expected-note 8{{candidate is the implicit}} +struct A { // expected-note 4{{candidate is the implicit}} A(...); // expected-note 4{{candidate constructor}} expected-note 4{{candidate inherited constructor}} A(int = 0, int = 0, int = 0, int = 0, ...); // expected-note 3{{candidate constructor}} expected-note 3{{candidate inherited constructor}} A(int = 0, int = 0, ...); // expected-note 3{{candidate constructor}} expected-note 3{{candidate inherited constructor}} @@ -15,7 +15,7 @@ struct A { // expected-note 8{{candidate }; struct B : A { // expected-note 4{{candidate is the implicit}} - using A::A; // expected-note 19{{inherited here}} + using A::A; // expected-note 15{{inherited here}} B(void*); }; Modified: vendor/clang/dist/test/CXX/special/class.inhctor/p3.cpp ============================================================================== --- vendor/clang/dist/test/CXX/special/class.inhctor/p3.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/CXX/special/class.inhctor/p3.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -14,21 +14,21 @@ D1 d1a(1), d1b(1, 1); D1 fd1() { return 1; } -struct B2 { // expected-note 2{{candidate}} +struct B2 { explicit B2(int, int = 0, int = 0); }; struct D2 : B2 { // expected-note 2{{candidate constructor}} - using B2::B2; // expected-note 2{{inherited here}} + using B2::B2; }; D2 d2a(1), d2b(1, 1), d2c(1, 1, 1); D2 fd2() { return 1; } // expected-error {{no viable conversion}} -struct B3 { // expected-note 2{{candidate}} +struct B3 { B3(void*); // expected-note {{candidate}} }; struct D3 : B3 { // expected-note 2{{candidate constructor}} - using B3::B3; // expected-note 3{{inherited here}} + using B3::B3; // expected-note {{inherited here}} }; D3 fd3() { return 1; } // expected-error {{no viable conversion}} Modified: vendor/clang/dist/test/CXX/special/class.inhctor/p7.cpp ============================================================================== --- vendor/clang/dist/test/CXX/special/class.inhctor/p7.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/CXX/special/class.inhctor/p7.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -3,15 +3,15 @@ // Note: [class.inhctor] was removed by P0136R1. This tests the new behavior // for the wording that used to be there. -struct B1 { // expected-note 2{{candidate}} +struct B1 { B1(int); // expected-note {{candidate}} }; -struct B2 { // expected-note 2{{candidate}} +struct B2 { B2(int); // expected-note {{candidate}} }; struct D1 : B1, B2 { // expected-note 2{{candidate}} - using B1::B1; // expected-note 3{{inherited here}} - using B2::B2; // expected-note 3{{inherited here}} + using B1::B1; // expected-note {{inherited here}} + using B2::B2; // expected-note {{inherited here}} }; struct D2 : B1, B2 { using B1::B1; Modified: vendor/clang/dist/test/CodeCompletion/member-access.cpp ============================================================================== --- vendor/clang/dist/test/CodeCompletion/member-access.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/CodeCompletion/member-access.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -27,6 +27,16 @@ public: void test(const Proxy &p) { p-> +} + +struct Test1 { + Base1 b; + + static void sfunc() { + b. // expected-error {{invalid use of member 'b' in static member function}} + } +}; + // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:29:6 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s // CHECK-CC1: Base1 : Base1:: // CHECK-CC1: member1 : [#int#][#Base1::#]member1 @@ -39,4 +49,6 @@ void test(const Proxy &p) { // CHECK-CC1: memfun1 (Hidden) : [#void#]Base2::memfun1(<#int#>) // CHECK-CC1: memfun2 : [#void#][#Base3::#]memfun2(<#int#>) // CHECK-CC1: memfun3 : [#int#]memfun3(<#int#>) - + +// Make sure this doesn't crash +// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:36:7 %s -verify Modified: vendor/clang/dist/test/Driver/netbsd.c ============================================================================== --- vendor/clang/dist/test/Driver/netbsd.c Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/Driver/netbsd.c Sun Jan 22 16:52:41 2017 (r312627) @@ -126,6 +126,8 @@ // RUN: %clang -no-canonical-prefixes -target powerpc64--netbsd -static \ // RUN: --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ // RUN: | FileCheck -check-prefix=S-POWERPC64 %s +// RUN: %clang -target x86_64--netbsd -pthread -dM -E %s \ +// RUN: | FileCheck -check-prefix=PTHREAD %s // STATIC: ld{{.*}}" "--eh-frame-hdr" // STATIC-NOT: "-pie" @@ -427,3 +429,7 @@ // S-POWERPC64: "{{.*}}/usr/lib{{/|\\\\}}crti.o" // S-POWERPC64: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc" // S-POWERPC64: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o" + +// PTHREAD-NOT: _POSIX_THREADS +// PTHREAD: _REENTRANT +// PTHREAD-NOT: _POSIX_THREADS Modified: vendor/clang/dist/test/Preprocessor/dependencies-and-pp.c ============================================================================== --- vendor/clang/dist/test/Preprocessor/dependencies-and-pp.c Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/Preprocessor/dependencies-and-pp.c Sun Jan 22 16:52:41 2017 (r312627) @@ -32,5 +32,12 @@ // RUN: FileCheck -check-prefix=TEST5 %s < %t.d // TEST5: foo $$(bar) b az qu\ ux \ space: +// Test self dependency, PR31644 + +// RUN: %clang -E -MD -MP -MF %t.d %s +// RUN: FileCheck -check-prefix=TEST6 %s < %t.d +// TEST6: dependencies-and-pp.c +// TEST6-NOT: dependencies-and-pp.c: + // TODO: Test default target without quoting // TODO: Test default target with quoting Modified: vendor/clang/dist/test/SemaCXX/cxx11-inheriting-ctors.cpp ============================================================================== --- vendor/clang/dist/test/SemaCXX/cxx11-inheriting-ctors.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/SemaCXX/cxx11-inheriting-ctors.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -56,9 +56,9 @@ namespace InvalidConstruction { } namespace ExplicitConv { - struct B {}; // expected-note 2{{candidate}} + struct B {}; struct D : B { // expected-note 3{{candidate}} - using B::B; // expected-note 2{{inherited}} + using B::B; }; struct X { explicit operator B(); } x; struct Y { explicit operator D(); } y; @@ -68,19 +68,40 @@ namespace ExplicitConv { } namespace NestedListInit { - struct B { B(); } b; // expected-note 5{{candidate}} - struct D : B { // expected-note 3{{candidate}} - using B::B; // expected-note 2{{inherited}} + struct B { B(); } b; // expected-note 3{{candidate}} + struct D : B { // expected-note 14{{not viable}} + using B::B; }; // This is a bit weird. We're allowed one pair of braces for overload // resolution, and one more pair of braces due to [over.ics.list]/2. B b1 = {b}; B b2 = {{b}}; B b3 = {{{b}}}; // expected-error {{no match}} - // This is the same, but we get one call to D's version of B::B(const B&) - // before the two permitted calls to D::D(D&&). - D d1 = {b}; - D d2 = {{b}}; - D d3 = {{{b}}}; + // Per a proposed defect resolution, we don't get to call + // D's version of B::B(const B&) here. + D d0 = b; // expected-error {{no viable conversion}} + D d1 = {b}; // expected-error {{no match}} + D d2 = {{b}}; // expected-error {{no match}} + D d3 = {{{b}}}; // expected-error {{no match}} D d4 = {{{{b}}}}; // expected-error {{no match}} } + +namespace PR31606 { + // PR31606: as part of a proposed defect resolution, do not consider + // inherited constructors that would be copy constructors for any class + // between the declaring class and the constructed class (inclusive). + struct Base {}; + + struct A : Base { + using Base::Base; + bool operator==(A const &) const; // expected-note {{no known conversion from 'PR31606::B' to 'const PR31606::A' for 1st argument}} + }; + + struct B : Base { + using Base::Base; + }; + + bool a = A{} == A{}; + // Note, we do *not* allow operator=='s argument to use the inherited A::A(Base&&) constructor to construct from B{}. + bool b = A{} == B{}; // expected-error {{invalid operands}} +} Modified: vendor/clang/dist/test/SemaTemplate/class-template-spec.cpp ============================================================================== --- vendor/clang/dist/test/SemaTemplate/class-template-spec.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/SemaTemplate/class-template-spec.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -207,19 +207,19 @@ namespace NTTPTypeVsPartialOrder { struct X { typedef int value_type; }; template struct Y { typedef T value_type; }; - template struct A; // expected-note {{template}} + template struct A; template struct A {}; - template struct A, N> {}; // expected-error {{not more specialized}} expected-note {{'T' vs 'typename Y::value_type'}} + template struct A, N> {}; A ax; A, 0> ay; - template struct B; // expected-note {{template}} - template struct B<0, T, N>; // expected-note {{matches}} + template struct B; + template struct B<0, T, N>; template struct B<0, X, N> {}; - template struct B<0, Y, N> {}; // expected-error {{not more specialized}} expected-note {{'T' vs 'typename Y::value_type'}} expected-note {{matches}} + template struct B<0, Y, N> {}; B<0, X, 0> bx; - B<0, Y, 0> by; // expected-error {{ambiguous}} + B<0, Y, 0> by; } namespace DefaultArgVsPartialSpec { Modified: vendor/clang/dist/test/SemaTemplate/cxx1z-using-declaration.cpp ============================================================================== --- vendor/clang/dist/test/SemaTemplate/cxx1z-using-declaration.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/SemaTemplate/cxx1z-using-declaration.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -17,7 +17,7 @@ void test_Unexpanded() { // Test using non-type members from pack of base classes. template struct A : T... { // expected-note 2{{candidate}} - using T::T ...; // expected-note 6{{inherited here}} + using T::T ...; // expected-note 2{{inherited here}} using T::operator() ...; using T::operator T* ...; using T::h ...; @@ -29,7 +29,7 @@ template struct A : T... }; namespace test_A { - struct X { // expected-note 2{{candidate}} + struct X { X(); X(int); // expected-note {{candidate}} void operator()(int); // expected-note 2{{candidate}} @@ -43,7 +43,7 @@ namespace test_A { operator Y *(); void h(int, int); // expected-note {{not viable}} }; - struct Z { // expected-note 2{{candidate}} + struct Z { Z(); Z(int); // expected-note {{candidate}} void operator()(int); // expected-note 2{{candidate}} Added: vendor/clang/dist/test/SemaTemplate/partial-order.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist/test/SemaTemplate/partial-order.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -std=c++1z %s -verify + +// expected-no-diagnostics + +namespace hana_enable_if_idiom { + template struct A {}; + template> struct B; + template struct B> {}; + template struct B> {}; + struct C { + static const bool value = true; + }; + B b; +} Modified: vendor/clang/dist/test/SemaTemplate/temp_arg_nontype.cpp ============================================================================== --- vendor/clang/dist/test/SemaTemplate/temp_arg_nontype.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/SemaTemplate/temp_arg_nontype.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -370,13 +370,13 @@ namespace PR17696 { } namespace partial_order_different_types { - // These are unordered because the type of the final argument doesn't match. - template struct A; // expected-note {{here}} - template struct A<0, N, T, U, V> {}; // expected-note {{matches}} - template struct A<0, 0, T, U, V> {}; // expected-note {{matches}} - // expected-error@-1 {{not more specialized than the primary}} - // expected-note@-2 {{deduced non-type template argument does not have the same type as the corresponding template parameter ('U' vs 'type-parameter-0-0')}} - A<0, 0, int, int, 0> a; // expected-error {{ambiguous partial specializations}} + template struct A; + template struct A<0, N, T, U, V>; // expected-note {{matches}} + // FIXME: It appears that this partial specialization should be ill-formed as + // it is not more specialized than the primary template. V is not deducible + // because it does not have the same type as the corresponding parameter. + template struct A<0, N, T, U, V> {}; // expected-note {{matches}} + A<0, 0, int, int, 0> a; // expected-error {{ambiguous}} } namespace partial_order_references { @@ -434,7 +434,7 @@ namespace dependent_nested_partial_speci template struct E { template struct F; // expected-note {{template}} - template struct F {}; // expected-error {{not more specialized than the primary}} expected-note {{does not have the same type}} + template struct F {}; // expected-error {{not more specialized than the primary}} }; E::F e1; // expected-note {{instantiation of}} } Modified: vendor/clang/dist/test/SemaTemplate/temp_arg_template_cxx1z.cpp ============================================================================== --- vendor/clang/dist/test/SemaTemplate/temp_arg_template_cxx1z.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/SemaTemplate/temp_arg_template_cxx1z.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -79,13 +79,13 @@ namespace Auto { TInt ia; TInt iap; // expected-error {{different template parameters}} - TInt ida; // FIXME expected-error {{different template parameters}} + TInt ida; TInt ii; TInt iip; // expected-error {{different template parameters}} TIntPtr ipa; TIntPtr ipap; - TIntPtr ipda; // FIXME expected-error {{different template parameters}} + TIntPtr ipda; TIntPtr ipi; // expected-error {{different template parameters}} TIntPtr ipip; @@ -114,6 +114,6 @@ namespace Auto { int n; template struct SubstFailure; - TInt isf; // expected-error {{different template parameters}} - TIntPtr ipsf; // expected-error {{different template parameters}} + TInt isf; // FIXME: this should be ill-formed + TIntPtr ipsf; }