Skip to content

Commit da65685

Browse files
authored
[clang][bytecode][NFC] Remove FunctionPointer leftovers (#155761)
from EvaluationResult. `setFunctionPointer()` is unused.
1 parent 7b3745e commit da65685

File tree

3 files changed

+1
-13
lines changed

3 files changed

+1
-13
lines changed

clang/lib/AST/ByteCode/Disasm.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,8 +574,6 @@ LLVM_DUMP_METHOD void EvaluationResult::dump() const {
574574
OS << "LValue: ";
575575
if (const auto *P = std::get_if<Pointer>(&Value))
576576
P->toAPValue(ASTCtx).printPretty(OS, ASTCtx, SourceType);
577-
else if (const auto *FP = std::get_if<FunctionPointer>(&Value)) // Nope
578-
FP->toAPValue(ASTCtx).printPretty(OS, ASTCtx, SourceType);
579577
OS << "\n";
580578
break;
581579
}

clang/lib/AST/ByteCode/EvaluationResult.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ APValue EvaluationResult::toAPValue() const {
2323
// Either a pointer or a function pointer.
2424
if (const auto *P = std::get_if<Pointer>(&Value))
2525
return P->toAPValue(Ctx->getASTContext());
26-
else if (const auto *FP = std::get_if<FunctionPointer>(&Value))
27-
return FP->toAPValue(Ctx->getASTContext());
2826
else
2927
llvm_unreachable("Unhandled LValue type");
3028
break;
@@ -46,8 +44,6 @@ std::optional<APValue> EvaluationResult::toRValue() const {
4644
// We have a pointer and want an RValue.
4745
if (const auto *P = std::get_if<Pointer>(&Value))
4846
return P->toRValue(*Ctx, getSourceType());
49-
else if (const auto *FP = std::get_if<FunctionPointer>(&Value)) // Nope
50-
return FP->toAPValue(Ctx->getASTContext());
5147
llvm_unreachable("Unhandled lvalue kind");
5248
}
5349

clang/lib/AST/ByteCode/EvaluationResult.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#ifndef LLVM_CLANG_AST_INTERP_EVALUATION_RESULT_H
1010
#define LLVM_CLANG_AST_INTERP_EVALUATION_RESULT_H
1111

12-
#include "FunctionPointer.h"
1312
#include "Pointer.h"
1413
#include "clang/AST/APValue.h"
1514
#include "clang/AST/Decl.h"
@@ -43,7 +42,7 @@ class EvaluationResult final {
4342

4443
private:
4544
const Context *Ctx = nullptr;
46-
std::variant<std::monostate, Pointer, FunctionPointer, APValue> Value;
45+
std::variant<std::monostate, Pointer, APValue> Value;
4746
ResultKind Kind = Empty;
4847
DeclTy Source = nullptr; // Currently only needed for dump().
4948

@@ -61,11 +60,6 @@ class EvaluationResult final {
6160
Value = std::move(V);
6261
Kind = RValue;
6362
}
64-
void setFunctionPointer(const FunctionPointer &P) {
65-
assert(empty());
66-
Value = P;
67-
Kind = LValue;
68-
}
6963
void setInvalid() {
7064
// We are NOT asserting empty() here, since setting it to invalid
7165
// is allowed even if there is already a result.

0 commit comments

Comments
 (0)