cmListFileContext: Implement LessThanComparable.
Move wrapping existing code from cmMakefile, and simplify the implementation there.
This commit is contained in:
parent
7eb0dfa062
commit
e96b5d14f9
@ -431,3 +431,11 @@ std::ostream& operator<<(std::ostream& os, cmListFileContext const& lfc)
|
|||||||
}
|
}
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool operator<(const cmListFileContext& lhs, const cmListFileContext& rhs)
|
||||||
|
{
|
||||||
|
if(lhs.FilePath != rhs.FilePath)
|
||||||
|
return lhs.FilePath < rhs.FilePath;
|
||||||
|
|
||||||
|
return lhs.Line < rhs.Line;
|
||||||
|
}
|
||||||
|
@ -62,6 +62,7 @@ struct cmListFileContext
|
|||||||
};
|
};
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream&, cmListFileContext const&);
|
std::ostream& operator<<(std::ostream&, cmListFileContext const&);
|
||||||
|
bool operator<(const cmListFileContext& lhs, const cmListFileContext& rhs);
|
||||||
|
|
||||||
struct cmListFileFunction: public cmListFileContext
|
struct cmListFileFunction: public cmListFileContext
|
||||||
{
|
{
|
||||||
|
@ -4943,9 +4943,7 @@ bool cmMakefile::SetPolicyVersion(const char *version)
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool cmMakefile::HasCMP0054AlreadyBeenReported() const
|
bool cmMakefile::HasCMP0054AlreadyBeenReported() const
|
||||||
{
|
{
|
||||||
cmCMP0054Id id(this->GetExecutionContext());
|
return !this->CMP0054ReportedIds.insert(this->GetExecutionContext()).second;
|
||||||
|
|
||||||
return !this->CMP0054ReportedIds.insert(id).second;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -386,26 +386,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
cmPolicies *GetPolicies() const;
|
cmPolicies *GetPolicies() const;
|
||||||
|
|
||||||
struct cmCMP0054Id
|
mutable std::set<cmListFileContext> CMP0054ReportedIds;
|
||||||
{
|
|
||||||
cmCMP0054Id(cmListFileContext const& context):
|
|
||||||
Context(context)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator< (cmCMP0054Id const& id) const
|
|
||||||
{
|
|
||||||
if(this->Context.FilePath != id.Context.FilePath)
|
|
||||||
return this->Context.FilePath < id.Context.FilePath;
|
|
||||||
|
|
||||||
return this->Context.Line < id.Context.Line;
|
|
||||||
}
|
|
||||||
|
|
||||||
cmListFileContext Context;
|
|
||||||
};
|
|
||||||
|
|
||||||
mutable std::set<cmCMP0054Id> CMP0054ReportedIds;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the given context, name pair has already been reported
|
* Determine if the given context, name pair has already been reported
|
||||||
|
Loading…
x
Reference in New Issue
Block a user