Skip to content

Commit

Permalink
Fix -Wunused-but-set-variable warnings in swift demangling code
Browse files Browse the repository at this point in the history
  • Loading branch information
nico committed Aug 5, 2024
1 parent b238477 commit 8242cd4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions third_party/swift/lib/Demangling/Demangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ NodePointer Demangler::demangleSymbolicReference(unsigned char rawKind) {
}

NodePointer Demangler::demangleTypeAnnotation() {
switch (char c2 = nextChar()) {
switch (nextChar()) {
case 'a':
return createNode(Node::Kind::AsyncAnnotation);
case 'A':
Expand Down Expand Up @@ -1019,7 +1019,7 @@ NodePointer Demangler::demangleOperator() {
case 'F': return demanglePlainFunction();
case 'G': return demangleBoundGenericType();
case 'H':
switch (char c2 = nextChar()) {
switch (nextChar()) {
case 'A': return demangleDependentProtocolConformanceAssociated();
case 'C': return demangleConcreteProtocolConformance();
case 'D': return demangleDependentProtocolConformanceRoot();
Expand Down Expand Up @@ -1200,7 +1200,7 @@ NodePointer Demangler::createSwiftType(Node::Kind typeKind, const char *name) {
}

NodePointer Demangler::demangleStandardSubstitution() {
switch (char c = nextChar()) {
switch (nextChar()) {
case 'o':
return createNode(Node::Kind::Module, MANGLING_MODULE_OBJC);
case 'C':
Expand Down Expand Up @@ -3112,7 +3112,7 @@ NodePointer Demangler::demangleDifferentiabilityWitness() {
result = addChild(result, node);
result->reverseChildren();
MangledDifferentiabilityKind kind;
switch (auto c = nextChar()) {
switch (nextChar()) {
case 'f': kind = MangledDifferentiabilityKind::Forward; break;
case 'r': kind = MangledDifferentiabilityKind::Reverse; break;
case 'd': kind = MangledDifferentiabilityKind::Normal; break;
Expand Down Expand Up @@ -3144,7 +3144,7 @@ NodePointer Demangler::demangleIndexSubset() {

NodePointer Demangler::demangleDifferentiableFunctionType() {
MangledDifferentiabilityKind kind;
switch (auto c = nextChar()) {
switch (nextChar()) {
case 'f': kind = MangledDifferentiabilityKind::Forward; break;
case 'r': kind = MangledDifferentiabilityKind::Reverse; break;
case 'd': kind = MangledDifferentiabilityKind::Normal; break;
Expand All @@ -3157,7 +3157,7 @@ NodePointer Demangler::demangleDifferentiableFunctionType() {

static std::optional<MangledLifetimeDependenceKind>
getMangledLifetimeDependenceKind(char nextChar) {
switch (auto c = nextChar) {
switch (nextChar) {
case 's':
return MangledLifetimeDependenceKind::Scope;
case 'i':
Expand Down Expand Up @@ -3660,7 +3660,7 @@ NodePointer Demangler::demangleWitness() {
case 'z': {
auto declList = createNode(Node::Kind::GlobalVariableOnceDeclList);
std::vector<NodePointer> vars;
while (auto sig = popNode(Node::Kind::FirstElementMarker)) {
while (popNode(Node::Kind::FirstElementMarker)) {
auto identifier = popNode(isDeclName);
if (!identifier)
return nullptr;
Expand Down Expand Up @@ -3711,7 +3711,7 @@ NodePointer Demangler::demangleSpecialType() {
case 'j':
return demangleSymbolicExtendedExistentialType();
case 'z':
switch (auto cchar = nextChar()) {
switch (nextChar()) {
case 'B':
return popFunctionType(Node::Kind::ObjCBlock, true);
case 'C':
Expand Down
2 changes: 1 addition & 1 deletion third_party/swift/lib/Demangling/Remangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1979,7 +1979,7 @@ ManglingError Remangler::mangleImplFunctionType(Node *node, unsigned depth) {
Node *PatternSubs = nullptr;
Node *InvocationSubs = nullptr;
for (NodePointer Child : *node) {
switch (auto kind = Child->getKind()) {
switch (Child->getKind()) {
case Node::Kind::ImplParameter:
case Node::Kind::ImplResult:
case Node::Kind::ImplYield:
Expand Down

0 comments on commit 8242cd4

Please sign in to comment.