Skip to content

Commit c88ac85

Browse files
committed
SR-11889: Fixed code review issues
1. Removed two braces {{ usage of Located initialization 2. Wrapped documentation into 80 characters
1 parent c1444de commit c88ac85

File tree

7 files changed

+15
-13
lines changed

7 files changed

+15
-13
lines changed

include/swift/Basic/Located.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212
//
13-
// Provides a currency data type Located<T> that should be used instead of std::pair<T, SourceLoc>.
13+
// Provides a currency data type Located<T> that should be used instead
14+
// of std::pair<T, SourceLoc>.
1415
//
1516
//===----------------------------------------------------------------------===//
1617

@@ -22,11 +23,12 @@
2223
namespace swift {
2324

2425
/// A currency type for keeping track of items which were found in the source code.
25-
///
26-
/// Several parts of the compiler need to keep track of a `SourceLoc` corresponding to an item, in case
27-
/// they need to report some diagnostics later. For example, the ClangImporter needs to keep track
28-
/// of where imports were originally written. Located makes it easy to do so while making the code
29-
/// more readable, compared to using `std::pair`.
26+
/// Several parts of the compiler need to keep track of a `SourceLoc` corresponding
27+
/// to an item, in case they need to report some diagnostics later. For example,
28+
/// the ClangImporter needs to keep track of where imports were originally written.
29+
/// Located makes it easy to do so while making the code more readable, compared to
30+
/// using `std::pair`.
31+
3032
template<typename T>
3133
struct Located {
3234

lib/AST/ASTContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1778,7 +1778,7 @@ ModuleDecl *ASTContext::getStdlibModule(bool loadIfAbsent) {
17781778
if (loadIfAbsent) {
17791779
auto mutableThis = const_cast<ASTContext*>(this);
17801780
TheStdlibModule =
1781-
mutableThis->getModule({{ StdlibModuleName, SourceLoc() }});
1781+
mutableThis->getModule({ Located<Identifier>(StdlibModuleName, SourceLoc()) });
17821782
} else {
17831783
TheStdlibModule = getLoadedModule(StdlibModuleName);
17841784
}

lib/Frontend/Frontend.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ ModuleDecl *CompilerInstance::importUnderlyingModule() {
778778
ModuleDecl *objCModuleUnderlyingMixedFramework =
779779
static_cast<ClangImporter *>(Context->getClangModuleLoader())
780780
->loadModule(SourceLoc(),
781-
{{MainModule->getName(), SourceLoc()}});
781+
{ Located<Identifier>(MainModule->getName(), SourceLoc()) });
782782
if (objCModuleUnderlyingMixedFramework)
783783
return objCModuleUnderlyingMixedFramework;
784784
Diagnostics.diagnose(SourceLoc(), diag::error_underlying_module_not_found,
@@ -808,7 +808,7 @@ void CompilerInstance::getImplicitlyImportedModules(
808808
if (Lexer::isIdentifier(ImplicitImportModuleName)) {
809809
auto moduleID = Context->getIdentifier(ImplicitImportModuleName);
810810
ModuleDecl *importModule =
811-
Context->getModule({{moduleID, SourceLoc()}});
811+
Context->getModule({ Located<Identifier>(moduleID, SourceLoc()) });
812812
if (importModule) {
813813
importModules.push_back(importModule);
814814
} else {

lib/FrontendTool/ImportedModules.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ bool swift::emitImportedModules(ASTContext &Context, ModuleDecl *mainModule,
9898
}
9999

100100
if (opts.ImportUnderlyingModule) {
101-
auto underlyingModule = clangImporter->loadModule(SourceLoc(), {{ mainModule->getName(), SourceLoc() }});
101+
auto underlyingModule = clangImporter->loadModule(SourceLoc(), { Located<Identifier>(mainModule->getName(), SourceLoc()) });
102102
if (!underlyingModule) {
103103
Context.Diags.diagnose(SourceLoc(),
104104
diag::error_underlying_module_not_found,

tools/SourceKit/lib/SwiftLang/SwiftDocSupport.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static ModuleDecl *getModuleByFullName(ASTContext &Ctx, StringRef ModuleName) {
5252
}
5353

5454
static ModuleDecl *getModuleByFullName(ASTContext &Ctx, Identifier ModuleName) {
55-
return Ctx.getModule({{ModuleName, SourceLoc()}});
55+
return Ctx.getModule({ Located<Identifier>(ModuleName, SourceLoc()) });
5656
}
5757

5858
namespace {

tools/SourceKit/lib/SwiftLang/SwiftEditorInterfaceGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static ModuleDecl *getModuleByFullName(ASTContext &Ctx, StringRef ModuleName) {
103103
}
104104

105105
static ModuleDecl *getModuleByFullName(ASTContext &Ctx, Identifier ModuleName) {
106-
return Ctx.getModule({{ModuleName, SourceLoc()}});
106+
return Ctx.getModule({ Located<Identifier>(ModuleName, SourceLoc()) });
107107
}
108108

109109
namespace {

tools/swift-ide-test/swift-ide-test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1600,7 +1600,7 @@ static ModuleDecl *getModuleByFullName(ASTContext &Context, StringRef ModuleName
16001600
}
16011601

16021602
static ModuleDecl *getModuleByFullName(ASTContext &Context, Identifier ModuleName) {
1603-
ModuleDecl *Result = Context.getModule({{ModuleName,SourceLoc()}});
1603+
ModuleDecl *Result = Context.getModule({ Located<Identifier>(ModuleName,SourceLoc()) });
16041604
if (!Result || Result->failedToLoad())
16051605
return nullptr;
16061606
return Result;

0 commit comments

Comments
 (0)