[PATCH] Change OwningPtr::take() to OwningPtr::release().

David Blaikie dblaikie at gmail.com
Fri Mar 7 08:41:08 PST 2014


  So much unspecified transfer of ownership :( But thanks for the porting work.

  Now that we've got a device to describe the actual transfer hopefully we can remove many of these cases of passing ownership by raw pointer.

  Feel free to commit - only some optional comments on the reformatting.


================
Comment at: include/clang/Frontend/FrontendAction.h:149
@@ -148,5 +148,3 @@
 
-  ASTUnit *takeCurrentASTUnit() {
-    return CurrentASTUnit.take();
-  }
+  ASTUnit *takeCurrentASTUnit() { return CurrentASTUnit.release(); }
 
----------------
I think clang-format might now have a mode in which it doesn't reformat lines you didn't edit (so this would remain on 3 lines instead of being clumped into one)... 

But I'm not too fussed - just a possible FYI for this or next time in case you endu p dealing with more complicated patches that would benefit from easier diffs.

================
Comment at: lib/CodeGen/ModuleBuilder.cpp:51
@@ -50,5 +50,3 @@
 
-    virtual llvm::Module* ReleaseModule() {
-      return M.take();
-    }
+    virtual llvm::Module *ReleaseModule() { return M.release(); }
 
----------------
Feel free to commit cleanup (like the moved '*' or the move to one-line - if you aren't using the "only modify lines I touched" thing I mentioned earlier - or if I hallucinated and that doesn't really exist) ahead of time without precommit review if you like - though it's not a big deal on a patch like this that's been manufactured by replacements and clang-format.

================
Comment at: lib/Frontend/CompilerInstance.cpp:162
@@ -161,3 +161,2 @@
-    clang::serialized_diags::create(OS.take(), DiagOpts);
+      clang::serialized_diags::create(OS.release(), DiagOpts);
 
-  
----------------
Another piece of orthogonal cleanup - I'm sort of surprised clang-format did that... 

================
Comment at: lib/Lex/PTHLexer.cpp:539
@@ -540,1 +538,3 @@
+                        SL.release(), NumIds, spellingBase,
+                        (const char *)originalSourceBase);
 }
----------------
More orthogonal cleanup - might be worth filing bugs on clang-format-patch (or git-clang-format, or whatever other tools) for these.


http://llvm-reviews.chandlerc.com/D3000



More information about the cfe-commits mailing list