Skip to content

Commit 226ba82

Browse files
committed
[ClangImporter] Add various const
`getSelector` now takes a `const clang::IdentifierInfo *` `ArrayRef`. Sprinkle a bunch of `const`s in.
1 parent 701800f commit 226ba82

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

include/swift/ClangImporter/SwiftAbstractBasicReader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class DataStreamBasicReader
7272
return clang::Selector();
7373

7474
unsigned numArgs = unsigned(numArgsPlusOne - 1);
75-
SmallVector<clang::IdentifierInfo *, 4> chunks;
75+
SmallVector<const clang::IdentifierInfo *, 4> chunks;
7676
for (unsigned i = 0, e = std::max(numArgs, 1U); i != e; ++i)
7777
chunks.push_back(asImpl().readIdentifier());
7878

lib/ClangImporter/ClangImporter.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,18 +1510,18 @@ ClangImporter::create(ASTContext &ctx,
15101510
importer->Impl.objectAtIndexedSubscript
15111511
= clangContext.Selectors.getUnarySelector(
15121512
&clangContext.Idents.get("objectAtIndexedSubscript"));
1513-
clang::IdentifierInfo *setObjectAtIndexedSubscriptIdents[2] = {
1514-
&clangContext.Idents.get("setObject"),
1515-
&clangContext.Idents.get("atIndexedSubscript")
1513+
const clang::IdentifierInfo *setObjectAtIndexedSubscriptIdents[2] = {
1514+
&clangContext.Idents.get("setObject"),
1515+
&clangContext.Idents.get("atIndexedSubscript"),
15161516
};
15171517
importer->Impl.setObjectAtIndexedSubscript
15181518
= clangContext.Selectors.getSelector(2, setObjectAtIndexedSubscriptIdents);
15191519
importer->Impl.objectForKeyedSubscript
15201520
= clangContext.Selectors.getUnarySelector(
15211521
&clangContext.Idents.get("objectForKeyedSubscript"));
1522-
clang::IdentifierInfo *setObjectForKeyedSubscriptIdents[2] = {
1523-
&clangContext.Idents.get("setObject"),
1524-
&clangContext.Idents.get("forKeyedSubscript")
1522+
const clang::IdentifierInfo *setObjectForKeyedSubscriptIdents[2] = {
1523+
&clangContext.Idents.get("setObject"),
1524+
&clangContext.Idents.get("forKeyedSubscript"),
15251525
};
15261526
importer->Impl.setObjectForKeyedSubscript
15271527
= clangContext.Selectors.getSelector(2, setObjectForKeyedSubscriptIdents);
@@ -2882,7 +2882,7 @@ ClangImporter::Implementation::exportSelector(DeclName name,
28822882

28832883
clang::ASTContext &ctx = getClangASTContext();
28842884

2885-
SmallVector<clang::IdentifierInfo *, 8> pieces;
2885+
SmallVector<const clang::IdentifierInfo *, 8> pieces;
28862886
pieces.push_back(exportName(name.getBaseIdentifier()).getAsIdentifierInfo());
28872887

28882888
auto argNames = name.getArgumentNames();
@@ -2901,7 +2901,7 @@ ClangImporter::Implementation::exportSelector(DeclName name,
29012901

29022902
clang::Selector
29032903
ClangImporter::Implementation::exportSelector(ObjCSelector selector) {
2904-
SmallVector<clang::IdentifierInfo *, 4> pieces;
2904+
SmallVector<const clang::IdentifierInfo *, 4> pieces;
29052905
for (auto piece : selector.getSelectorPieces())
29062906
pieces.push_back(exportName(piece).getAsIdentifierInfo());
29072907
return getClangASTContext().Selectors.getSelector(selector.getNumArgs(),
@@ -2917,7 +2917,7 @@ isPotentiallyConflictingSetter(const clang::ObjCProtocolDecl *proto,
29172917
if (sel.getNumArgs() != 1)
29182918
return false;
29192919

2920-
clang::IdentifierInfo *setterID = sel.getIdentifierInfoForSlot(0);
2920+
const clang::IdentifierInfo *setterID = sel.getIdentifierInfoForSlot(0);
29212921
if (!setterID || !setterID->getName().starts_with("set"))
29222922
return false;
29232923

lib/ClangImporter/ImportName.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1431,7 +1431,7 @@ bool NameImporter::hasErrorMethodNameCollision(
14311431
unsigned numArgs = selector.getNumArgs();
14321432
assert(numArgs > 0);
14331433

1434-
SmallVector<clang::IdentifierInfo *, 4> chunks;
1434+
SmallVector<const clang::IdentifierInfo *, 4> chunks;
14351435
for (unsigned i = 0, e = selector.getNumArgs(); i != e; ++i) {
14361436
chunks.push_back(selector.getIdentifierInfoForSlot(i));
14371437
}

tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1351,7 +1351,7 @@ getClangDeclarationName(const clang::NamedDecl *ND, NameTranslatingInfo &Info) {
13511351
return clang::DeclarationName();
13521352

13531353
ArrayRef<StringRef> Args = llvm::ArrayRef(Info.ArgNames);
1354-
std::vector<clang::IdentifierInfo *> Pieces;
1354+
std::vector<const clang::IdentifierInfo *> Pieces;
13551355
for (unsigned i = 0; i < NumPieces; ++i) {
13561356
if (i >= Info.ArgNames.size() || Info.ArgNames[i].empty()) {
13571357
Pieces.push_back(OrigSel.getIdentifierInfoForSlot(i));

0 commit comments

Comments
 (0)