Re: r296166 - clang-format: Don't leave behind temp files in -i mode on Windows, PR26125

2017-02-25 Thread NAKAMURA Takumi via cfe-commits
Reverted in r296237 .

 (MemoryBuffer)Code is referred after Code.reset().

On Sun, Feb 26, 2017 at 12:40 AM Nico Weber via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Thanks, I had fixed this in 171 a bit over an hour before your mail.
>
> On Feb 24, 2017 5:17 PM, "Renato Golin via cfe-commits" <
> cfe-commits@lists.llvm.org> wrote:
>
> On 24 February 2017 at 20:49, Nico Weber via cfe-commits
>  wrote:
> > Author: nico
> > Date: Fri Feb 24 14:49:00 2017
> > New Revision: 296166
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=296166&view=rev
> > Log:
> > clang-format: Don't leave behind temp files in -i mode on Windows,
> PR26125
> >
> > Fix and analysis by Wei Mao  (see bug), test by me.
>
> Hi Nico,
>
> This one looks yours:
>
> http://lab.llvm.org:8011/builders/clang-cmake-aarch64-42vma/builds/5005
>
> http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/4075
>
> http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-full/builds/4386
>
> http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15/builds/4439
>
> http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15/builds/4450
>
> cheers,
> --renato
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r296166 - clang-format: Don't leave behind temp files in -i mode on Windows, PR26125

2017-02-25 Thread Nico Weber via cfe-commits
Thanks, I had fixed this in 171 a bit over an hour before your mail.

On Feb 24, 2017 5:17 PM, "Renato Golin via cfe-commits" <
cfe-commits@lists.llvm.org> wrote:

> On 24 February 2017 at 20:49, Nico Weber via cfe-commits
>  wrote:
> > Author: nico
> > Date: Fri Feb 24 14:49:00 2017
> > New Revision: 296166
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=296166&view=rev
> > Log:
> > clang-format: Don't leave behind temp files in -i mode on Windows,
> PR26125
> >
> > Fix and analysis by Wei Mao  (see bug), test by me.
>
> Hi Nico,
>
> This one looks yours:
>
> http://lab.llvm.org:8011/builders/clang-cmake-aarch64-42vma/builds/5005
>
> http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/4075
>
> http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-full/builds/4386
>
> http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15/builds/4439
>
> http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15/builds/4450
>
> cheers,
> --renato
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r296237 - Revert r296166, "clang-format: Don't leave behind temp files in -i mode on Windows, PR26125", and r296171.

2017-02-24 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Fri Feb 24 21:45:49 2017
New Revision: 296237

URL: http://llvm.org/viewvc/llvm-project?rev=296237&view=rev
Log:
Revert r296166, "clang-format: Don't leave behind temp files in -i mode on 
Windows, PR26125", and r296171.

(MemoryBuffer)Code.reset() was too early.

  ==26912== Invalid read of size 1
  ==26912==at 0x437E1D: llvm::MemoryBuffer::init(char const*, char const*, 
bool) (MemoryBuffer.cpp:47)
  ==26912==by 0x438013: (anonymous 
namespace)::MemoryBufferMem::MemoryBufferMem(llvm::StringRef, bool) 
(MemoryBuffer.cpp:86)
  ==26912==by 0x438128: llvm::MemoryBuffer::getMemBuffer(llvm::StringRef, 
llvm::StringRef, bool) (MemoryBuffer.cpp:112)
  ==26912==by 0x4E189D: clang::vfs::detail::(anonymous 
namespace)::InMemoryFileAdaptor::getBuffer(llvm::Twine const&, long, bool, 
bool) (VirtualFileSystem.cpp:443)
  ==26912==by 0x4DF5BA: 
clang::vfs::FileSystem::getBufferForFile(llvm::Twine const&, long, bool, bool) 
(VirtualFileSystem.cpp:94)
  ==26912==by 0x4B72EC: 
clang::FileManager::getBufferForFile(clang::FileEntry const*, bool, bool) 
(FileManager.cpp:443)
  ==26912==by 0x4C1F81: 
clang::SrcMgr::ContentCache::getBuffer(clang::DiagnosticsEngine&, 
clang::SourceManager const&, clang::SourceLocation, bool*) const 
(SourceManager.cpp:98)
  ==26912==by 0x4C50E5: clang::SourceManager::getBufferData(clang::FileID, 
bool*) const (SourceManager.cpp:689)
  ==26912==by 0x58E794: clang::Rewriter::getEditBuffer(clang::FileID) 
(Rewriter.cpp:230)
  ==26912==by 0x407297: clang::format::format(llvm::StringRef) 
(ClangFormat.cpp:311)
  ==26912==by 0x4078D7: main (ClangFormat.cpp:363)

Removed:
cfe/trunk/test/Format/inplace.cpp
Modified:
cfe/trunk/tools/clang-format/ClangFormat.cpp

Removed: cfe/trunk/test/Format/inplace.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/inplace.cpp?rev=296236&view=auto
==
--- cfe/trunk/test/Format/inplace.cpp (original)
+++ cfe/trunk/test/Format/inplace.cpp (removed)
@@ -1,263 +0,0 @@
-// Regression test to check that clang-format does not leave behind temporary
-// files on Windows when doing in-place formatting.
-// RUN: rm %T/inplace*
-// RUN: cp %s %T/inplace.cpp
-// RUN: clang-format -style=LLVM -i %T/inplace.cpp
-// RUN: ls %T > %T/files.txt
-// RUN: FileCheck -strict-whitespace -input-file=%T/files.txt %s
-
-// CHECK-NOT: RF{{.*}}.TMP
-
-// The file needs to be larger than 16kiB so that Windows creates a real file
-// mapping object for it.
- int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
-int this_is_my_int_there_a

Re: r296166 - clang-format: Don't leave behind temp files in -i mode on Windows, PR26125

2017-02-24 Thread Renato Golin via cfe-commits
On 24 February 2017 at 20:49, Nico Weber via cfe-commits
 wrote:
> Author: nico
> Date: Fri Feb 24 14:49:00 2017
> New Revision: 296166
>
> URL: http://llvm.org/viewvc/llvm-project?rev=296166&view=rev
> Log:
> clang-format: Don't leave behind temp files in -i mode on Windows, PR26125
>
> Fix and analysis by Wei Mao  (see bug), test by me.

Hi Nico,

This one looks yours:

http://lab.llvm.org:8011/builders/clang-cmake-aarch64-42vma/builds/5005

http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/4075

http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-full/builds/4386

http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15/builds/4439

http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15/builds/4450

cheers,
--renato
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r296166 - clang-format: Don't leave behind temp files in -i mode on Windows, PR26125

2017-02-24 Thread Nico Weber via cfe-commits
Author: nico
Date: Fri Feb 24 14:49:00 2017
New Revision: 296166

URL: http://llvm.org/viewvc/llvm-project?rev=296166&view=rev
Log:
clang-format: Don't leave behind temp files in -i mode on Windows, PR26125

Fix and analysis by Wei Mao  (see bug), test by me.

Added:
cfe/trunk/test/Format/inplace.cpp
Modified:
cfe/trunk/tools/clang-format/ClangFormat.cpp

Added: cfe/trunk/test/Format/inplace.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/inplace.cpp?rev=296166&view=auto
==
--- cfe/trunk/test/Format/inplace.cpp (added)
+++ cfe/trunk/test/Format/inplace.cpp Fri Feb 24 14:49:00 2017
@@ -0,0 +1,263 @@
+// Regression test to check that clang-format does not leave behind temporary
+// files on Windows when doing in-place formatting.
+// RUN: rm %T/*
+// RUN: cp %s %T/inplace.cpp
+// RUN: clang-format -style=LLVM -i %T/inplace.cpp
+// RUN: ls %T > %T/files.txt
+// RUN: FileCheck -strict-whitespace -input-file=%T/files.txt %s
+
+// CHECK-NOT: RF{{.*}}.TMP
+
+// The file needs to be larger than 16kiB so that Windows creates a real file
+// mapping object for it.
+ int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_one_is_mine;
+int this_is_my_int_there_are_many_like_it_but_this_o