Skip to content

Commit 61c2276

Browse files
committed
[include-cleaner] verbatimSpelling->verbatim, clean up some silly init-lists. NFC
1 parent 0d84566 commit 61c2276

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

clang-tools-extra/include-cleaner/include/clang-include-cleaner/Types.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ struct Header {
107107
Standard,
108108
/// A verbatim header spelling, a string quoted with <> or "" that can be
109109
/// #included directly.
110-
VerbatimSpelling,
110+
Verbatim,
111111
};
112112

113113
Header(const FileEntry *FE) : Storage(FE) {}
@@ -121,8 +121,8 @@ struct Header {
121121
tooling::stdlib::Header standard() const {
122122
return std::get<Standard>(Storage);
123123
}
124-
StringRef verbatimSpelling() const {
125-
return std::get<VerbatimSpelling>(Storage);
124+
StringRef verbatim() const {
125+
return std::get<Verbatim>(Storage);
126126
}
127127

128128
private:

clang-tools-extra/include-cleaner/lib/Analysis.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include "clang/Basic/SourceManager.h"
1414
#include "clang/Tooling/Inclusions/StandardLibrary.h"
1515
#include "llvm/ADT/ArrayRef.h"
16-
#include "llvm/ADT/STLExtras.h"
1716
#include "llvm/ADT/SmallVector.h"
1817

1918
namespace clang::include_cleaner {
@@ -29,11 +28,11 @@ void walkUsed(llvm::ArrayRef<Decl *> ASTRoots,
2928
if (auto SS = Recognizer(&ND)) {
3029
// FIXME: Also report forward decls from main-file, so that the caller
3130
// can decide to insert/ignore a header.
32-
return CB({Loc, Symbol(*SS), RT}, findIncludeHeaders({*SS}, SM, PI));
31+
return CB({Loc, Symbol(*SS), RT}, findIncludeHeaders(*SS, SM, PI));
3332
}
3433
// FIXME: Extract locations from redecls.
3534
return CB({Loc, Symbol(ND), RT},
36-
findIncludeHeaders({ND.getLocation()}, SM, PI));
35+
findIncludeHeaders(ND.getLocation(), SM, PI));
3736
});
3837
}
3938
for (const SymbolReference &MacroRef : MacroRefs) {
@@ -61,9 +60,9 @@ llvm::SmallVector<Header> findIncludeHeaders(const SymbolLocation &SLoc,
6160
// header.
6261
llvm::StringRef VerbatimSpelling = PI.getPublic(FE);
6362
if (!VerbatimSpelling.empty())
64-
return {{VerbatimSpelling}};
63+
return {Header(VerbatimSpelling)};
6564

66-
Results = {{FE}};
65+
Results = {Header(FE)};
6766
// FIXME: compute transitive exporter headers.
6867
for (const auto *Export : PI.getExporters(FE, SM.getFileManager()))
6968
Results.push_back(Export);

clang-tools-extra/include-cleaner/lib/Record.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,8 @@ RecordedPP::RecordedIncludes::match(Header H) const {
332332
for (unsigned I : BySpelling.lookup(H.standard().name().trim("<>")))
333333
Result.push_back(&All[I]);
334334
break;
335-
case Header::VerbatimSpelling:
336-
for (unsigned I : BySpelling.lookup(H.verbatimSpelling().trim("\"<>")))
335+
case Header::Verbatim:
336+
for (unsigned I : BySpelling.lookup(H.verbatim().trim("\"<>")))
337337
Result.push_back(&All[I]);
338338
break;
339339
}

clang-tools-extra/include-cleaner/lib/Types.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Header &H) {
3434
return OS << H.physical()->getName();
3535
case Header::Standard:
3636
return OS << H.standard().name();
37-
case Header::VerbatimSpelling:
38-
return OS << H.verbatimSpelling();
37+
case Header::Verbatim:
38+
return OS << H.verbatim();
3939
}
4040
llvm_unreachable("Unhandled Header kind");
4141
}

0 commit comments

Comments
 (0)