[clang] 702d5de - [Clang] Enable opaque pointers by default

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 11 02:16:32 PDT 2022


Author: Nikita Popov
Date: 2022-04-11T11:13:45+02:00
New Revision: 702d5de4380b1e1554e5b90863093c3a57f76f70

URL: https://github.com/llvm/llvm-project/commit/702d5de4380b1e1554e5b90863093c3a57f76f70
DIFF: https://github.com/llvm/llvm-project/commit/702d5de4380b1e1554e5b90863093c3a57f76f70.diff

LOG: [Clang] Enable opaque pointers by default

Enable opaque pointers by default in clang, which can be disabled
either via cc1 option -no-opaque-pointers or cmake flag
-DCLANG_ENABLE_OPAQUE_POINTERS=OFF.

See https://llvm.org/docs/OpaquePointers.html for context.

Differential Revision: https://reviews.llvm.org/D123300

Added: 
    

Modified: 
    clang/CMakeLists.txt
    llvm/docs/OpaquePointers.rst

Removed: 
    


################################################################################
diff  --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 3a77e7b0c8d60..594e6d0887429 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -251,7 +251,7 @@ option(CLANG_DEFAULT_PIE_ON_LINUX "Default to -fPIE and -pie on linux-gnu" ON)
 set(CLANG_ENABLE_OPAQUE_POINTERS "DEFAULT" CACHE STRING
     "Enable opaque pointers by default")
 if(CLANG_ENABLE_OPAQUE_POINTERS STREQUAL "DEFAULT")
-  set(CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL OFF)
+  set(CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL ON)
 elseif(CLANG_ENABLE_OPAQUE_POINTERS)
   set(CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL ON)
 else()

diff  --git a/llvm/docs/OpaquePointers.rst b/llvm/docs/OpaquePointers.rst
index 6e684369b6b35..12689d8cd6ccc 100644
--- a/llvm/docs/OpaquePointers.rst
+++ b/llvm/docs/OpaquePointers.rst
@@ -195,8 +195,10 @@ Transition State
 ================
 
 As of April 2022 both LLVM and Clang have complete support for opaque pointers,
-but typed pointers are still the default. Opaque pointers will be enabled by
-default in Clang soon.
+and opaque pointers are enabled by default in Clang. It is possible to
+temporarily restore the old default using the
+``-DCLANG_ENABLE_OPAQUE_POINTERS=OFF`` cmake option. Opaque pointers can be
+disabled for a single Clang invocation using ``-Xclang -no-opaque-pointers``.
 
 The MLIR and Polly monorepo projects are not fully compatible with opaque
 pointers yet.


        


More information about the cfe-commits mailing list