Skip to content

Commit 50ee3f4

Browse files
committed
ClangImporter: Adjust code after transition to clang::IdentifierLoc
See llvm/llvm-project#136077
1 parent 6e9d9e1 commit 50ee3f4

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ class BridgingPPTracker : public clang::PPCallbacks {
328328
return;
329329
SmallVector<clang::SourceLocation, 4> IdLocs;
330330
for (auto &P : Path)
331-
IdLocs.push_back(P.second);
331+
IdLocs.push_back(P.getLoc());
332332
handleImport(ImportLoc, IdLocs, Imported);
333333
}
334334

@@ -2291,17 +2291,15 @@ ModuleDecl *ClangImporter::Implementation::loadModuleClang(
22912291
auto realModuleName = SwiftContext.getRealModuleName(path.front().Item).str();
22922292

22932293
// Convert the Swift import path over to a Clang import path.
2294-
SmallVector<std::pair<clang::IdentifierInfo *, clang::SourceLocation>, 4>
2295-
clangPath;
2294+
SmallVector<clang::IdentifierLoc, 4> clangPath;
22962295
bool isTopModuleComponent = true;
22972296
for (auto component : path) {
22982297
StringRef item = isTopModuleComponent? realModuleName:
22992298
component.Item.str();
23002299
isTopModuleComponent = false;
23012300

2302-
clangPath.emplace_back(
2303-
getClangPreprocessor().getIdentifierInfo(item),
2304-
exportSourceLoc(component.Loc));
2301+
clangPath.emplace_back(exportSourceLoc(component.Loc),
2302+
getClangPreprocessor().getIdentifierInfo(item));
23052303
}
23062304

23072305
auto &diagEngine = Instance->getDiagnostics();
@@ -2311,14 +2309,13 @@ ModuleDecl *ClangImporter::Implementation::loadModuleClang(
23112309
auto loadModule = [&](clang::ModuleIdPath path,
23122310
clang::Module::NameVisibilityKind visibility)
23132311
-> clang::ModuleLoadResult {
2314-
auto importRAII =
2315-
diagClient.handleImport(clangPath.front().first, diagEngine,
2316-
importLoc);
2312+
auto importRAII = diagClient.handleImport(
2313+
clangPath.front().getIdentifierInfo(), diagEngine, importLoc);
23172314

23182315
std::string preservedIndexStorePathOption;
23192316
auto &clangFEOpts = Instance->getFrontendOpts();
23202317
if (!clangFEOpts.IndexStorePath.empty()) {
2321-
StringRef moduleName = path[0].first->getName();
2318+
StringRef moduleName = path[0].getIdentifierInfo()->getName();
23222319
// Ignore the SwiftShims module for the index data.
23232320
if (moduleName == SwiftContext.SwiftShimsModuleName.str()) {
23242321
preservedIndexStorePathOption = clangFEOpts.IndexStorePath;

0 commit comments

Comments
 (0)