diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2014-10-24 16:58:12 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-10-24 17:31:21 (GMT) |
commit | 5f414cefb6524d26329484b296004e3c2d97ec4f (patch) | |
tree | 6a6edc8f85577dcf22f157488bb809e8733b2cbb /Source/cmDefinitions.h | |
parent | 5abfde6cb8a1ae0b2825797eab6c2e9842eb7c49 (diff) | |
download | CMake-5f414cefb6524d26329484b296004e3c2d97ec4f.zip CMake-5f414cefb6524d26329484b296004e3c2d97ec4f.tar.gz CMake-5f414cefb6524d26329484b296004e3c2d97ec4f.tar.bz2 |
Revert "cmDefinitions: Don't store parent lookups"
This reverts commit 5abfde6cb8a1ae0b2825797eab6c2e9842eb7c49.
The behaviors associated with implicit pulldown on variable lookup
seriously conflict with the optimizations made in these commits.
Basically, since values were copied upon variable lookup, not just on
PARENT_SCOPE, coupled with PARENT_SCOPE's behavior based on whether the
variable is in the current scope or not causes serious problems with not
storing a value for every variable at every scope.
The commit changed behavior of the following example, among other cases:
function(test_set)
set(blah "value2")
message("before PARENT_SCOPE blah=${blah}")
set(blah ${blah} PARENT_SCOPE)
message("after PARENT_SCOPE blah=${blah}")
endfunction()
set(blah value1)
test_set()
message("in parent scope, blah=${blah}")
Reported-by: Alex Merry <alex.merry@kde.org>
Reported-by: Ben Cooksley <bcooksley@kde.org>
Diffstat (limited to 'Source/cmDefinitions.h')
-rw-r--r-- | Source/cmDefinitions.h | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index ebe6fa5..d615fb0 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -33,11 +33,9 @@ public: /** Returns the parent scope, if any. */ cmDefinitions* GetParent() const { return this->Up; } - /** Get the value associated with a key; null if none. */ - const char* Get(const std::string& key) const; - - /** Pull a variable from the parent. */ - void Pull(const std::string& key); + /** Get the value associated with a key; null if none. + Store the result locally if it came from a parent. */ + const char* Get(const std::string& key); /** Set (or unset if null) a value associated with a key. */ const char* Set(const std::string& key, const char* value); @@ -75,7 +73,7 @@ private: MapType Map; // Internal query and update methods. - Def const& GetInternal(const std::string& key) const; + Def const& GetInternal(const std::string& key); Def const& SetInternal(const std::string& key, Def const& def); // Implementation of Closure() method. |