<div dir="ltr">Seems like it might be problematic to have this separate implementation of checking whether frame pointers are enabled compared to the canonical one (the one actually used to enable/disable frame pointers) in the static "shouldUseFramePointer" Function?<br><br>(eg: apparently on some targets (mustUseNonLeafFramePointerForTarget) frame pointers are enabled regardless of the arguments - looks like in that case this would still produce an error if you combined -fomit-frame-pointer with -pg on such a platform, even though frame pointers would still be emitted?)<br></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Sep 13, 2018 at 12:51 PM Stephen Hines via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: srhines<br>
Date: Thu Sep 13 12:50:02 2018<br>
New Revision: 342165<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=342165&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=342165&view=rev</a><br>
Log:<br>
Support -fno-omit-frame-pointer with -pg.<br>
<br>
Summary:<br>
Previously, any instance of -fomit-frame-pointer would make it such that<br>
-pg was an invalid flag combination. If -fno-omit-frame-pointer is<br>
passed later on the command line (such that it actually takes effect),<br>
-pg should be allowed.<br>
<br>
Reviewers: nickdesaulniers<br>
<br>
Reviewed By: nickdesaulniers<br>
<br>
Subscribers: manojgupta, nickdesaulniers, cfe-commits, kongyi, chh, pirama<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D51713" rel="noreferrer" target="_blank">https://reviews.llvm.org/D51713</a><br>
<br>
Modified:<br>
    cfe/trunk/lib/Driver/ToolChains/Clang.cpp<br>
    cfe/trunk/test/Driver/clang_f_opts.c<br>
<br>
Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=342165&r1=342164&r2=342165&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=342165&r1=342164&r2=342165&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)<br>
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Thu Sep 13 12:50:02 2018<br>
@@ -4910,7 +4910,8 @@ void Clang::ConstructJob(Compilation &C,<br>
   }<br>
<br>
   if (Arg *A = Args.getLastArg(options::OPT_pg))<br>
-    if (Args.hasArg(options::OPT_fomit_frame_pointer))<br>
+    if (Args.hasFlag(options::OPT_fomit_frame_pointer,<br>
+                     options::OPT_fno_omit_frame_pointer, /*default=*/false))<br>
       D.Diag(diag::err_drv_argument_not_allowed_with) << "-fomit-frame-pointer"<br>
                                                       << A->getAsString(Args);<br>
<br>
<br>
Modified: cfe/trunk/test/Driver/clang_f_opts.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang_f_opts.c?rev=342165&r1=342164&r2=342165&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang_f_opts.c?rev=342165&r1=342164&r2=342165&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/Driver/clang_f_opts.c (original)<br>
+++ cfe/trunk/test/Driver/clang_f_opts.c Thu Sep 13 12:50:02 2018<br>
@@ -531,3 +531,8 @@<br>
 // RUN: %clang -### -S -fno-delete-null-pointer-checks -fdelete-null-pointer-checks %s 2>&1 | FileCheck -check-prefix=CHECK-NULL-POINTER-CHECKS %s<br>
 // CHECK-NO-NULL-POINTER-CHECKS: "-fno-delete-null-pointer-checks"<br>
 // CHECK-NULL-POINTER-CHECKS-NOT: "-fno-delete-null-pointer-checks"<br>
+<br>
+// RUN: %clang -### -S -fomit-frame-pointer -pg %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-OMIT-FP-PG %s<br>
+// RUN: %clang -### -S -fomit-frame-pointer -fno-omit-frame-pointer -pg %s 2>&1 | FileCheck -check-prefix=CHECK-MIX-NO-OMIT-FP-PG %s<br>
+// CHECK-NO-MIX-OMIT-FP-PG: '-fomit-frame-pointer' not allowed with '-pg'<br>
+// CHECK-MIX-NO-OMIT-FP-PG-NOT: '-fomit-frame-pointer' not allowed with '-pg'<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div>