Differential D11136 Diff 29096 plugins/custom-definesandincludes/compilerprovider/compilerfactories.cpp
Changeset View
Changeset View
Standalone View
Standalone View
plugins/custom-definesandincludes/compilerprovider/compilerfactories.cpp
Show All 26 Lines | |||||
27 | #include "gcclikecompiler.h" | 27 | #include "gcclikecompiler.h" | ||
28 | #include "msvccompiler.h" | 28 | #include "msvccompiler.h" | ||
29 | 29 | | |||
30 | QString ClangFactory::name() const | 30 | QString ClangFactory::name() const | ||
31 | { | 31 | { | ||
32 | return QStringLiteral("Clang"); | 32 | return QStringLiteral("Clang"); | ||
33 | } | 33 | } | ||
34 | 34 | | |||
35 | bool ClangFactory::isSupported(const KDevelop::Path& path) const | ||||
36 | { | ||||
37 | const auto filename = path.lastPathSegment(); | ||||
38 | return filename.contains(QLatin1String("clang")) && !filename.contains(QLatin1String("clang-cl")); | ||||
39 | } | ||||
40 | | ||||
35 | CompilerPointer ClangFactory::createCompiler(const QString& name, const QString& path, bool editable ) const | 41 | CompilerPointer ClangFactory::createCompiler(const QString& name, const QString& path, bool editable ) const | ||
36 | { | 42 | { | ||
37 | return CompilerPointer(new GccLikeCompiler(name, path, editable, this->name())); | 43 | return CompilerPointer(new GccLikeCompiler(name, path, editable, this->name())); | ||
38 | } | 44 | } | ||
39 | 45 | | |||
40 | void ClangFactory::registerDefaultCompilers(CompilerProvider* provider) const | 46 | void ClangFactory::registerDefaultCompilers(CompilerProvider* provider) const | ||
41 | { | 47 | { | ||
42 | const QString clang = QStringLiteral("clang"); | 48 | const QString clang = QStringLiteral("clang"); | ||
43 | 49 | | |||
44 | auto compiler = createCompiler(name(), clang, false); | 50 | auto compiler = createCompiler(name(), clang, false); | ||
45 | provider->registerCompiler(compiler); | 51 | provider->registerCompiler(compiler); | ||
46 | } | 52 | } | ||
47 | 53 | | |||
48 | QString GccFactory::name() const | 54 | QString GccFactory::name() const | ||
49 | { | 55 | { | ||
50 | return QStringLiteral("GCC"); | 56 | return QStringLiteral("GCC"); | ||
51 | } | 57 | } | ||
52 | 58 | | |||
59 | bool GccFactory::isSupported(const KDevelop::Path& path) const | ||||
60 | { | ||||
61 | return path.lastPathSegment().contains(QLatin1String("gcc")) || path.lastPathSegment().contains(QLatin1String("g++")); | ||||
62 | } | ||||
63 | | ||||
53 | CompilerPointer GccFactory::createCompiler(const QString& name, const QString& path, bool editable ) const | 64 | CompilerPointer GccFactory::createCompiler(const QString& name, const QString& path, bool editable ) const | ||
54 | { | 65 | { | ||
55 | return CompilerPointer(new GccLikeCompiler(name, path, editable, this->name())); | 66 | return CompilerPointer(new GccLikeCompiler(name, path, editable, this->name())); | ||
56 | } | 67 | } | ||
57 | 68 | | |||
58 | void GccFactory::registerDefaultCompilers(CompilerProvider* provider) const | 69 | void GccFactory::registerDefaultCompilers(CompilerProvider* provider) const | ||
59 | { | 70 | { | ||
60 | const QString gcc = QStringLiteral("gcc"); | 71 | const QString gcc = QStringLiteral("gcc"); | ||
Show All 11 Lines | |||||
72 | { | 83 | { | ||
73 | return CompilerPointer(new MsvcCompiler(name, path, editable, this->name())); | 84 | return CompilerPointer(new MsvcCompiler(name, path, editable, this->name())); | ||
74 | } | 85 | } | ||
75 | 86 | | |||
76 | void MsvcFactory::registerDefaultCompilers(CompilerProvider* provider) const | 87 | void MsvcFactory::registerDefaultCompilers(CompilerProvider* provider) const | ||
77 | { | 88 | { | ||
78 | provider->registerCompiler(createCompiler(name(), QStringLiteral("cl.exe"), false)); | 89 | provider->registerCompiler(createCompiler(name(), QStringLiteral("cl.exe"), false)); | ||
79 | } | 90 | } | ||
91 | | ||||
92 | bool MsvcFactory::isSupported(const KDevelop::Path& path) const | ||||
93 | { | ||||
94 | return path.lastPathSegment() == QLatin1String("cl.exe") || path.lastPathSegment().contains(QLatin1String("clang-cl")); | ||||
95 | } |