<div dir="ltr">Thanks for fixing this Roman!</div><br><div class="gmail_quote"><div dir="ltr">On Mon, Jun 4, 2018 at 2:11 PM Roman Lebedev <<a href="mailto:lebedev.ri@gmail.com">lebedev.ri@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This broke building as shared libraries.<br>
<br>
I've committed the fix, but the bot coverage is clearly severely missing,<br>
given that such breakages are very often.<br>
<br>
Roman.<br>
<br>
On Mon, Jun 4, 2018 at 12:04 PM, Eric Liu via cfe-commits<br>
<<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:<br>
> Author: ioeric<br>
> Date: Mon Jun  4 02:04:12 2018<br>
> New Revision: 333874<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=333874&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=333874&view=rev</a><br>
> Log:<br>
> Reland "Move #include manipulation code to new lib/Tooling/Inclusions."<br>
><br>
> This reverts commit r333534 (i.e. reland r332720) after fixing module build.<br>
><br>
> Differential Revision: <a href="https://reviews.llvm.org/D47068" rel="noreferrer" target="_blank">https://reviews.llvm.org/D47068</a><br>
><br>
> Added:<br>
>     cfe/trunk/include/clang/Tooling/Inclusions/HeaderIncludes.h<br>
>       - copied, changed from r333865, cfe/trunk/include/clang/Tooling/Core/HeaderIncludes.h<br>
>     cfe/trunk/include/clang/Tooling/Inclusions/IncludeStyle.h<br>
>       - copied, changed from r333865, cfe/trunk/include/clang/Tooling/Core/IncludeStyle.h<br>
>     cfe/trunk/lib/Tooling/Inclusions/CMakeLists.txt<br>
>       - copied, changed from r333865, cfe/trunk/lib/Tooling/Core/CMakeLists.txt<br>
>     cfe/trunk/lib/Tooling/Inclusions/HeaderIncludes.cpp<br>
>       - copied, changed from r333865, cfe/trunk/lib/Tooling/Core/HeaderIncludes.cpp<br>
>     cfe/trunk/lib/Tooling/Inclusions/IncludeStyle.cpp<br>
>       - copied, changed from r333865, cfe/trunk/lib/Tooling/Core/IncludeStyle.cpp<br>
> Removed:<br>
>     cfe/trunk/include/clang/Tooling/Core/HeaderIncludes.h<br>
>     cfe/trunk/include/clang/Tooling/Core/IncludeStyle.h<br>
>     cfe/trunk/lib/Tooling/Core/HeaderIncludes.cpp<br>
>     cfe/trunk/lib/Tooling/Core/IncludeStyle.cpp<br>
> Modified:<br>
>     cfe/trunk/include/clang/Format/Format.h<br>
>     cfe/trunk/include/clang/module.modulemap<br>
>     cfe/trunk/lib/Format/CMakeLists.txt<br>
>     cfe/trunk/lib/Format/Format.cpp<br>
>     cfe/trunk/lib/Tooling/CMakeLists.txt<br>
>     cfe/trunk/lib/Tooling/Core/CMakeLists.txt<br>
>     cfe/trunk/unittests/Tooling/HeaderIncludesTest.cpp<br>
><br>
> Modified: cfe/trunk/include/clang/Format/Format.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Format/Format.h?rev=333874&r1=333873&r2=333874&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Format/Format.h?rev=333874&r1=333873&r2=333874&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Format/Format.h (original)<br>
> +++ cfe/trunk/include/clang/Format/Format.h Mon Jun  4 02:04:12 2018<br>
> @@ -16,8 +16,8 @@<br>
>  #define LLVM_CLANG_FORMAT_FORMAT_H<br>
><br>
>  #include "clang/Basic/LangOptions.h"<br>
> -#include "clang/Tooling/Core/IncludeStyle.h"<br>
>  #include "clang/Tooling/Core/Replacement.h"<br>
> +#include "clang/Tooling/Inclusions/IncludeStyle.h"<br>
>  #include "llvm/ADT/ArrayRef.h"<br>
>  #include "llvm/Support/Regex.h"<br>
>  #include <system_error><br>
><br>
> Removed: cfe/trunk/include/clang/Tooling/Core/HeaderIncludes.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/Core/HeaderIncludes.h?rev=333873&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/Core/HeaderIncludes.h?rev=333873&view=auto</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Tooling/Core/HeaderIncludes.h (original)<br>
> +++ cfe/trunk/include/clang/Tooling/Core/HeaderIncludes.h (removed)<br>
> @@ -1,137 +0,0 @@<br>
> -//===--- HeaderIncludes.h - Insert/Delete #includes for C++ code--*- C++-*-===//<br>
> -//<br>
> -//                     The LLVM Compiler Infrastructure<br>
> -//<br>
> -// This file is distributed under the University of Illinois Open Source<br>
> -// License. See LICENSE.TXT for details.<br>
> -//<br>
> -//===----------------------------------------------------------------------===//<br>
> -<br>
> -#ifndef LLVM_CLANG_TOOLING_CORE_HEADERINCLUDES_H<br>
> -#define LLVM_CLANG_TOOLING_CORE_HEADERINCLUDES_H<br>
> -<br>
> -#include "clang/Basic/SourceManager.h"<br>
> -#include "clang/Tooling/Core/Replacement.h"<br>
> -#include "clang/Tooling/Core/IncludeStyle.h"<br>
> -#include "llvm/Support/Path.h"<br>
> -#include "llvm/Support/Regex.h"<br>
> -#include <unordered_map><br>
> -<br>
> -namespace clang {<br>
> -namespace tooling {<br>
> -<br>
> -/// This class manages priorities of C++ #include categories and calculates<br>
> -/// priorities for headers.<br>
> -/// FIXME(ioeric): move this class into implementation file when clang-format's<br>
> -/// include sorting functions are also moved here.<br>
> -class IncludeCategoryManager {<br>
> -public:<br>
> -  IncludeCategoryManager(const IncludeStyle &Style, StringRef FileName);<br>
> -<br>
> -  /// Returns the priority of the category which \p IncludeName belongs to.<br>
> -  /// If \p CheckMainHeader is true and \p IncludeName is a main header, returns<br>
> -  /// 0. Otherwise, returns the priority of the matching category or INT_MAX.<br>
> -  /// NOTE: this API is not thread-safe!<br>
> -  int getIncludePriority(StringRef IncludeName, bool CheckMainHeader) const;<br>
> -<br>
> -private:<br>
> -  bool isMainHeader(StringRef IncludeName) const;<br>
> -<br>
> -  const IncludeStyle Style;<br>
> -  bool IsMainFile;<br>
> -  std::string FileName;<br>
> -  // This refers to a substring in FileName.<br>
> -  StringRef FileStem;<br>
> -  // Regex is not thread-safe.<br>
> -  mutable SmallVector<llvm::Regex, 4> CategoryRegexs;<br>
> -};<br>
> -<br>
> -/// Generates replacements for inserting or deleting #include directives in a<br>
> -/// file.<br>
> -class HeaderIncludes {<br>
> -public:<br>
> -  HeaderIncludes(llvm::StringRef FileName, llvm::StringRef Code,<br>
> -                 const IncludeStyle &Style);<br>
> -<br>
> -  /// Inserts an #include directive of \p Header into the code. If \p IsAngled<br>
> -  /// is true, \p Header will be quoted with <> in the directive; otherwise, it<br>
> -  /// will be quoted with "".<br>
> -  ///<br>
> -  /// When searching for points to insert new header, this ignores #include's<br>
> -  /// after the #include block(s) in the beginning of a file to avoid inserting<br>
> -  /// headers into code sections where new #include's should not be added by<br>
> -  /// default. These code sections include:<br>
> -  ///   - raw string literals (containing #include).<br>
> -  ///   - #if blocks.<br>
> -  ///   - Special #include's among declarations (e.g. functions).<br>
> -  ///<br>
> -  /// Returns a replacement that inserts the new header into a suitable #include<br>
> -  /// block of the same category. This respects the order of the existing<br>
> -  /// #includes in the block; if the existing #includes are not already sorted,<br>
> -  /// this will simply insert the #include in front of the first #include of the<br>
> -  /// same category in the code that should be sorted after \p IncludeName. If<br>
> -  /// \p IncludeName already exists (with exactly the same spelling), this<br>
> -  /// returns None.<br>
> -  llvm::Optional<tooling::Replacement> insert(llvm::StringRef Header,<br>
> -                                              bool IsAngled) const;<br>
> -<br>
> -  /// Removes all existing #includes of \p Header quoted with <> if \p IsAngled<br>
> -  /// is true or "" if \p IsAngled is false.<br>
> -  /// This doesn't resolve the header file path; it only deletes #includes with<br>
> -  /// exactly the same spelling.<br>
> -  tooling::Replacements remove(llvm::StringRef Header, bool IsAngled) const;<br>
> -<br>
> -private:<br>
> -  struct Include {<br>
> -    Include(StringRef Name, tooling::Range R) : Name(Name), R(R) {}<br>
> -<br>
> -    // An include header quoted with either <> or "".<br>
> -    std::string Name;<br>
> -    // The range of the whole line of include directive including any eading<br>
> -    // whitespaces and trailing comment.<br>
> -    tooling::Range R;<br>
> -  };<br>
> -<br>
> -  void addExistingInclude(Include IncludeToAdd, unsigned NextLineOffset);<br>
> -<br>
> -  std::string FileName;<br>
> -  std::string Code;<br>
> -<br>
> -  // Map from include name (quotation trimmed) to a list of existing includes<br>
> -  // (in case there are more than one) with the name in the current file. <x><br>
> -  // and "x" will be treated as the same header when deleting #includes.<br>
> -  llvm::StringMap<llvm::SmallVector<Include, 1>> ExistingIncludes;<br>
> -<br>
> -  /// Map from priorities of #include categories to all #includes in the same<br>
> -  /// category. This is used to find #includes of the same category when<br>
> -  /// inserting new #includes. #includes in the same categories are sorted in<br>
> -  /// in the order they appear in the source file.<br>
> -  /// See comment for "FormatStyle::IncludeCategories" for details about include<br>
> -  /// priorities.<br>
> -  std::unordered_map<int, llvm::SmallVector<const Include *, 8>><br>
> -      IncludesByPriority;<br>
> -<br>
> -  int FirstIncludeOffset;<br>
> -  // All new headers should be inserted after this offset (e.g. after header<br>
> -  // guards, file comment).<br>
> -  unsigned MinInsertOffset;<br>
> -  // Max insertion offset in the original code. For example, we want to avoid<br>
> -  // inserting new #includes into the actual code section (e.g. after a<br>
> -  // declaration).<br>
> -  unsigned MaxInsertOffset;<br>
> -  IncludeCategoryManager Categories;<br>
> -  // Record the offset of the end of the last include in each category.<br>
> -  std::unordered_map<int, int> CategoryEndOffsets;<br>
> -<br>
> -  // All possible priorities.<br>
> -  std::set<int> Priorities;<br>
> -<br>
> -  // Matches a whole #include directive.<br>
> -  llvm::Regex IncludeRegex;<br>
> -};<br>
> -<br>
> -<br>
> -} // namespace tooling<br>
> -} // namespace clang<br>
> -<br>
> -#endif // LLVM_CLANG_TOOLING_CORE_HEADERINCLUDES_H<br>
><br>
> Removed: cfe/trunk/include/clang/Tooling/Core/IncludeStyle.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/Core/IncludeStyle.h?rev=333873&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/Core/IncludeStyle.h?rev=333873&view=auto</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Tooling/Core/IncludeStyle.h (original)<br>
> +++ cfe/trunk/include/clang/Tooling/Core/IncludeStyle.h (removed)<br>
> @@ -1,133 +0,0 @@<br>
> -//===--- IncludeStyle.h - Style of C++ #include directives -------*- C++-*-===//<br>
> -//<br>
> -//                     The LLVM Compiler Infrastructure<br>
> -//<br>
> -// This file is distributed under the University of Illinois Open Source<br>
> -// License. See LICENSE.TXT for details.<br>
> -//<br>
> -//===----------------------------------------------------------------------===//<br>
> -<br>
> -#ifndef LLVM_CLANG_TOOLING_CORE_INCLUDESTYLE_H<br>
> -#define LLVM_CLANG_TOOLING_CORE_INCLUDESTYLE_H<br>
> -<br>
> -#include "llvm/Support/YAMLTraits.h"<br>
> -#include <string><br>
> -#include <vector><br>
> -<br>
> -namespace clang {<br>
> -namespace tooling {<br>
> -<br>
> -/// Style for sorting and grouping C++ #include directives.<br>
> -struct IncludeStyle {<br>
> -  /// Styles for sorting multiple ``#include`` blocks.<br>
> -  enum IncludeBlocksStyle {<br>
> -    /// Sort each ``#include`` block separately.<br>
> -    /// \code<br>
> -    ///    #include "b.h"               into      #include "b.h"<br>
> -    ///<br>
> -    ///    #include <lib/main.h>                  #include "a.h"<br>
> -    ///    #include "a.h"                         #include <lib/main.h><br>
> -    /// \endcode<br>
> -    IBS_Preserve,<br>
> -    /// Merge multiple ``#include`` blocks together and sort as one.<br>
> -    /// \code<br>
> -    ///    #include "b.h"               into      #include "a.h"<br>
> -    ///                                           #include "b.h"<br>
> -    ///    #include <lib/main.h>                  #include <lib/main.h><br>
> -    ///    #include "a.h"<br>
> -    /// \endcode<br>
> -    IBS_Merge,<br>
> -    /// Merge multiple ``#include`` blocks together and sort as one.<br>
> -    /// Then split into groups based on category priority. See<br>
> -    /// ``IncludeCategories``.<br>
> -    /// \code<br>
> -    ///    #include "b.h"               into      #include "a.h"<br>
> -    ///                                           #include "b.h"<br>
> -    ///    #include <lib/main.h><br>
> -    ///    #include "a.h"                         #include <lib/main.h><br>
> -    /// \endcode<br>
> -    IBS_Regroup,<br>
> -  };<br>
> -<br>
> -  /// Dependent on the value, multiple ``#include`` blocks can be sorted<br>
> -  /// as one and divided based on category.<br>
> -  IncludeBlocksStyle IncludeBlocks;<br>
> -<br>
> -  /// See documentation of ``IncludeCategories``.<br>
> -  struct IncludeCategory {<br>
> -    /// The regular expression that this category matches.<br>
> -    std::string Regex;<br>
> -    /// The priority to assign to this category.<br>
> -    int Priority;<br>
> -    bool operator==(const IncludeCategory &Other) const {<br>
> -      return Regex == Other.Regex && Priority == Other.Priority;<br>
> -    }<br>
> -  };<br>
> -<br>
> -  /// Regular expressions denoting the different ``#include`` categories<br>
> -  /// used for ordering ``#includes``.<br>
> -  ///<br>
> -  /// These regular expressions are matched against the filename of an include<br>
> -  /// (including the <> or "") in order. The value belonging to the first<br>
> -  /// matching regular expression is assigned and ``#includes`` are sorted first<br>
> -  /// according to increasing category number and then alphabetically within<br>
> -  /// each category.<br>
> -  ///<br>
> -  /// If none of the regular expressions match, INT_MAX is assigned as<br>
> -  /// category. The main header for a source file automatically gets category 0.<br>
> -  /// so that it is generally kept at the beginning of the ``#includes``<br>
> -  /// (<a href="http://llvm.org/docs/CodingStandards.html#include-style" rel="noreferrer" target="_blank">http://llvm.org/docs/CodingStandards.html#include-style</a>). However, you<br>
> -  /// can also assign negative priorities if you have certain headers that<br>
> -  /// always need to be first.<br>
> -  ///<br>
> -  /// To configure this in the .clang-format file, use:<br>
> -  /// \code{.yaml}<br>
> -  ///   IncludeCategories:<br>
> -  ///     - Regex:           '^"(llvm|llvm-c|clang|clang-c)/'<br>
> -  ///       Priority:        2<br>
> -  ///     - Regex:           '^(<|"(gtest|gmock|isl|json)/)'<br>
> -  ///       Priority:        3<br>
> -  ///     - Regex:           '.*'<br>
> -  ///       Priority:        1<br>
> -  /// \endcode<br>
> -  std::vector<IncludeCategory> IncludeCategories;<br>
> -<br>
> -  /// Specify a regular expression of suffixes that are allowed in the<br>
> -  /// file-to-main-include mapping.<br>
> -  ///<br>
> -  /// When guessing whether a #include is the "main" include (to assign<br>
> -  /// category 0, see above), use this regex of allowed suffixes to the header<br>
> -  /// stem. A partial match is done, so that:<br>
> -  /// - "" means "arbitrary suffix"<br>
> -  /// - "$" means "no suffix"<br>
> -  ///<br>
> -  /// For example, if configured to "(_test)?$", then a header a.h would be seen<br>
> -  /// as the "main" include in both a.cc and a_test.cc.<br>
> -  std::string IncludeIsMainRegex;<br>
> -};<br>
> -<br>
> -} // namespace tooling<br>
> -} // namespace clang<br>
> -<br>
> -LLVM_YAML_IS_SEQUENCE_VECTOR(clang::tooling::IncludeStyle::IncludeCategory)<br>
> -<br>
> -namespace llvm {<br>
> -namespace yaml {<br>
> -<br>
> -template <><br>
> -struct MappingTraits<clang::tooling::IncludeStyle::IncludeCategory> {<br>
> -  static void mapping(IO &IO,<br>
> -                      clang::tooling::IncludeStyle::IncludeCategory &Category);<br>
> -};<br>
> -<br>
> -template <><br>
> -struct ScalarEnumerationTraits<<br>
> -    clang::tooling::IncludeStyle::IncludeBlocksStyle> {<br>
> -  static void<br>
> -  enumeration(IO &IO, clang::tooling::IncludeStyle::IncludeBlocksStyle &Value);<br>
> -};<br>
> -<br>
> -} // namespace yaml<br>
> -} // namespace llvm<br>
> -<br>
> -#endif // LLVM_CLANG_TOOLING_CORE_INCLUDESTYLE_H<br>
><br>
> Copied: cfe/trunk/include/clang/Tooling/Inclusions/HeaderIncludes.h (from r333865, cfe/trunk/include/clang/Tooling/Core/HeaderIncludes.h)<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/Inclusions/HeaderIncludes.h?p2=cfe/trunk/include/clang/Tooling/Inclusions/HeaderIncludes.h&p1=cfe/trunk/include/clang/Tooling/Core/HeaderIncludes.h&r1=333865&r2=333874&rev=333874&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/Inclusions/HeaderIncludes.h?p2=cfe/trunk/include/clang/Tooling/Inclusions/HeaderIncludes.h&p1=cfe/trunk/include/clang/Tooling/Core/HeaderIncludes.h&r1=333865&r2=333874&rev=333874&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Tooling/Core/HeaderIncludes.h (original)<br>
> +++ cfe/trunk/include/clang/Tooling/Inclusions/HeaderIncludes.h Mon Jun  4 02:04:12 2018<br>
> @@ -7,12 +7,12 @@<br>
>  //<br>
>  //===----------------------------------------------------------------------===//<br>
><br>
> -#ifndef LLVM_CLANG_TOOLING_CORE_HEADERINCLUDES_H<br>
> -#define LLVM_CLANG_TOOLING_CORE_HEADERINCLUDES_H<br>
> +#ifndef LLVM_CLANG_TOOLING_INCLUSIONS_HEADERINCLUDES_H<br>
> +#define LLVM_CLANG_TOOLING_INCLUSIONS_HEADERINCLUDES_H<br>
><br>
>  #include "clang/Basic/SourceManager.h"<br>
>  #include "clang/Tooling/Core/Replacement.h"<br>
> -#include "clang/Tooling/Core/IncludeStyle.h"<br>
> +#include "clang/Tooling/Inclusions/IncludeStyle.h"<br>
>  #include "llvm/Support/Path.h"<br>
>  #include "llvm/Support/Regex.h"<br>
>  #include <unordered_map><br>
> @@ -134,4 +134,4 @@ private:<br>
>  } // namespace tooling<br>
>  } // namespace clang<br>
><br>
> -#endif // LLVM_CLANG_TOOLING_CORE_HEADERINCLUDES_H<br>
> +#endif // LLVM_CLANG_TOOLING_INCLUSIONS_HEADERINCLUDES_H<br>
><br>
> Copied: cfe/trunk/include/clang/Tooling/Inclusions/IncludeStyle.h (from r333865, cfe/trunk/include/clang/Tooling/Core/IncludeStyle.h)<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/Inclusions/IncludeStyle.h?p2=cfe/trunk/include/clang/Tooling/Inclusions/IncludeStyle.h&p1=cfe/trunk/include/clang/Tooling/Core/IncludeStyle.h&r1=333865&r2=333874&rev=333874&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/Inclusions/IncludeStyle.h?p2=cfe/trunk/include/clang/Tooling/Inclusions/IncludeStyle.h&p1=cfe/trunk/include/clang/Tooling/Core/IncludeStyle.h&r1=333865&r2=333874&rev=333874&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Tooling/Core/IncludeStyle.h (original)<br>
> +++ cfe/trunk/include/clang/Tooling/Inclusions/IncludeStyle.h Mon Jun  4 02:04:12 2018<br>
> @@ -7,8 +7,8 @@<br>
>  //<br>
>  //===----------------------------------------------------------------------===//<br>
><br>
> -#ifndef LLVM_CLANG_TOOLING_CORE_INCLUDESTYLE_H<br>
> -#define LLVM_CLANG_TOOLING_CORE_INCLUDESTYLE_H<br>
> +#ifndef LLVM_CLANG_TOOLING_INCLUSIONS_INCLUDESTYLE_H<br>
> +#define LLVM_CLANG_TOOLING_INCLUSIONS_INCLUDESTYLE_H<br>
><br>
>  #include "llvm/Support/YAMLTraits.h"<br>
>  #include <string><br>
> @@ -130,4 +130,4 @@ struct ScalarEnumerationTraits<<br>
>  } // namespace yaml<br>
>  } // namespace llvm<br>
><br>
> -#endif // LLVM_CLANG_TOOLING_CORE_INCLUDESTYLE_H<br>
> +#endif // LLVM_CLANG_TOOLING_INCLUSIONS_INCLUDESTYLE_H<br>
><br>
> Modified: cfe/trunk/include/clang/module.modulemap<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/module.modulemap?rev=333874&r1=333873&r2=333874&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/module.modulemap?rev=333874&r1=333873&r2=333874&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/module.modulemap (original)<br>
> +++ cfe/trunk/include/clang/module.modulemap Mon Jun  4 02:04:12 2018<br>
> @@ -154,3 +154,8 @@ module Clang_ToolingCore {<br>
>    requires cplusplus<br>
>    umbrella "Tooling/Core" module * { export * }<br>
>  }<br>
> +<br>
> +module Clang_ToolingInclusions {<br>
> +  requires cplusplus<br>
> +  umbrella "Tooling/Inclusions" module * { export * }<br>
> +}<br>
><br>
> Modified: cfe/trunk/lib/Format/CMakeLists.txt<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/CMakeLists.txt?rev=333874&r1=333873&r2=333874&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/CMakeLists.txt?rev=333874&r1=333873&r2=333874&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Format/CMakeLists.txt (original)<br>
> +++ cfe/trunk/lib/Format/CMakeLists.txt Mon Jun  4 02:04:12 2018<br>
> @@ -20,4 +20,5 @@ add_clang_library(clangFormat<br>
>    clangBasic<br>
>    clangLex<br>
>    clangToolingCore<br>
> +  clangToolingInclusions<br>
>    )<br>
><br>
> Modified: cfe/trunk/lib/Format/Format.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=333874&r1=333873&r2=333874&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=333874&r1=333873&r2=333874&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Format/Format.cpp (original)<br>
> +++ cfe/trunk/lib/Format/Format.cpp Mon Jun  4 02:04:12 2018<br>
> @@ -31,7 +31,7 @@<br>
>  #include "clang/Basic/SourceManager.h"<br>
>  #include "clang/Basic/VirtualFileSystem.h"<br>
>  #include "clang/Lex/Lexer.h"<br>
> -#include "clang/Tooling/Core/HeaderIncludes.h"<br>
> +#include "clang/Tooling/Inclusions/HeaderIncludes.h"<br>
>  #include "llvm/ADT/STLExtras.h"<br>
>  #include "llvm/ADT/StringRef.h"<br>
>  #include "llvm/Support/Allocator.h"<br>
><br>
> Modified: cfe/trunk/lib/Tooling/CMakeLists.txt<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/CMakeLists.txt?rev=333874&r1=333873&r2=333874&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/CMakeLists.txt?rev=333874&r1=333873&r2=333874&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Tooling/CMakeLists.txt (original)<br>
> +++ cfe/trunk/lib/Tooling/CMakeLists.txt Mon Jun  4 02:04:12 2018<br>
> @@ -4,6 +4,7 @@ set(LLVM_LINK_COMPONENTS<br>
>    )<br>
><br>
>  add_subdirectory(Core)<br>
> +add_subdirectory(Inclusions)<br>
>  add_subdirectory(Refactoring)<br>
>  add_subdirectory(ASTDiff)<br>
><br>
><br>
> Modified: cfe/trunk/lib/Tooling/Core/CMakeLists.txt<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Core/CMakeLists.txt?rev=333874&r1=333873&r2=333874&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Core/CMakeLists.txt?rev=333874&r1=333873&r2=333874&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Tooling/Core/CMakeLists.txt (original)<br>
> +++ cfe/trunk/lib/Tooling/Core/CMakeLists.txt Mon Jun  4 02:04:12 2018<br>
> @@ -2,8 +2,6 @@ set(LLVM_LINK_COMPONENTS support)<br>
><br>
>  add_clang_library(clangToolingCore<br>
>    Diagnostic.cpp<br>
> -  HeaderIncludes.cpp<br>
> -  IncludeStyle.cpp<br>
>    Lookup.cpp<br>
>    Replacement.cpp<br>
><br>
><br>
> Removed: cfe/trunk/lib/Tooling/Core/HeaderIncludes.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Core/HeaderIncludes.cpp?rev=333873&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Core/HeaderIncludes.cpp?rev=333873&view=auto</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Tooling/Core/HeaderIncludes.cpp (original)<br>
> +++ cfe/trunk/lib/Tooling/Core/HeaderIncludes.cpp (removed)<br>
> @@ -1,330 +0,0 @@<br>
> -//===--- HeaderIncludes.cpp - Insert/Delete #includes --*- C++ -*----------===//<br>
> -//<br>
> -//                     The LLVM Compiler Infrastructure<br>
> -//<br>
> -// This file is distributed under the University of Illinois Open Source<br>
> -// License. See LICENSE.TXT for details.<br>
> -//<br>
> -//===----------------------------------------------------------------------===//<br>
> -<br>
> -#include "clang/Tooling/Core/HeaderIncludes.h"<br>
> -#include "clang/Basic/SourceManager.h"<br>
> -#include "clang/Lex/Lexer.h"<br>
> -<br>
> -namespace clang {<br>
> -namespace tooling {<br>
> -namespace {<br>
> -<br>
> -LangOptions createLangOpts() {<br>
> -  LangOptions LangOpts;<br>
> -  LangOpts.CPlusPlus = 1;<br>
> -  LangOpts.CPlusPlus11 = 1;<br>
> -  LangOpts.CPlusPlus14 = 1;<br>
> -  LangOpts.LineComment = 1;<br>
> -  LangOpts.CXXOperatorNames = 1;<br>
> -  LangOpts.Bool = 1;<br>
> -  LangOpts.ObjC1 = 1;<br>
> -  LangOpts.ObjC2 = 1;<br>
> -  LangOpts.MicrosoftExt = 1;    // To get kw___try, kw___finally.<br>
> -  LangOpts.DeclSpecKeyword = 1; // To get __declspec.<br>
> -  LangOpts.WChar = 1;           // To get wchar_t<br>
> -  return LangOpts;<br>
> -}<br>
> -<br>
> -// Returns the offset after skipping a sequence of tokens, matched by \p<br>
> -// GetOffsetAfterSequence, from the start of the code.<br>
> -// \p GetOffsetAfterSequence should be a function that matches a sequence of<br>
> -// tokens and returns an offset after the sequence.<br>
> -unsigned getOffsetAfterTokenSequence(<br>
> -    StringRef FileName, StringRef Code, const IncludeStyle &Style,<br>
> -    llvm::function_ref<unsigned(const SourceManager &, Lexer &, Token &)><br>
> -        GetOffsetAfterSequence) {<br>
> -  SourceManagerForFile VirtualSM(FileName, Code);<br>
> -  SourceManager &SM = VirtualSM.get();<br>
> -  Lexer Lex(SM.getMainFileID(), SM.getBuffer(SM.getMainFileID()), SM,<br>
> -            createLangOpts());<br>
> -  Token Tok;<br>
> -  // Get the first token.<br>
> -  Lex.LexFromRawLexer(Tok);<br>
> -  return GetOffsetAfterSequence(SM, Lex, Tok);<br>
> -}<br>
> -<br>
> -// Check if a sequence of tokens is like "#<Name> <raw_identifier>". If it is,<br>
> -// \p Tok will be the token after this directive; otherwise, it can be any token<br>
> -// after the given \p Tok (including \p Tok).<br>
> -bool checkAndConsumeDirectiveWithName(Lexer &Lex, StringRef Name, Token &Tok) {<br>
> -  bool Matched = Tok.is(tok::hash) && !Lex.LexFromRawLexer(Tok) &&<br>
> -                 Tok.is(tok::raw_identifier) &&<br>
> -                 Tok.getRawIdentifier() == Name && !Lex.LexFromRawLexer(Tok) &&<br>
> -                 Tok.is(tok::raw_identifier);<br>
> -  if (Matched)<br>
> -    Lex.LexFromRawLexer(Tok);<br>
> -  return Matched;<br>
> -}<br>
> -<br>
> -void skipComments(Lexer &Lex, Token &Tok) {<br>
> -  while (Tok.is(tok::comment))<br>
> -    if (Lex.LexFromRawLexer(Tok))<br>
> -      return;<br>
> -}<br>
> -<br>
> -// Returns the offset after header guard directives and any comments<br>
> -// before/after header guards. If no header guard presents in the code, this<br>
> -// will returns the offset after skipping all comments from the start of the<br>
> -// code.<br>
> -unsigned getOffsetAfterHeaderGuardsAndComments(StringRef FileName,<br>
> -                                               StringRef Code,<br>
> -                                               const IncludeStyle &Style) {<br>
> -  return getOffsetAfterTokenSequence(<br>
> -      FileName, Code, Style,<br>
> -      [](const SourceManager &SM, Lexer &Lex, Token Tok) {<br>
> -        skipComments(Lex, Tok);<br>
> -        unsigned InitialOffset = SM.getFileOffset(Tok.getLocation());<br>
> -        if (checkAndConsumeDirectiveWithName(Lex, "ifndef", Tok)) {<br>
> -          skipComments(Lex, Tok);<br>
> -          if (checkAndConsumeDirectiveWithName(Lex, "define", Tok))<br>
> -            return SM.getFileOffset(Tok.getLocation());<br>
> -        }<br>
> -        return InitialOffset;<br>
> -      });<br>
> -}<br>
> -<br>
> -// Check if a sequence of tokens is like<br>
> -//    "#include ("header.h" | <header.h>)".<br>
> -// If it is, \p Tok will be the token after this directive; otherwise, it can be<br>
> -// any token after the given \p Tok (including \p Tok).<br>
> -bool checkAndConsumeInclusiveDirective(Lexer &Lex, Token &Tok) {<br>
> -  auto Matched = [&]() {<br>
> -    Lex.LexFromRawLexer(Tok);<br>
> -    return true;<br>
> -  };<br>
> -  if (Tok.is(tok::hash) && !Lex.LexFromRawLexer(Tok) &&<br>
> -      Tok.is(tok::raw_identifier) && Tok.getRawIdentifier() == "include") {<br>
> -    if (Lex.LexFromRawLexer(Tok))<br>
> -      return false;<br>
> -    if (Tok.is(tok::string_literal))<br>
> -      return Matched();<br>
> -    if (Tok.is(tok::less)) {<br>
> -      while (!Lex.LexFromRawLexer(Tok) && Tok.isNot(tok::greater)) {<br>
> -      }<br>
> -      if (Tok.is(tok::greater))<br>
> -        return Matched();<br>
> -    }<br>
> -  }<br>
> -  return false;<br>
> -}<br>
> -<br>
> -// Returns the offset of the last #include directive after which a new<br>
> -// #include can be inserted. This ignores #include's after the #include block(s)<br>
> -// in the beginning of a file to avoid inserting headers into code sections<br>
> -// where new #include's should not be added by default.<br>
> -// These code sections include:<br>
> -//      - raw string literals (containing #include).<br>
> -//      - #if blocks.<br>
> -//      - Special #include's among declarations (e.g. functions).<br>
> -//<br>
> -// If no #include after which a new #include can be inserted, this returns the<br>
> -// offset after skipping all comments from the start of the code.<br>
> -// Inserting after an #include is not allowed if it comes after code that is not<br>
> -// #include (e.g. pre-processing directive that is not #include, declarations).<br>
> -unsigned getMaxHeaderInsertionOffset(StringRef FileName, StringRef Code,<br>
> -                                     const IncludeStyle &Style) {<br>
> -  return getOffsetAfterTokenSequence(<br>
> -      FileName, Code, Style,<br>
> -      [](const SourceManager &SM, Lexer &Lex, Token Tok) {<br>
> -        skipComments(Lex, Tok);<br>
> -        unsigned MaxOffset = SM.getFileOffset(Tok.getLocation());<br>
> -        while (checkAndConsumeInclusiveDirective(Lex, Tok))<br>
> -          MaxOffset = SM.getFileOffset(Tok.getLocation());<br>
> -        return MaxOffset;<br>
> -      });<br>
> -}<br>
> -<br>
> -inline StringRef trimInclude(StringRef IncludeName) {<br>
> -  return IncludeName.trim("\"<>");<br>
> -}<br>
> -<br>
> -const char IncludeRegexPattern[] =<br>
> -    R"(^[\t\ ]*#[\t\ ]*(import|include)[^"<]*(["<][^">]*[">]))";<br>
> -<br>
> -} // anonymous namespace<br>
> -<br>
> -IncludeCategoryManager::IncludeCategoryManager(const IncludeStyle &Style,<br>
> -                                               StringRef FileName)<br>
> -    : Style(Style), FileName(FileName) {<br>
> -  FileStem = llvm::sys::path::stem(FileName);<br>
> -  for (const auto &Category : Style.IncludeCategories)<br>
> -    CategoryRegexs.emplace_back(Category.Regex, llvm::Regex::IgnoreCase);<br>
> -  IsMainFile = FileName.endswith(".c") || FileName.endswith(".cc") ||<br>
> -               FileName.endswith(".cpp") || FileName.endswith(".c++") ||<br>
> -               FileName.endswith(".cxx") || FileName.endswith(".m") ||<br>
> -               FileName.endswith(".mm");<br>
> -}<br>
> -<br>
> -int IncludeCategoryManager::getIncludePriority(StringRef IncludeName,<br>
> -                                               bool CheckMainHeader) const {<br>
> -  int Ret = INT_MAX;<br>
> -  for (unsigned i = 0, e = CategoryRegexs.size(); i != e; ++i)<br>
> -    if (CategoryRegexs[i].match(IncludeName)) {<br>
> -      Ret = Style.IncludeCategories[i].Priority;<br>
> -      break;<br>
> -    }<br>
> -  if (CheckMainHeader && IsMainFile && Ret > 0 && isMainHeader(IncludeName))<br>
> -    Ret = 0;<br>
> -  return Ret;<br>
> -}<br>
> -<br>
> -bool IncludeCategoryManager::isMainHeader(StringRef IncludeName) const {<br>
> -  if (!IncludeName.startswith("\""))<br>
> -    return false;<br>
> -  StringRef HeaderStem =<br>
> -      llvm::sys::path::stem(IncludeName.drop_front(1).drop_back(1));<br>
> -  if (FileStem.startswith(HeaderStem) ||<br>
> -      FileStem.startswith_lower(HeaderStem)) {<br>
> -    llvm::Regex MainIncludeRegex((HeaderStem + Style.IncludeIsMainRegex).str(),<br>
> -                                 llvm::Regex::IgnoreCase);<br>
> -    if (MainIncludeRegex.match(FileStem))<br>
> -      return true;<br>
> -  }<br>
> -  return false;<br>
> -}<br>
> -<br>
> -HeaderIncludes::HeaderIncludes(StringRef FileName, StringRef Code,<br>
> -                               const IncludeStyle &Style)<br>
> -    : FileName(FileName), Code(Code), FirstIncludeOffset(-1),<br>
> -      MinInsertOffset(<br>
> -          getOffsetAfterHeaderGuardsAndComments(FileName, Code, Style)),<br>
> -      MaxInsertOffset(MinInsertOffset +<br>
> -                      getMaxHeaderInsertionOffset(<br>
> -                          FileName, Code.drop_front(MinInsertOffset), Style)),<br>
> -      Categories(Style, FileName),<br>
> -      IncludeRegex(llvm::Regex(IncludeRegexPattern)) {<br>
> -  // Add 0 for main header and INT_MAX for headers that are not in any<br>
> -  // category.<br>
> -  Priorities = {0, INT_MAX};<br>
> -  for (const auto &Category : Style.IncludeCategories)<br>
> -    Priorities.insert(Category.Priority);<br>
> -  SmallVector<StringRef, 32> Lines;<br>
> -  Code.drop_front(MinInsertOffset).split(Lines, "\n");<br>
> -<br>
> -  unsigned Offset = MinInsertOffset;<br>
> -  unsigned NextLineOffset;<br>
> -  SmallVector<StringRef, 4> Matches;<br>
> -  for (auto Line : Lines) {<br>
> -    NextLineOffset = std::min(Code.size(), Offset + Line.size() + 1);<br>
> -    if (IncludeRegex.match(Line, &Matches)) {<br>
> -      // If this is the last line without trailing newline, we need to make<br>
> -      // sure we don't delete across the file boundary.<br>
> -      addExistingInclude(<br>
> -          Include(Matches[2],<br>
> -                  tooling::Range(<br>
> -                      Offset, std::min(Line.size() + 1, Code.size() - Offset))),<br>
> -          NextLineOffset);<br>
> -    }<br>
> -    Offset = NextLineOffset;<br>
> -  }<br>
> -<br>
> -  // Populate CategoryEndOfssets:<br>
> -  // - Ensure that CategoryEndOffset[Highest] is always populated.<br>
> -  // - If CategoryEndOffset[Priority] isn't set, use the next higher value<br>
> -  // that is set, up to CategoryEndOffset[Highest].<br>
> -  auto Highest = Priorities.begin();<br>
> -  if (CategoryEndOffsets.find(*Highest) == CategoryEndOffsets.end()) {<br>
> -    if (FirstIncludeOffset >= 0)<br>
> -      CategoryEndOffsets[*Highest] = FirstIncludeOffset;<br>
> -    else<br>
> -      CategoryEndOffsets[*Highest] = MinInsertOffset;<br>
> -  }<br>
> -  // By this point, CategoryEndOffset[Highest] is always set appropriately:<br>
> -  //  - to an appropriate location before/after existing #includes, or<br>
> -  //  - to right after the header guard, or<br>
> -  //  - to the beginning of the file.<br>
> -  for (auto I = ++Priorities.begin(), E = Priorities.end(); I != E; ++I)<br>
> -    if (CategoryEndOffsets.find(*I) == CategoryEndOffsets.end())<br>
> -      CategoryEndOffsets[*I] = CategoryEndOffsets[*std::prev(I)];<br>
> -}<br>
> -<br>
> -// \p Offset: the start of the line following this include directive.<br>
> -void HeaderIncludes::addExistingInclude(Include IncludeToAdd,<br>
> -                                        unsigned NextLineOffset) {<br>
> -  auto Iter =<br>
> -      ExistingIncludes.try_emplace(trimInclude(IncludeToAdd.Name)).first;<br>
> -  Iter->second.push_back(std::move(IncludeToAdd));<br>
> -  auto &CurInclude = Iter->second.back();<br>
> -  // The header name with quotes or angle brackets.<br>
> -  // Only record the offset of current #include if we can insert after it.<br>
> -  if (CurInclude.R.getOffset() <= MaxInsertOffset) {<br>
> -    int Priority = Categories.getIncludePriority(<br>
> -        CurInclude.Name, /*CheckMainHeader=*/FirstIncludeOffset < 0);<br>
> -    CategoryEndOffsets[Priority] = NextLineOffset;<br>
> -    IncludesByPriority[Priority].push_back(&CurInclude);<br>
> -    if (FirstIncludeOffset < 0)<br>
> -      FirstIncludeOffset = CurInclude.R.getOffset();<br>
> -  }<br>
> -}<br>
> -<br>
> -llvm::Optional<tooling::Replacement><br>
> -HeaderIncludes::insert(llvm::StringRef IncludeName, bool IsAngled) const {<br>
> -  assert(IncludeName == trimInclude(IncludeName));<br>
> -  // If a <header> ("header") already exists in code, "header" (<header>) with<br>
> -  // different quotation will still be inserted.<br>
> -  // FIXME: figure out if this is the best behavior.<br>
> -  auto It = ExistingIncludes.find(IncludeName);<br>
> -  if (It != ExistingIncludes.end())<br>
> -    for (const auto &Inc : It->second)<br>
> -      if ((IsAngled && StringRef(Inc.Name).startswith("<")) ||<br>
> -          (!IsAngled && StringRef(Inc.Name).startswith("\"")))<br>
> -        return llvm::None;<br>
> -  std::string Quoted = IsAngled ? ("<" + IncludeName + ">").str()<br>
> -                                : ("\"" + IncludeName + "\"").str();<br>
> -  StringRef QuotedName = Quoted;<br>
> -  int Priority = Categories.getIncludePriority(<br>
> -      QuotedName, /*CheckMainHeader=*/FirstIncludeOffset < 0);<br>
> -  auto CatOffset = CategoryEndOffsets.find(Priority);<br>
> -  assert(CatOffset != CategoryEndOffsets.end());<br>
> -  unsigned InsertOffset = CatOffset->second; // Fall back offset<br>
> -  auto Iter = IncludesByPriority.find(Priority);<br>
> -  if (Iter != IncludesByPriority.end()) {<br>
> -    for (const auto *Inc : Iter->second) {<br>
> -      if (QuotedName < Inc->Name) {<br>
> -        InsertOffset = Inc->R.getOffset();<br>
> -        break;<br>
> -      }<br>
> -    }<br>
> -  }<br>
> -  assert(InsertOffset <= Code.size());<br>
> -  std::string NewInclude = ("#include " + QuotedName + "\n").str();<br>
> -  // When inserting headers at end of the code, also append '\n' to the code<br>
> -  // if it does not end with '\n'.<br>
> -  // FIXME: when inserting multiple #includes at the end of code, only one<br>
> -  // newline should be added.<br>
> -  if (InsertOffset == Code.size() && (!Code.empty() && Code.back() != '\n'))<br>
> -    NewInclude = "\n" + NewInclude;<br>
> -  return tooling::Replacement(FileName, InsertOffset, 0, NewInclude);<br>
> -}<br>
> -<br>
> -tooling::Replacements HeaderIncludes::remove(llvm::StringRef IncludeName,<br>
> -                                             bool IsAngled) const {<br>
> -  assert(IncludeName == trimInclude(IncludeName));<br>
> -  tooling::Replacements Result;<br>
> -  auto Iter = ExistingIncludes.find(IncludeName);<br>
> -  if (Iter == ExistingIncludes.end())<br>
> -    return Result;<br>
> -  for (const auto &Inc : Iter->second) {<br>
> -    if ((IsAngled && StringRef(Inc.Name).startswith("\"")) ||<br>
> -        (!IsAngled && StringRef(Inc.Name).startswith("<")))<br>
> -      continue;<br>
> -    llvm::Error Err = Result.add(tooling::Replacement(<br>
> -        FileName, Inc.R.getOffset(), Inc.R.getLength(), ""));<br>
> -    if (Err) {<br>
> -      auto ErrMsg = "Unexpected conflicts in #include deletions: " +<br>
> -                    llvm::toString(std::move(Err));<br>
> -      llvm_unreachable(ErrMsg.c_str());<br>
> -    }<br>
> -  }<br>
> -  return Result;<br>
> -}<br>
> -<br>
> -<br>
> -} // namespace tooling<br>
> -} // namespace clang<br>
><br>
> Removed: cfe/trunk/lib/Tooling/Core/IncludeStyle.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Core/IncludeStyle.cpp?rev=333873&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Core/IncludeStyle.cpp?rev=333873&view=auto</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Tooling/Core/IncludeStyle.cpp (original)<br>
> +++ cfe/trunk/lib/Tooling/Core/IncludeStyle.cpp (removed)<br>
> @@ -1,32 +0,0 @@<br>
> -//===--- IncludeStyle.cpp - Style of C++ #include directives -----*- C++-*-===//<br>
> -//<br>
> -//                     The LLVM Compiler Infrastructure<br>
> -//<br>
> -// This file is distributed under the University of Illinois Open Source<br>
> -// License. See LICENSE.TXT for details.<br>
> -//<br>
> -//===----------------------------------------------------------------------===//<br>
> -<br>
> -#include "clang/Tooling/Core/IncludeStyle.h"<br>
> -<br>
> -<br>
> -using clang::tooling::IncludeStyle;<br>
> -<br>
> -namespace llvm {<br>
> -namespace yaml {<br>
> -<br>
> -void MappingTraits<IncludeStyle::IncludeCategory>::mapping(<br>
> -    IO &IO, IncludeStyle::IncludeCategory &Category) {<br>
> -  IO.mapOptional("Regex", Category.Regex);<br>
> -  IO.mapOptional("Priority", Category.Priority);<br>
> -}<br>
> -<br>
> -void ScalarEnumerationTraits<IncludeStyle::IncludeBlocksStyle>::enumeration(<br>
> -    IO &IO, IncludeStyle::IncludeBlocksStyle &Value) {<br>
> -  IO.enumCase(Value, "Preserve", IncludeStyle::IBS_Preserve);<br>
> -  IO.enumCase(Value, "Merge", IncludeStyle::IBS_Merge);<br>
> -  IO.enumCase(Value, "Regroup", IncludeStyle::IBS_Regroup);<br>
> -}<br>
> -<br>
> -} // namespace yaml<br>
> -} // namespace llvm<br>
><br>
> Copied: cfe/trunk/lib/Tooling/Inclusions/CMakeLists.txt (from r333865, cfe/trunk/lib/Tooling/Core/CMakeLists.txt)<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Inclusions/CMakeLists.txt?p2=cfe/trunk/lib/Tooling/Inclusions/CMakeLists.txt&p1=cfe/trunk/lib/Tooling/Core/CMakeLists.txt&r1=333865&r2=333874&rev=333874&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Inclusions/CMakeLists.txt?p2=cfe/trunk/lib/Tooling/Inclusions/CMakeLists.txt&p1=cfe/trunk/lib/Tooling/Core/CMakeLists.txt&r1=333865&r2=333874&rev=333874&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Tooling/Core/CMakeLists.txt (original)<br>
> +++ cfe/trunk/lib/Tooling/Inclusions/CMakeLists.txt Mon Jun  4 02:04:12 2018<br>
> @@ -1,15 +1,12 @@<br>
>  set(LLVM_LINK_COMPONENTS support)<br>
><br>
> -add_clang_library(clangToolingCore<br>
> -  Diagnostic.cpp<br>
> +add_clang_library(clangToolingInclusions<br>
>    HeaderIncludes.cpp<br>
>    IncludeStyle.cpp<br>
> -  Lookup.cpp<br>
> -  Replacement.cpp<br>
><br>
>    LINK_LIBS<br>
> -  clangAST<br>
>    clangBasic<br>
>    clangLex<br>
>    clangRewrite<br>
> +  clangToolingCore<br>
>    )<br>
><br>
> Copied: cfe/trunk/lib/Tooling/Inclusions/HeaderIncludes.cpp (from r333865, cfe/trunk/lib/Tooling/Core/HeaderIncludes.cpp)<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Inclusions/HeaderIncludes.cpp?p2=cfe/trunk/lib/Tooling/Inclusions/HeaderIncludes.cpp&p1=cfe/trunk/lib/Tooling/Core/HeaderIncludes.cpp&r1=333865&r2=333874&rev=333874&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Inclusions/HeaderIncludes.cpp?p2=cfe/trunk/lib/Tooling/Inclusions/HeaderIncludes.cpp&p1=cfe/trunk/lib/Tooling/Core/HeaderIncludes.cpp&r1=333865&r2=333874&rev=333874&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Tooling/Core/HeaderIncludes.cpp (original)<br>
> +++ cfe/trunk/lib/Tooling/Inclusions/HeaderIncludes.cpp Mon Jun  4 02:04:12 2018<br>
> @@ -7,7 +7,7 @@<br>
>  //<br>
>  //===----------------------------------------------------------------------===//<br>
><br>
> -#include "clang/Tooling/Core/HeaderIncludes.h"<br>
> +#include "clang/Tooling/Inclusions/HeaderIncludes.h"<br>
>  #include "clang/Basic/SourceManager.h"<br>
>  #include "clang/Lex/Lexer.h"<br>
><br>
><br>
> Copied: cfe/trunk/lib/Tooling/Inclusions/IncludeStyle.cpp (from r333865, cfe/trunk/lib/Tooling/Core/IncludeStyle.cpp)<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Inclusions/IncludeStyle.cpp?p2=cfe/trunk/lib/Tooling/Inclusions/IncludeStyle.cpp&p1=cfe/trunk/lib/Tooling/Core/IncludeStyle.cpp&r1=333865&r2=333874&rev=333874&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Inclusions/IncludeStyle.cpp?p2=cfe/trunk/lib/Tooling/Inclusions/IncludeStyle.cpp&p1=cfe/trunk/lib/Tooling/Core/IncludeStyle.cpp&r1=333865&r2=333874&rev=333874&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Tooling/Core/IncludeStyle.cpp (original)<br>
> +++ cfe/trunk/lib/Tooling/Inclusions/IncludeStyle.cpp Mon Jun  4 02:04:12 2018<br>
> @@ -7,8 +7,7 @@<br>
>  //<br>
>  //===----------------------------------------------------------------------===//<br>
><br>
> -#include "clang/Tooling/Core/IncludeStyle.h"<br>
> -<br>
> +#include "clang/Tooling/Inclusions/IncludeStyle.h"<br>
><br>
>  using clang::tooling::IncludeStyle;<br>
><br>
><br>
> Modified: cfe/trunk/unittests/Tooling/HeaderIncludesTest.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/HeaderIncludesTest.cpp?rev=333874&r1=333873&r2=333874&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/HeaderIncludesTest.cpp?rev=333874&r1=333873&r2=333874&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/unittests/Tooling/HeaderIncludesTest.cpp (original)<br>
> +++ cfe/trunk/unittests/Tooling/HeaderIncludesTest.cpp Mon Jun  4 02:04:12 2018<br>
> @@ -7,7 +7,7 @@<br>
>  //<br>
>  //===----------------------------------------------------------------------===//<br>
><br>
> -#include "clang/Tooling/Core/HeaderIncludes.h"<br>
> +#include "clang/Tooling/Inclusions/HeaderIncludes.h"<br>
>  #include "../Tooling/ReplacementTest.h"<br>
>  #include "../Tooling/RewriterTestContext.h"<br>
>  #include "clang/Format/Format.h"<br>
><br>
><br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div>