Hi timurrrr,
This function returns true if the ABI requires that we emit a
definition for a given function, given that we don't have a body
for it in the TU.
http://llvm-reviews.chandlerc.com/D820
Files:
lib/CodeGen/CGCXXABI.cpp
lib/CodeGen/CGCXXABI.h
lib/CodeGen/CodeGenModule.cpp
Index: lib/CodeGen/CGCXXABI.cpp
===================================================================
--- lib/CodeGen/CGCXXABI.cpp
+++ lib/CodeGen/CGCXXABI.cpp
@@ -292,3 +292,7 @@
ErrorUnsupportedABI(CGF, "odr-use of thread_local global");
return LValue();
}
+
+bool CGCXXABI::NeedsBodylessEmission(GlobalDecl GD) {
+ return false;
+}
Index: lib/CodeGen/CGCXXABI.h
===================================================================
--- lib/CodeGen/CGCXXABI.h
+++ lib/CodeGen/CGCXXABI.h
@@ -318,6 +318,10 @@
QualType ElementType, llvm::Value *&NumElements,
llvm::Value *&AllocPtr, CharUnits &CookieSize);
+ /// Returns true if the ABI requires that we emit a definition for this
+ /// function, given that we don't have a definition for it in the TU.
+ virtual bool NeedsBodylessEmission(GlobalDecl GD);
+
protected:
/// Returns the extra size required in order to store the array
/// cookie for the given type. Assumes that an array cookie is
Index: lib/CodeGen/CodeGenModule.cpp
===================================================================
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -1380,7 +1380,8 @@
assert(FD->isUsed() && "Sema didn't mark implicit function as
used!");
DeferredDeclsToEmit.push_back(D.getWithDecl(FD));
break;
- } else if (FD->doesThisDeclarationHaveABody()) {
+ } else if (FD->doesThisDeclarationHaveABody() ||
+ getCXXABI().NeedsBodylessEmission(D)) {
DeferredDeclsToEmit.push_back(D.getWithDecl(FD));
break;
}
Index: lib/CodeGen/CGCXXABI.cpp
===================================================================
--- lib/CodeGen/CGCXXABI.cpp
+++ lib/CodeGen/CGCXXABI.cpp
@@ -292,3 +292,7 @@
ErrorUnsupportedABI(CGF, "odr-use of thread_local global");
return LValue();
}
+
+bool CGCXXABI::NeedsBodylessEmission(GlobalDecl GD) {
+ return false;
+}
Index: lib/CodeGen/CGCXXABI.h
===================================================================
--- lib/CodeGen/CGCXXABI.h
+++ lib/CodeGen/CGCXXABI.h
@@ -318,6 +318,10 @@
QualType ElementType, llvm::Value *&NumElements,
llvm::Value *&AllocPtr, CharUnits &CookieSize);
+ /// Returns true if the ABI requires that we emit a definition for this
+ /// function, given that we don't have a definition for it in the TU.
+ virtual bool NeedsBodylessEmission(GlobalDecl GD);
+
protected:
/// Returns the extra size required in order to store the array
/// cookie for the given type. Assumes that an array cookie is
Index: lib/CodeGen/CodeGenModule.cpp
===================================================================
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -1380,7 +1380,8 @@
assert(FD->isUsed() && "Sema didn't mark implicit function as used!");
DeferredDeclsToEmit.push_back(D.getWithDecl(FD));
break;
- } else if (FD->doesThisDeclarationHaveABody()) {
+ } else if (FD->doesThisDeclarationHaveABody() ||
+ getCXXABI().NeedsBodylessEmission(D)) {
DeferredDeclsToEmit.push_back(D.getWithDecl(FD));
break;
}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits