Skip to content

Commit 702d5de

Browse files
committed
[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
1 parent 69f7f15 commit 702d5de

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

clang/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ option(CLANG_DEFAULT_PIE_ON_LINUX "Default to -fPIE and -pie on linux-gnu" ON)
251251
set(CLANG_ENABLE_OPAQUE_POINTERS "DEFAULT" CACHE STRING
252252
"Enable opaque pointers by default")
253253
if(CLANG_ENABLE_OPAQUE_POINTERS STREQUAL "DEFAULT")
254-
set(CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL OFF)
254+
set(CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL ON)
255255
elseif(CLANG_ENABLE_OPAQUE_POINTERS)
256256
set(CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL ON)
257257
else()

llvm/docs/OpaquePointers.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,10 @@ Transition State
195195
================
196196

197197
As of April 2022 both LLVM and Clang have complete support for opaque pointers,
198-
but typed pointers are still the default. Opaque pointers will be enabled by
199-
default in Clang soon.
198+
and opaque pointers are enabled by default in Clang. It is possible to
199+
temporarily restore the old default using the
200+
``-DCLANG_ENABLE_OPAQUE_POINTERS=OFF`` cmake option. Opaque pointers can be
201+
disabled for a single Clang invocation using ``-Xclang -no-opaque-pointers``.
200202

201203
The MLIR and Polly monorepo projects are not fully compatible with opaque
202204
pointers yet.

0 commit comments

Comments
 (0)