Clang: Fix MSVC build

Link error:
clangpchmanagerbackendmain.obj : error LNK2019: unresolved external symbol
    "__declspec(dllimport) public: __cdecl ClangBackEnd::ClangPathWatcher<class QFileSystemWatcher,class QTimer>::ClangPathWatcher<class QFileSystemWatcher,class QTimer>(
        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 351f355b69
and either ignore or suppress the GCC warning.

Change-Id: I040d4e3924af7f4d1f4424276329c6095e6ff6bd
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Orgad Shaneh
2018-01-17 17:06:13 +02:00
committed by Orgad Shaneh
parent d3096f0f73
commit 956e6f3a97
3 changed files with 8 additions and 2 deletions

View File

@@ -77,7 +77,7 @@ using IdCache = StringCache<Utils::SmallString,
template <typename FileSystemWatcher,
typename Timer>
class CLANGSUPPORT_EXPORT ClangPathWatcher : public ClangPathWatcherInterface
class CLANGSUPPORT_GCCEXPORT ClangPathWatcher : public ClangPathWatcherInterface
{
public:
ClangPathWatcher(FilePathCachingInterface &pathCache,

View File

@@ -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

View File

@@ -36,7 +36,7 @@
namespace ClangBackEnd {
template <typename FilePathStorage>
class CLANGSUPPORT_EXPORT FilePathCache
class CLANGSUPPORT_GCCEXPORT FilePathCache
{
using DirectoryPathCache = StringCache<Utils::PathString,
int,