[PATCH] D154602: [clang][clangd] Don't crash/assert on -gsplit-dwarf=single without output

Dmitry Polukhin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 7 04:56:51 PDT 2023


DmitryPolukhin added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/CommonArgs.cpp:1274
   if (Arg *A = Args.getLastArg(options::OPT_gsplit_dwarf_EQ))
-    if (StringRef(A->getValue()) == "single")
+    if (StringRef(A->getValue()) == "single" && Output.isFilename())
       return Args.MakeArgString(Output.getFilename());
----------------
yaxunl wrote:
> I am wondering in what situation the Output here is not a file name. Is it possible to have a lit test for this?
It is possible to create lit test but still will be clangd lit test. I was not able to find case when it happens with clang driver itself. Nothing `Output` appears from https://github.com/llvm/llvm-project/blob/main/clang/lib/Driver/Driver.cpp#L5580 in case of clangd. In case of clang driver next else is taken and it produces file based Output. As far as I understand clangd prefers unittests over lit tests. But I can convert it to lit test if you think it is better.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154602



More information about the cfe-commits mailing list