Hi klimek,

Creating an include and lib directory for sources. Updating build
systems to match. This reorg will make it slightly nicer for users of
libclangReplace.

Depends on D1519.

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

Files:
  clang-replace/CMakeLists.txt
  clang-replace/Makefile
  clang-replace/include/Replace/ApplyReplacements.h
  clang-replace/ApplyReplacements.h
  clang-replace/lib/Replace/ApplyReplacements.cpp
  clang-replace/ApplyReplacements.cpp
  clang-replace/lib/Replace/Makefile
  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/Replace/ApplyReplacements.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/ApplyReplacements.h
===================================================================
--- /dev/null
+++ clang-replace/ApplyReplacements.h
@@ -1,100 +0,0 @@
-//===-- Core/ApplyChangeDescriptions.h --------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-///
-/// \file
-/// \brief This file provides the interface for finding and applying change
-/// description files.
-///
-//===----------------------------------------------------------------------===//
-
-#ifndef CPP11_MIGRATE_APPLYCHANGEDESCRIPTIONS_H
-#define CPP11_MIGRATE_APPLYCHANGEDESCRIPTIONS_H
-
-#include "clang/Tooling/ReplacementsYaml.h"
-#include "llvm/ADT/StringMap.h"
-#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/system_error.h"
-#include <vector>
-
-namespace clang {
-
-class DiagnosticsEngine;
-
-namespace replace {
-
-/// \brief Collection of TranslationUnitReplacements.
-typedef std::vector<clang::tooling::TranslationUnitReplacements>
-TUReplacements;
-
-/// \brief Map mapping file name to Replacements targeting that file.
-typedef llvm::StringMap<std::vector<clang::tooling::Replacement> >
-FileToReplacementsMap;
-
-/// \brief Recursively descends through a directory structure rooted at \p
-/// Directory and attempts to deserialize *.yaml files as
-/// TranslationUnitReplacements. All docs that successfully deserialize are
-/// added to \p TUs.
-///
-/// Directories starting with '.' are ignored during traversal.
-///
-/// \param[in] Directory Directory to begin search for serialized
-/// TranslationUnitReplacements.
-/// \param[out] TUs Collection of all found and deserialized
-/// TranslationUnitReplacements.
-/// \param[in] Diagnostics DiagnosticsEngine used for error output.
-///
-/// \returns An error_code indicating success or failure in navigating the
-/// directory structure.
-llvm::error_code
-collectReplacementsFromDirectory(const llvm::StringRef Directory,
-                                 TUReplacements &TUs,
-                                 clang::DiagnosticsEngine &Diagnostics);
-
-/// \brief Deduplicate, check for conflicts, and apply all Replacements stored
-/// in \c TUs. If conflicts occur, no Replacements are applied.
-///
-/// \param[in] TUs Collection of TranslationUnitReplacements to merge,
-/// deduplicate, and test for conflicts.
-/// \param[out] GroupedReplacements Container grouping all Replacements by the
-/// file they target.
-/// \param[in] SM SourceManager required for conflict reporting.
-///
-/// \returns \li true If all changes were applied successfully.
-///          \li false If there were conflicts.
-bool mergeAndDeduplicate(const TUReplacements &TUs,
-                         FileToReplacementsMap &GroupedReplacements,
-                         clang::SourceManager &SM);
-
-/// \brief Apply all replacements in \c GroupedReplacements.
-///
-/// \param[in] GroupedReplacements Deduplicated and conflict free Replacements
-/// to apply.
-/// \param[in] SM SourceManager required to construct clang::Rewriter.
-/// \param[out] FileContents The results of applying replacements will be
-/// written into this map. The map keys are filenames and the map values are
-/// file contents.
-///
-/// \returns \li true If all changes were applied successfully.
-///          \li false If a replacement failed to apply.
-bool applyReplacements(const FileToReplacementsMap &GroupedReplacements,
-                       clang::SourceManager &SM,
-                       llvm::StringMap<std::string> &OutputState);
-
-/// \brief Write the contents of \c FileContents to disk. Keys of the map are
-/// filenames and values are the new contents for those files.
-///
-/// \param[in] FileContents Map of file name -> file content to write.
-/// \param[in] Diagnostics DiagnosticsEngine used for error output.
-bool writeFiles(const llvm::StringMap<std::string> &FileContents,
-                clang::DiagnosticsEngine &Diagnostics);
-
-} // end namespace replace
-} // end namespace clang
-
-#endif // CPP11_MIGRATE_APPLYCHANGEDESCRIPTIONS_H
Index: clang-replace/lib/Replace/ApplyReplacements.cpp
===================================================================
--- clang-replace/lib/Replace/ApplyReplacements.cpp
+++ clang-replace/lib/Replace/ApplyReplacements.cpp
@@ -12,7 +12,7 @@
 /// description files.
 ///
 //===----------------------------------------------------------------------===//
-#include "ApplyReplacements.h"
+#include "Replace/ApplyReplacements.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Rewrite/Core/Rewriter.h"
Index: clang-replace/lib/Replace/Makefile
===================================================================
--- clang-replace/lib/Replace/Makefile
+++ clang-replace/lib/Replace/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/tool/ClangReplaceMain.cpp
===================================================================
--- clang-replace/tool/ClangReplaceMain.cpp
+++ clang-replace/tool/ClangReplaceMain.cpp
@@ -12,7 +12,7 @@
 ///
 //===----------------------------------------------------------------------===//
 
-#include "ApplyReplacements.h"
+#include "Replace/ApplyReplacements.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
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to