diff options
author | Oleksandr Koval <oleksandr.koval.dev@gmail.com> | 2020-10-01 11:28:03 (GMT) |
---|---|---|
committer | Oleksandr Koval <oleksandr.koval.dev@gmail.com> | 2020-10-01 11:28:03 (GMT) |
commit | e614528ad1e7d053169535cc32fe566f6eb22d41 (patch) | |
tree | fc81ab6b79afc387519d5b97d088ef99a0454567 /Source/cmIfCommand.cxx | |
parent | 47b569a85852f716b05ede538e9940392407316c (diff) | |
download | CMake-e614528ad1e7d053169535cc32fe566f6eb22d41.zip CMake-e614528ad1e7d053169535cc32fe566f6eb22d41.tar.gz CMake-e614528ad1e7d053169535cc32fe566f6eb22d41.tar.bz2 |
cmListFileCache: Make cmListFileFunction a shared pointer
Passing cmListFileFunction everywhere by-value involves big overhead.
Now cmListFileFunction stores std::shared_ptr to the underlying data.
Diffstat (limited to 'Source/cmIfCommand.cxx')
-rw-r--r-- | Source/cmIfCommand.cxx | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index fc257b1..55f6453 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -54,7 +54,7 @@ public: bool cmIfFunctionBlocker::ArgumentsMatch(cmListFileFunction const& lff, cmMakefile&) const { - return lff.Arguments.empty() || lff.Arguments == this->Args; + return lff.Arguments().empty() || lff.Arguments() == this->Args; } bool cmIfFunctionBlocker::Replay(std::vector<cmListFileFunction> functions, @@ -65,19 +65,19 @@ bool cmIfFunctionBlocker::Replay(std::vector<cmListFileFunction> functions, int scopeDepth = 0; for (cmListFileFunction const& func : functions) { // keep track of scope depth - if (func.Name.Lower == "if") { + if (func.LowerCaseName() == "if") { scopeDepth++; } - if (func.Name.Lower == "endif") { + if (func.LowerCaseName() == "endif") { scopeDepth--; } // watch for our state change - if (scopeDepth == 0 && func.Name.Lower == "else") { + if (scopeDepth == 0 && func.LowerCaseName() == "else") { if (this->ElseSeen) { - cmListFileBacktrace elseBT = mf.GetBacktrace().Push( - cmListFileContext{ func.Name.Original, - this->GetStartingContext().FilePath, func.Line }); + cmListFileBacktrace elseBT = mf.GetBacktrace().Push(cmListFileContext{ + func.OriginalName(), this->GetStartingContext().FilePath, + func.Line() }); mf.GetCMakeInstance()->IssueMessage( MessageType::FATAL_ERROR, "A duplicate ELSE command was found inside an IF block.", elseBT); @@ -94,9 +94,10 @@ bool cmIfFunctionBlocker::Replay(std::vector<cmListFileFunction> functions, if (!this->IsBlocking && mf.GetCMakeInstance()->GetTrace()) { mf.PrintCommandTrace(func); } - } else if (scopeDepth == 0 && func.Name.Lower == "elseif") { - cmListFileBacktrace elseifBT = mf.GetBacktrace().Push(cmListFileContext{ - func.Name.Original, this->GetStartingContext().FilePath, func.Line }); + } else if (scopeDepth == 0 && func.LowerCaseName() == "elseif") { + cmListFileBacktrace elseifBT = mf.GetBacktrace().Push( + cmListFileContext{ func.OriginalName(), + this->GetStartingContext().FilePath, func.Line() }); if (this->ElseSeen) { mf.GetCMakeInstance()->IssueMessage( MessageType::FATAL_ERROR, @@ -116,7 +117,7 @@ bool cmIfFunctionBlocker::Replay(std::vector<cmListFileFunction> functions, std::string errorString; std::vector<cmExpandedCommandArgument> expandedArguments; - mf.ExpandArguments(func.Arguments, expandedArguments); + mf.ExpandArguments(func.Arguments(), expandedArguments); MessageType messType; |