Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit 32c7998

Browse files
committed
Revert "Don't inline dllimport functions referencing non-imported methods"
This reverts commit r292522. It appears to be causing crashes in builds using dllimport. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292643 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent e32fe3b commit 32c7998

File tree

2 files changed

+0
-12
lines changed

2 files changed

+0
-12
lines changed

lib/CodeGen/CodeGenModule.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -1751,11 +1751,6 @@ namespace {
17511751
SafeToInline = E->getConstructor()->hasAttr<DLLImportAttr>();
17521752
return SafeToInline;
17531753
}
1754-
bool VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
1755-
CXXMethodDecl *M = E->getMethodDecl();
1756-
SafeToInline = M->hasAttr<DLLImportAttr>();
1757-
return SafeToInline;
1758-
}
17591754
bool VisitCXXDeleteExpr(CXXDeleteExpr *E) {
17601755
SafeToInline = E->getOperatorDelete()->hasAttr<DLLImportAttr>();
17611756
return SafeToInline;

test/CodeGenCXX/dllimport.cpp

-7
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ struct ExplicitSpec_NotImported {};
2626
#define USEVARTYPE(type, var) type UNIQ(use)() { return var; }
2727
#define USEVAR(var) USEVARTYPE(int, var)
2828
#define USE(func) void UNIQ(use)() { func(); }
29-
#define USE1(func) void UNIQ(use)() { func(nullptr); }
3029
#define USEMEMFUNC(class, func) void (class::*UNIQ(use)())() { return &class::func; }
3130
#define USESTATICMEMFUNC(class, func) void (*UNIQ(use)())() { return &class::func; }
3231
#define USECLASS(class) void UNIQ(USE)() { class x; }
@@ -317,13 +316,10 @@ namespace ns { __declspec(dllimport) void externalFunc(); }
317316
USE(ns::externalFunc)
318317

319318
// A dllimport function referencing non-imported vars or functions must not be available_externally.
320-
321319
__declspec(dllimport) int ImportedVar;
322320
int NonImportedVar;
323321
__declspec(dllimport) int ImportedFunc();
324322
int NonImportedFunc();
325-
struct ClassWithNonImportedMethod { int f(); };
326-
327323
__declspec(dllimport) inline int ReferencingImportedVar() { return ImportedVar; }
328324
// MO1-DAG: define available_externally dllimport i32 @"\01?ReferencingImportedVar@@YAHXZ"
329325
__declspec(dllimport) inline int ReferencingNonImportedVar() { return NonImportedVar; }
@@ -332,13 +328,10 @@ __declspec(dllimport) inline int ReferencingImportedFunc() { return ImportedFunc
332328
// MO1-DAG: define available_externally dllimport i32 @"\01?ReferencingImportedFunc@@YAHXZ"
333329
__declspec(dllimport) inline int ReferencingNonImportedFunc() { return NonImportedFunc(); }
334330
// MO1-DAG: declare dllimport i32 @"\01?ReferencingNonImportedFunc@@YAHXZ"()
335-
__declspec(dllimport) inline int ReferencingNonImportedMethod(ClassWithNonImportedMethod *x) { return x->f(); }
336-
// MO1-DAG: declare dllimport i32 @"\01?ReferencingNonImportedMethod
337331
USE(ReferencingImportedVar)
338332
USE(ReferencingNonImportedVar)
339333
USE(ReferencingImportedFunc)
340334
USE(ReferencingNonImportedFunc)
341-
USE1(ReferencingNonImportedMethod)
342335
// References to operator new and delete count too, despite not being DeclRefExprs.
343336
__declspec(dllimport) inline int *ReferencingNonImportedNew() { return new int[2]; }
344337
// MO1-DAG: declare dllimport i32* @"\01?ReferencingNonImportedNew@@YAPAHXZ"

0 commit comments

Comments
 (0)