summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-05-18 19:44:14 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-05-18 21:55:43 (GMT)
commite96b5d14f9f3500b2221e9afedfacabb0a56bb4c (patch)
tree242b3a3c35d604973ae7150aef12b775702928ec
parent7eb0dfa0622afe078c2e131ee1cbad293960b634 (diff)
downloadCMake-e96b5d14f9f3500b2221e9afedfacabb0a56bb4c.zip
CMake-e96b5d14f9f3500b2221e9afedfacabb0a56bb4c.tar.gz
CMake-e96b5d14f9f3500b2221e9afedfacabb0a56bb4c.tar.bz2
cmListFileContext: Implement LessThanComparable.
Move wrapping existing code from cmMakefile, and simplify the implementation there.
-rw-r--r--Source/cmListFileCache.cxx8
-rw-r--r--Source/cmListFileCache.h1
-rw-r--r--Source/cmMakefile.cxx4
-rw-r--r--Source/cmMakefile.h21
4 files changed, 11 insertions, 23 deletions
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index ddcea9b..d8d339a 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -431,3 +431,11 @@ std::ostream& operator<<(std::ostream& os, cmListFileContext const& lfc)
}
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;
+}
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index 544ff1b..da89016 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -62,6 +62,7 @@ struct cmListFileContext
};
std::ostream& operator<<(std::ostream&, cmListFileContext const&);
+bool operator<(const cmListFileContext& lhs, const cmListFileContext& rhs);
struct cmListFileFunction: public cmListFileContext
{
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 5240dc8..8631d73 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4943,9 +4943,7 @@ bool cmMakefile::SetPolicyVersion(const char *version)
//----------------------------------------------------------------------------
bool cmMakefile::HasCMP0054AlreadyBeenReported() const
{
- cmCMP0054Id id(this->GetExecutionContext());
-
- return !this->CMP0054ReportedIds.insert(id).second;
+ return !this->CMP0054ReportedIds.insert(this->GetExecutionContext()).second;
}
//----------------------------------------------------------------------------
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 3203b1b..bfd6155 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -386,26 +386,7 @@ public:
*/
cmPolicies *GetPolicies() const;
- struct cmCMP0054Id
- {
- 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;
+ mutable std::set<cmListFileContext> CMP0054ReportedIds;
/**
* Determine if the given context, name pair has already been reported