================
@@ -192,6 +192,9 @@ An overview of all the command-line options:
     --export-fixes=<filename>        - YAML file to store suggested fixes in. 
The
                                        stored fixes can be applied to the 
input source
                                        code with clang-apply-replacements.
+    --sarif-export=<filename>        - File in which to store diagnostics in 
SARIF format.
+                                       Use '-' to write to stdout instead of 
the usual
+                                       diagnostic output.
----------------
zeyi2 wrote:

> Using - for stdout feels strange to me, could you please explain why you 
> chose such design? Any other tools (in LLVM ecosystem particular) use that?

IMO using `-` for stdout is a common practive in UNIX?

e.g.

- `ls -la | vim -`
- `wget -O - https://example.com`

in LLVM ecosystem, Clang already supports this:

```
zeyi2@PhantomParty:tmp% clang -S -emit-llvm a.c -o -
; ModuleID = 'a.c'
source_filename = "a.c"
target datalayout = 
"e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32"
target triple = "arm64-apple-macosx26.0.0"

; Function Attrs: noinline nounwind optnone ssp uwtable(sync)
define i32 @main() #0 {
  %1 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  ret i32 0
}

attributes #0 = { noinline nounwind optnone ssp uwtable(sync) 
"frame-pointer"="non-leaf" "no-trapping-math"="true" 
"probe-stack"="__chkstk_darwin" "stack-protector-buffer-size"="8" 
"target-cpu"="apple-m1" 
"target-features"="+aes,+altnzcv,+bti,+ccdp,+ccidx,+ccpp,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8a"
 }

!llvm.module.flags = !{!0, !1, !2, !3, !4}
!llvm.ident = !{!5}

!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 27, i32 0]}
!1 = !{i32 1, !"wchar_size", i32 4}
!2 = !{i32 8, !"PIC Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 1}
!4 = !{i32 7, !"frame-pointer", i32 1}
!5 = !{!"Apple clang version 21.0.0 (clang-2100.3.34.2)"}
```

So personally I think this is fine?



https://github.com/llvm/llvm-project/pull/219182
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to