From bc0a2226c7fcd18b29b6846049e2cfcb872d3593 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Mon, 27 Jul 2009 21:00:51 +0000 Subject: [PATCH] Update for LLVM API change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77249 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Analysis/PathSensitive/Checker.h | 2 +- include/clang/Analysis/PathSensitive/CheckerVisitor.h | 2 +- lib/CodeGen/CGBuiltin.cpp | 2 +- lib/CodeGen/CGExprComplex.cpp | 4 +--- lib/CodeGen/CGExprConstant.cpp | 10 ++++++---- lib/CodeGen/CGExprScalar.cpp | 10 ++++++---- test/CXX/class/class.local/p4.cpp | 2 +- test/CXX/over/over.over/p2.cpp | 2 +- .../temp/temp.decls/temp.class/temp.mem.class/p1.cpp | 2 +- .../temp.decls/temp.class/temp.mem.func/p1-retmem.cpp | 2 +- .../temp.decls/temp.class/temp.mem.func/p1inst.cpp | 2 +- .../temp/temp.decls/temp.class/temp.static/p1-inst.cpp | 2 +- test/CXX/temp/temp.decls/temp.class/temp.static/p1.cpp | 2 +- test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp | 2 +- .../temp.deduct/temp.deduct.funcaddr/p1.cpp | 2 +- test/CodeGenCXX/function-template-specialization.cpp | 2 +- test/SemaTemplate/implicit-instantiation-1.cpp | 2 +- 17 files changed, 27 insertions(+), 25 deletions(-) diff --git a/include/clang/Analysis/PathSensitive/Checker.h b/include/clang/Analysis/PathSensitive/Checker.h index d432086e6e..611a135e6c 100644 --- a/include/clang/Analysis/PathSensitive/Checker.h +++ b/include/clang/Analysis/PathSensitive/Checker.h @@ -100,4 +100,4 @@ public: } // end clang namespace #endif - \ No newline at end of file + diff --git a/include/clang/Analysis/PathSensitive/CheckerVisitor.h b/include/clang/Analysis/PathSensitive/CheckerVisitor.h index 91db783a53..72fd5f3dab 100644 --- a/include/clang/Analysis/PathSensitive/CheckerVisitor.h +++ b/include/clang/Analysis/PathSensitive/CheckerVisitor.h @@ -51,4 +51,4 @@ void PreVisit ## NAME(CheckerContext &C, const NAME* S) {} } // end clang namespace #endif - \ No newline at end of file + diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp index ffd19e371d..86650a1e7e 100644 --- a/lib/CodeGen/CGBuiltin.cpp +++ b/lib/CodeGen/CGBuiltin.cpp @@ -66,7 +66,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD, return RValue::get(llvm::ConstantInt::get(VMContext, Result.Val.getInt())); else if (Result.Val.isFloat()) - return RValue::get(VMContext.getConstantFP(Result.Val.getFloat())); + return RValue::get(ConstantFP::get(VMContext, Result.Val.getFloat())); } switch (BuiltinID) { diff --git a/lib/CodeGen/CGExprComplex.cpp b/lib/CodeGen/CGExprComplex.cpp index 445efe8864..87b45d3af9 100644 --- a/lib/CodeGen/CGExprComplex.cpp +++ b/lib/CodeGen/CGExprComplex.cpp @@ -367,8 +367,6 @@ ComplexPairTy ComplexExprEmitter::EmitCast(Expr *Op, QualType DestTy) { ComplexPairTy ComplexExprEmitter::VisitPrePostIncDec(const UnaryOperator *E, bool isInc, bool isPre) { - llvm::LLVMContext &VMContext = CGF.getLLVMContext(); - LValue LV = CGF.EmitLValue(E->getSubExpr()); ComplexPairTy InVal = EmitLoadOfComplex(LV.getAddress(), LV.isVolatileQualified()); @@ -386,7 +384,7 @@ ComplexPairTy ComplexExprEmitter::VisitPrePostIncDec(const UnaryOperator *E, llvm::APFloat FVal(CGF.getContext().getFloatTypeSemantics(ElemTy), 1); if (!isInc) FVal.changeSign(); - NextVal = VMContext.getConstantFP(FVal); + NextVal = llvm::ConstantFP::get(CGF.getLLVMContext(), FVal); // Add the inc/dec to the real part. NextVal = Builder.CreateFAdd(InVal.first, NextVal, isInc ? "inc" : "dec"); diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp index a64fb09eca..36c3256a2f 100644 --- a/lib/CodeGen/CGExprConstant.cpp +++ b/lib/CodeGen/CGExprConstant.cpp @@ -879,12 +879,14 @@ llvm::Constant *CodeGenModule::EmitConstantExpr(const Expr *E, return VMContext.getConstantStruct(Complex, 2); } case APValue::Float: - return VMContext.getConstantFP(Result.Val.getFloat()); + return llvm::ConstantFP::get(VMContext, Result.Val.getFloat()); case APValue::ComplexFloat: { llvm::Constant *Complex[2]; - Complex[0] = VMContext.getConstantFP(Result.Val.getComplexFloatReal()); - Complex[1] = VMContext.getConstantFP(Result.Val.getComplexFloatImag()); + Complex[0] = llvm::ConstantFP::get(VMContext, + Result.Val.getComplexFloatReal()); + Complex[1] = llvm::ConstantFP::get(VMContext, + Result.Val.getComplexFloatImag()); return VMContext.getConstantStruct(Complex, 2); } @@ -897,7 +899,7 @@ llvm::Constant *CodeGenModule::EmitConstantExpr(const Expr *E, if (Elt.isInt()) Inits.push_back(llvm::ConstantInt::get(VMContext, Elt.getInt())); else - Inits.push_back(VMContext.getConstantFP(Elt.getFloat())); + Inits.push_back(llvm::ConstantFP::get(VMContext, Elt.getFloat())); } return VMContext.getConstantVector(&Inits[0], Inits.size()); } diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index b80b64ccce..141d39359a 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -112,7 +112,7 @@ public: return llvm::ConstantInt::get(VMContext, E->getValue()); } Value *VisitFloatingLiteral(const FloatingLiteral *E) { - return VMContext.getConstantFP(E->getValue()); + return llvm::ConstantFP::get(VMContext, E->getValue()); } Value *VisitCharacterLiteral(const CharacterLiteral *E) { return llvm::ConstantInt::get(ConvertType(E->getType()), E->getValue()); @@ -731,16 +731,18 @@ Value *ScalarExprEmitter::VisitPrePostIncDec(const UnaryOperator *E, // Add the inc/dec to the real part. if (InVal->getType() == llvm::Type::FloatTy) NextVal = - VMContext.getConstantFP(llvm::APFloat(static_cast(AmountVal))); + llvm::ConstantFP::get(VMContext, + llvm::APFloat(static_cast(AmountVal))); else if (InVal->getType() == llvm::Type::DoubleTy) NextVal = - VMContext.getConstantFP(llvm::APFloat(static_cast(AmountVal))); + llvm::ConstantFP::get(VMContext, + llvm::APFloat(static_cast(AmountVal))); else { llvm::APFloat F(static_cast(AmountVal)); bool ignored; F.convert(CGF.Target.getLongDoubleFormat(), llvm::APFloat::rmTowardZero, &ignored); - NextVal = VMContext.getConstantFP(F); + NextVal = llvm::ConstantFP::get(VMContext, F); } NextVal = Builder.CreateFAdd(InVal, NextVal, isInc ? "inc" : "dec"); } diff --git a/test/CXX/class/class.local/p4.cpp b/test/CXX/class/class.local/p4.cpp index 40702ad968..f2432ec973 100644 --- a/test/CXX/class/class.local/p4.cpp +++ b/test/CXX/class/class.local/p4.cpp @@ -7,4 +7,4 @@ void f() { static void f() { } }; -} \ No newline at end of file +} diff --git a/test/CXX/over/over.over/p2.cpp b/test/CXX/over/over.over/p2.cpp index adca33cc7c..9ab0260618 100644 --- a/test/CXX/over/over.over/p2.cpp +++ b/test/CXX/over/over.over/p2.cpp @@ -7,4 +7,4 @@ void test_f0() { int (*f0b)(int, int) = &f0; int (*f0c)(int, float) = f0; // expected-error{{incompatible type}} // FIXME: poor error message above! -} \ No newline at end of file +} diff --git a/test/CXX/temp/temp.decls/temp.class/temp.mem.class/p1.cpp b/test/CXX/temp/temp.decls/temp.class/temp.mem.class/p1.cpp index 9bafacc00a..bc4bb5da40 100644 --- a/test/CXX/temp/temp.decls/temp.class/temp.mem.class/p1.cpp +++ b/test/CXX/temp/temp.decls/temp.class/temp.mem.class/p1.cpp @@ -24,4 +24,4 @@ void test(int i, float f) { inner2.x = &i; inner2.y = &f; inner2.f(); // expected-note{{instantiation}} -} \ No newline at end of file +} diff --git a/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1-retmem.cpp b/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1-retmem.cpp index 8b70ded8ca..0b9ea35d11 100644 --- a/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1-retmem.cpp +++ b/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1-retmem.cpp @@ -9,4 +9,4 @@ struct X0 { }; template -typename X0::size_type X0::f0() const { } \ No newline at end of file +typename X0::size_type X0::f0() const { } diff --git a/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1inst.cpp b/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1inst.cpp index c505823a32..a09d0efa29 100644 --- a/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1inst.cpp +++ b/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1inst.cpp @@ -14,4 +14,4 @@ void X0::f(T *t, const U &u) { void test_f(X0 xfi, X0 xvi, float *fp, void *vp, int i) { xfi.f(fp, i); xvi.f(vp, i); // expected-note{{instantiation}} -} \ No newline at end of file +} diff --git a/test/CXX/temp/temp.decls/temp.class/temp.static/p1-inst.cpp b/test/CXX/temp/temp.decls/temp.class/temp.static/p1-inst.cpp index b13ca93764..2ddb8eac6c 100644 --- a/test/CXX/temp/temp.decls/temp.class/temp.static/p1-inst.cpp +++ b/test/CXX/temp/temp.decls/temp.class/temp.static/p1-inst.cpp @@ -25,4 +25,4 @@ unsigned long sizeOkay() { return sizeof(X::value); } CannotInit &returnError() { return X::value; // expected-note{{instantiation}} -} \ No newline at end of file +} diff --git a/test/CXX/temp/temp.decls/temp.class/temp.static/p1.cpp b/test/CXX/temp/temp.decls/temp.class/temp.static/p1.cpp index 37cae38cac..949a8b0a72 100644 --- a/test/CXX/temp/temp.decls/temp.class/temp.static/p1.cpp +++ b/test/CXX/temp/temp.decls/temp.class/temp.static/p1.cpp @@ -23,4 +23,4 @@ X2& get_X2() { return X0::value; // expected-note{{instantiation}} } -template T x; // expected-error{{variable 'x' declared as a template}} \ No newline at end of file +template T x; // expected-error{{variable 'x' declared as a template}} diff --git a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp index f4970b89f6..01030b2a8a 100644 --- a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp @@ -8,4 +8,4 @@ void g() { f("aa",3.0); // Y is deduced to be char*, and // Z is deduced to be double f("aa",3.0); // expected-error{{no matching}} -} \ No newline at end of file +} diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.funcaddr/p1.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.funcaddr/p1.cpp index 0a496392a8..86a34500ad 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.funcaddr/p1.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.funcaddr/p1.cpp @@ -19,4 +19,4 @@ void test_f1() { float (*f1d)(float) = (f1); float (*f1e)(float) = &f1; float (*f1f)(float) = (&f1); -} \ No newline at end of file +} diff --git a/test/CodeGenCXX/function-template-specialization.cpp b/test/CodeGenCXX/function-template-specialization.cpp index bea3af2bb5..1d3c5f65ec 100644 --- a/test/CodeGenCXX/function-template-specialization.cpp +++ b/test/CodeGenCXX/function-template-specialization.cpp @@ -24,4 +24,4 @@ void test2(int *iptr, double *dptr, int diff) { // FIXME: should be "_Z4nextIdiEPT_S1_RKT0_" // RUN: grep "_Z4nextIdiEPdPdRKi" %t dptr = next(dptr, diff); -} \ No newline at end of file +} diff --git a/test/SemaTemplate/implicit-instantiation-1.cpp b/test/SemaTemplate/implicit-instantiation-1.cpp index b8f9622001..d04bbd8484 100644 --- a/test/SemaTemplate/implicit-instantiation-1.cpp +++ b/test/SemaTemplate/implicit-instantiation-1.cpp @@ -22,4 +22,4 @@ void test_add(char *cp, int i, int *ip) { char* cp2 = add(cp, i); add(cp, cp); // expected-note{{instantiation of}} (void)sizeof(add(ip, ip)); -} \ No newline at end of file +} -- 2.40.0