From 956e6f3a97217acc8f4630e3e681fde1d0cccc51 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Wed, 17 Jan 2018 17:06:13 +0200 Subject: [PATCH] Clang: Fix MSVC build Link error: clangpchmanagerbackendmain.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl ClangBackEnd::ClangPathWatcher::ClangPathWatcher( class ClangBackEnd::FilePathCachingInterface &,class ClangBackEnd::ClangPathWatcherNotifier *)" (__imp_??0?$ClangPathWatcher@VQFileSystemWatcher@@VQTimer@@@ClangBackEnd@@QEAA@AEAVFilePathCachingInterface@1@PEAVClangPathWatcherNotifier@1@@Z) referenced in function main Looks like MSVC looks for import even for inline template functions. Another alternative is to revert 351f355b69632038f996d2d7039903d10f82c003 and either ignore or suppress the GCC warning. Change-Id: I040d4e3924af7f4d1f4424276329c6095e6ff6bd Reviewed-by: Ivan Donchevskii --- src/libs/clangsupport/clangpathwatcher.h | 2 +- src/libs/clangsupport/clangsupport_global.h | 6 ++++++ src/libs/clangsupport/filepathcache.h | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libs/clangsupport/clangpathwatcher.h b/src/libs/clangsupport/clangpathwatcher.h index 610e42cccf2..9339c56d51d 100644 --- a/src/libs/clangsupport/clangpathwatcher.h +++ b/src/libs/clangsupport/clangpathwatcher.h @@ -77,7 +77,7 @@ using IdCache = StringCache -class CLANGSUPPORT_EXPORT ClangPathWatcher : public ClangPathWatcherInterface +class CLANGSUPPORT_GCCEXPORT ClangPathWatcher : public ClangPathWatcherInterface { public: ClangPathWatcher(FilePathCachingInterface &pathCache, diff --git a/src/libs/clangsupport/clangsupport_global.h b/src/libs/clangsupport/clangsupport_global.h index 34f65cdcad0..67830143f6c 100644 --- a/src/libs/clangsupport/clangsupport_global.h +++ b/src/libs/clangsupport/clangsupport_global.h @@ -39,6 +39,12 @@ # define CLANGSUPPORT_EXPORT Q_DECL_IMPORT #endif +#ifdef Q_CC_GNU +# define CLANGSUPPORT_GCCEXPORT __attribute__((visibility("default"))) +#else +# define CLANGSUPPORT_GCCEXPORT +#endif + #ifndef CLANGBACKENDPROCESSPATH # define CLANGBACKENDPROCESSPATH "" #endif diff --git a/src/libs/clangsupport/filepathcache.h b/src/libs/clangsupport/filepathcache.h index 81bc3f40cc8..ebdd2a8aacb 100644 --- a/src/libs/clangsupport/filepathcache.h +++ b/src/libs/clangsupport/filepathcache.h @@ -36,7 +36,7 @@ namespace ClangBackEnd { template -class CLANGSUPPORT_EXPORT FilePathCache +class CLANGSUPPORT_GCCEXPORT FilePathCache { using DirectoryPathCache = StringCache