Path: blob/main/contrib/llvm-project/clang/lib/AST/ByteCode/FunctionPointer.cpp
213799 views
//===----------------------- FunctionPointer.cpp ----------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "FunctionPointer.h"910namespace clang {11namespace interp {1213APValue FunctionPointer::toAPValue(const ASTContext &) const {14if (!Func)15return APValue(static_cast<Expr *>(nullptr), CharUnits::Zero(), {},16/*OnePastTheEnd=*/false, /*IsNull=*/true);1718if (Func->getDecl())19return APValue(Func->getDecl(), CharUnits::fromQuantity(0), {},20/*OnePastTheEnd=*/false, /*IsNull=*/false);21return APValue(Func->getExpr(), CharUnits::fromQuantity(0), {},22/*OnePastTheEnd=*/false, /*IsNull=*/false);23}2425void FunctionPointer::print(llvm::raw_ostream &OS) const {26OS << "FnPtr(";27if (Func)28OS << Func->getName();29else30OS << "nullptr";31OS << ")";32}3334} // namespace interp35} // namespace clang363738