Skip to content

Commit f6e145e

Browse files
committed
[NFC] Remove dead branch.
The variable `storage` was defined as `nullptr` a couple lines above and then is check for null, a spurious check. Eliminate that nullcheck--it's always true.
1 parent f1f0ccd commit f6e145e

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

lib/SILGen/SILGenType.cpp

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -423,24 +423,22 @@ template<typename T> class SILGenWitnessTable : public SILWitnessVisitor<T> {
423423

424424
// If it's not an accessor, just look for the witness.
425425
if (!reqAccessor) {
426-
if (!storage) {
427-
if (auto witness = asDerived().getWitness(reqDecl)) {
428-
auto newDecl = requirementRef.withDecl(witness.getDecl());
429-
// Only import C++ methods as foreign. If the following
430-
// Objective-C function is imported as foreign:
431-
// () -> String
432-
// It will be imported as the following type:
433-
// () -> NSString
434-
// But the first is correct, so make sure we don't mark this witness
435-
// as foreign.
436-
if (dyn_cast_or_null<clang::CXXMethodDecl>(
437-
witness.getDecl()->getClangDecl()))
438-
newDecl = newDecl.asForeign();
439-
return addMethodImplementation(
440-
requirementRef, getWitnessRef(newDecl, witness), witness);
441-
}
442-
return asDerived().addMissingMethod(requirementRef);
443-
} // else, fallthrough to the usual accessor handling!
426+
if (auto witness = asDerived().getWitness(reqDecl)) {
427+
auto newDecl = requirementRef.withDecl(witness.getDecl());
428+
// Only import C++ methods as foreign. If the following
429+
// Objective-C function is imported as foreign:
430+
// () -> String
431+
// It will be imported as the following type:
432+
// () -> NSString
433+
// But the first is correct, so make sure we don't mark this witness
434+
// as foreign.
435+
if (dyn_cast_or_null<clang::CXXMethodDecl>(
436+
witness.getDecl()->getClangDecl()))
437+
newDecl = newDecl.asForeign();
438+
return addMethodImplementation(
439+
requirementRef, getWitnessRef(newDecl, witness), witness);
440+
}
441+
return asDerived().addMissingMethod(requirementRef);
444442
} else {
445443
// Otherwise, we need to map the storage declaration and then get
446444
// the appropriate accessor for it.

0 commit comments

Comments
 (0)