diff options
| author | Craig Silverstein <csilvers2000@yahoo.com> | 2010-11-16 07:16:25 +0000 |
|---|---|---|
| committer | Craig Silverstein <csilvers2000@yahoo.com> | 2010-11-16 07:16:25 +0000 |
| commit | 9e448da3240813be12b9546cd60e5e755a52dd97 (patch) | |
| tree | b83547dc9fd9a316bfc9e16b074e4f9db7bcb943 /clang/lib | |
| parent | 4098598ca88c61d8c6123cd0f42e03ba57eb7f9f (diff) | |
| download | bcm5719-llvm-9e448da3240813be12b9546cd60e5e755a52dd97.tar.gz bcm5719-llvm-9e448da3240813be12b9546cd60e5e755a52dd97.zip | |
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
llvm-svn: 119334
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/AST/ExprCXX.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/AST/ExprCXX.cpp b/clang/lib/AST/ExprCXX.cpp index 60785d471ac..1820ff77074 100644 --- a/clang/lib/AST/ExprCXX.cpp +++ b/clang/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(); } |

