diff options
author | Eric Liu <ioeric@google.com> | 2016-05-31 13:34:20 +0000 |
---|---|---|
committer | Eric Liu <ioeric@google.com> | 2016-05-31 13:34:20 +0000 |
commit | 9ee9835de5203523d7f3491b3f434f3084892b73 (patch) | |
tree | 55365c53d16fcbaf5c049412871836519156df8a /include/clang/Format | |
parent | 6358954832fb04090e9f2b405685f6930915b61c (diff) |
[clang-format] insert new #includes into correct blocks when cleaning up Replacement with cleanupAroundReplacements().
Summary:
When a replacement's offset is set to UINT_MAX or -1U, it is treated as
a header insertion replacement by cleanupAroundReplacements(). The new #include
directive is then inserted into the correct block.
Reviewers: klimek, djasper
Subscribers: klimek, cfe-commits, bkramer
Differential Revision: http://reviews.llvm.org/D20734
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@271276 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Format')
-rw-r--r-- | include/clang/Format/Format.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/clang/Format/Format.h b/include/clang/Format/Format.h index e695b8cd7d..3600c416b9 100644 --- a/include/clang/Format/Format.h +++ b/include/clang/Format/Format.h @@ -773,6 +773,8 @@ tooling::Replacements formatReplacements(StringRef Code, /// \brief Returns the replacements corresponding to applying \p Replaces and /// cleaning up the code after that. +/// This also inserts a C++ #include directive into the correct block if the +/// replacement corresponding to the header insertion has offset UINT_MAX. tooling::Replacements cleanupAroundReplacements(StringRef Code, const tooling::Replacements &Replaces, const FormatStyle &Style); |