r310030 - Revert r309984, "Use "foo-12345.o" instead of "foo.o-12345" as temporary file name."

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 4 07:09:36 PDT 2017


Takumi provides some more details on IRC: The change broke
http://bb.pgr.jp/builders/bootstrap-clang-libcxx-lld-i686-linux/builds/655/steps/build_stage2/logs/stdio
, which uses modules.  He says there's a race-condition: while clang emits
***-{tmp}.pcm, another clang collects *.pcm for the module index.
GlobalModuleIndex.cpp walks over a directory here and ignores everything
not ending in '.pcm' here:
http://llvm-cs.pcc.me.uk/tools/clang/lib/Serialization/GlobalModuleIndex.cpp#850

That seems pretty gross, but I can't think of a non-gross way to make this
patch work with that pcm walking.

We could always append ".tmp" to the temp file names, but then the original
benefit is gone too.

We could do this patch only for .obj files, or always except for .pcm
files, but that seems both kind of gross as well.

On Fri, Aug 4, 2017 at 2:35 AM, NAKAMURA Takumi via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Author: chapuni
> Date: Thu Aug  3 23:35:32 2017
> New Revision: 310030
>
> URL: http://llvm.org/viewvc/llvm-project?rev=310030&view=rev
> Log:
> Revert r309984, "Use "foo-12345.o" instead of "foo.o-12345" as temporary
> file name."
>
> It generates MODULE-XXXXXXXXXXXX-%%%%%%%%.pcm, then GlobalModuleIndex.cpp
> is confused with the suffix ".pcm"
>
> Modified:
>     cfe/trunk/lib/Frontend/CompilerInstance.cpp
>
> Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/
> Frontend/CompilerInstance.cpp?rev=310030&r1=310029&r2=310030&view=diff
> ============================================================
> ==================
> --- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
> +++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Thu Aug  3 23:35:32 2017
> @@ -759,13 +759,9 @@ std::unique_ptr<llvm::raw_pwrite_stream>
>
>    if (UseTemporary) {
>      // Create a temporary file.
> -    // Insert -%%%%%%%% before the extension (if any), so that tools doing
> -    // things based on the file extension do the right thing.
> -    StringRef OutputExtension = llvm::sys::path::extension(OutFile);
> -    SmallString<128> TempPath =
> -        StringRef(OutFile).drop_back(OutputExtension.size());
> +    SmallString<128> TempPath;
> +    TempPath = OutFile;
>      TempPath += "-%%%%%%%%";
> -    TempPath += OutputExtension;
>      int fd;
>      std::error_code EC =
>          llvm::sys::fs::createUniqueFile(TempPath, fd, TempPath);
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170804/fb571030/attachment.html>


More information about the cfe-commits mailing list