================ @@ -40,17 +40,28 @@ enum class OpenVariant { OpenAt }; +static CachedMacroValue getCreateFlagValue(const ASTContext &Ctx, + const Preprocessor &PP) { + CachedMacroValue MacroVal("O_CREAT", PP); + if (MacroVal.hasValue()) + return MacroVal; + + // If we failed, fall-back to known values. + if (Ctx.getTargetInfo().getTriple().getVendor() == llvm::Triple::Apple) + return CachedMacroValue{0x0200}; + return MacroVal; +} + ---------------- balazske wrote:
`tryExpandAsInteger` could have a version which returns a non-optional value and takes a default value or a lambda for the default value. It could be used instead of this function. https://github.com/llvm/llvm-project/pull/127409 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits