Index: clang/CMakeLists.txt =================================================================== --- clang/CMakeLists.txt +++ clang/CMakeLists.txt @@ -247,6 +247,17 @@ option(CLANG_DEFAULT_PIE_ON_LINUX "Default to -fPIE and -pie on Linux" OFF) +# Manually handle default so we can change the meaning of a cached default. +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) +elseif(CLANG_ENABLE_OPAQUE_POINTERS) + set(CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL ON) +else() + set(CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL OFF) +endif() + # TODO: verify the values against LangStandards.def? set(CLANG_DEFAULT_STD_C "" CACHE STRING "Default standard to use for C/ObjC code (IDENT from LangStandards.def, empty for platform default)") Index: clang/include/clang/Config/config.h.cmake =================================================================== --- clang/include/clang/Config/config.h.cmake +++ clang/include/clang/Config/config.h.cmake @@ -89,4 +89,7 @@ /* Spawn a new process clang.exe for the CC1 tool invocation, when necessary */ #cmakedefine01 CLANG_SPAWN_CC1 +/* Whether to enable opaque pointers by default */ +#cmakedefine01 CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL + #endif Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -5507,7 +5507,7 @@ defm opaque_pointers : BoolOption<"", "opaque-pointers", CodeGenOpts<"OpaquePointers">, - DefaultFalse, + Default<"CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL">, PosFlag, NegFlag, BothFlags<[], " opaque pointers">>;