]> granicus.if.org Git - clang/commitdiff
Make DISABLE_SMART_POINTERS work, again
authorDouglas Gregor <dgregor@apple.com>
Wed, 29 Apr 2009 23:37:31 +0000 (23:37 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 29 Apr 2009 23:37:31 +0000 (23:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70443 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Parse/Ownership.h

index 652fc46505da475390f449a59b51d55ffb043298..54c04c2c4d7bd3110ce3f0625bf81883a08ccd6a 100644 (file)
@@ -379,6 +379,12 @@ namespace clang {
       return Node;
     }
 
+    /// Take outside ownership of the raw pointer and cast it down.
+    template<typename T>
+    T *takeAs() {
+      return static_cast<T*>(Node);
+    }
+
     /// Alias for interface familiarity with unique_ptr.
     void * release() {
       return take();
@@ -698,8 +704,9 @@ namespace clang {
     unsigned size() const { return Count; }
 
     void reset(void **args, bool *argIsType, unsigned count) {
+#if !defined(DISABLE_SMART_POINTERS)
       destroy();
-
+#endif
       Args = args;
       ArgIsType = argIsType;
       Count = count;