diff options
author | hjk <hjk@qt.io> | 2021-12-06 05:11:04 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2021-12-06 17:10:49 +0000 |
commit | 104ea4accc8bf7d2e317c10638a299c3af267ede (patch) | |
tree | 8ab53d49a45cb72372a5294d272a7e43c815d661 /src/tools/clangbackend/source | |
parent | 8cb5c3cfdd07f98449d3df0a676c5026c33f6b7a (diff) |
Make some qHash and comparison operators overloads hidden friends
Restricts lookup scope more to necessary bits.
Change-Id: Ia42c95aaa70534843b7f6a90bfc56d2a1202c612
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/tools/clangbackend/source')
-rw-r--r-- | src/tools/clangbackend/source/clangdocument.h | 5 | ||||
-rw-r--r-- | src/tools/clangbackend/source/clangjobrequest.h | 3 | ||||
-rw-r--r-- | src/tools/clangbackend/source/clangtype.h | 4 | ||||
-rw-r--r-- | src/tools/clangbackend/source/sourcerange.h | 3 |
4 files changed, 6 insertions, 9 deletions
diff --git a/src/tools/clangbackend/source/clangdocument.h b/src/tools/clangbackend/source/clangdocument.h index bb2eb42ab4..a637731a6e 100644 --- a/src/tools/clangbackend/source/clangdocument.h +++ b/src/tools/clangbackend/source/clangdocument.h @@ -115,6 +115,9 @@ public: = PreferredTranslationUnit::RecentlyParsed) const; TranslationUnits &translationUnits() const; + friend bool operator==(const Document &first, const Document &second); + friend std::ostream &operator<<(std::ostream &os, const Document &document); + public: // for tests void parse() const; void reparse() const; @@ -136,6 +139,4 @@ private: mutable std::shared_ptr<DocumentData> d; }; -bool operator==(const Document &first, const Document &second); -std::ostream &operator<<(std::ostream &os, const Document &document); } // namespace ClangBackEnd diff --git a/src/tools/clangbackend/source/clangjobrequest.h b/src/tools/clangbackend/source/clangjobrequest.h index 1580e327be..fde2eca4db 100644 --- a/src/tools/clangbackend/source/clangjobrequest.h +++ b/src/tools/clangbackend/source/clangjobrequest.h @@ -96,6 +96,7 @@ public: bool isTakeOverable() const; bool operator==(const JobRequest &other) const; + friend QDebug operator<<(QDebug debug, const JobRequest &jobRequest); public: quint64 id = 0; @@ -121,9 +122,7 @@ public: using JobRequests = QVector<JobRequest>; -QDebug operator<<(QDebug debug, const JobRequest &jobRequest); std::ostream &operator<<(std::ostream &os, JobRequest::Type type); std::ostream &operator<<(std::ostream &os, PreferredTranslationUnit preferredTranslationUnit); - } // namespace ClangBackEnd diff --git a/src/tools/clangbackend/source/clangtype.h b/src/tools/clangbackend/source/clangtype.h index 53953392e3..c8dca274d9 100644 --- a/src/tools/clangbackend/source/clangtype.h +++ b/src/tools/clangbackend/source/clangtype.h @@ -40,6 +40,7 @@ class Type { friend class Cursor; friend bool operator==(Type first, Type second); + friend bool operator!=(Type first, Type second); public: bool isValid() const; @@ -80,9 +81,6 @@ private: CXType m_cxType; }; -bool operator==(Type first, Type second); -bool operator!=(Type first, Type second); - std::ostream &operator<<(std::ostream &os, CXTypeKind typeKind); std::ostream &operator<<(std::ostream &os, const Type &type); } // namespace ClangBackEnd diff --git a/src/tools/clangbackend/source/sourcerange.h b/src/tools/clangbackend/source/sourcerange.h index e21f32e9a6..9cef453b92 100644 --- a/src/tools/clangbackend/source/sourcerange.h +++ b/src/tools/clangbackend/source/sourcerange.h @@ -37,6 +37,7 @@ class SourceRange friend class FixIt; friend class Cursor; friend bool operator==(const SourceRange &first, const SourceRange &second); + friend std::ostream &operator<<(std::ostream &os, const SourceRange &sourceRange); public: SourceRange(); @@ -63,6 +64,4 @@ private: CXTranslationUnit cxTranslationUnit = nullptr; }; -bool operator==(const SourceRange &first, const SourceRange &second); -std::ostream &operator<<(std::ostream &os, const SourceRange &sourceRange); } // namespace ClangBackEnd |