#51 Apply D74878 patch.
Closed 4 years ago by sergesanspaille. Opened 4 years ago by sergesanspaille.
rpms/ sergesanspaille/clang master  into  master

file added
+70
@@ -0,0 +1,70 @@ 

+ Index: clang/include/clang/Basic/DiagnosticDriverKinds.td

+ ===================================================================

+ --- a/clang/include/clang/Basic/DiagnosticDriverKinds.td

+ +++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td

+ @@ -271,6 +271,9 @@

+    InGroup<UnsupportedTargetOpt>;

+  def warn_c_kext : Warning<

+    "ignoring -fapple-kext which is valid for C++ and Objective-C++ only">;

+ +def warn_ignoring_fdiscard_for_bitcode : Warning<

+ +  "ignoring -fdiscard-value-names for LLVM Bitcode">,

+ +  InGroup<UnusedCommandLineArgument>;

+  def warn_drv_input_file_unused : Warning<

+    "%0: '%1' input unused%select{ when '%3' is present|}2">,

+    InGroup<UnusedCommandLineArgument>;

+ Index: clang/lib/CodeGen/CodeGenAction.cpp

+ ===================================================================

+ --- a/clang/lib/CodeGen/CodeGenAction.cpp

+ +++ b/clang/lib/CodeGen/CodeGenAction.cpp

+ @@ -1146,6 +1146,9 @@

+                             CI.getTargetOpts(), CI.getLangOpts(),

+                             CI.getFrontendOpts().ShowTimers,

+                             std::move(LinkModules), *VMContext, nullptr);

+ +    // PR44896: Force DiscardValueNames as false. DiscardValueNames cannot be

+ +    // true here because the valued names are needed for reading textual IR.

+ +    Ctx.setDiscardValueNames(false);

+      Ctx.setDiagnosticHandler(

+          std::make_unique<ClangDiagnosticHandler>(CodeGenOpts, &Result));

+  

+ Index: clang/lib/Driver/ToolChains/Clang.cpp

+ ===================================================================

+ --- a/clang/lib/Driver/ToolChains/Clang.cpp

+ +++ b/clang/lib/Driver/ToolChains/Clang.cpp

+ @@ -4332,8 +4332,16 @@

+  

+    // Discard value names in assert builds unless otherwise specified.

+    if (Args.hasFlag(options::OPT_fdiscard_value_names,

+ -                   options::OPT_fno_discard_value_names, !IsAssertBuild))

+ +                   options::OPT_fno_discard_value_names, !IsAssertBuild)) {

+ +    if (Args.hasArg(options::OPT_fdiscard_value_names) &&

+ +        (std::any_of(Inputs.begin(), Inputs.end(),

+ +                     [](const clang::driver::InputInfo &II) {

+ +                       return types::isLLVMIR(II.getType());

+ +                     }))) {

+ +      D.Diag(diag::warn_ignoring_fdiscard_for_bitcode);

+ +    }

+      CmdArgs.push_back("-discard-value-names");

+ +  }

+  

+    // Set the main file name, so that debug info works even with

+    // -save-temps.

+ Index: clang/test/CodeGen/PR44896.ll

+ ===================================================================

+ --- /dev/null

+ +++ b/clang/test/CodeGen/PR44896.ll

+ @@ -0,0 +1,15 @@

+ +; RUN: %clang -fdiscard-value-names -S %s -o /dev/null 2>&1 | FileCheck --check-prefix=WARNING %s

+ +; RUN: %clang -S %s -o /dev/null 2>&1 | FileCheck --check-prefix=NOWARNING %s

+ +; RUN: %clang_cc1 -S -emit-llvm %s -discard-value-names -o /dev/null

+ +; PR 44896

+ +

+ +; WARNING: ignoring -fdiscard-value-names for LLVM Bitcode

+ +; NOWARNING-NOT: ignoring -fdiscard-value-names for LLVM Bitcode

+ +

+ +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"

+ +target triple = "x86_64--linux-gnu"

+ +

+ +define linkonce i8* @b(i8* %a) {

+ +  ret i8* %a

+ +}

+ +

file modified
+6 -1
@@ -4,7 +4,7 @@ 

  %global min_ver 0

  %global patch_ver 0

  %global rc_ver 2

- %global baserelease 0.3

+ %global baserelease 0.4

  

  %global clang_tools_binaries \

  	%{_bindir}/clang-apply-replacements \
@@ -88,6 +88,7 @@ 

  Patch4:		0002-gtest-reorg.patch

  Patch11:	0001-ToolChain-Add-lgcc_s-to-the-linker-flags-when-using-.patch

  Patch13:	0001-Make-funwind-tables-the-default-for-all-archs.patch

+ Patch14:	D74878.patch

  

  # Not Upstream

  Patch15:	0001-clang-Don-t-install-static-libraries.patch
@@ -237,6 +238,7 @@ 

  %patch4 -p1 -b .gtest

  %patch11 -p1 -b .libcxx-fix

  %patch13 -p2 -b .unwind-all

+ %patch14 -p2 -b .discard-names

  %patch15 -p2 -b .no-install-static

  

  mv ../%{clang_tools_srcdir} tools/extra
@@ -456,6 +458,9 @@ 

  

  %endif

  %changelog

+ * Tue Feb 25 2020 sguelton@redhat.com - 10.0.0-0.4.rc2

+ - Apply D74878 patch.

+ 

  * Mon Feb 17 2020 sguelton@redhat.com - 10.0.0-0.3.rc2

  - Fix NVR

  

This patch has been applied upstream and should fix the issue with llvm-test-suite.

Pull-Request has been closed by sergesanspaille

4 years ago