diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index ceb592d1548f5..fea4ee909ff46 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -4631,11 +4631,8 @@ renderDebugOptions(const ToolChain &TC, const Driver &D, const llvm::Triple &T, } if (Args.hasFlag(options::OPT_gkey_instructions, - options::OPT_gno_key_instructions, false)) { + options::OPT_gno_key_instructions, false)) CmdArgs.push_back("-gkey-instructions"); - CmdArgs.push_back("-mllvm"); - CmdArgs.push_back("-dwarf-use-key-instructions"); - } if (EmitCodeView) { CmdArgs.push_back("-gcodeview"); diff --git a/clang/test/DebugInfo/KeyInstructions/flag.cpp b/clang/test/DebugInfo/KeyInstructions/flag.cpp index 93503dd4bdb4c..813f7e908011c 100644 --- a/clang/test/DebugInfo/KeyInstructions/flag.cpp +++ b/clang/test/DebugInfo/KeyInstructions/flag.cpp @@ -3,13 +3,19 @@ //// Default: Off. // RUN: %clang -### -target x86_64 -c -gdwarf %s 2>&1 | FileCheck %s --check-prefixes=NO-KEY-INSTRUCTIONS -//// Help hidden. -// RUN %clang --help | FileCheck %s --check-prefix=HELP -// HELP-NOT: key-instructions - // KEY-INSTRUCTIONS: "-gkey-instructions" -// KEY-INSTRUCTIONS: "-mllvm" "-dwarf-use-key-instructions" - // NO-KEY-INSTRUCTIONS-NOT: key-instructions -//// TODO: Add smoke test once some functionality has been added. +//// Help hidden: flag should not be visible. +// RUN: %clang --help | FileCheck %s --check-prefix=HELP +// HELP-NOT: key-instructions + +// Smoke test: check for Key Instructions keywords in the IR. +void f() {} +// RUN: %clang_cc1 %s -triple x86_64-linux-gnu -debug-info-kind=line-tables-only -emit-llvm -o - | FileCheck %s --check-prefix=SMOKETEST-OFF +// SMOKETEST-OFF-NOT: keyInstructions: +// SMOKETEST-OFF-NOT: atomGroup + +// RUN: %clang_cc1 %s -triple x86_64-linux-gnu -gkey-instructions -debug-info-kind=line-tables-only -emit-llvm -o - | FileCheck %s --check-prefix=SMOKETEST-ON +// SMOKETEST-ON: keyInstructions: true +// SMOKETEST-ON: atomGroup: 1