summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-09-11 00:07:24 +0000
committerAnders Carlsson <andersca@mac.com>2009-09-11 00:07:24 +0000
commit73fcc95f0fdebdae62dbef9174b8a775c01affe9 (patch)
treefc7eda0efedc7c2861adacafc154624e7e1f8711 /clang/lib/CodeGen/CodeGenFunction.cpp
parent11ff570292bc776efc2ee29e49c0620934275f34 (diff)
downloadbcm5719-llvm-73fcc95f0fdebdae62dbef9174b8a775c01affe9.tar.gz
bcm5719-llvm-73fcc95f0fdebdae62dbef9174b8a775c01affe9.zip
Pass GlobalDecls to GenerateCode and StartFunction.
llvm-svn: 81485
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 05f94371cb2..d42d0723fa8 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -141,10 +141,12 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) {
Ptr->eraseFromParent();
}
-void CodeGenFunction::StartFunction(const Decl *D, QualType RetTy,
+void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
llvm::Function *Fn,
const FunctionArgList &Args,
SourceLocation StartLoc) {
+ const Decl *D = GD.getDecl();
+
DidCallStackSave = false;
CurCodeDecl = CurFuncDecl = D;
FnRetTy = RetTy;
@@ -199,8 +201,10 @@ void CodeGenFunction::StartFunction(const Decl *D, QualType RetTy,
}
}
-void CodeGenFunction::GenerateCode(const FunctionDecl *FD,
+void CodeGenFunction::GenerateCode(GlobalDecl GD,
llvm::Function *Fn) {
+ const FunctionDecl *FD = cast<FunctionDecl>(GD.getDecl());
+
// Check if we should generate debug info for this function.
if (CGM.getDebugInfo() && !FD->hasAttr<NoDebugAttr>())
DebugInfo = CGM.getDebugInfo();
@@ -230,7 +234,7 @@ void CodeGenFunction::GenerateCode(const FunctionDecl *FD,
// FIXME: Support CXXTryStmt here, too.
if (const CompoundStmt *S = FD->getCompoundBody()) {
- StartFunction(FD, FD->getResultType(), Fn, Args, S->getLBracLoc());
+ StartFunction(GD, FD->getResultType(), Fn, Args, S->getLBracLoc());
if (const CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(FD))
EmitCtorPrologue(CD);
EmitStmt(S);
@@ -246,19 +250,20 @@ void CodeGenFunction::GenerateCode(const FunctionDecl *FD,
if (CD->isCopyConstructor(getContext())) {
assert(!ClassDecl->hasUserDeclaredCopyConstructor() &&
"bogus constructor is being synthesize");
- SynthesizeCXXCopyConstructor(CD, FD, Fn, Args);
+ SynthesizeCXXCopyConstructor(GD, FD, Fn, Args);
}
else {
assert(!ClassDecl->hasUserDeclaredConstructor() &&
"bogus constructor is being synthesize");
- SynthesizeDefaultConstructor(CD, FD, Fn, Args);
+ SynthesizeDefaultConstructor(GD, FD, Fn, Args);
}
}
- else if (const CXXDestructorDecl *DD = dyn_cast<CXXDestructorDecl>(FD))
- SynthesizeDefaultDestructor(DD, FD, Fn, Args);
- else if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD))
- if (MD->isCopyAssignment())
- SynthesizeCXXCopyAssignment(MD, FD, Fn, Args);
+ else if (isa<CXXDestructorDecl>(FD))
+ SynthesizeDefaultDestructor(GD, FD, Fn, Args);
+ else if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) {
+ if (MD->isCopyAssignment())
+ SynthesizeCXXCopyAssignment(MD, FD, Fn, Args);
+ }
// Destroy the 'this' declaration.
if (CXXThisDecl)
OpenPOWER on IntegriCloud