[PATCH] D36764: The following functions and tests work fine for powerpc64, so enable them.
nemanjai added a comment. In https://reviews.llvm.org/D36764#844692, @joerg wrote: > divtc3 and friends. Ah, OK. I see what you mean now. These builtins are for `XCmode` calculations (complex values as two `XFmode` components). Since PPC has no support for `XFmode` (i.e. 80-bit long double) in HW (and I don't imagine emulation is useful), I'm not sure it's meaningful to expose these builtins. That's at least my interpretation, but please let me know if I'm way off base with that analysis. https://reviews.llvm.org/D36764 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Buildmaster restart 08.20.2017
Hello everyone, LLVM buildmasters (both main and staging) will be restarted in 2 hours (~3:00 AM PDT). -- Best Regards, Victor Leschuk | Software Engineer |Access Softek ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: Buildmaster restart 08.20.2017
Both buildmasters were updated and currently are up and running. On 08/20/2017 10:47 AM, Victor Leschuk wrote: > Hello everyone, > LLVM buildmasters (both main and staging) will be restarted in 2 hours > (~3:00 AM PDT). > -- Best Regards, Victor Leschuk | Software Engineer |Access Softek ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r311280 - [clang-diff] Filter AST nodes
Author: krobelus Date: Sun Aug 20 03:22:32 2017 New Revision: 311280 URL: http://llvm.org/viewvc/llvm-project?rev=311280&view=rev Log: [clang-diff] Filter AST nodes Summary: Ignore macros and implicit AST nodes, as well as anything outside of the main source file. Reviewers: arphaman Subscribers: klimek Differential Revision: https://reviews.llvm.org/D36184 Modified: cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp cfe/trunk/test/Tooling/clang-diff-ast.cpp cfe/trunk/test/Tooling/clang-diff-json.cpp Modified: cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp?rev=311280&r1=311279&r2=311280&view=diff == --- cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp (original) +++ cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp Sun Aug 20 03:22:32 2017 @@ -158,12 +158,23 @@ private: void setLeftMostDescendants(); }; +static bool isSpecializedNodeExcluded(const Decl *D) { return D->isImplicit(); } +static bool isSpecializedNodeExcluded(const Stmt *S) { return false; } + template static bool isNodeExcluded(const SourceManager &SrcMgr, T *N) { if (!N) return true; SourceLocation SLoc = N->getLocStart(); - return SLoc.isValid() && SrcMgr.isInSystemHeader(SLoc); + if (SLoc.isValid()) { +// Ignore everything from other files. +if (!SrcMgr.isInMainFile(SLoc)) + return true; +// Ignore macros. +if (SLoc != SrcMgr.getSpellingLoc(SLoc)) + return true; + } + return isSpecializedNodeExcluded(N); } namespace { @@ -180,6 +191,8 @@ struct NodeCountVisitor : public Recursi return true; } bool TraverseStmt(Stmt *S) { +if (S) + S = S->IgnoreImplicit(); if (isNodeExcluded(Tree.AST.getSourceManager(), S)) return true; ++Count; @@ -242,6 +255,8 @@ struct PreorderVisitor : public Recursiv return true; } bool TraverseStmt(Stmt *S) { +if (S) + S = S->IgnoreImplicit(); if (isNodeExcluded(Tree.AST.getSourceManager(), S)) return true; auto SavedState = PreTraverse(S); Modified: cfe/trunk/test/Tooling/clang-diff-ast.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Tooling/clang-diff-ast.cpp?rev=311280&r1=311279&r2=311280&view=diff == --- cfe/trunk/test/Tooling/clang-diff-ast.cpp (original) +++ cfe/trunk/test/Tooling/clang-diff-ast.cpp Sun Aug 20 03:22:32 2017 @@ -12,7 +12,8 @@ void f() { // CHECK: IntegerLiteral: 1 auto i = 1; // CHECK: CallExpr( - // CHECK: DeclRefExpr: f( + // CHECK-NOT: ImplicitCastExpr + // CHECK-NEXT: DeclRefExpr: f( f(); // CHECK: BinaryOperator: =( i = i; @@ -37,6 +38,7 @@ class X : Base { if (i == 0) // CHECK: StringLiteral: foo( return "foo"; +// CHECK-NOT: ImplicitCastExpr return 0; } @@ -48,3 +50,23 @@ public: int x = m; } }; + +#define M (void)1 +#define MA(a, b) (void)a, b +// CHECK: FunctionDecl +// CHECK-NEXT: CompoundStmt +void macros() { + M; + MA(1, 2); +} + +#ifndef GUARD +#define GUARD +// CHECK-NEXT: NamespaceDecl +namespace world { +// nodes from other files are excluded, there should be no output here +#include "clang-diff-ast.cpp" +} +// CHECK-NEXT: FunctionDecl: sentinel +void sentinel(); +#endif Modified: cfe/trunk/test/Tooling/clang-diff-json.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Tooling/clang-diff-json.cpp?rev=311280&r1=311279&r2=311280&view=diff == --- cfe/trunk/test/Tooling/clang-diff-json.cpp (original) +++ cfe/trunk/test/Tooling/clang-diff-json.cpp Sun Aug 20 03:22:32 2017 @@ -3,9 +3,9 @@ // RUN: | FileCheck %s // CHECK: "begin": 299, -// CHECK: "type": "CXXRecordDecl", // CHECK: "type": "FieldDecl", // CHECK: "end": 319, +// CHECK: "type": "CXXRecordDecl", class A { int x; }; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D36184: [clang-diff] Filter AST nodes
This revision was automatically updated to reflect the committed changes. Closed by commit rL311280: [clang-diff] Filter AST nodes (authored by krobelus). Changed prior to commit: https://reviews.llvm.org/D36184?vs=110687&id=111872#toc Repository: rL LLVM https://reviews.llvm.org/D36184 Files: cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp cfe/trunk/test/Tooling/clang-diff-ast.cpp cfe/trunk/test/Tooling/clang-diff-json.cpp Index: cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp === --- cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp +++ cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp @@ -158,12 +158,23 @@ void setLeftMostDescendants(); }; +static bool isSpecializedNodeExcluded(const Decl *D) { return D->isImplicit(); } +static bool isSpecializedNodeExcluded(const Stmt *S) { return false; } + template static bool isNodeExcluded(const SourceManager &SrcMgr, T *N) { if (!N) return true; SourceLocation SLoc = N->getLocStart(); - return SLoc.isValid() && SrcMgr.isInSystemHeader(SLoc); + if (SLoc.isValid()) { +// Ignore everything from other files. +if (!SrcMgr.isInMainFile(SLoc)) + return true; +// Ignore macros. +if (SLoc != SrcMgr.getSpellingLoc(SLoc)) + return true; + } + return isSpecializedNodeExcluded(N); } namespace { @@ -180,6 +191,8 @@ return true; } bool TraverseStmt(Stmt *S) { +if (S) + S = S->IgnoreImplicit(); if (isNodeExcluded(Tree.AST.getSourceManager(), S)) return true; ++Count; @@ -242,6 +255,8 @@ return true; } bool TraverseStmt(Stmt *S) { +if (S) + S = S->IgnoreImplicit(); if (isNodeExcluded(Tree.AST.getSourceManager(), S)) return true; auto SavedState = PreTraverse(S); Index: cfe/trunk/test/Tooling/clang-diff-ast.cpp === --- cfe/trunk/test/Tooling/clang-diff-ast.cpp +++ cfe/trunk/test/Tooling/clang-diff-ast.cpp @@ -12,7 +12,8 @@ // CHECK: IntegerLiteral: 1 auto i = 1; // CHECK: CallExpr( - // CHECK: DeclRefExpr: f( + // CHECK-NOT: ImplicitCastExpr + // CHECK-NEXT: DeclRefExpr: f( f(); // CHECK: BinaryOperator: =( i = i; @@ -37,6 +38,7 @@ if (i == 0) // CHECK: StringLiteral: foo( return "foo"; +// CHECK-NOT: ImplicitCastExpr return 0; } @@ -48,3 +50,23 @@ int x = m; } }; + +#define M (void)1 +#define MA(a, b) (void)a, b +// CHECK: FunctionDecl +// CHECK-NEXT: CompoundStmt +void macros() { + M; + MA(1, 2); +} + +#ifndef GUARD +#define GUARD +// CHECK-NEXT: NamespaceDecl +namespace world { +// nodes from other files are excluded, there should be no output here +#include "clang-diff-ast.cpp" +} +// CHECK-NEXT: FunctionDecl: sentinel +void sentinel(); +#endif Index: cfe/trunk/test/Tooling/clang-diff-json.cpp === --- cfe/trunk/test/Tooling/clang-diff-json.cpp +++ cfe/trunk/test/Tooling/clang-diff-json.cpp @@ -3,9 +3,9 @@ // RUN: | FileCheck %s // CHECK: "begin": 299, -// CHECK: "type": "CXXRecordDecl", // CHECK: "type": "FieldDecl", // CHECK: "end": 319, +// CHECK: "type": "CXXRecordDecl", class A { int x; }; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r311283 - [NFC] remove trailing WS
Author: hiraditya Date: Sun Aug 20 03:38:55 2017 New Revision: 311283 URL: http://llvm.org/viewvc/llvm-project?rev=311283&view=rev Log: [NFC] remove trailing WS Modified: libcxx/trunk/include/memory Modified: libcxx/trunk/include/memory URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=311283&r1=311282&r2=311283&view=diff == --- libcxx/trunk/include/memory (original) +++ libcxx/trunk/include/memory Sun Aug 20 03:38:55 2017 @@ -724,7 +724,7 @@ template struct __has_element_type : false_type {}; template -struct __has_element_type<_Tp, +struct __has_element_type<_Tp, typename __void_t::type> : true_type {}; template ::value> @@ -808,7 +808,7 @@ template struct __has_difference_type : false_type {}; template -struct __has_difference_type<_Tp, +struct __has_difference_type<_Tp, typename __void_t::type> : true_type {}; template ::value> @@ -994,7 +994,7 @@ template struct __has_pointer_type : false_type {}; template -struct __has_pointer_type<_Tp, +struct __has_pointer_type<_Tp, typename __void_t::type> : true_type {}; namespace __pointer_type_imp @@ -1024,7 +1024,7 @@ template struct __has_const_pointer : false_type {}; template -struct __has_const_pointer<_Tp, +struct __has_const_pointer<_Tp, typename __void_t::type> : true_type {}; template ::value> @@ -1047,7 +1047,7 @@ template struct __has_void_pointer : false_type {}; template -struct __has_void_pointer<_Tp, +struct __has_void_pointer<_Tp, typename __void_t::type> : true_type {}; template ::value> @@ -1070,7 +1070,7 @@ template struct __has_const_void_pointer : false_type {}; template -struct __has_const_void_pointer<_Tp, +struct __has_const_void_pointer<_Tp, typename __void_t::type> : true_type {}; template ::value> @@ -1148,7 +1148,7 @@ template struct __has_propagate_on_container_move_assignment : false_type {}; template -struct __has_propagate_on_container_move_assignment<_Tp, +struct __has_propagate_on_container_move_assignment<_Tp, typename __void_t::type> : true_type {}; @@ -1168,7 +1168,7 @@ template struct __has_propagate_on_container_swap : false_type {}; template -struct __has_propagate_on_container_swap<_Tp, +struct __has_propagate_on_container_swap<_Tp, typename __void_t::type> : true_type {}; @@ -1188,7 +1188,7 @@ template struct __has_is_always_equal : false_type {}; template -struct __has_is_always_equal<_Tp, +struct __has_is_always_equal<_Tp, typename __void_t::type> : true_type {}; @@ -1941,7 +1941,7 @@ public: _LIBCPP_INLINE_VISIBILITY raw_storage_iterator operator++(int) {raw_storage_iterator __t(*this); ++__x_; return __t;} #if _LIBCPP_STD_VER >= 14 -_LIBCPP_INLINE_VISIBILITY _OutputIterator base() const { return __x_; } +_LIBCPP_INLINE_VISIBILITY _OutputIterator base() const { return __x_; } #endif }; @@ -3850,7 +3850,7 @@ public: _LIBCPP_INLINE_VISIBILITY _Dp* __get_deleter() const _NOEXCEPT {return static_cast<_Dp*>(__cntrl_ -? const_cast(__cntrl_->__get_deleter(typeid(_Dp))) +? const_cast(__cntrl_->__get_deleter(typeid(_Dp))) : nullptr);} #endif // _LIBCPP_NO_RTTI @@ -4477,7 +4477,7 @@ inline typename enable_if < !is_array<_Yp>::value && -is_convertible::pointer, +is_convertible::pointer, typename shared_ptr<_Tp>::element_type*>::value, shared_ptr<_Tp>& >::type @@ -4512,7 +4512,7 @@ inline _LIBCPP_INLINE_VISIBILITY typename enable_if < !is_array<_Yp>::value && -is_convertible::pointer, +is_convertible::pointer, typename shared_ptr<_Tp>::element_type*>::value, shared_ptr<_Tp>& >::type @@ -5311,7 +5311,7 @@ atomic_load(const shared_ptr<_Tp>* __p) __m.unlock(); return __q; } - + template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR @@ -5352,7 +5352,7 @@ atomic_exchange(shared_ptr<_Tp>* __p, sh __m.unlock(); return __r; } - + template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR @@ -5484,7 +5484,7 @@ void __swap_allocator(_Alloc & __a1, _Al _NOEXCEPT_(__is_nothrow_swappable<_Alloc>::value) #endif { -__swap_allocator(__a1, __a2, +__swap_allocator(__a1, __a2, integral_constant::propagate_on_container_swap::value>()); } @@ -5506,7 +5506,7 @@ inline _LIBCPP_INLINE_VISIBILITY void __swap_allocator(_Alloc &, _Alloc &, false_type) _NOEXCEPT {} template > -struct __noexcept_move_assign_container : public integral_constant 14 || _Traits::is_always_equal::value @@ -5520,17 +5520,17 @@ struct __noexcept_move_assign_container template struct __temp_val
r311284 - [clang-diff] Fix similarity computation
Author: krobelus Date: Sun Aug 20 05:09:07 2017 New Revision: 311284 URL: http://llvm.org/viewvc/llvm-project?rev=311284&view=rev Log: [clang-diff] Fix similarity computation Summary: Add separate tests for the top-down and the bottom-up phase, as well as one for the optimal matching. Reviewers: arphaman Subscribers: klimek Differential Revision: https://reviews.llvm.org/D36185 Added: cfe/trunk/test/Tooling/clang-diff-bottomup.cpp cfe/trunk/test/Tooling/clang-diff-opt.cpp cfe/trunk/test/Tooling/clang-diff-topdown.cpp Modified: cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiff.h cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp cfe/trunk/tools/clang-diff/ClangDiff.cpp Modified: cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiff.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiff.h?rev=311284&r1=311283&r2=311284&view=diff == --- cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiff.h (original) +++ cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiff.h Sun Aug 20 05:09:07 2017 @@ -105,12 +105,14 @@ struct ComparisonOptions { /// During bottom-up matching, match only nodes with at least this value as /// the ratio of their common descendants. - double MinSimilarity = 0.2; + double MinSimilarity = 0.5; /// Whenever two subtrees are matched in the bottom-up phase, the optimal /// mapping is computed, unless the size of either subtrees exceeds this. int MaxSize = 100; + bool StopAfterTopDown = false; + /// Returns false if the nodes should never be matched. bool isMatchingAllowed(const Node &N1, const Node &N2) const { return N1.getType().isSame(N2.getType()); Modified: cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp?rev=311284&r1=311283&r2=311284&view=diff == --- cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp (original) +++ cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp Sun Aug 20 05:09:07 2017 @@ -92,7 +92,7 @@ private: // Computes the ratio of common descendants between the two nodes. // Descendants are only considered to be equal when they are mapped in M. - double getSimilarity(const Mapping &M, NodeId Id1, NodeId Id2) const; + double getJaccardSimilarity(const Mapping &M, NodeId Id1, NodeId Id2) const; // Returns the node that has the highest degree of similarity. NodeId findCandidate(const Mapping &M, NodeId Id1) const; @@ -714,8 +714,8 @@ bool ASTDiff::Impl::haveSameParents(cons void ASTDiff::Impl::addOptimalMapping(Mapping &M, NodeId Id1, NodeId Id2) const { - if (std::max(T1.getNumberOfDescendants(Id1), - T2.getNumberOfDescendants(Id2)) >= Options.MaxSize) + if (std::max(T1.getNumberOfDescendants(Id1), T2.getNumberOfDescendants(Id2)) > + Options.MaxSize) return; ZhangShashaMatcher Matcher(*this, T1, T2, Id1, Id2); std::vector> R = Matcher.getMatchingNodes(); @@ -727,16 +727,23 @@ void ASTDiff::Impl::addOptimalMapping(Ma } } -double ASTDiff::Impl::getSimilarity(const Mapping &M, NodeId Id1, -NodeId Id2) const { - if (Id1.isInvalid() || Id2.isInvalid()) -return 0.0; +double ASTDiff::Impl::getJaccardSimilarity(const Mapping &M, NodeId Id1, + NodeId Id2) const { int CommonDescendants = 0; const Node &N1 = T1.getNode(Id1); - for (NodeId Id = Id1 + 1; Id <= N1.RightMostDescendant; ++Id) -CommonDescendants += int(T2.isInSubtree(M.getDst(Id), Id2)); - return 2.0 * CommonDescendants / - (T1.getNumberOfDescendants(Id1) + T2.getNumberOfDescendants(Id2)); + // Count the common descendants, excluding the subtree root. + for (NodeId Src = Id1 + 1; Src <= N1.RightMostDescendant; ++Src) { +NodeId Dst = M.getDst(Src); +CommonDescendants += int(Dst.isValid() && T2.isInSubtree(Dst, Id2)); + } + // We need to subtract 1 to get the number of descendants excluding the root. + double Denominator = T1.getNumberOfDescendants(Id1) - 1 + + T2.getNumberOfDescendants(Id2) - 1 - CommonDescendants; + // CommonDescendants is less than the size of one subtree. + assert(Denominator >= 0 && "Expected non-negative denominator."); + if (Denominator == 0) +return 0; + return CommonDescendants / Denominator; } NodeId ASTDiff::Impl::findCandidate(const Mapping &M, NodeId Id1) const { @@ -747,7 +754,7 @@ NodeId ASTDiff::Impl::findCandidate(cons continue; if (M.hasDst(Id2)) continue; -double Similarity = getSimilarity(M, Id1, Id2); +double Similarity = getJaccardSimilarity(M, Id1, Id2); if (Similarity >= Options.MinSimilarity && Similarity > HighestSimilarity) { HighestSimilarity = Similarity; Candidate = Id2; @@ -767,8 +774,8 @@ void ASTDiff::Impl::matchB
[PATCH] D36527: Implemented P0428R2 - Familiar template syntax for generic lambdas
hamzasood added inline comments. Comment at: lib/Parse/ParseExprCXX.cpp:1090 + TemplateParameterDepthRAII CurTemplateDepthTracker(TemplateParameterDepth); + Actions.RecordParsingTemplateParameterDepth(TemplateParameterDepth); + faisalv wrote: > Since you only really need to pass this information on for computing the > depth of the 'auto' parameters - why not just leave the > RecordParsingTEmplateParameterDepth call where it was, increment the template > depth once we parse the TPL, and just pass in the right depth (minus one if > ExplicitTemplateParameters) and increment the tracker if we getGenericLambda > but no explicit TPL? > > I wonder if that might be the safer way to do it - especially if you have > generic lambdas in default arguments of generic lambdas - each of which have > explicit template parameters also?? > > thoughts? > While the depth is currently only used for auto parameters, that could change in the future (especially since the function name is quite general. I.e. record depth instead of record auto depth or whatever). Because of that, it wouldn't seem right to not record it in the case where there's an explicit template param list but no function parameters. So the options were to record it twice (parsing the explicit TPL and function parameters) or just do it once for every lambda. Since it's a cheap operation (pretty much just setting a variable), I went for the latter. Good point about incrementing after seeing an explicit template param list. I'll change that in the next update. Comment at: lib/Parse/ParseExprCXX.cpp:1305 + TemplateParamScope.Exit(); + faisalv wrote: > Why do you exit the scope here, and then re-add the template parameters to > the current scope? What confusion (if any) occurs if you leave this scope on? > That was my original attempt, but I just couldn't get it to work. E.g. ``` auto l = [](T t) { }; ``` triggers an assertion: ``` (!A->getDeducedType().isNull() && "cannot request the size of an undeduced or dependent auto type"), function getTypeInfoImpl, file /Users/hamzasood/LLVM/src/tools/clang/lib/AST/ASTContext.cpp, line 1883. ``` A lot of other things broke too. I figured since function parameters are explicitly added to scope, it would make sense to introduce explicit template parameters in the same place. https://reviews.llvm.org/D36527 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D36185: [clang-diff] Fix similarity computation
This revision was automatically updated to reflect the committed changes. Closed by commit rL311284: [clang-diff] Fix similarity computation (authored by krobelus). Changed prior to commit: https://reviews.llvm.org/D36185?vs=110951&id=111877#toc Repository: rL LLVM https://reviews.llvm.org/D36185 Files: cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiff.h cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp cfe/trunk/test/Tooling/clang-diff-bottomup.cpp cfe/trunk/test/Tooling/clang-diff-opt.cpp cfe/trunk/test/Tooling/clang-diff-topdown.cpp cfe/trunk/tools/clang-diff/ClangDiff.cpp Index: cfe/trunk/tools/clang-diff/ClangDiff.cpp === --- cfe/trunk/tools/clang-diff/ClangDiff.cpp +++ cfe/trunk/tools/clang-diff/ClangDiff.cpp @@ -50,6 +50,11 @@ cl::Optional, cl::cat(ClangDiffCategory)); +static cl::opt StopAfter("stop-after", + cl::desc(""), + cl::Optional, cl::init(""), + cl::cat(ClangDiffCategory)); + static cl::opt MaxSize("s", cl::desc(""), cl::Optional, cl::init(-1), cl::cat(ClangDiffCategory)); @@ -425,6 +430,14 @@ diff::ComparisonOptions Options; if (MaxSize != -1) Options.MaxSize = MaxSize; + if (!StopAfter.empty()) { +if (StopAfter == "topdown") + Options.StopAfterTopDown = true; +else if (StopAfter != "bottomup") { + llvm::errs() << "Error: Invalid argument for -stop-after\n"; + return 1; +} + } diff::SyntaxTree SrcTree(Src->getASTContext()); diff::SyntaxTree DstTree(Dst->getASTContext()); diff::ASTDiff Diff(SrcTree, DstTree, Options); Index: cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiff.h === --- cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiff.h +++ cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiff.h @@ -105,12 +105,14 @@ /// During bottom-up matching, match only nodes with at least this value as /// the ratio of their common descendants. - double MinSimilarity = 0.2; + double MinSimilarity = 0.5; /// Whenever two subtrees are matched in the bottom-up phase, the optimal /// mapping is computed, unless the size of either subtrees exceeds this. int MaxSize = 100; + bool StopAfterTopDown = false; + /// Returns false if the nodes should never be matched. bool isMatchingAllowed(const Node &N1, const Node &N2) const { return N1.getType().isSame(N2.getType()); Index: cfe/trunk/test/Tooling/clang-diff-bottomup.cpp === --- cfe/trunk/test/Tooling/clang-diff-bottomup.cpp +++ cfe/trunk/test/Tooling/clang-diff-bottomup.cpp @@ -0,0 +1,39 @@ +// RUN: %clang_cc1 -E %s > %t.src.cpp +// RUN: %clang_cc1 -E %s > %t.dst.cpp -DDEST +// RUN: clang-diff -dump-matches -s=0 %t.src.cpp %t.dst.cpp -- | FileCheck %s +// +// Test the bottom-up matching, with maxsize set to 0, so that the optimal matching will never be applied. + +#ifndef DEST + +void f1() { ; {{;}} } +void f2() { ;; {{;}} } + +#else + +// Jaccard similarity threshold is 0.5. + +void f1() { +// CompoundStmt: 3 matched descendants, subtree sizes 4 and 5 +// Jaccard similarity = 3 / (4 + 5 - 3) = 3 / 6 >= 0.5 +// CHECK: Match FunctionDecl: f1(void (void))(1) to FunctionDecl: f1(void (void))(1) +// CHECK: Match CompoundStmt(2) to CompoundStmt(2) +// CHECK: Match CompoundStmt(4) to CompoundStmt(3) +// CHECK: Match CompoundStmt(5) to CompoundStmt(4) +// CHECK: Match NullStmt(6) to NullStmt(5) + {{;}} ;; +} + +void f2() { +// CompoundStmt: 3 matched descendants, subtree sizes 4 and 5 +// Jaccard similarity = 3 / (5 + 6 - 3) = 3 / 8 < 0.5 +// CHECK-NOT: Match FunctionDecl(9) +// CHECK-NOT: Match CompoundStmt(10) +// CHECK: Match CompoundStmt(11) to CompoundStmt(10) +// CHECK: Match CompoundStmt(12) to CompoundStmt(11) +// CHECK: Match NullStmt(13) to NullStmt(12) +// CHECK-NOT: Match NullStmt(13) + {{;}} ;;; +} + +#endif Index: cfe/trunk/test/Tooling/clang-diff-opt.cpp === --- cfe/trunk/test/Tooling/clang-diff-opt.cpp +++ cfe/trunk/test/Tooling/clang-diff-opt.cpp @@ -0,0 +1,44 @@ +// RUN: %clang_cc1 -E %s > %t.src.cpp +// RUN: %clang_cc1 -E %s > %t.dst.cpp -DDEST +// RUN: clang-diff -dump-matches -s=10 %t.src.cpp %t.dst.cpp -- | FileCheck %s +// +// Test the behaviour of the matching according to the optimal tree edit +// distance, implemented with Zhang and Shasha's algorithm. +// Just for testing we use a tiny value of 10 for maxsize. Subtrees bigger than +// this size will not be processed by the optimal algorithm. + +#ifndef DEST + +void f1() { {;} {{;}} } + +void f2() { {;} {{;}} } + +void f3() { {;} {{;;}} } + +#else + +void f1() { +// Jaccard similarity = 3 / (5 + 4 - 3) = 3 / 6 >= 0.
r311286 - [ODRHash] Move into anonymous namespace. NFC.
Author: d0k Date: Sun Aug 20 06:02:57 2017 New Revision: 311286 URL: http://llvm.org/viewvc/llvm-project?rev=311286&view=rev Log: [ODRHash] Move into anonymous namespace. NFC. Modified: cfe/trunk/lib/AST/ODRHash.cpp Modified: cfe/trunk/lib/AST/ODRHash.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ODRHash.cpp?rev=311286&r1=311285&r2=311286&view=diff == --- cfe/trunk/lib/AST/ODRHash.cpp (original) +++ cfe/trunk/lib/AST/ODRHash.cpp Sun Aug 20 06:02:57 2017 @@ -199,6 +199,7 @@ unsigned ODRHash::CalculateHash() { return ID.ComputeHash(); } +namespace { // Process a Decl pointer. Add* methods call back into ODRHash while Visit* // methods process the relevant parts of the Decl. class ODRDeclVisitor : public ConstDeclVisitor { @@ -343,6 +344,7 @@ public: } } }; +} // namespace // Only allow a small portion of Decl's to be processed. Remove this once // all Decl's can be handled. @@ -420,6 +422,7 @@ void ODRHash::AddDecl(const Decl *D) { } } +namespace { // Process a Type pointer. Add* methods call back into ODRHash while Visit* // methods process the relevant parts of the Type. class ODRTypeVisitor : public TypeVisitor { @@ -608,6 +611,7 @@ public: AddDecl(T->getDecl()); } }; +} // namespace void ODRHash::AddType(const Type *T) { assert(T && "Expecting non-null pointer."); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D36527: Implemented P0428R2 - Familiar template syntax for generic lambdas
faisalv added inline comments. Comment at: lib/Parse/ParseExprCXX.cpp:1090 + TemplateParameterDepthRAII CurTemplateDepthTracker(TemplateParameterDepth); + Actions.RecordParsingTemplateParameterDepth(TemplateParameterDepth); + hamzasood wrote: > faisalv wrote: > > Since you only really need to pass this information on for computing the > > depth of the 'auto' parameters - why not just leave the > > RecordParsingTEmplateParameterDepth call where it was, increment the > > template depth once we parse the TPL, and just pass in the right depth > > (minus one if ExplicitTemplateParameters) and increment the tracker if we > > getGenericLambda but no explicit TPL? > > > > I wonder if that might be the safer way to do it - especially if you have > > generic lambdas in default arguments of generic lambdas - each of which > > have explicit template parameters also?? > > > > thoughts? > > > While the depth is currently only used for auto parameters, that could change > in the future (especially since the function name is quite general. I.e. > record depth instead of record auto depth or whatever). Because of that, it > wouldn't seem right to not record it in the case where there's an explicit > template param list but no function parameters. So the options were to record > it twice (parsing the explicit TPL and function parameters) or just do it > once for every lambda. Since it's a cheap operation (pretty much just setting > a variable), I went for the latter. > > Good point about incrementing after seeing an explicit template param list. > I'll change that in the next update. I think If the depth will be needed in the future for something other than determining the depth of the auto parameter - then that change (of moving the call outside) should occur in that 'future' patch. I don't see why you say that it would ever need to be called twice in your patch? Just like we localize our variable declarations and limit their scope (to ease comprehension) similarly, i think changes to state should be as local to the part of the program that uses that state (once again for comprehension: If you move the call, folks now might have to put in more effort when trying to comprehend the effects of that call, since the set of potential operations relying on that set grows). Comment at: lib/Parse/ParseExprCXX.cpp:1305 + TemplateParamScope.Exit(); + hamzasood wrote: > faisalv wrote: > > Why do you exit the scope here, and then re-add the template parameters to > > the current scope? What confusion (if any) occurs if you leave this scope > > on? > > > That was my original attempt, but I just couldn't get it to work. > > E.g. > > ``` > auto l = [](T t) { }; > ``` > > triggers an assertion: > > ``` > (!A->getDeducedType().isNull() && "cannot request the size of an undeduced or > dependent auto type"), function getTypeInfoImpl, file > /Users/hamzasood/LLVM/src/tools/clang/lib/AST/ASTContext.cpp, line 1883. > ``` > > A lot of other things broke too. > > I figured since function parameters are explicitly added to scope, it would > make sense to introduce explicit template parameters in the same place. Hmm - I think at the very least we should understand exactly what assumptions are being violated - and then decide whether we wish to temporarily bypass/shortcut the way scopes are supposed to 'seamlessly' work (w a fixme or comment prior to the 'false exit' that explains why we are doing so) or adjust the assumptions... https://reviews.llvm.org/D36527 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D35782: [C++2a][Preprocessor] Implement p0306 __VA_OPT__ (Comma omission and comma deletion)
faisalv added a comment. *ping* Repository: rL LLVM https://reviews.llvm.org/D35782 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D36371: [Clang][x86][Inline Asm] support for GCC style inline asm - Y constraints
coby updated this revision to Diff 111885. coby added a comment. Herald added a subscriber: eraman. > @rnk: tests? Add forgotten test. Repository: rL LLVM https://reviews.llvm.org/D36371 Files: lib/Basic/Targets/X86.cpp lib/Basic/Targets/X86.h lib/CodeGen/TargetInfo.cpp test/CodeGen/x86-GCC-inline-asm-Y-constraints.c Index: lib/CodeGen/TargetInfo.cpp === --- lib/CodeGen/TargetInfo.cpp +++ lib/CodeGen/TargetInfo.cpp @@ -22,6 +22,7 @@ #include "clang/CodeGen/SwiftCallingConv.h" #include "clang/Frontend/CodeGenOptions.h" #include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/Triple.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/Type.h" @@ -870,7 +871,10 @@ static llvm::Type* X86AdjustInlineAsmType(CodeGen::CodeGenFunction &CGF, StringRef Constraint, llvm::Type* Ty) { - if ((Constraint == "y" || Constraint == "&y") && Ty->isVectorTy()) { + bool IsMMXCons = llvm::StringSwitch(Constraint) + .Cases("y", "&y", "^Ym", true) + .Default(false); + if (IsMMXCons && Ty->isVectorTy()) { if (cast(Ty)->getBitWidth() != 64) { // Invalid MMX constraint return nullptr; Index: lib/Basic/Targets/X86.cpp === --- lib/Basic/Targets/X86.cpp +++ lib/Basic/Targets/X86.cpp @@ -1386,7 +1386,9 @@ switch (*Name) { default: return false; +case 'z': case '0': // First SSE register. +case '2': case 't': // Any SSE register, when SSE2 is enabled. case 'i': // Any SSE register, when SSE2 and inter-unit moves enabled. case 'm': // Any MMX register, when inter-unit moves enabled. @@ -1455,33 +1457,39 @@ case 't': case 'u': return Size <= 128; - case 'v': - case 'x': -if (SSELevel >= AVX512F) - // 512-bit zmm registers can be used if target supports AVX512F. - return Size <= 512U; -else if (SSELevel >= AVX) - // 256-bit ymm registers can be used if target supports AVX. - return Size <= 256U; -return Size <= 128U; case 'Y': // 'Y' is the first character for several 2-character constraints. switch (Constraint[1]) { default: - break; + return false; case 'm': // 'Ym' is synonymous with 'y'. case 'k': return Size <= 64; +case 'z': +case '0': + // XMM0 + if (SSELevel >= SSE1) +return Size <= 128U; + return false; case 'i': case 't': - // 'Yi' and 'Yt' are synonymous with 'x' when SSE2 is enabled. - if (SSELevel >= AVX512F) -return Size <= 512U; - else if (SSELevel >= AVX) -return Size <= 256U; - return SSELevel >= SSE2 && Size <= 128U; +case '2': + // 'Yi','Yt','Y2' are synonymous with 'x' when SSE2 is enabled. + if (SSELevel < SSE2) +return false; + break; } + case 'v': + case 'x': +if (SSELevel >= AVX512F) + // 512-bit zmm registers can be used if target supports AVX512F. + return Size <= 512U; +else if (SSELevel >= AVX) + // 256-bit ymm registers can be used if target supports AVX. + return Size <= 256U; +return Size <= 128U; + } return true; @@ -1515,6 +1523,12 @@ // the return string. break; case 'k': +case 'm': +case 'i': +case 't': +case 'z': +case '0': +case '2': // "^" hints llvm that this is a 2 letter constraint. // "Constraint++" is used to promote the string iterator // to the next constraint. Index: lib/Basic/Targets/X86.h === --- lib/Basic/Targets/X86.h +++ lib/Basic/Targets/X86.h @@ -437,9 +437,12 @@ // In case the constraint is 'r' we need to return Expression case 'r': return Expression; +// Double letters Y constraints +case 'Y': + if ((++I != E) && ((*I == '0') || (*I == 'z'))) +return "xmm0"; default: - // Default value if there is no constraint for the register - return ""; + break; } return ""; } Index: test/CodeGen/x86-GCC-inline-asm-Y-constraints.c === --- test/CodeGen/x86-GCC-inline-asm-Y-constraints.c +++ test/CodeGen/x86-GCC-inline-asm-Y-constraints.c @@ -0,0 +1,68 @@ +// RUN: %clang_cc1 -ffreestanding -triple=x86_64-apple-darwin -target-cpu skx %s -emit-llvm -o - | FileCheck %s +#include +// This test is complimented by the .ll test under llvm/test/MC/X86/. +// At this level we can only check if the constarints are passed correctly +// from inline asm to llvm IR. + +// CHECK-LABEL: @f_Ym +void f_Ym(__m64 m) + { + // CHECK: movq $0, %mm1 + // CHECK-SAME: "=^Ym,~{dirflag},~{fpsr},~{flags}" + __asm__ volatile ("movq %0, %%mm1\n\t" +
[PATCH] D36527: Implemented P0428R2 - Familiar template syntax for generic lambdas
hamzasood updated this revision to Diff 111887. hamzasood added a comment. - Corrected a typo. - Made HasExplicitTemplateParams const. - Reverted the change in where template depth is incremented and recorded. - Fixed the broken test. - Keep the template scope active instead of exiting it and manually introducing the template parameters into scope. I think this works fine now; you can see the fix in line 847 of SemaLambda.cpp. Basically having a template scope active resulted in the lambda being incorrectly marked as dependent, which broke a lot of stuff. One question I have is how to expose explicit template params in the AST (if at all)? I was thinking of adding an int representing the number of template params that were explicitly specified. But do I add that to LambdaExpr or CXXRecordDecl::LambdaDefinitionData (or both)? https://reviews.llvm.org/D36527 Files: include/clang/Basic/DiagnosticParseKinds.td include/clang/Sema/ScopeInfo.h include/clang/Sema/Sema.h lib/Parse/ParseExprCXX.cpp lib/Sema/Sema.cpp lib/Sema/SemaLambda.cpp lib/Sema/SemaType.cpp test/CXX/temp/temp.decls/temp.variadic/p4.cpp test/Parser/cxx2a-template-lambdas.cpp test/SemaCXX/cxx2a-template-lambdas.cpp www/cxx_status.html Index: www/cxx_status.html === --- www/cxx_status.html +++ www/cxx_status.html @@ -822,7 +822,7 @@ template-parameter-list for generic lambdas http://wg21.link/p0428r2";>P0428R2 - No + SVN Initializer list constructors in class template argument deduction Index: test/SemaCXX/cxx2a-template-lambdas.cpp === --- test/SemaCXX/cxx2a-template-lambdas.cpp +++ test/SemaCXX/cxx2a-template-lambdas.cpp @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -std=c++2a -verify %s + +template +constexpr bool is_same = false; + +template +constexpr bool is_same = true; + +template +struct DummyTemplate { }; + +void func() { + auto L0 = [](T arg) { +static_assert(is_same); + }; + L0(0); + + auto L1 = [] { +static_assert(I == 5); + }; + L1.operator()<5>(); + + auto L2 = [] class T, class U>(T &&arg) { +static_assert(is_same, DummyTemplate>); + }; + L2(DummyTemplate()); +} + +template // expected-note {{declared here}} +struct ShadowMe { + void member_func() { +auto L = [] { }; // expected-error {{'T' shadows template parameter}} + } +}; Index: test/Parser/cxx2a-template-lambdas.cpp === --- test/Parser/cxx2a-template-lambdas.cpp +++ test/Parser/cxx2a-template-lambdas.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -std=c++2a %s -verify + +auto L0 = []<> { }; //expected-error {{cannot be empty}} + +auto L1 = [] { }; +auto L2 = [](T1 arg1, T2 arg2) -> T1 { }; +auto L3 = [](auto arg) { T t; }; +auto L4 = []() { }; Index: test/CXX/temp/temp.decls/temp.variadic/p4.cpp === --- test/CXX/temp/temp.decls/temp.variadic/p4.cpp +++ test/CXX/temp/temp.decls/temp.variadic/p4.cpp @@ -213,8 +213,10 @@ }; #endif +#if __cplusplus >= 201707L //- in a template parameter pack that is a pack expansion - // FIXME: We do not support any way to reach this case yet. + swallow([] typename ...W>(W ...wv) { }); +#endif //- in an initializer-list int arr[] = {T().x...}; @@ -279,11 +281,6 @@ struct T { int x; using U = int; }; void g() { f(1, 2, 3); } - template void pack_in_lambda(U ...u) { // expected-note {{here}} -// FIXME: Move this test into 'f' above once we support this syntax. -[] typename ...U>(U ...uv) {}; // expected-error {{expected body of lambda}} expected-error {{does not refer to a value}} - } - template void pack_expand_attr() { // FIXME: Move this test into 'f' above once we support this. [[gnu::aligned(alignof(T))...]] int x; // expected-error {{cannot be used as an attribute pack}} expected-error {{unexpanded}} Index: lib/Sema/SemaType.cpp === --- lib/Sema/SemaType.cpp +++ lib/Sema/SemaType.cpp @@ -2790,7 +2790,7 @@ sema::LambdaScopeInfo *LSI = SemaRef.getCurLambda(); assert(LSI && "No LambdaScopeInfo on the stack!"); const unsigned TemplateParameterDepth = LSI->AutoTemplateParameterDepth; -const unsigned AutoParameterPosition = LSI->AutoTemplateParams.size(); +const unsigned AutoParameterPosition = LSI->TemplateParams.size(); const bool IsParameterPack = D.hasEllipsis(); // Create the TemplateTypeParmDecl here to retrieve the corresponding @@ -2802,7 +2802,7 @@ /*KeyLoc*/SourceLocation(), /*NameLoc*/D.getLocStart(), TemplateParameterDepth, AutoParameterPosition, /*Identifier*/nullptr, false, IsParameterPack); -LSI->AutoTemplateParams.push_back(Co
[PATCH] D36935: Enable libfuzzer on NetBSD/amd64
krytarowski created this revision. krytarowski added a project: Sanitizers. Enable SanitizerKind::Fuzzer and SanitizerKind::FuzzerNoLink on x86_64. Sponsored by Repository: rL LLVM https://reviews.llvm.org/D36935 Files: lib/Driver/ToolChains/NetBSD.cpp Index: lib/Driver/ToolChains/NetBSD.cpp === --- lib/Driver/ToolChains/NetBSD.cpp +++ lib/Driver/ToolChains/NetBSD.cpp @@ -428,6 +428,8 @@ Res |= SanitizerKind::Vptr; } if (IsX86_64) { +Res |= SanitizerKind::Fuzzer; +Res |= SanitizerKind::FuzzerNoLink; Res |= SanitizerKind::Thread; } return Res; Index: lib/Driver/ToolChains/NetBSD.cpp === --- lib/Driver/ToolChains/NetBSD.cpp +++ lib/Driver/ToolChains/NetBSD.cpp @@ -428,6 +428,8 @@ Res |= SanitizerKind::Vptr; } if (IsX86_64) { +Res |= SanitizerKind::Fuzzer; +Res |= SanitizerKind::FuzzerNoLink; Res |= SanitizerKind::Thread; } return Res; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D36527: Implemented P0428R2 - Familiar template syntax for generic lambdas
hamzasood updated this revision to Diff 111892. hamzasood added a comment. Sorry, I've just spotted a small mistake in how the auto parameter depth is recorded. This update fixes it. https://reviews.llvm.org/D36527 Files: include/clang/Basic/DiagnosticParseKinds.td include/clang/Sema/ScopeInfo.h include/clang/Sema/Sema.h lib/Parse/ParseExprCXX.cpp lib/Sema/Sema.cpp lib/Sema/SemaLambda.cpp lib/Sema/SemaType.cpp test/CXX/temp/temp.decls/temp.variadic/p4.cpp test/Parser/cxx2a-template-lambdas.cpp test/SemaCXX/cxx2a-template-lambdas.cpp www/cxx_status.html Index: www/cxx_status.html === --- www/cxx_status.html +++ www/cxx_status.html @@ -822,7 +822,7 @@ template-parameter-list for generic lambdas http://wg21.link/p0428r2";>P0428R2 - No + SVN Initializer list constructors in class template argument deduction Index: test/SemaCXX/cxx2a-template-lambdas.cpp === --- test/SemaCXX/cxx2a-template-lambdas.cpp +++ test/SemaCXX/cxx2a-template-lambdas.cpp @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -std=c++2a -verify %s + +template +constexpr bool is_same = false; + +template +constexpr bool is_same = true; + +template +struct DummyTemplate { }; + +void func() { + auto L0 = [](T arg) { +static_assert(is_same); + }; + L0(0); + + auto L1 = [] { +static_assert(I == 5); + }; + L1.operator()<5>(); + + auto L2 = [] class T, class U>(T &&arg) { +static_assert(is_same, DummyTemplate>); + }; + L2(DummyTemplate()); +} + +template // expected-note {{declared here}} +struct ShadowMe { + void member_func() { +auto L = [] { }; // expected-error {{'T' shadows template parameter}} + } +}; Index: test/Parser/cxx2a-template-lambdas.cpp === --- test/Parser/cxx2a-template-lambdas.cpp +++ test/Parser/cxx2a-template-lambdas.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -std=c++2a %s -verify + +auto L0 = []<> { }; //expected-error {{cannot be empty}} + +auto L1 = [] { }; +auto L2 = [](T1 arg1, T2 arg2) -> T1 { }; +auto L3 = [](auto arg) { T t; }; +auto L4 = []() { }; Index: test/CXX/temp/temp.decls/temp.variadic/p4.cpp === --- test/CXX/temp/temp.decls/temp.variadic/p4.cpp +++ test/CXX/temp/temp.decls/temp.variadic/p4.cpp @@ -213,8 +213,10 @@ }; #endif +#if __cplusplus >= 201707L //- in a template parameter pack that is a pack expansion - // FIXME: We do not support any way to reach this case yet. + swallow([] typename ...W>(W ...wv) { }); +#endif //- in an initializer-list int arr[] = {T().x...}; @@ -279,11 +281,6 @@ struct T { int x; using U = int; }; void g() { f(1, 2, 3); } - template void pack_in_lambda(U ...u) { // expected-note {{here}} -// FIXME: Move this test into 'f' above once we support this syntax. -[] typename ...U>(U ...uv) {}; // expected-error {{expected body of lambda}} expected-error {{does not refer to a value}} - } - template void pack_expand_attr() { // FIXME: Move this test into 'f' above once we support this. [[gnu::aligned(alignof(T))...]] int x; // expected-error {{cannot be used as an attribute pack}} expected-error {{unexpanded}} Index: lib/Sema/SemaType.cpp === --- lib/Sema/SemaType.cpp +++ lib/Sema/SemaType.cpp @@ -2790,7 +2790,7 @@ sema::LambdaScopeInfo *LSI = SemaRef.getCurLambda(); assert(LSI && "No LambdaScopeInfo on the stack!"); const unsigned TemplateParameterDepth = LSI->AutoTemplateParameterDepth; -const unsigned AutoParameterPosition = LSI->AutoTemplateParams.size(); +const unsigned AutoParameterPosition = LSI->TemplateParams.size(); const bool IsParameterPack = D.hasEllipsis(); // Create the TemplateTypeParmDecl here to retrieve the corresponding @@ -2802,7 +2802,7 @@ /*KeyLoc*/SourceLocation(), /*NameLoc*/D.getLocStart(), TemplateParameterDepth, AutoParameterPosition, /*Identifier*/nullptr, false, IsParameterPack); -LSI->AutoTemplateParams.push_back(CorrespondingTemplateParam); +LSI->TemplateParams.push_back(CorrespondingTemplateParam); // Replace the 'auto' in the function parameter with this invented // template type parameter. // FIXME: Retain some type sugar to indicate that this was written Index: lib/Sema/SemaLambda.cpp === --- lib/Sema/SemaLambda.cpp +++ lib/Sema/SemaLambda.cpp @@ -229,15 +229,17 @@ if (LSI->GLTemplateParameterList) return LSI->GLTemplateParameterList; - if (!LSI->AutoTemplateParams.empty()) { -SourceRange IntroRange = LSI->IntroducerRange; -SourceLocation LAn
r311292 - [clang-diff] Improve and test getNodeValue
Author: krobelus Date: Sun Aug 20 09:18:43 2017 New Revision: 311292 URL: http://llvm.org/viewvc/llvm-project?rev=311292&view=rev Log: [clang-diff] Improve and test getNodeValue Summary: Use qualified names if available. Reviewers: arphaman Subscribers: klimek Differential Revision: https://reviews.llvm.org/D36186 Modified: cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiff.h cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp cfe/trunk/test/Tooling/clang-diff-ast.cpp cfe/trunk/test/Tooling/clang-diff-basic.cpp cfe/trunk/test/Tooling/clang-diff-bottomup.cpp cfe/trunk/test/Tooling/clang-diff-html.test cfe/trunk/test/Tooling/clang-diff-opt.cpp cfe/trunk/test/Tooling/clang-diff-topdown.cpp cfe/trunk/tools/clang-diff/ClangDiff.cpp Modified: cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiff.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiff.h?rev=311292&r1=311291&r2=311292&view=diff == --- cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiff.h (original) +++ cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiff.h Sun Aug 20 09:18:43 2017 @@ -45,6 +45,8 @@ struct Node { ast_type_traits::ASTNodeKind getType() const; StringRef getTypeLabel() const; bool isLeaf() const { return Children.empty(); } + llvm::Optional getIdentifier() const; + llvm::Optional getQualifiedIdentifier() const; }; class ASTDiff { Modified: cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp?rev=311292&r1=311291&r2=311292&view=diff == --- cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp (original) +++ cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp Sun Aug 20 09:18:43 2017 @@ -149,6 +149,8 @@ public: std::string getNodeValue(NodeId Id) const; std::string getNodeValue(const Node &Node) const; + std::string getDeclValue(const Decl *D) const; + std::string getStmtValue(const Stmt *S) const; private: /// Nodes in preorder. @@ -268,9 +270,6 @@ struct PreorderVisitor : public Recursiv }; } // end anonymous namespace -SyntaxTree::Impl::Impl(SyntaxTree *Parent, const ASTContext &AST) -: Impl(Parent, AST.getTranslationUnitDecl(), AST) {} - SyntaxTree::Impl::Impl(SyntaxTree *Parent, Decl *N, const ASTContext &AST) : Parent(Parent), AST(AST) { NodeCountVisitor NodeCounter(*this); @@ -372,49 +371,82 @@ std::string SyntaxTree::Impl::getNodeVal std::string SyntaxTree::Impl::getNodeValue(const Node &N) const { const DynTypedNode &DTN = N.ASTNode; - if (auto *X = DTN.get()) -return X->getOpcodeStr(); - if (auto *X = DTN.get()) { -CharSourceRange Range(X->getSourceRange(), false); + if (auto *S = DTN.get()) +return getStmtValue(S); + if (auto *D = DTN.get()) +return getDeclValue(D); + llvm_unreachable("Fatal: unhandled AST node.\n"); +} + +std::string SyntaxTree::Impl::getDeclValue(const Decl *D) const { + std::string Value; + PrintingPolicy TypePP(AST.getLangOpts()); + TypePP.AnonymousTagLocations = false; + + if (auto *V = dyn_cast(D)) { +Value += V->getQualifiedNameAsString() + "(" + + V->getType().getAsString(TypePP) + ")"; +if (auto *C = dyn_cast(D)) { + for (auto *Init : C->inits()) { +if (!Init->isWritten()) + continue; +if (Init->isBaseInitializer()) { + Value += Init->getBaseClass()->getCanonicalTypeInternal().getAsString( + TypePP); +} else if (Init->isDelegatingInitializer()) { + Value += C->getNameAsString(); +} else { + assert(Init->isAnyMemberInitializer()); + Value += Init->getMember()->getQualifiedNameAsString(); +} +Value += ","; + } +} +return Value; + } + if (auto *N = dyn_cast(D)) +Value += N->getQualifiedNameAsString() + ";"; + if (auto *T = dyn_cast(D)) +return Value + T->getUnderlyingType().getAsString(TypePP) + ";"; + if (auto *T = dyn_cast(D)) +if (T->getTypeForDecl()) + Value += + T->getTypeForDecl()->getCanonicalTypeInternal().getAsString(TypePP) + + ";"; + if (auto *U = dyn_cast(D)) +return U->getNominatedNamespace()->getName(); + if (auto *A = dyn_cast(D)) { +CharSourceRange Range(A->getSourceRange(), false); return Lexer::getSourceText(Range, AST.getSourceManager(), AST.getLangOpts()); } - if (auto *X = DTN.get()) { + return Value; +} + +std::string SyntaxTree::Impl::getStmtValue(const Stmt *S) const { + if (auto *U = dyn_cast(S)) +return UnaryOperator::getOpcodeStr(U->getOpcode()); + if (auto *B = dyn_cast(S)) +return B->getOpcodeStr(); + if (auto *M = dyn_cast(S)) +return M->getMemberDecl()->getQualifiedNameAsString(); + if (auto *I = dyn_cast(S)) { SmallString<256> Str; -X->getValue().toString(Str, /*Radix=*/10, /*Signed=*/fa
[PATCH] D36186: [clang-diff] Improve and test getNodeValue
This revision was automatically updated to reflect the committed changes. Closed by commit rL311292: [clang-diff] Improve and test getNodeValue (authored by krobelus). Changed prior to commit: https://reviews.llvm.org/D36186?vs=110952&id=111893#toc Repository: rL LLVM https://reviews.llvm.org/D36186 Files: cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiff.h cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp cfe/trunk/test/Tooling/clang-diff-ast.cpp cfe/trunk/test/Tooling/clang-diff-basic.cpp cfe/trunk/test/Tooling/clang-diff-bottomup.cpp cfe/trunk/test/Tooling/clang-diff-html.test cfe/trunk/test/Tooling/clang-diff-opt.cpp cfe/trunk/test/Tooling/clang-diff-topdown.cpp cfe/trunk/tools/clang-diff/ClangDiff.cpp Index: cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiff.h === --- cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiff.h +++ cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiff.h @@ -45,6 +45,8 @@ ast_type_traits::ASTNodeKind getType() const; StringRef getTypeLabel() const; bool isLeaf() const { return Children.empty(); } + llvm::Optional getIdentifier() const; + llvm::Optional getQualifiedIdentifier() const; }; class ASTDiff { Index: cfe/trunk/test/Tooling/clang-diff-basic.cpp === --- cfe/trunk/test/Tooling/clang-diff-basic.cpp +++ cfe/trunk/test/Tooling/clang-diff-basic.cpp @@ -11,18 +11,18 @@ } } -// CHECK: Match DeclRefExpr: foo{{.*}} to DeclRefExpr: inner::foo +// CHECK: Match DeclRefExpr: src::foo{{.*}} to DeclRefExpr: dst::inner::foo void main() { inner::foo(); } // CHECK: Match StringLiteral: foo{{.*}} to StringLiteral: foo const char *b = "f" "o" "o"; // unsigned is canonicalized to unsigned int -// CHECK: Match TypedefDecl: nat;unsigned int;{{.*}} to TypedefDecl: nat;unsigned int; +// CHECK: Match TypedefDecl: src::nat;unsigned int;{{.*}} to TypedefDecl: dst::nat;unsigned int; typedef unsigned nat; -// CHECK: Match VarDecl: p(int){{.*}} to VarDecl: prod(double) -// CHECK: Update VarDecl: p(int){{.*}} to prod(double) +// CHECK: Match VarDecl: src::p(int){{.*}} to VarDecl: dst::prod(double) +// CHECK: Update VarDecl: src::p(int){{.*}} to dst::prod(double) // CHECK: Match BinaryOperator: *{{.*}} to BinaryOperator: * double prod = 1 * 2 * 10; // CHECK: Update DeclRefExpr @@ -49,7 +49,7 @@ namespace { // match with parents of different type -// CHECK: Match FunctionDecl: f1{{.*}} to FunctionDecl: f1 +// CHECK: Match FunctionDecl: f1{{.*}} to FunctionDecl: (anonymous namespace)::f1 void f1() {{ (void) __func__;;; }} } Index: cfe/trunk/test/Tooling/clang-diff-bottomup.cpp === --- cfe/trunk/test/Tooling/clang-diff-bottomup.cpp +++ cfe/trunk/test/Tooling/clang-diff-bottomup.cpp @@ -16,7 +16,7 @@ void f1() { // CompoundStmt: 3 matched descendants, subtree sizes 4 and 5 // Jaccard similarity = 3 / (4 + 5 - 3) = 3 / 6 >= 0.5 -// CHECK: Match FunctionDecl: f1(void (void))(1) to FunctionDecl: f1(void (void))(1) +// CHECK: Match FunctionDecl: f1(void ())(1) to FunctionDecl: f1(void ())(1) // CHECK: Match CompoundStmt(2) to CompoundStmt(2) // CHECK: Match CompoundStmt(4) to CompoundStmt(3) // CHECK: Match CompoundStmt(5) to CompoundStmt(4) Index: cfe/trunk/test/Tooling/clang-diff-opt.cpp === --- cfe/trunk/test/Tooling/clang-diff-opt.cpp +++ cfe/trunk/test/Tooling/clang-diff-opt.cpp @@ -41,4 +41,5 @@ // CHECK: Delete NullStmt(22) ;; {{;;}} } + #endif Index: cfe/trunk/test/Tooling/clang-diff-html.test === --- cfe/trunk/test/Tooling/clang-diff-html.test +++ cfe/trunk/test/Tooling/clang-diff-html.test @@ -11,12 +11,12 @@ // match, move // CHECK: void foo() +// CHECK-NEXT: src::foo(void ())' class='u m'>void foo() // match // CHECK: void main() +// CHECK-NEXT: src::main(void ())' class='u'>void main() // deletion // CHECK:
[PATCH] D35948: [CommonOptionsParser] Expose ArgumentsAdjustingCompilationDatabase
johannes accepted this revision. johannes added a comment. This revision is now accepted and ready to land. This has already landed. https://reviews.llvm.org/D35948 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r311170 - [CommonOptionsParser] Expose ArgumentsAdjustingCompilationDatabase
Author: krobelus Date: Fri Aug 18 09:21:08 2017 New Revision: 311170 URL: http://llvm.org/viewvc/llvm-project?rev=311170&view=rev Log: [CommonOptionsParser] Expose ArgumentsAdjustingCompilationDatabase This is useful for tools such as clang-diff which do not use CommonOptionsParser due to the need for multiple compilation databases. Modified: cfe/trunk/include/clang/Tooling/CommonOptionsParser.h cfe/trunk/lib/Tooling/CommonOptionsParser.cpp Modified: cfe/trunk/include/clang/Tooling/CommonOptionsParser.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/CommonOptionsParser.h?rev=311170&r1=311169&r2=311170&view=diff == --- cfe/trunk/include/clang/Tooling/CommonOptionsParser.h (original) +++ cfe/trunk/include/clang/Tooling/CommonOptionsParser.h Fri Aug 18 09:21:08 2017 @@ -27,6 +27,7 @@ #ifndef LLVM_CLANG_TOOLING_COMMONOPTIONSPARSER_H #define LLVM_CLANG_TOOLING_COMMONOPTIONSPARSER_H +#include "clang/Tooling/ArgumentsAdjusters.h" #include "clang/Tooling/CompilationDatabase.h" #include "llvm/Support/CommandLine.h" @@ -111,6 +112,29 @@ private: std::vector ExtraArgsAfter; }; +class ArgumentsAdjustingCompilations : public CompilationDatabase { +public: + ArgumentsAdjustingCompilations( + std::unique_ptr Compilations) + : Compilations(std::move(Compilations)) {} + + void appendArgumentsAdjuster(ArgumentsAdjuster Adjuster); + + std::vector + getCompileCommands(StringRef FilePath) const override; + + std::vector getAllFiles() const override; + + std::vector getAllCompileCommands() const override; + +private: + std::unique_ptr Compilations; + std::vector Adjusters; + + std::vector + adjustCommands(std::vector Commands) const; +}; + } // namespace tooling } // namespace clang Modified: cfe/trunk/lib/Tooling/CommonOptionsParser.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/CommonOptionsParser.cpp?rev=311170&r1=311169&r2=311170&view=diff == --- cfe/trunk/lib/Tooling/CommonOptionsParser.cpp (original) +++ cfe/trunk/lib/Tooling/CommonOptionsParser.cpp Fri Aug 18 09:21:08 2017 @@ -25,7 +25,6 @@ //===--===// #include "llvm/Support/CommandLine.h" -#include "clang/Tooling/ArgumentsAdjusters.h" #include "clang/Tooling/CommonOptionsParser.h" #include "clang/Tooling/Tooling.h" @@ -54,43 +53,33 @@ const char *const CommonOptionsParser::H "\tsuffix of a path in the compile command database.\n" "\n"; -namespace { -class ArgumentsAdjustingCompilations : public CompilationDatabase { -public: - ArgumentsAdjustingCompilations( - std::unique_ptr Compilations) - : Compilations(std::move(Compilations)) {} - - void appendArgumentsAdjuster(ArgumentsAdjuster Adjuster) { -Adjusters.push_back(std::move(Adjuster)); - } - - std::vector - getCompileCommands(StringRef FilePath) const override { -return adjustCommands(Compilations->getCompileCommands(FilePath)); - } - - std::vector getAllFiles() const override { -return Compilations->getAllFiles(); - } - - std::vector getAllCompileCommands() const override { -return adjustCommands(Compilations->getAllCompileCommands()); - } - -private: - std::unique_ptr Compilations; - std::vector Adjusters; - - std::vector - adjustCommands(std::vector Commands) const { -for (CompileCommand &Command : Commands) - for (const auto &Adjuster : Adjusters) -Command.CommandLine = Adjuster(Command.CommandLine, Command.Filename); -return Commands; - } -}; -} // namespace +void ArgumentsAdjustingCompilations::appendArgumentsAdjuster( +ArgumentsAdjuster Adjuster) { + Adjusters.push_back(std::move(Adjuster)); +} + +std::vector ArgumentsAdjustingCompilations::getCompileCommands( +StringRef FilePath) const { + return adjustCommands(Compilations->getCompileCommands(FilePath)); +} + +std::vector +ArgumentsAdjustingCompilations::getAllFiles() const { + return Compilations->getAllFiles(); +} + +std::vector +ArgumentsAdjustingCompilations::getAllCompileCommands() const { + return adjustCommands(Compilations->getAllCompileCommands()); +} + +std::vector ArgumentsAdjustingCompilations::adjustCommands( +std::vector Commands) const { + for (CompileCommand &Command : Commands) +for (const auto &Adjuster : Adjusters) + Command.CommandLine = Adjuster(Command.CommandLine, Command.Filename); + return Commands; +} CommonOptionsParser::CommonOptionsParser( int &argc, const char **argv, cl::OptionCategory &Category, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r311301 - Allow thiscall attribute in test/Tooling/clang-diff-ast.cpp
Author: krobelus Date: Sun Aug 20 13:13:33 2017 New Revision: 311301 URL: http://llvm.org/viewvc/llvm-project?rev=311301&view=rev Log: Allow thiscall attribute in test/Tooling/clang-diff-ast.cpp Modified: cfe/trunk/test/Tooling/clang-diff-ast.cpp Modified: cfe/trunk/test/Tooling/clang-diff-ast.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Tooling/clang-diff-ast.cpp?rev=311301&r1=311300&r2=311301&view=diff == --- cfe/trunk/test/Tooling/clang-diff-ast.cpp (original) +++ cfe/trunk/test/Tooling/clang-diff-ast.cpp Sun Aug 20 13:13:33 2017 @@ -61,7 +61,7 @@ public: // CHECK: MemberExpr: X::m( int x = m; } - // CHECK: CXXConstructorDecl: X::X(void (char))X,( + // CHECK: CXXConstructorDecl: X::X(void (char){{( __attribute__\(\(thiscall\)\))?}})X,( X(char s) : X(s, 4) {} }; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D36423: [libc++] Introsort based sorting function
hiraditya added a comment. Results with the patch. Before: Run on (8 X 3900 MHz CPU s) 2017-08-20 15:11:41 --- BenchmarkTime CPU Iterations --- BM_Sort/random_uint32/65536 14202353 ns 14203202 ns 48 BM_Sort/sorted_ascending_uint32/65536 254100 ns 254108 ns 2754 BM_Sort/sorted_descending_uint32/65536 552118 ns 552151 ns 1232 BM_Sort/single_element_uint32/65536 170140 ns 170136 ns 4090 BM_Sort/pipe_organ_uint32/655365989117 ns5989494 ns113 BM_Sort/random_strings/65536 105697682 ns 105702553 ns 7 BM_Sort/sorted_ascending_strings/6553613324109 ns 13324186 ns 50 BM_Sort/sorted_descending_strings/65536 19057303 ns 19058005 ns 36 BM_Sort/single_element_strings/65536 57941433 ns 57944691 ns 12 BM_Sort/qsort_worst_uint32/65536 694858550 ns 694894213 ns 1 After: Run on (8 X 3900 MHz CPU s) 2017-08-20 15:15:14 --- BenchmarkTime CPU Iterations --- BM_Sort/random_uint32/65536 14073209 ns 14073732 ns 49 BM_Sort/sorted_ascending_uint32/65536 257596 ns 257610 ns 2740 BM_Sort/sorted_descending_uint32/65536 560208 ns 560069 ns 1226 BM_Sort/single_element_uint32/65536 170543 ns 170549 ns 4075 BM_Sort/pipe_organ_uint32/655366008832 ns6009173 ns113 BM_Sort/random_strings/65536 104672888 ns 104677220 ns 7 BM_Sort/sorted_ascending_strings/6553613334016 ns 13334393 ns 54 BM_Sort/sorted_descending_strings/65536 18883275 ns 18883831 ns 37 BM_Sort/single_element_strings/65536 57022905 ns 57025206 ns 12 BM_Sort/qsort_worst_uint32/65536 16870788 ns 16871828 ns 41 https://reviews.llvm.org/D36423 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27918: [analyzer] OStreamChecker
gamesh411 added a comment. Ping. @NoQ would you please have a look? Thanks! https://reviews.llvm.org/D27918 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27918: [analyzer] OStreamChecker
zaks.anna added inline comments. Comment at: lib/StaticAnalyzer/Checkers/OStreamFormatChecker.cpp:513 + +bool OStreamFormatChecker::evalCall(const CallExpr *CE, +CheckerContext &C) const { gamesh411 wrote: > NoQ wrote: > > One of the practical differences between `checkPostCall` and `evalCall` is > > that in the latter you have full control over the function execution, > > including invalidations that the call causes. Your code not only sets the > > return value, but also removes invalidations that normally happen. Like, > > normally when an unknown function is called, it is either inlined and > > therefore modeled directly, or destroys all information about any global > > variables or heap memory that it might have touched. By implementing > > `evalCall`, you are saying that the only effect of calling `operator<<()` > > on a `basic_ostream` is returning the first argument lvalue, and nothing > > else happens; inlining is suppressed, invalidation is suppressed. > > > > I'm not sure if it's a good thing. On one hand, this is not entirely true, > > because the operator changes the internal state of the stream and maybe of > > some global stuff inside the standard library. On the other hand, it is > > unlikely to matter in practice, as far as i can see. > > > > Would it undermine any of your efforts here if you add a manual > > invalidation of the stream object and of the `GlobalSystemSpaceRegion` > > memory space (you could construct a temporary `CallEvent` and call one of > > its methods if it turns out to be easier)? > > > > I'm not exactly in favor of turning this into `checkPostCall()` because > > binding expressions in that callback may cause hard-to-notice conflicts > > across multiple checkers. Some checkers may even take the old value before > > it's replaced. For `evalCall()` we at least have an assert. > > > > If you intend to keep the return value as the only effect, there's option > > of making a synthesized body in our body farm, which is even better at > > avoiding inter-checker conflicts. Body farms were created for that specific > > purpose, even though they also have their drawbacks (sometimes `evalCall` > > is more flexible than anything we could synthesize, eg. D20811). > > > > If you have considered all the alternative options mentioned above and > > rejected them, could you add a comment explaining why? :) > I am not familiar with the BodyFarm approach, however I tried something > along the lines of: > auto CEvt = > ResultEqualsFirstParam->getStateManager().getCallEventManager().getSimpleCall(CE, > S, C.getLocationContext()); > ProgramStateRef StreamStateInvalidated = > CEvt->invalidateRegions(C.blockCount()); > > It however broke test2 (where the state is set to hex formatting, then, back > to dec). Any tips why resetting regions could cause problems? > I agree that we should not use evalCall(), especially, in an opt-in checker, as it can introduce subtle/hard to debug issues. As was mentioned, if a checker implements evalCall(), the usual evaluation by the analyzer core does not occur, which could lead to various unpredictable results. https://reviews.llvm.org/D27918 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D35782: [C++2a][Preprocessor] Implement p0306 __VA_OPT__ (Comma omission and comma deletion)
majnemer added inline comments. Comment at: include/clang/Lex/TokenLexer.h:169 + bool PasteTokens(Token &Tok, + llvm::ArrayRef AltTokens = llvm::ArrayRef(), + unsigned int *const AltCurTokenIdx = nullptr); I think `llvm::ArrayRef()` can just be `llvm::None`. Repository: rL LLVM https://reviews.llvm.org/D35782 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D36949: [clang] Fix tests for Emitting Single Inline Remark
lenary created this revision. This change depends on https://reviews.llvm.org/D36054 and should be landed at the same time. https://reviews.llvm.org/D36949 Files: test/Frontend/optimization-remark-with-hotness.c test/Frontend/optimization-remark.c Index: test/Frontend/optimization-remark.c === --- test/Frontend/optimization-remark.c +++ test/Frontend/optimization-remark.c @@ -42,9 +42,8 @@ // twice. // int bar(int j) { -// expected-remark@+4 {{foz not inlined into bar because it should never be inlined (cost=never)}} // expected-remark@+3 {{foz not inlined into bar because it should never be inlined (cost=never)}} -// expected-remark@+2 {{foo should always be inlined}} +// expected-remark@+2 {{foz not inlined into bar because it should never be inlined (cost=never)}} // expected-remark@+1 {{foo inlined into bar}} return foo(j, j - 2) * foz(j - 2, j); } Index: test/Frontend/optimization-remark-with-hotness.c === --- test/Frontend/optimization-remark-with-hotness.c +++ test/Frontend/optimization-remark-with-hotness.c @@ -56,8 +56,7 @@ // THRESHOLD-NOT: hotness // NO_PGO: '-fdiagnostics-show-hotness' requires profile-guided optimization information // NO_PGO: '-fdiagnostics-hotness-threshold=' requires profile-guided optimization information - // expected-remark@+2 {{foo should always be inlined (cost=always) (hotness: 30)}} - // expected-remark@+1 {{foo inlined into bar (hotness: 30)}} + // expected-remark@+1 {{foo inlined into bar with cost=always}} sum += foo(x, x - 2); } Index: test/Frontend/optimization-remark.c === --- test/Frontend/optimization-remark.c +++ test/Frontend/optimization-remark.c @@ -42,9 +42,8 @@ // twice. // int bar(int j) { -// expected-remark@+4 {{foz not inlined into bar because it should never be inlined (cost=never)}} // expected-remark@+3 {{foz not inlined into bar because it should never be inlined (cost=never)}} -// expected-remark@+2 {{foo should always be inlined}} +// expected-remark@+2 {{foz not inlined into bar because it should never be inlined (cost=never)}} // expected-remark@+1 {{foo inlined into bar}} return foo(j, j - 2) * foz(j - 2, j); } Index: test/Frontend/optimization-remark-with-hotness.c === --- test/Frontend/optimization-remark-with-hotness.c +++ test/Frontend/optimization-remark-with-hotness.c @@ -56,8 +56,7 @@ // THRESHOLD-NOT: hotness // NO_PGO: '-fdiagnostics-show-hotness' requires profile-guided optimization information // NO_PGO: '-fdiagnostics-hotness-threshold=' requires profile-guided optimization information - // expected-remark@+2 {{foo should always be inlined (cost=always) (hotness: 30)}} - // expected-remark@+1 {{foo inlined into bar (hotness: 30)}} + // expected-remark@+1 {{foo inlined into bar with cost=always}} sum += foo(x, x - 2); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits