Differential D8653 Diff 22021 plugins/custom-definesandincludes/compilerprovider/compilerprovider.cpp
Changeset View
Changeset View
Standalone View
Standalone View
plugins/custom-definesandincludes/compilerprovider/compilerprovider.cpp
Show First 20 Lines • Show All 132 Lines • ▼ Show 20 Line(s) | |||||
133 | 133 | | |||
134 | QHash<QString, QString> CompilerProvider::defines( ProjectBaseItem* item ) const | 134 | QHash<QString, QString> CompilerProvider::defines( ProjectBaseItem* item ) const | ||
135 | { | 135 | { | ||
136 | auto config = configForItem(item); | 136 | auto config = configForItem(item); | ||
137 | auto languageType = Utils::Cpp; | 137 | auto languageType = Utils::Cpp; | ||
138 | if (item) { | 138 | if (item) { | ||
139 | languageType = Utils::languageType(item->path(), config.parserArguments.parseAmbiguousAsCPP); | 139 | languageType = Utils::languageType(item->path(), config.parserArguments.parseAmbiguousAsCPP); | ||
140 | } | 140 | } | ||
141 | // If called on files that we can't compile, return an empty set of defines. | ||||
142 | if (languageType == Utils::Other) { | ||||
143 | return {}; | ||||
144 | } | ||||
141 | 145 | | |||
142 | return config.compiler->defines(languageType, | 146 | return config.compiler->defines(languageType, | ||
143 | languageType == Utils::C ? config.parserArguments.cArguments : config.parserArguments.cppArguments); | 147 | languageType == Utils::C ? config.parserArguments.cArguments : config.parserArguments.cppArguments); | ||
144 | } | 148 | } | ||
145 | 149 | | |||
146 | Path::List CompilerProvider::includes( ProjectBaseItem* item ) const | 150 | Path::List CompilerProvider::includes( ProjectBaseItem* item ) const | ||
147 | { | 151 | { | ||
148 | auto config = configForItem(item); | 152 | auto config = configForItem(item); | ||
149 | auto languageType = Utils::Cpp; | 153 | auto languageType = Utils::Cpp; | ||
150 | if (item) { | 154 | if (item) { | ||
151 | languageType = Utils::languageType(item->path(), config.parserArguments.parseAmbiguousAsCPP); | 155 | languageType = Utils::languageType(item->path(), config.parserArguments.parseAmbiguousAsCPP); | ||
152 | } | 156 | } | ||
157 | // If called on files that we can't compile, return an empty set of includes. | ||||
158 | if (languageType == Utils::Other) { | ||||
159 | return {}; | ||||
160 | } | ||||
153 | 161 | | |||
154 | return config.compiler->includes(languageType, | 162 | return config.compiler->includes(languageType, | ||
155 | languageType == Utils::C ? config.parserArguments.cArguments : config.parserArguments.cppArguments); | 163 | languageType == Utils::C ? config.parserArguments.cArguments : config.parserArguments.cppArguments); | ||
156 | } | 164 | } | ||
157 | 165 | | |||
158 | Path::List CompilerProvider::frameworkDirectories( ProjectBaseItem* /* item */ ) const | 166 | Path::List CompilerProvider::frameworkDirectories( ProjectBaseItem* /* item */ ) const | ||
159 | { | 167 | { | ||
160 | return {}; | 168 | return {}; | ||
▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines |