[PATCH] clang-replace: Re-org of file structure

Edwin Vane edwin.vane at intel.com
Thu Aug 29 10:55:42 PDT 2013


Hi klimek, chandlerc,

clang-replace is likely to move to clang proper one day soon. To
facilitate that move, renaming files and directory structure layout to
ease transition for users of clang-replace and libclangReplace.

For now, functionality still exists in clang::replace namespace. Header
guards and file comments updated.

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

Files:
  clang-replace/CMakeLists.txt
  clang-replace/Makefile
  clang-replace/include/clang-replace/Tooling/Replace.h
  clang-replace/ApplyReplacements.h
  clang-replace/lib/Tooling/Makefile
  clang-replace/lib/Tooling/Replace.cpp
  clang-replace/ApplyReplacements.cpp
  clang-replace/tool/ClangReplaceMain.cpp
  clang-replace/tool/Makefile

Index: clang-replace/CMakeLists.txt
===================================================================
--- clang-replace/CMakeLists.txt
+++ clang-replace/CMakeLists.txt
@@ -7,13 +7,16 @@
   )
 
 add_clang_library(clangReplace
-  ApplyReplacements.cpp
+  lib/Tooling/Replace.cpp
   )
 target_link_libraries(clangReplace
   clangTooling
   clangBasic
   clangRewriteFrontend
   )
 
-include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+include_directories(
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  include
+  )
 add_subdirectory(tool)
Index: clang-replace/Makefile
===================================================================
--- clang-replace/Makefile
+++ clang-replace/Makefile
@@ -8,9 +8,8 @@
 ##===----------------------------------------------------------------------===##
 
 CLANG_LEVEL := ../../..
-LIBRARYNAME := clangReplace
 include $(CLANG_LEVEL)/../../Makefile.config
 
-DIRS = tool
+DIRS = lib/Replace tool
 
 include $(CLANG_LEVEL)/Makefile
Index: clang-replace/include/clang-replace/Tooling/Replace.h
===================================================================
--- clang-replace/include/clang-replace/Tooling/Replace.h
+++ clang-replace/include/clang-replace/Tooling/Replace.h
@@ -1,4 +1,4 @@
-//===-- Core/ApplyChangeDescriptions.h --------------------------*- C++ -*-===//
+//===-- Replace.h - Replacement deduplciation and application ----- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -8,13 +8,13 @@
 //===----------------------------------------------------------------------===//
 ///
 /// \file
-/// \brief This file provides the interface for finding and applying change
-/// description files.
+/// \brief This file provides the interface for deduplicating, detecting
+/// conflicts in, and applying collections of Replacements.
 ///
 //===----------------------------------------------------------------------===//
 
-#ifndef CPP11_MIGRATE_APPLYCHANGEDESCRIPTIONS_H
-#define CPP11_MIGRATE_APPLYCHANGEDESCRIPTIONS_H
+#ifndef LLVM_CLANG_REPLACE_H
+#define LLVM_CLANG_REPLACE_H
 
 #include "clang/Tooling/Refactoring.h"
 #include "llvm/ADT/StringMap.h"
@@ -111,4 +111,4 @@
 } // end namespace replace
 } // end namespace clang
 
-#endif // CPP11_MIGRATE_APPLYCHANGEDESCRIPTIONS_H
+#endif // LLVM_CLANG_REPLACE_H
Index: clang-replace/lib/Tooling/Makefile
===================================================================
--- clang-replace/lib/Tooling/Makefile
+++ clang-replace/lib/Tooling/Makefile
@@ -1,3 +1,4 @@
+
 ##===- clang-replace/Makefile ------------------------------*- Makefile -*-===##
 #
 #                     The LLVM Compiler Infrastructure
@@ -7,10 +8,8 @@
 #
 ##===----------------------------------------------------------------------===##
 
-CLANG_LEVEL := ../../..
+CLANG_LEVEL := ../../../../..
 LIBRARYNAME := clangReplace
 include $(CLANG_LEVEL)/../../Makefile.config
-
-DIRS = tool
-
 include $(CLANG_LEVEL)/Makefile
+CPP.Flags += -I$(PROJ_SRC_DIR)/../../include
Index: clang-replace/lib/Tooling/Replace.cpp
===================================================================
--- clang-replace/lib/Tooling/Replace.cpp
+++ clang-replace/lib/Tooling/Replace.cpp
@@ -1,4 +1,4 @@
-//===-- Core/ApplyChangeDescriptions.cpp ----------------------------------===//
+//===-- Replace.cpp - Impl for Replacement deduplication and application --===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -8,11 +8,13 @@
 //===----------------------------------------------------------------------===//
 ///
 /// \file
-/// \brief This file provides the implementation for finding and applying change
-/// description files.
+/// \brief This file provides the implementation for deduplicating, detecting
+/// conflicts in, and applying collections of Replacements.
+///
+/// FIXME: Use Diagnostics for output instead of llvm::errs().
 ///
 //===----------------------------------------------------------------------===//
-#include "ApplyReplacements.h"
+#include "clang-replace/Tooling/Replace.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Rewrite/Core/Rewriter.h"
@@ -32,6 +34,7 @@
 namespace clang {
 namespace replace {
 
+
 llvm::error_code
 collectReplacementsFromDirectory(const llvm::StringRef Directory,
                                  TUReplacements &TUs,
@@ -173,8 +176,6 @@
                          FileToReplacementsMap &GroupedReplacements,
                          clang::SourceManager &SM) {
 
-  // FIXME: Use Diagnostics for output
-
   // Group all replacements by target file.
   for (TUReplacements::const_iterator TUI = TUs.begin(), TUE = TUs.end();
        TUI != TUE; ++TUI)
Index: clang-replace/tool/ClangReplaceMain.cpp
===================================================================
--- clang-replace/tool/ClangReplaceMain.cpp
+++ clang-replace/tool/ClangReplaceMain.cpp
@@ -12,7 +12,7 @@
 ///
 //===----------------------------------------------------------------------===//
 
-#include "ApplyReplacements.h"
+#include "clang-replace/Tooling/Replace.h"
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/DiagnosticOptions.h"
 #include "clang/Basic/SourceManager.h"
Index: clang-replace/tool/Makefile
===================================================================
--- clang-replace/tool/Makefile
+++ clang-replace/tool/Makefile
@@ -25,4 +25,4 @@
 
 include $(CLANG_LEVEL)/Makefile
 
-CPP.Flags += -I$(PROJ_SRC_DIR)/..
+CPP.Flags += -I$(PROJ_SRC_DIR)/../include
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1548.1.patch
Type: text/x-patch
Size: 5452 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130829/ccce6fc8/attachment.bin>


More information about the cfe-commits mailing list