Page MenuHomePhabricator
Feed Advanced Search

Today

njames93 committed rG556ee675c147: [clang-tidy][NFC] IdentifierNaming: Remove unnecessary string allocations (authored by njames93).
[clang-tidy][NFC] IdentifierNaming: Remove unnecessary string allocations
Wed, Oct 28, 8:50 AM
njames93 closed D90244: [clang-tidy][NFC] IdentifierNaming: Remove unnecessary string allocations.
Wed, Oct 28, 8:50 AM · Restricted Project
njames93 requested review of D90303: [ASTMatchers] Made isExpandedFromMacro Polymorphic.
Wed, Oct 28, 6:05 AM · Restricted Project

Yesterday

njames93 added inline comments to D89743: Support Attr in DynTypedNode and ASTMatchers..
Tue, Oct 27, 5:08 PM · Restricted Project
njames93 added a comment to D90244: [clang-tidy][NFC] IdentifierNaming: Remove unnecessary string allocations.

Was this caused by a performance concern when profiling something? I'm not opposed to the changes, but I do think the original formulation is easier to read.

It's not a huge performance concern, but removing up to 156 malloc calls* for each time we read** or store the style is certainly reason for this.

Tue, Oct 27, 1:51 PM · Restricted Project
njames93 added a comment to D89936: [clang-tidy] adding "--config-file=<file-path>" to specify custom config file..

If you plan on contributing quite a lot then it would be wise to upload your patches with arcanist - https://llvm.org/docs/Phabricator.html. It will help prevent issues with diffs being relative to previous revisions.
Personally I just create a branch from master for a feature. When I create the patch or update, I just need to use arc diff master and it will handle everything for me.
The other advantage of using arc for patches is the pre-merge bot is then able to build and check your patch to make sure all tests pass.

Tue, Oct 27, 10:49 AM · Restricted Project, Restricted Project
njames93 requested review of D90244: [clang-tidy][NFC] IdentifierNaming: Remove unnecessary string allocations.
Tue, Oct 27, 9:23 AM · Restricted Project
njames93 retitled D89936: [clang-tidy] adding "--config-file=<file-path>" to specify custom config file. from clang-tidy: adding "--clang-tidy-config=<file-path>" to specify custom config file to [clang-tidy] adding "--clang-tidy-config=<file-path>" to specify custom config file.
Tue, Oct 27, 2:20 AM · Restricted Project, Restricted Project

Mon, Oct 26

njames93 added a comment to D90180: [clang-tidy] find/fix unneeded semicolon after switch.

Taking a step back, clang-tidy checks are supposed to enforce guidelines for the specific module they live in.
If there are 10'000 occurrences of a semi directly after a switch closing brace in the linux kernel code base it could be argued that its a style guideline of the code base (or something they don't feel too strongly about).
In any case this check wouldn't be enforcing any guideline for the linux kernel code base.

Mon, Oct 26, 5:28 PM · Restricted Project, Restricted Project
njames93 committed rGb698ad00cbc7: [clang][NFC] Rearrange Comment Token and Lexer fields to reduce padding (authored by njames93).
[clang][NFC] Rearrange Comment Token and Lexer fields to reduce padding
Mon, Oct 26, 5:04 PM
njames93 closed D90127: [clang][NFC] Rearrange Comment Token and Lexer fields to reduce padding.
Mon, Oct 26, 5:03 PM · Restricted Project
njames93 added a comment to D90180: [clang-tidy] find/fix unneeded semicolon after switch.

Is this not already handled by -Wextra-semi. If it isn't I feel like it should be handled there rather than in clang-tidy

Mon, Oct 26, 3:26 PM · Restricted Project, Restricted Project
njames93 added a comment to D80531: [clang-tidy]: Added modernize-replace-disallow-copy-and-assign-macro.

@njames93 I could do that but the original Macros had were defined without a semicolon at the end and one had to add it manually. See this revision in which I replaced some occurrences of DISALLOW_COPY_AND_ASSIGN: eaebcbc67926a18befaa297f1778edde63baec9b. What do you suggest? Keep the semicolon to more closely match the original macros or remove it to make the test happy?

Mon, Oct 26, 5:29 AM · Restricted Project, Restricted Project
njames93 added a comment to D80531: [clang-tidy]: Added modernize-replace-disallow-copy-and-assign-macro.

@dblaikie sorry for the late feedback. The LLVM_ENABLE_WERROR:BOOL will "Stop and fail the build, if a compiler warning is triggered. Defaults to OFF." I wonder if any other test fails from clang tidy because. My test explicitly checks that a warning is issued (e.g. // CHECK-MESSAGES-DEFAULT: :[[@LINE-2]]:3: warning: prefer deleting) and when the LLVM_ENABLE_WERROR propagates to this piece, it will indeed fail the build. But I wonder why this doesn't happen to the other clang-tidy checks. @njames93 @Eugene.Zelenko any ideas?

Mon, Oct 26, 4:54 AM · Restricted Project, Restricted Project
njames93 updated the diff for D90127: [clang][NFC] Rearrange Comment Token and Lexer fields to reduce padding.

Fix field initialisation order in constructor

Mon, Oct 26, 3:54 AM · Restricted Project
njames93 added inline comments to D90127: [clang][NFC] Rearrange Comment Token and Lexer fields to reduce padding.
Mon, Oct 26, 3:51 AM · Restricted Project
njames93 updated the diff for D90127: [clang][NFC] Rearrange Comment Token and Lexer fields to reduce padding.

Keep VerbatimBlockEndCommandName after LexerState while preserving smaller size

Mon, Oct 26, 3:48 AM · Restricted Project

Sun, Oct 25

njames93 requested review of D90127: [clang][NFC] Rearrange Comment Token and Lexer fields to reduce padding.
Sun, Oct 25, 3:08 PM · Restricted Project
njames93 added a comment to D87326: [ADT] Fix reference invalidation when self referencing a SmallVector.

Overhead is likely caused by slightly more code needing to be emitted. However there is a glaring hole here that SmallVector isn't very smart about how it should take paramaters for calls like push_back.
For small trivial types it makes sense to take those by value and in those instances the current implementation of just calling grow would have no issue about reference invalidation as there no longer a reference.
Downside is it would require copying most of the small vector implementation code for this special case, kind of like what currently happens for SmallVectorTemplateBase with trivially copyable types.

Sun, Oct 25, 2:20 PM · Restricted Project
njames93 added a comment to D90010: clang-tidy: Reduce number of stderr write calls.

Isn't llvm::errs() buffered, negating most of the benefit here.
Also using std::string here is bad, its potentially going to allocate and reallocate memory each time it grows.
It would be better off using an llvm::SmallString and looking at what could potentially be outputted, I'd suggest you'd want a buffer size of at least 256 bytes.

Sun, Oct 25, 1:31 PM · Restricted Project, Restricted Project

Thu, Oct 22

njames93 updated the diff for D89951: [ptr-traits] Add a LowPointerIntPair alias.

Fix compilation error in assert enabled build

Thu, Oct 22, 7:08 AM · Restricted Project
njames93 requested review of D89951: [ptr-traits] Add a LowPointerIntPair alias.
Thu, Oct 22, 4:56 AM · Restricted Project
njames93 added a comment to D89852: [clangd] Get rid of llvm::Optional in Remote- and LocalIndexRoot; NFC.

I'm a little concerned by this, not sure if Expected and Optional play nicely with rvo. If the compiler can't optimise it's potentially a 256 byte memcpy in the return, granted that would still be cheaper than dynamic allocation. However it would most likely be faster if the functions took a reference to the SmallString (or more likely SmallVectorImpl<char>) and returned an llvm::Error or bool.

Thu, Oct 22, 1:47 AM · Restricted Project
njames93 added inline comments to D89935: [clangd] NFC: Update FIXME comment regarding lack of c/dtor support.
Thu, Oct 22, 1:28 AM · Restricted Project

Wed, Oct 21

njames93 updated the diff for D87326: [ADT] Fix reference invalidation when self referencing a SmallVector.

Tried to control binary size when compiling for gcc. Reworked everything here (apart from the test cases)

Wed, Oct 21, 5:47 PM · Restricted Project

Tue, Oct 20

njames93 updated the diff for D72553: [clang-tidy] Add performance-prefer-preincrement check.

Rebased and fix issues relating to rebase

Tue, Oct 20, 12:40 PM · Restricted Project, Restricted Project
njames93 added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Hi @njames93,

It's a smart idea, the rework for it is worth. There is a special case if lowercase name with Hungarian prefix, it possibly makes variable ambiguous, like the Case1. How about separating them and aNy_CasE with an underscore, like Case2 ?

// Case1
bool bRIGHT_LEVEL;     // UPPER_CASE
bool bRightLevel;      // CamelCase
bool bRight_Level;     // Camel_Snake_Case
bool baNy_CasE;        // aNy_CasE
bool bright_level;     // lower_case
bool brightLevel;      // camelBack
bool bright_Level;     // camel_Snake_Back
.....^^^^^^ <-- right? bright?

// Case2
bool bRIGHT_LEVEL;     // UPPER_CASE
bool bRightLevel;      // CamelCase
bool bRight_Level;     // Camel_Snake_Case
bool b_aNy_CasE;       // aNy_CasE
bool b_right_level;    // lower_case
bool b_rightLevel;     // camelBack
bool b_right_Level;    // camel_Snake_Back
.....^^^^^^^ <-- add an underscore

That still has hidden surprises. Maybe instead of a bool, an enum is used for controlling hungarian prefix (Off|On|...).
Can't think of a good name for the third option but it would do the inserting of '_' (bright_level ->b_right_level) or capitalising the first word of the identifier (brightLevel -> bRightLevel).

Tue, Oct 20, 9:14 AM · Restricted Project, Restricted Project
njames93 added a comment to D85697: [clang-tidy] Add cppcoreguidelines-prefer-scoped-enums.

It is not strongly connected to this review, but in the future I am planning to extend the check with:

  • options to exclude enums, because changing them to scoped enumerations might not be suitable for every cases

Not strictly necessary, if people don't want the fix they could annotate the code with a // NOLINT(*prefer-unscoped-enums) comment.

I think with the inline suppression the users should annotate every usage of the enum while with the option it would be enough to list the enum's name to ignore it from the whole check. However it is just an improvement, when I reach that point I will do further digging about this topic, how the suppression actually work etc.

Ah so an issue here is you emit a warning for the enum declaration as well as each usage and the NOLINT will only affect warnings emitted for the line its declared on.
Perhaps this needs a reshape.

Tue, Oct 20, 5:24 AM · Restricted Project, Restricted Project

Mon, Oct 19

njames93 added a comment to D85697: [clang-tidy] Add cppcoreguidelines-prefer-scoped-enums.

I tend to be very skeptical of the value of checks that basically throw out entire usable chunks of the base language because the check is effectively impossible to apply to an existing code base. Have you run the check over large C++ code bases to see just how often the diagnostic triggers and whether there are ways we might want to reduce false-positives that the C++ Core Guidelines haven't considered as part of their enforcement strategy?

I disagree with this mentality, This is following what the core guideline states perfectly. If a codebase doesn't want to adhere to those guidelines, they don't need to run this check. If you think there are shortcomings in the guidelines, raise an issue on their github.

Mon, Oct 19, 3:50 PM · Restricted Project, Restricted Project
njames93 committed rG86ef37980016: [clang-tidy] Add scoped enum constants to identifier naming check (authored by njames93).
[clang-tidy] Add scoped enum constants to identifier naming check
Mon, Oct 19, 7:58 AM
njames93 closed D89407: [clang-tidy] Add scoped enum constants to identifier naming check.
Mon, Oct 19, 7:57 AM · Restricted Project
njames93 committed rG866dc0978449: [clang-tidy] Better support for Override function in RenamerClangTidy based… (authored by njames93).
[clang-tidy] Better support for Override function in RenamerClangTidy based…
Mon, Oct 19, 7:21 AM
njames93 closed D79674: [clang-tidy] Better support for Override function in RenamerClangTidy based checks.
Mon, Oct 19, 7:21 AM · Restricted Project
njames93 committed rGaccda625b8e1: [nfc][clang-change-namespace] Remove unnecessary isScoped EnumDecl Matcher (authored by njames93).
[nfc][clang-change-namespace] Remove unnecessary isScoped EnumDecl Matcher
Mon, Oct 19, 4:54 AM
njames93 added a comment to D89065: [clang] Tweaked fixit for static assert with no message.

Ping

Mon, Oct 19, 4:26 AM · Restricted Project
njames93 added a comment to D89332: [clang-tidy] performance-unnecessary-copy-initialization: Always allow std::function to be copied..

Come to think of it, this is a pretty illogical way to solve this problem, just append ::std::function to the AllowedTypes vector in registerMatchers and be do with it. Will require dropping the const Qualifier on AllowedTypes, but aside from that it is a much simpler fix.
The has(Any)Name matcher has logic for skipping inline namespaces.

Mon, Oct 19, 4:25 AM · Restricted Project
njames93 added a comment to D89651: [clang-tidy] Add bugprone-suspicious-memory-comparison check.

Should point out there is already a check for cert-oop57-cpp, added in D72488. Do these play nice with each other or should they perhaps be merged or share code?

Mon, Oct 19, 4:08 AM · Restricted Project, Restricted Project
njames93 retitled D85697: [clang-tidy] Add cppcoreguidelines-prefer-scoped-enums from [clang-tidy] Add cppcoreguidelines-prefer-scoped-enums-over-unscoped to [clang-tidy] Add cppcoreguidelines-prefer-scoped-enums.
Mon, Oct 19, 4:00 AM · Restricted Project, Restricted Project
njames93 added a comment to D85697: [clang-tidy] Add cppcoreguidelines-prefer-scoped-enums.

The known "limitations" are mostly similar to other checks:

  • It cannot detect unfixable cases from other translation units. Practically that means if an enum is used in multiple source files, one of them might end up not fixed. I tried to work around this, but I haven't found any solution for this, moreover this cause problems for other checks also. Therefore I think it shouldn't be a blocking issue.

That's what the run_clang_tidy.py script is meant to handle.

  • It doesn't take into account if an enum is defined in a header that is filtered out. Similarly to the previous one, I tried to find a solution for this, but I was unable (the ClangTidyCheck class can access the header filter information, but it doesn't expose it for the descendant classes). I also checked other checks, and they behave in the same way. Therefore I also think it is shouldn't be a blocking issue.

I recently pushed an upgrade to readability-identifier-naming where it would check the naming style for identifiers declared in header files, maybe thats something this could also use, this is the commit 4888c9ce97d8

It is not strongly connected to this review, but in the future I am planning to extend the check with:

  • options to exclude enums, because changing them to scoped enumerations might not be suitable for every cases

Not strictly necessary, if people don't want the fix they could annotate the code with a // NOLINT(*prefer-unscoped-enums) comment.

  • options to force the doable fixes: based on my little experience it might be easier to force the doable fixes and manually fix the remaining ones

Forcing the fix is usually just a case of converting implicit cast usages of the constants into static casts.

Mon, Oct 19, 3:47 AM · Restricted Project, Restricted Project
njames93 added a comment to D85697: [clang-tidy] Add cppcoreguidelines-prefer-scoped-enums.

It may be a pain, but I'd also like to see an option like RemovePrefix.
Generally most unscoped enums constants have prefixes based on the enum name. A simple way around this would just be to get the longest common prefix in all the enums constants. There is probably some other heuristics that could be used like maybe stop after you reach an underscore or change of case but probably not essential.

Mon, Oct 19, 3:39 AM · Restricted Project, Restricted Project

Sun, Oct 18

njames93 committed rGce619f645f58: [NFC][clang-tidy] Use isInStdNamespace matcher instead of check defined… (authored by njames93).
[NFC][clang-tidy] Use isInStdNamespace matcher instead of check defined…
Sun, Oct 18, 8:02 AM
njames93 committed rG5f88c3b6392f: [clang tidy] Fix SIMDIntrinsicsCheck not storing options (authored by njames93).
[clang tidy] Fix SIMDIntrinsicsCheck not storing options
Sun, Oct 18, 7:57 AM

Sat, Oct 17

njames93 added inline comments to D89332: [clang-tidy] performance-unnecessary-copy-initialization: Always allow std::function to be copied..
Sat, Oct 17, 12:11 AM · Restricted Project

Fri, Oct 16

njames93 added a comment to D87830: [clang-tidy][test] Allow empty checks in check_clang_tidy.py.

Probably not quite as verbose but should do the job

// RUN: clang-tidy %s --checks=-*,my-check-to-test --warnings-as-errors=* -- -std=c++11
Fri, Oct 16, 11:36 PM · Restricted Project
njames93 added a comment to D89332: [clang-tidy] performance-unnecessary-copy-initialization: Always allow std::function to be copied..

How does this type alias and typedef, In theory that should also be handled.

using Functor = std::function<...>;
Functor Copy = Orig; // No warning.
Fri, Oct 16, 11:27 PM · Restricted Project
njames93 accepted D75813: [clang-tidy] fix readability-braces-around-statements Stmt type dependency.

LGTM

Fri, Oct 16, 6:43 AM · Restricted Project, Restricted Project
njames93 updated the summary of D79674: [clang-tidy] Better support for Override function in RenamerClangTidy based checks.
Fri, Oct 16, 6:29 AM · Restricted Project
njames93 updated the diff for D79674: [clang-tidy] Better support for Override function in RenamerClangTidy based checks.

Updated release notes to reflect change

Fri, Oct 16, 6:28 AM · Restricted Project
njames93 committed rG8a548bc203cf: [clang-tidy] modernize-loop-convert reverse iteration support (authored by njames93).
[clang-tidy] modernize-loop-convert reverse iteration support
Fri, Oct 16, 6:17 AM
njames93 closed D82089: [clang-tidy] modernize-loop-convert reverse iteration support.
Fri, Oct 16, 6:16 AM · Restricted Project
njames93 added a comment to D89407: [clang-tidy] Add scoped enum constants to identifier naming check.

I think will be good idea to add test for suffix/prefix too.

Not strictly necessary, there are tests that make sure prefixes and suffixes are applied correctly. Then there are tests that make sure a type of decl is correctly matched against its style, this is one of these tests. You'll find that's the convention with most of the style types tests in here.

Fri, Oct 16, 3:40 AM · Restricted Project

Thu, Oct 15

njames93 updated subscribers of D89407: [clang-tidy] Add scoped enum constants to identifier naming check.
Thu, Oct 15, 3:59 PM · Restricted Project
njames93 updated the diff for D89407: [clang-tidy] Add scoped enum constants to identifier naming check.

Removed runtime check in release mode that EnumConstant DeclContext is a EnumDecl

Thu, Oct 15, 4:26 AM · Restricted Project

Wed, Oct 14

njames93 updated the diff for D89407: [clang-tidy] Add scoped enum constants to identifier naming check.

Small tweak to the docs

Wed, Oct 14, 11:25 AM · Restricted Project
njames93 added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Is this diff been created incorrectly again?

Wed, Oct 14, 11:17 AM · Restricted Project, Restricted Project
njames93 requested review of D89407: [clang-tidy] Add scoped enum constants to identifier naming check.
Wed, Oct 14, 10:14 AM · Restricted Project

Mon, Oct 12

njames93 added a comment to D75813: [clang-tidy] fix readability-braces-around-statements Stmt type dependency.

The patch as shown here generates ~130k braces on llvm, you can see it at https://github.com/llvm/llvm-project/commit/16d3ec868cf00

Mon, Oct 12, 10:48 PM · Restricted Project, Restricted Project

Sat, Oct 10

njames93 updated the diff for D89065: [clang] Tweaked fixit for static assert with no message.

FixIt now properly generated

Sat, Oct 10, 6:12 PM · Restricted Project
njames93 added inline comments to D89194: [clang-tidy] Fix crash in readability-function-cognitive-complexity on weak refs.
Sat, Oct 10, 5:34 PM · Restricted Project, Restricted Project
njames93 planned changes to D89065: [clang] Tweaked fixit for static assert with no message.

Just noticed this doesn't quite work as expected, will update

Sat, Oct 10, 8:11 AM · Restricted Project

Thu, Oct 8

njames93 updated the diff for D89065: [clang] Tweaked fixit for static assert with no message.

Remove unnecessary changes

Thu, Oct 8, 4:05 PM · Restricted Project
njames93 added a comment to D89065: [clang] Tweaked fixit for static assert with no message.

I don't see any support for verifying fix-its in the test cases so unsure how i could go about testing this change.

Thu, Oct 8, 12:38 PM · Restricted Project
njames93 requested review of D89065: [clang] Tweaked fixit for static assert with no message.
Thu, Oct 8, 12:36 PM · Restricted Project

Tue, Oct 6

njames93 added a comment to D88833: [clang-tidy] Do not warn on pointer decays in system macros.

Can you please upload this diff with full context -U999999

Tue, Oct 6, 12:26 AM · Restricted Project, Restricted Project

Wed, Sep 30

njames93 added a comment to D86671: [clang-tidy] Add new case type to check variables with Hungarian notation.

Not strictly relevant here, but this does open up the idea of enforcing the style where an enum constant is prefixed by the initials of the enum name.

Wed, Sep 30, 12:15 PM · Restricted Project, Restricted Project

Tue, Sep 29

njames93 committed rG01a30fa6787d: [clangd] Trivial setter support when moving items to fields (authored by njames93).
[clangd] Trivial setter support when moving items to fields
Tue, Sep 29, 1:51 PM
njames93 closed D88297: [clangd] Trivial setter support when moving items to fields.
Tue, Sep 29, 1:51 PM · Restricted Project
njames93 added a comment to D84176: [CMake][CTE] Add "check-clang-extra-..." targets to test only a particular Clang extra tool.

Just a follow up on this point, dependencies are a little messed up here. Running any of the check-clang-extra<...> results in all clang-tools-extra targets being built.
Not ideal if you just want to test a small change to one tools and potentially having to rebuild all extra-tools
Is this an artefact of how check-clang-tools also depends on all clang-tools-extra targets.

Tue, Sep 29, 5:45 AM · Restricted Project, Restricted Project

Mon, Sep 28

njames93 updated the diff for D82089: [clang-tidy] modernize-loop-convert reverse iteration support.

IsReverse=

Mon, Sep 28, 11:55 PM · Restricted Project
njames93 updated the diff for D82089: [clang-tidy] modernize-loop-convert reverse iteration support.

Address reviewer comments

Mon, Sep 28, 11:54 PM · Restricted Project

Sep 25 2020

njames93 added inline comments to D88297: [clangd] Trivial setter support when moving items to fields.
Sep 25 2020, 9:57 AM · Restricted Project
njames93 updated the diff for D88297: [clangd] Trivial setter support when moving items to fields.

Updated function doc
Fix potential assertion

Sep 25 2020, 9:57 AM · Restricted Project
njames93 requested review of D88297: [clangd] Trivial setter support when moving items to fields.
Sep 25 2020, 6:01 AM · Restricted Project

Sep 16 2020

njames93 added a comment to D87326: [ADT] Fix reference invalidation when self referencing a SmallVector.

So, I think either this patch needs to be landed after some tweaking to try and bring the compile size down, though as it only appears to be an issue with clang it can probably afford some regression on gcc. Or we explicitly state that small vector is not safe to self reference itself and add instrumentation to enforce that behaviour. Right now we are in a middle ground where there are some guarantees made but not enough.
I would hedge my bets that there are definitely some code clients(whether in tree or not) that are currently using SmallVector incorrectly and sometimes run into little bugs like this.
Also for the record I have just built with gcc and noticed the same kind of regressions on the text size so at least I can have a look into this myself

Sep 16 2020, 1:11 AM · Restricted Project

Sep 15 2020

njames93 added a comment to D87683: [clang-tidy] Crash fix for bugprone-misplaced-pointer-arithmetic-in-alloc.

Please fix the test case first, can't call operator new(unsigned long, void*) with an argument of type void*
The other failures the pre merge bot detected can safely be disregarded

Sep 15 2020, 9:27 AM · Restricted Project, Restricted Project
njames93 added a comment to D87326: [ADT] Fix reference invalidation when self referencing a SmallVector.

@nikic Would you be able to see what the delta with this is https://gist.github.com/njames93/f26f159f06bda9e7ed2270adb39d9b08, should apply on top of trunk. It has the most expensive part of the grow buffer defined outline to dissuade inlining, may reduce binary size and improve performance with gcc9.3

Sep 15 2020, 4:16 AM · Restricted Project
njames93 added a comment to D87326: [ADT] Fix reference invalidation when self referencing a SmallVector.

Tested the newest version of this patch and I'm still seeing massive regressions, even larger than before.

Compile-time (instructions retired): https://llvm-compile-time-tracker.com/compare.php?from=cc947207283f934c72af0eb0b1a08978c59d40a2&to=d99c6d441764431519c1c11d490e7e88ffe06775&stat=instructions This is now a 1.4% geomean regression at O3, with 2% at O3, with tramp3d-v4 hitting 3%.

Max RSS: https://llvm-compile-time-tracker.com/compare.php?from=cc947207283f934c72af0eb0b1a08978c59d40a2&to=d99c6d441764431519c1c11d490e7e88ffe06775&stat=max-rss This is now a 1.6% geomean regression at O3, with 2.1% at O0.

Clang text size goes from 80560905 to 82179908, a 2% regression (non-LTO build using GCC 9.3).

I'm still seeing a different picture with clang-10 as the host compiler, I'm only targetting x86 which explains why my binaries are so much smaller than yours.

orig-o3  54404996
this-03  54046228
orig-lto 69549814
this-lto 65981798

The most likely reason for a larger binary in GCC is in the original file, the calls to grow weren't inlined. Now, most of that code for using a new buffer is inlined. Clang may handle things a little differently.
Maybe I could define the swap buffer methods out of line to dissuade inlining.

Sep 15 2020, 3:20 AM · Restricted Project

Sep 14 2020

njames93 updated the diff for D87326: [ADT] Fix reference invalidation when self referencing a SmallVector.

Add tests for SmallVector::assign to ensure contents aren't copied excessive amounts of times.

Sep 14 2020, 8:07 PM · Restricted Project
njames93 added a comment to D87627: [clang-tidy] Fix crash in modernize-use-noexcept on uninstantiated throw class.

Please fix the clang-format fail too.

Sep 14 2020, 7:53 PM · Restricted Project, Restricted Project
njames93 updated the diff for D87326: [ADT] Fix reference invalidation when self referencing a SmallVector.

Remove excessive this-> from GrowBuffer.
Use range-based loop instead of for_each.

Sep 14 2020, 7:46 PM · Restricted Project
njames93 added a comment to D87326: [ADT] Fix reference invalidation when self referencing a SmallVector.

Use global namespace new inside GrowBuffer.

Why this change? Would've thought op new overloads might be desirable, but I certainly don't know the specifics off-hand right now.

SmallVector seems to use global namespace new for all its operations, so I thought I'd follow the convention there.

Sep 14 2020, 7:46 PM · Restricted Project
njames93 added a comment to D87326: [ADT] Fix reference invalidation when self referencing a SmallVector.

Format was provided by clang-format-11. the pre-merge bot is using 10 so I think I should ignore the format messages.

Sep 14 2020, 7:33 AM · Restricted Project
njames93 updated the diff for D87326: [ADT] Fix reference invalidation when self referencing a SmallVector.

Move grow_size into SmallVectorBase

Sep 14 2020, 6:23 AM · Restricted Project
njames93 requested review of D87606: [ADT] Remove unnecessary copies in SmallVectorImpl::swap.
Sep 14 2020, 5:39 AM · Restricted Project
njames93 updated the diff for D87326: [ADT] Fix reference invalidation when self referencing a SmallVector.

Fix for the case if anyone tries SmallVector.emplace_back(SmallVector[X]) being invalidated on growth.
Added missing else if inside SmallVector append methods.
Refactored GrowBufferBase to take the Size_T as the template arguments to reduce template instantiations.
Use global namespace new inside GrowBuffer.

Sep 14 2020, 5:01 AM · Restricted Project
njames93 added a comment to D87326: [ADT] Fix reference invalidation when self referencing a SmallVector.

Yeah, seems that SmallVector::push_back should be fixed to allow a.push_back(a[0]). SmallVector::insert has been fixed in rL134554

It hasn't, that handles the case where the element to insert is moved when shifting the elements down to make room, but not when the element to insert is moved because of container growth.

Yeah, agreed. rL134554 was only half the fix (fixing the non-growth case). Your/this patch now fixes the other half (the growth case) and fixes the push_back case (which only has a problem on growth, doesn't have a problem on non-growth, unlike insert). Great! :)

Yeah thats whats happening here.

Sep 14 2020, 3:15 AM · Restricted Project
njames93 planned changes to D87237: [ADT] Add ASAN Support for SmallVector.

Adding some potential reviewers

Sep 14 2020, 2:07 AM · Restricted Project

Sep 13 2020

njames93 added a comment to D87326: [ADT] Fix reference invalidation when self referencing a SmallVector.

Yeah, seems that SmallVector::push_back should be fixed to allow a.push_back(a[0]). SmallVector::insert has been fixed in rL134554

Sep 13 2020, 1:32 AM · Restricted Project
njames93 updated the diff for D87326: [ADT] Fix reference invalidation when self referencing a SmallVector.

Address a few inlines

Sep 13 2020, 1:32 AM · Restricted Project
njames93 updated the diff for D87237: [ADT] Add ASAN Support for SmallVector.

Undo SmallVectorTest fix

Sep 13 2020, 1:06 AM · Restricted Project

Sep 12 2020

njames93 added a comment to D87326: [ADT] Fix reference invalidation when self referencing a SmallVector.

Hmm - I think maybe what I had trouble with was understanding how much this shuold generalize. Should this handle subranges? (if you try to append half of a vector onto itself) and if so, how? Anyone happen to know what's guaranteed by the standard (perhaps only push_back of single elements - that's easier to handle)

Sep 12 2020, 6:47 AM · Restricted Project

Sep 10 2020

njames93 added a comment to D87326: [ADT] Fix reference invalidation when self referencing a SmallVector.

Here's the compile-time impact I see with this change:

1.2% regression in instructions retired: https://llvm-compile-time-tracker.com/compare.php?from=3c42c0dcf631ad6b90e718df895c05f79718659f&to=606330864b2349e29beb460ae69fa41c0170674e&stat=instructions
1.0% max-rss regression: https://llvm-compile-time-tracker.com/compare.php?from=3c42c0dcf631ad6b90e718df895c05f79718659f&to=606330864b2349e29beb460ae69fa41c0170674e&stat=max-rss

The max-rss regression is presumably due to an increase in clang binary size. Manually checking the data, size-text goes from 80490755 to 81122130, i.e. 0.8% increase.

What build flags are you using. I tried a release build with thinlto. Also tried to move some of this code into the cpp file by type erasing the template out of GrowBufferBase.
For the record I'm testing on a Ryzen 2600X on ubuntu 20.04 and using clang-10 as the host compiler and linking with lld-10

trunk      - size.text = 42483D6, size.binary = 6141438
this       - size.text = 3EBD276, size.binary = 5DDD940
type-erase - size.text = 3EC0B26, size.binary = 5DE1290
Sep 10 2020, 2:13 PM · Restricted Project
njames93 updated the diff for D87326: [ADT] Fix reference invalidation when self referencing a SmallVector.

Fix build error when appending iterators of types convertible to SmallVector::value_type

Sep 10 2020, 5:56 AM · Restricted Project
njames93 updated the summary of D87326: [ADT] Fix reference invalidation when self referencing a SmallVector.
Sep 10 2020, 5:22 AM · Restricted Project
njames93 updated the diff for D87326: [ADT] Fix reference invalidation when self referencing a SmallVector.

Add buffer to append(iterator, iterator) to handle SmallVec.append(SmallVec.begin(), SmallVec.end());

Sep 10 2020, 5:12 AM · Restricted Project
njames93 added a comment to D87326: [ADT] Fix reference invalidation when self referencing a SmallVector.

Could you please rebase this to current master? I wasn't able to git apply it. (Sorry, Phabricator troubles. It's hard to believe that a code review tool is incapable of properly retaining merge bases.)

Sep 10 2020, 4:53 AM · Restricted Project
njames93 updated the diff for D87326: [ADT] Fix reference invalidation when self referencing a SmallVector.

Rebased trunk and fixed up assign to use new buffer

Sep 10 2020, 4:52 AM · Restricted Project

Sep 9 2020

njames93 updated the diff for D87326: [ADT] Fix reference invalidation when self referencing a SmallVector.

Extend behaviour to more methods.

Sep 9 2020, 6:56 PM · Restricted Project
njames93 updated the diff for D87326: [ADT] Fix reference invalidation when self referencing a SmallVector.

Harden test cases for SmallVector

Sep 9 2020, 4:48 PM · Restricted Project
njames93 added a comment to D87326: [ADT] Fix reference invalidation when self referencing a SmallVector.

For the clang tidy naming warnings, is it better to follow the warnings, or the current convention of the file?

Sep 9 2020, 7:45 AM · Restricted Project