Skip to content

Commit 1ff2977

Browse files
committed
---
yaml --- r: 341726 b: refs/heads/rxwei-patch-1 c: 5022d8b h: refs/heads/master
1 parent 25e5ad8 commit 1ff2977

32 files changed

+126
-512
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-08-18-a: b10b1fce14385faa6d44f6b933e95
10151015
refs/heads/rdar-43033749-fix-batch-mode-no-diags-swift-5.0-branch: a14e64eaad30de89f0f5f0b2a782eed7ecdcb255
10161016
refs/heads/revert-19006-error-bridging-integer-type: 8a9065a3696535305ea53fe9b71f91cbe6702019
10171017
refs/heads/revert-19050-revert-19006-error-bridging-integer-type: ecf752d54b05dd0a20f510f0bfa54a3fec3bcaca
1018-
refs/heads/rxwei-patch-1: 277a4dc0366f39514434b8916d306e33416e89cc
1018+
refs/heads/rxwei-patch-1: 5022d8be5dc0527429785c6d6543bd6555550d1c
10191019
refs/heads/shahmishal-patch-1: e58ec0f7488258d42bef51bc3e6d7b3dc74d7b2a
10201020
refs/heads/typelist-existential: 4046359efd541fb5c72d69a92eefc0a784df8f5e
10211021
refs/tags/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-08-20-a: 4319ba09e4fb8650ee86061075c74a016b6baab9

branches/rxwei-patch-1/include/swift/AST/Expr.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -599,12 +599,6 @@ class CodeCompletionExpr : public Expr {
599599
class LiteralExpr : public Expr {
600600
public:
601601
LiteralExpr(ExprKind Kind, bool Implicit) : Expr(Kind, Implicit) {}
602-
603-
// Make an exact copy of this one AST node.
604-
LiteralExpr *
605-
shallowClone(ASTContext &Ctx,
606-
llvm::function_ref<void(Expr *, Type)> setType,
607-
llvm::function_ref<Type(const Expr *)> getType) const;
608602

609603
static bool classof(const Expr *E) {
610604
return E->getKind() >= ExprKind::First_LiteralExpr &&

branches/rxwei-patch-1/include/swift/Basic/SourceManager.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,14 +231,9 @@ class SourceManager {
231231
void verifyAllBuffers() const;
232232

233233
/// Translate line and column pair to the offset.
234-
/// If the column number is the maximum unsinged int, return the offset of the end of the line.
235234
llvm::Optional<unsigned> resolveFromLineCol(unsigned BufferId, unsigned Line,
236235
unsigned Col) const;
237236

238-
/// Translate the end position of the given line to the offset.
239-
llvm::Optional<unsigned> resolveOffsetForEndOfLine(unsigned BufferId,
240-
unsigned Line) const;
241-
242237
SourceLoc getLocForLineCol(unsigned BufferId, unsigned Line, unsigned Col) const {
243238
auto Offset = resolveFromLineCol(BufferId, Line, Col);
244239
return Offset.hasValue() ? getLocForOffset(BufferId, Offset.getValue()) :

branches/rxwei-patch-1/include/swift/Driver/Action.h

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,9 @@ class Action {
5252
GenerateDSYMJob,
5353
VerifyDebugInfoJob,
5454
GeneratePCHJob,
55-
LoadModuleJob,
5655

5756
JobFirst = CompileJob,
58-
JobLast = LoadModuleJob
57+
JobLast = GeneratePCHJob
5958
};
6059

6160
static const char *getClassName(Kind AC);
@@ -339,24 +338,6 @@ class StaticLinkJobAction : public JobAction {
339338
}
340339
};
341340

342-
/// An action that will attempt to load a specific module before any other
343-
/// actions.
344-
class LoadModuleJobAction : public JobAction {
345-
virtual void anchor();
346-
std::string moduleName;
347-
348-
public:
349-
LoadModuleJobAction(StringRef moduleName)
350-
: JobAction(Action::Kind::LoadModuleJob, {}, file_types::TY_Nothing),
351-
moduleName(moduleName) {}
352-
353-
StringRef getModuleName() const { return moduleName; }
354-
355-
static bool classof(const Action *A) {
356-
return A->getKind() == Action::Kind::LoadModuleJob;
357-
}
358-
};
359-
360341
} // end namespace driver
361342
} // end namespace swift
362343

branches/rxwei-patch-1/include/swift/Driver/ToolChain.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,6 @@ class ToolChain {
164164
virtual InvocationInfo constructInvocation(const StaticLinkJobAction &job,
165165
const JobContext &context) const;
166166

167-
virtual InvocationInfo constructInvocation(const LoadModuleJobAction &job,
168-
const JobContext &context) const;
169-
170167
/// Searches for the given executable in appropriate paths relative to the
171168
/// Swift binary.
172169
///

branches/rxwei-patch-1/lib/AST/Expr.cpp

Lines changed: 0 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -773,103 +773,6 @@ llvm::DenseMap<Expr *, unsigned> Expr::getPreorderIndexMap() {
773773
// Support methods for Exprs.
774774
//===----------------------------------------------------------------------===//
775775

776-
static LiteralExpr *
777-
shallowCloneImpl(const NilLiteralExpr *E, ASTContext &Ctx,
778-
llvm::function_ref<Type(const Expr *)> getType) {
779-
return new (Ctx) NilLiteralExpr(E->getLoc());
780-
}
781-
782-
static LiteralExpr *
783-
shallowCloneImpl(const IntegerLiteralExpr *E, ASTContext &Ctx,
784-
llvm::function_ref<Type(const Expr *)> getType) {
785-
auto res = new (Ctx) IntegerLiteralExpr(E->getDigitsText(),
786-
E->getSourceRange().End);
787-
if (E->isNegative())
788-
res->setNegative(E->getSourceRange().Start);
789-
return res;
790-
}
791-
792-
static LiteralExpr *
793-
shallowCloneImpl(const FloatLiteralExpr *E, ASTContext &Ctx,
794-
llvm::function_ref<Type(const Expr *)> getType) {
795-
auto res = new (Ctx) FloatLiteralExpr(E->getDigitsText(),
796-
E->getSourceRange().End);
797-
if (E->isNegative())
798-
res->setNegative(E->getSourceRange().Start);
799-
return res;
800-
}
801-
static LiteralExpr *
802-
shallowCloneImpl(const BooleanLiteralExpr *E, ASTContext &Ctx,
803-
llvm::function_ref<Type(const Expr *)> getType) {
804-
return new (Ctx) BooleanLiteralExpr(E->getValue(), E->getLoc());
805-
}
806-
static LiteralExpr *
807-
shallowCloneImpl(const StringLiteralExpr *E, ASTContext &Ctx,
808-
llvm::function_ref<Type(const Expr *)> getType) {
809-
auto res = new (Ctx) StringLiteralExpr(E->getValue(), E->getSourceRange());
810-
res->setEncoding(E->getEncoding());
811-
return res;
812-
}
813-
814-
static LiteralExpr *
815-
shallowCloneImpl(const InterpolatedStringLiteralExpr *E, ASTContext &Ctx,
816-
llvm::function_ref<Type(const Expr *)> getType) {
817-
auto res = new (Ctx) InterpolatedStringLiteralExpr(E->getLoc(),
818-
E->getTrailingQuoteLoc(),
819-
E->getLiteralCapacity(),
820-
E->getInterpolationCount(),
821-
E->getAppendingExpr());
822-
res->setSemanticExpr(E->getSemanticExpr());
823-
return res;
824-
}
825-
826-
static LiteralExpr *
827-
shallowCloneImpl(const MagicIdentifierLiteralExpr *E, ASTContext &Ctx,
828-
llvm::function_ref<Type(const Expr *)> getType) {
829-
auto res = new (Ctx) MagicIdentifierLiteralExpr(E->getKind(),
830-
E->getSourceRange().End);
831-
if (res->isString())
832-
res->setStringEncoding(E->getStringEncoding());
833-
return res;
834-
}
835-
836-
static LiteralExpr *
837-
shallowCloneImpl(const ObjectLiteralExpr *E, ASTContext &Ctx,
838-
llvm::function_ref<Type(const Expr *)> getType) {
839-
auto res =
840-
ObjectLiteralExpr::create(Ctx, E->getStartLoc(), E->getLiteralKind(),
841-
E->getArg(), E->isImplicit(), getType);
842-
return res;
843-
}
844-
845-
// Make an exact copy of this AST node.
846-
LiteralExpr *LiteralExpr::shallowClone(
847-
ASTContext &Ctx, llvm::function_ref<void(Expr *, Type)> setType,
848-
llvm::function_ref<Type(const Expr *)> getType) const {
849-
LiteralExpr *Result = nullptr;
850-
switch (getKind()) {
851-
default: llvm_unreachable("Unknown literal type!");
852-
#define DISPATCH_CLONE(KIND) \
853-
case ExprKind::KIND: \
854-
Result = shallowCloneImpl(cast<KIND##Expr>(this), Ctx, getType); \
855-
break;
856-
857-
DISPATCH_CLONE(NilLiteral)
858-
DISPATCH_CLONE(IntegerLiteral)
859-
DISPATCH_CLONE(FloatLiteral)
860-
DISPATCH_CLONE(BooleanLiteral)
861-
DISPATCH_CLONE(StringLiteral)
862-
DISPATCH_CLONE(InterpolatedStringLiteral)
863-
DISPATCH_CLONE(ObjectLiteral)
864-
DISPATCH_CLONE(MagicIdentifierLiteral)
865-
#undef DISPATCH_CLONE
866-
}
867-
868-
setType(Result, getType(this));
869-
Result->setImplicit(isImplicit());
870-
return Result;
871-
}
872-
873776
IntegerLiteralExpr * IntegerLiteralExpr::createFromUnsigned(ASTContext &C, unsigned value) {
874777
llvm::SmallString<8> Scratch;
875778
llvm::APInt(sizeof(unsigned)*8, value).toString(Scratch, 10, /*signed*/ false);

branches/rxwei-patch-1/lib/Basic/SourceLoc.cpp

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -310,19 +310,12 @@ void CharSourceRange::dump(const SourceManager &SM) const {
310310
print(llvm::errs(), SM);
311311
}
312312

313-
llvm::Optional<unsigned>
314-
SourceManager::resolveOffsetForEndOfLine(unsigned BufferId,
315-
unsigned Line) const {
316-
return resolveFromLineCol(BufferId, Line, ~0u);
317-
}
318-
319313
llvm::Optional<unsigned> SourceManager::resolveFromLineCol(unsigned BufferId,
320314
unsigned Line,
321315
unsigned Col) const {
322316
if (Line == 0 || Col == 0) {
323317
return None;
324318
}
325-
const bool LineEnd = Col == ~0u;
326319
auto InputBuf = getLLVMSourceMgr().getMemoryBuffer(BufferId);
327320
const char *Ptr = InputBuf->getBufferStart();
328321
const char *End = InputBuf->getBufferEnd();
@@ -338,18 +331,14 @@ llvm::Optional<unsigned> SourceManager::resolveFromLineCol(unsigned BufferId,
338331
return None;
339332
}
340333
Ptr = LineStart;
334+
341335
// The <= here is to allow for non-inclusive range end positions at EOF
342-
for (; ; ++Ptr) {
336+
for (; Ptr <= End; ++Ptr) {
343337
--Col;
344338
if (Col == 0)
345339
return Ptr - InputBuf->getBufferStart();
346-
if (*Ptr == '\n' || Ptr == End) {
347-
if (LineEnd) {
348-
return Ptr - InputBuf->getBufferStart();
349-
} else {
350-
break;
351-
}
352-
}
340+
if (*Ptr == '\n')
341+
break;
353342
}
354343
return None;
355344
}

branches/rxwei-patch-1/lib/Driver/Action.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ const char *Action::getClassName(Kind AC) {
3333
case Kind::GenerateDSYMJob: return "generate-dSYM";
3434
case Kind::VerifyDebugInfoJob: return "verify-debug-info";
3535
case Kind::GeneratePCHJob: return "generate-pch";
36-
case Kind::LoadModuleJob: return "load-module";
3736
}
3837

3938
llvm_unreachable("invalid class");
@@ -66,5 +65,3 @@ void GenerateDSYMJobAction::anchor() {}
6665
void VerifyDebugInfoJobAction::anchor() {}
6766

6867
void GeneratePCHJobAction::anchor() {}
69-
70-
void LoadModuleJobAction::anchor() {}

branches/rxwei-patch-1/lib/Driver/Driver.cpp

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,25 +1731,6 @@ Driver::computeCompilerMode(const DerivedArgList &Args,
17311731
return OutputInfo::Mode::SingleCompile;
17321732
}
17331733

1734-
/// Determines whether the given set of inputs has multiple .swift, .sil, or
1735-
/// .sib inputs, which will require loading the standard library.
1736-
static bool hasMultipleSourceFileInputs(ArrayRef<InputPair> inputs) {
1737-
bool hasFoundOneSourceFileAlready = false;
1738-
for (const InputPair &input : inputs) {
1739-
switch (input.first) {
1740-
case file_types::TY_Swift:
1741-
case file_types::TY_SIL:
1742-
case file_types::TY_SIB:
1743-
if (hasFoundOneSourceFileAlready)
1744-
return true;
1745-
hasFoundOneSourceFileAlready = true;
1746-
break;
1747-
default: break;
1748-
}
1749-
}
1750-
return false;
1751-
}
1752-
17531734
void Driver::buildActions(SmallVectorImpl<const Action *> &TopLevelActions,
17541735
const ToolChain &TC, const OutputInfo &OI,
17551736
const InputInfoMap *OutOfDateMap,
@@ -1768,18 +1749,6 @@ void Driver::buildActions(SmallVectorImpl<const Action *> &TopLevelActions,
17681749
switch (OI.CompilerMode) {
17691750
case OutputInfo::Mode::StandardCompile: {
17701751

1771-
// If we're not compiling the standard library, and we're going to schedule
1772-
// multiple parallel compile jobs, add an action before any others that
1773-
// will quickly load the standard library module.
1774-
// This will ensure that, if we need to build the standard library from
1775-
// a module interface, it happens once, rather than once per parallel
1776-
// invocation.
1777-
LoadModuleJobAction *preLoadStdlib = nullptr;
1778-
if (!Args.hasArg(options::OPT_parse_stdlib) &&
1779-
hasMultipleSourceFileInputs(Inputs)) {
1780-
preLoadStdlib = C.createAction<LoadModuleJobAction>(STDLIB_NAME);
1781-
}
1782-
17831752
// If the user is importing a textual (.h) bridging header and we're in
17841753
// standard-compile (non-WMO) mode, we take the opportunity to precompile
17851754
// the header into a temporary PCH, and replace the import argument with the
@@ -1803,15 +1772,6 @@ void Driver::buildActions(SmallVectorImpl<const Action *> &TopLevelActions,
18031772
}
18041773
}
18051774

1806-
// Adds the implicit dependencies for this job action, either generating
1807-
// a PCH, or pre-loading the standard library, or both.
1808-
auto addImplicitDeps = [&](Action *action) {
1809-
if (PCH)
1810-
cast<JobAction>(action)->addInput(PCH);
1811-
if (preLoadStdlib)
1812-
cast<JobAction>(action)->addInput(preLoadStdlib);
1813-
};
1814-
18151775
for (const InputPair &Input : Inputs) {
18161776
file_types::ID InputType = Input.first;
18171777
const Arg *InputArg = Input.second;
@@ -1833,15 +1793,17 @@ void Driver::buildActions(SmallVectorImpl<const Action *> &TopLevelActions,
18331793
if (Args.hasArg(options::OPT_embed_bitcode)) {
18341794
Current = C.createAction<CompileJobAction>(
18351795
Current, file_types::TY_LLVM_BC, previousBuildState);
1836-
addImplicitDeps(Current);
1796+
if (PCH)
1797+
cast<JobAction>(Current)->addInput(PCH);
18371798
AllModuleInputs.push_back(Current);
18381799
Current = C.createAction<BackendJobAction>(Current,
18391800
OI.CompilerOutputType, 0);
18401801
} else {
18411802
Current = C.createAction<CompileJobAction>(Current,
18421803
OI.CompilerOutputType,
18431804
previousBuildState);
1844-
addImplicitDeps(Current);
1805+
if (PCH)
1806+
cast<JobAction>(Current)->addInput(PCH);
18451807
AllModuleInputs.push_back(Current);
18461808
}
18471809
AllLinkerInputs.push_back(Current);

branches/rxwei-patch-1/lib/Driver/Job.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -383,14 +383,9 @@ void Job::printSummary(raw_ostream &os) const {
383383
if (const auto *IA = dyn_cast<InputAction>(A))
384384
Inputs.push_back(IA->getInputArg().getValue());
385385

386-
for (const Job *J : getInputs()) {
387-
// Some jobs might produce no output, so don't include them in the
388-
// list of inputs.
389-
if (J->getOutput().getPrimaryOutputType() == file_types::TY_Nothing)
390-
continue;
386+
for (const Job *J : getInputs())
391387
for (StringRef f : J->getOutput().getPrimaryOutputFilenames())
392388
Inputs.push_back(f);
393-
}
394389

395390
size_t limit = 3;
396391
size_t actual_in = Inputs.size();

branches/rxwei-patch-1/lib/Driver/ParseableOutput.cpp

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -146,27 +146,13 @@ class DetailedCommandBasedMessage : public CommandBasedMessage {
146146
});
147147
}
148148

149-
/// Subclasses can override this to determine if they should print empty
150-
/// arrays for `inputs` and `output`, or if they can omit them.
151-
virtual bool requireInputsAndOutputs() {
152-
return false;
153-
}
154-
155149
void provideMapping(swift::json::Output &out) override {
156150
Message::provideMapping(out);
157151
out.mapRequired("command", CommandLine); // Deprecated, do not document
158152
out.mapRequired("command_executable", Executable);
159153
out.mapRequired("command_arguments", Arguments);
160-
161-
// Some commands can choose to print empty arrays if their inputs and
162-
// outputs are empty.
163-
if (requireInputsAndOutputs()) {
164-
out.mapRequired("inputs", Inputs);
165-
out.mapRequired("outputs", Outputs);
166-
} else {
167-
out.mapOptional("inputs", Inputs);
168-
out.mapOptional("outputs", Outputs);
169-
}
154+
out.mapOptional("inputs", Inputs);
155+
out.mapOptional("outputs", Outputs);
170156
}
171157
};
172158

@@ -191,12 +177,6 @@ class BeganMessage : public DetailedCommandBasedMessage {
191177
: DetailedCommandBasedMessage("began", Cmd), Pid(Pid),
192178
ProcInfo(ProcInfo) {}
193179

194-
bool requireInputsAndOutputs() override {
195-
/// `began` messages should always print inputs and outputs, even if they
196-
/// are empty.
197-
return true;
198-
}
199-
200180
void provideMapping(swift::json::Output &out) override {
201181
DetailedCommandBasedMessage::provideMapping(out);
202182
out.mapRequired("pid", Pid);

branches/rxwei-patch-1/lib/Driver/ToolChain.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ std::unique_ptr<Job> ToolChain::constructJob(
106106
CASE(GeneratePCHJob)
107107
CASE(AutolinkExtractJob)
108108
CASE(REPLJob)
109-
CASE(LoadModuleJob)
110109
#undef CASE
111110
case Action::Kind::Input:
112111
llvm_unreachable("not a JobAction");

0 commit comments

Comments
 (0)