From 251c204e57dba2a6b177312d601ad3e256f5f681 Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Mon, 23 Jan 2017 23:57:50 +0000 Subject: Re-commit "Don't inline dllimport functions referencing non-imported methods" This re-commits r292522 with the addition that it also handles calls through pointer to member functions without crashing. llvm-svn: 292856 --- clang/lib/CodeGen/CodeGenModule.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index c9d9a35fb8a..f9866957a14 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1751,6 +1751,16 @@ namespace { SafeToInline = E->getConstructor()->hasAttr(); return SafeToInline; } + bool VisitCXXMemberCallExpr(CXXMemberCallExpr *E) { + CXXMethodDecl *M = E->getMethodDecl(); + if (!M) { + // Call through a pointer to member function. This is safe to inline. + SafeToInline = true; + } else { + SafeToInline = M->hasAttr(); + } + return SafeToInline; + } bool VisitCXXDeleteExpr(CXXDeleteExpr *E) { SafeToInline = E->getOperatorDelete()->hasAttr(); return SafeToInline; -- cgit v1.2.3