r298842 - Publish one more parser RAII for external use.

Vassil Vassilev via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 27 06:11:32 PDT 2017


Author: vvassilev
Date: Mon Mar 27 08:11:32 2017
New Revision: 298842

URL: http://llvm.org/viewvc/llvm-project?rev=298842&view=rev
Log:
Publish one more parser RAII for external use.

Modified:
    cfe/trunk/include/clang/Parse/RAIIObjectsForParser.h
    cfe/trunk/lib/Parse/Parser.cpp

Modified: cfe/trunk/include/clang/Parse/RAIIObjectsForParser.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/RAIIObjectsForParser.h?rev=298842&r1=298841&r2=298842&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/RAIIObjectsForParser.h (original)
+++ cfe/trunk/include/clang/Parse/RAIIObjectsForParser.h Mon Mar 27 08:11:32 2017
@@ -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

Modified: cfe/trunk/lib/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=298842&r1=298841&r2=298842&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/Parser.cpp (original)
+++ cfe/trunk/lib/Parse/Parser.cpp Mon Mar 27 08:11:32 2017
@@ -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() {




More information about the cfe-commits mailing list