Changeset View
Changeset View
Standalone View
Standalone View
plugins/custom-definesandincludes/definesandincludesmanager.cpp
Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Line(s) | 67 | if (targetDirectory == itemPath || targetDirectory.isParentOf(itemPath)) { | |||
---|---|---|---|---|---|
76 | if (targetDirectory.segments().size() > closestPath.segments().size()) { | 76 | if (targetDirectory.segments().size() > closestPath.segments().size()) { | ||
77 | ret.parserArguments = entry.parserArguments; | 77 | ret.parserArguments = entry.parserArguments; | ||
78 | closestPath = targetDirectory; | 78 | closestPath = targetDirectory; | ||
79 | } | 79 | } | ||
80 | } | 80 | } | ||
81 | } | 81 | } | ||
82 | ret.includes.removeDuplicates(); | 82 | ret.includes.removeDuplicates(); | ||
83 | 83 | | |||
84 | Q_ASSERT(!ret.parserArguments.cppArguments.isEmpty()); | 84 | Q_ASSERT(!ret.parserArguments.isAnyEmpty()); | ||
85 | Q_ASSERT(!ret.parserArguments.cArguments.isEmpty()); | | |||
86 | 85 | | |||
87 | return ret; | 86 | return ret; | ||
88 | } | 87 | } | ||
89 | 88 | | |||
90 | void merge(Defines* target, const Defines& source) | 89 | void merge(Defines* target, const Defines& source) | ||
91 | { | 90 | { | ||
92 | if (target->isEmpty()) { | 91 | if (target->isEmpty()) { | ||
93 | *target = source; | 92 | *target = source; | ||
94 | return; | 93 | return; | ||
95 | } | 94 | } | ||
96 | 95 | | |||
97 | for (auto it = source.constBegin(); it != source.constEnd(); ++it) { | 96 | for (auto it = source.constBegin(); it != source.constEnd(); ++it) { | ||
98 | target->insert(it.key(), it.value()); | 97 | target->insert(it.key(), it.value()); | ||
99 | } | 98 | } | ||
100 | } | 99 | } | ||
101 | 100 | | |||
102 | QString argumentsForPath(const Path& path, const ParserArguments& arguments) | 101 | QString argumentsForPath(const Path& path, const ParserArguments& arguments) | ||
103 | { | 102 | { | ||
104 | auto languageType = Utils::languageType(path, arguments.parseAmbiguousAsCPP); | 103 | auto languageType = Utils::languageType(path, arguments.parseAmbiguousAsCPP); | ||
105 | switch (languageType) { | 104 | if (languageType != Utils::Other) | ||
106 | case Utils::C: | 105 | return arguments[languageType]; | ||
107 | return arguments.cArguments; | 106 | else | ||
108 | case Utils::Cpp: | 107 | return {}; | ||
109 | return arguments.cppArguments; | | |||
110 | case Utils::OpenCl: | | |||
111 | return arguments.openClArguments; | | |||
112 | case Utils::Cuda: | | |||
113 | return arguments.cudaArguments; | | |||
114 | case Utils::ObjC: | | |||
115 | return QString(); | | |||
116 | case Utils::Other: | | |||
117 | return QString(); | | |||
118 | } | | |||
119 | Q_UNREACHABLE(); | | |||
120 | return QString(); | | |||
121 | } | 108 | } | ||
122 | 109 | | |||
123 | } | 110 | } | ||
124 | 111 | | |||
125 | K_PLUGIN_FACTORY_WITH_JSON(DefinesAndIncludesManagerFactory, "kdevdefinesandincludesmanager.json", registerPlugin<DefinesAndIncludesManager>(); ) | 112 | K_PLUGIN_FACTORY_WITH_JSON(DefinesAndIncludesManagerFactory, "kdevdefinesandincludesmanager.json", registerPlugin<DefinesAndIncludesManager>(); ) | ||
126 | 113 | | |||
127 | DefinesAndIncludesManager::DefinesAndIncludesManager( QObject* parent, const QVariantList& ) | 114 | DefinesAndIncludesManager::DefinesAndIncludesManager( QObject* parent, const QVariantList& ) | ||
128 | : IPlugin(QStringLiteral("kdevdefinesandincludesmanager"), parent ) | 115 | : IPlugin(QStringLiteral("kdevdefinesandincludesmanager"), parent ) | ||
▲ Show 20 Lines • Show All 285 Lines • Show Last 20 Lines |