llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-modules @llvm/pr-subscribers-clang Author: None (yronglin) <details> <summary>Changes</summary> Currently we have many similiar data structures like: - `std::pair<IdentifierInfo *, SourceLocation>`. - Element type of `ModuleIdPath`. - `IdentifierLocPair`. - `IdentifierLoc`. This PR unify these data structures to `IdentifierLoc`. I found this issue when I working on https://github.com/llvm/llvm-project/pull/107168. --- Patch is 105.19 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/135808.diff 44 Files Affected: - (modified) clang/include/clang/AST/OpenACCClause.h (+2-2) - (modified) clang/include/clang/Basic/IdentifierTable.h (-3) - (modified) clang/include/clang/Basic/SourceLocation.h (+24) - (modified) clang/include/clang/Lex/ModuleLoader.h (+1-1) - (modified) clang/include/clang/Lex/Preprocessor.h (+4-5) - (modified) clang/include/clang/Parse/LoopHint.h (-1) - (modified) clang/include/clang/Parse/Parser.h (+5-8) - (modified) clang/include/clang/Sema/ParsedAttr.h (-10) - (modified) clang/include/clang/Sema/Sema.h (+1-1) - (modified) clang/include/clang/Sema/SemaCodeCompletion.h (+1-2) - (modified) clang/include/clang/Sema/SemaObjC.h (+2-2) - (modified) clang/include/clang/Sema/SemaOpenACC.h (+1-1) - (modified) clang/lib/AST/OpenACCClause.cpp (+2-2) - (modified) clang/lib/AST/TextNodeDumper.cpp (+2-2) - (modified) clang/lib/Frontend/CompilerInstance.cpp (+28-25) - (modified) clang/lib/Frontend/FrontendActions.cpp (+2-2) - (modified) clang/lib/Lex/PPDirectives.cpp (+11-11) - (modified) clang/lib/Lex/PPLexerChange.cpp (+3-3) - (modified) clang/lib/Lex/Pragma.cpp (+35-38) - (modified) clang/lib/Lex/Preprocessor.cpp (+8-8) - (modified) clang/lib/Parse/ParseDecl.cpp (+14-14) - (modified) clang/lib/Parse/ParseExpr.cpp (+4-3) - (modified) clang/lib/Parse/ParseHLSL.cpp (+1-1) - (modified) clang/lib/Parse/ParseObjc.cpp (+18-20) - (modified) clang/lib/Parse/ParseOpenACC.cpp (+7-5) - (modified) clang/lib/Parse/ParsePragma.cpp (+7-8) - (modified) clang/lib/Parse/ParseStmt.cpp (+3-3) - (modified) clang/lib/Parse/Parser.cpp (+9-10) - (modified) clang/lib/Sema/ParsedAttr.cpp (-8) - (modified) clang/lib/Sema/SemaARM.cpp (+1-1) - (modified) clang/lib/Sema/SemaCodeComplete.cpp (+4-4) - (modified) clang/lib/Sema/SemaDeclAttr.cpp (+65-59) - (modified) clang/lib/Sema/SemaDeclObjC.cpp (+19-16) - (modified) clang/lib/Sema/SemaHLSL.cpp (+6-6) - (modified) clang/lib/Sema/SemaModule.cpp (+23-19) - (modified) clang/lib/Sema/SemaObjC.cpp (+23-22) - (modified) clang/lib/Sema/SemaOpenACCClause.cpp (+6-5) - (modified) clang/lib/Sema/SemaStmtAttr.cpp (+16-13) - (modified) clang/lib/Sema/SemaSwift.cpp (+12-12) - (modified) clang/lib/Sema/SemaTemplateVariadic.cpp (+5-5) - (modified) clang/lib/Sema/SemaType.cpp (+6-7) - (modified) clang/lib/Serialization/ASTReader.cpp (+1-1) - (modified) clang/lib/Serialization/ASTWriter.cpp (+4-4) - (modified) clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp (+1-1) ``````````diff diff --git a/clang/include/clang/AST/OpenACCClause.h b/clang/include/clang/AST/OpenACCClause.h index 3687af76a559f..0f09fa7d0a698 100644 --- a/clang/include/clang/AST/OpenACCClause.h +++ b/clang/include/clang/AST/OpenACCClause.h @@ -258,7 +258,7 @@ inline bool operator!=(const OpenACCBindClause &LHS, return !(LHS == RHS); } -using DeviceTypeArgument = std::pair<IdentifierInfo *, SourceLocation>; +using DeviceTypeArgument = IdentifierLoc; /// A 'device_type' or 'dtype' clause, takes a list of either an 'asterisk' or /// an identifier. The 'asterisk' means 'the rest'. class OpenACCDeviceTypeClause final @@ -302,7 +302,7 @@ class OpenACCDeviceTypeClause final } bool hasAsterisk() const { return getArchitectures().size() > 0 && - getArchitectures()[0].first == nullptr; + getArchitectures()[0].getIdentifierInfo() == nullptr; } ArrayRef<DeviceTypeArgument> getArchitectures() const { diff --git a/clang/include/clang/Basic/IdentifierTable.h b/clang/include/clang/Basic/IdentifierTable.h index 0347880244a40..55ef6e571aff2 100644 --- a/clang/include/clang/Basic/IdentifierTable.h +++ b/clang/include/clang/Basic/IdentifierTable.h @@ -76,9 +76,6 @@ inline bool isReservedInAllContexts(ReservedIdentifierStatus Status) { Status != ReservedIdentifierStatus::StartsWithUnderscoreAndIsExternC; } -/// A simple pair of identifier info and location. -using IdentifierLocPair = std::pair<IdentifierInfo *, SourceLocation>; - /// IdentifierInfo and other related classes are aligned to /// 8 bytes so that DeclarationName can use the lower 3 bits /// of a pointer to one of these classes. diff --git a/clang/include/clang/Basic/SourceLocation.h b/clang/include/clang/Basic/SourceLocation.h index 7a0f5ba8d1270..8039172188746 100644 --- a/clang/include/clang/Basic/SourceLocation.h +++ b/clang/include/clang/Basic/SourceLocation.h @@ -31,6 +31,7 @@ template <typename T, typename Enable> struct FoldingSetTrait; namespace clang { +class IdentifierInfo; class SourceManager; /// An opaque identifier used by SourceManager which refers to a @@ -466,6 +467,29 @@ class FullSourceLoc : public SourceLocation { } }; +/// A simple pair of identifier info and location. +class IdentifierLoc { + SourceLocation Loc; + IdentifierInfo *II = nullptr; + +public: + IdentifierLoc() = default; + IdentifierLoc(SourceLocation L, IdentifierInfo *Ident) : Loc(L), II(Ident) {} + + void setLoc(SourceLocation L) { Loc = L; } + void setIdentifierInfo(IdentifierInfo *Ident) { II = Ident; } + SourceLocation getLoc() const { return Loc; } + IdentifierInfo *getIdentifierInfo() const { return II; } + + bool operator==(const IdentifierLoc &X) const { + return Loc == X.Loc && II == X.II; + } + + bool operator!=(const IdentifierLoc &X) const { + return Loc != X.Loc || II != X.II; + } +}; + } // namespace clang namespace llvm { diff --git a/clang/include/clang/Lex/ModuleLoader.h b/clang/include/clang/Lex/ModuleLoader.h index f880a9091a2ed..16597bbcb1a30 100644 --- a/clang/include/clang/Lex/ModuleLoader.h +++ b/clang/include/clang/Lex/ModuleLoader.h @@ -29,7 +29,7 @@ class IdentifierInfo; /// A sequence of identifier/location pairs used to describe a particular /// module or submodule, e.g., std.vector. -using ModuleIdPath = ArrayRef<std::pair<IdentifierInfo *, SourceLocation>>; +using ModuleIdPath = ArrayRef<IdentifierLoc>; /// Describes the result of attempting to load a module. class ModuleLoadResult { diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h index 24bb524783e93..f8f2f567f9171 100644 --- a/clang/include/clang/Lex/Preprocessor.h +++ b/clang/include/clang/Lex/Preprocessor.h @@ -327,7 +327,7 @@ class Preprocessor { SourceLocation ModuleImportLoc; /// The import path for named module that we're currently processing. - SmallVector<std::pair<IdentifierInfo *, SourceLocation>, 2> NamedModuleImportPath; + SmallVector<IdentifierLoc, 2> NamedModuleImportPath; llvm::DenseMap<FileID, SmallVector<const char *>> CheckPoints; unsigned CheckPointCounter = 0; @@ -622,7 +622,7 @@ class Preprocessor { /// The identifier and source location of the currently-active /// \#pragma clang arc_cf_code_audited begin. - std::pair<IdentifierInfo *, SourceLocation> PragmaARCCFCodeAuditedInfo; + IdentifierLoc PragmaARCCFCodeAuditedInfo; /// The source location of the currently-active /// \#pragma clang assume_nonnull begin. @@ -1998,8 +1998,7 @@ class Preprocessor { /// arc_cf_code_audited begin. /// /// Returns an invalid location if there is no such pragma active. - std::pair<IdentifierInfo *, SourceLocation> - getPragmaARCCFCodeAuditedInfo() const { + IdentifierLoc getPragmaARCCFCodeAuditedInfo() const { return PragmaARCCFCodeAuditedInfo; } @@ -2007,7 +2006,7 @@ class Preprocessor { /// arc_cf_code_audited begin. An invalid location ends the pragma. void setPragmaARCCFCodeAuditedInfo(IdentifierInfo *Ident, SourceLocation Loc) { - PragmaARCCFCodeAuditedInfo = {Ident, Loc}; + PragmaARCCFCodeAuditedInfo = IdentifierLoc(Loc, Ident); } /// The location of the currently-active \#pragma clang diff --git a/clang/include/clang/Parse/LoopHint.h b/clang/include/clang/Parse/LoopHint.h index cec5605ea3615..d8e67a6a79490 100644 --- a/clang/include/clang/Parse/LoopHint.h +++ b/clang/include/clang/Parse/LoopHint.h @@ -14,7 +14,6 @@ namespace clang { class Expr; -struct IdentifierLoc; /// Loop optimization hint for loop and unroll pragmas. struct LoopHint { diff --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h index 53da6269a3b11..fcc81b0c8f006 100644 --- a/clang/include/clang/Parse/Parser.h +++ b/clang/include/clang/Parse/Parser.h @@ -1725,8 +1725,8 @@ class Parser : public CodeCompletionHandler { ObjCTypeParamList *parseObjCTypeParamList(); ObjCTypeParamList *parseObjCTypeParamListOrProtocolRefs( ObjCTypeParamListScope &Scope, SourceLocation &lAngleLoc, - SmallVectorImpl<IdentifierLocPair> &protocolIdents, - SourceLocation &rAngleLoc, bool mayBeProtocolList = true); + SmallVectorImpl<IdentifierLoc> &protocolIdents, SourceLocation &rAngleLoc, + bool mayBeProtocolList = true); void HelperActionsForIvarDeclarations(ObjCContainerDecl *interfaceDecl, SourceLocation atLoc, @@ -3816,8 +3816,7 @@ class Parser : public CodeCompletionHandler { SourceLocation Loc, llvm::SmallVectorImpl<Expr *> &IntExprs); /// Parses the 'device-type-list', which is a list of identifiers. - bool ParseOpenACCDeviceTypeList( - llvm::SmallVector<std::pair<IdentifierInfo *, SourceLocation>> &Archs); + bool ParseOpenACCDeviceTypeList(llvm::SmallVector<IdentifierLoc> &Archs); /// Parses the 'async-argument', which is an integral value with two /// 'special' values that are likely negative (but come from Macros). OpenACCIntExprParseResult ParseOpenACCAsyncArgument(OpenACCDirectiveKind DK, @@ -3949,10 +3948,8 @@ class Parser : public CodeCompletionHandler { return false; } - bool ParseModuleName( - SourceLocation UseLoc, - SmallVectorImpl<std::pair<IdentifierInfo *, SourceLocation>> &Path, - bool IsImport); + bool ParseModuleName(SourceLocation UseLoc, + SmallVectorImpl<IdentifierLoc> &Path, bool IsImport); //===--------------------------------------------------------------------===// // C++11/G++: Type Traits [Type-Traits.html in the GCC manual] diff --git a/clang/include/clang/Sema/ParsedAttr.h b/clang/include/clang/Sema/ParsedAttr.h index b88b871dc8821..428d3111de80d 100644 --- a/clang/include/clang/Sema/ParsedAttr.h +++ b/clang/include/clang/Sema/ParsedAttr.h @@ -40,7 +40,6 @@ class LangOptions; class Sema; class Stmt; class TargetInfo; -struct IdentifierLoc; /// Represents information about a change in availability for /// an entity, which is part of the encoding of the 'availability' @@ -99,15 +98,6 @@ struct PropertyData { } // namespace detail -/// Wraps an identifier and optional source location for the identifier. -struct IdentifierLoc { - SourceLocation Loc; - IdentifierInfo *Ident; - - static IdentifierLoc *create(ASTContext &Ctx, SourceLocation Loc, - IdentifierInfo *Ident); -}; - /// A union of the various pointer types that can be passed to an /// ParsedAttr as an argument. using ArgsUnion = llvm::PointerUnion<Expr *, IdentifierLoc *>; diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 5ab0af8234e26..8c68830001fd9 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -143,7 +143,7 @@ enum class LangAS : unsigned int; class LocalInstantiationScope; class LookupResult; class MangleNumberingContext; -typedef ArrayRef<std::pair<IdentifierInfo *, SourceLocation>> ModuleIdPath; +typedef ArrayRef<IdentifierLoc> ModuleIdPath; class ModuleLoader; class MultiLevelTemplateArgumentList; struct NormalizedConstraint; diff --git a/clang/include/clang/Sema/SemaCodeCompletion.h b/clang/include/clang/Sema/SemaCodeCompletion.h index 72159de3a6e72..3029e56e5cfe2 100644 --- a/clang/include/clang/Sema/SemaCodeCompletion.h +++ b/clang/include/clang/Sema/SemaCodeCompletion.h @@ -193,8 +193,7 @@ class SemaCodeCompletion : public SemaBase { void CodeCompleteObjCForCollection(Scope *S, DeclGroupPtrTy IterationVar); void CodeCompleteObjCSelector(Scope *S, ArrayRef<const IdentifierInfo *> SelIdents); - void - CodeCompleteObjCProtocolReferences(ArrayRef<IdentifierLocPair> Protocols); + void CodeCompleteObjCProtocolReferences(ArrayRef<IdentifierLoc> Protocols); void CodeCompleteObjCProtocolDecl(Scope *S); void CodeCompleteObjCInterfaceDecl(Scope *S); void CodeCompleteObjCClassForwardDecl(Scope *S); diff --git a/clang/include/clang/Sema/SemaObjC.h b/clang/include/clang/Sema/SemaObjC.h index 791a7f45b832f..4cda41a82b61f 100644 --- a/clang/include/clang/Sema/SemaObjC.h +++ b/clang/include/clang/Sema/SemaObjC.h @@ -307,11 +307,11 @@ class SemaObjC : public SemaBase { DeclGroupPtrTy ActOnForwardProtocolDeclaration(SourceLocation AtProtoclLoc, - ArrayRef<IdentifierLocPair> IdentList, + ArrayRef<IdentifierLoc> IdentList, const ParsedAttributesView &attrList); void FindProtocolDeclaration(bool WarnOnDeclarations, bool ForObjCContainer, - ArrayRef<IdentifierLocPair> ProtocolId, + ArrayRef<IdentifierLoc> ProtocolId, SmallVectorImpl<Decl *> &Protocols); void DiagnoseTypeArgsAndProtocols(IdentifierInfo *ProtocolId, diff --git a/clang/include/clang/Sema/SemaOpenACC.h b/clang/include/clang/Sema/SemaOpenACC.h index 4c3a13a3b044f..8d31d46444c7e 100644 --- a/clang/include/clang/Sema/SemaOpenACC.h +++ b/clang/include/clang/Sema/SemaOpenACC.h @@ -212,7 +212,7 @@ class SemaOpenACC : public SemaBase { } LoopWithoutSeqInfo; // Redeclaration of the version in OpenACCClause.h. - using DeviceTypeArgument = std::pair<IdentifierInfo *, SourceLocation>; + using DeviceTypeArgument = IdentifierLoc; /// A type to represent all the data for an OpenACC Clause that has been /// parsed, but not yet created/semantically analyzed. This is effectively a diff --git a/clang/lib/AST/OpenACCClause.cpp b/clang/lib/AST/OpenACCClause.cpp index d7cbb51335359..2820d7b288658 100644 --- a/clang/lib/AST/OpenACCClause.cpp +++ b/clang/lib/AST/OpenACCClause.cpp @@ -891,10 +891,10 @@ void OpenACCClausePrinter::VisitDeviceTypeClause( OS << "("; llvm::interleaveComma(C.getArchitectures(), OS, [&](const DeviceTypeArgument &Arch) { - if (Arch.first == nullptr) + if (Arch.getIdentifierInfo() == nullptr) OS << "*"; else - OS << Arch.first->getName(); + OS << Arch.getIdentifierInfo()->getName(); }); OS << ")"; } diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp index b90f32389c897..1fce87ce3c9ae 100644 --- a/clang/lib/AST/TextNodeDumper.cpp +++ b/clang/lib/AST/TextNodeDumper.cpp @@ -500,10 +500,10 @@ void TextNodeDumper::Visit(const OpenACCClause *C) { llvm::interleaveComma( cast<OpenACCDeviceTypeClause>(C)->getArchitectures(), OS, [&](const DeviceTypeArgument &Arch) { - if (Arch.first == nullptr) + if (Arch.getIdentifierInfo() == nullptr) OS << "*"; else - OS << Arch.first->getName(); + OS << Arch.getIdentifierInfo()->getName(); }); OS << ")"; break; diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index eb138de9d20cc..9fb89b96c2c77 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -35,6 +35,7 @@ #include "clang/Lex/Preprocessor.h" #include "clang/Lex/PreprocessorOptions.h" #include "clang/Sema/CodeCompleteConsumer.h" +#include "clang/Sema/ParsedAttr.h" #include "clang/Sema/Sema.h" #include "clang/Serialization/ASTReader.h" #include "clang/Serialization/GlobalModuleIndex.h" @@ -2028,8 +2029,8 @@ CompilerInstance::loadModule(SourceLocation ImportLoc, Module::NameVisibilityKind Visibility, bool IsInclusionDirective) { // Determine what file we're searching from. - StringRef ModuleName = Path[0].first->getName(); - SourceLocation ModuleNameLoc = Path[0].second; + StringRef ModuleName = Path[0].getIdentifierInfo()->getName(); + SourceLocation ModuleNameLoc = Path[0].getLoc(); // If we've already handled this import, just return the cached result. // This one-element cache is important to eliminate redundant diagnostics @@ -2045,7 +2046,7 @@ CompilerInstance::loadModule(SourceLocation ImportLoc, // If we don't already have information on this module, load the module now. Module *Module = nullptr; ModuleMap &MM = getPreprocessor().getHeaderSearchInfo().getModuleMap(); - if (auto MaybeModule = MM.getCachedModuleLoad(*Path[0].first)) { + if (auto MaybeModule = MM.getCachedModuleLoad(*Path[0].getIdentifierInfo())) { // Use the cached result, which may be nullptr. Module = *MaybeModule; // Config macros are already checked before building a module, but they need @@ -2065,7 +2066,7 @@ CompilerInstance::loadModule(SourceLocation ImportLoc, // * `Preprocessor::HandleHeaderIncludeOrImport` will never call this // function as the `#include` or `#import` is textual. - MM.cacheModuleLoad(*Path[0].first, Module); + MM.cacheModuleLoad(*Path[0].getIdentifierInfo(), Module); } else { ModuleLoadResult Result = findOrCompileModuleAndReadAST( ModuleName, ImportLoc, ModuleNameLoc, IsInclusionDirective); @@ -2074,7 +2075,7 @@ CompilerInstance::loadModule(SourceLocation ImportLoc, if (!Result) DisableGeneratingGlobalModuleIndex = true; Module = Result; - MM.cacheModuleLoad(*Path[0].first, Module); + MM.cacheModuleLoad(*Path[0].getIdentifierInfo(), Module); } // If we never found the module, fail. Otherwise, verify the module and link @@ -2086,7 +2087,7 @@ CompilerInstance::loadModule(SourceLocation ImportLoc, // a submodule. bool MapPrivateSubModToTopLevel = false; for (unsigned I = 1, N = Path.size(); I != N; ++I) { - StringRef Name = Path[I].first->getName(); + StringRef Name = Path[I].getIdentifierInfo()->getName(); clang::Module *Sub = Module->findSubmodule(Name); // If the user is requesting Foo.Private and it doesn't exist, try to @@ -2097,10 +2098,10 @@ CompilerInstance::loadModule(SourceLocation ImportLoc, SmallString<128> PrivateModule(Module->Name); PrivateModule.append("_Private"); - SmallVector<std::pair<IdentifierInfo *, SourceLocation>, 2> PrivPath; + SmallVector<IdentifierLoc, 2> PrivPath; auto &II = PP->getIdentifierTable().get( PrivateModule, PP->getIdentifierInfo(Module->Name)->getTokenID()); - PrivPath.push_back(std::make_pair(&II, Path[0].second)); + PrivPath.emplace_back(Path[0].getLoc(), &II); std::string FileName; // If there is a modulemap module or prebuilt module, load it. @@ -2114,11 +2115,12 @@ CompilerInstance::loadModule(SourceLocation ImportLoc, PP->markClangModuleAsAffecting(Module); if (!getDiagnostics().isIgnored( diag::warn_no_priv_submodule_use_toplevel, ImportLoc)) { - getDiagnostics().Report(Path[I].second, + getDiagnostics().Report(Path[I].getLoc(), diag::warn_no_priv_submodule_use_toplevel) - << Path[I].first << Module->getFullModuleName() << PrivateModule - << SourceRange(Path[0].second, Path[I].second) - << FixItHint::CreateReplacement(SourceRange(Path[0].second), + << Path[I].getIdentifierInfo() << Module->getFullModuleName() + << PrivateModule + << SourceRange(Path[0].getLoc(), Path[I].getLoc()) + << FixItHint::CreateReplacement(SourceRange(Path[0].getLoc()), PrivateModule); getDiagnostics().Report(Sub->DefinitionLoc, diag::note_private_top_level_defined); @@ -2147,10 +2149,11 @@ CompilerInstance::loadModule(SourceLocation ImportLoc, // If there was a clear winner, user it. if (Best.size() == 1) { - getDiagnostics().Report(Path[I].second, diag::err_no_submodule_suggest) - << Path[I].first << Module->getFullModuleName() << Best[0] - << SourceRange(Path[0].second, Path[I - 1].second) - << FixItHint::CreateReplacement(SourceRange(Path[I].second), + getDiagnostics().Report(Path[I].getLoc(), + diag::err_no_submodule_suggest) + << Path[I].getIdentifierInfo() << Module->getFullModuleName() + << Best[0] << SourceRange(Path[0].getLoc(), Path[I - 1].getLoc()) + << FixItHint::CreateReplacement(SourceRange(Path[I].getLoc()), Best[0]); Sub = Module->findSubmodule(Best[0]); @@ -2160,9 +2163,9 @@ CompilerInstance::loadModule(SourceLocation ImportLoc, if (!Sub) { // No submodule by this name. Complain, and don't look for further // submodules. - getDiagnostics().Report(Path[I].second, diag::err_no_submodule) - << Path[I].first << Module->getFullModuleName() - << SourceRange(Path[0].second, Path[I - 1].second); + getDiagnostics().Report(Path[I].getLoc(), diag::err_no_submodule) + << Path[I].getIdentifierInfo() << Module->getFullModuleName() + << SourceRange(Path[0].getLoc(), Path[I - 1].getLoc()); break; } @@ -2180,8 +2183,8 @@ CompilerInstance::loadModule(SourceLocation ImportLoc, // FIXME: Should we detect this at module load time? It seems fairly // expensive (and rare). getDiagnostics().Report(ImportLoc, diag::warn_missing_submodule) - << Module->getFullModuleName() - << SourceRange(Path.front().second, Path.back().second); + << Module->getFullModuleName() + << SourceRange(Path.front().getLoc(), Path.back().getLoc()); return ModuleLoadResult(Module, ModuleLoadResult::MissingExpected); } @@ -2190,7 +2193,7 @@ CompilerInstance::loadModule(SourceLocation ImportLoc, if (Preprocessor::checkModuleIsAvailable(getLangOpts(), getTarget(), *Module, getDiagnostics())) { getDiagnostics().Report(ImportLoc, diag::note_module_import_here) - << SourceRange(Path.front().second, Path.back().second); + << SourceRange(Path.front().getLoc(), Path.back().getLoc()); LastModuleImportLoc = ImportLoc; LastModuleImportResult = ModuleLoadResult(); return ModuleLoadResult(); @@ -2316,9 +2319,9 @@ G... [truncated] `````````` </details> https://github.com/llvm/llvm-project/pull/135808 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits