diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-05-31 17:37:08 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-07-04 09:51:27 (GMT) |
commit | dbafb01580a0d35e33e6577ad07002f4dd345236 (patch) | |
tree | 5c69384cf1065f5e1796194d142d4547adab5543 /Source | |
parent | 27ff19a96a7d12f2ed6d9683ef733eff6378472a (diff) | |
download | CMake-dbafb01580a0d35e33e6577ad07002f4dd345236.zip CMake-dbafb01580a0d35e33e6577ad07002f4dd345236.tar.gz CMake-dbafb01580a0d35e33e6577ad07002f4dd345236.tar.bz2 |
cmMakefile: Split CallStack into two pieces.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmMakefile.cxx | 35 | ||||
-rw-r--r-- | Source/cmMakefile.h | 10 |
2 files changed, 21 insertions, 24 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index cdcf88c..678c1b3 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -247,11 +247,11 @@ void cmMakefile::IssueMessage(cmake::MessageType t, std::string const& text) const { // Collect context information. - if(!this->CallStack.empty()) + if(!this->ExecutionStatusStack.empty()) { if((t == cmake::FATAL_ERROR) || (t == cmake::INTERNAL_ERROR)) { - this->CallStack.back().Status->SetNestedError(true); + this->ExecutionStatusStack.back()->SetNestedError(true); } this->GetCMakeInstance()->IssueMessage(t, text, this->GetBacktrace()); } @@ -276,10 +276,11 @@ void cmMakefile::IssueMessage(cmake::MessageType t, cmListFileBacktrace cmMakefile::GetBacktrace() const { cmListFileBacktrace backtrace(this->StateSnapshot); - for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin(); - i != this->CallStack.rend(); ++i) + for(std::vector<cmListFileContext const*>::const_reverse_iterator + i = this->ContextStack.rbegin(); + i != this->ContextStack.rend(); ++i) { - backtrace.Append(*i->Context); + backtrace.Append(*(*i)); } return backtrace; } @@ -290,10 +291,11 @@ cmMakefile::GetBacktrace(cmListFileContext const& lfc) const { cmListFileBacktrace backtrace(this->StateSnapshot); backtrace.Append(lfc); - for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin(); - i != this->CallStack.rend(); ++i) + for(std::vector<cmListFileContext const*>::const_reverse_iterator + i = this->ContextStack.rbegin(); + i != this->ContextStack.rend(); ++i) { - backtrace.Append(*i->Context); + backtrace.Append(*(*i)); } return backtrace; } @@ -301,7 +303,7 @@ cmMakefile::GetBacktrace(cmListFileContext const& lfc) const //---------------------------------------------------------------------------- cmListFileContext cmMakefile::GetExecutionContext() const { - return *this->CallStack.back().Context; + return *this->ContextStack.back(); } //---------------------------------------------------------------------------- @@ -1996,7 +1998,7 @@ void cmMakefile::LogUnused(const char* reason, { std::string path; cmListFileContext lfc; - if (!this->CallStack.empty()) + if (!this->ExecutionStatusStack.empty()) { lfc = this->GetExecutionContext(); path = lfc.FilePath; @@ -3360,11 +3362,11 @@ bool cmMakefile::IsLoopBlock() const std::string cmMakefile::GetExecutionFilePath() const { - if (this->CallStack.empty()) + if (this->ContextStack.empty()) { return std::string(); } - return this->CallStack.back().Context->FilePath; + return this->ContextStack.back()->FilePath; } //---------------------------------------------------------------------------- @@ -3455,7 +3457,7 @@ bool cmMakefile::ExpandArguments( //---------------------------------------------------------------------------- void cmMakefile::AddFunctionBlocker(cmFunctionBlocker* fb) { - if(!this->CallStack.empty()) + if(!this->ExecutionStatusStack.empty()) { // Record the context in which the blocker is created. fb->SetStartingContext(this->GetExecutionContext()); @@ -5503,11 +5505,12 @@ cmMakefile::MacroPushPop::~MacroPushPop() cmMakefileCall::cmMakefileCall(cmMakefile* mf, const cmListFileContext& lfc, cmExecutionStatus& status): Makefile(mf) { - cmMakefile::CallStackEntry entry = {&lfc, &status}; - this->Makefile->CallStack.push_back(entry); + this->Makefile->ContextStack.push_back(&lfc); + this->Makefile->ExecutionStatusStack.push_back(&status); } cmMakefileCall::~cmMakefileCall() { - this->Makefile->CallStack.pop_back(); + this->Makefile->ExecutionStatusStack.pop_back(); + this->Makefile->ContextStack.pop_back(); } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index aa70c72..0ade8e1 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -935,14 +935,8 @@ private: // stack of list files being read std::vector<std::string> ListFileStack; - // stack of commands being invoked. - struct CallStackEntry - { - cmListFileContext const* Context; - cmExecutionStatus* Status; - }; - typedef std::vector<CallStackEntry> CallStackType; - CallStackType CallStack; + std::vector<cmListFileContext const*> ContextStack; + std::vector<cmExecutionStatus*> ExecutionStatusStack; friend class cmMakefileCall; std::vector<cmTarget*> ImportedTargetsOwned; |