diff options
author | Hans Wennborg <hans@hanshq.net> | 2017-01-23 23:57:50 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2017-01-23 23:57:50 +0000 |
commit | 251c204e57dba2a6b177312d601ad3e256f5f681 (patch) | |
tree | 3b82366f14d75e6ff7432dca880e152e27001de4 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 954a624fb987f97e74bdf7b01685d4ec2a4dc861 (diff) | |
download | bcm5719-llvm-251c204e57dba2a6b177312d601ad3e256f5f681.tar.gz bcm5719-llvm-251c204e57dba2a6b177312d601ad3e256f5f681.zip |
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
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
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<DLLImportAttr>(); 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<DLLImportAttr>(); + } + return SafeToInline; + } bool VisitCXXDeleteExpr(CXXDeleteExpr *E) { SafeToInline = E->getOperatorDelete()->hasAttr<DLLImportAttr>(); return SafeToInline; |