forked from OSchip/llvm-project
Don't warn about undefined inline functions if they're dllexport/import
llvm-svn: 209471
This commit is contained in:
parent
e1f62eca2d
commit
5ebffb5555
|
@ -478,6 +478,13 @@ static void checkUndefinedButUsed(Sema &S) {
|
|||
I = Undefined.begin(), E = Undefined.end(); I != E; ++I) {
|
||||
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()) {
|
||||
S.Diag(ND->getLocation(), diag::warn_undefined_internal)
|
||||
<< isa<VarDecl>(ND) << ND;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -triple i686-pc-win32 -verify %s
|
||||
// PR14993
|
||||
|
||||
namespace test1 {
|
||||
|
@ -55,3 +55,9 @@ namespace test10 {
|
|||
void test() { foo(); }
|
||||
inline void foo() __attribute__((gnu_inline));
|
||||
}
|
||||
|
||||
namespace test11 {
|
||||
inline void foo() __attribute__((dllexport));
|
||||
inline void bar() __attribute__((dllimport));
|
||||
void test() { foo(); bar(); }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue