| 2140 | } |
| 2141 | |
| 2142 | cmGeneratorTarget::ClassifiedFlags |
| 2143 | cmGeneratorTarget::GetClassifiedFlagsForSource(cmSourceFile const* sf, |
| 2144 | std::string const& config) |
| 2145 | { |
| 2146 | auto& sourceFlagsCache = this->Configs[config].SourceFlags; |
| 2147 | auto cacheEntry = sourceFlagsCache.lower_bound(sf); |
| 2148 | if (cacheEntry != sourceFlagsCache.end() && cacheEntry->first == sf) { |
| 2149 | return cacheEntry->second; |
| 2150 | } |
| 2151 | |
| 2152 | ClassifiedFlags flags; |
| 2153 | std::string const& lang = sf->GetLanguage(); |
| 2154 | |
| 2155 | if (!IsSupportedClassifiedFlagsLanguage(lang)) { |
| 2156 | return flags; |
| 2157 | } |
| 2158 | |
| 2159 | auto* const lg = this->GetLocalGenerator(); |
| 2160 | auto const* const mf = this->Makefile; |
| 2161 | |
| 2162 | // Compute the compiler launcher flags. |
| 2163 | if (CanUseCompilerLauncher(lang)) { |
| 2164 | // Compiler launchers are all execution flags and should not be relevant to |
| 2165 | // the actual compilation. |
| 2166 | FlagClassification cls = FlagClassification::ExecutionFlag; |
| 2167 | FlagKind kind = FlagKind::NotAFlag; |
| 2168 | |
| 2169 | std::string const clauncher_prop = cmStrCat(lang, "_COMPILER_LAUNCHER"); |
| 2170 | cmValue clauncher = this->GetProperty(clauncher_prop); |
| 2171 | std::string const evaluatedClauncher = cmGeneratorExpression::Evaluate( |
| 2172 | *clauncher, lg, config, this, nullptr, this, lang); |
| 2173 | |
| 2174 | for (auto const& flag : SplitFlags(evaluatedClauncher)) { |
| 2175 | flags.emplace_back(cls, kind, flag); |
| 2176 | } |
| 2177 | } |
| 2178 | |
| 2179 | ClassifiedFlags define_flags; |
| 2180 | ClassifiedFlags include_flags; |
| 2181 | ClassifiedFlags compile_flags; |
| 2182 | |
| 2183 | SourceVariables sfVars = this->GetSourceVariables(sf, config); |
| 2184 | |
| 2185 | // Compute language flags. |
| 2186 | { |
| 2187 | FlagClassification cls = FlagClassification::BaselineFlag; |
| 2188 | FlagKind kind = FlagKind::Compile; |
| 2189 | |
| 2190 | std::string mfFlags; |
| 2191 | // Explicitly add the explicit language flag before any other flag |
| 2192 | // so user flags can override it. |
| 2193 | this->AddExplicitLanguageFlags(mfFlags, *sf); |
| 2194 | |
| 2195 | for (auto const& flag : SplitFlags(mfFlags)) { |
| 2196 | flags.emplace_back(cls, kind, flag); |
| 2197 | } |
| 2198 | } |
| 2199 |
no test coverage detected