Skip to content

Commit 6e4435e

Browse files
committed
Rename and avoid two calls
1 parent 00a6e51 commit 6e4435e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

clang-tools-extra/clang-tidy/modernize/UseDesignatedInitializersCheck.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ struct Designators {
4040
assert(InitList->isSyntacticForm());
4141
};
4242

43-
unsigned size() { return get().size(); }
43+
unsigned size() { return getCached().size(); }
4444

4545
std::optional<llvm::StringRef> operator[](const SourceLocation &Location) {
46-
const auto Result = get().find(Location);
47-
if (Result == get().end())
46+
const auto Designators = getCached();
47+
const auto Result = Designators.find(Location);
48+
if (Result == Designators.end())
4849
return {};
4950
return Result->getSecond();
5051
}
@@ -55,7 +56,7 @@ struct Designators {
5556
std::optional<LocationToNameMap> CachedDesignators;
5657
const InitListExpr *InitList;
5758

58-
LocationToNameMap &get() {
59+
LocationToNameMap &getCached() {
5960
return CachedDesignators ? *CachedDesignators
6061
: CachedDesignators.emplace(
6162
utils::getUnwrittenDesignators(InitList));

0 commit comments

Comments
 (0)