diff options
Diffstat (limited to 'clang/lib/AST/ByteCode/Pointer.cpp')
-rw-r--r-- | clang/lib/AST/ByteCode/Pointer.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/clang/lib/AST/ByteCode/Pointer.cpp b/clang/lib/AST/ByteCode/Pointer.cpp index 5b52261..918a434 100644 --- a/clang/lib/AST/ByteCode/Pointer.cpp +++ b/clang/lib/AST/ByteCode/Pointer.cpp @@ -152,8 +152,15 @@ APValue Pointer::toAPValue(const ASTContext &ASTCtx) const { CharUnits::fromQuantity(asIntPointer().Value + this->Offset), Path, /*IsOnePastEnd=*/false, /*IsNullPtr=*/false); - if (isFunctionPointer()) - return asFunctionPointer().toAPValue(ASTCtx); + if (isFunctionPointer()) { + const FunctionPointer &FP = asFunctionPointer(); + if (const FunctionDecl *FD = FP.getFunction()->getDecl()) + return APValue(FD, CharUnits::fromQuantity(FP.getOffset() + Offset), {}, + /*OnePastTheEnd=*/false, /*IsNull=*/false); + return APValue(FP.getFunction()->getExpr(), + CharUnits::fromQuantity(FP.getOffset() + Offset), {}, + /*OnePastTheEnd=*/false, /*IsNull=*/false); + } if (isTypeidPointer()) { TypeInfoLValue TypeInfo(PointeeStorage.Typeid.TypePtr); @@ -379,6 +386,9 @@ std::string Pointer::toDiagnosticString(const ASTContext &Ctx) const { if (isIntegralPointer()) return (Twine("&(") + Twine(asIntPointer().Value + Offset) + ")").str(); + if (isFunctionPointer()) + return asFunctionPointer().toDiagnosticString(Ctx); + return toAPValue(Ctx).getAsString(Ctx, getType()); } |