Differential D1047 Diff 2606 languages/plugins/custom-definesandincludes/compilerprovider/compilerprovider.cpp
Changeset View
Changeset View
Standalone View
Standalone View
languages/plugins/custom-definesandincludes/compilerprovider/compilerprovider.cpp
Show First 20 Lines • Show All 127 Lines • ▼ Show 20 Line(s) | 125 | #endif | |||
---|---|---|---|---|---|
128 | retrieveUserDefinedCompilers(); | 128 | retrieveUserDefinedCompilers(); | ||
129 | } | 129 | } | ||
130 | 130 | | |||
131 | CompilerProvider::~CompilerProvider() = default; | 131 | CompilerProvider::~CompilerProvider() = default; | ||
132 | 132 | | |||
133 | QHash<QString, QString> CompilerProvider::defines( ProjectBaseItem* item ) const | 133 | QHash<QString, QString> CompilerProvider::defines( ProjectBaseItem* item ) const | ||
134 | { | 134 | { | ||
135 | auto config = configForItem(item); | 135 | auto config = configForItem(item); | ||
136 | return config.compiler->defines(config.parserArguments); | 136 | auto languageType = Utils::Cpp; | ||
kfunk: `lt` -> `type` or `languageType` | |||||
mwolff: and use auto on the lhs. | |||||
137 | if (item) { | ||||
138 | languageType = Utils::languageType(item->path(), config.parserArguments.parseAmbiguousAsCPP); | ||||
139 | } | ||||
140 | | ||||
141 | return config.compiler->defines(languageType == Utils::C ? config.parserArguments.cArguments : config.parserArguments.cppArguments); | ||||
137 | } | 142 | } | ||
138 | 143 | | |||
139 | Path::List CompilerProvider::includes( ProjectBaseItem* item ) const | 144 | Path::List CompilerProvider::includes( ProjectBaseItem* item ) const | ||
140 | { | 145 | { | ||
141 | auto config = configForItem(item); | 146 | auto config = configForItem(item); | ||
142 | return config.compiler->includes(config.parserArguments); | 147 | auto languageType = Utils::Cpp; | ||
148 | if (item) { | ||||
149 | languageType = Utils::languageType(item->path(), config.parserArguments.parseAmbiguousAsCPP); | ||||
150 | } | ||||
151 | | ||||
152 | return config.compiler->includes(languageType == Utils::C ? config.parserArguments.cArguments : config.parserArguments.cppArguments); | ||||
143 | } | 153 | } | ||
144 | 154 | | |||
kfunk: Code duplication, factor out functionality? | |||||
145 | IDefinesAndIncludesManager::Type CompilerProvider::type() const | 155 | IDefinesAndIncludesManager::Type CompilerProvider::type() const | ||
146 | { | 156 | { | ||
147 | return IDefinesAndIncludesManager::CompilerSpecific; | 157 | return IDefinesAndIncludesManager::CompilerSpecific; | ||
148 | } | 158 | } | ||
149 | 159 | | |||
150 | CompilerPointer CompilerProvider::checkCompilerExists( const CompilerPointer& compiler ) const | 160 | CompilerPointer CompilerProvider::checkCompilerExists( const CompilerPointer& compiler ) const | ||
151 | { | 161 | { | ||
152 | //This may happen for opened for the first time projects | 162 | //This may happen for opened for the first time projects | ||
▲ Show 20 Lines • Show All 72 Lines • Show Last 20 Lines |
lt -> type or languageType