Commit a0861931 authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'dev/backtrace-performance'

86be733f cmGeneratorExpression: Add workaround for Borland compiler
3495ab0a tests: update unused variable test expected output
2a1b2d84 backtrace: Convert to local paths in IssueMessage
a0829205 genex: remove the need for backtraces
efc20569 cmake: remove dummy backtraces for IssueMessage
d46c650d cmMakefile: return a backtrace
parents 3c0652f8 86be733f
......@@ -137,7 +137,7 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
this->Makefile->GetHomeOutputDirectory()))
{
cmOStringStream msg;
cmListFileBacktrace bt;
cmListFileBacktrace bt(this->Makefile->GetLocalGenerator());
cmListFileContext lfc;
lfc.FilePath = this->FileName;
lfc.Line = this->FileLine;
......
......@@ -386,15 +386,17 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
e << "The dependency target \"" << dependee_name
<< "\" of target \"" << depender->GetName() << "\" does not exist.";
cmListFileBacktrace nullBacktrace;
cmListFileBacktrace const* backtrace =
depender->GetUtilityBacktrace(dependee_name);
if(!backtrace)
if(backtrace)
{
backtrace = &nullBacktrace;
cm->IssueMessage(messageType, e.str(), *backtrace);
}
else
{
cm->IssueMessage(messageType, e.str());
}
cm->IssueMessage(messageType, e.str(), *backtrace);
}
}
......
......@@ -17,6 +17,7 @@
//----------------------------------------------------------------------------
cmCustomCommand::cmCustomCommand()
: Backtrace(NULL)
{
this->HaveComment = false;
this->EscapeOldStyle = true;
......@@ -33,7 +34,7 @@ cmCustomCommand::cmCustomCommand(const cmCustomCommand& r):
WorkingDirectory(r.WorkingDirectory),
EscapeAllowMakeVars(r.EscapeAllowMakeVars),
EscapeOldStyle(r.EscapeOldStyle),
Backtrace(new cmListFileBacktrace(*r.Backtrace))
Backtrace(r.Backtrace)
{
}
......@@ -54,11 +55,7 @@ cmCustomCommand& cmCustomCommand::operator=(cmCustomCommand const& r)
this->EscapeAllowMakeVars = r.EscapeAllowMakeVars;
this->EscapeOldStyle = r.EscapeOldStyle;
this->ImplicitDepends = r.ImplicitDepends;
cmsys::auto_ptr<cmListFileBacktrace>
newBacktrace(new cmListFileBacktrace(*r.Backtrace));
delete this->Backtrace;
this->Backtrace = newBacktrace.release();
this->Backtrace = r.Backtrace;
return *this;
}
......@@ -78,20 +75,19 @@ cmCustomCommand::cmCustomCommand(cmMakefile const* mf,
WorkingDirectory(workingDirectory?workingDirectory:""),
EscapeAllowMakeVars(false),
EscapeOldStyle(true),
Backtrace(new cmListFileBacktrace)
Backtrace(NULL)
{
this->EscapeOldStyle = true;
this->EscapeAllowMakeVars = false;
if(mf)
{
mf->GetBacktrace(*this->Backtrace);
this->Backtrace = mf->GetBacktrace();
}
}
//----------------------------------------------------------------------------
cmCustomCommand::~cmCustomCommand()
{
delete this->Backtrace;
}
//----------------------------------------------------------------------------
......@@ -166,7 +162,7 @@ void cmCustomCommand::SetEscapeAllowMakeVars(bool b)
//----------------------------------------------------------------------------
cmListFileBacktrace const& cmCustomCommand::GetBacktrace() const
{
return *this->Backtrace;
return this->Backtrace;
}
//----------------------------------------------------------------------------
......
......@@ -13,8 +13,8 @@
#define cmCustomCommand_h
#include "cmStandardIncludes.h"
#include "cmListFileCache.h"
class cmMakefile;
class cmListFileBacktrace;
/** \class cmCustomCommand
* \brief A class to encapsulate a custom command
......@@ -88,7 +88,7 @@ private:
std::string WorkingDirectory;
bool EscapeAllowMakeVars;
bool EscapeOldStyle;
cmListFileBacktrace* Backtrace;
cmListFileBacktrace Backtrace;
ImplicitDependsList ImplicitDepends;
};
......
......@@ -21,7 +21,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(
cmCustomCommand const& cc, const std::string& config, cmMakefile* mf):
CC(cc), Config(config), Makefile(mf), LG(mf->GetLocalGenerator()),
OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars()),
GE(new cmGeneratorExpression(cc.GetBacktrace())), DependsDone(false)
GE(new cmGeneratorExpression(&cc.GetBacktrace())), DependsDone(false)
{
}
......
......@@ -18,6 +18,7 @@
//----------------------------------------------------------------------------
cmExportBuildFileGenerator::cmExportBuildFileGenerator()
: Backtrace(NULL)
{
this->Makefile = 0;
this->ExportSet = 0;
......
......@@ -45,7 +45,7 @@ public:
void SetMakefile(cmMakefile *mf) {
this->Makefile = mf;
this->Makefile->GetBacktrace(this->Backtrace);
this->Backtrace = this->Makefile->GetBacktrace();
}
protected:
......
......@@ -377,8 +377,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
const char *propName = "INTERFACE_INCLUDE_DIRECTORIES";
const char *input = target->GetProperty(propName);
cmListFileBacktrace lfbt;
cmGeneratorExpression ge(lfbt);
cmGeneratorExpression ge;
std::string dirs = cmGeneratorExpression::Preprocess(
tei->InterfaceIncludeDirectories,
......
......@@ -57,10 +57,9 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
return std::string();
}
cmListFileBacktrace lfbt;
cmGeneratorExpression ge(lfbt);
cmGeneratorExpression ge;
cmGeneratorExpressionDAGChecker dagChecker(lfbt,
cmGeneratorExpressionDAGChecker dagChecker(
tgt->GetName(),
propName, 0, 0);
......
......@@ -3270,14 +3270,13 @@ void cmFileCommand::AddEvaluationFile(const std::string &inputName,
bool inputIsContent
)
{
cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
cmGeneratorExpression outputGe(lfbt);
cmGeneratorExpression outputGe(&lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> outputCge
= outputGe.Parse(outputExpr);
cmGeneratorExpression conditionGe(lfbt);
cmGeneratorExpression conditionGe(&lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> conditionCge
= conditionGe.Parse(condition);
......
......@@ -24,7 +24,7 @@
//----------------------------------------------------------------------------
cmGeneratorExpression::cmGeneratorExpression(
cmListFileBacktrace const& backtrace):
cmListFileBacktrace const* backtrace):
Backtrace(backtrace)
{
}
......@@ -33,10 +33,18 @@ cmGeneratorExpression::cmGeneratorExpression(
cmsys::auto_ptr<cmCompiledGeneratorExpression>
cmGeneratorExpression::Parse(std::string const& input)
{
#if !defined(__BORLANDC__)
return cmsys::auto_ptr<cmCompiledGeneratorExpression>(
new cmCompiledGeneratorExpression(
this->Backtrace,
input));
new cmCompiledGeneratorExpression(
this->Backtrace ? *this->Backtrace : cmListFileBacktrace(NULL),
input));
#else
cmListFileBacktrace emptyBacktrace(NULL);
return cmsys::auto_ptr<cmCompiledGeneratorExpression>(
new cmCompiledGeneratorExpression(
this->Backtrace ? *this->Backtrace : emptyBacktrace,
input));
#endif
}
//----------------------------------------------------------------------------
......
......@@ -41,7 +41,7 @@ class cmGeneratorExpression
{
public:
/** Construct. */
cmGeneratorExpression(cmListFileBacktrace const& backtrace);
cmGeneratorExpression(cmListFileBacktrace const* backtrace = NULL);
~cmGeneratorExpression();
cmsys::auto_ptr<cmCompiledGeneratorExpression> Parse(
......@@ -70,7 +70,7 @@ private:
cmGeneratorExpression(const cmGeneratorExpression &);
void operator=(const cmGeneratorExpression &);
cmListFileBacktrace const& Backtrace;
cmListFileBacktrace const* Backtrace;
};
class cmCompiledGeneratorExpression
......
......@@ -23,6 +23,25 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
cmGeneratorExpressionDAGChecker *parent)
: Parent(parent), Target(target), Property(property),
Content(content), Backtrace(backtrace), TransitivePropertiesOnly(false)
{
Initialize();
}
//----------------------------------------------------------------------------
cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
const std::string &target,
const std::string &property,
const GeneratorExpressionContent *content,
cmGeneratorExpressionDAGChecker *parent)
: Parent(parent), Target(target), Property(property),
Content(content), Backtrace(NULL), TransitivePropertiesOnly(false)
{
Initialize();
}
//----------------------------------------------------------------------------
void
cmGeneratorExpressionDAGChecker::Initialize()
{
const cmGeneratorExpressionDAGChecker *top = this;
const cmGeneratorExpressionDAGChecker *p = this->Parent;
......@@ -43,11 +62,12 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
#undef TEST_TRANSITIVE_PROPERTY_METHOD
{
std::map<std::string, std::set<std::string> >::const_iterator it
= top->Seen.find(target);
= top->Seen.find(this->Target);
if (it != top->Seen.end())
{
const std::set<std::string> &propSet = it->second;
const std::set<std::string>::const_iterator i = propSet.find(property);
const std::set<std::string>::const_iterator i
= propSet.find(this->Property);
if (i != propSet.end())
{
this->CheckResult = ALREADY_SEEN;
......@@ -55,7 +75,7 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
}
}
const_cast<cmGeneratorExpressionDAGChecker *>(top)
->Seen[target].insert(property);
->Seen[this->Target].insert(this->Property);
}
}
......
......@@ -46,6 +46,10 @@ struct cmGeneratorExpressionDAGChecker
const std::string &property,
const GeneratorExpressionContent *content,
cmGeneratorExpressionDAGChecker *parent);
cmGeneratorExpressionDAGChecker(const std::string &target,
const std::string &property,
const GeneratorExpressionContent *content,
cmGeneratorExpressionDAGChecker *parent);
enum Result {
DAG,
......@@ -76,6 +80,7 @@ struct cmGeneratorExpressionDAGChecker
private:
Result CheckGraph() const;
void Initialize();
private:
const cmGeneratorExpressionDAGChecker * const Parent;
......
......@@ -115,7 +115,7 @@ void cmGeneratorExpressionEvaluationFile::Generate()
}
cmListFileBacktrace lfbt = this->OutputFileExpr->GetBacktrace();
cmGeneratorExpression contentGE(lfbt);
cmGeneratorExpression contentGE(&lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> inputExpression
= contentGE.Parse(inputContent);
......
......@@ -809,7 +809,7 @@ std::string getLinkedTargetsContent(const std::vector<cmTarget*> &targets,
cmGeneratorExpressionDAGChecker *dagChecker,
const std::string &interfacePropertyName)
{
cmGeneratorExpression ge(context->Backtrace);
cmGeneratorExpression ge(&context->Backtrace);
std::string sep;
std::string depString;
......@@ -1196,7 +1196,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
{
if (targetPropertyTransitiveWhitelist[i] == interfacePropertyName)
{
cmGeneratorExpression ge(context->Backtrace);
cmGeneratorExpression ge(&context->Backtrace);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
std::string result = cge->Evaluate(context->Makefile,
context->Config,
......
......@@ -22,6 +22,11 @@ class cmTarget;
//----------------------------------------------------------------------------
struct cmGeneratorExpressionContext
{
cmGeneratorExpressionContext()
: Backtrace(NULL)
{
}
cmListFileBacktrace Backtrace;
std::set<cmTarget*> DependTargets;
std::set<cmTarget const*> AllTargets;
......
......@@ -259,12 +259,10 @@ static void handleSystemIncludesDep(cmMakefile *mf, cmTarget* depTgt,
std::vector<std::string>& result,
bool excludeImported)
{
cmListFileBacktrace lfbt;
if (const char* dirs =
depTgt->GetProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES"))
{
cmGeneratorExpression ge(lfbt);
cmGeneratorExpression ge;
cmSystemTools::ExpandListArgument(ge.Parse(dirs)
->Evaluate(mf,
config, false, headTarget,
......@@ -278,7 +276,7 @@ static void handleSystemIncludesDep(cmMakefile *mf, cmTarget* depTgt,
if (const char* dirs =
depTgt->GetProperty("INTERFACE_INCLUDE_DIRECTORIES"))
{
cmGeneratorExpression ge(lfbt);
cmGeneratorExpression ge;
cmSystemTools::ExpandListArgument(ge.Parse(dirs)
->Evaluate(mf,
config, false, headTarget,
......@@ -457,8 +455,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir,
return false;
}
cmListFileBacktrace lfbt;
cmGeneratorExpressionDAGChecker dagChecker(lfbt,
cmGeneratorExpressionDAGChecker dagChecker(
this->GetName(),
"SYSTEM_INCLUDE_DIRECTORIES", 0, 0);
......@@ -470,7 +467,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir,
it = this->Target->GetSystemIncludeDirectories().begin();
it != this->Target->GetSystemIncludeDirectories().end(); ++it)
{
cmGeneratorExpression ge(lfbt);
cmGeneratorExpression ge;
cmSystemTools::ExpandListArgument(ge.Parse(*it)
->Evaluate(this->Makefile,
config, false, this->Target,
......@@ -808,7 +805,7 @@ cmTargetTraceDependencies
{
// Transform command names that reference targets built in this
// project to corresponding target-level dependencies.
cmGeneratorExpression ge(cc.GetBacktrace());
cmGeneratorExpression ge(&cc.GetBacktrace());
// Add target-level dependencies referenced by generator expressions.
std::set<cmTarget*> targets;
......
......@@ -1282,8 +1282,7 @@ void cmGlobalGenerator::Generate()
if(!this->GenerateCPackPropertiesFile())
{
this->GetCMakeInstance()->IssueMessage(
cmake::FATAL_ERROR, "Could not write CPack properties file.",
cmListFileBacktrace());
cmake::FATAL_ERROR, "Could not write CPack properties file.");
}
for (std::map<std::string, cmExportBuildFileGenerator*>::iterator
......@@ -1294,8 +1293,7 @@ void cmGlobalGenerator::Generate()
&& !cmSystemTools::GetErrorOccuredFlag())
{
this->GetCMakeInstance()
->IssueMessage(cmake::FATAL_ERROR, "Could not write export file.",
cmListFileBacktrace());
->IssueMessage(cmake::FATAL_ERROR, "Could not write export file.");
return;
}
}
......@@ -1324,8 +1322,7 @@ void cmGlobalGenerator::Generate()
{
w << " " << *iter << "\n";
}
this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
cmListFileBacktrace());
this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, w.str());
}
this->CMakeInstance->UpdateProgress("Generating done", -1);
......@@ -1525,8 +1522,7 @@ cmGlobalGenerator::GetGeneratorTarget(cmTarget const* t) const
if(ti == this->GeneratorTargets.end())
{
this->CMakeInstance->IssueMessage(
cmake::INTERNAL_ERROR, "Missing cmGeneratorTarget instance!",
cmListFileBacktrace());
cmake::INTERNAL_ERROR, "Missing cmGeneratorTarget instance!");
return 0;
}
return ti->second;
......
......@@ -12,6 +12,7 @@
#include "cmInstallFilesGenerator.h"
#include "cmGeneratorExpression.h"
#include "cmMakefile.h"
#include "cmSystemTools.h"
//----------------------------------------------------------------------------
......@@ -84,8 +85,7 @@ void cmInstallFilesGenerator::GenerateScriptForConfig(std::ostream& os,
Indent const& indent)
{
std::vector<std::string> files;
cmListFileBacktrace lfbt;
cmGeneratorExpression ge(lfbt);
cmGeneratorExpression ge;
for(std::vector<std::string>::const_iterator i = this->Files.begin();
i != this->Files.end(); ++i)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment