summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/APValue.cpp
diff options
context:
space:
mode:
authorChris Bieneman <chris.bieneman@me.com>2019-05-17 05:46:03 +0000
committerChris Bieneman <chris.bieneman@me.com>2019-05-17 05:46:03 +0000
commita971003e46774281f768c7f59c575827f60f27b4 (patch)
tree3ca250ccea8ff242661c8c36c136b7369e119585 /clang/lib/AST/APValue.cpp
parenta5a4124c494ce08a9decb96d2be94e7f216bedbd (diff)
downloadbcm5719-llvm-a971003e46774281f768c7f59c575827f60f27b4.tar.gz
bcm5719-llvm-a971003e46774281f768c7f59c575827f60f27b4.zip
Revert Refactor constant evaluation of typeid(T) to track a symbolic type_info object rather than tracking the originating expression.
This reverts r360974 (git commit 7ee4307bd4450022c3c8777f43a40cc4f0ccc009) llvm-svn: 360988
Diffstat (limited to 'clang/lib/AST/APValue.cpp')
-rw-r--r--clang/lib/AST/APValue.cpp59
1 files changed, 1 insertions, 58 deletions
diff --git a/clang/lib/AST/APValue.cpp b/clang/lib/AST/APValue.cpp
index 83b0fb5e1a2..e7902e68780 100644
--- a/clang/lib/AST/APValue.cpp
+++ b/clang/lib/AST/APValue.cpp
@@ -20,56 +20,6 @@
#include "llvm/Support/raw_ostream.h"
using namespace clang;
-/// The identity of a type_info object depends on the canonical unqualified
-/// type only.
-TypeInfoLValue::TypeInfoLValue(const Type *T)
- : T(T->getCanonicalTypeUnqualified().getTypePtr()) {}
-
-void TypeInfoLValue::print(llvm::raw_ostream &Out,
- const PrintingPolicy &Policy) const {
- Out << "typeid(";
- QualType(getType(), 0).print(Out, Policy);
- Out << ")";
-}
-
-static_assert(
- 1 << llvm::PointerLikeTypeTraits<TypeInfoLValue>::NumLowBitsAvailable <=
- alignof(const Type *),
- "Type is insufficiently aligned");
-
-APValue::LValueBase APValue::LValueBase::getTypeInfo(TypeInfoLValue LV,
- QualType TypeInfo) {
- LValueBase Base;
- Base.Ptr = LV;
- Base.TypeInfoType = TypeInfo.getAsOpaquePtr();
- return Base;
-}
-
-unsigned APValue::LValueBase::getCallIndex() const {
- return is<TypeInfoLValue>() ? 0 : Local.CallIndex;
-}
-
-unsigned APValue::LValueBase::getVersion() const {
- return is<TypeInfoLValue>() ? 0 : Local.Version;
-}
-
-QualType APValue::LValueBase::getTypeInfoType() const {
- assert(is<TypeInfoLValue>() && "not a type_info lvalue");
- return QualType::getFromOpaquePtr(TypeInfoType);
-}
-
-namespace clang {
-bool operator==(const APValue::LValueBase &LHS,
- const APValue::LValueBase &RHS) {
- if (LHS.Ptr != RHS.Ptr)
- return false;
- if (LHS.is<TypeInfoLValue>())
- return true;
- return LHS.Local.CallIndex == RHS.Local.CallIndex &&
- LHS.Local.Version == RHS.Local.Version;
-}
-}
-
namespace {
struct LVBase {
APValue::LValueBase Base;
@@ -110,8 +60,6 @@ llvm::DenseMapInfo<clang::APValue::LValueBase>::getTombstoneKey() {
namespace clang {
llvm::hash_code hash_value(const APValue::LValueBase &Base) {
- if (Base.is<TypeInfoLValue>())
- return llvm::hash_value(Base.getOpaqueValue());
return llvm::hash_combine(Base.getOpaqueValue(), Base.getCallIndex(),
Base.getVersion());
}
@@ -522,9 +470,7 @@ void APValue::printPretty(raw_ostream &Out, ASTContext &Ctx, QualType Ty) const{
if (const ValueDecl *VD = Base.dyn_cast<const ValueDecl*>())
Out << *VD;
- else if (TypeInfoLValue TI = Base.dyn_cast<TypeInfoLValue>()) {
- TI.print(Out, Ctx.getPrintingPolicy());
- } else {
+ else {
assert(Base.get<const Expr *>() != nullptr &&
"Expecting non-null Expr");
Base.get<const Expr*>()->printPretty(Out, nullptr,
@@ -549,9 +495,6 @@ void APValue::printPretty(raw_ostream &Out, ASTContext &Ctx, QualType Ty) const{
if (const ValueDecl *VD = Base.dyn_cast<const ValueDecl*>()) {
Out << *VD;
ElemTy = VD->getType();
- } else if (TypeInfoLValue TI = Base.dyn_cast<TypeInfoLValue>()) {
- TI.print(Out, Ctx.getPrintingPolicy());
- ElemTy = Base.getTypeInfoType();
} else {
const Expr *E = Base.get<const Expr*>();
assert(E != nullptr && "Expecting non-null Expr");
OpenPOWER on IntegriCloud