[PATCH] D67592: [Clang] Use -main-file-name for source filename if not set

Nico Weber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 30 10:13:16 PDT 2019


thakis added a comment.

This is failing on my mac like so:

  FAIL: Clang :: Frontend/stdin-input.c (1 of 1)
  ******************** TEST 'Clang :: Frontend/stdin-input.c' FAILED ********************
  Script:
  --
  : 'RUN: at line 1';   cat /Users/thakis/src/llvm-project/clang/test/Frontend/stdin-input.c | /Users/thakis/src/llvm-project/out/gn/bin/clang -emit-llvm -g -S  -Xclang -main-file-name -Xclang test/foo.c -x c - -o - | /Users/thakis/src/llvm-project/out/gn/bin/FileCheck /Users/thakis/src/llvm-project/clang/test/Frontend/stdin-input.c
  --
  Exit Code: 1
  
  Command Output (stderr):
  --
  + : 'RUN: at line 1'
  + cat /Users/thakis/src/llvm-project/clang/test/Frontend/stdin-input.c
  + /Users/thakis/src/llvm-project/out/gn/bin/clang -emit-llvm -g -S -Xclang -main-file-name -Xclang test/foo.c -x c - -o -
  + /Users/thakis/src/llvm-project/out/gn/bin/FileCheck /Users/thakis/src/llvm-project/clang/test/Frontend/stdin-input.c
  /Users/thakis/src/llvm-project/clang/test/Frontend/stdin-input.c:5:11: error: CHECK: expected string not found in input
  // CHECK: !1 = !DIFile(filename: "test/foo.c"
            ^
  <stdin>:3:1: note: scanning from here
  target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
  ^
  <stdin>:24:1: note: possible intended match here
  !6 = !DIFile(filename: "test/foo.c", directory: "/Users/thakis/src/llvm-project/out/gn/obj/clang/test/Frontend")
  ^
  
  --
  
  ********************
  Testing Time: 0.06s
  ********************
  Failing Tests (1):
      Clang :: Frontend/stdin-input.c

If I manually run `bin/llvm-lit clang/test/Frontend/stdin-input.c` it fails, but if I run the command it claims to be running it passes.

If I replace the `FileCheck` on the run line with `> tmp.txt` I see what the failing FileCheck is seeing:

  !0 = !{i32 2, !"SDK Version", [2 x i32] [i32 10, i32 14]}
  !1 = !{i32 2, !"Dwarf Version", i32 4}
  !2 = !{i32 2, !"Debug Info Version", i32 3}
  !3 = !{i32 1, !"wchar_size", i32 4}
  !4 = !{i32 7, !"PIC Level", i32 2}
  !5 = distinct !DICompileUnit(language: DW_LANG_C99, file: !6, producer: "clang version 10.0.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !7, nameTableKind: None)
  !6 = !DIFile(filename: "test/foo.c", directory: "/Users/thakis/src/llvm-project/out/gn/obj/clang/test/Frontend")

I'm guessing lit sets some env var that makes clang emit these additional values (?)


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67592/new/

https://reviews.llvm.org/D67592





More information about the cfe-commits mailing list