aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ExprCXX.cpp
diff options
context:
space:
mode:
authorCraig Silverstein <csilvers2000@yahoo.com>2010-11-16 07:16:25 +0000
committerCraig Silverstein <csilvers2000@yahoo.com>2010-11-16 07:16:25 +0000
commita437ad3ec5b407ede394d74e6f9f463fa3657dbe (patch)
tree3d8cab3738ce7c04c1af84fb09462fb6a9cc387b /lib/AST/ExprCXX.cpp
parent11b39d48702e3f494c71eed0ede0c3d27c54160e (diff)
Have CXXDeleteExpr::getDestroyedType return the actual destroyed type
in more situations. In particular, for code like template<class T> void Fn() { T* x; delete x; } getDestroyedType() will now return T rather than T*, as it would before this change. On the other hand, for code like this: template<class T> void Fn() { T x; delete x; } getDestroyedType() will return an empty QualType(), since it doesn't know what the actual destroyed type would be. Previously, it would return T. OKed by rjmccall git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119334 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprCXX.cpp')
-rw-r--r--lib/AST/ExprCXX.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp
index 60785d471a..1820ff7707 100644
--- a/lib/AST/ExprCXX.cpp
+++ b/lib/AST/ExprCXX.cpp
@@ -162,8 +162,9 @@ QualType CXXDeleteExpr::getDestroyedType() const {
}
// The type-to-delete may not be a pointer if it's a dependent type.
const QualType ArgType = Arg->getType();
- if (ArgType->isDependentType())
- return ArgType;
+
+ if (ArgType->isDependentType() && !ArgType->isPointerType())
+ return QualType();
return ArgType->getAs<PointerType>()->getPointeeType();
}