mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-19 02:17:27 +08:00
cm*FunctionBlocker: Move to source file
This commit is contained in:
@@ -10,11 +10,30 @@
|
|||||||
#include "cm_memory.hxx"
|
#include "cm_memory.hxx"
|
||||||
|
|
||||||
#include "cmExecutionStatus.h"
|
#include "cmExecutionStatus.h"
|
||||||
|
#include "cmFunctionBlocker.h"
|
||||||
|
#include "cmListFileCache.h"
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
#include "cmMessageType.h"
|
#include "cmMessageType.h"
|
||||||
#include "cmRange.h"
|
#include "cmRange.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
|
|
||||||
|
class cmForEachFunctionBlocker : public cmFunctionBlocker
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
cmForEachFunctionBlocker(cmMakefile* mf);
|
||||||
|
~cmForEachFunctionBlocker() override;
|
||||||
|
bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf,
|
||||||
|
cmExecutionStatus&) override;
|
||||||
|
bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) override;
|
||||||
|
|
||||||
|
std::vector<std::string> Args;
|
||||||
|
std::vector<cmListFileFunction> Functions;
|
||||||
|
|
||||||
|
private:
|
||||||
|
cmMakefile* Makefile;
|
||||||
|
int Depth;
|
||||||
|
};
|
||||||
|
|
||||||
cmForEachFunctionBlocker::cmForEachFunctionBlocker(cmMakefile* mf)
|
cmForEachFunctionBlocker::cmForEachFunctionBlocker(cmMakefile* mf)
|
||||||
: Makefile(mf)
|
: Makefile(mf)
|
||||||
, Depth(0)
|
, Depth(0)
|
||||||
|
@@ -11,28 +11,8 @@
|
|||||||
#include "cm_memory.hxx"
|
#include "cm_memory.hxx"
|
||||||
|
|
||||||
#include "cmCommand.h"
|
#include "cmCommand.h"
|
||||||
#include "cmFunctionBlocker.h"
|
|
||||||
#include "cmListFileCache.h"
|
|
||||||
|
|
||||||
class cmExecutionStatus;
|
class cmExecutionStatus;
|
||||||
class cmMakefile;
|
|
||||||
|
|
||||||
class cmForEachFunctionBlocker : public cmFunctionBlocker
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
cmForEachFunctionBlocker(cmMakefile* mf);
|
|
||||||
~cmForEachFunctionBlocker() override;
|
|
||||||
bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf,
|
|
||||||
cmExecutionStatus&) override;
|
|
||||||
bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) override;
|
|
||||||
|
|
||||||
std::vector<std::string> Args;
|
|
||||||
std::vector<cmListFileFunction> Functions;
|
|
||||||
|
|
||||||
private:
|
|
||||||
cmMakefile* Makefile;
|
|
||||||
int Depth;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Starts foreach() ... endforeach() block
|
/// Starts foreach() ... endforeach() block
|
||||||
class cmForEachCommand : public cmCommand
|
class cmForEachCommand : public cmCommand
|
||||||
|
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
#include "cmAlgorithms.h"
|
#include "cmAlgorithms.h"
|
||||||
#include "cmExecutionStatus.h"
|
#include "cmExecutionStatus.h"
|
||||||
|
#include "cmFunctionBlocker.h"
|
||||||
|
#include "cmListFileCache.h"
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
#include "cmPolicies.h"
|
#include "cmPolicies.h"
|
||||||
#include "cmRange.h"
|
#include "cmRange.h"
|
||||||
@@ -102,6 +104,18 @@ bool cmFunctionHelperCommand::operator()(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class cmFunctionFunctionBlocker : public cmFunctionBlocker
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile& mf,
|
||||||
|
cmExecutionStatus&) override;
|
||||||
|
bool ShouldRemove(const cmListFileFunction&, cmMakefile& mf) override;
|
||||||
|
|
||||||
|
std::vector<std::string> Args;
|
||||||
|
std::vector<cmListFileFunction> Functions;
|
||||||
|
int Depth = 0;
|
||||||
|
};
|
||||||
|
|
||||||
bool cmFunctionFunctionBlocker::IsFunctionBlocked(
|
bool cmFunctionFunctionBlocker::IsFunctionBlocked(
|
||||||
const cmListFileFunction& lff, cmMakefile& mf, cmExecutionStatus&)
|
const cmListFileFunction& lff, cmMakefile& mf, cmExecutionStatus&)
|
||||||
{
|
{
|
||||||
|
@@ -11,23 +11,8 @@
|
|||||||
#include "cm_memory.hxx"
|
#include "cm_memory.hxx"
|
||||||
|
|
||||||
#include "cmCommand.h"
|
#include "cmCommand.h"
|
||||||
#include "cmFunctionBlocker.h"
|
|
||||||
#include "cmListFileCache.h"
|
|
||||||
|
|
||||||
class cmExecutionStatus;
|
class cmExecutionStatus;
|
||||||
class cmMakefile;
|
|
||||||
|
|
||||||
class cmFunctionFunctionBlocker : public cmFunctionBlocker
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile& mf,
|
|
||||||
cmExecutionStatus&) override;
|
|
||||||
bool ShouldRemove(const cmListFileFunction&, cmMakefile& mf) override;
|
|
||||||
|
|
||||||
std::vector<std::string> Args;
|
|
||||||
std::vector<cmListFileFunction> Functions;
|
|
||||||
int Depth = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Starts function() ... endfunction() block
|
/// Starts function() ... endfunction() block
|
||||||
class cmFunctionCommand : public cmCommand
|
class cmFunctionCommand : public cmCommand
|
||||||
|
@@ -7,6 +7,8 @@
|
|||||||
#include "cmConditionEvaluator.h"
|
#include "cmConditionEvaluator.h"
|
||||||
#include "cmExecutionStatus.h"
|
#include "cmExecutionStatus.h"
|
||||||
#include "cmExpandedCommandArgument.h"
|
#include "cmExpandedCommandArgument.h"
|
||||||
|
#include "cmFunctionBlocker.h"
|
||||||
|
#include "cmListFileCache.h"
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
#include "cmMessageType.h"
|
#include "cmMessageType.h"
|
||||||
#include "cmOutputConverter.h"
|
#include "cmOutputConverter.h"
|
||||||
@@ -28,6 +30,21 @@ static std::string cmIfCommandError(
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class cmIfFunctionBlocker : public cmFunctionBlocker
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf,
|
||||||
|
cmExecutionStatus&) override;
|
||||||
|
bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) override;
|
||||||
|
|
||||||
|
std::vector<cmListFileArgument> Args;
|
||||||
|
std::vector<cmListFileFunction> Functions;
|
||||||
|
bool IsBlocking;
|
||||||
|
bool HasRun = false;
|
||||||
|
bool ElseSeen = false;
|
||||||
|
unsigned int ScopeDepth = 0;
|
||||||
|
};
|
||||||
|
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
bool cmIfFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
|
bool cmIfFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
|
||||||
cmMakefile& mf,
|
cmMakefile& mf,
|
||||||
|
@@ -7,26 +7,8 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "cmFunctionBlocker.h"
|
|
||||||
#include "cmListFileCache.h"
|
|
||||||
|
|
||||||
class cmExecutionStatus;
|
class cmExecutionStatus;
|
||||||
class cmMakefile;
|
struct cmListFileArgument;
|
||||||
|
|
||||||
class cmIfFunctionBlocker : public cmFunctionBlocker
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf,
|
|
||||||
cmExecutionStatus&) override;
|
|
||||||
bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) override;
|
|
||||||
|
|
||||||
std::vector<cmListFileArgument> Args;
|
|
||||||
std::vector<cmListFileFunction> Functions;
|
|
||||||
bool IsBlocking;
|
|
||||||
bool HasRun = false;
|
|
||||||
bool ElseSeen = false;
|
|
||||||
unsigned int ScopeDepth = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Starts an if block
|
/// Starts an if block
|
||||||
bool cmIfCommand(std::vector<cmListFileArgument> const& args,
|
bool cmIfCommand(std::vector<cmListFileArgument> const& args,
|
||||||
|
@@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
#include "cmAlgorithms.h"
|
#include "cmAlgorithms.h"
|
||||||
#include "cmExecutionStatus.h"
|
#include "cmExecutionStatus.h"
|
||||||
|
#include "cmFunctionBlocker.h"
|
||||||
|
#include "cmListFileCache.h"
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
#include "cmPolicies.h"
|
#include "cmPolicies.h"
|
||||||
#include "cmRange.h"
|
#include "cmRange.h"
|
||||||
@@ -136,6 +138,18 @@ bool cmMacroHelperCommand::operator()(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class cmMacroFunctionBlocker : public cmFunctionBlocker
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile& mf,
|
||||||
|
cmExecutionStatus&) override;
|
||||||
|
bool ShouldRemove(const cmListFileFunction&, cmMakefile& mf) override;
|
||||||
|
|
||||||
|
std::vector<std::string> Args;
|
||||||
|
std::vector<cmListFileFunction> Functions;
|
||||||
|
int Depth = 0;
|
||||||
|
};
|
||||||
|
|
||||||
bool cmMacroFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
|
bool cmMacroFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
|
||||||
cmMakefile& mf,
|
cmMakefile& mf,
|
||||||
cmExecutionStatus&)
|
cmExecutionStatus&)
|
||||||
|
@@ -11,23 +11,8 @@
|
|||||||
#include "cm_memory.hxx"
|
#include "cm_memory.hxx"
|
||||||
|
|
||||||
#include "cmCommand.h"
|
#include "cmCommand.h"
|
||||||
#include "cmFunctionBlocker.h"
|
|
||||||
#include "cmListFileCache.h"
|
|
||||||
|
|
||||||
class cmExecutionStatus;
|
class cmExecutionStatus;
|
||||||
class cmMakefile;
|
|
||||||
|
|
||||||
class cmMacroFunctionBlocker : public cmFunctionBlocker
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile& mf,
|
|
||||||
cmExecutionStatus&) override;
|
|
||||||
bool ShouldRemove(const cmListFileFunction&, cmMakefile& mf) override;
|
|
||||||
|
|
||||||
std::vector<std::string> Args;
|
|
||||||
std::vector<cmListFileFunction> Functions;
|
|
||||||
int Depth = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Starts macro() ... endmacro() block
|
/// Starts macro() ... endmacro() block
|
||||||
class cmMacroCommand : public cmCommand
|
class cmMacroCommand : public cmCommand
|
||||||
|
@@ -7,6 +7,8 @@
|
|||||||
#include "cmConditionEvaluator.h"
|
#include "cmConditionEvaluator.h"
|
||||||
#include "cmExecutionStatus.h"
|
#include "cmExecutionStatus.h"
|
||||||
#include "cmExpandedCommandArgument.h"
|
#include "cmExpandedCommandArgument.h"
|
||||||
|
#include "cmFunctionBlocker.h"
|
||||||
|
#include "cmListFileCache.h"
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
#include "cmMessageType.h"
|
#include "cmMessageType.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
@@ -14,6 +16,23 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
class cmWhileFunctionBlocker : public cmFunctionBlocker
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
cmWhileFunctionBlocker(cmMakefile* mf);
|
||||||
|
~cmWhileFunctionBlocker() override;
|
||||||
|
bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf,
|
||||||
|
cmExecutionStatus&) override;
|
||||||
|
bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) override;
|
||||||
|
|
||||||
|
std::vector<cmListFileArgument> Args;
|
||||||
|
std::vector<cmListFileFunction> Functions;
|
||||||
|
|
||||||
|
private:
|
||||||
|
cmMakefile* Makefile;
|
||||||
|
int Depth;
|
||||||
|
};
|
||||||
|
|
||||||
cmWhileFunctionBlocker::cmWhileFunctionBlocker(cmMakefile* mf)
|
cmWhileFunctionBlocker::cmWhileFunctionBlocker(cmMakefile* mf)
|
||||||
: Makefile(mf)
|
: Makefile(mf)
|
||||||
, Depth(0)
|
, Depth(0)
|
||||||
|
@@ -7,28 +7,8 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "cmFunctionBlocker.h"
|
|
||||||
#include "cmListFileCache.h"
|
|
||||||
|
|
||||||
class cmExecutionStatus;
|
class cmExecutionStatus;
|
||||||
class cmMakefile;
|
struct cmListFileArgument;
|
||||||
|
|
||||||
class cmWhileFunctionBlocker : public cmFunctionBlocker
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
cmWhileFunctionBlocker(cmMakefile* mf);
|
|
||||||
~cmWhileFunctionBlocker() override;
|
|
||||||
bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf,
|
|
||||||
cmExecutionStatus&) override;
|
|
||||||
bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) override;
|
|
||||||
|
|
||||||
std::vector<cmListFileArgument> Args;
|
|
||||||
std::vector<cmListFileFunction> Functions;
|
|
||||||
|
|
||||||
private:
|
|
||||||
cmMakefile* Makefile;
|
|
||||||
int Depth;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// \brief Starts a while loop
|
/// \brief Starts a while loop
|
||||||
bool cmWhileCommand(std::vector<cmListFileArgument> const& args,
|
bool cmWhileCommand(std::vector<cmListFileArgument> const& args,
|
||||||
|
Reference in New Issue
Block a user