[PATCH] D110386: [clangd] Refactor IncludeStructure: use File (unsigned) for most computations
Kirill Bobyrev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 27 07:35:07 PDT 2021
kbobyrev added inline comments.
================
Comment at: clang-tools-extra/clangd/unittests/HeadersTests.cpp:234
+ auto Includes = collectIncludes();
+ EXPECT_THAT(Includes.IncludeChildren[getID(MainFile)],
+ UnorderedElementsAreArray({getID(FooHeader), getID(BarHeader)}));
----------------
sammccall wrote:
> kbobyrev wrote:
> > sammccall wrote:
> > > Why are we asserting on every element of the map one at a time, instead of the whole map at once? Seems like it would be more regular and easier to read.
> > >
> > > I'd probably just write:
> > > ```
> > > DenseMap<HeaderID, SmallVector<HeaderID>> Expected = { ... };
> > > EXPECT_EQ(Expected, Includes.IncludeChildren);
> > > ```
> > This would expect the elements in the map to be in a particular order, isn't this something we don't want?
> `==` on DenseMap doesn't consider order.
>
> If you mean the order within map values (i.e. lists of child edges): these are in the order the `#includes` appear in the file, which seems fine to depend on to me
Yes, I initially meant the `SmallVector` order, but yeah, this seems reasonable, thank you!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110386/new/
https://reviews.llvm.org/D110386
More information about the cfe-commits
mailing list