Skip to content

Commit dbbc34f

Browse files
committed
Accept all compiler for querying drivers (g++ and gcc for example)
1 parent a9580aa commit dbbc34f

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

handler/handler.go

+6-9
Original file line numberDiff line numberDiff line change
@@ -283,29 +283,26 @@ func startClangd(compileCommandsDir, sketchCpp *paths.Path) (io.WriteCloser, io.
283283
if err != nil {
284284
panic("could not find compile_commands.json")
285285
}
286-
compiler := ""
286+
compilers := map[string]bool{}
287287
for _, cmd := range compileCommands.Contents {
288-
// Accepts only `arguments` fields for now
289-
if !sketchCpp.EquivalentTo(paths.New(cmd.File)) {
290-
continue
291-
}
292288
if len(cmd.Arguments) == 0 {
293289
panic("invalid empty argument field in compile_commands.json")
294290
}
295-
compiler = cmd.Arguments[0]
296-
break
291+
compilers[cmd.Arguments[0]] = true
297292
}
298-
if compiler == "" {
293+
if len(compilers) == 0 {
299294
panic("main compiler not found")
300295
}
301296

302297
// Start clangd
303298
args := []string{
304299
globalClangdPath,
305300
"-log=verbose",
306-
fmt.Sprintf("-query-driver=%s", compiler),
307301
fmt.Sprintf(`--compile-commands-dir=%s`, compileCommandsDir),
308302
}
303+
for compiler := range compilers {
304+
args = append(args, fmt.Sprintf("-query-driver=%s", compiler))
305+
}
309306
if enableLogging {
310307
log.Println(" Starting clangd:", strings.Join(args, " "))
311308
}

0 commit comments

Comments
 (0)