azat updated this revision to Diff 457182. azat added a comment. Add test
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D133092/new/ https://reviews.llvm.org/D133092 Files: clang/lib/Driver/ToolChains/CommonArgs.cpp clang/test/Driver/debug-options.c Index: clang/test/Driver/debug-options.c =================================================================== --- clang/test/Driver/debug-options.c +++ clang/test/Driver/debug-options.c @@ -247,6 +247,10 @@ // RUN: %clang -### -c -glldb -gno-pubnames %s 2>&1 | FileCheck -check-prefix=NOPUB %s // // RUN: %clang -### -c -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=GARANGE %s +// RUN: %clang -### -flto -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LDGARANGE %s +// RUN: %clang -### -flto=thin -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LDGARANGE %s +// RUN: %clang -### -fuse-ld=lld -flto -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s +// RUN: %clang -### -fuse-ld=lld -flto=thin -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s // // RUN: %clang -### -fdebug-types-section -target x86_64-unknown-linux %s 2>&1 \ // RUN: | FileCheck -check-prefix=FDTS %s @@ -371,6 +375,8 @@ // NORNGBSE-NOT: -fdebug-ranges-base-address // // GARANGE-DAG: -generate-arange-section +// LDGARANGE-NOT: {{".*ld" .* "-generate-arange-section"}} +// LLDGARANGE-DAG: {{".*lld" .* "-generate-arange-section"}} // // FDTS: "-mllvm" "-generate-type-units" // FDTSE: error: unsupported option '-fdebug-types-section' for target 'x86_64-apple-darwin' Index: clang/lib/Driver/ToolChains/CommonArgs.cpp =================================================================== --- clang/lib/Driver/ToolChains/CommonArgs.cpp +++ clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -506,6 +506,9 @@ Suffix, Plugin); CmdArgs.push_back(Args.MakeArgString(Plugin)); + } else if (Args.hasArg(options::OPT_gdwarf_aranges)) { + CmdArgs.push_back(Args.MakeArgString("-mllvm")); + CmdArgs.push_back(Args.MakeArgString("-generate-arange-section")); } // Try to pass driver level flags relevant to LTO code generation down to
Index: clang/test/Driver/debug-options.c =================================================================== --- clang/test/Driver/debug-options.c +++ clang/test/Driver/debug-options.c @@ -247,6 +247,10 @@ // RUN: %clang -### -c -glldb -gno-pubnames %s 2>&1 | FileCheck -check-prefix=NOPUB %s // // RUN: %clang -### -c -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=GARANGE %s +// RUN: %clang -### -flto -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LDGARANGE %s +// RUN: %clang -### -flto=thin -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LDGARANGE %s +// RUN: %clang -### -fuse-ld=lld -flto -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s +// RUN: %clang -### -fuse-ld=lld -flto=thin -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s // // RUN: %clang -### -fdebug-types-section -target x86_64-unknown-linux %s 2>&1 \ // RUN: | FileCheck -check-prefix=FDTS %s @@ -371,6 +375,8 @@ // NORNGBSE-NOT: -fdebug-ranges-base-address // // GARANGE-DAG: -generate-arange-section +// LDGARANGE-NOT: {{".*ld" .* "-generate-arange-section"}} +// LLDGARANGE-DAG: {{".*lld" .* "-generate-arange-section"}} // // FDTS: "-mllvm" "-generate-type-units" // FDTSE: error: unsupported option '-fdebug-types-section' for target 'x86_64-apple-darwin' Index: clang/lib/Driver/ToolChains/CommonArgs.cpp =================================================================== --- clang/lib/Driver/ToolChains/CommonArgs.cpp +++ clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -506,6 +506,9 @@ Suffix, Plugin); CmdArgs.push_back(Args.MakeArgString(Plugin)); + } else if (Args.hasArg(options::OPT_gdwarf_aranges)) { + CmdArgs.push_back(Args.MakeArgString("-mllvm")); + CmdArgs.push_back(Args.MakeArgString("-generate-arange-section")); } // Try to pass driver level flags relevant to LTO code generation down to
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits