<div dir="ltr">Fixed in r286279.</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 8, 2016 at 10:45 AM, Galina Kistanova <span dir="ltr"><<a href="mailto:gkistanova@gmail.com" target="_blank">gkistanova@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello Daniel,<br><br>This commit broke at least one of our builders:<br><a href="http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/234" target="_blank">http://lab.llvm.org:8011/<wbr>builders/clang-with-thin-lto-<wbr>ubuntu/builds/234</a><br><br>Please have a look at this?<br><br>Thanks<span class="HOEnZb"><font color="#888888"><br><br>Galina<br></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 8, 2016 at 8:11 AM, Daniel Jasper via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: djasper<br>
Date: Tue Nov  8 10:11:33 2016<br>
New Revision: 286243<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=286243&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=286243&view=rev</a><br>
Log:<br>
[clang-format] Remove (SourceManager, FileID) variants<br>
<br>
In Format, remove the reformat() and clean() functions taking a SourceManager<br>
and a FileID. Keep the versions taking StringRef Code.<br>
<br>
- there was duplicated functionality<br>
- the FileID versions were harder to use<br>
- the clean() version is dead code anyways<br>
<br>
Patch by Krasimir Georgiev. Thank you.<br>
<br>
Modified:<br>
    cfe/trunk/include/clang/Format<wbr>/Format.h<br>
    cfe/trunk/lib/Format/Format.cp<wbr>p<br>
    cfe/trunk/lib/Index/CommentToX<wbr>ML.cpp<br>
<br>
Modified: cfe/trunk/include/clang/Format<wbr>/Format.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Format/Format.h?rev=286243&r1=286242&r2=286243&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/include/clang/<wbr>Format/Format.h?rev=286243&r1=<wbr>286242&r2=286243&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/Format<wbr>/Format.h (original)<br>
+++ cfe/trunk/include/clang/Format<wbr>/Format.h Tue Nov  8 10:11:33 2016<br>
@@ -794,7 +794,7 @@ llvm::Expected<tooling::Replac<wbr>ements><br>
 cleanupAroundReplacements(Str<wbr>ingRef Code, const tooling::Replacements &Replaces,<br>
                           const FormatStyle &Style);<br>
<br>
-/// \brief Reformats the given \p Ranges in the file \p ID.<br>
+/// \brief Reformats the given \p Ranges in \p Code.<br>
 ///<br>
 /// Each range is extended on either end to its next bigger logic unit, i.e.<br>
 /// everything that might influence its formatting or might be influenced by its<br>
@@ -806,31 +806,15 @@ cleanupAroundReplacements(Stri<wbr>ngRef Code<br>
 /// If ``IncompleteFormat`` is non-null, its value will be set to true if any<br>
 /// of the affected ranges were not formatted due to a non-recoverable syntax<br>
 /// error.<br>
-tooling::Replacements reformat(const FormatStyle &Style,<br>
-                               SourceManager &SourceMgr, FileID ID,<br>
-                               ArrayRef<CharSourceRange> Ranges,<br>
-                               bool *IncompleteFormat = nullptr);<br>
-<br>
-/// \brief Reformats the given \p Ranges in \p Code.<br>
-///<br>
-/// Otherwise identical to the reformat() function using a file ID.<br>
 tooling::Replacements reformat(const FormatStyle &Style, StringRef Code,<br>
                                ArrayRef<tooling::Range> Ranges,<br>
                                StringRef FileName = "<stdin>",<br>
                                bool *IncompleteFormat = nullptr);<br>
<br>
-/// \brief Clean up any erroneous/redundant code in the given \p Ranges in the<br>
-/// file \p ID.<br>
-///<br>
-/// Returns the ``Replacements`` that clean up all \p Ranges in the file \p ID.<br>
-tooling::Replacements cleanup(const FormatStyle &Style,<br>
-                              SourceManager &SourceMgr, FileID ID,<br>
-                              ArrayRef<CharSourceRange> Ranges);<br>
-<br>
 /// \brief Clean up any erroneous/redundant code in the given \p Ranges in \p<br>
 /// Code.<br>
 ///<br>
-/// Otherwise identical to the cleanup() function using a file ID.<br>
+/// Returns the ``Replacements`` that clean up all \p Ranges in \p Code.<br>
 tooling::Replacements cleanup(const FormatStyle &Style, StringRef Code,<br>
                               ArrayRef<tooling::Range> Ranges,<br>
                               StringRef FileName = "<stdin>");<br>
<br>
Modified: cfe/trunk/lib/Format/Format.cp<wbr>p<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=286243&r1=286242&r2=286243&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/lib/Format/For<wbr>mat.cpp?rev=286243&r1=286242&<wbr>r2=286243&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Format/Format.cp<wbr>p (original)<br>
+++ cfe/trunk/lib/Format/Format.cp<wbr>p Tue Nov  8 10:11:33 2016<br>
@@ -1719,18 +1719,6 @@ cleanupAroundReplacements(Stri<wbr>ngRef Code<br>
   return processReplacements(Cleanup, Code, NewReplaces, Style);<br>
 }<br>
<br>
-tooling::Replacements reformat(const FormatStyle &Style, SourceManager &SM,<br>
-                               FileID ID, ArrayRef<CharSourceRange> Ranges,<br>
-                               bool *IncompleteFormat) {<br>
-  FormatStyle Expanded = expandPresets(Style);<br>
-  if (Expanded.DisableFormat)<br>
-    return tooling::Replacements();<br>
-<br>
-  Environment Env(SM, ID, Ranges);<br>
-  Formatter Format(Env, Expanded, IncompleteFormat);<br>
-  return Format.process();<br>
-}<br>
-<br>
 tooling::Replacements reformat(const FormatStyle &Style, StringRef Code,<br>
                                ArrayRef<tooling::Range> Ranges,<br>
                                StringRef FileName, bool *IncompleteFormat) {<br>
@@ -1760,13 +1748,6 @@ tooling::Replacements reformat(const For<br>
   return Format.process();<br>
 }<br>
<br>
-tooling::Replacements cleanup(const FormatStyle &Style, SourceManager &SM,<br>
-                              FileID ID, ArrayRef<CharSourceRange> Ranges) {<br>
-  Environment Env(SM, ID, Ranges);<br>
-  Cleaner Clean(Env, Style);<br>
-  return Clean.process();<br>
-}<br>
-<br>
 tooling::Replacements cleanup(const FormatStyle &Style, StringRef Code,<br>
                               ArrayRef<tooling::Range> Ranges,<br>
                               StringRef FileName) {<br>
<br>
Modified: cfe/trunk/lib/Index/CommentToX<wbr>ML.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/CommentToXML.cpp?rev=286243&r1=286242&r2=286243&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/lib/Index/Comm<wbr>entToXML.cpp?rev=286243&r1=<wbr>286242&r2=286243&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Index/CommentToX<wbr>ML.cpp (original)<br>
+++ cfe/trunk/lib/Index/CommentToX<wbr>ML.cpp Tue Nov  8 10:11:33 2016<br>
@@ -597,20 +597,21 @@ void CommentASTToXMLConverter::form<wbr>atTex<br>
<br>
   // Formatter specific code.<br>
   // Form a unique in memory buffer name.<br>
-  SmallString<128> filename;<br>
-  filename += "xmldecl";<br>
-  filename += llvm::utostr(FormatInMemoryUni<wbr>queId);<br>
-  filename += ".xd";<br>
-  FileID ID = FormatRewriterContext.createIn<wbr>MemoryFile(filename, StringDecl);<br>
-  SourceLocation Start = FormatRewriterContext.Sources.<wbr>getLocForStartOfFile(ID)<br>
-      .getLocWithOffset(0);<br>
+  SmallString<128> Filename;<br>
+  Filename += "xmldecl";<br>
+  Filename += llvm::utostr(FormatInMemoryUni<wbr>queId);<br>
+  Filename += ".xd";<br>
+  unsigned Offset = 0;<br>
   unsigned Length = Declaration.size();<br>
<br>
-  tooling::Replacements Replace = reformat(<br>
-      format::getLLVMStyle(), FormatRewriterContext.Sources, ID,<br>
-      CharSourceRange::getCharRange(<wbr>Start, Start.getLocWithOffset(Length)<wbr>));<br>
-  applyAllReplacements(Replace, FormatRewriterContext.Rewrite)<wbr>;<br>
-  Declaration = FormatRewriterContext.getRewri<wbr>ttenText(ID);<br>
+  bool IncompleteFormat = false;<br>
+  tooling::Replacements Replaces =<br>
+      reformat(format::getLLVMStyle(<wbr>), StringDecl,<br>
+               tooling::Range(Offset, Length), Filename, &IncompleteFormat);<br>
+  auto FormattedStringDecl = applyAllReplacements(StringDec<wbr>l, Replaces);<br>
+  if (static_cast<bool>(FormattedSt<wbr>ringDecl)) {<br>
+    Declaration = *FormattedStringDecl;<br>
+  }<br>
 }<br>
<br>
 } // end unnamed namespace<br>
@@ -1159,4 +1160,3 @@ void CommentToXMLConverter::convert<wbr>Comme<br>
                                      FormatInMemoryUniqueId++);<br>
   Converter.visit(FC);<br>
 }<br>
-<br>
<br>
<br>
______________________________<wbr>_________________<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/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>