[PATCH] cpp11-migrate: Register the transforms automatically using llvm::Registry.

Guillaume Papin guillaume.papin at epitech.eu
Mon Jul 22 14:13:57 PDT 2013

  Your question made me asking myself more questions.
  I will what is missing tomorrow, and submit a new patch.

Comment at: cpp11-migrate/AddOverride/AddOverride.cpp:75
@@ +74,2 @@
+// and thus register the factory.
+volatile int AddOverrideTransformAnchorSource = 0;
Edwin Vane wrote:
> Where is this trick documented?
I took the same approach as Clang-Tidy (see http://llvm-reviews.chandlerc.com/D884 and grep GoogleModuleAnchorSource).

But I'm not using this the right way apparently, I got half of the things correct and will document myself more tomorrow.

An alternative way of doing this is somewhat documented here: http://llvm.org/docs/WritingAnLLVMPass.html#basic-code-required
But in this case they don't use a volatile global variable.

Comment at: cpp11-migrate/Core/Transform.cpp:131
@@ -130,4 +130,3 @@
-FrontendActionFactory *
-Transform::createActionFactory(MatchFinder &Finder) {
+FrontendActionFactory *Transform::createActionFactory(MatchFinder &Finder) {
   return new ActionFactory(Finder, /*Owner=*/ *this);
Edwin Vane wrote:
> This change is unrelated to your patch. Please undo.




More information about the cfe-commits mailing list