From d60f2fbf69df08e952377b498c036f269395024d Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 17 Feb 2009 18:43:32 +0000 Subject: Change EmitConstantExpr to allow failure. IRgen no longer relies on isConstantInitializer, instead we just try to emit the constant. If that fails then in C we emit an error unsupported (this occurs when Sema accepted something that it doesn't know how to fold, and IRgen doesn't know how to emit) and in C++ we emit a guarded initializer. This ends up handling a few more cases, because IRgen was actually able to emit some of the constants Sema accepts but can't Evaluate(). For example, PR3398. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64780 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenModule.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/CodeGen/CodeGenModule.h') diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h index ff1437c20d..b54ee13df6 100644 --- a/lib/CodeGen/CodeGenModule.h +++ b/lib/CodeGen/CodeGenModule.h @@ -247,7 +247,12 @@ public: const std::string &Name); void UpdateCompletedType(const TagDecl *D); + + /// EmitConstantExpr - Try to emit the given expression as a + /// constant; returns 0 if the expression cannot be emitted as a + /// constant. llvm::Constant *EmitConstantExpr(const Expr *E, CodeGenFunction *CGF = 0); + llvm::Constant *EmitAnnotateAttr(llvm::GlobalValue *GV, const AnnotateAttr *AA, unsigned LineNo); -- cgit v1.2.3