[PATCH] D21279: Fix some issues in clang-format's AlignConsecutive modes
bmharper added a comment. Pinging @djasper. Any chance we can get this merged? https://reviews.llvm.org/D21279 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D21279: Fix some issues in clang-format's AlignConsecutive modes
djasper added inline comments. Comment at: lib/Format/WhitespaceManager.cpp:207 + +if (i != Start) { + if (Changes[i].NestingAndIndentLevel > Merge the two ifs into a single one? Comment at: lib/Format/WhitespaceManager.cpp:318 + for (unsigned e = Changes.size(); + i != e && Changes[i].NestingAndIndentLevel >= NestingAndIndentLevel; + ++i) { I'd probably move the second condition into an early exit inside the loop: if (Changes[i].NestingAndIndentLevel >= NestingAndIndentLevel) break; Comment at: lib/Format/WhitespaceManager.cpp:394 }, - Changes); + Changes, 0); } Use a comment to describe the literal, i.e.: /*StartAt=*/0 Comment at: lib/Format/WhitespaceManager.h:134 +// A combination of nesting level and indent level. +// The nesting level of this token, i.e. the number of surrounding (), +// [], {} or <>. Note that the value stored here is slightly different This comment seems outdated. Comment at: lib/Format/WhitespaceManager.h:217 + /// declaration name. + static bool IsStartOfDeclName(const FormatToken &Tok); + This function should be a local function in the .cpp file. Also, can you describe in more detail what this does, i.e. what kind of declarations are covered here? Also, it is a bit confusing to have a function and a member of WhitespaceManager::Change with the exact same name. https://reviews.llvm.org/D21279 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r292776 - ASTImporter: improve support for C++ templates
Author: a.sidorin Date: Mon Jan 23 03:30:36 2017 New Revision: 292776 URL: http://llvm.org/viewvc/llvm-project?rev=292776&view=rev Log: ASTImporter: improve support for C++ templates * Support template partial specialization * Avoid infinite recursion in IsStructurallyEquivalent for TemplateArgument with implementing IsStructurallyEquivalent for TemplateName Modified: cfe/trunk/include/clang/AST/TemplateBase.h cfe/trunk/lib/AST/ASTImporter.cpp Modified: cfe/trunk/include/clang/AST/TemplateBase.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TemplateBase.h?rev=292776&r1=292775&r2=292776&view=diff == --- cfe/trunk/include/clang/AST/TemplateBase.h (original) +++ cfe/trunk/include/clang/AST/TemplateBase.h Mon Jan 23 03:30:36 2017 @@ -578,6 +578,7 @@ struct ASTTemplateArgumentListInfo final TemplateArgumentLoc> { private: friend TrailingObjects; + friend class ASTNodeImporter; ASTTemplateArgumentListInfo(const TemplateArgumentListInfo &List); Modified: cfe/trunk/lib/AST/ASTImporter.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=292776&r1=292775&r2=292776&view=diff == --- cfe/trunk/lib/AST/ASTImporter.cpp (original) +++ cfe/trunk/lib/AST/ASTImporter.cpp Mon Jan 23 03:30:36 2017 @@ -72,7 +72,7 @@ namespace clang { QualType VisitEnumType(const EnumType *T); QualType VisitAttributedType(const AttributedType *T); QualType VisitTemplateTypeParmType(const TemplateTypeParmType *T); -// FIXME: SubstTemplateTypeParmType +QualType VisitSubstTemplateTypeParmType(const SubstTemplateTypeParmType *T); QualType VisitTemplateSpecializationType(const TemplateSpecializationType *T); QualType VisitElaboratedType(const ElaboratedType *T); // FIXME: DependentNameType @@ -278,6 +278,8 @@ namespace clang { Expr *VisitArrayInitIndexExpr(ArrayInitIndexExpr *E); Expr *VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E); Expr *VisitCXXNamedCastExpr(CXXNamedCastExpr *E); +Expr *VisitSubstNonTypeTemplateParmExpr(SubstNonTypeTemplateParmExpr *E); + template void ImportArray(IIter Ibegin, IIter Iend, OIter Obegin) { @@ -397,6 +399,9 @@ static bool IsStructurallyEquivalent(Str QualType T1, QualType T2); static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, Decl *D1, Decl *D2); +static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, + const TemplateArgument &Arg1, + const TemplateArgument &Arg2); /// \brief Determine structural equivalence of two expressions. static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, @@ -421,8 +426,103 @@ static bool IsStructurallyEquivalent(con static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, NestedNameSpecifier *NNS1, NestedNameSpecifier *NNS2) { - // FIXME: Implement! - return true; + if (NNS1->getKind() != NNS2->getKind()) +return false; + + NestedNameSpecifier *Prefix1 = NNS1->getPrefix(), + *Prefix2 = NNS2->getPrefix(); + if ((bool)Prefix1 != (bool)Prefix2) +return false; + + if (Prefix1) +if (!IsStructurallyEquivalent(Context, Prefix1, Prefix2)) + return false; + + switch (NNS1->getKind()) { + case NestedNameSpecifier::Identifier: +return IsStructurallyEquivalent(NNS1->getAsIdentifier(), +NNS2->getAsIdentifier()); + case NestedNameSpecifier::Namespace: +return IsStructurallyEquivalent(Context, NNS1->getAsNamespace(), +NNS2->getAsNamespace()); + case NestedNameSpecifier::NamespaceAlias: +return IsStructurallyEquivalent(Context, NNS1->getAsNamespaceAlias(), +NNS2->getAsNamespaceAlias()); + case NestedNameSpecifier::TypeSpec: + case NestedNameSpecifier::TypeSpecWithTemplate: +return IsStructurallyEquivalent(Context, QualType(NNS1->getAsType(), 0), +QualType(NNS2->getAsType(), 0)); + case NestedNameSpecifier::Global: +return true; + case NestedNameSpecifier::Super: +return IsStructurallyEquivalent(Context, NNS1->getAsRecordDecl(), +NNS2->getAsRecordDecl()); + } + return false; +} + +static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, + const TemplateName &N1, + const TemplateName &N2) { + if (N1.getKind() != N2.getKind()) +return false; + switch (N1.getKind()) { + case TemplateName::Template: +return IsStructurallyEq
r292778 - ASTImporter: add forgotten tests for rL292776
Author: a.sidorin Date: Mon Jan 23 03:45:29 2017 New Revision: 292778 URL: http://llvm.org/viewvc/llvm-project?rev=292778&view=rev Log: ASTImporter: add forgotten tests for rL292776 Added: cfe/trunk/test/ASTMerge/class-template-partial-spec/ cfe/trunk/test/ASTMerge/class-template-partial-spec/Inputs/ cfe/trunk/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec1.cpp cfe/trunk/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec2.cpp cfe/trunk/test/ASTMerge/class-template-partial-spec/test.cpp Added: cfe/trunk/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec1.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec1.cpp?rev=292778&view=auto == --- cfe/trunk/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec1.cpp (added) +++ cfe/trunk/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec1.cpp Mon Jan 23 03:45:29 2017 @@ -0,0 +1,118 @@ +template +struct TwoOptionTemplate {}; + +template +struct TwoOptionTemplate { + int member; +}; + + +template +struct TwoOptionTemplate { + float member; +}; + +template +struct TwoOptionTemplate { + T** member; +}; + +TwoOptionTemplate X0; +TwoOptionTemplate X1; +TwoOptionTemplate X2; +TwoOptionTemplate X3; +TwoOptionTemplate X4; +TwoOptionTemplate SingleSource; +TwoOptionTemplate SecondDoubleSource; + + +template +struct IntTemplateSpec {}; + +template +struct IntTemplateSpec<4, C> { + C member; +}; + +template +struct IntTemplateSpec { + int member; + static constexpr int val = I; +}; + +template +struct IntTemplateSpec { + char member; + static constexpr int val = I; +}; + +IntTemplateSpec<4, wchar_t> Y0; +IntTemplateSpec<5, void *> Y1; +IntTemplateSpec<1, long> Y2; +IntTemplateSpec<3, int> Y3; +//template constexpr int IntTemplateSpec::val; +IntTemplateSpec<42, double> NumberSource; +static_assert(NumberSource.val == 42); + +namespace One { +namespace Two { + // Just an empty namespace to ensure we can deal with multiple namespace decls. +} +} + + +namespace One { +namespace Two { +namespace Three { + +template +class Parent {}; + +} // namespace Three + +} // namespace Two + +template +struct Child1: public Two::Three::Parent { + char member; +}; + +template +struct Child1> { + T member; +}; + +} // namespace One + +One::Child1 Z0Source; + +// Test import of nested namespace specifiers +template +struct Outer { + template class Inner0; +}; + +template +template +class Outer::Inner0 { +public: + void f(X, Y); + template struct Inner1; +}; + +template +template +void Outer::Inner0::f(X, Y) {} + +template +template +template +class Outer::Inner0::Inner1 { +public: + void f(Y, Z); +}; + +template +template +template +void Outer::Inner0::Inner1::f(Y, Z) {} Added: cfe/trunk/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec2.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec2.cpp?rev=292778&view=auto == --- cfe/trunk/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec2.cpp (added) +++ cfe/trunk/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec2.cpp Mon Jan 23 03:45:29 2017 @@ -0,0 +1,79 @@ +template +struct TwoOptionTemplate {}; + +template +struct TwoOptionTemplate { + int member; +}; + + +template +struct TwoOptionTemplate { + float member; +}; + +template +struct TwoOptionTemplate { + T** member; +}; + +TwoOptionTemplate X0; +TwoOptionTemplate X1; +TwoOptionTemplate X2; +TwoOptionTemplate X3; +TwoOptionTemplate X4; +TwoOptionTemplate SingleDest; +TwoOptionTemplate SecondDoubleDest; + + +template +struct IntTemplateSpec {}; + +template +struct IntTemplateSpec<4, C> { + C member; +}; + +template +struct IntTemplateSpec { + double member; + static constexpr int val = I; +}; + +template +struct IntTemplateSpec { + char member; + static constexpr int val = I; +}; + +IntTemplateSpec<4, wchar_t>Y0; +IntTemplateSpec<5, void *> Y1; +IntTemplateSpec<1, int> Y2; +IntTemplateSpec<2, int> Y3; +IntTemplateSpec<43, double> NumberDest; + +namespace One { +namespace Two { +namespace Three { + +template +class Parent {}; + +} // namespace Three + +} // namespace Two + +template +struct Child1: public Two::Three::Parent { + char member; +}; + +template +struct Child1> { + T member; +}; + +} // namespace One + +namespace Dst { One::Child1> Z0Dst; } +One::Child1 Z1; Added: cfe/trunk/test/ASTMerge/class-template-partial-spec/test.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ASTMerge/class-template-partial-spec/test.cpp?rev=292778&view=auto =
r292779 - ASTImporter: quick test fix
Author: a.sidorin Date: Mon Jan 23 04:16:30 2017 New Revision: 292779 URL: http://llvm.org/viewvc/llvm-project?rev=292779&view=rev Log: ASTImporter: quick test fix Differential Revision: https://reviews.llvm.org/D26753 Modified: cfe/trunk/test/ASTMerge/class-template-partial-spec/test.cpp Modified: cfe/trunk/test/ASTMerge/class-template-partial-spec/test.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ASTMerge/class-template-partial-spec/test.cpp?rev=292779&r1=292778&r2=292779&view=diff == --- cfe/trunk/test/ASTMerge/class-template-partial-spec/test.cpp (original) +++ cfe/trunk/test/ASTMerge/class-template-partial-spec/test.cpp Mon Jan 23 04:16:30 2017 @@ -9,17 +9,17 @@ static_assert(sizeof(Z0Source.member) == static_assert(sizeof(Dst::Z0Dst.member) == sizeof(double)); static_assert(sizeof(One::Child1>::member) == sizeof(double)); -// CHECK: llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec2.cpp:21:32: error: external variable 'X1' declared with incompatible types in different translation units ('TwoOptionTemplate' vs. 'TwoOptionTemplate') -// CHECK: llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec1.cpp:21:31: note: declared here with type 'TwoOptionTemplate' +// CHECK: Inputs/class-template-partial-spec2.cpp:21:32: error: external variable 'X1' declared with incompatible types in different translation units ('TwoOptionTemplate' vs. 'TwoOptionTemplate') +// CHECK: Inputs/class-template-partial-spec1.cpp:21:31: note: declared here with type 'TwoOptionTemplate' -// CHECK: llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec2.cpp:24:29: error: external variable 'X4' declared with incompatible types in different translation units ('TwoOptionTemplate' vs. 'TwoOptionTemplate') -// CHECK: llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec1.cpp:24:33: note: declared here with type 'TwoOptionTemplate' +// CHECK: Inputs/class-template-partial-spec2.cpp:24:29: error: external variable 'X4' declared with incompatible types in different translation units ('TwoOptionTemplate' vs. 'TwoOptionTemplate') +// CHECK: Inputs/class-template-partial-spec1.cpp:24:33: note: declared here with type 'TwoOptionTemplate' -// CHECK: llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec1.cpp:38:8: warning: type 'IntTemplateSpec<5, void *>' has incompatible definitions in different translation units -// CHECK: llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec1.cpp:39:7: note: field 'member' has type 'int' here -// CHECK: llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec2.cpp:39:10: note: field 'member' has type 'double' here +// CHECK: Inputs/class-template-partial-spec1.cpp:38:8: warning: type 'IntTemplateSpec<5, void *>' has incompatible definitions in different translation units +// CHECK: Inputs/class-template-partial-spec1.cpp:39:7: note: field 'member' has type 'int' here +// CHECK: Inputs/class-template-partial-spec2.cpp:39:10: note: field 'member' has type 'double' here -// CHECK: llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec2.cpp:52:25: error: external variable 'Y3' declared with incompatible types in different translation units ('IntTemplateSpec<2, int>' vs. 'IntTemplateSpec<3, int>') -// CHECK: llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec1.cpp:52:25: note: declared here with type 'IntTemplateSpec<3, int>' +// CHECK: Inputs/class-template-partial-spec2.cpp:52:25: error: external variable 'Y3' declared with incompatible types in different translation units ('IntTemplateSpec<2, int>' vs. 'IntTemplateSpec<3, int>') +// CHECK: Inputs/class-template-partial-spec1.cpp:52:25: note: declared here with type 'IntTemplateSpec<3, int>' // CHECK-NOT: static_assert ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26753: ASTImporter: improve support for C++ templates
This revision was automatically updated to reflect the committed changes. Closed by commit rL292779: ASTImporter: quick test fix (authored by a.sidorin). Changed prior to commit: https://reviews.llvm.org/D26753?vs=79054&id=85332#toc Repository: rL LLVM https://reviews.llvm.org/D26753 Files: cfe/trunk/test/ASTMerge/class-template-partial-spec/test.cpp Index: cfe/trunk/test/ASTMerge/class-template-partial-spec/test.cpp === --- cfe/trunk/test/ASTMerge/class-template-partial-spec/test.cpp +++ cfe/trunk/test/ASTMerge/class-template-partial-spec/test.cpp @@ -9,17 +9,17 @@ static_assert(sizeof(Dst::Z0Dst.member) == sizeof(double)); static_assert(sizeof(One::Child1>::member) == sizeof(double)); -// CHECK: llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec2.cpp:21:32: error: external variable 'X1' declared with incompatible types in different translation units ('TwoOptionTemplate' vs. 'TwoOptionTemplate') -// CHECK: llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec1.cpp:21:31: note: declared here with type 'TwoOptionTemplate' +// CHECK: Inputs/class-template-partial-spec2.cpp:21:32: error: external variable 'X1' declared with incompatible types in different translation units ('TwoOptionTemplate' vs. 'TwoOptionTemplate') +// CHECK: Inputs/class-template-partial-spec1.cpp:21:31: note: declared here with type 'TwoOptionTemplate' -// CHECK: llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec2.cpp:24:29: error: external variable 'X4' declared with incompatible types in different translation units ('TwoOptionTemplate' vs. 'TwoOptionTemplate') -// CHECK: llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec1.cpp:24:33: note: declared here with type 'TwoOptionTemplate' +// CHECK: Inputs/class-template-partial-spec2.cpp:24:29: error: external variable 'X4' declared with incompatible types in different translation units ('TwoOptionTemplate' vs. 'TwoOptionTemplate') +// CHECK: Inputs/class-template-partial-spec1.cpp:24:33: note: declared here with type 'TwoOptionTemplate' -// CHECK: llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec1.cpp:38:8: warning: type 'IntTemplateSpec<5, void *>' has incompatible definitions in different translation units -// CHECK: llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec1.cpp:39:7: note: field 'member' has type 'int' here -// CHECK: llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec2.cpp:39:10: note: field 'member' has type 'double' here +// CHECK: Inputs/class-template-partial-spec1.cpp:38:8: warning: type 'IntTemplateSpec<5, void *>' has incompatible definitions in different translation units +// CHECK: Inputs/class-template-partial-spec1.cpp:39:7: note: field 'member' has type 'int' here +// CHECK: Inputs/class-template-partial-spec2.cpp:39:10: note: field 'member' has type 'double' here -// CHECK: llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec2.cpp:52:25: error: external variable 'Y3' declared with incompatible types in different translation units ('IntTemplateSpec<2, int>' vs. 'IntTemplateSpec<3, int>') -// CHECK: llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec1.cpp:52:25: note: declared here with type 'IntTemplateSpec<3, int>' +// CHECK: Inputs/class-template-partial-spec2.cpp:52:25: error: external variable 'Y3' declared with incompatible types in different translation units ('IntTemplateSpec<2, int>' vs. 'IntTemplateSpec<3, int>') +// CHECK: Inputs/class-template-partial-spec1.cpp:52:25: note: declared here with type 'IntTemplateSpec<3, int>' // CHECK-NOT: static_assert Index: cfe/trunk/test/ASTMerge/class-template-partial-spec/test.cpp === --- cfe/trunk/test/ASTMerge/class-template-partial-spec/test.cpp +++ cfe/trunk/test/ASTMerge/class-template-partial-spec/test.cpp @@ -9,17 +9,17 @@ static_assert(sizeof(Dst::Z0Dst.member) == sizeof(double)); static_assert(sizeof(One::Child1>::member) == sizeof(double)); -// CHECK: llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec2.cpp:21:32: error: external variable 'X1' declared with incompatible types in different translation units ('TwoOptionTemplate' vs. 'TwoOptionTemplate') -// CHECK: llvm/tools/clang/test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec1.cpp:21:31: note: declared here with type 'TwoOptionTemplate' +// CHECK: Inputs/class-template-partial-spec2.cpp:21:32: error: external variable 'X1' declared with incompatible types in different translation units ('TwoOptionTemplate' vs. 'TwoOptionTemp
r292781 - ASTImporter: fix tests on Windows with removing slashed parts of paths
Author: a.sidorin Date: Mon Jan 23 04:39:45 2017 New Revision: 292781 URL: http://llvm.org/viewvc/llvm-project?rev=292781&view=rev Log: ASTImporter: fix tests on Windows with removing slashed parts of paths Differential Revision: https://reviews.llvm.org/D26753 Modified: cfe/trunk/test/ASTMerge/class-template-partial-spec/test.cpp Modified: cfe/trunk/test/ASTMerge/class-template-partial-spec/test.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ASTMerge/class-template-partial-spec/test.cpp?rev=292781&r1=292780&r2=292781&view=diff == --- cfe/trunk/test/ASTMerge/class-template-partial-spec/test.cpp (original) +++ cfe/trunk/test/ASTMerge/class-template-partial-spec/test.cpp Mon Jan 23 04:39:45 2017 @@ -9,17 +9,17 @@ static_assert(sizeof(Z0Source.member) == static_assert(sizeof(Dst::Z0Dst.member) == sizeof(double)); static_assert(sizeof(One::Child1>::member) == sizeof(double)); -// CHECK: Inputs/class-template-partial-spec2.cpp:21:32: error: external variable 'X1' declared with incompatible types in different translation units ('TwoOptionTemplate' vs. 'TwoOptionTemplate') -// CHECK: Inputs/class-template-partial-spec1.cpp:21:31: note: declared here with type 'TwoOptionTemplate' +// CHECK: class-template-partial-spec2.cpp:21:32: error: external variable 'X1' declared with incompatible types in different translation units ('TwoOptionTemplate' vs. 'TwoOptionTemplate') +// CHECK: class-template-partial-spec1.cpp:21:31: note: declared here with type 'TwoOptionTemplate' -// CHECK: Inputs/class-template-partial-spec2.cpp:24:29: error: external variable 'X4' declared with incompatible types in different translation units ('TwoOptionTemplate' vs. 'TwoOptionTemplate') -// CHECK: Inputs/class-template-partial-spec1.cpp:24:33: note: declared here with type 'TwoOptionTemplate' +// CHECK: class-template-partial-spec2.cpp:24:29: error: external variable 'X4' declared with incompatible types in different translation units ('TwoOptionTemplate' vs. 'TwoOptionTemplate') +// CHECK: class-template-partial-spec1.cpp:24:33: note: declared here with type 'TwoOptionTemplate' -// CHECK: Inputs/class-template-partial-spec1.cpp:38:8: warning: type 'IntTemplateSpec<5, void *>' has incompatible definitions in different translation units -// CHECK: Inputs/class-template-partial-spec1.cpp:39:7: note: field 'member' has type 'int' here -// CHECK: Inputs/class-template-partial-spec2.cpp:39:10: note: field 'member' has type 'double' here +// CHECK: class-template-partial-spec1.cpp:38:8: warning: type 'IntTemplateSpec<5, void *>' has incompatible definitions in different translation units +// CHECK: class-template-partial-spec1.cpp:39:7: note: field 'member' has type 'int' here +// CHECK: class-template-partial-spec2.cpp:39:10: note: field 'member' has type 'double' here -// CHECK: Inputs/class-template-partial-spec2.cpp:52:25: error: external variable 'Y3' declared with incompatible types in different translation units ('IntTemplateSpec<2, int>' vs. 'IntTemplateSpec<3, int>') -// CHECK: Inputs/class-template-partial-spec1.cpp:52:25: note: declared here with type 'IntTemplateSpec<3, int>' +// CHECK: class-template-partial-spec2.cpp:52:25: error: external variable 'Y3' declared with incompatible types in different translation units ('IntTemplateSpec<2, int>' vs. 'IntTemplateSpec<3, int>') +// CHECK: class-template-partial-spec1.cpp:52:25: note: declared here with type 'IntTemplateSpec<3, int>' // CHECK-NOT: static_assert ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26753: ASTImporter: improve support for C++ templates
a.sidorin added a comment. Main revisions: https://reviews.llvm.org/rL292776, https://reviews.llvm.org/rL292778. Sorry for not mentioning them in Differential Revision. Repository: rL LLVM https://reviews.llvm.org/D26753 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28764: [clang-format] Implement comment reflowing (v3)
krasimir updated this revision to Diff 85339. krasimir added a comment. - [clang-format] Improve the interface of BreakableToken and add comments. https://reviews.llvm.org/D28764 Files: lib/Format/BreakableToken.cpp lib/Format/BreakableToken.h lib/Format/CMakeLists.txt lib/Format/Comments.cpp lib/Format/Comments.h lib/Format/ContinuationIndenter.cpp lib/Format/TokenAnnotator.cpp lib/Format/UnwrappedLineParser.cpp lib/Format/WhitespaceManager.cpp unittests/Format/FormatTest.cpp unittests/Format/FormatTestSelective.cpp Index: unittests/Format/FormatTestSelective.cpp === --- unittests/Format/FormatTestSelective.cpp +++ unittests/Format/FormatTestSelective.cpp @@ -111,13 +111,19 @@ format("int a; // comment\n" "intb; // comment", 0, 0)); - EXPECT_EQ("int a; // comment\n" -" // line 2\n" + EXPECT_EQ("int a; // comment\n" +" // line 2\n" "int b;", format("int a; // comment\n" "// line 2\n" "int b;", 28, 0)); + EXPECT_EQ("int a; // comment\n" +"// comment 2\n" +"int b;", +format("int a; // comment\n" + "// comment 2\n" + "int b;", 28, 0)); EXPECT_EQ("int aa; // comment\n" "int b;\n" "int c; // unrelated comment", Index: unittests/Format/FormatTest.cpp === --- unittests/Format/FormatTest.cpp +++ unittests/Format/FormatTest.cpp @@ -1783,6 +1783,455 @@ "0x00, 0x00, 0x00, 0x00};// comment\n"); } +TEST_F(FormatTest, ReflowsComments) { + // Break a long line and reflow with the full next line. + EXPECT_EQ("// long long long\n" +"// long long", +format("// long long long long\n" + "// long", + getLLVMStyleWithColumns(20))); + + // Keep the trailing newline while reflowing. + EXPECT_EQ("// long long long\n" +"// long long\n", +format("// long long long long\n" + "// long\n", + getLLVMStyleWithColumns(20))); + + // Break a long line and reflow with a part of the next line. + EXPECT_EQ("// long long long\n" +"// long long\n" +"// long_long", +format("// long long long long\n" + "// long long_long", + getLLVMStyleWithColumns(20))); + + // Break but do not reflow if the first word from the next line is too long. + EXPECT_EQ("// long long long\n" +"// long\n" +"// long_long_long\n", +format("// long long long long\n" + "// long_long_long\n", + getLLVMStyleWithColumns(20))); + + // Don't break or reflow short lines. + verifyFormat("// long\n" + "// long long long lo\n" + "// long long long lo\n" + "// long", + getLLVMStyleWithColumns(20)); + + // Keep prefixes and decorations while reflowing. + EXPECT_EQ("/// long long long\n" +"/// long long\n", +format("/// long long long long\n" + "/// long\n", + getLLVMStyleWithColumns(20))); + EXPECT_EQ("//! long long long\n" +"//! long long\n", +format("//! long long long long\n" + "//! long\n", + getLLVMStyleWithColumns(20))); + EXPECT_EQ("/* long long long\n" +" * long long */", +format("/* long long long long\n" + " * long */", + getLLVMStyleWithColumns(20))); + + // Don't bring leading whitespace up while reflowing. + EXPECT_EQ("/* long long long\n" +" * long long long\n" +" */", +format("/* long long long long\n" + " * long long\n" + " */", + getLLVMStyleWithColumns(20))); + + // Reflow the last line of a block comment with its trailing '*/'. + EXPECT_EQ("/* long long long\n" +" long long */", +format("/* long long long long\n" + " long */", + getLLVMStyleWithColumns(20))); + + // Reflow two short lines; keep the postfix of the last one. + EXPECT_EQ("/* long long long\n" +" * long long long */", +format("/* long long long long\n" + " * long\n" + " * long */", + getLLVMStyleWithColumns(20))); + + // Put the postfix of the last short reflow line on a newline if it doesn't + // fit. + EXPECT_EQ("/* long long long\n" +" * long long longg\n" +" */", +format("/* long long long long\n" + " * long\n" +
[PATCH] D28764: [clang-format] Implement comment reflowing (v3)
krasimir added inline comments. Comment at: lib/Format/BreakableToken.h:87 /// space. virtual void replaceWhitespace(unsigned LineIndex, unsigned TailOffset, Split Split, By the way, I got confused, this stays because the new triplet of methods replaces the old replaceWhitespace**Before**; this method serves a different purpose during breaking, that is tries to shrink whitespace instead of inserting a break. https://reviews.llvm.org/D28764 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28764: [clang-format] Implement comment reflowing (v3)
klimek added inline comments. Comment at: lib/Format/BreakableToken.h:40 +/// of the content after a split has been used for breaking, and +/// - insertBreak, for executing the split using a whitespace manager. +/// Do we want to describe how replaceWhitespace fits in here, then? https://reviews.llvm.org/D28764 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
RE: [libunwind] r292722 - DWARF: allow enabling tracing at runtime
Hi Saleem, This patch is causing our internal runs of the libc++ and libc++abi tests to fail, because logDWARF is referenced but not defined in release builds (with NDEBUG defined). However, I see that all of the libc++ buildbots are passing. Does this patch need modifying to make _LIBUNWIND_TRACE_DWARF conditional on NDEBUG, or is there something in the Linux environment that we might need to replicate in our bare-metal environment to make this work? Thanks, Oliver > -Original Message- > From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of > Saleem Abdulrasool via cfe-commits > Sent: 21 January 2017 16:23 > To: cfe-commits@lists.llvm.org > Subject: [libunwind] r292722 - DWARF: allow enabling tracing at runtime > > Author: compnerd > Date: Sat Jan 21 10:22:57 2017 > New Revision: 292722 > > URL: http://llvm.org/viewvc/llvm-project?rev=292722&view=rev > Log: > DWARF: allow enabling tracing at runtime > > Introduce `logDWARF` and the associated environment variable > `LIBUNWIND_PRINT_DWARF` to trace the CFI instructions. > > Modified: > libunwind/trunk/src/DwarfParser.hpp > libunwind/trunk/src/libunwind.cpp > > Modified: libunwind/trunk/src/DwarfParser.hpp > URL: http://llvm.org/viewvc/llvm- > project/libunwind/trunk/src/DwarfParser.hpp?rev=292722&r1=292721&r2=292722 > &view=diff > == > > --- libunwind/trunk/src/DwarfParser.hpp (original) > +++ libunwind/trunk/src/DwarfParser.hpp Sat Jan 21 10:22:57 2017 > @@ -23,6 +23,14 @@ > > #include "AddressSpace.hpp" > > +extern "C" bool logDWARF(); > + > +#define _LIBUNWIND_TRACE_DWARF(...) > \ > + do { > \ > +if (logDWARF()) > \ > + fprintf(stderr, __VA_ARGS__); > \ > + } while (0) > + > namespace libunwind { > > /// CFI_Parser does basic parsing of a CFI (Call Frame Information) > records. > @@ -364,13 +372,12 @@ bool CFI_Parser::parseInstructions(A >const CIE_Info &cieInfo, pint_t > pcoffset, >PrologInfoStackEntry > *&rememberStack, >PrologInfo *results) { > - const bool logDwarf = false; >pint_t p = instructions; >pint_t codeOffset = 0; >PrologInfo initialState = *results; > - if (logDwarf) > -fprintf(stderr, "parseInstructions(instructions=0x%0" PRIx64 ")\n", > -(uint64_t)instructionsEnd); > + > + _LIBUNWIND_TRACE_DWARF("parseInstructions(instructions=0x%0" PRIx64 > ")\n", > + static_cast(instructionsEnd)); > >// see DWARF Spec, section 6.4.2 for details on unwind opcodes >while ((p < instructionsEnd) && (codeOffset < pcoffset)) { > @@ -386,35 +393,30 @@ bool CFI_Parser::parseInstructions(A > ++p; > switch (opcode) { > case DW_CFA_nop: > - if (logDwarf) > -fprintf(stderr, "DW_CFA_nop\n"); > + _LIBUNWIND_TRACE_DWARF("DW_CFA_nop\n"); >break; > case DW_CFA_set_loc: >codeOffset = >addressSpace.getEncodedP(p, instructionsEnd, > cieInfo.pointerEncoding); > - if (logDwarf) > -fprintf(stderr, "DW_CFA_set_loc\n"); > + _LIBUNWIND_TRACE_DWARF("DW_CFA_set_loc\n"); >break; > case DW_CFA_advance_loc1: >codeOffset += (addressSpace.get8(p) * cieInfo.codeAlignFactor); >p += 1; > - if (logDwarf) > -fprintf(stderr, "DW_CFA_advance_loc1: new offset=%" PRIu64 "\n", > -(uint64_t)codeOffset); > + _LIBUNWIND_TRACE_DWARF("DW_CFA_advance_loc1: new offset=%" PRIu64 > "\n", > + static_cast(codeOffset)); >break; > case DW_CFA_advance_loc2: >codeOffset += (addressSpace.get16(p) * cieInfo.codeAlignFactor); >p += 2; > - if (logDwarf) > -fprintf(stderr, "DW_CFA_advance_loc2: new offset=%" PRIu64 "\n", > -(uint64_t)codeOffset); > + _LIBUNWIND_TRACE_DWARF("DW_CFA_advance_loc2: new offset=%" PRIu64 > "\n", > + static_cast(codeOffset)); >break; > case DW_CFA_advance_loc4: >codeOffset += (addressSpace.get32(p) * cieInfo.codeAlignFactor); >p += 4; > - if (logDwarf) > -fprintf(stderr, "DW_CFA_advance_loc4: new offset=%" PRIu64 "\n", > -(uint64_t)codeOffset); > + _LIBUNWIND_TRACE_DWARF("DW_CFA_advance_loc4: new offset=%" PRIu64 > "\n", > + static_cast(codeOffset)); >break; > case DW_CFA_offset_extended: >reg = addressSpace.getULEB128(p, instructionsEnd); > @@ -426,21 +428,18 @@ bool CFI_Parser::parseInstructions(A >} >results->savedRegisters[reg].location = kRegisterInCFA; >results->savedRegisters[reg].value = offset; > - if (logDwarf) > -fprintf(stderr, > -"DW_CFA_offset_extended(reg=%" PRIu64 ", offset=%" PRId64 > ")\n", > -reg, offset); >
[PATCH] D29018: [clang-tidy] Ignore implicit functions in performance-unnecessary-value-param
malcolm.parsons created this revision. Herald added a subscriber: JDevlieghere. The performance-unnecessary-value-param check mangled inherited constructors, as the constructors' parameters do not have useful source locations. Fix this by ignoring implicit functions. Fixes PR31684. https://reviews.llvm.org/D29018 Files: clang-tidy/performance/UnnecessaryValueParamCheck.cpp test/clang-tidy/performance-unnecessary-value-param.cpp Index: test/clang-tidy/performance-unnecessary-value-param.cpp === --- test/clang-tidy/performance-unnecessary-value-param.cpp +++ test/clang-tidy/performance-unnecessary-value-param.cpp @@ -320,3 +320,20 @@ struct NegativeFinalImpl : public NegativeDependentTypeInterface { void Method(ExpensiveToCopyType E) final {} }; + +struct PositiveConstructor { + PositiveConstructor(ExpensiveToCopyType E) : E(E) {} + // CHECK-MESSAGES: [[@LINE-1]]:43: warning: the parameter 'E' is copied + // CHECK-FIXES: PositiveConstructor(const ExpensiveToCopyType& E) : E(E) {} + + ExpensiveToCopyType E; +}; + +struct NegativeUsingConstructor : public PositiveConstructor { + using PositiveConstructor::PositiveConstructor; +}; + +void fun() { + ExpensiveToCopyType E; + NegativeUsingConstructor S(E); +} Index: clang-tidy/performance/UnnecessaryValueParamCheck.cpp === --- clang-tidy/performance/UnnecessaryValueParamCheck.cpp +++ clang-tidy/performance/UnnecessaryValueParamCheck.cpp @@ -74,7 +74,7 @@ Finder->addMatcher( functionDecl(hasBody(stmt()), isDefinition(), unless(cxxMethodDecl(anyOf(isOverride(), isFinal(, - unless(isInstantiated()), + unless(anyOf(isInstantiated(), isImplicit())), has(typeLoc(forEach(ExpensiveValueParamDecl))), decl().bind("functionDecl")), this); Index: test/clang-tidy/performance-unnecessary-value-param.cpp === --- test/clang-tidy/performance-unnecessary-value-param.cpp +++ test/clang-tidy/performance-unnecessary-value-param.cpp @@ -320,3 +320,20 @@ struct NegativeFinalImpl : public NegativeDependentTypeInterface { void Method(ExpensiveToCopyType E) final {} }; + +struct PositiveConstructor { + PositiveConstructor(ExpensiveToCopyType E) : E(E) {} + // CHECK-MESSAGES: [[@LINE-1]]:43: warning: the parameter 'E' is copied + // CHECK-FIXES: PositiveConstructor(const ExpensiveToCopyType& E) : E(E) {} + + ExpensiveToCopyType E; +}; + +struct NegativeUsingConstructor : public PositiveConstructor { + using PositiveConstructor::PositiveConstructor; +}; + +void fun() { + ExpensiveToCopyType E; + NegativeUsingConstructor S(E); +} Index: clang-tidy/performance/UnnecessaryValueParamCheck.cpp === --- clang-tidy/performance/UnnecessaryValueParamCheck.cpp +++ clang-tidy/performance/UnnecessaryValueParamCheck.cpp @@ -74,7 +74,7 @@ Finder->addMatcher( functionDecl(hasBody(stmt()), isDefinition(), unless(cxxMethodDecl(anyOf(isOverride(), isFinal(, - unless(isInstantiated()), + unless(anyOf(isInstantiated(), isImplicit())), has(typeLoc(forEach(ExpensiveValueParamDecl))), decl().bind("functionDecl")), this); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26418: [clang-tidy] Add '-suppress-checks-filter' option to suppress diagnostics from certain files
nkakuev added a comment. Ping. https://reviews.llvm.org/D26418 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26466: [clang-tidy] Fix NOLINT test
nkakuev added a comment. Ping. https://reviews.llvm.org/D26466 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29018: [clang-tidy] Ignore implicit functions in performance-unnecessary-value-param
madsravn added a comment. Looks good to me. Nice touch by solving with implicit. https://reviews.llvm.org/D29018 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r292786 - [clang-tidy] Ignore implicit functions in performance-unnecessary-value-param
Author: malcolm.parsons Date: Mon Jan 23 07:18:08 2017 New Revision: 292786 URL: http://llvm.org/viewvc/llvm-project?rev=292786&view=rev Log: [clang-tidy] Ignore implicit functions in performance-unnecessary-value-param Summary: The performance-unnecessary-value-param check mangled inherited constructors, as the constructors' parameters do not have useful source locations. Fix this by ignoring implicit functions. Fixes PR31684. Reviewers: flx, alexfh, aaron.ballman Subscribers: madsravn, JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D29018 Modified: clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp Modified: clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp?rev=292786&r1=292785&r2=292786&view=diff == --- clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp Mon Jan 23 07:18:08 2017 @@ -74,7 +74,7 @@ void UnnecessaryValueParamCheck::registe Finder->addMatcher( functionDecl(hasBody(stmt()), isDefinition(), unless(cxxMethodDecl(anyOf(isOverride(), isFinal(, - unless(isInstantiated()), + unless(anyOf(isInstantiated(), isImplicit())), has(typeLoc(forEach(ExpensiveValueParamDecl))), decl().bind("functionDecl")), this); Modified: clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp?rev=292786&r1=292785&r2=292786&view=diff == --- clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp (original) +++ clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp Mon Jan 23 07:18:08 2017 @@ -331,3 +331,20 @@ template struct NegativeFinalImpl : public NegativeDependentTypeInterface { void Method(ExpensiveToCopyType E) final {} }; + +struct PositiveConstructor { + PositiveConstructor(ExpensiveToCopyType E) : E(E) {} + // CHECK-MESSAGES: [[@LINE-1]]:43: warning: the parameter 'E' is copied + // CHECK-FIXES: PositiveConstructor(const ExpensiveToCopyType& E) : E(E) {} + + ExpensiveToCopyType E; +}; + +struct NegativeUsingConstructor : public PositiveConstructor { + using PositiveConstructor::PositiveConstructor; +}; + +void fun() { + ExpensiveToCopyType E; + NegativeUsingConstructor S(E); +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29018: [clang-tidy] Ignore implicit functions in performance-unnecessary-value-param
This revision was automatically updated to reflect the committed changes. Closed by commit rL292786: [clang-tidy] Ignore implicit functions in performance-unnecessary-value-param (authored by malcolm.parsons). Changed prior to commit: https://reviews.llvm.org/D29018?vs=85358&id=85365#toc Repository: rL LLVM https://reviews.llvm.org/D29018 Files: clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp Index: clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp === --- clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp @@ -74,7 +74,7 @@ Finder->addMatcher( functionDecl(hasBody(stmt()), isDefinition(), unless(cxxMethodDecl(anyOf(isOverride(), isFinal(, - unless(isInstantiated()), + unless(anyOf(isInstantiated(), isImplicit())), has(typeLoc(forEach(ExpensiveValueParamDecl))), decl().bind("functionDecl")), this); Index: clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp === --- clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp +++ clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp @@ -331,3 +331,20 @@ struct NegativeFinalImpl : public NegativeDependentTypeInterface { void Method(ExpensiveToCopyType E) final {} }; + +struct PositiveConstructor { + PositiveConstructor(ExpensiveToCopyType E) : E(E) {} + // CHECK-MESSAGES: [[@LINE-1]]:43: warning: the parameter 'E' is copied + // CHECK-FIXES: PositiveConstructor(const ExpensiveToCopyType& E) : E(E) {} + + ExpensiveToCopyType E; +}; + +struct NegativeUsingConstructor : public PositiveConstructor { + using PositiveConstructor::PositiveConstructor; +}; + +void fun() { + ExpensiveToCopyType E; + NegativeUsingConstructor S(E); +} Index: clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp === --- clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp @@ -74,7 +74,7 @@ Finder->addMatcher( functionDecl(hasBody(stmt()), isDefinition(), unless(cxxMethodDecl(anyOf(isOverride(), isFinal(, - unless(isInstantiated()), + unless(anyOf(isInstantiated(), isImplicit())), has(typeLoc(forEach(ExpensiveValueParamDecl))), decl().bind("functionDecl")), this); Index: clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp === --- clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp +++ clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp @@ -331,3 +331,20 @@ struct NegativeFinalImpl : public NegativeDependentTypeInterface { void Method(ExpensiveToCopyType E) final {} }; + +struct PositiveConstructor { + PositiveConstructor(ExpensiveToCopyType E) : E(E) {} + // CHECK-MESSAGES: [[@LINE-1]]:43: warning: the parameter 'E' is copied + // CHECK-FIXES: PositiveConstructor(const ExpensiveToCopyType& E) : E(E) {} + + ExpensiveToCopyType E; +}; + +struct NegativeUsingConstructor : public PositiveConstructor { + using PositiveConstructor::PositiveConstructor; +}; + +void fun() { + ExpensiveToCopyType E; + NegativeUsingConstructor S(E); +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28983: clang-format: remove tests that assume no config file will be found as this is not always the case
This revision was automatically updated to reflect the committed changes. Closed by commit rL292787: clang-format: remove tests that assume no config file will be found as this is… (authored by amaiorano). Changed prior to commit: https://reviews.llvm.org/D28983?vs=85247&id=85366#toc Repository: rL LLVM https://reviews.llvm.org/D28983 Files: cfe/trunk/test/Format/style-on-command-line.cpp Index: cfe/trunk/test/Format/style-on-command-line.cpp === --- cfe/trunk/test/Format/style-on-command-line.cpp +++ cfe/trunk/test/Format/style-on-command-line.cpp @@ -13,16 +13,11 @@ // RUN: clang-format -style="{BasedOnStyle: WebKit, PointerBindsToType: false}" %s | FileCheck -strict-whitespace -check-prefix=CHECK9 %s // Fallback style tests -// RUN: rm %T/_clang-format -// Test no config file found, WebKit fallback style is applied -// RUN: clang-format -style=file -fallback-style=WebKit -assume-filename=%T/foo.cpp < %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK10 %s -// Test no config file and fallback style "none", no formatting is applied -// RUN: clang-format -style=file -fallback-style=none -assume-filename=%T/foo.cpp < %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK11 %s // Test config file with no based style, and fallback style "none", formatting is applied // RUN: printf "IndentWidth: 6\n" > %T/_clang-format -// RUN: clang-format -style=file -fallback-style=none -assume-filename=%T/foo.cpp < %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK12 %s +// RUN: clang-format -style=file -fallback-style=none -assume-filename=%T/foo.cpp < %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK10 %s // Test yaml with no based style, and fallback style "none", LLVM formatting applied -// RUN: clang-format -style="{IndentWidth: 7}" -fallback-style=none %s | FileCheck -strict-whitespace -check-prefix=CHECK13 %s +// RUN: clang-format -style="{IndentWidth: 7}" -fallback-style=none %s | FileCheck -strict-whitespace -check-prefix=CHECK11 %s void f() { // CHECK1: {{^int\* i;$}} @@ -35,10 +30,8 @@ // CHECK7: {{^ int\* i;$}} // CHECK8: {{^ int\* i;$}} // CHECK9: {{^int \*i;$}} -// CHECK10: {{^int\* i;$}} -// CHECK11: {{^int\*i;$}} -// CHECK12: {{^ int \*i;$}} -// CHECK13: {{^ int \*i;$}} +// CHECK10: {{^ int \*i;$}} +// CHECK11: {{^ int \*i;$}} int*i; int j; } Index: cfe/trunk/test/Format/style-on-command-line.cpp === --- cfe/trunk/test/Format/style-on-command-line.cpp +++ cfe/trunk/test/Format/style-on-command-line.cpp @@ -13,16 +13,11 @@ // RUN: clang-format -style="{BasedOnStyle: WebKit, PointerBindsToType: false}" %s | FileCheck -strict-whitespace -check-prefix=CHECK9 %s // Fallback style tests -// RUN: rm %T/_clang-format -// Test no config file found, WebKit fallback style is applied -// RUN: clang-format -style=file -fallback-style=WebKit -assume-filename=%T/foo.cpp < %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK10 %s -// Test no config file and fallback style "none", no formatting is applied -// RUN: clang-format -style=file -fallback-style=none -assume-filename=%T/foo.cpp < %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK11 %s // Test config file with no based style, and fallback style "none", formatting is applied // RUN: printf "IndentWidth: 6\n" > %T/_clang-format -// RUN: clang-format -style=file -fallback-style=none -assume-filename=%T/foo.cpp < %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK12 %s +// RUN: clang-format -style=file -fallback-style=none -assume-filename=%T/foo.cpp < %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK10 %s // Test yaml with no based style, and fallback style "none", LLVM formatting applied -// RUN: clang-format -style="{IndentWidth: 7}" -fallback-style=none %s | FileCheck -strict-whitespace -check-prefix=CHECK13 %s +// RUN: clang-format -style="{IndentWidth: 7}" -fallback-style=none %s | FileCheck -strict-whitespace -check-prefix=CHECK11 %s void f() { // CHECK1: {{^int\* i;$}} @@ -35,10 +30,8 @@ // CHECK7: {{^ int\* i;$}} // CHECK8: {{^ int\* i;$}} // CHECK9: {{^int \*i;$}} -// CHECK10: {{^int\* i;$}} -// CHECK11: {{^int\*i;$}} -// CHECK12: {{^ int \*i;$}} -// CHECK13: {{^ int \*i;$}} +// CHECK10: {{^ int \*i;$}} +// CHECK11: {{^ int \*i;$}} int*i; int j; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r292787 - clang-format: remove tests that assume no config file will be found as this is not always the case
Author: amaiorano Date: Mon Jan 23 07:20:23 2017 New Revision: 292787 URL: http://llvm.org/viewvc/llvm-project?rev=292787&view=rev Log: clang-format: remove tests that assume no config file will be found as this is not always the case These tests fail for developers who place their build directories under the llvm root directory because llvm's own .clang-format file will be found. Anyway these cases are covered by FormatStyle.GetStyleOfFile tests (FormatTest.cpp). Differential Revision: https://reviews.llvm.org/D28983 Modified: cfe/trunk/test/Format/style-on-command-line.cpp Modified: cfe/trunk/test/Format/style-on-command-line.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/style-on-command-line.cpp?rev=292787&r1=292786&r2=292787&view=diff == --- cfe/trunk/test/Format/style-on-command-line.cpp (original) +++ cfe/trunk/test/Format/style-on-command-line.cpp Mon Jan 23 07:20:23 2017 @@ -13,16 +13,11 @@ // RUN: clang-format -style="{BasedOnStyle: WebKit, PointerBindsToType: false}" %s | FileCheck -strict-whitespace -check-prefix=CHECK9 %s // Fallback style tests -// RUN: rm %T/_clang-format -// Test no config file found, WebKit fallback style is applied -// RUN: clang-format -style=file -fallback-style=WebKit -assume-filename=%T/foo.cpp < %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK10 %s -// Test no config file and fallback style "none", no formatting is applied -// RUN: clang-format -style=file -fallback-style=none -assume-filename=%T/foo.cpp < %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK11 %s // Test config file with no based style, and fallback style "none", formatting is applied // RUN: printf "IndentWidth: 6\n" > %T/_clang-format -// RUN: clang-format -style=file -fallback-style=none -assume-filename=%T/foo.cpp < %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK12 %s +// RUN: clang-format -style=file -fallback-style=none -assume-filename=%T/foo.cpp < %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK10 %s // Test yaml with no based style, and fallback style "none", LLVM formatting applied -// RUN: clang-format -style="{IndentWidth: 7}" -fallback-style=none %s | FileCheck -strict-whitespace -check-prefix=CHECK13 %s +// RUN: clang-format -style="{IndentWidth: 7}" -fallback-style=none %s | FileCheck -strict-whitespace -check-prefix=CHECK11 %s void f() { // CHECK1: {{^int\* i;$}} @@ -35,10 +30,8 @@ void f() { // CHECK7: {{^ int\* i;$}} // CHECK8: {{^ int\* i;$}} // CHECK9: {{^int \*i;$}} -// CHECK10: {{^int\* i;$}} -// CHECK11: {{^int\*i;$}} -// CHECK12: {{^ int \*i;$}} -// CHECK13: {{^ int \*i;$}} +// CHECK10: {{^ int \*i;$}} +// CHECK11: {{^ int \*i;$}} int*i; int j; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29025: Revert "IRGen: Start using the WriteThinLTOBitcode pass."
mboehme created this revision. Herald added subscribers: mgorny, mehdi_amini. This reverts commit r292662. This change broke internal builds. Will provide a reproducer internally. https://reviews.llvm.org/D29025 Files: lib/CodeGen/BackendUtil.cpp test/CMakeLists.txt test/CodeGenCXX/type-metadata-thinlto.cpp Index: test/CodeGenCXX/type-metadata-thinlto.cpp === --- test/CodeGenCXX/type-metadata-thinlto.cpp +++ /dev/null @@ -1,11 +0,0 @@ -// RUN: %clang_cc1 -flto=thin -flto-unit -triple x86_64-unknown-linux -fvisibility hidden -emit-llvm-bc -o %t %s -// RUN: llvm-modextract -o - -n 1 %t | llvm-dis | FileCheck %s - -// CHECK: @_ZTV1A = linkonce_odr -class A { - virtual void f() {} -}; - -A *f() { - return new A; -} Index: test/CMakeLists.txt === --- test/CMakeLists.txt +++ test/CMakeLists.txt @@ -80,7 +80,6 @@ llc llvm-bcanalyzer llvm-dis -llvm-modextract llvm-nm llvm-objdump llvm-profdata Index: lib/CodeGen/BackendUtil.cpp === --- lib/CodeGen/BackendUtil.cpp +++ lib/CodeGen/BackendUtil.cpp @@ -689,11 +689,9 @@ break; case Backend_EmitBC: -if (CodeGenOpts.EmitSummaryIndex) - PerModulePasses.add(createWriteThinLTOBitcodePass(*OS)); -else - PerModulePasses.add( - createBitcodeWriterPass(*OS, CodeGenOpts.EmitLLVMUseLists)); +PerModulePasses.add(createBitcodeWriterPass( +*OS, CodeGenOpts.EmitLLVMUseLists, CodeGenOpts.EmitSummaryIndex, +CodeGenOpts.EmitSummaryIndex)); break; case Backend_EmitLL: Index: test/CodeGenCXX/type-metadata-thinlto.cpp === --- test/CodeGenCXX/type-metadata-thinlto.cpp +++ /dev/null @@ -1,11 +0,0 @@ -// RUN: %clang_cc1 -flto=thin -flto-unit -triple x86_64-unknown-linux -fvisibility hidden -emit-llvm-bc -o %t %s -// RUN: llvm-modextract -o - -n 1 %t | llvm-dis | FileCheck %s - -// CHECK: @_ZTV1A = linkonce_odr -class A { - virtual void f() {} -}; - -A *f() { - return new A; -} Index: test/CMakeLists.txt === --- test/CMakeLists.txt +++ test/CMakeLists.txt @@ -80,7 +80,6 @@ llc llvm-bcanalyzer llvm-dis -llvm-modextract llvm-nm llvm-objdump llvm-profdata Index: lib/CodeGen/BackendUtil.cpp === --- lib/CodeGen/BackendUtil.cpp +++ lib/CodeGen/BackendUtil.cpp @@ -689,11 +689,9 @@ break; case Backend_EmitBC: -if (CodeGenOpts.EmitSummaryIndex) - PerModulePasses.add(createWriteThinLTOBitcodePass(*OS)); -else - PerModulePasses.add( - createBitcodeWriterPass(*OS, CodeGenOpts.EmitLLVMUseLists)); +PerModulePasses.add(createBitcodeWriterPass( +*OS, CodeGenOpts.EmitLLVMUseLists, CodeGenOpts.EmitSummaryIndex, +CodeGenOpts.EmitSummaryIndex)); break; case Backend_EmitLL: ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28764: [clang-format] Implement comment reflowing (v3)
krasimir updated this revision to Diff 85376. krasimir added a comment. - Add a note about replaceWhitespace in the comments of BreakableToken. https://reviews.llvm.org/D28764 Files: lib/Format/BreakableToken.cpp lib/Format/BreakableToken.h lib/Format/CMakeLists.txt lib/Format/Comments.cpp lib/Format/Comments.h lib/Format/ContinuationIndenter.cpp lib/Format/TokenAnnotator.cpp lib/Format/UnwrappedLineParser.cpp lib/Format/WhitespaceManager.cpp unittests/Format/FormatTest.cpp unittests/Format/FormatTestSelective.cpp Index: unittests/Format/FormatTestSelective.cpp === --- unittests/Format/FormatTestSelective.cpp +++ unittests/Format/FormatTestSelective.cpp @@ -111,13 +111,19 @@ format("int a; // comment\n" "intb; // comment", 0, 0)); - EXPECT_EQ("int a; // comment\n" -" // line 2\n" + EXPECT_EQ("int a; // comment\n" +" // line 2\n" "int b;", format("int a; // comment\n" "// line 2\n" "int b;", 28, 0)); + EXPECT_EQ("int a; // comment\n" +"// comment 2\n" +"int b;", +format("int a; // comment\n" + "// comment 2\n" + "int b;", 28, 0)); EXPECT_EQ("int aa; // comment\n" "int b;\n" "int c; // unrelated comment", Index: unittests/Format/FormatTest.cpp === --- unittests/Format/FormatTest.cpp +++ unittests/Format/FormatTest.cpp @@ -1783,6 +1783,455 @@ "0x00, 0x00, 0x00, 0x00};// comment\n"); } +TEST_F(FormatTest, ReflowsComments) { + // Break a long line and reflow with the full next line. + EXPECT_EQ("// long long long\n" +"// long long", +format("// long long long long\n" + "// long", + getLLVMStyleWithColumns(20))); + + // Keep the trailing newline while reflowing. + EXPECT_EQ("// long long long\n" +"// long long\n", +format("// long long long long\n" + "// long\n", + getLLVMStyleWithColumns(20))); + + // Break a long line and reflow with a part of the next line. + EXPECT_EQ("// long long long\n" +"// long long\n" +"// long_long", +format("// long long long long\n" + "// long long_long", + getLLVMStyleWithColumns(20))); + + // Break but do not reflow if the first word from the next line is too long. + EXPECT_EQ("// long long long\n" +"// long\n" +"// long_long_long\n", +format("// long long long long\n" + "// long_long_long\n", + getLLVMStyleWithColumns(20))); + + // Don't break or reflow short lines. + verifyFormat("// long\n" + "// long long long lo\n" + "// long long long lo\n" + "// long", + getLLVMStyleWithColumns(20)); + + // Keep prefixes and decorations while reflowing. + EXPECT_EQ("/// long long long\n" +"/// long long\n", +format("/// long long long long\n" + "/// long\n", + getLLVMStyleWithColumns(20))); + EXPECT_EQ("//! long long long\n" +"//! long long\n", +format("//! long long long long\n" + "//! long\n", + getLLVMStyleWithColumns(20))); + EXPECT_EQ("/* long long long\n" +" * long long */", +format("/* long long long long\n" + " * long */", + getLLVMStyleWithColumns(20))); + + // Don't bring leading whitespace up while reflowing. + EXPECT_EQ("/* long long long\n" +" * long long long\n" +" */", +format("/* long long long long\n" + " * long long\n" + " */", + getLLVMStyleWithColumns(20))); + + // Reflow the last line of a block comment with its trailing '*/'. + EXPECT_EQ("/* long long long\n" +" long long */", +format("/* long long long long\n" + " long */", + getLLVMStyleWithColumns(20))); + + // Reflow two short lines; keep the postfix of the last one. + EXPECT_EQ("/* long long long\n" +" * long long long */", +format("/* long long long long\n" + " * long\n" + " * long */", + getLLVMStyleWithColumns(20))); + + // Put the postfix of the last short reflow line on a newline if it doesn't + // fit. + EXPECT_EQ("/* long long long\n" +" * long long longg\n" +" */", +format("/* long long long long\n" + " * long\n" +
r292791 - Revert "IRGen: Start using the WriteThinLTOBitcode pass."
Author: mboehme Date: Mon Jan 23 08:33:42 2017 New Revision: 292791 URL: http://llvm.org/viewvc/llvm-project?rev=292791&view=rev Log: Revert "IRGen: Start using the WriteThinLTOBitcode pass." Summary: This reverts commit r292662. This change broke internal builds. Will provide a reproducer internally. Subscribers: pcc, mehdi_amini, cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D29025 Removed: cfe/trunk/test/CodeGenCXX/type-metadata-thinlto.cpp Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp cfe/trunk/test/CMakeLists.txt Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=292791&r1=292790&r2=292791&view=diff == --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original) +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Mon Jan 23 08:33:42 2017 @@ -689,11 +689,9 @@ void EmitAssemblyHelper::EmitAssembly(Ba break; case Backend_EmitBC: -if (CodeGenOpts.EmitSummaryIndex) - PerModulePasses.add(createWriteThinLTOBitcodePass(*OS)); -else - PerModulePasses.add( - createBitcodeWriterPass(*OS, CodeGenOpts.EmitLLVMUseLists)); +PerModulePasses.add(createBitcodeWriterPass( +*OS, CodeGenOpts.EmitLLVMUseLists, CodeGenOpts.EmitSummaryIndex, +CodeGenOpts.EmitSummaryIndex)); break; case Backend_EmitLL: Modified: cfe/trunk/test/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CMakeLists.txt?rev=292791&r1=292790&r2=292791&view=diff == --- cfe/trunk/test/CMakeLists.txt (original) +++ cfe/trunk/test/CMakeLists.txt Mon Jan 23 08:33:42 2017 @@ -80,7 +80,6 @@ if( NOT CLANG_BUILT_STANDALONE ) llc llvm-bcanalyzer llvm-dis -llvm-modextract llvm-nm llvm-objdump llvm-profdata Removed: cfe/trunk/test/CodeGenCXX/type-metadata-thinlto.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/type-metadata-thinlto.cpp?rev=292790&view=auto == --- cfe/trunk/test/CodeGenCXX/type-metadata-thinlto.cpp (original) +++ cfe/trunk/test/CodeGenCXX/type-metadata-thinlto.cpp (removed) @@ -1,11 +0,0 @@ -// RUN: %clang_cc1 -flto=thin -flto-unit -triple x86_64-unknown-linux -fvisibility hidden -emit-llvm-bc -o %t %s -// RUN: llvm-modextract -o - -n 1 %t | llvm-dis | FileCheck %s - -// CHECK: @_ZTV1A = linkonce_odr -class A { - virtual void f() {} -}; - -A *f() { - return new A; -} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29025: Revert "IRGen: Start using the WriteThinLTOBitcode pass."
This revision was automatically updated to reflect the committed changes. Closed by commit rL292791: Revert "IRGen: Start using the WriteThinLTOBitcode pass." (authored by mboehme). Changed prior to commit: https://reviews.llvm.org/D29025?vs=85375&id=85379#toc Repository: rL LLVM https://reviews.llvm.org/D29025 Files: cfe/trunk/lib/CodeGen/BackendUtil.cpp cfe/trunk/test/CMakeLists.txt cfe/trunk/test/CodeGenCXX/type-metadata-thinlto.cpp Index: cfe/trunk/lib/CodeGen/BackendUtil.cpp === --- cfe/trunk/lib/CodeGen/BackendUtil.cpp +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp @@ -689,11 +689,9 @@ break; case Backend_EmitBC: -if (CodeGenOpts.EmitSummaryIndex) - PerModulePasses.add(createWriteThinLTOBitcodePass(*OS)); -else - PerModulePasses.add( - createBitcodeWriterPass(*OS, CodeGenOpts.EmitLLVMUseLists)); +PerModulePasses.add(createBitcodeWriterPass( +*OS, CodeGenOpts.EmitLLVMUseLists, CodeGenOpts.EmitSummaryIndex, +CodeGenOpts.EmitSummaryIndex)); break; case Backend_EmitLL: Index: cfe/trunk/test/CodeGenCXX/type-metadata-thinlto.cpp === --- cfe/trunk/test/CodeGenCXX/type-metadata-thinlto.cpp +++ cfe/trunk/test/CodeGenCXX/type-metadata-thinlto.cpp @@ -1,11 +0,0 @@ -// RUN: %clang_cc1 -flto=thin -flto-unit -triple x86_64-unknown-linux -fvisibility hidden -emit-llvm-bc -o %t %s -// RUN: llvm-modextract -o - -n 1 %t | llvm-dis | FileCheck %s - -// CHECK: @_ZTV1A = linkonce_odr -class A { - virtual void f() {} -}; - -A *f() { - return new A; -} Index: cfe/trunk/test/CMakeLists.txt === --- cfe/trunk/test/CMakeLists.txt +++ cfe/trunk/test/CMakeLists.txt @@ -80,7 +80,6 @@ llc llvm-bcanalyzer llvm-dis -llvm-modextract llvm-nm llvm-objdump llvm-profdata Index: cfe/trunk/lib/CodeGen/BackendUtil.cpp === --- cfe/trunk/lib/CodeGen/BackendUtil.cpp +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp @@ -689,11 +689,9 @@ break; case Backend_EmitBC: -if (CodeGenOpts.EmitSummaryIndex) - PerModulePasses.add(createWriteThinLTOBitcodePass(*OS)); -else - PerModulePasses.add( - createBitcodeWriterPass(*OS, CodeGenOpts.EmitLLVMUseLists)); +PerModulePasses.add(createBitcodeWriterPass( +*OS, CodeGenOpts.EmitLLVMUseLists, CodeGenOpts.EmitSummaryIndex, +CodeGenOpts.EmitSummaryIndex)); break; case Backend_EmitLL: Index: cfe/trunk/test/CodeGenCXX/type-metadata-thinlto.cpp === --- cfe/trunk/test/CodeGenCXX/type-metadata-thinlto.cpp +++ cfe/trunk/test/CodeGenCXX/type-metadata-thinlto.cpp @@ -1,11 +0,0 @@ -// RUN: %clang_cc1 -flto=thin -flto-unit -triple x86_64-unknown-linux -fvisibility hidden -emit-llvm-bc -o %t %s -// RUN: llvm-modextract -o - -n 1 %t | llvm-dis | FileCheck %s - -// CHECK: @_ZTV1A = linkonce_odr -class A { - virtual void f() {} -}; - -A *f() { - return new A; -} Index: cfe/trunk/test/CMakeLists.txt === --- cfe/trunk/test/CMakeLists.txt +++ cfe/trunk/test/CMakeLists.txt @@ -80,7 +80,6 @@ llc llvm-bcanalyzer llvm-dis -llvm-modextract llvm-nm llvm-objdump llvm-profdata ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r292276 - Fix std::string assignment ambiguity from braced initializer lists.
> On 17 Jan 2017, at 23:10, Eric Fiselier via cfe-commits > wrote: > > Author: ericwf > Date: Tue Jan 17 16:10:32 2017 > New Revision: 292276 > > URL: http://llvm.org/viewvc/llvm-project?rev=292276&view=rev > Log: > Fix std::string assignment ambiguity from braced initializer lists. > > When support for `basic_string_view` was added to string it also > added new assignment operators from `basic_string_view`. These caused > ambiguity when assigning from a braced initializer. This patch fixes > that regression by making the basic_string_view assignment operator > rank lower in overload resolution by making it a template. > > Added: > > libcxx/trunk/test/std/strings/basic.string/string.cons/brace_assignment.pass.cpp > Modified: >libcxx/trunk/include/string >libcxx/trunk/test/std/strings/basic.string/string.cons/string_view.pass.cpp > > Modified: libcxx/trunk/include/string > URL: > http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=292276&r1=292275&r2=292276&view=diff > == > --- libcxx/trunk/include/string (original) > +++ libcxx/trunk/include/string Tue Jan 17 16:10:32 2017 > @@ -818,6 +818,7 @@ public: > operator __self_view() const _NOEXCEPT { return __self_view(data(), > size()); } > > basic_string& operator=(const basic_string& __str); > +template > _LIBCPP_INLINE_VISIBILITY > basic_string& operator=(__self_view __sv) {return assign(__sv);} > #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES Hi Eric, This fix has one side effect that shows up in https://bugs.freebsd.org/216404 now: gcc has until recently defaulted to -std=gnu++98, and this makes it complain about the default template argument: In file included from /usr/include/c++/v1/__locale:15:0, from /usr/include/c++/v1/ios:216, from /usr/include/c++/v1/iostream:38, from a.cc:1: /usr/include/c++/v1/string:823:45: error: default template arguments may not be used in function templates without -std=c++11 or -std=gnu++11 basic_string& operator=(__self_view __sv) {return assign(__sv);} ^ Maybe the defaulted template argument can be surrounded with _LIBCPP_CXX03_LANG? -Dimitry signature.asc Description: Message signed with OpenPGP using GPGMail ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28764: [clang-format] Implement comment reflowing (v3)
krasimir updated this revision to Diff 85381. krasimir added a comment. - Add back a test case that I had previously removed for no good reason. https://reviews.llvm.org/D28764 Files: lib/Format/BreakableToken.cpp lib/Format/BreakableToken.h lib/Format/CMakeLists.txt lib/Format/Comments.cpp lib/Format/Comments.h lib/Format/ContinuationIndenter.cpp lib/Format/TokenAnnotator.cpp lib/Format/UnwrappedLineParser.cpp lib/Format/WhitespaceManager.cpp unittests/Format/FormatTest.cpp unittests/Format/FormatTestSelective.cpp Index: unittests/Format/FormatTestSelective.cpp === --- unittests/Format/FormatTestSelective.cpp +++ unittests/Format/FormatTestSelective.cpp @@ -111,13 +111,19 @@ format("int a; // comment\n" "intb; // comment", 0, 0)); - EXPECT_EQ("int a; // comment\n" -" // line 2\n" + EXPECT_EQ("int a; // comment\n" +" // line 2\n" "int b;", format("int a; // comment\n" "// line 2\n" "int b;", 28, 0)); + EXPECT_EQ("int a; // comment\n" +"// comment 2\n" +"int b;", +format("int a; // comment\n" + "// comment 2\n" + "int b;", 28, 0)); EXPECT_EQ("int aa; // comment\n" "int b;\n" "int c; // unrelated comment", Index: unittests/Format/FormatTest.cpp === --- unittests/Format/FormatTest.cpp +++ unittests/Format/FormatTest.cpp @@ -1783,6 +1783,455 @@ "0x00, 0x00, 0x00, 0x00};// comment\n"); } +TEST_F(FormatTest, ReflowsComments) { + // Break a long line and reflow with the full next line. + EXPECT_EQ("// long long long\n" +"// long long", +format("// long long long long\n" + "// long", + getLLVMStyleWithColumns(20))); + + // Keep the trailing newline while reflowing. + EXPECT_EQ("// long long long\n" +"// long long\n", +format("// long long long long\n" + "// long\n", + getLLVMStyleWithColumns(20))); + + // Break a long line and reflow with a part of the next line. + EXPECT_EQ("// long long long\n" +"// long long\n" +"// long_long", +format("// long long long long\n" + "// long long_long", + getLLVMStyleWithColumns(20))); + + // Break but do not reflow if the first word from the next line is too long. + EXPECT_EQ("// long long long\n" +"// long\n" +"// long_long_long\n", +format("// long long long long\n" + "// long_long_long\n", + getLLVMStyleWithColumns(20))); + + // Don't break or reflow short lines. + verifyFormat("// long\n" + "// long long long lo\n" + "// long long long lo\n" + "// long", + getLLVMStyleWithColumns(20)); + + // Keep prefixes and decorations while reflowing. + EXPECT_EQ("/// long long long\n" +"/// long long\n", +format("/// long long long long\n" + "/// long\n", + getLLVMStyleWithColumns(20))); + EXPECT_EQ("//! long long long\n" +"//! long long\n", +format("//! long long long long\n" + "//! long\n", + getLLVMStyleWithColumns(20))); + EXPECT_EQ("/* long long long\n" +" * long long */", +format("/* long long long long\n" + " * long */", + getLLVMStyleWithColumns(20))); + + // Don't bring leading whitespace up while reflowing. + EXPECT_EQ("/* long long long\n" +" * long long long\n" +" */", +format("/* long long long long\n" + " * long long\n" + " */", + getLLVMStyleWithColumns(20))); + + // Reflow the last line of a block comment with its trailing '*/'. + EXPECT_EQ("/* long long long\n" +" long long */", +format("/* long long long long\n" + " long */", + getLLVMStyleWithColumns(20))); + + // Reflow two short lines; keep the postfix of the last one. + EXPECT_EQ("/* long long long\n" +" * long long long */", +format("/* long long long long\n" + " * long\n" + " * long */", + getLLVMStyleWithColumns(20))); + + // Put the postfix of the last short reflow line on a newline if it doesn't + // fit. + EXPECT_EQ("/* long long long\n" +" * long long longg\n" +" */", +format("/* long long long long\n" + " * long\n" +
[PATCH] D29026: [OpenMP] DSAChecker bug fix for combined directives.
arpith-jacob created this revision. The DSAChecker code in SemaOpenMP looks at the captured statement associated with an OpenMP directive. A combined directive such as 'target parallel' has nested capture statements, which have to be fully traversed before executing the DSAChecker. This is a patch to perform the traversal for such combined directives. https://reviews.llvm.org/D29026 Files: lib/Sema/SemaOpenMP.cpp test/OpenMP/target_parallel_default_messages.cpp Index: test/OpenMP/target_parallel_default_messages.cpp === --- test/OpenMP/target_parallel_default_messages.cpp +++ test/OpenMP/target_parallel_default_messages.cpp @@ -23,5 +23,8 @@ foo(); #pragma omp target parallel default(shared) ++argc; + #pragma omp target parallel default(none) + #pragma omp parallel default(shared) + ++argc; return 0; } Index: lib/Sema/SemaOpenMP.cpp === --- lib/Sema/SemaOpenMP.cpp +++ lib/Sema/SemaOpenMP.cpp @@ -2268,7 +2268,11 @@ // Check default data sharing attributes for referenced variables. DSAAttrChecker DSAChecker(DSAStack, *this, cast(AStmt)); -DSAChecker.Visit(cast(AStmt)->getCapturedStmt()); +int ThisCaptureLevel = getOpenMPCaptureLevels(Kind); +Stmt *S = AStmt; +while (--ThisCaptureLevel >= 0) + S = cast(S)->getCapturedStmt(); +DSAChecker.Visit(S); if (DSAChecker.isErrorFound()) return StmtError(); // Generate list of implicitly defined firstprivate variables. Index: test/OpenMP/target_parallel_default_messages.cpp === --- test/OpenMP/target_parallel_default_messages.cpp +++ test/OpenMP/target_parallel_default_messages.cpp @@ -23,5 +23,8 @@ foo(); #pragma omp target parallel default(shared) ++argc; + #pragma omp target parallel default(none) + #pragma omp parallel default(shared) + ++argc; return 0; } Index: lib/Sema/SemaOpenMP.cpp === --- lib/Sema/SemaOpenMP.cpp +++ lib/Sema/SemaOpenMP.cpp @@ -2268,7 +2268,11 @@ // Check default data sharing attributes for referenced variables. DSAAttrChecker DSAChecker(DSAStack, *this, cast(AStmt)); -DSAChecker.Visit(cast(AStmt)->getCapturedStmt()); +int ThisCaptureLevel = getOpenMPCaptureLevels(Kind); +Stmt *S = AStmt; +while (--ThisCaptureLevel >= 0) + S = cast(S)->getCapturedStmt(); +DSAChecker.Visit(S); if (DSAChecker.isErrorFound()) return StmtError(); // Generate list of implicitly defined firstprivate variables. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29027: [Stack Protection] Add remark for reasons why Stack Protection has been applied
jhenderson created this revision. Herald added a subscriber: fhahn. Depends on https://reviews.llvm.org/D29023, which is currently under review. In that change, I am adding diagnostic information to LLVM for why Stack Smash Protection has been applied to each function. This is the second stage, namely adding a new remark to clang, which is emitted when enabled via "-Rssp-reason". https://reviews.llvm.org/D29027 Files: include/clang/Basic/DiagnosticFrontendKinds.td include/clang/Basic/DiagnosticGroups.td lib/CodeGen/CodeGenAction.cpp test/CodeGen/stack-protector-remarks.c Index: test/CodeGen/stack-protector-remarks.c === --- test/CodeGen/stack-protector-remarks.c +++ test/CodeGen/stack-protector-remarks.c @@ -0,0 +1,60 @@ +// RUN: %clang_cc1 -emit-obj %s -Rssp-reason -stack-protector 2 -o /dev/null 2>&1 | FileCheck %s -check-prefix=CHECK1 +// CHECK1-NOT: no_ssp +// CHECK1: call to alloca +// CHECK1-NEXT: alloca_ssp() +// CHECK1: stack allocated buffer or struct +// CHECK1-NEXT: buffer_ssp() +// CHECK1: stack allocated buffer or struct +// CHECK1-NEXT: struct_ssp() +// CHECK1: address of a local variable +// CHECK1-NEXT: address_ssp() +// CHECK1: stack allocated buffer or struct +// CHECK1-NEXT: multiple_ssp +// CHECK1: stack allocated buffer or struct +// CHECK1: address of a local variable +// CHECK1: call to alloca + +// RUN: %clang_cc1 -emit-obj %s -Rssp-reason -stack-protector 3 -o /dev/null 2>&1 | FileCheck %s -check-prefix=CHECK2 +// CHECK2: function attribute or use of -fstack-protector-all +// CHECK2-NEXT: no_ssp +// CHECK2: function attribute or use of -fstack-protector-all +// CHECK2-NEXT: alloca_ssp() +// CHECK2: function attribute or use of -fstack-protector-all +// CHECK2-NEXT: buffer_ssp() +// CHECK2: function attribute or use of -fstack-protector-all +// CHECK2-NEXT: struct_ssp() +// CHECK2: function attribute or use of -fstack-protector-all +// CHECK2-NEXT: address_ssp() +// CHECK2: function attribute or use of -fstack-protector-all +// CHECK2-NEXT: multiple_ssp + +void no_ssp() { +} + +void alloca_ssp() { + __builtin_alloca(2); +} + +void buffer_ssp() { + int x[64]; +} + +struct X { + int x[64]; +}; +void struct_ssp() { + struct X x; +} + +void address_ssp() { + int x = 32; + int * y = &x; +} + +void multiple_ssp() { + struct X x; + int y[64]; + __builtin_alloca(2); + int a = 32; + int * b = &a; +} Index: lib/CodeGen/CodeGenAction.cpp === --- lib/CodeGen/CodeGenAction.cpp +++ lib/CodeGen/CodeGenAction.cpp @@ -307,6 +307,9 @@ const llvm::OptimizationRemarkAnalysisAliasing &D); void OptimizationFailureHandler( const llvm::DiagnosticInfoOptimizationFailure &D); + +/// \brief Specialized handler for Stack Protector remark diagnostics. +void SSPRemarkHandler(const DiagnosticInfoSSP &D); }; void BackendConsumer::anchor() {} @@ -631,6 +634,15 @@ EmitOptimizationMessage(D, diag::warn_fe_backend_optimization_failure); } +void BackendConsumer::SSPRemarkHandler(const DiagnosticInfoSSP &D) { + StringRef Filename; + unsigned Line, Column; + bool BadDebugInfo = false; + FullSourceLoc Loc = getBestLocationFromDebugLoc(D, BadDebugInfo, Filename, + Line, Column); + Diags.Report(Loc, diag::remark_ssp_applied_reason) << D.Reason(); +} + /// \brief This function is invoked when the backend needs /// to report something to the user. void BackendConsumer::DiagnosticHandlerImpl(const DiagnosticInfo &DI) { @@ -688,6 +700,9 @@ case llvm::DK_Unsupported: UnsupportedDiagHandler(cast(DI)); return; + case llvm::DK_SSPReason: +SSPRemarkHandler(cast(DI)); +return; default: // Plugin IDs are not bound to any value as they are set dynamically. ComputeDiagRemarkID(Severity, backend_plugin, DiagID); Index: include/clang/Basic/DiagnosticGroups.td === --- include/clang/Basic/DiagnosticGroups.td +++ include/clang/Basic/DiagnosticGroups.td @@ -905,3 +905,7 @@ // A warning group for warnings about code that clang accepts when // compiling OpenCL C/C++ but which is not compatible with the SPIR spec. def SpirCompat : DiagGroup<"spir-compat">; + +// A remark group for remarks about why stack protection was applied to a +// function. +def SSPReason : DiagGroup<"ssp-reason">; Index: include/clang/Basic/DiagnosticFrontendKinds.td === --- include/clang/Basic/DiagnosticFrontendKinds.td +++ include/clang/Basic/DiagnosticFrontendKinds.td @@ -224,4 +224,11 @@ def warn_option_invalid_ocl_version : Warning< "OpenCL version %0 does not support the option '%1'">, InGroup; + +def remark_ssp_applied_reason +: Remark<"SSP applied to function due to %select{an unknown reason|a " + "call to alloca|a stack allocated buffer or struct containing a " +
[PATCH] D28451: [AVR] Add support for the 'interrupt' and 'naked' attributes
aaron.ballman added inline comments. Comment at: lib/Sema/SemaDeclAttr.cpp:5158 + case llvm::Triple::avr: +handleAVRInterruptAttr(S, D, Attr); +break; aaron.ballman wrote: > Just call `handleSimpleAttribute()` instead. Since this is no longer truly a simple attribute (it requires some custom checking), I think my earlier advice was wrong -- you should split this into a `handleAVRInterruptAttr()` method. I forgot that you need the custom checking because the attribute has custom parsing. Comment at: lib/Sema/SemaDeclAttr.cpp:5721 + case AttributeList::AT_AVRSignal: +handleAVRSignalAttr(S, D, Attr); +break; aaron.ballman wrote: > ...same here. ... same here. Comment at: lib/Sema/SemaDeclAttr.cpp:5145 +if (!isFunctionOrMethod(D)) { + S.Diag(D->getLocation(), diag::warn_attribute_wrong_decl_type) + << "'interrupt'" << ExpectedFunctionOrMethod; dylanmckay wrote: > I'm pretty sure that this check shouldn't be necessary, because we define > `Subjects = [Function]` in TableGen. > > Without it though, the warning doesn't appear. Do you know why that is > @aaron.ballman? It's because it requires custom parsing. Comment at: lib/Sema/SemaDeclAttr.cpp:5146 + S.Diag(D->getLocation(), diag::warn_attribute_wrong_decl_type) + << "'interrupt'" << ExpectedFunctionOrMethod; + return; The diagnostic and the predicate for it don't match your `Subjects` line. Should this appertain to ObjC methods? If not, you want to use `ExpectedFunction` instead. If so, you want to add `ObjCMethod` to the `Subjects` line. https://reviews.llvm.org/D28451 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27621: [clang-tidy] check to find declarations declaring more than one name
aaron.ballman added inline comments. Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:37-38 + const auto *DeclStatement = Result.Nodes.getNodeAs("declstmt"); + if (!DeclStatement) +return; + Is there a case where this could happen? I would have imagined this as an `assert()`, if anything. https://reviews.llvm.org/D27621 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29031: [mips] Add support for static model on N64
sdardis created this revision. The patch teaches the Clang driver how to handle the N64 static relocation model properly. It enforces the correct target feature (+noabicalls) when -fno-pic is used. This is required as non-pic N64 code as the abi extension to call PIC code (CPIC) is unsupported. Make PIC the default for mips64 and mips64el, this affects both N32 & N64 ABIs, to better match GCC. As part of this effort, clean up the assembler invocation command builder, so the correct flags are used. Repository: rL LLVM https://reviews.llvm.org/D29031 Files: lib/Driver/ToolChains.cpp lib/Driver/Tools.cpp test/Driver/mips-as.c Index: test/Driver/mips-as.c === --- test/Driver/mips-as.c +++ test/Driver/mips-as.c @@ -21,17 +21,32 @@ // MIPS32R2-DEF-EL-AS: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EL" // // RUN: %clang -target mips64-linux-gnu -### \ -// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS64R2-EB-AS %s -// MIPS64R2-EB-AS: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-mno-shared" "-KPIC" "-EB" +// MIPS64R2-EB-AS: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-mno-shared" "-EB" // -// RUN: %clang -target mips64el-linux-gnu -### \ +// RUN: %clang -target mips64-linux-gnu -### \ // RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=MIPS64R2-EB-AS-PIC %s +// MIPS64R2-EB-AS-PIC: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-EB" "-KPIC" +// +// RUN: %clang -target mips64el-linux-gnu -### \ +// RUN: -no-integrated-as -c -fno-pic %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS64R2-DEF-EL-AS %s -// MIPS64R2-DEF-EL-AS: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-mno-shared" "-KPIC" "-EL" +// MIPS64R2-DEF-EL-AS: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-mno-shared" "-EL" +// +// RUN: %clang -target mips64el-linux-gnu -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=MIPS64R2-DEF-EL-AS-PIC %s +// MIPS64R2-DEF-EL-AS-PIC: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-EL" "-KPIC" // // RUN: %clang -target mips64-linux-gnu -mabi=n32 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=MIPS-N32-PIC %s +// MIPS-N32-PIC: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "n32" "-call_nonpic" "-EB" "-KPIC" +// +// RUN: %clang -target mips64-linux-gnu -mabi=n32 -### \ +// RUN: -no-integrated-as -c %s -fno-pic 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-N32 %s // MIPS-N32: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "n32" "-mno-shared" "-call_nonpic" "-EB" // @@ -45,8 +60,13 @@ // // RUN: %clang -target mips64el-linux-gnu -mabi=64 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=MIPS64R2-EL-AS-PIC %s +// MIPS64R2-EL-AS-PIC: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-EL" "-KPIC" +// +// RUN: %clang -target mips64el-linux-gnu -mabi=64 -### \ +// RUN: -no-integrated-as -c %s -fno-pic 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS64R2-EL-AS %s -// MIPS64R2-EL-AS: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-mno-shared" "-KPIC" "-EL" +// MIPS64R2-EL-AS: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-mno-shared" "-EL" // // RUN: %clang -target mips-linux-gnu -march=mips32r2 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ @@ -60,8 +80,13 @@ // // RUN: %clang -target mips64-linux-gnu -march=octeon -### \ // RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=MIPS-OCTEON-PIC %s +// MIPS-OCTEON-PIC: as{{(.exe)?}}" "-march" "octeon" "-mabi" "64" "-EB" "-KPIC" +// +// RUN: %clang -target mips64-linux-gnu -march=octeon -### \ +// RUN: -no-integrated-as -c %s -fno-pic 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-OCTEON %s -// MIPS-OCTEON: as{{(.exe)?}}" "-march" "octeon" "-mabi" "64" "-mno-shared" "-KPIC" "-EB" +// MIPS-OCTEON: as{{(.exe)?}}" "-march" "octeon" "-mabi" "64" "-mno-shared" "-EB" // // RUN: %clang -target mips-linux-gnu -mips1 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ @@ -115,28 +140,48 @@ // // RUN: %clang -target mips64-linux-gnu -mips64 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=MIPS-ALIAS-64-PIC %s +// MIPS-ALIAS-64-PIC: as{{(.exe)?}}" "-march" "mips64" "-mabi" "64" "-EB" "-KPIC" +// +// RUN: %clang -target mips64-linux-gnu -mips64 -### \ +// RUN: -no-integrated-as -c -fno-pic %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-64 %s -// MIPS-ALIAS-64: as{{(.exe)?}}" "-march" "mips64" "-mabi" "64" "-mno-shared" "-KPIC" "-EB" +// MIPS-ALIAS-64: as{{(.exe)?}}" "-march" "mips64" "-mabi" "64" "-mno-shared" "-EB" // // RUN: %clang -target mips64-linux-gnu -mips64r2 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ -// RUN: | FileCheck -check-prefix=MIPS-ALIAS-64R2 %s -// MIPS-ALIAS-64R2: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-mno
[PATCH] D29032: [mips] Define macros related to -mabicalls in the preprocessor
sdardis created this revision. Historically, NetBSD, FreeBSD and OpenBSD have defined the macro ABICALLS in the preprocessor when -mabicalls is in effect. Mainline GCC later defined __mips_abicalls when -mabicalls is in effect. This patch teaches the preprocessor to define these macros when appropriate. This resolves PR/31694. Thanks to Sean Bruno for highlighting this issue! https://reviews.llvm.org/D29032 Files: lib/Basic/Targets.cpp test/Preprocessor/init.c Index: test/Preprocessor/init.c === --- test/Preprocessor/init.c +++ test/Preprocessor/init.c @@ -3040,6 +3040,7 @@ // MIPS32BE:#define __llvm__ 1 // MIPS32BE:#define __mips 32 // MIPS32BE:#define __mips__ 1 +// MIPS32BE:#define __mips_abicalls 1 // MIPS32BE:#define __mips_fpr 32 // MIPS32BE:#define __mips_hard_float 1 // MIPS32BE:#define __mips_o32 1 @@ -3246,6 +3247,7 @@ // MIPS32EL:#define __llvm__ 1 // MIPS32EL:#define __mips 32 // MIPS32EL:#define __mips__ 1 +// MIPS32EL:#define __mips_abicalls 1 // MIPS32EL:#define __mips_fpr 32 // MIPS32EL:#define __mips_hard_float 1 // MIPS32EL:#define __mips_o32 1 @@ -3555,6 +3557,7 @@ // MIPSN32BE: #define __mips64 1 // MIPSN32BE: #define __mips64__ 1 // MIPSN32BE: #define __mips__ 1 +// MIPSN32BE: #define __mips_abicalls 1 // MIPSN32BE: #define __mips_fpr 64 // MIPSN32BE: #define __mips_hard_float 1 // MIPSN32BE: #define __mips_isa_rev 2 @@ -3861,6 +3864,7 @@ // MIPSN32EL: #define __mips64 1 // MIPSN32EL: #define __mips64__ 1 // MIPSN32EL: #define __mips__ 1 +// MIPSN32EL: #define __mips_abicalls 1 // MIPSN32EL: #define __mips_fpr 64 // MIPSN32EL: #define __mips_hard_float 1 // MIPSN32EL: #define __mips_isa_rev 2 @@ -4073,6 +4077,7 @@ // MIPS64BE:#define __mips64 1 // MIPS64BE:#define __mips64__ 1 // MIPS64BE:#define __mips__ 1 +// MIPS64BE:#define __mips_abicalls 1 // MIPS64BE:#define __mips_fpr 64 // MIPS64BE:#define __mips_hard_float 1 // MIPS64BE:#define __mips_n64 1 @@ -4282,6 +4287,7 @@ // MIPS64EL:#define __mips64 1 // MIPS64EL:#define __mips64__ 1 // MIPS64EL:#define __mips__ 1 +// MIPS64EL:#define __mips_abicalls 1 // MIPS64EL:#define __mips_fpr 64 // MIPS64EL:#define __mips_hard_float 1 // MIPS64EL:#define __mips_n64 1 @@ -4513,6 +4519,45 @@ // MIPS-XXR6:#define __mips_fpr 64 // MIPS-XXR6:#define __mips_nan2008 1 // +// RUN: %clang_cc1 -target-cpu mips32 \ +// RUN: -E -dM -triple=mips-unknown-netbsd -mrelocation-model pic < /dev/null \ +// RUN: | FileCheck -match-full-lines -check-prefix MIPS-ABICALLS-NETBSD %s +// MIPS-ABICALLS-NETBSD: #define __ABICALLS__ 1 +// MIPS-ABICALLS-NETBSD-NOT: #define __mips_abicalls 1 +// +// RUN: %clang_cc1 -target-cpu mips64 \ +// RUN: -E -dM -triple=mips64-unknown-netbsd -mrelocation-model pic < \ +// RUN: /dev/null | FileCheck -match-full-lines \ +// RUN: -check-prefix MIPS-ABICALLS-NETBSD64 %s +// MIPS-ABICALLS-NETBSD64: #define __ABICALLS__ 1 +// MIPS-ABICALLS-NETBSD-NOT: #define __mips_abicalls 1 +// +// RUN: %clang_cc1 -target-cpu mips32 \ +// RUN: -E -dM -triple=mips-unknown-freebsd -mrelocation-model pic < /dev/null \ +// RUN: | FileCheck -match-full-lines -check-prefix MIPS-ABICALLS-FREEBSD %s +// MIPS-ABICALLS-FREEBSD: #define __ABICALLS__ 1 +// MIPS-ABICALLS-FREEBSD-NOT: #define __mips_abicalls 1 +// +// RUN: %clang_cc1 -target-cpu mips64 \ +// RUN: -E -dM -triple=mips64-unknown-freebsd -mrelocation-model pic < \ +// RUN: /dev/null | FileCheck -match-full-lines \ +// RUN: -check-prefix MIPS-ABICALLS-FREEBSD64 %s +// MIPS-ABICALLS-FREEBSD64: #define __ABICALLS__ 1 +// MIPS-ABICALLS-FREEBSD-NOT: #define __mips_abicalls 1 +// +// RUN: %clang_cc1 -target-cpu mips32 \ +// RUN: -E -dM -triple=mips-unknown-openbsd -mrelocation-model pic < /dev/null \ +// RUN: | FileCheck -match-full-lines -check-prefix MIPS-ABICALLS-OPENBSD %s +// MIPS-ABICALLS-OPENBSD: #define __ABICALLS__ 1 +// MIPS-ABICALLS-OPENBSD-NOT: #define __mips_abicalls 1 +// +// RUN: %clang_cc1 -target-cpu mips64 \ +// RUN: -E -dM -triple=mips64-unknown-openbsd -mrelocation-model pic < \ +// RUN: /dev/null | FileCheck -match-full-lines \ +// RUN: -check-prefix MIPS-ABICALLS-OPENBSD64 %s +// MIPS-ABICALLS-OPENBSD64: #define __ABICALLS__ 1 +// MIPS-ABICALLS-OPENBSD-NOT: #define __mips_abicalls 1 +// // RUN: %clang_cc1 -E -dM -ffreestanding -triple=msp430-none-none < /dev/null | FileCheck -match-full-lines -check-prefix MSP430 %s // RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=msp430-none-none < /dev/null | FileCheck -match-full-lines -check-prefix MSP430 -check-prefix MSP430-CXX %s // Index: lib/Basic/Targets.cpp === --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -7434,6 +7434,8 @@ bool IsMicromips; bool IsNan2008; bool IsSingleFloat; + bool IsNoABICalls; + bool CanUseBSDABICalls; enum MipsFloatABI { HardFloat, SoftFloat } FloatABI; @@ -7449,16 +7451,21 @@
[PATCH] D29032: [mips] Define macros related to -mabicalls in the preprocessor
sdardis added a comment. Sending it to the correct list this time. https://reviews.llvm.org/D29032 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r292794 - [OpenMP] DSAChecker bug fix for combined directives.
Author: arpith Date: Mon Jan 23 09:38:49 2017 New Revision: 292794 URL: http://llvm.org/viewvc/llvm-project?rev=292794&view=rev Log: [OpenMP] DSAChecker bug fix for combined directives. The DSAChecker code in SemaOpenMP looks at the captured statement associated with an OpenMP directive. A combined directive such as 'target parallel' has nested capture statements, which have to be fully traversed before executing the DSAChecker. This is a patch to perform the traversal for such combined directives. Reviewers: ABataev Differential Revision: https://reviews.llvm.org/D29026 Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp cfe/trunk/test/OpenMP/target_parallel_default_messages.cpp Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=292794&r1=292793&r2=292794&view=diff == --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original) +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Mon Jan 23 09:38:49 2017 @@ -2268,7 +2268,11 @@ StmtResult Sema::ActOnOpenMPExecutableDi // Check default data sharing attributes for referenced variables. DSAAttrChecker DSAChecker(DSAStack, *this, cast(AStmt)); -DSAChecker.Visit(cast(AStmt)->getCapturedStmt()); +int ThisCaptureLevel = getOpenMPCaptureLevels(Kind); +Stmt *S = AStmt; +while (--ThisCaptureLevel >= 0) + S = cast(S)->getCapturedStmt(); +DSAChecker.Visit(S); if (DSAChecker.isErrorFound()) return StmtError(); // Generate list of implicitly defined firstprivate variables. Modified: cfe/trunk/test/OpenMP/target_parallel_default_messages.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_parallel_default_messages.cpp?rev=292794&r1=292793&r2=292794&view=diff == --- cfe/trunk/test/OpenMP/target_parallel_default_messages.cpp (original) +++ cfe/trunk/test/OpenMP/target_parallel_default_messages.cpp Mon Jan 23 09:38:49 2017 @@ -23,5 +23,8 @@ int main(int argc, char **argv) { foo(); #pragma omp target parallel default(shared) ++argc; + #pragma omp target parallel default(none) + #pragma omp parallel default(shared) + ++argc; return 0; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28520: Disable -Wthread-safety-analysis for some functions in __thread_support
aaron.ballman added a comment. In https://reviews.llvm.org/D28520#652607, @dim wrote: > In https://reviews.llvm.org/D28520#648880, @delesley wrote: > > > Sorry about the slow response. My main concern here is that the thread > > safety analysis was designed for use with a library that wraps the system > > mutex in a separate Mutex class. We did that specifically to avoid > > breaking anything; code has to opt-in to the static checking by defining > > and using a Mutex class, and the API of that class is restricted to calls > > that can be easily checked via annotations. Including attributes directly > > in the standard library has the potential to cause lots of breakage and > > false positives. > > > Yes, I agree with that. However, on FreeBSD the pthread functions themselves > are already annotated, so the libc++ wrapper functions cause -Werror warnings > during the tests. Therefore one of my suggestions was to explicitly turn off > warnings using `no_thread_safety_analysis` attributes. Is there any > disadvantage in doing that? > > > Is there some way to control the #ifdefs so that the annotations are turned > > off by default for everyone except possibly freebsd, but there's still a > > way to turn them on for users who want to see the warnings? I'm not a > > libcxx expert. > > Yes, that was one of my other suggestions, using `#if defined(__FreeBSD__)` > to limit these attributes to FreeBSD only. We can do that either with the > `no_thread_safety_analysis` attributes, or with the 'real' annotations, > though the latter are not really useful in this case. > > I'm really open to any variant, as long as something that works can get in > before the 4.0.0 release. :) I feel like there's still some confusion here (likely on my part). DeLesley was asking if there was a way to turn this off for everyone *except* FreeBSD (that is user-controllable), but your code turns it off specifically *for* FreeBSD with no option to enable. The part that has me confused is that FreeBSD is annotating their functionality specifically to enable thread safety checking; it seems like turning that checking off rather than supporting it is the wrong way to go. I think that may be why DeLesley was saying to disable the functionality for non-FreeBSD systems while still honoring it on FreeBSD, but if I'm confused, hopefully he'll clarify. https://reviews.llvm.org/D28520 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29026: [OpenMP] DSAChecker bug fix for combined directives.
This revision was automatically updated to reflect the committed changes. Closed by commit rL292794: [OpenMP] DSAChecker bug fix for combined directives. (authored by arpith). Changed prior to commit: https://reviews.llvm.org/D29026?vs=85382&id=85393#toc Repository: rL LLVM https://reviews.llvm.org/D29026 Files: cfe/trunk/lib/Sema/SemaOpenMP.cpp cfe/trunk/test/OpenMP/target_parallel_default_messages.cpp Index: cfe/trunk/test/OpenMP/target_parallel_default_messages.cpp === --- cfe/trunk/test/OpenMP/target_parallel_default_messages.cpp +++ cfe/trunk/test/OpenMP/target_parallel_default_messages.cpp @@ -23,5 +23,8 @@ foo(); #pragma omp target parallel default(shared) ++argc; + #pragma omp target parallel default(none) + #pragma omp parallel default(shared) + ++argc; return 0; } Index: cfe/trunk/lib/Sema/SemaOpenMP.cpp === --- cfe/trunk/lib/Sema/SemaOpenMP.cpp +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp @@ -2268,7 +2268,11 @@ // Check default data sharing attributes for referenced variables. DSAAttrChecker DSAChecker(DSAStack, *this, cast(AStmt)); -DSAChecker.Visit(cast(AStmt)->getCapturedStmt()); +int ThisCaptureLevel = getOpenMPCaptureLevels(Kind); +Stmt *S = AStmt; +while (--ThisCaptureLevel >= 0) + S = cast(S)->getCapturedStmt(); +DSAChecker.Visit(S); if (DSAChecker.isErrorFound()) return StmtError(); // Generate list of implicitly defined firstprivate variables. Index: cfe/trunk/test/OpenMP/target_parallel_default_messages.cpp === --- cfe/trunk/test/OpenMP/target_parallel_default_messages.cpp +++ cfe/trunk/test/OpenMP/target_parallel_default_messages.cpp @@ -23,5 +23,8 @@ foo(); #pragma omp target parallel default(shared) ++argc; + #pragma omp target parallel default(none) + #pragma omp parallel default(shared) + ++argc; return 0; } Index: cfe/trunk/lib/Sema/SemaOpenMP.cpp === --- cfe/trunk/lib/Sema/SemaOpenMP.cpp +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp @@ -2268,7 +2268,11 @@ // Check default data sharing attributes for referenced variables. DSAAttrChecker DSAChecker(DSAStack, *this, cast(AStmt)); -DSAChecker.Visit(cast(AStmt)->getCapturedStmt()); +int ThisCaptureLevel = getOpenMPCaptureLevels(Kind); +Stmt *S = AStmt; +while (--ThisCaptureLevel >= 0) + S = cast(S)->getCapturedStmt(); +DSAChecker.Visit(S); if (DSAChecker.isErrorFound()) return StmtError(); // Generate list of implicitly defined firstprivate variables. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29026: [OpenMP] DSAChecker bug fix for combined directives.
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG https://reviews.llvm.org/D29026 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28514: [CodeCompletion] Reset the hidden declaration obtained after lookup when caching UsingShadowDecls
arphaman updated this revision to Diff 85398. arphaman added a comment. Verify that the using shadow decl can be hidden by its owning using decl. Repository: rL LLVM https://reviews.llvm.org/D28514 Files: lib/Sema/SemaLookup.cpp test/Index/complete-cached-globals.cpp Index: test/Index/complete-cached-globals.cpp === --- /dev/null +++ test/Index/complete-cached-globals.cpp @@ -0,0 +1,25 @@ +// Note: the run lines follow their respective tests, since line/column +// matter in this test. + +namespace SomeNamespace { +class SomeClass { +}; +void SomeFunction(); +} + +using SomeNamespace::SomeClass; +using SomeNamespace::SomeFunction; + +static void foo() { + return; +} + +// rdar://23454249 + +// RUN: c-index-test -code-completion-at=%s:14:3 %s | FileCheck -check-prefix=CHECK-CC1 %s +// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:14:3 %s | FileCheck -check-prefix=CHECK-CC1 %s + +// CHECK-CC1: ClassDecl:{TypedText SomeClass} (50) +// CHECK-CC1: FunctionDecl:{ResultType void}{TypedText SomeFunction}{LeftParen (}{RightParen )} (50) +// CHECK-CC1-NOT: {Text SomeNamespace::}{TypedText SomeClass} +// CHECK-CC1-NOT: {Text SomeNamespace::}{TypedText SomeFunction} Index: lib/Sema/SemaLookup.cpp === --- lib/Sema/SemaLookup.cpp +++ lib/Sema/SemaLookup.cpp @@ -3428,6 +3428,12 @@ SM == ShadowMaps.rbegin()) continue; + // A shadow declaration that's created by a resolved using declaration + // is not hidden by the same using declaration. + if (isa(ND) && isa(D) && + cast(ND)->getUsingDecl() == D) +continue; + // We've found a declaration that hides this one. return D; } Index: test/Index/complete-cached-globals.cpp === --- /dev/null +++ test/Index/complete-cached-globals.cpp @@ -0,0 +1,25 @@ +// Note: the run lines follow their respective tests, since line/column +// matter in this test. + +namespace SomeNamespace { +class SomeClass { +}; +void SomeFunction(); +} + +using SomeNamespace::SomeClass; +using SomeNamespace::SomeFunction; + +static void foo() { + return; +} + +// rdar://23454249 + +// RUN: c-index-test -code-completion-at=%s:14:3 %s | FileCheck -check-prefix=CHECK-CC1 %s +// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:14:3 %s | FileCheck -check-prefix=CHECK-CC1 %s + +// CHECK-CC1: ClassDecl:{TypedText SomeClass} (50) +// CHECK-CC1: FunctionDecl:{ResultType void}{TypedText SomeFunction}{LeftParen (}{RightParen )} (50) +// CHECK-CC1-NOT: {Text SomeNamespace::}{TypedText SomeClass} +// CHECK-CC1-NOT: {Text SomeNamespace::}{TypedText SomeFunction} Index: lib/Sema/SemaLookup.cpp === --- lib/Sema/SemaLookup.cpp +++ lib/Sema/SemaLookup.cpp @@ -3428,6 +3428,12 @@ SM == ShadowMaps.rbegin()) continue; + // A shadow declaration that's created by a resolved using declaration + // is not hidden by the same using declaration. + if (isa(ND) && isa(D) && + cast(ND)->getUsingDecl() == D) +continue; + // We've found a declaration that hides this one. return D; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28514: [CodeCompletion] Reset the hidden declaration obtained after lookup when caching UsingShadowDecls
arphaman added a comment. In https://reviews.llvm.org/D28514#651724, @ahatanak wrote: > If they are equal, the loop can continue because a UsingDecl doesn't hide a > UsingShadowDecl that is tied to it. You're right, that would be better, I didn't notice that method before. Repository: rL LLVM https://reviews.llvm.org/D28514 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27257: [CodeCompletion] Ensure that ObjC root class completes instance methods from protocols and categories as well
arphaman marked an inline comment as done. arphaman added a comment. In https://reviews.llvm.org/D27257#652135, @bruno wrote: > How does this interact (if at all) with classes annotated with > `__attribute__((objc_root_class))`? The root classes are just classes without a superclass, the attribute `__attribute__((objc_root_class))` is used by foundation root classes to avoid the warning for a missing superclass. But there's no real crossover here. Repository: rL LLVM https://reviews.llvm.org/D27257 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27257: [CodeCompletion] Ensure that ObjC root class completes instance methods from protocols and categories as well
arphaman updated this revision to Diff 85400. arphaman added a comment. Add comment to parameter Repository: rL LLVM https://reviews.llvm.org/D27257 Files: lib/Sema/SemaCodeComplete.cpp test/Index/complete-objc-message.m Index: test/Index/complete-objc-message.m === --- test/Index/complete-objc-message.m +++ test/Index/complete-objc-message.m @@ -346,3 +346,54 @@ // RUN: c-index-test -code-completion-at=%s:197:6 %s | FileCheck -check-prefix=CHECK-NULLABLE %s // CHECK-NULLABLE: ObjCInstanceMethodDecl:{ResultType A * _Nonnull}{TypedText method:}{Placeholder (nullable A *)} + +// rdar://28012953 +// Code completion results should include instance methods from RootProtocol and +// RootClass when completing a method invocation for a RootClass object because +// RootClasses metaclass subclasses from RootClass (i.e. RootClass is actually +// an instance of RootClass). + +@protocol SubRootProtocol + +- (void)subProtocolInstanceMethod; + +@end + +@protocol RootProtocol + +- (void)protocolInstanceMethod; ++ (void)protocolClassMethod; + +@end + +@interface RootClass + +- (void)instanceMethod; ++ (void)classMethod; + +@end + +@protocol RootCategoryProtocol + +- (void)categoryProtocolInstanceMethod; + +@end + +@interface RootClass (Cat) + +- (void)categoryInstanceMethod; + +@end + +void completeAllTheRootThings() { + [RootClass classMethod]; +} + +// RUN: c-index-test -code-completion-at=%s:389:14 %s | FileCheck -check-prefix=CHECK-ROOT %s +// CHECK-ROOT: ObjCInstanceMethodDecl:{ResultType void}{TypedText categoryInstanceMethod} (35) +// CHECK-ROOT-NEXT: ObjCInstanceMethodDecl:{ResultType void}{TypedText categoryProtocolInstanceMethod} (37) +// CHECK-ROOT-NEXT: ObjCClassMethodDecl:{ResultType void}{TypedText classMethod} (35) +// CHECK-ROOT-NEXT: ObjCInstanceMethodDecl:{ResultType void}{TypedText instanceMethod} (35) +// CHECK-ROOT-NEXT: ObjCClassMethodDecl:{ResultType void}{TypedText protocolClassMethod} (37) +// CHECK-ROOT-NEXT: ObjCInstanceMethodDecl:{ResultType void}{TypedText protocolInstanceMethod} (37) +// CHECK-ROOT-NEXT: ObjCInstanceMethodDecl:{ResultType void}{TypedText subProtocolInstanceMethod} (37) Index: lib/Sema/SemaCodeComplete.cpp === --- lib/Sema/SemaCodeComplete.cpp +++ lib/Sema/SemaCodeComplete.cpp @@ -5230,24 +5230,22 @@ /// when it has the same number of parameters as we have selector identifiers. /// /// \param Results the structure into which we'll add results. -static void AddObjCMethods(ObjCContainerDecl *Container, - bool WantInstanceMethods, - ObjCMethodKind WantKind, +static void AddObjCMethods(ObjCContainerDecl *Container, + bool WantInstanceMethods, ObjCMethodKind WantKind, ArrayRef SelIdents, DeclContext *CurContext, - VisitedSelectorSet &Selectors, - bool AllowSameLength, - ResultBuilder &Results, - bool InOriginalClass = true) { + VisitedSelectorSet &Selectors, bool AllowSameLength, + ResultBuilder &Results, bool InOriginalClass = true, + bool IsRootClass = false) { typedef CodeCompletionResult Result; Container = getContainerDef(Container); ObjCInterfaceDecl *IFace = dyn_cast(Container); - bool isRootClass = IFace && !IFace->getSuperClass(); + IsRootClass = IsRootClass || (IFace && !IFace->getSuperClass()); for (auto *M : Container->methods()) { // The instance methods on the root class can be messaged via the // metaclass. if (M->isInstanceMethod() == WantInstanceMethods || -(isRootClass && !WantInstanceMethods)) { +(IsRootClass && !WantInstanceMethods)) { // Check whether the selector identifiers we've been given are a // subset of the identifiers for this particular method. if (!isAcceptableObjCMethod(M, WantKind, SelIdents, AllowSameLength)) @@ -5273,53 +5271,53 @@ for (ObjCList::iterator I = Protocols.begin(), E = Protocols.end(); I != E; ++I) -AddObjCMethods(*I, WantInstanceMethods, WantKind, SelIdents, - CurContext, Selectors, AllowSameLength, Results, false); +AddObjCMethods(*I, WantInstanceMethods, WantKind, SelIdents, CurContext, + Selectors, AllowSameLength, Results, false, IsRootClass); } } if (!IFace || !IFace->hasDefinition()) return; // Add methods in protocols. for (auto *I : IFace->protocols()) -AddObjCMethods(I, WantInstanceMethods, WantKind, SelIdents, - CurContext, Selectors, AllowSameLength, Results, false); - +AddObjCMethods(I, WantInstanceMethods, WantK
[PATCH] D29033: [clang-format] Fix LanguageKind comments.
djasper accepted this revision. djasper added a comment. This revision is now accepted and ready to land. Looks good. Thanks! https://reviews.llvm.org/D29033 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r292796 - [clang-format] Fix LanguageKind comments.
Author: krasimir Date: Mon Jan 23 10:21:06 2017 New Revision: 292796 URL: http://llvm.org/viewvc/llvm-project?rev=292796&view=rev Log: [clang-format] Fix LanguageKind comments. Summary: With the introduction of LK_ObjC, the comment line for LK_Cpp became obsolete. Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D29033 Modified: cfe/trunk/include/clang/Format/Format.h Modified: cfe/trunk/include/clang/Format/Format.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Format/Format.h?rev=292796&r1=292795&r2=292796&view=diff == --- cfe/trunk/include/clang/Format/Format.h (original) +++ cfe/trunk/include/clang/Format/Format.h Mon Jan 23 10:21:06 2017 @@ -459,13 +459,13 @@ struct FormatStyle { enum LanguageKind { /// Do not use. LK_None, -/// Should be used for C, C++, ObjectiveC, ObjectiveC++. +/// Should be used for C, C++. LK_Cpp, /// Should be used for Java. LK_Java, /// Should be used for JavaScript. LK_JavaScript, -/// Should be used for ObjC code. +/// Should be used for ObjectiveC, ObjectiveC++. LK_ObjC, /// Should be used for Protocol Buffers /// (https://developers.google.com/protocol-buffers/). ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29033: [clang-format] Fix LanguageKind comments.
This revision was automatically updated to reflect the committed changes. Closed by commit rL292796: [clang-format] Fix LanguageKind comments. (authored by krasimir). Changed prior to commit: https://reviews.llvm.org/D29033?vs=85397&id=85403#toc Repository: rL LLVM https://reviews.llvm.org/D29033 Files: cfe/trunk/include/clang/Format/Format.h Index: cfe/trunk/include/clang/Format/Format.h === --- cfe/trunk/include/clang/Format/Format.h +++ cfe/trunk/include/clang/Format/Format.h @@ -459,13 +459,13 @@ enum LanguageKind { /// Do not use. LK_None, -/// Should be used for C, C++, ObjectiveC, ObjectiveC++. +/// Should be used for C, C++. LK_Cpp, /// Should be used for Java. LK_Java, /// Should be used for JavaScript. LK_JavaScript, -/// Should be used for ObjC code. +/// Should be used for ObjectiveC, ObjectiveC++. LK_ObjC, /// Should be used for Protocol Buffers /// (https://developers.google.com/protocol-buffers/). Index: cfe/trunk/include/clang/Format/Format.h === --- cfe/trunk/include/clang/Format/Format.h +++ cfe/trunk/include/clang/Format/Format.h @@ -459,13 +459,13 @@ enum LanguageKind { /// Do not use. LK_None, -/// Should be used for C, C++, ObjectiveC, ObjectiveC++. +/// Should be used for C, C++. LK_Cpp, /// Should be used for Java. LK_Java, /// Should be used for JavaScript. LK_JavaScript, -/// Should be used for ObjC code. +/// Should be used for ObjectiveC, ObjectiveC++. LK_ObjC, /// Should be used for Protocol Buffers /// (https://developers.google.com/protocol-buffers/). ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r291961 - Add _LIBCPP_DIAGNOSE_WARNING and _LIBCPP_DIAGNOSE_ERROR macros.
This happens to fire in practice in protobuf. It's probably a true positive and it's cool that this warning found it, but it means we have to disable Wuser-defined-warnings for a bit -- which then disables all of these user-defined warnings. Right now there aren't any others, but it feels like we'd want to have the ability to turn individual user-defined warnings on or off instead of just having a single toggle for all of them. Are there plans for something like that? On Fri, Jan 13, 2017 at 5:02 PM, Eric Fiselier via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: ericwf > Date: Fri Jan 13 16:02:08 2017 > New Revision: 291961 > > URL: http://llvm.org/viewvc/llvm-project?rev=291961&view=rev > Log: > Add _LIBCPP_DIAGNOSE_WARNING and _LIBCPP_DIAGNOSE_ERROR macros. > > Clang recently added a `diagnose_if(cond, msg, type)` attribute > which can be used to generate diagnostics when `cond` is a constant > expression that evaluates to true. Otherwise no attribute has no > effect. > > This patch adds _LIBCPP_DIAGNOSE_ERROR/WARNING macros which > use this new attribute. Additionally this patch implements > a diagnostic message when a non-const-callable comparator is > given to a container. > > Note: For now the warning version of the diagnostic is useless > within libc++ since warning diagnostics are suppressed by the > system header pragma. I'm going to work on fixing this. > > Added: > libcxx/trunk/test/libcxx/containers/associative/non_ > const_comparator.fail.cpp > Modified: > libcxx/trunk/docs/UsingLibcxx.rst > libcxx/trunk/include/__config > libcxx/trunk/include/__tree > libcxx/trunk/include/map > libcxx/trunk/include/type_traits > libcxx/trunk/test/libcxx/compiler.py > libcxx/trunk/test/libcxx/test/config.py > libcxx/trunk/test/libcxx/test/format.py > libcxx/trunk/test/libcxx/utilities/tuple/tuple.tuple/ > diagnose_reference_binding.fail.cpp > > Modified: libcxx/trunk/docs/UsingLibcxx.rst > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/ > UsingLibcxx.rst?rev=291961&r1=291960&r2=291961&view=diff > > == > --- libcxx/trunk/docs/UsingLibcxx.rst (original) > +++ libcxx/trunk/docs/UsingLibcxx.rst Fri Jan 13 16:02:08 2017 > @@ -173,3 +173,10 @@ thread safety annotations. >return Tup{"hello world", 42}; // explicit constructor called. OK. > } > > +**_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS**: > + This macro disables the additional diagnostics generated by libc++ > using the > + `diagnose_if` attribute. These additional diagnostics include checks > for: > + > +* Giving `set`, `map`, `multiset`, `multimap` a comparator which is > not > + const callable. > + > > Modified: libcxx/trunk/include/__config > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/_ > _config?rev=291961&r1=291960&r2=291961&view=diff > > == > --- libcxx/trunk/include/__config (original) > +++ libcxx/trunk/include/__config Fri Jan 13 16:02:08 2017 > @@ -1006,6 +1006,16 @@ _LIBCPP_FUNC_VIS extern "C" void __sanit > #endif > #endif > > +#if __has_attribute(diagnose_if) && !defined(_LIBCPP_DISABLE_ > ADDITIONAL_DIAGNOSTICS) > +# define _LIBCPP_DIAGNOSE_WARNING(...) \ > +__attribute__((__diagnose_if__(__VA_ARGS__, "warning"))) > +# define _LIBCPP_DIAGNOSE_ERROR(...) \ > +__attribute__((__diagnose_if__(__VA_ARGS__, "error"))) > +#else > +# define _LIBCPP_DIAGNOSE_WARNING(...) > +# define _LIBCPP_DIAGNOSE_ERROR(...) > +#endif > + > #endif // __cplusplus > > #endif // _LIBCPP_CONFIG > > Modified: libcxx/trunk/include/__tree > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/_ > _tree?rev=291961&r1=291960&r2=291961&view=diff > > == > --- libcxx/trunk/include/__tree (original) > +++ libcxx/trunk/include/__tree Fri Jan 13 16:02:08 2017 > @@ -41,6 +41,10 @@ template > struct __value_type; > #endif > > +template +bool = is_empty<_Compare>::value && !__libcpp_is_final<_Compare>:: > value> > +class __map_value_compare; > + > template class __map_node_destructor; > template class _LIBCPP_TEMPLATE_VIS __map_iterator; > template class _LIBCPP_TEMPLATE_VIS > __map_const_iterator; > @@ -955,6 +959,30 @@ private: > > }; > > +#ifndef _LIBCPP_CXX03_LANG > +template > +struct __diagnose_tree_helper { > + static constexpr bool __trigger_diagnostics() > + _LIBCPP_DIAGNOSE_WARNING(!__is_const_comparable<_Compare, > _Tp>::value, > +"the specified comparator type does not provide a const call > operator") > + { return true; } > +}; > + > +template > +struct __diagnose_tree_helper< > +__value_type<_Key, _Value>, > +__map_value_compare<_Key, __value_type<_Key, _Value>, _KeyComp>, > +_Alloc > +> > +{ > + static constexpr bool __trigger_diagnostics() > + _LIBCPP_DIAGNOSE_WARNING
[PATCH] D28764: [clang-format] Implement comment reflowing (v3)
klimek added inline comments. Comment at: lib/Format/BreakableToken.h:55-56 +/// been reformatted, and +/// - replaceWhitespaceBefore, for executing the reflow using a whitespace +/// manager. +/// Shouldn't that be called insertBreakBefore for consistency then? Also, perhaps we want to rename replaceWhitespace to cleanupWhitespace or compressWhitespace or something... Comment at: lib/Format/ContinuationIndenter.cpp:1158-1159 +CommentPragmasRegex.match(Current.TokenText.substr(2)) || +Current.TokenText.substr(2).ltrim().startswith("clang-format on") || +Current.TokenText.substr(2).ltrim().startswith("clang-format off")) return addMultilineToken(Current, State); Generally, we shouldn't need those here, as those should be part of the Token.Finalized state. Comment at: lib/Format/ContinuationIndenter.cpp:1220 +RemainingTokenColumns = RemainingTokenColumns + 1 - Split.second; +ReflowInProgress = true; if (!DryRun) Explain this part in a comment. https://reviews.llvm.org/D28764 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r292632 - Fix actually-reachable llvm_unreachable.
Should this test that some specific mangling comes out the other end (tests that amount to "test that this does anything other than crashing" always make me a bit suspicious that there's /some/ specific behavior that is intended/should be tested for) On Fri, Jan 20, 2017 at 11:01 AM Richard Smith via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: rsmith > Date: Fri Jan 20 12:50:12 2017 > New Revision: 292632 > > URL: http://llvm.org/viewvc/llvm-project?rev=292632&view=rev > Log: > Fix actually-reachable llvm_unreachable. > > Modified: > cfe/trunk/lib/AST/ItaniumMangle.cpp > cfe/trunk/test/CodeGenCXX/mangle.cpp > > Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=292632&r1=292631&r2=292632&view=diff > > == > --- cfe/trunk/lib/AST/ItaniumMangle.cpp (original) > +++ cfe/trunk/lib/AST/ItaniumMangle.cpp Fri Jan 20 12:50:12 2017 > @@ -3043,6 +3043,7 @@ void CXXNameMangler::mangleType(const De >// ::= Te # dependent elaborated type > specifier using >// # 'enum' >switch (T->getKeyword()) { > +case ETK_None: > case ETK_Typename: >break; > case ETK_Struct: > @@ -3056,8 +3057,6 @@ void CXXNameMangler::mangleType(const De > case ETK_Enum: >Out << "Te"; >break; > -default: > - llvm_unreachable("unexpected keyword for dependent type name"); >} >// Typename types are always nested >Out << 'N'; > > Modified: cfe/trunk/test/CodeGenCXX/mangle.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle.cpp?rev=292632&r1=292631&r2=292632&view=diff > > == > --- cfe/trunk/test/CodeGenCXX/mangle.cpp (original) > +++ cfe/trunk/test/CodeGenCXX/mangle.cpp Fri Jan 20 12:50:12 2017 > @@ -1125,3 +1125,14 @@ namespace test57 { >// CHECK-LABEL: @_ZN6test571fILi0EEEvDTplcldtL_ZNS_1xEE1fIXLi0T_E >template void f<0>(int); > } > + > +namespace test58 { > + struct State { > + bool m_fn1(); > + } a; > + template struct identity_ { typedef T type; }; > + struct A { > + template A(T, bool (identity_::type::*)()); > + }; > + void fn1() { A(a, &State::m_fn1); } > +} > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28365: [Driver] Updated for Visual Studio 2017
hamzasood marked 5 inline comments as done. hamzasood added a comment. Ping https://reviews.llvm.org/D28365 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r292800 - [analyzer] Fix memory space of static locals seen from nested blocks.
Author: dergachev Date: Mon Jan 23 10:57:11 2017 New Revision: 292800 URL: http://llvm.org/viewvc/llvm-project?rev=292800&view=rev Log: [analyzer] Fix memory space of static locals seen from nested blocks. When a block within a function accesses a function's static local variable, this local is captured by reference rather than copied to the heap. Therefore this variable's memory space is known: StaticGlobalSpaceRegion. Used to be UnknownSpaceRegion, same as for stack locals. Fixes a false positive in MacOSXAPIChecker. rdar://problem/30105546 Differential revision: https://reviews.llvm.org/D28946 Modified: cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp cfe/trunk/test/Analysis/dispatch-once.m Modified: cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp?rev=292800&r1=292799&r2=292800&view=diff == --- cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp Mon Jan 23 10:57:11 2017 @@ -776,6 +776,22 @@ getStackOrCaptureRegionForDeclContext(co return (const StackFrameContext *)nullptr; } +static CanQualType getBlockPointerType(const BlockDecl *BD, ASTContext &C) { + // FIXME: The fallback type here is totally bogus -- though it should + // never be queried, it will prevent uniquing with the real + // BlockCodeRegion. Ideally we'd fix the AST so that we always had a + // signature. + QualType T; + if (const TypeSourceInfo *TSI = BD->getSignatureAsWritten()) +T = TSI->getType(); + if (T.isNull()) +T = C.VoidTy; + if (!T->getAs()) +T = C.getFunctionNoProtoType(T); + T = C.getBlockPointerType(T); + return C.getCanonicalType(T); +} + const VarRegion* MemRegionManager::getVarRegion(const VarDecl *D, const LocationContext *LC) { const MemRegion *sReg = nullptr; @@ -803,7 +819,7 @@ const VarRegion* MemRegionManager::getVa sReg = getGlobalsRegion(); } - // Finally handle static locals. + // Finally handle locals. } else { // FIXME: Once we implement scope handling, we will need to properly lookup // 'D' to the proper LocationContext. @@ -816,9 +832,22 @@ const VarRegion* MemRegionManager::getVa const StackFrameContext *STC = V.get(); -if (!STC) - sReg = getUnknownRegion(); -else { +if (!STC) { + if (D->isStaticLocal()) { +const CodeTextRegion *fReg = nullptr; +if (const auto *ND = dyn_cast(DC)) + fReg = getFunctionCodeRegion(ND); +else if (const auto *BD = dyn_cast(DC)) + fReg = getBlockCodeRegion(BD, getBlockPointerType(BD, getContext()), +LC->getAnalysisDeclContext()); +assert(fReg && "Unable to determine code region for a static local!"); +sReg = getGlobalsRegion(MemRegion::StaticGlobalSpaceRegionKind, fReg); + } else { +// We're looking at a block-captured local variable, which may be either +// still local, or already moved to the heap. So we're not sure. +sReg = getUnknownRegion(); + } +} else { if (D->hasLocalStorage()) { sReg = isa(D) || isa(D) ? static_cast(getStackArgumentsRegion(STC)) @@ -831,22 +860,9 @@ const VarRegion* MemRegionManager::getVa sReg = getGlobalsRegion(MemRegion::StaticGlobalSpaceRegionKind, getFunctionCodeRegion(cast(STCD))); else if (const BlockDecl *BD = dyn_cast(STCD)) { - // FIXME: The fallback type here is totally bogus -- though it should - // never be queried, it will prevent uniquing with the real - // BlockCodeRegion. Ideally we'd fix the AST so that we always had a - // signature. - QualType T; - if (const TypeSourceInfo *TSI = BD->getSignatureAsWritten()) -T = TSI->getType(); - if (T.isNull()) -T = getContext().VoidTy; - if (!T->getAs()) -T = getContext().getFunctionNoProtoType(T); - T = getContext().getBlockPointerType(T); - const BlockCodeRegion *BTR = -getBlockCodeRegion(BD, C.getCanonicalType(T), - STC->getAnalysisDeclContext()); + getBlockCodeRegion(BD, getBlockPointerType(BD, getContext()), + STC->getAnalysisDeclContext()); sReg = getGlobalsRegion(MemRegion::StaticGlobalSpaceRegionKind, BTR); } Modified: cfe/trunk/test/Analysis/dispatch-once.m URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/dispatch-once.m?rev=292800&r1=292799&r2=292800&view=diff == --- cfe/trunk/test/Analysis/dispatch-once.m (original) +++ cfe/trunk/test/Analysis
r292801 - Revert "DebugInfo: Omit class definitions even in the presence of available_externally vtables"
Author: dblaikie Date: Mon Jan 23 10:57:14 2017 New Revision: 292801 URL: http://llvm.org/viewvc/llvm-project?rev=292801&view=rev Log: Revert "DebugInfo: Omit class definitions even in the presence of available_externally vtables" Patch crashing on a bootstrapping sanitizer bot: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/679 Reverting while I investigate. This reverts commit r292768. Removed: cfe/trunk/test/CodeGenCXX/debug-info-class-optzns.cpp Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp cfe/trunk/lib/CodeGen/CGDebugInfo.h cfe/trunk/lib/CodeGen/CGVTables.cpp Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=292801&r1=292800&r2=292801&view=diff == --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Jan 23 10:57:14 2017 @@ -1714,26 +1714,7 @@ void CGDebugInfo::completeType(const Rec completeRequiredType(RD); } -/// Return true if the class or any of its methods are marked dllimport. -static bool isClassOrMethodDLLImport(const CXXRecordDecl *RD) { - if (RD->hasAttr()) -return true; - for (const CXXMethodDecl *MD : RD->methods()) -if (MD->hasAttr()) - return true; - return false; -} - void CGDebugInfo::completeClassData(const RecordDecl *RD) { - if (auto *CXXRD = dyn_cast(RD)) -if (CGM.getVTableLinkage(CXXRD) == -llvm::GlobalValue::AvailableExternallyLinkage && -!isClassOrMethodDLLImport(CXXRD)) - return; - completeClass(RD); -} - -void CGDebugInfo::completeClass(const RecordDecl *RD) { if (DebugKind <= codegenoptions::DebugLineTablesOnly) return; QualType Ty = CGM.getContext().getRecordType(RD); @@ -1779,6 +1760,16 @@ static bool isDefinedInClangModule(const return true; } +/// Return true if the class or any of its methods are marked dllimport. +static bool isClassOrMethodDLLImport(const CXXRecordDecl *RD) { + if (RD->hasAttr()) +return true; + for (const CXXMethodDecl *MD : RD->methods()) +if (MD->hasAttr()) + return true; + return false; +} + static bool shouldOmitDefinition(codegenoptions::DebugInfoKind DebugKind, bool DebugTypeExtRefs, const RecordDecl *RD, const LangOptions &LangOpts) { Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=292801&r1=292800&r2=292801&view=diff == --- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Mon Jan 23 10:57:14 2017 @@ -409,7 +409,6 @@ public: void completeType(const RecordDecl *RD); void completeRequiredType(const RecordDecl *RD); void completeClassData(const RecordDecl *RD); - void completeClass(const RecordDecl *RD); void completeTemplateDefinition(const ClassTemplateSpecializationDecl &SD); Modified: cfe/trunk/lib/CodeGen/CGVTables.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTables.cpp?rev=292801&r1=292800&r2=292801&view=diff == --- cfe/trunk/lib/CodeGen/CGVTables.cpp (original) +++ cfe/trunk/lib/CodeGen/CGVTables.cpp Mon Jan 23 10:57:14 2017 @@ -744,10 +744,9 @@ CodeGenModule::getVTableLinkage(const CX switch (keyFunction->getTemplateSpecializationKind()) { case TSK_Undeclared: case TSK_ExplicitSpecialization: -assert((def || CodeGenOpts.OptimizationLevel > 0 || -CodeGenOpts.getDebugInfo() != codegenoptions::NoDebugInfo) && - "Shouldn't query vtable linkage without key function, " - "optimizations, or debug info"); +assert((def || CodeGenOpts.OptimizationLevel > 0) && + "Shouldn't query vtable linkage without key function or " + "optimizations"); if (!def && CodeGenOpts.OptimizationLevel > 0) return llvm::GlobalVariable::AvailableExternallyLinkage; Removed: cfe/trunk/test/CodeGenCXX/debug-info-class-optzns.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-class-optzns.cpp?rev=292800&view=auto == --- cfe/trunk/test/CodeGenCXX/debug-info-class-optzns.cpp (original) +++ cfe/trunk/test/CodeGenCXX/debug-info-class-optzns.cpp (removed) @@ -1,16 +0,0 @@ -// RUN: %clang_cc1 -triple x86_64-unknown_unknown -emit-llvm -debug-info-kind=limited %s -O1 -o - | FileCheck %s - -// Ensure class definitions are not emitted to debug info just because the -// vtable is emitted for optimization purposes (as available_externally). The -// class definition debug info should only go where the vtable is actually -// emitted into th
[PATCH] D28946: [analyzer] Fix memory space for block-captured static locals.
This revision was automatically updated to reflect the committed changes. Closed by commit rL292800: [analyzer] Fix memory space of static locals seen from nested blocks. (authored by dergachev). Changed prior to commit: https://reviews.llvm.org/D28946?vs=85123&id=85408#toc Repository: rL LLVM https://reviews.llvm.org/D28946 Files: cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp cfe/trunk/test/Analysis/dispatch-once.m Index: cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp === --- cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp +++ cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp @@ -776,6 +776,22 @@ return (const StackFrameContext *)nullptr; } +static CanQualType getBlockPointerType(const BlockDecl *BD, ASTContext &C) { + // FIXME: The fallback type here is totally bogus -- though it should + // never be queried, it will prevent uniquing with the real + // BlockCodeRegion. Ideally we'd fix the AST so that we always had a + // signature. + QualType T; + if (const TypeSourceInfo *TSI = BD->getSignatureAsWritten()) +T = TSI->getType(); + if (T.isNull()) +T = C.VoidTy; + if (!T->getAs()) +T = C.getFunctionNoProtoType(T); + T = C.getBlockPointerType(T); + return C.getCanonicalType(T); +} + const VarRegion* MemRegionManager::getVarRegion(const VarDecl *D, const LocationContext *LC) { const MemRegion *sReg = nullptr; @@ -803,7 +819,7 @@ sReg = getGlobalsRegion(); } - // Finally handle static locals. + // Finally handle locals. } else { // FIXME: Once we implement scope handling, we will need to properly lookup // 'D' to the proper LocationContext. @@ -816,9 +832,22 @@ const StackFrameContext *STC = V.get(); -if (!STC) - sReg = getUnknownRegion(); -else { +if (!STC) { + if (D->isStaticLocal()) { +const CodeTextRegion *fReg = nullptr; +if (const auto *ND = dyn_cast(DC)) + fReg = getFunctionCodeRegion(ND); +else if (const auto *BD = dyn_cast(DC)) + fReg = getBlockCodeRegion(BD, getBlockPointerType(BD, getContext()), +LC->getAnalysisDeclContext()); +assert(fReg && "Unable to determine code region for a static local!"); +sReg = getGlobalsRegion(MemRegion::StaticGlobalSpaceRegionKind, fReg); + } else { +// We're looking at a block-captured local variable, which may be either +// still local, or already moved to the heap. So we're not sure. +sReg = getUnknownRegion(); + } +} else { if (D->hasLocalStorage()) { sReg = isa(D) || isa(D) ? static_cast(getStackArgumentsRegion(STC)) @@ -831,22 +860,9 @@ sReg = getGlobalsRegion(MemRegion::StaticGlobalSpaceRegionKind, getFunctionCodeRegion(cast(STCD))); else if (const BlockDecl *BD = dyn_cast(STCD)) { - // FIXME: The fallback type here is totally bogus -- though it should - // never be queried, it will prevent uniquing with the real - // BlockCodeRegion. Ideally we'd fix the AST so that we always had a - // signature. - QualType T; - if (const TypeSourceInfo *TSI = BD->getSignatureAsWritten()) -T = TSI->getType(); - if (T.isNull()) -T = getContext().VoidTy; - if (!T->getAs()) -T = getContext().getFunctionNoProtoType(T); - T = getContext().getBlockPointerType(T); - const BlockCodeRegion *BTR = -getBlockCodeRegion(BD, C.getCanonicalType(T), - STC->getAnalysisDeclContext()); + getBlockCodeRegion(BD, getBlockPointerType(BD, getContext()), + STC->getAnalysisDeclContext()); sReg = getGlobalsRegion(MemRegion::StaticGlobalSpaceRegionKind, BTR); } Index: cfe/trunk/test/Analysis/dispatch-once.m === --- cfe/trunk/test/Analysis/dispatch-once.m +++ cfe/trunk/test/Analysis/dispatch-once.m @@ -107,3 +107,10 @@ }; dispatch_once(&once, ^{}); // expected-warning{{Call to 'dispatch_once' uses the block variable 'once' for the predicate value.}} } + +void test_static_var_from_outside_block() { + static dispatch_once_t once; + ^{ +dispatch_once(&once, ^{}); // no-warning + }; +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28514: [CodeCompletion] Reset the hidden declaration obtained after lookup when caching UsingShadowDecls
ahatanak accepted this revision. ahatanak added a comment. This revision is now accepted and ready to land. Thanks LGTM. Repository: rL LLVM https://reviews.llvm.org/D28514 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28080: [Docs][OpenCL] Added OpenCL feature description to user manual.
Anastasia added a comment. > (I should pass -finclude-default-header after -cc1 without -Xclang then it > works, but I think also the > latter version should work, no?) In general -cc1 and -Xclang have similar effect so I either should work indeed. > Also, I cannot add -S (even with -emit-llvm), then it complains about a > missing target: > > $ clang -cc1 -triple spir64-unknown-unknown ~/temp/local.cl -S > error: unable to create target: 'No available targets are compatible with > this triple.' > > > I think -S used to work with -emit-llvm as a switch to output LLVM text > instead of bitcode, but now it seems to > output text by default so it should not be used. I think this has to do with spir being a 'generic' target. > Is there are reason to use/document the -cc1 -triple instead of > -target here? Yes, because in some cases we have added frontend flag only, so we need to either pass -cc1 or -Xclang. But I could change the documentation to try to pass -target before the -cc1 flag. > Also, for me the command without -emit-llvm doesn't output anything. What targets do you use? I think the problem is that it's not clear what the default output of the standalone compiler should be for the most of the OpenCL targets, since it does't produce a valid binary. If let's say we emit an x86 binary, would it be valid to run it for POCL directly? Perhaps, we could try to emit the bitcode by default then. Currently if I run: clang test.cl I get an error: undefined reference to `main'. But if I add a main (which isn't really valid for OpenCL) I get: error: function cannot be called 'main' https://reviews.llvm.org/D28080 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r292804 - [OpenCL] Improved enqueue_kernel diagnostic message
Author: stulova Date: Mon Jan 23 11:12:36 2017 New Revision: 292804 URL: http://llvm.org/viewvc/llvm-project?rev=292804&view=rev Log: [OpenCL] Improved enqueue_kernel diagnostic message - Removed duplicated word typo. - Made coherent across multiple similar diagnostics. Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/test/SemaOpenCL/cl20-device-side-enqueue.cl Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=292804&r1=292803&r2=292804&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Jan 23 11:12:36 2017 @@ -8248,9 +8248,9 @@ def err_opencl_enqueue_kernel_local_size def err_opencl_enqueue_kernel_invalid_local_size_type : Error< "illegal call to enqueue_kernel, parameter needs to be specified as integer type">; def err_opencl_enqueue_kernel_blocks_non_local_void_args : Error< - "blocks used in device side enqueue are expected to have parameters of type 'local void*'">; + "blocks used in enqueue_kernel call are expected to have parameters of type 'local void*'">; def err_opencl_enqueue_kernel_blocks_no_args : Error< - "blocks in this form of device side enqueue call are expected to have have no parameters">; + "blocks with parameters are not accepted in this prototype of enqueue_kernel call">; // OpenCL v2.2 s2.1.2.3 - Vector Component Access def ext_opencl_ext_vector_type_rgba_selector: ExtWarn< Modified: cfe/trunk/test/SemaOpenCL/cl20-device-side-enqueue.cl URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/cl20-device-side-enqueue.cl?rev=292804&r1=292803&r2=292804&view=diff == --- cfe/trunk/test/SemaOpenCL/cl20-device-side-enqueue.cl (original) +++ cfe/trunk/test/SemaOpenCL/cl20-device-side-enqueue.cl Mon Jan 23 11:12:36 2017 @@ -30,7 +30,7 @@ kernel void enqueue_kernel_tests() { enqueue_kernel(default_queue, flags, ndrange, vptr); // expected-error{{illegal call to enqueue_kernel, expected block argument}} - enqueue_kernel(default_queue, flags, ndrange, ^(int i) { // expected-error{{blocks in this form of device side enqueue call are expected to have have no parameters}} + enqueue_kernel(default_queue, flags, ndrange, ^(int i) { // expected-error{{blocks with parameters are not accepted in this prototype of enqueue_kernel call}} return 0; }); @@ -111,7 +111,7 @@ kernel void enqueue_kernel_tests() { const bl_B_t block_B = (bl_B_t) ^ (local void *a, local int *b) {}; - enqueue_kernel(default_queue, flags, ndrange, block_B, 1024, 1024); // expected-error{{blocks used in device side enqueue are expected to have parameters of type 'local void*'}} + enqueue_kernel(default_queue, flags, ndrange, block_B, 1024, 1024); // expected-error{{blocks used in enqueue_kernel call are expected to have parameters of type 'local void*'}} enqueue_kernel(default_queue, flags, ndrange, // expected-error{{mismatch in number of block parameters and local size arguments passed}} ^(local void *a, local void *b) { @@ -177,12 +177,12 @@ kernel void work_group_size_tests() { size = get_kernel_work_group_size(^(local void *a) { return; }); - size = get_kernel_work_group_size(^(local int *a) { // expected-error {{blocks used in device side enqueue are expected to have parameters of type 'local void*'}} + size = get_kernel_work_group_size(^(local int *a) { // expected-error {{blocks used in enqueue_kernel call are expected to have parameters of type 'local void*'}} return; }); - size = get_kernel_work_group_size(block_B); // expected-error {{blocks used in device side enqueue are expected to have parameters of type 'local void*'}} - size = get_kernel_work_group_size(block_D); // expected-error {{blocks used in device side enqueue are expected to have parameters of type 'local void*'}} - size = get_kernel_work_group_size(^(int a) { // expected-error {{blocks used in device side enqueue are expected to have parameters of type 'local void*'}} + size = get_kernel_work_group_size(block_B); // expected-error {{blocks used in enqueue_kernel call are expected to have parameters of type 'local void*'}} + size = get_kernel_work_group_size(block_D); // expected-error {{blocks used in enqueue_kernel call are expected to have parameters of type 'local void*'}} + size = get_kernel_work_group_size(^(int a) { // expected-error {{blocks used in enqueue_kernel call are expected to have parameters of type 'local void*'}} return; }); size = get_kernel_work_group_size(); // expected-error {{too few arguments to function call, expected 1, have 0}} @@ -194,14 +194,14 @@ kernel void work_group_size_tes
[PATCH] D28814: [OpenCL] Add missing address spaces in IR generation of Blocks
Anastasia added a comment. Ping! @yaxunl, Sam do you think you will have time to look into this? https://reviews.llvm.org/D28814 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r292805 - [Sema] UsingShadowDecl shouldn't be hidden by the UsingDecl that owns it
Author: arphaman Date: Mon Jan 23 11:23:23 2017 New Revision: 292805 URL: http://llvm.org/viewvc/llvm-project?rev=292805&view=rev Log: [Sema] UsingShadowDecl shouldn't be hidden by the UsingDecl that owns it rdar://23454249 Differential Revision: https://reviews.llvm.org/D28514 Added: cfe/trunk/test/Index/complete-cached-globals.cpp Modified: cfe/trunk/lib/Sema/SemaLookup.cpp Modified: cfe/trunk/lib/Sema/SemaLookup.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=292805&r1=292804&r2=292805&view=diff == --- cfe/trunk/lib/Sema/SemaLookup.cpp (original) +++ cfe/trunk/lib/Sema/SemaLookup.cpp Mon Jan 23 11:23:23 2017 @@ -3428,6 +3428,12 @@ NamedDecl *VisibleDeclsRecord::checkHidd SM == ShadowMaps.rbegin()) continue; + // A shadow declaration that's created by a resolved using declaration + // is not hidden by the same using declaration. + if (isa(ND) && isa(D) && + cast(ND)->getUsingDecl() == D) +continue; + // We've found a declaration that hides this one. return D; } Added: cfe/trunk/test/Index/complete-cached-globals.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-cached-globals.cpp?rev=292805&view=auto == --- cfe/trunk/test/Index/complete-cached-globals.cpp (added) +++ cfe/trunk/test/Index/complete-cached-globals.cpp Mon Jan 23 11:23:23 2017 @@ -0,0 +1,25 @@ +// Note: the run lines follow their respective tests, since line/column +// matter in this test. + +namespace SomeNamespace { +class SomeClass { +}; +void SomeFunction(); +} + +using SomeNamespace::SomeClass; +using SomeNamespace::SomeFunction; + +static void foo() { + return; +} + +// rdar://23454249 + +// RUN: c-index-test -code-completion-at=%s:14:3 %s | FileCheck -check-prefix=CHECK-CC1 %s +// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:14:3 %s | FileCheck -check-prefix=CHECK-CC1 %s + +// CHECK-CC1: ClassDecl:{TypedText SomeClass} (50) +// CHECK-CC1: FunctionDecl:{ResultType void}{TypedText SomeFunction}{LeftParen (}{RightParen )} (50) +// CHECK-CC1-NOT: {Text SomeNamespace::}{TypedText SomeClass} +// CHECK-CC1-NOT: {Text SomeNamespace::}{TypedText SomeFunction} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28514: [CodeCompletion] Reset the hidden declaration obtained after lookup when caching UsingShadowDecls
This revision was automatically updated to reflect the committed changes. Closed by commit rL292805: [Sema] UsingShadowDecl shouldn't be hidden by the UsingDecl that owns it (authored by arphaman). Changed prior to commit: https://reviews.llvm.org/D28514?vs=85398&id=85414#toc Repository: rL LLVM https://reviews.llvm.org/D28514 Files: cfe/trunk/lib/Sema/SemaLookup.cpp cfe/trunk/test/Index/complete-cached-globals.cpp Index: cfe/trunk/test/Index/complete-cached-globals.cpp === --- cfe/trunk/test/Index/complete-cached-globals.cpp +++ cfe/trunk/test/Index/complete-cached-globals.cpp @@ -0,0 +1,25 @@ +// Note: the run lines follow their respective tests, since line/column +// matter in this test. + +namespace SomeNamespace { +class SomeClass { +}; +void SomeFunction(); +} + +using SomeNamespace::SomeClass; +using SomeNamespace::SomeFunction; + +static void foo() { + return; +} + +// rdar://23454249 + +// RUN: c-index-test -code-completion-at=%s:14:3 %s | FileCheck -check-prefix=CHECK-CC1 %s +// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:14:3 %s | FileCheck -check-prefix=CHECK-CC1 %s + +// CHECK-CC1: ClassDecl:{TypedText SomeClass} (50) +// CHECK-CC1: FunctionDecl:{ResultType void}{TypedText SomeFunction}{LeftParen (}{RightParen )} (50) +// CHECK-CC1-NOT: {Text SomeNamespace::}{TypedText SomeClass} +// CHECK-CC1-NOT: {Text SomeNamespace::}{TypedText SomeFunction} Index: cfe/trunk/lib/Sema/SemaLookup.cpp === --- cfe/trunk/lib/Sema/SemaLookup.cpp +++ cfe/trunk/lib/Sema/SemaLookup.cpp @@ -3428,6 +3428,12 @@ SM == ShadowMaps.rbegin()) continue; + // A shadow declaration that's created by a resolved using declaration + // is not hidden by the same using declaration. + if (isa(ND) && isa(D) && + cast(ND)->getUsingDecl() == D) +continue; + // We've found a declaration that hides this one. return D; } Index: cfe/trunk/test/Index/complete-cached-globals.cpp === --- cfe/trunk/test/Index/complete-cached-globals.cpp +++ cfe/trunk/test/Index/complete-cached-globals.cpp @@ -0,0 +1,25 @@ +// Note: the run lines follow their respective tests, since line/column +// matter in this test. + +namespace SomeNamespace { +class SomeClass { +}; +void SomeFunction(); +} + +using SomeNamespace::SomeClass; +using SomeNamespace::SomeFunction; + +static void foo() { + return; +} + +// rdar://23454249 + +// RUN: c-index-test -code-completion-at=%s:14:3 %s | FileCheck -check-prefix=CHECK-CC1 %s +// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:14:3 %s | FileCheck -check-prefix=CHECK-CC1 %s + +// CHECK-CC1: ClassDecl:{TypedText SomeClass} (50) +// CHECK-CC1: FunctionDecl:{ResultType void}{TypedText SomeFunction}{LeftParen (}{RightParen )} (50) +// CHECK-CC1-NOT: {Text SomeNamespace::}{TypedText SomeClass} +// CHECK-CC1-NOT: {Text SomeNamespace::}{TypedText SomeFunction} Index: cfe/trunk/lib/Sema/SemaLookup.cpp === --- cfe/trunk/lib/Sema/SemaLookup.cpp +++ cfe/trunk/lib/Sema/SemaLookup.cpp @@ -3428,6 +3428,12 @@ SM == ShadowMaps.rbegin()) continue; + // A shadow declaration that's created by a resolved using declaration + // is not hidden by the same using declaration. + if (isa(ND) && isa(D) && + cast(ND)->getUsingDecl() == D) +continue; + // We've found a declaration that hides this one. return D; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r292806 - Removed some un-needed ifdefs
Author: marshall Date: Mon Jan 23 11:25:38 2017 New Revision: 292806 URL: http://llvm.org/viewvc/llvm-project?rev=292806&view=rev Log: Removed some un-needed ifdefs Modified: libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.creation/tie.pass.cpp Modified: libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.creation/tie.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.creation/tie.pass.cpp?rev=292806&r1=292805&r2=292806&view=diff == --- libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.creation/tie.pass.cpp (original) +++ libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.creation/tie.pass.cpp Mon Jan 23 11:25:38 2017 @@ -31,7 +31,6 @@ int main() assert(i == 42); assert(s == "C++"); } -#if TEST_STD_VER > 11 { static constexpr int i = 42; static constexpr double f = 1.1; @@ -39,5 +38,4 @@ int main() static_assert ( std::get<0>(t) == 42, "" ); static_assert ( std::get<1>(t) == 1.1, "" ); } -#endif } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29038: [OpenCL] Accept logical NOT for pointer types in CL1.0 and CL1.1
Anastasia created this revision. Herald added a subscriber: yaxunl. A bug is reported regarding incorrect error given for logical NOT operation with a pointer type: https://llvm.org/bugs/show_bug.cgi?id=30217 Detailed investigation shows that this has only been a problem for CL earlier than v1.2. This patch fixes the issue as well as improves and simplifies related test. https://reviews.llvm.org/D29038 Files: lib/Sema/SemaExpr.cpp test/SemaOpenCL/invalid-logical-ops-1.1.cl test/SemaOpenCL/invalid-logical-ops-1.2.cl Index: test/SemaOpenCL/invalid-logical-ops-1.2.cl === --- test/SemaOpenCL/invalid-logical-ops-1.2.cl +++ /dev/null @@ -1,58 +0,0 @@ -// RUN: %clang_cc1 %s -verify -cl-std=CL1.2 -triple x86_64-unknown-linux-gnu - -#pragma OPENCL EXTENSION cl_khr_fp64 : enable - -typedef __attribute__((ext_vector_type(4))) float float4; -typedef __attribute__((ext_vector_type(4))) double double4; -typedef __attribute__((ext_vector_type(4))) int int4; -typedef __attribute__((ext_vector_type(4))) long long4; - -kernel void float_ops() { - int flaf = 0.0f && 0.0f; - int flof = 0.0f || 0.0f; - float fbaf = 0.0f & 0.0f; // expected-error {{invalid operands}} - float fbof = 0.0f | 0.0f; // expected-error {{invalid operands}} - float fbxf = 0.0f ^ 0.0f; // expected-error {{invalid operands}} - int flai = 0.0f && 0; - int floi = 0.0f || 0; - float ibaf = 0 & 0.0f; // expected-error {{invalid operands}} - float ibof = 0 | 0.0f; // expected-error {{invalid operands}} - float bnf = ~0.0f;// expected-error {{invalid argument type}} - float lnf = !0.0f; -} - -kernel void vec_float_ops() { - float4 f4 = (float4)(0, 0, 0, 0); - int4 f4laf = f4 && 0.0f; - int4 f4lof = f4 || 0.0f; - float4 f4baf = f4 & 0.0f; // expected-error {{invalid operands}} - float4 f4bof = f4 | 0.0f; // expected-error {{invalid operands}} - float4 f4bxf = f4 ^ 0.0f; // expected-error {{invalid operands}} - float bnf4 = ~f4; // expected-error {{invalid argument type}} - int4 lnf4 = !f4; -} - -kernel void double_ops() { - int flaf = 0.0 && 0.0; - int flof = 0.0 || 0.0; - double fbaf = 0.0 & 0.0; // expected-error {{invalid operands}} - double fbof = 0.0 | 0.0; // expected-error {{invalid operands}} - double fbxf = 0.0 ^ 0.0; // expected-error {{invalid operands}} - int flai = 0.0 && 0; - int floi = 0.0 || 0; - double ibaf = 0 & 0.0; // expected-error {{invalid operands}} - double ibof = 0 | 0.0; // expected-error {{invalid operands}} - double bnf = ~0.0; // expected-error {{invalid argument type}} - double lnf = !0.0; -} - -kernel void vec_double_ops() { - double4 f4 = (double4)(0, 0, 0, 0); - long4 f4laf = f4 && 0.0; - long4 f4lof = f4 || 0.0; - double4 f4baf = f4 & 0.0; // expected-error {{invalid operands}} - double4 f4bof = f4 | 0.0; // expected-error {{invalid operands}} - double4 f4bxf = f4 ^ 0.0; // expected-error {{invalid operands}} - double bnf4 = ~f4; // expected-error {{invalid argument type}} - long4 lnf4 = !f4; -} Index: test/SemaOpenCL/invalid-logical-ops-1.1.cl === --- test/SemaOpenCL/invalid-logical-ops-1.1.cl +++ /dev/null @@ -1,57 +0,0 @@ -// RUN: %clang_cc1 %s -verify -cl-std=CL1.1 -triple x86_64-unknown-linux-gnu - -#pragma OPENCL EXTENSION cl_khr_fp64 : enable -typedef __attribute__((ext_vector_type(4))) float float4; -typedef __attribute__((ext_vector_type(4))) double double4; -typedef __attribute__((ext_vector_type(4))) int int4; -typedef __attribute__((ext_vector_type(4))) long long4; - -kernel void float_ops() { - int flaf = 0.0f && 0.0f; // expected-error {{invalid operands}} - int flof = 0.0f || 0.0f; // expected-error {{invalid operands}} - float fbaf = 0.0f & 0.0f; // expected-error {{invalid operands}} - float fbof = 0.0f | 0.0f; // expected-error {{invalid operands}} - float fbxf = 0.0f ^ 0.0f; // expected-error {{invalid operands}} - int flai = 0.0f && 0; // expected-error {{invalid operands}} - int floi = 0.0f || 0; // expected-error {{invalid operands}} - float ibaf = 0 & 0.0f; // expected-error {{invalid operands}} - float ibof = 0 | 0.0f; // expected-error {{invalid operands}} - float bnf = ~0.0f; // expected-error {{invalid argument type}} - float lnf = !0.0f; // expected-error {{invalid argument type}} -} - -kernel void vec_float_ops() { - float4 f4 = (float4)(0, 0, 0, 0); - int4 f4laf = f4 && 0.0f; // expected-error {{invalid operands}} - int4 f4lof = f4 || 0.0f; // expected-error {{invalid operands}} - float4 f4baf = f4 & 0.0f; // expected-error {{invalid operands}} - float4 f4bof = f4 | 0.0f; // expected-error {{invalid operands}} - float4 f4bxf = f4 ^ 0.0f; // expected-error {{invalid operands}} - float bnf4 = ~f4; // expected-error {{invalid argument type}} - int4 lnf4 = !f4; // expected-error {{invalid argument type}} -} - -kernel void double_ops() { - int flaf = 0.0 && 0.0; // expected-error {{invalid operands}} - i
[PATCH] D29038: [OpenCL] Accept logical NOT for pointer types in CL1.0 and CL1.1
Anastasia updated this revision to Diff 85418. Anastasia added a comment. Added missing test! https://reviews.llvm.org/D29038 Files: lib/Sema/SemaExpr.cpp test/SemaOpenCL/invalid-logical-ops-1.1.cl test/SemaOpenCL/invalid-logical-ops-1.2.cl test/SemaOpenCL/logical-ops.cl Index: test/SemaOpenCL/logical-ops.cl === --- /dev/null +++ test/SemaOpenCL/logical-ops.cl @@ -0,0 +1,116 @@ +// RUN: %clang_cc1 %s -verify -cl-std=CL1.1 -triple x86_64-unknown-linux-gnu +// RUN: %clang_cc1 %s -verify -cl-std=CL1.2 -triple x86_64-unknown-linux-gnu + +#pragma OPENCL EXTENSION cl_khr_fp64 : enable + +typedef __attribute__((ext_vector_type(4))) float float4; +typedef __attribute__((ext_vector_type(4))) double double4; +typedef __attribute__((ext_vector_type(4))) int int4; +typedef __attribute__((ext_vector_type(4))) long long4; + +kernel void float_ops() { + int flaf = 0.0f && 0.0f; +#if __OPENCL_C_VERSION__ < 120 +// expected-error@-2{{invalid operands}} +#endif + int flof = 0.0f || 0.0f; +#if __OPENCL_C_VERSION__ < 120 +// expected-error@-2{{invalid operands}} +#endif + float fbaf = 0.0f & 0.0f; // expected-error {{invalid operands}} + float fbof = 0.0f | 0.0f; // expected-error {{invalid operands}} + float fbxf = 0.0f ^ 0.0f; // expected-error {{invalid operands}} + int flai = 0.0f && 0; +#if __OPENCL_C_VERSION__ < 120 +// expected-error@-2{{invalid operands}} +#endif + int floi = 0.0f || 0; +#if __OPENCL_C_VERSION__ < 120 +// expected-error@-2{{invalid operands}} +#endif + float ibaf = 0 & 0.0f; // expected-error {{invalid operands}} + float ibof = 0 | 0.0f; // expected-error {{invalid operands}} + float bnf = ~0.0f;// expected-error {{invalid argument type}} + float lnf = !0.0f; +#if __OPENCL_C_VERSION__ < 120 +// expected-error@-2{{invalid argument type}} +#endif +} + +kernel void vec_float_ops() { + float4 f4 = (float4)(0, 0, 0, 0); + int4 f4laf = f4 && 0.0f; +#if __OPENCL_C_VERSION__ < 120 +// expected-error@-2{{invalid operands}} +#endif + int4 f4lof = f4 || 0.0f; +#if __OPENCL_C_VERSION__ < 120 +// expected-error@-2{{invalid operands}} +#endif + float4 f4baf = f4 & 0.0f; // expected-error {{invalid operands}} + float4 f4bof = f4 | 0.0f; // expected-error {{invalid operands}} + float4 f4bxf = f4 ^ 0.0f; // expected-error {{invalid operands}} + float bnf4 = ~f4; // expected-error {{invalid argument type}} + int4 lnf4 = !f4; +#if __OPENCL_C_VERSION__ < 120 +// expected-error@-2{{invalid argument type}} +#endif +} + +kernel void double_ops() { + int flaf = 0.0 && 0.0; +#if __OPENCL_C_VERSION__ < 120 +// expected-error@-2{{invalid operands}} +#endif + int flof = 0.0 || 0.0; +#if __OPENCL_C_VERSION__ < 120 +// expected-error@-2{{invalid operands}} +#endif + double fbaf = 0.0 & 0.0; // expected-error {{invalid operands}} + double fbof = 0.0 | 0.0; // expected-error {{invalid operands}} + double fbxf = 0.0 ^ 0.0; // expected-error {{invalid operands}} + int flai = 0.0 && 0; +#if __OPENCL_C_VERSION__ < 120 +// expected-error@-2{{invalid operands}} +#endif + int floi = 0.0 || 0; +#if __OPENCL_C_VERSION__ < 120 +// expected-error@-2{{invalid operands}} +#endif + double ibaf = 0 & 0.0; // expected-error {{invalid operands}} + double ibof = 0 | 0.0; // expected-error {{invalid operands}} + double bnf = ~0.0; // expected-error {{invalid argument type}} + double lnf = !0.0; +#if __OPENCL_C_VERSION__ < 120 +// expected-error@-2{{invalid argument type}} +#endif +} + +kernel void vec_double_ops() { + double4 f4 = (double4)(0, 0, 0, 0); + long4 f4laf = f4 && 0.0; +#if __OPENCL_C_VERSION__ < 120 +// expected-error@-2{{invalid operands}} +#endif + long4 f4lof = f4 || 0.0; +#if __OPENCL_C_VERSION__ < 120 +// expected-error@-2{{invalid operands}} +#endif + double4 f4baf = f4 & 0.0; // expected-error {{invalid operands}} + double4 f4bof = f4 | 0.0; // expected-error {{invalid operands}} + double4 f4bxf = f4 ^ 0.0; // expected-error {{invalid operands}} + double bnf4 = ~f4; // expected-error {{invalid argument type}} + long4 lnf4 = !f4; +#if __OPENCL_C_VERSION__ < 120 +// expected-error@-2{{invalid argument type}} +#endif +} + +kernel void pointer_ops(){ + global int* p; + bool b = !p; + b = p==0; + int i; + b = !&i; + b = &i==(int *)1; +} Index: test/SemaOpenCL/invalid-logical-ops-1.2.cl === --- test/SemaOpenCL/invalid-logical-ops-1.2.cl +++ /dev/null @@ -1,58 +0,0 @@ -// RUN: %clang_cc1 %s -verify -cl-std=CL1.2 -triple x86_64-unknown-linux-gnu - -#pragma OPENCL EXTENSION cl_khr_fp64 : enable - -typedef __attribute__((ext_vector_type(4))) float float4; -typedef __attribute__((ext_vector_type(4))) double double4; -typedef __attribute__((ext_vector_type(4))) int int4; -typedef __attribute__((ext_vector_type(4))) long long4; - -kernel void float_ops() { - int flaf = 0.0f && 0.0f; - int flof = 0.0f || 0.0f; - float fbaf = 0.0f & 0.0f; // expected-error {{inva
Re: r292555 - P0426: Make the library implementation of constexpr char_traits a little easier
r292807. Thanks, Hans On Thu, Jan 19, 2017 at 5:22 PM, Richard Smith wrote: > Hans, can we get this onto the Clang 4 release branch (along with the > documentation added in r292558 and fixed in r292559)? This will allow us to > avoid libc++ carrying a version test for Clang, and allow it to cleanly > finish off its implementation of P0426. > > On 19 January 2017 at 16:45, Richard Smith via cfe-commits > wrote: >> >> Author: rsmith >> Date: Thu Jan 19 18:45:35 2017 >> New Revision: 292555 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=292555&view=rev >> Log: >> P0426: Make the library implementation of constexpr char_traits a little >> easier >> by providing a memchr builtin that returns char* instead of void*. >> >> Also add a __has_feature flag to indicate the presence of constexpr forms >> of >> the relevant functions. >> >> Modified: >> cfe/trunk/include/clang/Basic/Builtins.def >> cfe/trunk/lib/AST/ExprConstant.cpp >> cfe/trunk/lib/CodeGen/CGBuiltin.cpp >> cfe/trunk/lib/Lex/PPMacroExpansion.cpp >> cfe/trunk/test/CodeGenCXX/builtins.cpp >> cfe/trunk/test/Lexer/has_feature_cxx0x.cpp >> cfe/trunk/test/SemaCXX/constexpr-string.cpp >> >> Modified: cfe/trunk/include/clang/Basic/Builtins.def >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.def?rev=292555&r1=292554&r2=292555&view=diff >> >> == >> --- cfe/trunk/include/clang/Basic/Builtins.def (original) >> +++ cfe/trunk/include/clang/Basic/Builtins.def Thu Jan 19 18:45:35 2017 >> @@ -1339,6 +1339,7 @@ BUILTIN(__builtin_smulll_overflow, "bSLL >> BUILTIN(__builtin_addressof, "v*v&", "nct") >> BUILTIN(__builtin_operator_new, "v*z", "c") >> BUILTIN(__builtin_operator_delete, "vv*", "n") >> +BUILTIN(__builtin_char_memchr, "c*cC*iz", "n") >> >> // Safestack builtins >> BUILTIN(__builtin___get_unsafe_stack_start, "v*", "Fn") >> >> Modified: cfe/trunk/lib/AST/ExprConstant.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=292555&r1=292554&r2=292555&view=diff >> >> == >> --- cfe/trunk/lib/AST/ExprConstant.cpp (original) >> +++ cfe/trunk/lib/AST/ExprConstant.cpp Thu Jan 19 18:45:35 2017 >> @@ -5683,6 +5683,7 @@ bool PointerExprEvaluator::VisitBuiltinC >>case Builtin::BI__builtin_strchr: >>case Builtin::BI__builtin_wcschr: >>case Builtin::BI__builtin_memchr: >> + case Builtin::BI__builtin_char_memchr: >>case Builtin::BI__builtin_wmemchr: { >> if (!Visit(E->getArg(0))) >>return false; >> @@ -5720,6 +5721,7 @@ bool PointerExprEvaluator::VisitBuiltinC >>// Fall through. >> case Builtin::BImemchr: >> case Builtin::BI__builtin_memchr: >> +case Builtin::BI__builtin_char_memchr: >>// memchr compares by converting both sides to unsigned char. >> That's also >>// correct for strchr if we get this far (to cope with plain char >> being >>// unsigned in the strchr case). >> >> Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=292555&r1=292554&r2=292555&view=diff >> >> == >> --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original) >> +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Thu Jan 19 18:45:35 2017 >> @@ -1189,6 +1189,10 @@ RValue CodeGenFunction::EmitBuiltinExpr( >> return RValue::get(Dest.getPointer()); >>} >> >> + case Builtin::BI__builtin_char_memchr: >> +BuiltinID = Builtin::BI__builtin_memchr; >> +break; >> + >>case Builtin::BI__builtin___memcpy_chk: { >> // fold __builtin_memcpy_chk(x, y, cst1, cst2) to memcpy iff >> cst1<=cst2. >> llvm::APSInt Size, DstSize; >> >> Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=292555&r1=292554&r2=292555&view=diff >> >> == >> --- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original) >> +++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Thu Jan 19 18:45:35 2017 >> @@ -1183,6 +1183,7 @@ static bool HasFeature(const Preprocesso >>.Case("cxx_attributes", LangOpts.CPlusPlus11) >>.Case("cxx_auto_type", LangOpts.CPlusPlus11) >>.Case("cxx_constexpr", LangOpts.CPlusPlus11) >> + .Case("cxx_constexpr_string_builtins", LangOpts.CPlusPlus11) >>.Case("cxx_decltype", LangOpts.CPlusPlus11) >>.Case("cxx_decltype_incomplete_return_types", LangOpts.CPlusPlus11) >>.Case("cxx_default_function_template_args", LangOpts.CPlusPlus11) >> >> Modified: cfe/trunk/test/CodeGenCXX/builtins.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/builtins.cpp?rev=292555&r1=292554&r2=292555&view=diff >> >> =
Re: [libcxx] r292564 - Disable aligned new/delete on Apple platforms without posix_memalign
Thanks! On Thu, Jan 19, 2017 at 6:07 PM, Eric Fiselier wrote: > Merged. > > Relevant commits: > > * r292566 - Merge r292564 > * r292565 - Merge r292560 > > /Eric ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r292809 - Revert previous cleanup; I got too agressive removing #ifdefs
Author: marshall Date: Mon Jan 23 12:00:15 2017 New Revision: 292809 URL: http://llvm.org/viewvc/llvm-project?rev=292809&view=rev Log: Revert previous cleanup; I got too agressive removing #ifdefs Modified: libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.creation/tie.pass.cpp Modified: libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.creation/tie.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.creation/tie.pass.cpp?rev=292809&r1=292808&r2=292809&view=diff == --- libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.creation/tie.pass.cpp (original) +++ libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.creation/tie.pass.cpp Mon Jan 23 12:00:15 2017 @@ -31,6 +31,7 @@ int main() assert(i == 42); assert(s == "C++"); } +#if TEST_STD_VER > 11 { static constexpr int i = 42; static constexpr double f = 1.1; @@ -38,4 +39,5 @@ int main() static_assert ( std::get<0>(t) == 42, "" ); static_assert ( std::get<1>(t) == 1.1, "" ); } +#endif } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r292497 - [Sema] Fix PR28181 by avoiding calling BuildOverloadedBinOp in C mode
On Thu, Jan 19, 2017 at 6:25 PM, Richard Smith wrote: > On 19 January 2017 at 15:52, Hans Wennborg wrote: >> >> Richard, what do you think? > > > Yes, let's merge this. r292808. Cheers, Hans >> On Thu, Jan 19, 2017 at 9:34 AM, Alex L wrote: >> > Hi Hans, >> > >> > Would it be possible to merge this for 4.0? >> > >> > Cheers, >> > Alex >> > >> > On 19 January 2017 at 17:17, Alex Lorenz via cfe-commits >> > wrote: >> >> >> >> Author: arphaman >> >> Date: Thu Jan 19 11:17:57 2017 >> >> New Revision: 292497 >> >> >> >> URL: http://llvm.org/viewvc/llvm-project?rev=292497&view=rev >> >> Log: >> >> [Sema] Fix PR28181 by avoiding calling BuildOverloadedBinOp in C mode >> >> >> >> rdar://28532840 >> >> >> >> Differential Revision: https://reviews.llvm.org/D25213 >> >> >> >> Added: >> >> cfe/trunk/test/Sema/PR28181.c >> >> Modified: >> >> cfe/trunk/lib/Sema/SemaExpr.cpp >> >> >> >> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp >> >> URL: >> >> >> >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=292497&r1=292496&r2=292497&view=diff >> >> >> >> >> >> == >> >> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original) >> >> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Jan 19 11:17:57 2017 >> >> @@ -11505,7 +11505,7 @@ ExprResult Sema::BuildBinOp(Scope *S, So >> >>return checkPseudoObjectAssignment(S, OpLoc, Opc, LHSExpr, >> >> RHSExpr); >> >> >> >> // Don't resolve overloads if the other type is overloadable. >> >> -if (pty->getKind() == BuiltinType::Overload) { >> >> +if (getLangOpts().CPlusPlus && pty->getKind() == >> >> BuiltinType::Overload) { >> >>// We can't actually test that if we still have a placeholder, >> >>// though. Fortunately, none of the exceptions we see in that >> >>// code below are valid when the LHS is an overload set. Note >> >> @@ -11530,17 +11530,16 @@ ExprResult Sema::BuildBinOp(Scope *S, So >> >> // An overload in the RHS can potentially be resolved by the type >> >> // being assigned to. >> >> if (Opc == BO_Assign && pty->getKind() == BuiltinType::Overload) { >> >> - if (LHSExpr->isTypeDependent() || RHSExpr->isTypeDependent()) >> >> -return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr, >> >> RHSExpr); >> >> - >> >> - if (LHSExpr->getType()->isOverloadableType()) >> >> + if (getLangOpts().CPlusPlus && >> >> + (LHSExpr->isTypeDependent() || RHSExpr->isTypeDependent() || >> >> + LHSExpr->getType()->isOverloadableType())) >> >> return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr, >> >> RHSExpr); >> >> >> >>return CreateBuiltinBinOp(OpLoc, Opc, LHSExpr, RHSExpr); >> >> } >> >> >> >> // Don't resolve overloads if the other type is overloadable. >> >> -if (pty->getKind() == BuiltinType::Overload && >> >> +if (getLangOpts().CPlusPlus && pty->getKind() == >> >> BuiltinType::Overload && >> >> LHSExpr->getType()->isOverloadableType()) >> >>return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr, >> >> RHSExpr); >> >> >> >> >> >> Added: cfe/trunk/test/Sema/PR28181.c >> >> URL: >> >> >> >> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/PR28181.c?rev=292497&view=auto >> >> >> >> >> >> == >> >> --- cfe/trunk/test/Sema/PR28181.c (added) >> >> +++ cfe/trunk/test/Sema/PR28181.c Thu Jan 19 11:17:57 2017 >> >> @@ -0,0 +1,13 @@ >> >> +// RUN: %clang_cc1 -fsyntax-only -verify %s >> >> + >> >> +struct spinlock_t { >> >> + int lock; >> >> +} audit_skb_queue; >> >> + >> >> +void fn1() { >> >> + audit_skb_queue = (lock); // expected-error {{use of undeclared >> >> identifier 'lock'; did you mean 'long'?}} >> >> +} // expected-error@-1 {{assigning to >> >> 'struct >> >> spinlock_t' from incompatible type ''}} >> >> + >> >> +void fn2() { >> >> + audit_skb_queue + (lock); // expected-error {{use of undeclared >> >> identifier 'lock'; did you mean 'long'?}} >> >> +} // expected-error@-1 {{reference to >> >> overloaded function could not be resolved; did you mean to call it?}} >> >> >> >> >> >> ___ >> >> cfe-commits mailing list >> >> cfe-commits@lists.llvm.org >> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >> > >> > > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r292607 - Don't default older GCC's to C++17, but C++14 or C++11 instead
Sounds good to me. On Fri, Jan 20, 2017 at 11:38 AM, Eric Fiselier wrote: > We should merge this patch into the 4.0 release branch. It is needed to make > "check-all" pass when using GCC 4, 5 and 6. > > /Eric > > On Fri, Jan 20, 2017 at 5:54 AM, Eric Fiselier via cfe-commits > wrote: >> >> Author: ericwf >> Date: Fri Jan 20 06:54:45 2017 >> New Revision: 292607 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=292607&view=rev >> Log: >> Don't default older GCC's to C++17, but C++14 or C++11 instead >> >> Modified: >> libcxx/trunk/test/libcxx/test/config.py >> >> Modified: libcxx/trunk/test/libcxx/test/config.py >> URL: >> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/config.py?rev=292607&r1=292606&r2=292607&view=diff >> >> == >> --- libcxx/trunk/test/libcxx/test/config.py (original) >> +++ libcxx/trunk/test/libcxx/test/config.py Fri Jan 20 06:54:45 2017 >> @@ -423,6 +423,15 @@ class Configuration(object): >> if not std: >> # Choose the newest possible language dialect if none is >> given. >> possible_stds = ['c++1z', 'c++14', 'c++11', 'c++03'] >> +if self.cxx.type == 'gcc': >> +maj_v, _, _ = self.cxx.version >> +maj_v = int(maj_v) >> +if maj_v < 7: >> +possible_stds.remove('c++1z') >> +# FIXME: How many C++14 tests actually fail under GCC 5 >> and 6? >> +# Should we XFAIL them individually instead? >> +if maj_v <= 6: >> +possible_stds.remove('c++14') >> for s in possible_stds: >> if self.cxx.hasCompileFlag('-std=%s' % s): >> std = s >> >> >> ___ >> cfe-commits mailing list >> cfe-commits@lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28814: [OpenCL] Add missing address spaces in IR generation of Blocks
yaxunl added inline comments. Comment at: lib/CodeGen/CGBlocks.cpp:723 +? CGM.getNSConcreteStackBlock() +: llvm::Constant::getNullValue( + CGM.getNSConcreteStackBlock()->getType()); should use CGM.getNullPointer to create a null pointer. Comment at: lib/CodeGen/CGBlocks.cpp:1124 + ? CGM.getNSConcreteGlobalBlock() + : llvm::Constant::getNullValue( + CGM.getNSConcreteGlobalBlock()->getType())); should use CGM.getNullPointer to create a null pointer. https://reviews.llvm.org/D28814 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r292811 - Fix documentation typo from r292558.
Author: rsmith Date: Mon Jan 23 12:17:46 2017 New Revision: 292811 URL: http://llvm.org/viewvc/llvm-project?rev=292811&view=rev Log: Fix documentation typo from r292558. Modified: cfe/trunk/docs/LanguageExtensions.rst Modified: cfe/trunk/docs/LanguageExtensions.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.rst?rev=292811&r1=292810&r2=292811&view=diff == --- cfe/trunk/docs/LanguageExtensions.rst (original) +++ cfe/trunk/docs/LanguageExtensions.rst Mon Jan 23 12:17:46 2017 @@ -1780,7 +1780,7 @@ String builtins --- Clang provides constant expression evaluation support for builtins forms of -the following functions from the C standard library header: +the following functions from the C standard library header: * ``memchr`` * ``memcmp`` ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r292558 - Add documentation for constexpr string builtin support.
On 22 January 2017 at 07:57, Kim Gräsman wrote: > Hi Richard, > > On Fri, Jan 20, 2017 at 1:58 AM, Richard Smith via cfe-commits > wrote: > > > > +String builtins > > +--- > > + > > +Clang provides constant expression evaluation support for builtins > forms of > > +the following functions from the C standard library > header: > > + > > +* ``memchr`` > > +* ``memcmp`` > > +* ``strchr`` > > This should say , right? Yes, thanks, fixed in r292811. > > - Kim > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r292800 - [analyzer] Fix memory space of static locals seen from nested blocks.
Hans, Could we merge this one into the 4.0.0 release branch? It's a recent bugfix for the analyzer. Thanks, Artem. On 1/23/17 7:57 PM, Artem Dergachev via cfe-commits wrote: Author: dergachev Date: Mon Jan 23 10:57:11 2017 New Revision: 292800 URL: http://llvm.org/viewvc/llvm-project?rev=292800&view=rev Log: [analyzer] Fix memory space of static locals seen from nested blocks. When a block within a function accesses a function's static local variable, this local is captured by reference rather than copied to the heap. Therefore this variable's memory space is known: StaticGlobalSpaceRegion. Used to be UnknownSpaceRegion, same as for stack locals. Fixes a false positive in MacOSXAPIChecker. rdar://problem/30105546 Differential revision: https://reviews.llvm.org/D28946 Modified: cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp cfe/trunk/test/Analysis/dispatch-once.m Modified: cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp?rev=292800&r1=292799&r2=292800&view=diff == --- cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp Mon Jan 23 10:57:11 2017 @@ -776,6 +776,22 @@ getStackOrCaptureRegionForDeclContext(co return (const StackFrameContext *)nullptr; } +static CanQualType getBlockPointerType(const BlockDecl *BD, ASTContext &C) { + // FIXME: The fallback type here is totally bogus -- though it should + // never be queried, it will prevent uniquing with the real + // BlockCodeRegion. Ideally we'd fix the AST so that we always had a + // signature. + QualType T; + if (const TypeSourceInfo *TSI = BD->getSignatureAsWritten()) +T = TSI->getType(); + if (T.isNull()) +T = C.VoidTy; + if (!T->getAs()) +T = C.getFunctionNoProtoType(T); + T = C.getBlockPointerType(T); + return C.getCanonicalType(T); +} + const VarRegion* MemRegionManager::getVarRegion(const VarDecl *D, const LocationContext *LC) { const MemRegion *sReg = nullptr; @@ -803,7 +819,7 @@ const VarRegion* MemRegionManager::getVa sReg = getGlobalsRegion(); } - // Finally handle static locals. + // Finally handle locals. } else { // FIXME: Once we implement scope handling, we will need to properly lookup // 'D' to the proper LocationContext. @@ -816,9 +832,22 @@ const VarRegion* MemRegionManager::getVa const StackFrameContext *STC = V.get(); -if (!STC) - sReg = getUnknownRegion(); -else { +if (!STC) { + if (D->isStaticLocal()) { +const CodeTextRegion *fReg = nullptr; +if (const auto *ND = dyn_cast(DC)) + fReg = getFunctionCodeRegion(ND); +else if (const auto *BD = dyn_cast(DC)) + fReg = getBlockCodeRegion(BD, getBlockPointerType(BD, getContext()), +LC->getAnalysisDeclContext()); +assert(fReg && "Unable to determine code region for a static local!"); +sReg = getGlobalsRegion(MemRegion::StaticGlobalSpaceRegionKind, fReg); + } else { +// We're looking at a block-captured local variable, which may be either +// still local, or already moved to the heap. So we're not sure. +sReg = getUnknownRegion(); + } +} else { if (D->hasLocalStorage()) { sReg = isa(D) || isa(D) ? static_cast(getStackArgumentsRegion(STC)) @@ -831,22 +860,9 @@ const VarRegion* MemRegionManager::getVa sReg = getGlobalsRegion(MemRegion::StaticGlobalSpaceRegionKind, getFunctionCodeRegion(cast(STCD))); else if (const BlockDecl *BD = dyn_cast(STCD)) { - // FIXME: The fallback type here is totally bogus -- though it should - // never be queried, it will prevent uniquing with the real - // BlockCodeRegion. Ideally we'd fix the AST so that we always had a - // signature. - QualType T; - if (const TypeSourceInfo *TSI = BD->getSignatureAsWritten()) -T = TSI->getType(); - if (T.isNull()) -T = getContext().VoidTy; - if (!T->getAs()) -T = getContext().getFunctionNoProtoType(T); - T = getContext().getBlockPointerType(T); - const BlockCodeRegion *BTR = -getBlockCodeRegion(BD, C.getCanonicalType(T), - STC->getAnalysisDeclContext()); + getBlockCodeRegion(BD, getBlockPointerType(BD, getContext()), + STC->getAnalysisDeclContext()); sReg = getGlobalsRegion(MemRegion::StaticGlobalSpaceRegionKind, BTR); } Modified: cfe/trunk/test/Analysis/dispatch-once.m URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/dispa
Re: [libcxx] r291961 - Add _LIBCPP_DIAGNOSE_WARNING and _LIBCPP_DIAGNOSE_ERROR macros.
The only plan that we have at the moment is basically for a -Wno-user-defined-warnings-in-system-headers type of flag. I agree that it would be nice if we could be more granular than this, so I'll think about what we can do. On Mon, Jan 23, 2017 at 8:36 AM, Nico Weber wrote: > This happens to fire in practice in protobuf. It's probably a true > positive and it's cool that this warning found it, but it means we have to > disable Wuser-defined-warnings for a bit -- which then disables all of > these user-defined warnings. Right now there aren't any others, but it > feels like we'd want to have the ability to turn individual user-defined > warnings on or off instead of just having a single toggle for all of them. > Are there plans for something like that? > > On Fri, Jan 13, 2017 at 5:02 PM, Eric Fiselier via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > >> Author: ericwf >> Date: Fri Jan 13 16:02:08 2017 >> New Revision: 291961 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=291961&view=rev >> Log: >> Add _LIBCPP_DIAGNOSE_WARNING and _LIBCPP_DIAGNOSE_ERROR macros. >> >> Clang recently added a `diagnose_if(cond, msg, type)` attribute >> which can be used to generate diagnostics when `cond` is a constant >> expression that evaluates to true. Otherwise no attribute has no >> effect. >> >> This patch adds _LIBCPP_DIAGNOSE_ERROR/WARNING macros which >> use this new attribute. Additionally this patch implements >> a diagnostic message when a non-const-callable comparator is >> given to a container. >> >> Note: For now the warning version of the diagnostic is useless >> within libc++ since warning diagnostics are suppressed by the >> system header pragma. I'm going to work on fixing this. >> >> Added: >> libcxx/trunk/test/libcxx/containers/associative/non_const_co >> mparator.fail.cpp >> Modified: >> libcxx/trunk/docs/UsingLibcxx.rst >> libcxx/trunk/include/__config >> libcxx/trunk/include/__tree >> libcxx/trunk/include/map >> libcxx/trunk/include/type_traits >> libcxx/trunk/test/libcxx/compiler.py >> libcxx/trunk/test/libcxx/test/config.py >> libcxx/trunk/test/libcxx/test/format.py >> libcxx/trunk/test/libcxx/utilities/tuple/tuple.tuple/diagnos >> e_reference_binding.fail.cpp >> >> Modified: libcxx/trunk/docs/UsingLibcxx.rst >> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/UsingL >> ibcxx.rst?rev=291961&r1=291960&r2=291961&view=diff >> >> == >> --- libcxx/trunk/docs/UsingLibcxx.rst (original) >> +++ libcxx/trunk/docs/UsingLibcxx.rst Fri Jan 13 16:02:08 2017 >> @@ -173,3 +173,10 @@ thread safety annotations. >>return Tup{"hello world", 42}; // explicit constructor called. OK. >> } >> >> +**_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS**: >> + This macro disables the additional diagnostics generated by libc++ >> using the >> + `diagnose_if` attribute. These additional diagnostics include checks >> for: >> + >> +* Giving `set`, `map`, `multiset`, `multimap` a comparator which is >> not >> + const callable. >> + >> >> Modified: libcxx/trunk/include/__config >> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__c >> onfig?rev=291961&r1=291960&r2=291961&view=diff >> >> == >> --- libcxx/trunk/include/__config (original) >> +++ libcxx/trunk/include/__config Fri Jan 13 16:02:08 2017 >> @@ -1006,6 +1006,16 @@ _LIBCPP_FUNC_VIS extern "C" void __sanit >> #endif >> #endif >> >> +#if __has_attribute(diagnose_if) && !defined(_LIBCPP_DISABLE_ADDIT >> IONAL_DIAGNOSTICS) >> +# define _LIBCPP_DIAGNOSE_WARNING(...) \ >> +__attribute__((__diagnose_if__(__VA_ARGS__, "warning"))) >> +# define _LIBCPP_DIAGNOSE_ERROR(...) \ >> +__attribute__((__diagnose_if__(__VA_ARGS__, "error"))) >> +#else >> +# define _LIBCPP_DIAGNOSE_WARNING(...) >> +# define _LIBCPP_DIAGNOSE_ERROR(...) >> +#endif >> + >> #endif // __cplusplus >> >> #endif // _LIBCPP_CONFIG >> >> Modified: libcxx/trunk/include/__tree >> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__t >> ree?rev=291961&r1=291960&r2=291961&view=diff >> >> == >> --- libcxx/trunk/include/__tree (original) >> +++ libcxx/trunk/include/__tree Fri Jan 13 16:02:08 2017 >> @@ -41,6 +41,10 @@ template >> struct __value_type; >> #endif >> >> +template > +bool = is_empty<_Compare>::value && !__libcpp_is_final<_Compare>:: >> value> >> +class __map_value_compare; >> + >> template class __map_node_destructor; >> template class _LIBCPP_TEMPLATE_VIS __map_iterator; >> template class _LIBCPP_TEMPLATE_VIS >> __map_const_iterator; >> @@ -955,6 +959,30 @@ private: >> >> }; >> >> +#ifndef _LIBCPP_CXX03_LANG >> +template >> +struct __diagnose_tree_helper { >> + static constexpr bool __trigger_diagnostics() >> + _LIBCPP_DIAGNOSE_WARNING(!__is_const_compar
[PATCH] D28860: [OpenCL] Diagnose write_only image3d when extension is disabled
yaxunl added a comment. The tests should be added to SemaOpenCL/extension-version.cl Comment at: lib/Sema/SemaType.cpp:6683 + // access qualifier unless the cl_khr_3d_image_writes extension is enabled. + if (CurType->isOCLImage3dWOType() && + !S.getOpenCLOptions().isEnabled("cl_khr_3d_image_writes")) { should modify OpenCLImageTypes.def for image types associated with an extension. The diagnostics will be emitted automatically. https://reviews.llvm.org/D28860 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27257: [CodeCompletion] Ensure that ObjC root class completes instance methods from protocols and categories as well
bruno accepted this revision. bruno added a comment. This revision is now accepted and ready to land. Ok. Thanks Alex, LGTM Repository: rL LLVM https://reviews.llvm.org/D27257 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29038: [OpenCL] Accept logical NOT for pointer types in CL1.0 and CL1.1
arsenm added inline comments. Comment at: test/SemaOpenCL/logical-ops.cl:1-3 +// RUN: %clang_cc1 %s -verify -cl-std=CL1.1 -triple x86_64-unknown-linux-gnu +// RUN: %clang_cc1 %s -verify -cl-std=CL1.2 -triple x86_64-unknown-linux-gnu + Should this have a 2.0 run line for good measure? https://reviews.llvm.org/D29038 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29038: [OpenCL] Accept logical NOT for pointer types in CL1.0 and CL1.1
arsenm added inline comments. Comment at: test/SemaOpenCL/logical-ops.cl:1-3 +// RUN: %clang_cc1 %s -verify -cl-std=CL1.1 -triple x86_64-unknown-linux-gnu +// RUN: %clang_cc1 %s -verify -cl-std=CL1.2 -triple x86_64-unknown-linux-gnu + arsenm wrote: > Should this have a 2.0 run line for good measure? 1.0 too I suppose https://reviews.llvm.org/D29038 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27872: [APFloat] Switch from (PPCDoubleDoubleImpl, IEEEdouble) layout to (IEEEdouble, IEEEdouble)
echristo accepted this revision. echristo added a comment. This revision is now accepted and ready to land. This looks fine to me now, might be good to get someone else to ack as well though. https://reviews.llvm.org/D27872 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r292819 - Guard __gnuc_va_list typedef.
Author: probinson Date: Mon Jan 23 13:09:21 2017 New Revision: 292819 URL: http://llvm.org/viewvc/llvm-project?rev=292819&view=rev Log: Guard __gnuc_va_list typedef. Differential Revision: http://reviews.llvm.org/D28620 Added: cfe/trunk/test/Headers/stdarg-gnuc_va_list.c Modified: cfe/trunk/lib/Headers/stdarg.h Modified: cfe/trunk/lib/Headers/stdarg.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/stdarg.h?rev=292819&r1=292818&r2=292819&view=diff == --- cfe/trunk/lib/Headers/stdarg.h (original) +++ cfe/trunk/lib/Headers/stdarg.h Mon Jan 23 13:09:21 2017 @@ -43,10 +43,9 @@ typedef __builtin_va_list va_list; #define va_copy(dest, src) __builtin_va_copy(dest, src) #endif -/* Hack required to make standard headers work, at least on Ubuntu */ #ifndef __GNUC_VA_LIST #define __GNUC_VA_LIST 1 -#endif typedef __builtin_va_list __gnuc_va_list; +#endif #endif /* __STDARG_H */ Added: cfe/trunk/test/Headers/stdarg-gnuc_va_list.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/stdarg-gnuc_va_list.c?rev=292819&view=auto == --- cfe/trunk/test/Headers/stdarg-gnuc_va_list.c (added) +++ cfe/trunk/test/Headers/stdarg-gnuc_va_list.c Mon Jan 23 13:09:21 2017 @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wsystem-headers -std=c99 %s +// expected-no-diagnostics + +// Check that no warnings are emitted from stdarg.h if __gnuc_va_list has +// previously been defined in another header file. +typedef __builtin_va_list __va_list; +typedef __va_list __gnuc_va_list; +#define __GNUC_VA_LIST + +#include ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28620: Guard __gnuc_va_list typedef
This revision was automatically updated to reflect the committed changes. Closed by commit rL292819: Guard __gnuc_va_list typedef. (authored by probinson). Changed prior to commit: https://reviews.llvm.org/D28620?vs=84151&id=85430#toc Repository: rL LLVM https://reviews.llvm.org/D28620 Files: cfe/trunk/lib/Headers/stdarg.h cfe/trunk/test/Headers/stdarg-gnuc_va_list.c Index: cfe/trunk/test/Headers/stdarg-gnuc_va_list.c === --- cfe/trunk/test/Headers/stdarg-gnuc_va_list.c +++ cfe/trunk/test/Headers/stdarg-gnuc_va_list.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wsystem-headers -std=c99 %s +// expected-no-diagnostics + +// Check that no warnings are emitted from stdarg.h if __gnuc_va_list has +// previously been defined in another header file. +typedef __builtin_va_list __va_list; +typedef __va_list __gnuc_va_list; +#define __GNUC_VA_LIST + +#include Index: cfe/trunk/lib/Headers/stdarg.h === --- cfe/trunk/lib/Headers/stdarg.h +++ cfe/trunk/lib/Headers/stdarg.h @@ -43,10 +43,9 @@ #define va_copy(dest, src) __builtin_va_copy(dest, src) #endif -/* Hack required to make standard headers work, at least on Ubuntu */ #ifndef __GNUC_VA_LIST #define __GNUC_VA_LIST 1 -#endif typedef __builtin_va_list __gnuc_va_list; +#endif #endif /* __STDARG_H */ Index: cfe/trunk/test/Headers/stdarg-gnuc_va_list.c === --- cfe/trunk/test/Headers/stdarg-gnuc_va_list.c +++ cfe/trunk/test/Headers/stdarg-gnuc_va_list.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wsystem-headers -std=c99 %s +// expected-no-diagnostics + +// Check that no warnings are emitted from stdarg.h if __gnuc_va_list has +// previously been defined in another header file. +typedef __builtin_va_list __va_list; +typedef __va_list __gnuc_va_list; +#define __GNUC_VA_LIST + +#include Index: cfe/trunk/lib/Headers/stdarg.h === --- cfe/trunk/lib/Headers/stdarg.h +++ cfe/trunk/lib/Headers/stdarg.h @@ -43,10 +43,9 @@ #define va_copy(dest, src) __builtin_va_copy(dest, src) #endif -/* Hack required to make standard headers work, at least on Ubuntu */ #ifndef __GNUC_VA_LIST #define __GNUC_VA_LIST 1 -#endif typedef __builtin_va_list __gnuc_va_list; +#endif #endif /* __STDARG_H */ ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29027: [Stack Protection] Add remark for reasons why Stack Protection has been applied
rsmith added inline comments. Comment at: include/clang/Basic/DiagnosticFrontendKinds.td:229 +def remark_ssp_applied_reason +: Remark<"SSP applied to function due to %select{an unknown reason|a " + "call to alloca|a stack allocated buffer or struct containing a " Can this "unknown reason" case actually happen? It seems like a bug that SSP insertion would not know why it's doing what it's doing. Comment at: include/clang/Basic/DiagnosticFrontendKinds.td:229 +def remark_ssp_applied_reason +: Remark<"SSP applied to function due to %select{an unknown reason|a " + "call to alloca|a stack allocated buffer or struct containing a " rsmith wrote: > Can this "unknown reason" case actually happen? It seems like a bug that SSP > insertion would not know why it's doing what it's doing. Rather than the potentially-opaque initialism SSP, could you say "stack protector" here? That would match the flag name better. Comment at: include/clang/Basic/DiagnosticFrontendKinds.td:230 +: Remark<"SSP applied to function due to %select{an unknown reason|a " + "call to alloca|a stack allocated buffer or struct containing a " + "buffer|the address of a local variable being taken|a function " Do we actually know that the cause is a call to `alloca` rather than a VLA? Comment at: include/clang/Basic/DiagnosticFrontendKinds.td:232 + "buffer|the address of a local variable being taken|a function " + "attribute or use of -fstack-protector-all}0">, + InGroup; These two cases seem very easy to tell apart: if `-fstack-protector-all` is specified, use that diagnostic, otherwise the LLVM attribute must have been from a source-level attribute. Comment at: include/clang/Basic/DiagnosticGroups.td:911 +// function. +def SSPReason : DiagGroup<"ssp-reason">; The flags to control this are `-fstack-protector*`, so `-Rstack-protector` (or something starting `-Rstack-protector`) should be used here. https://reviews.llvm.org/D29027 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28889: Change where we handle arg-dependent diagnose_if attributes
rsmith added inline comments. Comment at: include/clang/Sema/Overload.h:758 /// instead. +/// FIXME: Now that it only alloates ImplicitConversionSequences, do we want +/// to un-generalize this? Typo "alloates" Comment at: lib/Sema/SemaChecking.cpp:2490 CallType); + diagnoseArgDependentDiagnoseIfAttrs(FDecl, /*ThisArg=*/nullptr, Args, Loc); } Can this be moved inside `checkCall`? https://reviews.llvm.org/D28889 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28835: [coroutines] NFC: Refactor Sema::CoroutineBodyStmt construction.
rsmith added a comment. Generally looks good, but we have a better way of modeling types with a trailing variable-length array that you should use. Comment at: include/clang/AST/StmtCXX.h:299 /// down the coroutine frame. class CoroutineBodyStmt : public Stmt { enum SubStmt { Please use `llvm::TrailingObjects` to store the trailing variable-length `SubStmts` array. Comment at: lib/Sema/SemaCoroutine.cpp:714-722 +// Try to form 'p.set_exception(std::current_exception());' to handle +// uncaught exceptions. +// TODO: Post WG21 Issaquah 2016 renamed set_exception to unhandled_exception +// TODO: and dropped exception_ptr parameter. Make it so. + + if (!PromiseRecordDecl) +return true; Reindent comments. https://reviews.llvm.org/D28835 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28510: Reinstate CWG1607 restrictions on lambdas appearing inside certain constant-expressions
rsmith requested changes to this revision. rsmith added a comment. This revision now requires changes to proceed. I don't think it's possible to check this in the way you're doing so here. In general, there's no way to know whether a constant expression will be part of a `typedef` declaration or function declaration until you've finished parsing it (when you're parsing the decl-specifiers in a declaration you don't know whether you're declaring a function or a variable, and the `typedef` keyword might appear later). So I think you need a different approach here. How about tracking the set of contained lambdas on the `Declarator` and `DeclSpec` objects, and diagnose from `ActOnFunctionDeclarator` / `ActOnTypedefDeclarator` if the current expression evaluation context contains any lambdas? (Maybe when entering an expression evaluation context, pass an optional `SmallVectorImpl*` to `Sema` to collect the lambdas contained within the expression.) There are some particularly "fun" cases to watch out for here: decltype([]{}) a, // ok f(); // ill-formed ... that require us to track the lambdas in the `DeclSpec` separately from the lambdas in the `Declarator`. Repository: rL LLVM https://reviews.llvm.org/D28510 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r292822 - Fixed a typo in __config that prevented the aligned new/delete tests from passing on Mac OS.
Author: marshall Date: Mon Jan 23 13:51:54 2017 New Revision: 292822 URL: http://llvm.org/viewvc/llvm-project?rev=292822&view=rev Log: Fixed a typo in __config that prevented the aligned new/delete tests from passing on Mac OS. Modified: libcxx/trunk/include/__config Modified: libcxx/trunk/include/__config URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=292822&r1=292821&r2=292822&view=diff == --- libcxx/trunk/include/__config (original) +++ libcxx/trunk/include/__config Mon Jan 23 13:51:54 2017 @@ -851,7 +851,7 @@ template struct __static_asse #if defined(__APPLE__) # if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \ defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) -# define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIROMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ +# define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ # endif # if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) # if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r292823 - Implement LWG#2778: basic_string_view is missing constexpr.
Author: marshall Date: Mon Jan 23 13:53:28 2017 New Revision: 292823 URL: http://llvm.org/viewvc/llvm-project?rev=292823&view=rev Log: Implement LWG#2778: basic_string_view is missing constexpr. Added: libcxx/trunk/test/std/strings/string.view/string.view.cons/assign.pass.cpp Modified: libcxx/trunk/include/string_view libcxx/trunk/www/cxx1z_status.html Modified: libcxx/trunk/include/string_view URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string_view?rev=292823&r1=292822&r2=292823&view=diff == --- libcxx/trunk/include/string_view (original) +++ libcxx/trunk/include/string_view Mon Jan 23 13:53:28 2017 @@ -206,7 +206,7 @@ public: _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY basic_string_view(const basic_string_view&) _NOEXCEPT = default; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY basic_string_view& operator=(const basic_string_view&) _NOEXCEPT = default; _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY @@ -235,16 +235,16 @@ public: _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY const_iterator cend() const _NOEXCEPT { return __data + __size; } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX14 _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(cend()); } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX14 _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(cbegin()); } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX14 _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crbegin() const _NOEXCEPT { return const_reverse_iterator(cend()); } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX14 _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend()const _NOEXCEPT { return const_reverse_iterator(cbegin()); } // [string.view.capacity], capacity Added: libcxx/trunk/test/std/strings/string.view/string.view.cons/assign.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/string.view/string.view.cons/assign.pass.cpp?rev=292823&view=auto == --- libcxx/trunk/test/std/strings/string.view/string.view.cons/assign.pass.cpp (added) +++ libcxx/trunk/test/std/strings/string.view/string.view.cons/assign.pass.cpp Mon Jan 23 13:53:28 2017 @@ -0,0 +1,50 @@ +//===--===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===--===// + + +// + +// constexpr basic_string_view& operator=(const basic_string_view &) noexcept = default; + +#include +#include + +#include "test_macros.h" + +template +#if TEST_STD_VER > 11 +constexpr +#endif +bool test (T sv0) +{ +T sv1; +sv1 = sv0; +// We can't just say "sv0 == sv1" here because string_view::compare +// isn't constexpr until C++17, and we want to support back to C++14 +return sv0.size() == sv1.size() && sv0.data() == sv1.data(); +} + +int main () { + +assert( test( "1234")); +#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS +assert( test (u"1234")); +assert( test (U"1234")); +#endif +assert( test (L"1234")); + +#if TEST_STD_VER > 11 +static_assert( test({ "abc", 3}), ""); +#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS +static_assert( test ({u"abc", 3}), ""); +static_assert( test ({U"abc", 3}), ""); +#endif +static_assert( test ({L"abc", 3}), ""); +#endif +} Modified: libcxx/trunk/www/cxx1z_status.html URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=292823&r1=292822&r2=292823&view=diff == --- libcxx/trunk/www/cxx1z_status.html (original) +++ libcxx/trunk/www/cxx1z_status.html Mon Jan 23 13:53:28 2017 @@ -409,7 +409,7 @@ http://wg21.link/LWG2771";>2771Broken Effects of some basic_string::compare functions in terms of basic_string_viewIssaquahComplete http://wg21.link/LWG2773";>2773Making std::ignore constexprIssaquah http://wg21.link/LWG2777";>2777basic_string_view::copy should use char_traits::copyIssaquahComplete - http://wg21.link/LWG2778";>2778basic_string_view is missing constexprIssaquah + http://wg21.link/LWG2778";>2778basic_string_view is missing constexprIssaquahComplete - Last Updated: 19-Jan-2017 + Last Updated: 23-Jan-2017 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http
[PATCH] D28520: Disable -Wthread-safety-analysis for some functions in __thread_support
dim updated this revision to Diff 85440. dim added a comment. In https://reviews.llvm.org/D28520#653360, @aaron.ballman wrote: > In https://reviews.llvm.org/D28520#652607, @dim wrote: > > > > [...] >> I'm really open to any variant, as long as something that works can get in >> before the 4.0.0 release. :) > > I feel like there's still some confusion here (likely on my part). DeLesley > was asking if there was a way to turn this off for everyone *except* FreeBSD > (that is user-controllable), but your code turns it off specifically *for* > FreeBSD with no option to enable. The part that has me confused is that > FreeBSD is annotating their functionality specifically to enable thread > safety checking; it seems like turning that checking off rather than > supporting it is the wrong way to go. I think that may be why DeLesley was > saying to disable the functionality for non-FreeBSD systems while still > honoring it on FreeBSD, but if I'm confused, hopefully he'll clarify. Ok, so let's go back to the previous variant, but with conditionals to be able to turn checking on, if so desired, using `_LIBCPP_ENABLE_THREAD_SAFETY_ATTRIBUTE`. Checking is on by default for FreeBSD only, but can still be disabled explicitly by defining `_LIBCPP_DISABLE_THREAD_SAFETY_ATTRIBUTE`. https://reviews.llvm.org/D28520 Files: include/__threading_support Index: include/__threading_support === --- include/__threading_support +++ include/__threading_support @@ -40,14 +40,30 @@ #define _LIBCPP_THREAD_ABI_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY #endif +#if defined(__FreeBSD__) && !defined(_LIBCPP_DISABLE_THREAD_SAFETY_ATTRIBUTE) && \ +!defined(_LIBCPP_ENABLE_THREAD_SAFETY_ATTRIBUTE) +# define _LIBCPP_ENABLE_THREAD_SAFETY_ATTRIBUTE +#endif + +#ifndef _LIBCPP_THREAD_SAFETY_ATTRIBUTE +# if defined(__clang__) && __has_attribute(acquire_capability) && \ + defined(_LIBCPP_ENABLE_THREAD_SAFETY_ATTRIBUTE) +# define _LIBCPP_THREAD_SAFETY_ATTRIBUTE(x) __attribute__((x)) +# else +# define _LIBCPP_THREAD_SAFETY_ATTRIBUTE(x) +# endif +#endif + _LIBCPP_BEGIN_NAMESPACE_STD #if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) // Mutex -typedef pthread_mutex_t __libcpp_mutex_t; +typedef pthread_mutex_t __libcpp_mutex_t +_LIBCPP_THREAD_SAFETY_ATTRIBUTE(capability("mutex")); #define _LIBCPP_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER -typedef pthread_mutex_t __libcpp_recursive_mutex_t; +typedef pthread_mutex_t __libcpp_recursive_mutex_t +_LIBCPP_THREAD_SAFETY_ATTRIBUTE(capability("mutex")); // Condition Variable typedef pthread_cond_t __libcpp_condvar_t; @@ -71,10 +87,12 @@ #define _LIBCPP_TLS_DESTRUCTOR_CC #else // Mutex -typedef SRWLOCK __libcpp_mutex_t; +typedef SRWLOCK __libcpp_mutex_t +_LIBCPP_THREAD_SAFETY_ATTRIBUTE(capability("mutex")); #define _LIBCPP_MUTEX_INITIALIZER SRWLOCK_INIT -typedef CRITICAL_SECTION __libcpp_recursive_mutex_t; +typedef CRITICAL_SECTION __libcpp_recursive_mutex_t +_LIBCPP_THREAD_SAFETY_ATTRIBUTE(capability("mutex")); // Condition Variable typedef CONDITION_VARIABLE __libcpp_condvar_t; @@ -103,25 +121,31 @@ int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m); _LIBCPP_THREAD_ABI_VISIBILITY -int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m); +int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m) +_LIBCPP_THREAD_SAFETY_ATTRIBUTE(acquire_capability(*__m)); _LIBCPP_THREAD_ABI_VISIBILITY -bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m); +bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m) +_LIBCPP_THREAD_SAFETY_ATTRIBUTE(try_acquire_capability(true, *__m)); _LIBCPP_THREAD_ABI_VISIBILITY -int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t *__m); +int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t *__m) +_LIBCPP_THREAD_SAFETY_ATTRIBUTE(release_capability(*__m)); _LIBCPP_THREAD_ABI_VISIBILITY int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t *__m); _LIBCPP_THREAD_ABI_VISIBILITY -int __libcpp_mutex_lock(__libcpp_mutex_t *__m); +int __libcpp_mutex_lock(__libcpp_mutex_t *__m) +_LIBCPP_THREAD_SAFETY_ATTRIBUTE(acquire_capability(*__m)); _LIBCPP_THREAD_ABI_VISIBILITY -bool __libcpp_mutex_trylock(__libcpp_mutex_t *__m); +bool __libcpp_mutex_trylock(__libcpp_mutex_t *__m) +_LIBCPP_THREAD_SAFETY_ATTRIBUTE(try_acquire_capability(true, *__m)); _LIBCPP_THREAD_ABI_VISIBILITY -int __libcpp_mutex_unlock(__libcpp_mutex_t *__m); +int __libcpp_mutex_unlock(__libcpp_mutex_t *__m) +_LIBCPP_THREAD_SAFETY_ATTRIBUTE(release_capability(*__m)); _LIBCPP_THREAD_ABI_VISIBILITY int __libcpp_mutex_destroy(__libcpp_mutex_t *__m); @@ -134,11 +158,13 @@ int __libcpp_condvar_broadcast(__libcpp_condvar_t* __cv); _LIBCPP_THREAD_ABI_VISIBILITY -int __libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m); +int __libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m) +
[PATCH] D26110: Add a check for GCC to the _LIBCPP_EXPLICIT define
mclow.lists added a comment. Ok, this is weird. It looks like the changes to <__config> got committed, but not the test. https://reviews.llvm.org/D26110 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27680: [CodeGen] Move lifetime.start of a variable when goto jumps back past its declaration
rjmccall added inline comments. Comment at: lib/CodeGen/CodeGenFunction.h:217 + /// statements. + llvm::SmallVector LabelSeenStack; + Shouldn't this be maintained by some existing scoping structure like LexicalScope? Comment at: lib/CodeGen/CodeGenFunction.h:236 +LabelSeenStack.back() = true; + } + A label in a nested scope acts like a label in outer scopes, too. https://reviews.llvm.org/D27680 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28526: [ARM] Add diagnostics when initialization global variables with ropi/rwpi
weimingz updated this revision to Diff 85446. weimingz edited the summary of this revision. weimingz added a comment. As Eli sugguested, it's better to check it in Sema. In order to access RelocationModel in Sema, we moved it from CodeGenOpts to LangOpts https://reviews.llvm.org/D28526 Files: include/clang/Basic/LangOptions.def include/clang/Basic/LangOptions.h include/clang/Frontend/CodeGenOptions.h lib/AST/ExprConstant.cpp lib/CodeGen/BackendUtil.cpp lib/Frontend/CodeGenOptions.cpp lib/Frontend/CompilerInvocation.cpp test/CodeGen/arm-ropi-rwpi.c test/Sema/ropi-rwpi.c Index: test/Sema/ropi-rwpi.c === --- /dev/null +++ test/Sema/ropi-rwpi.c @@ -0,0 +1,65 @@ +// OK with local initialization, rwpi with const gv and ropi with non-const gv. +// RUN: %clang_cc1 -triple armv7 -DDEFAULT -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple armv7 -DROPI -mrelocation-model ropi -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple armv7 -DRWPI -mrelocation-model rwpi -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple armv7 -DROPI -DRWPI -mrelocation-model ropi-rwpi -fsyntax-only -verify %s + +extern int func(const int* const []); + +extern int gv; +extern const int c_gv; + +void *p1 = &func; +const void *p2 = &c_gv; +const int *p_compound_literal_c = &(const int){1}; + +void ropi_test() { + static void *sp1 = &func; + static const void *sp2 = &c_gv; + static char(*x)[7] = &"abcdef"; + static const void *x2 = &__func__; + static const int *const arr[2] = {&c_gv, &c_gv}; + static void *addr = &&label1; +label1: + return; +} + +void *p3 = &gv; +int *p_compound_literal = &(int){1}; + +void rwpi_test() { + static void *sp1 = &gv; + static int *const arr[2] = {&gv, &gv}; +} + +unsigned test() { + unsigned a = (unsigned)&func; + unsigned b = (unsigned)&gv; + unsigned c = (unsigned)&c_gv; + return a + b + c; +} + +#ifdef DEFAULT +// expected-no-diagnostics +#endif + +#if defined(ROPI) +// expected-error@12 {{initializer element is not a compile-time constant}} +// expected-error@13 {{initializer element is not a compile-time constant}} +// expected-error@14 {{initializer element is not a compile-time constant}} + +// expected-error@17 {{initializer element is not a compile-time constant}} +// expected-error@18 {{initializer element is not a compile-time constant}} +// expected-error@19 {{initializer element is not a compile-time constant}} +// expected-error@20 {{initializer element is not a compile-time constant}} +// expected-error@21 {{initializer element is not a compile-time constant}} +// expected-error@22 {{initializer element is not a compile-time constant}} +#endif + +#if defined(RWPI) +// expected-error@27 {{initializer element is not a compile-time constant}} +// expected-error@28 {{initializer element is not a compile-time constant}} + +// expected-error@31 {{initializer element is not a compile-time constant}} +// expected-error@32 {{initializer element is not a compile-time constant}} +#endif Index: test/CodeGen/arm-ropi-rwpi.c === --- /dev/null +++ test/CodeGen/arm-ropi-rwpi.c @@ -0,0 +1,32 @@ +// REQUIRES: arm-registered-target + +// Below tests check if memcpy is not generated with ropi/rwpi for local var initialization. +// RUN: %clang_cc1 -triple armv7 -S -emit-llvm -o - %s | FileCheck %s --check-prefix=DEFAULT +// RUN: %clang_cc1 -triple armv7 -S -emit-llvm -mrelocation-model ropi -o - %s | FileCheck %s --check-prefix=ROPI +// RUN: %clang_cc1 -triple armv7 -S -emit-llvm -mrelocation-model rwpi -o - %s | FileCheck %s --check-prefix=RWPI +// RUN: %clang_cc1 -triple armv7 -S -emit-llvm -mrelocation-model ropi-rwpi -o - %s | FileCheck %s --check-prefix=ROPI_RWPI + +extern int gv; +extern const int c_gv; + +void test_local() { +// DEFAULT-LABEL: @test_local +// DEFAULT: call void @{{llvm.memcpy.*@test_local.x}} +// DEFAULT: call void @{{llvm.memcpy.*@test_local.y}} + +// ROPI-LABEL: @test_local +// ROPI: call void @{{llvm.memcpy.*@test_local.x}} +// ROPI-NOT: call void@llvm.memcpy + +// RWPI-LABEL: @test_local +// RWPI-NOT: call void@{{llvm.memcpy.*@test_local.x}} +// RWPI: call void @{{llvm.memcpy.*@test_local.y}} + +// ROPI_RWPI-LABEL: @test_local +// ROPI_RWPI-NOT: call void @llvm.memcpy + + const int *x[] = {&gv, &gv, &gv}; // This is OK, no diagnostic. + func(x); + const int *y[] = {&c_gv, &c_gv, &c_gv}; // This is OK, no diagnostic. + func(y); +} Index: lib/Frontend/CompilerInvocation.cpp === --- lib/Frontend/CompilerInvocation.cpp +++ lib/Frontend/CompilerInvocation.cpp @@ -610,7 +610,6 @@ Args.hasArg(OPT_cl_unsafe_math_optimizations) || Args.hasArg(OPT_cl_fast_relaxed_math); Opts.UnwindTables = Args.hasArg(OPT_munwind_tables); - Opts.RelocationModel = Args.getLastArgValue(OPT_mrelocation_model, "pic"); Opts.ThreadMod
[PATCH] D26110: Add a check for GCC to the _LIBCPP_EXPLICIT define
EricWF added a comment. I think I may have committed these changes as part of another change set. https://reviews.llvm.org/D26110 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27800: Add overload of TransformToPotentiallyEvaluated for TypeSourceInfo
efriedma added inline comments. Comment at: lib/Sema/SemaExpr.cpp:4031 // C99 6.5.3.4p4: the type (an unsigned integer type) is size_t. + if (isUnevaluatedContext() && ExprKind == UETT_SizeOf && + TInfo->getType()->isVariablyModifiedType()) Is the isUnevaluatedContext() check here necessary? Comment at: test/SemaCXX/pr31042.cpp:1 +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -emit-obj -disable-free %s + -emit-obj ? Comment at: test/SemaCXX/pr31042.cpp:3 + +extern void abort (void); + Is this declaration necessary somehow? https://reviews.llvm.org/D27800 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r292830 - Fix GCC C++03 build by hiding default template argument in C++03
Author: ericwf Date: Mon Jan 23 15:24:58 2017 New Revision: 292830 URL: http://llvm.org/viewvc/llvm-project?rev=292830&view=rev Log: Fix GCC C++03 build by hiding default template argument in C++03 Modified: libcxx/trunk/include/string Modified: libcxx/trunk/include/string URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=292830&r1=292829&r2=292830&view=diff == --- libcxx/trunk/include/string (original) +++ libcxx/trunk/include/string Mon Jan 23 15:24:58 2017 @@ -818,7 +818,10 @@ public: operator __self_view() const _NOEXCEPT { return __self_view(data(), size()); } basic_string& operator=(const basic_string& __str); + +#ifndef _LIBCPP_CXX03_LANG template +#endif _LIBCPP_INLINE_VISIBILITY basic_string& operator=(__self_view __sv) {return assign(__sv);} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r292830 - Fix GCC C++03 build by hiding default template argument in C++03
This patch should be merge into the 4.0 branch. It fixes a bug introduced to the 4.0 branch in r292354 ( https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216054). /Eric On Mon, Jan 23, 2017 at 2:24 PM, Eric Fiselier via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: ericwf > Date: Mon Jan 23 15:24:58 2017 > New Revision: 292830 > > URL: http://llvm.org/viewvc/llvm-project?rev=292830&view=rev > Log: > Fix GCC C++03 build by hiding default template argument in C++03 > > Modified: > libcxx/trunk/include/string > > Modified: libcxx/trunk/include/string > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/ > string?rev=292830&r1=292829&r2=292830&view=diff > > == > --- libcxx/trunk/include/string (original) > +++ libcxx/trunk/include/string Mon Jan 23 15:24:58 2017 > @@ -818,7 +818,10 @@ public: > operator __self_view() const _NOEXCEPT { return __self_view(data(), > size()); } > > basic_string& operator=(const basic_string& __str); > + > +#ifndef _LIBCPP_CXX03_LANG > template > +#endif > _LIBCPP_INLINE_VISIBILITY > basic_string& operator=(__self_view __sv) {return assign(__sv);} > #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r292800 - [analyzer] Fix memory space of static locals seen from nested blocks.
Sounds good to me. Anna, you're the code owner here. Ok to merge this? Thanks, Hans On Mon, Jan 23, 2017 at 10:37 AM, Artem Dergachev wrote: > Hans, > > Could we merge this one into the 4.0.0 release branch? It's a recent bugfix > for the analyzer. > > Thanks, > Artem. > > > > On 1/23/17 7:57 PM, Artem Dergachev via cfe-commits wrote: >> >> Author: dergachev >> Date: Mon Jan 23 10:57:11 2017 >> New Revision: 292800 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=292800&view=rev >> Log: >> [analyzer] Fix memory space of static locals seen from nested blocks. >> >> When a block within a function accesses a function's static local >> variable, >> this local is captured by reference rather than copied to the heap. >> >> Therefore this variable's memory space is known: StaticGlobalSpaceRegion. >> Used to be UnknownSpaceRegion, same as for stack locals. >> >> Fixes a false positive in MacOSXAPIChecker. >> >> rdar://problem/30105546 >> Differential revision: https://reviews.llvm.org/D28946 >> >> Modified: >> cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp >> cfe/trunk/test/Analysis/dispatch-once.m >> >> Modified: cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp?rev=292800&r1=292799&r2=292800&view=diff >> >> == >> --- cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp (original) >> +++ cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp Mon Jan 23 10:57:11 >> 2017 >> @@ -776,6 +776,22 @@ getStackOrCaptureRegionForDeclContext(co >> return (const StackFrameContext *)nullptr; >> } >> +static CanQualType getBlockPointerType(const BlockDecl *BD, ASTContext >> &C) { >> + // FIXME: The fallback type here is totally bogus -- though it should >> + // never be queried, it will prevent uniquing with the real >> + // BlockCodeRegion. Ideally we'd fix the AST so that we always had a >> + // signature. >> + QualType T; >> + if (const TypeSourceInfo *TSI = BD->getSignatureAsWritten()) >> +T = TSI->getType(); >> + if (T.isNull()) >> +T = C.VoidTy; >> + if (!T->getAs()) >> +T = C.getFunctionNoProtoType(T); >> + T = C.getBlockPointerType(T); >> + return C.getCanonicalType(T); >> +} >> + >> const VarRegion* MemRegionManager::getVarRegion(const VarDecl *D, >> const LocationContext >> *LC) { >> const MemRegion *sReg = nullptr; >> @@ -803,7 +819,7 @@ const VarRegion* MemRegionManager::getVa >> sReg = getGlobalsRegion(); >> } >> - // Finally handle static locals. >> + // Finally handle locals. >> } else { >> // FIXME: Once we implement scope handling, we will need to properly >> lookup >> // 'D' to the proper LocationContext. >> @@ -816,9 +832,22 @@ const VarRegion* MemRegionManager::getVa >> const StackFrameContext *STC = V.get(); >> -if (!STC) >> - sReg = getUnknownRegion(); >> -else { >> +if (!STC) { >> + if (D->isStaticLocal()) { >> +const CodeTextRegion *fReg = nullptr; >> +if (const auto *ND = dyn_cast(DC)) >> + fReg = getFunctionCodeRegion(ND); >> +else if (const auto *BD = dyn_cast(DC)) >> + fReg = getBlockCodeRegion(BD, getBlockPointerType(BD, >> getContext()), >> +LC->getAnalysisDeclContext()); >> +assert(fReg && "Unable to determine code region for a static >> local!"); >> +sReg = getGlobalsRegion(MemRegion::StaticGlobalSpaceRegionKind, >> fReg); >> + } else { >> +// We're looking at a block-captured local variable, which may be >> either >> +// still local, or already moved to the heap. So we're not sure. >> +sReg = getUnknownRegion(); >> + } >> +} else { >> if (D->hasLocalStorage()) { >> sReg = isa(D) || isa(D) >> ? static_cast> MemRegion*>(getStackArgumentsRegion(STC)) >> @@ -831,22 +860,9 @@ const VarRegion* MemRegionManager::getVa >> sReg = >> getGlobalsRegion(MemRegion::StaticGlobalSpaceRegionKind, >> >> getFunctionCodeRegion(cast(STCD))); >> else if (const BlockDecl *BD = dyn_cast(STCD)) { >> - // FIXME: The fallback type here is totally bogus -- though it >> should >> - // never be queried, it will prevent uniquing with the real >> - // BlockCodeRegion. Ideally we'd fix the AST so that we always >> had a >> - // signature. >> - QualType T; >> - if (const TypeSourceInfo *TSI = BD->getSignatureAsWritten()) >> -T = TSI->getType(); >> - if (T.isNull()) >> -T = getContext().VoidTy; >> - if (!T->getAs()) >> -T = getContext().getFunctionNoProtoType(T); >> - T = getContext().getBlockPointerType(T); >> - >> const BlockCodeRegion *BTR = >> -getBlockCodeRegion(BD, C.getCanonica
[libcxx] r292833 - Manually force the use of __decltype in C++03 with Clang 3.4.
Author: ericwf Date: Mon Jan 23 15:41:13 2017 New Revision: 292833 URL: http://llvm.org/viewvc/llvm-project?rev=292833&view=rev Log: Manually force the use of __decltype in C++03 with Clang 3.4. uses `decltype` in a way incompatible with `__typeof__`. This is problematic when compiling with Clang 3.4 because even though it provides `__decltype` libc++ still used `__typeof__` because clang 3.4 doesn't provide __is_identifier which libc++ uses to detect __decltype. This patch manually detects Clang 3.4 and properly configures for it. Modified: libcxx/trunk/include/__config Modified: libcxx/trunk/include/__config URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=292833&r1=292832&r2=292833&view=diff == --- libcxx/trunk/include/__config (original) +++ libcxx/trunk/include/__config Mon Jan 23 15:41:13 2017 @@ -109,6 +109,9 @@ #if defined(__clang__) #define _LIBCPP_COMPILER_CLANG +# ifndef __apple_build_version__ +# define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__) +# endif #elif defined(__GNUC__) #define _LIBCPP_COMPILER_GCC #elif defined(_MSC_VER) @@ -117,6 +120,10 @@ #define _LIBCPP_COMPILER_IBM #endif +#ifndef _LIBCPP_CLANG_VER +#define _LIBCPP_CLANG_VER 0 +#endif + // FIXME: ABI detection should be done via compiler builtin macros. This // is just a placeholder until Clang implements such macros. For now assume // that Windows compilers pretending to be MSVC++ target the microsoft ABI. @@ -754,7 +761,7 @@ template struct __static_asse #ifdef _LIBCPP_HAS_NO_DECLTYPE // GCC 4.6 provides __decltype in all standard modes. -#if __has_keyword(__decltype) || _GNUC_VER >= 406 +#if __has_keyword(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406 # define decltype(__x) __decltype(__x) #else # define decltype(__x) __typeof__(__x) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r292830 - Fix GCC C++03 build by hiding default template argument in C++03
We merged the first one, so I suppose we better fix it :-) Sounds good to me. On Mon, Jan 23, 2017 at 1:37 PM, Eric Fiselier wrote: > This patch should be merge into the 4.0 branch. > > It fixes a bug introduced to the 4.0 branch in r292354 > (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216054). > > /Eric > > On Mon, Jan 23, 2017 at 2:24 PM, Eric Fiselier via cfe-commits > wrote: >> >> Author: ericwf >> Date: Mon Jan 23 15:24:58 2017 >> New Revision: 292830 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=292830&view=rev >> Log: >> Fix GCC C++03 build by hiding default template argument in C++03 >> >> Modified: >> libcxx/trunk/include/string >> >> Modified: libcxx/trunk/include/string >> URL: >> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=292830&r1=292829&r2=292830&view=diff >> >> == >> --- libcxx/trunk/include/string (original) >> +++ libcxx/trunk/include/string Mon Jan 23 15:24:58 2017 >> @@ -818,7 +818,10 @@ public: >> operator __self_view() const _NOEXCEPT { return __self_view(data(), >> size()); } >> >> basic_string& operator=(const basic_string& __str); >> + >> +#ifndef _LIBCPP_CXX03_LANG >> template >> +#endif >> _LIBCPP_INLINE_VISIBILITY >> basic_string& operator=(__self_view __sv) {return assign(__sv);} >> #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES >> >> >> ___ >> cfe-commits mailing list >> cfe-commits@lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r292822 - Fixed a typo in __config that prevented the aligned new/delete tests from passing on Mac OS.
This patch needs to get merged into 4.0 since the offending commit with the misspelling is in the 4.0 branch. /Eric On Mon, Jan 23, 2017 at 12:51 PM, Marshall Clow via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: marshall > Date: Mon Jan 23 13:51:54 2017 > New Revision: 292822 > > URL: http://llvm.org/viewvc/llvm-project?rev=292822&view=rev > Log: > Fixed a typo in __config that prevented the aligned new/delete tests from > passing on Mac OS. > > Modified: > libcxx/trunk/include/__config > > Modified: libcxx/trunk/include/__config > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__ > config?rev=292822&r1=292821&r2=292822&view=diff > > == > --- libcxx/trunk/include/__config (original) > +++ libcxx/trunk/include/__config Mon Jan 23 13:51:54 2017 > @@ -851,7 +851,7 @@ template struct __static_asse > #if defined(__APPLE__) > # if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \ > defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) > -# define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIROMENT_MAC_OS_X_VERSION_ > MIN_REQUIRED__ > +# define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION > _MIN_REQUIRED__ > # endif > # if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) > # if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060 > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r292833 - Manually force the use of __decltype in C++03 with Clang 3.4.
This patch should be merge into 4.0 since it is needed to fix compile time regressions in when using Clang 3.4 and C++03. See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216054 for more info. /Eric On Mon, Jan 23, 2017 at 2:41 PM, Eric Fiselier via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: ericwf > Date: Mon Jan 23 15:41:13 2017 > New Revision: 292833 > > URL: http://llvm.org/viewvc/llvm-project?rev=292833&view=rev > Log: > Manually force the use of __decltype in C++03 with Clang 3.4. > > uses `decltype` in a way incompatible with `__typeof__`. > This is problematic when compiling with Clang 3.4 because > even though it provides `__decltype` libc++ still used `__typeof__` > because clang 3.4 doesn't provide __is_identifier which libc++ > uses to detect __decltype. > > This patch manually detects Clang 3.4 and properly configures > for it. > > Modified: > libcxx/trunk/include/__config > > Modified: libcxx/trunk/include/__config > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/_ > _config?rev=292833&r1=292832&r2=292833&view=diff > > == > --- libcxx/trunk/include/__config (original) > +++ libcxx/trunk/include/__config Mon Jan 23 15:41:13 2017 > @@ -109,6 +109,9 @@ > > #if defined(__clang__) > #define _LIBCPP_COMPILER_CLANG > +# ifndef __apple_build_version__ > +# define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__) > +# endif > #elif defined(__GNUC__) > #define _LIBCPP_COMPILER_GCC > #elif defined(_MSC_VER) > @@ -117,6 +120,10 @@ > #define _LIBCPP_COMPILER_IBM > #endif > > +#ifndef _LIBCPP_CLANG_VER > +#define _LIBCPP_CLANG_VER 0 > +#endif > + > // FIXME: ABI detection should be done via compiler builtin macros. This > // is just a placeholder until Clang implements such macros. For now > assume > // that Windows compilers pretending to be MSVC++ target the microsoft > ABI. > @@ -754,7 +761,7 @@ template struct __static_asse > > #ifdef _LIBCPP_HAS_NO_DECLTYPE > // GCC 4.6 provides __decltype in all standard modes. > -#if __has_keyword(__decltype) || _GNUC_VER >= 406 > +#if __has_keyword(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= > 406 > # define decltype(__x) __decltype(__x) > #else > # define decltype(__x) __typeof__(__x) > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r291905 - [Sema] Add warning for unused lambda captures
On Sun, Jan 22, 2017 at 6:17 AM, Malcolm Parsons wrote: > On 20 January 2017 at 21:32, Nico Weber wrote: > > This warns about code like > > > > constexpr int foo = 4; > > [&foo]() { use(foo); } > > > > That's correct, but removing &foo then makes MSVC complain about this > code > > like "error C3493: 'foo' cannot be implicitly captured because no default > > capture mode has been specified". A workaround is to make foo static > const > > instead of constexpr. > > > > This seems like an MSVC bug, but it's still a bit annoying that clang now > > suggests doing things that won't build in other compilers. Any ideas > what to > > do about this? > > Should Clang care about the behaviour of other compilers that don't > follow the standard? > clang should be a compiler that people like to use. Multi-platform development isn't super uncommon, so trying to give a good experience in that case seems like a good thing to me -- and we've tried to do that in the past pretty hard. It's possible that "do nothing" is the right thing, but "well that other compiler is buggy" seems like a somewhat oversimplified reply. > You could: > Disable the warning on the command line. > Disable the warning with a pragma. > It's an error, not a warning. > Cast foo to void inside the lambda. > That's equivalent to disabling the clang warning in those cases (which would be a shame, since the warning is super useful, and it doesn't introduce problems in most cases -- only with local constexprs). Maybe the warning could be split in two, so that it can be toggled separately for constexpr? > Only capture foo when building with MSVC. Stop building with MSVC. > This reply like this make me believe you think it was silly to even report this problem. I don't think it's silly, and there's ample precedent in clang to make it work well in the actual world instead of in a world we wished we lived in. > Complain to Microsoft. > Already done. The reality is that their shipping compiler produces this diagnostic, and the current 2017 build does too. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r292822 - Fixed a typo in __config that prevented the aligned new/delete tests from passing on Mac OS.
Ok, go ahead. On Mon, Jan 23, 2017 at 1:54 PM, Eric Fiselier wrote: > This patch needs to get merged into 4.0 since the offending commit with the > misspelling is in the 4.0 branch. > > /Eric > > > On Mon, Jan 23, 2017 at 12:51 PM, Marshall Clow via cfe-commits > wrote: >> >> Author: marshall >> Date: Mon Jan 23 13:51:54 2017 >> New Revision: 292822 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=292822&view=rev >> Log: >> Fixed a typo in __config that prevented the aligned new/delete tests from >> passing on Mac OS. >> >> Modified: >> libcxx/trunk/include/__config >> >> Modified: libcxx/trunk/include/__config >> URL: >> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=292822&r1=292821&r2=292822&view=diff >> >> == >> --- libcxx/trunk/include/__config (original) >> +++ libcxx/trunk/include/__config Mon Jan 23 13:51:54 2017 >> @@ -851,7 +851,7 @@ template struct __static_asse >> #if defined(__APPLE__) >> # if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \ >> defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) >> -# define __MAC_OS_X_VERSION_MIN_REQUIRED >> __ENVIROMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >> +# define __MAC_OS_X_VERSION_MIN_REQUIRED >> __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >> # endif >> # if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) >> # if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060 >> >> >> ___ >> cfe-commits mailing list >> cfe-commits@lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28520: Disable -Wthread-safety-analysis for some functions in __thread_support
EricWF added a comment. @dim I would really rather just suppress these warnings if we want them merged into 4.0. https://reviews.llvm.org/D28520 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r291961 - Add _LIBCPP_DIAGNOSE_WARNING and _LIBCPP_DIAGNOSE_ERROR macros.
My dream, and something I would like to work towards is supporting something like this: > [[clang::libcxx_diagnose_if(cond, "message", "warning", /* warning-id*/ "non-const-functor")]] > > -Wno-libcxx-warnings=non-const-functor This way libc++ warnings get treated differently from all other users of diagnose_if, and can be enabled and disabled separately. @George does this sound like a reasonable goal? If so I'm happy to start working on this. /Eric On Mon, Jan 23, 2017 at 11:46 AM, George Burgess wrote: > The only plan that we have at the moment is basically for a > -Wno-user-defined-warnings-in-system-headers type of flag. I agree that > it would be nice if we could be more granular than this, so I'll think > about what we can do. > > On Mon, Jan 23, 2017 at 8:36 AM, Nico Weber wrote: > >> This happens to fire in practice in protobuf. It's probably a true >> positive and it's cool that this warning found it, but it means we have to >> disable Wuser-defined-warnings for a bit -- which then disables all of >> these user-defined warnings. Right now there aren't any others, but it >> feels like we'd want to have the ability to turn individual user-defined >> warnings on or off instead of just having a single toggle for all of them. >> Are there plans for something like that? >> >> On Fri, Jan 13, 2017 at 5:02 PM, Eric Fiselier via cfe-commits < >> cfe-commits@lists.llvm.org> wrote: >> >>> Author: ericwf >>> Date: Fri Jan 13 16:02:08 2017 >>> New Revision: 291961 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=291961&view=rev >>> Log: >>> Add _LIBCPP_DIAGNOSE_WARNING and _LIBCPP_DIAGNOSE_ERROR macros. >>> >>> Clang recently added a `diagnose_if(cond, msg, type)` attribute >>> which can be used to generate diagnostics when `cond` is a constant >>> expression that evaluates to true. Otherwise no attribute has no >>> effect. >>> >>> This patch adds _LIBCPP_DIAGNOSE_ERROR/WARNING macros which >>> use this new attribute. Additionally this patch implements >>> a diagnostic message when a non-const-callable comparator is >>> given to a container. >>> >>> Note: For now the warning version of the diagnostic is useless >>> within libc++ since warning diagnostics are suppressed by the >>> system header pragma. I'm going to work on fixing this. >>> >>> Added: >>> libcxx/trunk/test/libcxx/containers/associative/non_const_co >>> mparator.fail.cpp >>> Modified: >>> libcxx/trunk/docs/UsingLibcxx.rst >>> libcxx/trunk/include/__config >>> libcxx/trunk/include/__tree >>> libcxx/trunk/include/map >>> libcxx/trunk/include/type_traits >>> libcxx/trunk/test/libcxx/compiler.py >>> libcxx/trunk/test/libcxx/test/config.py >>> libcxx/trunk/test/libcxx/test/format.py >>> libcxx/trunk/test/libcxx/utilities/tuple/tuple.tuple/diagnos >>> e_reference_binding.fail.cpp >>> >>> Modified: libcxx/trunk/docs/UsingLibcxx.rst >>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/UsingL >>> ibcxx.rst?rev=291961&r1=291960&r2=291961&view=diff >>> >>> == >>> --- libcxx/trunk/docs/UsingLibcxx.rst (original) >>> +++ libcxx/trunk/docs/UsingLibcxx.rst Fri Jan 13 16:02:08 2017 >>> @@ -173,3 +173,10 @@ thread safety annotations. >>>return Tup{"hello world", 42}; // explicit constructor called. OK. >>> } >>> >>> +**_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS**: >>> + This macro disables the additional diagnostics generated by libc++ >>> using the >>> + `diagnose_if` attribute. These additional diagnostics include checks >>> for: >>> + >>> +* Giving `set`, `map`, `multiset`, `multimap` a comparator which is >>> not >>> + const callable. >>> + >>> >>> Modified: libcxx/trunk/include/__config >>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__c >>> onfig?rev=291961&r1=291960&r2=291961&view=diff >>> >>> == >>> --- libcxx/trunk/include/__config (original) >>> +++ libcxx/trunk/include/__config Fri Jan 13 16:02:08 2017 >>> @@ -1006,6 +1006,16 @@ _LIBCPP_FUNC_VIS extern "C" void __sanit >>> #endif >>> #endif >>> >>> +#if __has_attribute(diagnose_if) && !defined(_LIBCPP_DISABLE_ADDIT >>> IONAL_DIAGNOSTICS) >>> +# define _LIBCPP_DIAGNOSE_WARNING(...) \ >>> +__attribute__((__diagnose_if__(__VA_ARGS__, "warning"))) >>> +# define _LIBCPP_DIAGNOSE_ERROR(...) \ >>> +__attribute__((__diagnose_if__(__VA_ARGS__, "error"))) >>> +#else >>> +# define _LIBCPP_DIAGNOSE_WARNING(...) >>> +# define _LIBCPP_DIAGNOSE_ERROR(...) >>> +#endif >>> + >>> #endif // __cplusplus >>> >>> #endif // _LIBCPP_CONFIG >>> >>> Modified: libcxx/trunk/include/__tree >>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__t >>> ree?rev=291961&r1=291960&r2=291961&view=diff >>> >>> == >>> --- libcxx/trunk/include/__tree (original) >>> +++ libcxx/trunk/include/_