summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-06-22 06:09:49 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-06-22 06:09:49 +0000
commitc0c5dd26513c9482af4ce1f3501cfb435f86940e (patch)
tree34f0aec64bd1c83689e2f4da120ac176ea753e72 /clang/lib/Parse/ParseDecl.cpp
parentfc0bb5855b28fd75d96b6bd7e3e1e618d1d144fb (diff)
downloadbcm5719-llvm-c0c5dd26513c9482af4ce1f3501cfb435f86940e.tar.gz
bcm5719-llvm-c0c5dd26513c9482af4ce1f3501cfb435f86940e.zip
Introduce DelayedCleanupPool useful for simplifying clean-up of certain resources that, while their
lifetime is well-known and restricted, cleaning them up manually is easy to miss and cause a leak. Use it to plug the leaking of TemplateIdAnnotation objects. rdar://9634138. llvm-svn: 133610
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r--clang/lib/Parse/ParseDecl.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 9af7345fdd6..99441e0e0e3 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -1396,8 +1396,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
// Thus, if the template-name is actually the constructor
// name, then the code is ill-formed; this interpretation is
// reinforced by the NAD status of core issue 635.
- TemplateIdAnnotation *TemplateId
- = static_cast<TemplateIdAnnotation *>(Next.getAnnotationValue());
+ TemplateIdAnnotation *TemplateId = takeTemplateIdAnnotation(Next);
if ((DSContext == DSC_top_level ||
(DSContext == DSC_class && DS.isFriendSpecified())) &&
TemplateId->Name &&
@@ -1599,8 +1598,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
// type-name
case tok::annot_template_id: {
- TemplateIdAnnotation *TemplateId
- = static_cast<TemplateIdAnnotation *>(Tok.getAnnotationValue());
+ TemplateIdAnnotation *TemplateId = takeTemplateIdAnnotation(Tok);
if (TemplateId->Kind != TNK_Type_template) {
// This template-id does not refer to a type name, so we're
// done with the type-specifiers.
OpenPOWER on IntegriCloud