[clang] da65685 - [clang][bytecode][NFC] Remove FunctionPointer leftovers (#155761)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 27 23:53:49 PDT 2025
Author: Timm Baeder
Date: 2025-08-28T08:53:45+02:00
New Revision: da656858936fef99e7e6d7ee6f775aa812d49530
URL: https://github.com/llvm/llvm-project/commit/da656858936fef99e7e6d7ee6f775aa812d49530
DIFF: https://github.com/llvm/llvm-project/commit/da656858936fef99e7e6d7ee6f775aa812d49530.diff
LOG: [clang][bytecode][NFC] Remove FunctionPointer leftovers (#155761)
from EvaluationResult. `setFunctionPointer()` is unused.
Added:
Modified:
clang/lib/AST/ByteCode/Disasm.cpp
clang/lib/AST/ByteCode/EvaluationResult.cpp
clang/lib/AST/ByteCode/EvaluationResult.h
Removed:
################################################################################
diff --git a/clang/lib/AST/ByteCode/Disasm.cpp b/clang/lib/AST/ByteCode/Disasm.cpp
index 58e6d1a722afa..4ea47eac2150c 100644
--- a/clang/lib/AST/ByteCode/Disasm.cpp
+++ b/clang/lib/AST/ByteCode/Disasm.cpp
@@ -574,8 +574,6 @@ LLVM_DUMP_METHOD void EvaluationResult::dump() const {
OS << "LValue: ";
if (const auto *P = std::get_if<Pointer>(&Value))
P->toAPValue(ASTCtx).printPretty(OS, ASTCtx, SourceType);
- else if (const auto *FP = std::get_if<FunctionPointer>(&Value)) // Nope
- FP->toAPValue(ASTCtx).printPretty(OS, ASTCtx, SourceType);
OS << "\n";
break;
}
diff --git a/clang/lib/AST/ByteCode/EvaluationResult.cpp b/clang/lib/AST/ByteCode/EvaluationResult.cpp
index 5110e243d167c..de049b4da90a7 100644
--- a/clang/lib/AST/ByteCode/EvaluationResult.cpp
+++ b/clang/lib/AST/ByteCode/EvaluationResult.cpp
@@ -23,8 +23,6 @@ APValue EvaluationResult::toAPValue() const {
// Either a pointer or a function pointer.
if (const auto *P = std::get_if<Pointer>(&Value))
return P->toAPValue(Ctx->getASTContext());
- else if (const auto *FP = std::get_if<FunctionPointer>(&Value))
- return FP->toAPValue(Ctx->getASTContext());
else
llvm_unreachable("Unhandled LValue type");
break;
@@ -46,8 +44,6 @@ std::optional<APValue> EvaluationResult::toRValue() const {
// We have a pointer and want an RValue.
if (const auto *P = std::get_if<Pointer>(&Value))
return P->toRValue(*Ctx, getSourceType());
- else if (const auto *FP = std::get_if<FunctionPointer>(&Value)) // Nope
- return FP->toAPValue(Ctx->getASTContext());
llvm_unreachable("Unhandled lvalue kind");
}
diff --git a/clang/lib/AST/ByteCode/EvaluationResult.h b/clang/lib/AST/ByteCode/EvaluationResult.h
index 49a3e5c00eea3..9785ec564d76e 100644
--- a/clang/lib/AST/ByteCode/EvaluationResult.h
+++ b/clang/lib/AST/ByteCode/EvaluationResult.h
@@ -9,7 +9,6 @@
#ifndef LLVM_CLANG_AST_INTERP_EVALUATION_RESULT_H
#define LLVM_CLANG_AST_INTERP_EVALUATION_RESULT_H
-#include "FunctionPointer.h"
#include "Pointer.h"
#include "clang/AST/APValue.h"
#include "clang/AST/Decl.h"
@@ -43,7 +42,7 @@ class EvaluationResult final {
private:
const Context *Ctx = nullptr;
- std::variant<std::monostate, Pointer, FunctionPointer, APValue> Value;
+ std::variant<std::monostate, Pointer, APValue> Value;
ResultKind Kind = Empty;
DeclTy Source = nullptr; // Currently only needed for dump().
@@ -61,11 +60,6 @@ class EvaluationResult final {
Value = std::move(V);
Kind = RValue;
}
- void setFunctionPointer(const FunctionPointer &P) {
- assert(empty());
- Value = P;
- Kind = LValue;
- }
void setInvalid() {
// We are NOT asserting empty() here, since setting it to invalid
// is allowed even if there is already a result.
More information about the cfe-commits
mailing list