[PATCH] D123744: [Driver] Change CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL to affect driver default instead of cc1 default

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 13 16:34:58 PDT 2022


MaskRay created this revision.
MaskRay added reviewers: opaque-pointers, rsmith, aeubanks, nikic.
Herald added a subscriber: StephenFan.
Herald added a reviewer: ctetreau.
Herald added a reviewer: ctetreau.
Herald added a project: All.
MaskRay requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

cc1 option default dependent on CMake options should be used prudently
(generally avoided), as they may leave large differences in code
generation tests. We generally limit the target difference to Driver.

The current CLANG_ENABLE_OPAQUE_POINTERS=on default may attract people to
contribute %clang_cc1 tests that assume ON behavior, which will cause failures
on systems set to OFF.

Change the CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL mechanism introduced in D123122 <https://reviews.llvm.org/D123122>
to be a driver default. This is similar to the mechanism used for the
-flegacy-pass-manager transition to new PM transition.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123744

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/Clang.cpp


Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -29,6 +29,7 @@
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/ObjCRuntime.h"
 #include "clang/Basic/Version.h"
+#include "clang/Config/config.h"
 #include "clang/Driver/Action.h"
 #include "clang/Driver/Distro.h"
 #include "clang/Driver/DriverDiagnostic.h"
@@ -6506,6 +6507,9 @@
                    false))
     CmdArgs.push_back("-fmodules-debuginfo");
 
+  if (!CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL)
+    CmdArgs.push_back("-no-opaque-pointers");
+
   ObjCRuntime Runtime = AddObjCRuntimeArgs(Args, Inputs, CmdArgs, rewriteKind);
   RenderObjCOptions(TC, D, RawTriple, Args, Runtime, rewriteKind != RK_None,
                     Input, CmdArgs);
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -5533,7 +5533,7 @@
 defm opaque_pointers : BoolOption<"",
   "opaque-pointers",
   CodeGenOpts<"OpaquePointers">,
-  Default<"CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL">,
+  DefaultTrue,
   PosFlag<SetTrue, [], "Enable">,
   NegFlag<SetFalse, [], "Disable">,
   BothFlags<[], " opaque pointers">>;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123744.422691.patch
Type: text/x-patch
Size: 1357 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220413/5c7fe166/attachment-0001.bin>


More information about the cfe-commits mailing list