[PATCH] D23329: [NFC] Reducing allocations in AST attributes
kevgs created this revision. kevgs added reviewers: rsmith, bkramer. kevgs added a subscriber: cfe-commits. In my test case max resident memory changed from 65760k to 64476k which is 1.9% improvement. Allocations in grow_pod changed from 8847 to 4872 according to tcmalloc heap profiler. Overall running time remained the same. https://reviews.llvm.org/D23329 Files: include/clang/AST/AttrIterator.h Index: include/clang/AST/AttrIterator.h === --- include/clang/AST/AttrIterator.h +++ include/clang/AST/AttrIterator.h @@ -39,8 +39,8 @@ namespace clang { /// AttrVec - A vector of Attr, which is how they are stored on the AST. -typedef SmallVector AttrVec; -typedef SmallVector ConstAttrVec; +typedef SmallVector AttrVec; +typedef SmallVector ConstAttrVec; /// specific_attr_iterator - Iterates over a subrange of an AttrVec, only /// providing attributes that are of a specific type. Index: include/clang/AST/AttrIterator.h === --- include/clang/AST/AttrIterator.h +++ include/clang/AST/AttrIterator.h @@ -39,8 +39,8 @@ namespace clang { /// AttrVec - A vector of Attr, which is how they are stored on the AST. -typedef SmallVector AttrVec; -typedef SmallVector ConstAttrVec; +typedef SmallVector AttrVec; +typedef SmallVector ConstAttrVec; /// specific_attr_iterator - Iterates over a subrange of an AttrVec, only /// providing attributes that are of a specific type. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D23329: [NFC] Reducing allocations in AST attributes
kevgs added a comment. My test case is: clang++ -std=c++14 -fsyntax-only test.cc #include #include #include int main() { std::vector v = {1, 2, 3}; std::for_each(v.begin(), v.end(), [](auto i) { std::cout << i; }); return 0; } https://reviews.llvm.org/D23329 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D23329: [NFC] Reducing allocations in AST attributes
kevgs added a comment. Btw, ConstAttrVec is never used. https://reviews.llvm.org/D23329 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D23329: [NFC] Reducing allocations in AST attributes
kevgs updated this revision to Diff 67955. kevgs added a comment. clang-formatted + dead code removed https://reviews.llvm.org/D23329 Files: include/clang/AST/AttrIterator.h Index: include/clang/AST/AttrIterator.h === --- include/clang/AST/AttrIterator.h +++ include/clang/AST/AttrIterator.h @@ -39,8 +39,7 @@ namespace clang { /// AttrVec - A vector of Attr, which is how they are stored on the AST. -typedef SmallVector AttrVec; -typedef SmallVector ConstAttrVec; +typedef SmallVector AttrVec; /// specific_attr_iterator - Iterates over a subrange of an AttrVec, only /// providing attributes that are of a specific type. Index: include/clang/AST/AttrIterator.h === --- include/clang/AST/AttrIterator.h +++ include/clang/AST/AttrIterator.h @@ -39,8 +39,7 @@ namespace clang { /// AttrVec - A vector of Attr, which is how they are stored on the AST. -typedef SmallVector AttrVec; -typedef SmallVector ConstAttrVec; +typedef SmallVector AttrVec; /// specific_attr_iterator - Iterates over a subrange of an AttrVec, only /// providing attributes that are of a specific type. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D23329: [NFC] Reducing allocations in AST attributes
kevgs added a comment. I have no commit rights. https://reviews.llvm.org/D23329 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20100: [NFC] Header cleanup
kevgs added a comment. Sadly, I dont know such a tool. I was using a simple script to find unused headers ack --cpp -l 'SmallString\.h"' | xargs grep -L 'SmallString[ (http://reviews.llvm.org/D20100 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D19108: [Sema] Fixed assert failure in template code analyzer
kevgs created this revision. kevgs added reviewers: rsmith, dblaikie. kevgs added a subscriber: cfe-commits. Fix for this bug https://llvm.org/bugs/show_bug.cgi?id=27312 http://reviews.llvm.org/D19108 Files: lib/Sema/SemaAccess.cpp test/SemaTemplate/crash-bug-27258.cpp Index: test/SemaTemplate/crash-bug-27258.cpp === --- /dev/null +++ test/SemaTemplate/crash-bug-27258.cpp @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -fsyntax-only %s -verify +template +struct AA { + template + struct B {}; +}; + +class C { + int i; // expected-note{{implicitly declared private here}} + template + template + friend struct AA::B; +}; + +struct A { + template + struct B { +void f() { + C c; + c.i; // expected-error{{'i' is a private member of 'C'}} expected-warning{{expression result unused}} +} + }; +}; Index: lib/Sema/SemaAccess.cpp === --- lib/Sema/SemaAccess.cpp +++ lib/Sema/SemaAccess.cpp @@ -475,8 +475,8 @@ // If the class's context can't instantiate to the friend's // context, it can't be a dependent match. -if (!MightInstantiateTo(S, CTD->getDeclContext(), -Friend->getDeclContext())) +if (Friend->getDeclContext()->isDependentContext() || +!MightInstantiateTo(S, CTD->getDeclContext(), Friend->getDeclContext())) continue; // Otherwise, it's a dependent match. Index: test/SemaTemplate/crash-bug-27258.cpp === --- /dev/null +++ test/SemaTemplate/crash-bug-27258.cpp @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -fsyntax-only %s -verify +template +struct AA { + template + struct B {}; +}; + +class C { + int i; // expected-note{{implicitly declared private here}} + template + template + friend struct AA::B; +}; + +struct A { + template + struct B { +void f() { + C c; + c.i; // expected-error{{'i' is a private member of 'C'}} expected-warning{{expression result unused}} +} + }; +}; Index: lib/Sema/SemaAccess.cpp === --- lib/Sema/SemaAccess.cpp +++ lib/Sema/SemaAccess.cpp @@ -475,8 +475,8 @@ // If the class's context can't instantiate to the friend's // context, it can't be a dependent match. -if (!MightInstantiateTo(S, CTD->getDeclContext(), -Friend->getDeclContext())) +if (Friend->getDeclContext()->isDependentContext() || +!MightInstantiateTo(S, CTD->getDeclContext(), Friend->getDeclContext())) continue; // Otherwise, it's a dependent match. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20100: [NFC] Header cleanup
kevgs added a comment. Good. I have no commit rights. https://reviews.llvm.org/D20100 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits