From 32096695c76033a6b0b1747c439f7378a11e8312 Mon Sep 17 00:00:00 2001 From: John McCall Date: Fri, 18 Mar 2011 02:56:14 +0000 Subject: The Darwin kernel does not provide useful guard variable support. Issue this as an IR-gen error; it's not really worthwhile doing this "right", i.e. in Sema, because IR gen knows a lot of tricks beyond what the constant evaluator knows. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127854 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGDeclCXX.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/CodeGen/CGDeclCXX.cpp') diff --git a/lib/CodeGen/CGDeclCXX.cpp b/lib/CodeGen/CGDeclCXX.cpp index 6635af8893..ed25b6db38 100644 --- a/lib/CodeGen/CGDeclCXX.cpp +++ b/lib/CodeGen/CGDeclCXX.cpp @@ -149,6 +149,14 @@ CodeGenFunction::EmitCXXGlobalDtorRegistration(llvm::Constant *DtorFn, void CodeGenFunction::EmitCXXGuardedInit(const VarDecl &D, llvm::GlobalVariable *DeclPtr) { + // If we've been asked to forbid guard variables, emit an error now. + // This diagnostic is hard-coded for Darwin's use case; we can find + // better phrasing if someone else needs it. + if (CGM.getCodeGenOpts().ForbidGuardVariables) + CGM.Error(D.getLocation(), + "this initialization requires a guard variable, which " + "the kernel does not support"); + CGM.getCXXABI().EmitGuardedInit(*this, D, DeclPtr); } -- cgit v1.2.1