diff options
author | Stephen Kelly <steveire@gmail.com> | 2012-09-12 13:11:25 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-09-18 21:03:08 (GMT) |
commit | 91011bd217726f73e362b10d77a6638977d6a781 (patch) | |
tree | 5feed05d259d3c4b8b152e51a1d567a0e26a508a /Source/cmGeneratorExpression.h | |
parent | f1eacf0e07759b57d100dbf5d83c70e4028bcb54 (diff) | |
download | CMake-91011bd217726f73e362b10d77a6638977d6a781.zip CMake-91011bd217726f73e362b10d77a6638977d6a781.tar.gz CMake-91011bd217726f73e362b10d77a6638977d6a781.tar.bz2 |
cmGeneratorExpression: Port users to two-stage processing
Removing the Process() API and removing the parameters from the
constructor will allow cmGeneratorExpressions to be cached and evaluated
with multiple configs for example, such as when evaluating target
properties. This requires the creation of a new compiled representation
of cmGeneratorExpression. The cmListFileBacktrace remains in the
constructor so that we can record where a particular generator
expression appeared in the CMakeLists file.
Diffstat (limited to 'Source/cmGeneratorExpression.h')
-rw-r--r-- | Source/cmGeneratorExpression.h | 54 |
1 files changed, 35 insertions, 19 deletions
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 00e6907..b8467c2 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -21,6 +21,8 @@ class cmListFileBacktrace; struct cmGeneratorExpressionEvaluator; +class cmCompiledGeneratorExpression; + /** \class cmGeneratorExpression * \brief Evaluate generate-time query expression syntax. * @@ -33,34 +35,48 @@ struct cmGeneratorExpressionEvaluator; class cmGeneratorExpression { public: - /** Construct with an evaluation context and configuration. */ - cmGeneratorExpression(cmMakefile* mf, const char* config, - cmListFileBacktrace const& backtrace, - bool quiet = false); - + /** Construct. */ + cmGeneratorExpression(cmListFileBacktrace const& backtrace); ~cmGeneratorExpression(); - /** Evaluate generator expressions in a string. */ - const char* Process(std::string const& input); - const char* Process(const char* input); + const cmCompiledGeneratorExpression& Parse(std::string const& input); + const cmCompiledGeneratorExpression& Parse(const char* input); + +private: + cmGeneratorExpression(const cmGeneratorExpression &); + void operator=(const cmGeneratorExpression &); + + cmListFileBacktrace const& Backtrace; + cmCompiledGeneratorExpression *CompiledExpression; +}; - void Parse(const char* input); +class cmCompiledGeneratorExpression +{ +public: const char* Evaluate(cmMakefile* mf, const char* config, - bool quiet = false); + bool quiet = false) const; /** Get set of targets found during evaluations. */ std::set<cmTarget*> const& GetTargets() const { return this->Targets; } + + ~cmCompiledGeneratorExpression(); + private: - std::vector<cmGeneratorExpressionEvaluator*> Evaluators; - cmMakefile* Makefile; - const char* Config; - cmListFileBacktrace const& Backtrace; - bool Quiet; + cmCompiledGeneratorExpression(cmListFileBacktrace const& backtrace, + const std::vector<cmGeneratorExpressionEvaluator*> &evaluators, + const char *input, bool needsParsing); - std::set<cmTarget*> Targets; - const char* Input; - bool NeedsParsing; + friend class cmGeneratorExpression; + + cmCompiledGeneratorExpression(const cmCompiledGeneratorExpression &); + void operator=(const cmCompiledGeneratorExpression &); + + cmListFileBacktrace const& Backtrace; + const std::vector<cmGeneratorExpressionEvaluator*> Evaluators; + const char* const Input; + const bool NeedsParsing; - std::string Output; + mutable std::set<cmTarget*> Targets; + mutable std::string Output; }; |