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

Guillaume Papin guillaume.papin at epitech.eu
Tue Jul 23 07:20:02 PDT 2013


  I fixed my code according to the review:
    - Undo clang-format on unrelated code.
    - Add anchor destinations to the main file.

  Now the transforms can be converted to a library system and it should still
  work.

  For example I tried to make the AddOverride a library,
  AddOverride/CMakeLists.txt was:

    set(LLVM_LINK_COMPONENTS support)

    add_clang_library(migrateAddOverrideTransform
      AddOverrideActions.cpp
      AddOverride.cpp
      AddOverrideMatchers.cpp
      )

    target_link_libraries(migrateAddOverrideTransform
      migrateCore
      )

  Then in tool/CMakeLists.txt I used:

    -file(GLOB_RECURSE AddOverrideSources "../AddOverride/*.cpp")
    -list(APPEND Cpp11MigrateSources ${AddOverrideSources})
    +# file(GLOB_RECURSE AddOverrideSources "../AddOverride/*.cpp")
    +# list(APPEND Cpp11MigrateSources ${AddOverrideSources})

    <...>

     target_link_libraries(cpp11-migrate
       migrateCore
    +  migrateAddOverrideTransform
       )


  I linked this library and it worked, displaying the command line option and
  passing the tests. I believe this is a [long-term] goal to have
  "library-transform".

Hi revane, arielbernal, tareqsiraj,

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

CHANGE SINCE LAST DIFF
  http://llvm-reviews.chandlerc.com/D1196?vs=2944&id=2969#toc

Files:
  cpp11-migrate/AddOverride/AddOverride.cpp
  cpp11-migrate/Core/Transform.cpp
  cpp11-migrate/Core/Transform.h
  cpp11-migrate/Core/Transforms.cpp
  cpp11-migrate/Core/Transforms.h
  cpp11-migrate/LoopConvert/LoopConvert.cpp
  cpp11-migrate/ReplaceAutoPtr/ReplaceAutoPtr.cpp
  cpp11-migrate/UseAuto/UseAuto.cpp
  cpp11-migrate/UseNullptr/UseNullptr.cpp
  cpp11-migrate/tool/Cpp11Migrate.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1196.2.patch
Type: text/x-patch
Size: 11792 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130723/57240da5/attachment.bin>


More information about the cfe-commits mailing list