diff options
author | John McCall <rjmccall@apple.com> | 2011-03-18 02:56:14 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-03-18 02:56:14 +0000 |
commit | 7ef5cb3038fcbd4caa102d1ce9d70ae598985a7c (patch) | |
tree | cf12fb2284f5fc7e93e2cf14b6d186631d0cdad2 /clang/lib/CodeGen/CGDeclCXX.cpp | |
parent | 7c9cc461651e1acb8c1c9c19141d8477c86c6976 (diff) | |
download | bcm5719-llvm-7ef5cb3038fcbd4caa102d1ce9d70ae598985a7c.tar.gz bcm5719-llvm-7ef5cb3038fcbd4caa102d1ce9d70ae598985a7c.zip |
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.
llvm-svn: 127854
Diffstat (limited to 'clang/lib/CodeGen/CGDeclCXX.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDeclCXX.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp index 6635af88939..ed25b6db38e 100644 --- a/clang/lib/CodeGen/CGDeclCXX.cpp +++ b/clang/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); } |