diff --git a/clang/lib/Driver/ToolChains/WebAssembly.h b/clang/lib/Driver/ToolChains/WebAssembly.h --- a/clang/lib/Driver/ToolChains/WebAssembly.h +++ b/clang/lib/Driver/ToolChains/WebAssembly.h @@ -51,6 +51,7 @@ bool hasBlocksRuntime() const override; bool SupportsProfiling() const override; bool HasNativeLLVMSupport() const override; + unsigned GetDefaultDwarfVersion() const override { return 4; } void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, diff --git a/clang/test/Driver/debug-options.c b/clang/test/Driver/debug-options.c --- a/clang/test/Driver/debug-options.c +++ b/clang/test/Driver/debug-options.c @@ -132,6 +132,15 @@ // RUN: %clang -### -c -g %s -target powerpc64-ibm-aix-xcoff -gcolumn-info \ // RUN: 2>&1 | FileCheck -check-prefix=CI %s +// WebAssembly. +// WebAssembly should default to DWARF4. +// RUN: %clang -### -c -g %s -target wasm32 -gdwarf-4 2>&1 \ +// RUN: | FileCheck -check-prefix=G_DWARF4 %s +// RUN: %clang -### -c -g %s -target wasm64 -gdwarf-4 2>&1 \ +// RUN: | FileCheck -check-prefix=G_DWARF4 %s + + + // RUN: %clang -### -c -gdwarf-2 %s 2>&1 \ // RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s //