Skip to content
Snippets Groups Projects
Commit 3175e5fb authored by Hans Wennborg's avatar Hans Wennborg
Browse files

Don't warn about undefined inline functions if they're dllexport/import

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209471 91177308-0d34-0410-b5e6-96231b3b80d8
parent c2f2b74e
No related branches found
No related tags found
No related merge requests found
...@@ -478,6 +478,13 @@ static void checkUndefinedButUsed(Sema &S) { ...@@ -478,6 +478,13 @@ static void checkUndefinedButUsed(Sema &S) {
I = Undefined.begin(), E = Undefined.end(); I != E; ++I) { I = Undefined.begin(), E = Undefined.end(); I != E; ++I) {
NamedDecl *ND = I->first; NamedDecl *ND = I->first;
if (ND->hasAttr<DLLImportAttr>() || ND->hasAttr<DLLExportAttr>()) {
// An exported function will always be emitted when defined, so even if
// the function is inline, it doesn't have to be emitted in this TU. An
// imported function implies that it has been exported somewhere else.
continue;
}
if (!ND->isExternallyVisible()) { if (!ND->isExternallyVisible()) {
S.Diag(ND->getLocation(), diag::warn_undefined_internal) S.Diag(ND->getLocation(), diag::warn_undefined_internal)
<< isa<VarDecl>(ND) << ND; << isa<VarDecl>(ND) << ND;
......
// RUN: %clang_cc1 -fsyntax-only -verify %s // RUN: %clang_cc1 -fsyntax-only -triple i686-pc-win32 -verify %s
// PR14993 // PR14993
namespace test1 { namespace test1 {
...@@ -55,3 +55,9 @@ namespace test10 { ...@@ -55,3 +55,9 @@ namespace test10 {
void test() { foo(); } void test() { foo(); }
inline void foo() __attribute__((gnu_inline)); inline void foo() __attribute__((gnu_inline));
} }
namespace test11 {
inline void foo() __attribute__((dllexport));
inline void bar() __attribute__((dllimport));
void test() { foo(); bar(); }
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment