diff options
author | Brad King <brad.king@kitware.com> | 2018-09-06 20:49:34 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-09-07 13:23:43 (GMT) |
commit | 1b57f49586afc9e8663d5e146732b1cd0597e7ef (patch) | |
tree | 3754c4403d6b5cc3f5e6b2543f6e1f394dc92ea7 /Source/cmGeneratorExpression.h | |
parent | bea390e9bd68e1aa7d86b6aef7384f502c39068c (diff) | |
download | CMake-1b57f49586afc9e8663d5e146732b1cd0597e7ef.zip CMake-1b57f49586afc9e8663d5e146732b1cd0597e7ef.tar.gz CMake-1b57f49586afc9e8663d5e146732b1cd0597e7ef.tar.bz2 |
genex: Simplify cmGeneratorExpressionInterpreter
All callers were constructing with a non-empty target name using the
target whose pointer was passed anyway. Drop this argument. Simplify
logic accordingly. Re-order constructor arguments to match the
cmCompiledGeneratorExpression::Evaluate arguments.
Also remove unnecessary getters.
Diffstat (limited to 'Source/cmGeneratorExpression.h')
-rw-r--r-- | Source/cmGeneratorExpression.h | 55 |
1 files changed, 5 insertions, 50 deletions
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 2b7df91..8176d5c 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -160,24 +160,15 @@ class cmGeneratorExpressionInterpreter public: cmGeneratorExpressionInterpreter(cmLocalGenerator* localGenerator, - cmGeneratorTarget* generatorTarget, - const std::string& config, - const std::string& target, - const std::string& lang) + std::string const& config, + cmGeneratorTarget const* headTarget, + std::string const& lang = std::string()) : LocalGenerator(localGenerator) - , GeneratorTarget(generatorTarget) , Config(config) - , Target(target) + , HeadTarget(headTarget) , Language(lang) { } - cmGeneratorExpressionInterpreter(cmLocalGenerator* localGenerator, - cmGeneratorTarget* generatorTarget, - const std::string& config) - : cmGeneratorExpressionInterpreter(localGenerator, generatorTarget, config, - std::string(), std::string()) - { - } const std::string& Evaluate(const char* expression, const std::string& property); @@ -188,47 +179,11 @@ public: } protected: - cmGeneratorExpression& GetGeneratorExpression() - { - return this->GeneratorExpression; - } - - cmCompiledGeneratorExpression& GetCompiledGeneratorExpression() - { - return *(this->CompiledGeneratorExpression); - } - - cmLocalGenerator* GetLocalGenerator() { return this->LocalGenerator; } - - cmGeneratorTarget* GetGeneratorTarget() { return this->GeneratorTarget; } - - const std::string& GetTargetName() const { return this->Target; } - const std::string& GetLanguage() const { return this->Language; } - - const std::string& EvaluateExpression( - const char* expression, - cmGeneratorExpressionDAGChecker* dagChecker = nullptr) - { - this->CompiledGeneratorExpression = - this->GeneratorExpression.Parse(expression); - - if (dagChecker == nullptr) { - return this->CompiledGeneratorExpression->Evaluate( - this->LocalGenerator, this->Config, false, this->GeneratorTarget); - } - - return this->CompiledGeneratorExpression->Evaluate( - this->LocalGenerator, this->Config, false, this->GeneratorTarget, - dagChecker, this->Language); - } - -private: cmGeneratorExpression GeneratorExpression; std::unique_ptr<cmCompiledGeneratorExpression> CompiledGeneratorExpression; cmLocalGenerator* LocalGenerator = nullptr; - cmGeneratorTarget* GeneratorTarget = nullptr; std::string Config; - std::string Target; + cmGeneratorTarget const* HeadTarget = nullptr; std::string Language; }; |