Publish one more parser RAII for external use.

llvm-svn: 298842
This commit is contained in:
Vassil Vassilev 2017-03-27 13:11:32 +00:00
parent 8444d106d5
commit d2a97e0b7e
2 changed files with 20 additions and 20 deletions

View File

@ -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<TemplateIdAnnotation *> &Container;
public:
DestroyTemplateIdAnnotationsRAIIObj(
SmallVectorImpl<TemplateIdAnnotation *> &Container)
: Container(Container) {}
~DestroyTemplateIdAnnotationsRAIIObj() {
for (SmallVectorImpl<TemplateIdAnnotation *>::iterator I =
Container.begin(),
E = Container.end();
I != E; ++I)
(*I)->Destroy();
Container.clear();
}
};
} // end namespace clang
#endif

View File

@ -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<TemplateIdAnnotation *> &Container;
public:
DestroyTemplateIdAnnotationsRAIIObj(
SmallVectorImpl<TemplateIdAnnotation *> &Container)
: Container(Container) {}
~DestroyTemplateIdAnnotationsRAIIObj() {
for (SmallVectorImpl<TemplateIdAnnotation *>::iterator I =
Container.begin(),
E = Container.end();
I != E; ++I)
(*I)->Destroy();
Container.clear();
}
};
} // end anonymous namespace
IdentifierInfo *Parser::getSEHExceptKeyword() {