[all-commits] [llvm/llvm-project] ab8f62: [DebugInfo] Fix file path separator when targeting...

Zequan Wu via All-commits all-commits at lists.llvm.org
Mon Apr 17 10:07:55 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ab8f622c79b27bc606da043e8dcbd417b8ade725
      https://github.com/llvm/llvm-project/commit/ab8f622c79b27bc606da043e8dcbd417b8ade725
  Author: Zequan Wu <zequanwu at google.com>
  Date:   2023-04-17 (Mon, 17 Apr 2023)

  Changed paths:
    M clang/include/clang/Basic/LangOptions.h
    M clang/lib/CodeGen/CGDebugInfo.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    A clang/test/CodeGen/debug-info-slash.c
    M clang/test/Driver/cl-outputs.c
    M llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp

  Log Message:
  -----------
  [DebugInfo] Fix file path separator when targeting windows.

This fixes two problems:

1. When crossing compiling for windows on linux, source file path in debug info is concatenated with directory by host native separator ('/'). For windows local build, they are concatenated by '\'. This causes non-determinism bug.

  The solution here is to let `LangOptions.UseTargetPathSeparator` to control if we should use host native separator or not.

2. Objectfile path in CodeView also uses host native separator when generated.

 It's fixed by changing the path separator in `/Fo` to '\' if the path is not an absolute path when adding the `-object-file-name=` flag.

Reviewed By: hans

Differential Revision: https://reviews.llvm.org/D147256




More information about the All-commits mailing list