diff options
author | Stephen Kelly <steveire@gmail.com> | 2012-11-19 18:30:56 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2012-12-20 11:17:37 (GMT) |
commit | 76ea420fb9a8ceada0e806f1201230e5a7c1202c (patch) | |
tree | 3cb2ec0d1a5470a1a76d426e1fabfb5bc53fc2f3 /Source/cmGeneratorExpression.h | |
parent | 5ac16ea6e4ddb086d48c97fa4f58543284ec3305 (diff) | |
download | CMake-76ea420fb9a8ceada0e806f1201230e5a7c1202c.zip CMake-76ea420fb9a8ceada0e806f1201230e5a7c1202c.tar.gz CMake-76ea420fb9a8ceada0e806f1201230e5a7c1202c.tar.bz2 |
Use cmsys::auto_ptr to manage cmCompiledGeneratorExpressions
The compiled generator expressions need to outlive the creating
type. For the same reason, store the input string in a std::string.
Diffstat (limited to 'Source/cmGeneratorExpression.h')
-rw-r--r-- | Source/cmGeneratorExpression.h | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index ea3e7d0..961e53d 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -14,10 +14,12 @@ #define cmGeneratorExpression_h #include "cmStandardIncludes.h" +#include "cmListFileCache.h" #include <stack> #include <cmsys/RegularExpression.hxx> +#include <cmsys/auto_ptr.hxx> class cmTarget; class cmMakefile; @@ -44,8 +46,9 @@ public: cmGeneratorExpression(cmListFileBacktrace const& backtrace); ~cmGeneratorExpression(); - const cmCompiledGeneratorExpression& Parse(std::string const& input); - const cmCompiledGeneratorExpression& Parse(const char* input); + cmsys::auto_ptr<cmCompiledGeneratorExpression> Parse( + std::string const& input); + cmsys::auto_ptr<cmCompiledGeneratorExpression> Parse(const char* input); enum PreprocessContext { StripAllGeneratorExpressions @@ -59,7 +62,6 @@ private: void operator=(const cmGeneratorExpression &); cmListFileBacktrace const& Backtrace; - cmCompiledGeneratorExpression *CompiledExpression; }; class cmCompiledGeneratorExpression @@ -76,20 +78,24 @@ public: ~cmCompiledGeneratorExpression(); + std::string GetInput() const + { + return this->Input; + } + private: cmCompiledGeneratorExpression(cmListFileBacktrace const& backtrace, - const std::vector<cmGeneratorExpressionEvaluator*> &evaluators, - const char *input, bool needsParsing); + const char *input); 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; + cmListFileBacktrace Backtrace; + std::vector<cmGeneratorExpressionEvaluator*> Evaluators; + const std::string Input; + bool NeedsParsing; mutable std::set<cmTarget*> Targets; mutable std::string Output; |