aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGVTables.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2011-02-06 20:09:44 +0000
committerAnders Carlsson <andersca@mac.com>2011-02-06 20:09:44 +0000
commit22df7b17f1b086f4347256406703d259753a0cbf (patch)
treef8eca9a9ec35c95a6f23e6254aac304d9b1304dd /lib/CodeGen/CGVTables.cpp
parent14e82fd91c6d5041aa840574143521d244f185cd (diff)
Fix self-host; if a thunk already exists and has available_externally linkage, we should change its linkage instead of asserting.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124986 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGVTables.cpp')
-rw-r--r--lib/CodeGen/CGVTables.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/CodeGen/CGVTables.cpp b/lib/CodeGen/CGVTables.cpp
index 3dd7a15fe3..d74226ec89 100644
--- a/lib/CodeGen/CGVTables.cpp
+++ b/lib/CodeGen/CGVTables.cpp
@@ -2723,8 +2723,13 @@ void CodeGenVTables::EmitThunk(GlobalDecl GD, const ThunkInfo &Thunk,
return;
}
- // We should never be able to get a function with a definition here.
- assert(false && "Shouldn't have an already existing definition");
+ // If a function has a body, it should have available_externally linkage.
+ assert(ThunkFn->hasAvailableExternallyLinkage() &&
+ "Function should have available_externally linkage!");
+
+ // Change the linkage.
+ CGM.setFunctionLinkage(cast<CXXMethodDecl>(GD.getDecl()), ThunkFn);
+ return;
}
// Actually generate the thunk body.