From: Vassil Vassilev Date: Mon, 27 Mar 2017 13:11:32 +0000 (+0000) Subject: Publish one more parser RAII for external use. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=10d0b66f7cf4d8851255f35ce81ea5b3825d370b;p=clang Publish one more parser RAII for external use. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298842 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Parse/RAIIObjectsForParser.h b/include/clang/Parse/RAIIObjectsForParser.h index 36d87ebd8a..0422b038da 100644 --- a/include/clang/Parse/RAIIObjectsForParser.h +++ b/include/clang/Parse/RAIIObjectsForParser.h @@ -18,6 +18,7 @@ #include "clang/Parse/ParseDiagnostic.h" #include "clang/Parse/Parser.h" #include "clang/Sema/DelayedDiagnostic.h" +#include "clang/Sema/ParsedTemplate.h" #include "clang/Sema/Sema.h" namespace clang { @@ -442,6 +443,25 @@ namespace clang { void skipToEnd(); }; + /// \brief RAIIObject to destroy the contents of a SmallVector of + /// TemplateIdAnnotation pointers and clear the vector. + class DestroyTemplateIdAnnotationsRAIIObj { + SmallVectorImpl &Container; + + public: + DestroyTemplateIdAnnotationsRAIIObj( + SmallVectorImpl &Container) + : Container(Container) {} + + ~DestroyTemplateIdAnnotationsRAIIObj() { + for (SmallVectorImpl::iterator I = + Container.begin(), + E = Container.end(); + I != E; ++I) + (*I)->Destroy(); + Container.clear(); + } + }; } // end namespace clang #endif diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp index c938cc9b5e..08b7661a8a 100644 --- a/lib/Parse/Parser.cpp +++ b/lib/Parse/Parser.cpp @@ -37,26 +37,6 @@ public: return false; } }; - -/// \brief RAIIObject to destroy the contents of a SmallVector of -/// TemplateIdAnnotation pointers and clear the vector. -class DestroyTemplateIdAnnotationsRAIIObj { - SmallVectorImpl &Container; - -public: - DestroyTemplateIdAnnotationsRAIIObj( - SmallVectorImpl &Container) - : Container(Container) {} - - ~DestroyTemplateIdAnnotationsRAIIObj() { - for (SmallVectorImpl::iterator I = - Container.begin(), - E = Container.end(); - I != E; ++I) - (*I)->Destroy(); - Container.clear(); - } -}; } // end anonymous namespace IdentifierInfo *Parser::getSEHExceptKeyword() {