diff options
author | Daniel Teske <daniel.teske@theqtcompany.com> | 2015-06-02 13:23:04 +0200 |
---|---|---|
committer | Daniel Teske <daniel.teske@theqtcompany.com> | 2015-06-02 16:06:22 +0000 |
commit | 26059dbb1eb10966f8e3b9079ac2b054ac77aa54 (patch) | |
tree | ef081b896d6e457396c022df344ac8322fd9313c /src/libs | |
parent | 2189464a840a13a51a99458a364667c40d09fb75 (diff) | |
download | qt-creator-26059dbb1eb10966f8e3b9079ac2b054ac77aa54.tar.gz |
Make every operator bool() explicit
operator bool() is a trap, but with explicit it's far safer,
and we can use that now.
Change-Id: I4e58631c94e87c00256c3ab3cff4fd2c5f632713
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
Diffstat (limited to 'src/libs')
-rw-r--r-- | src/libs/3rdparty/cplusplus/FullySpecifiedType.h | 2 | ||||
-rw-r--r-- | src/libs/cplusplus/pp-engine.cpp | 2 | ||||
-rw-r--r-- | src/libs/glsl/glslsemantic.h | 2 | ||||
-rw-r--r-- | src/libs/qmljs/qmljsmodelmanagerinterface.h | 2 | ||||
-rw-r--r-- | src/libs/qtcreatorcdbext/iinterfacepointer.h | 2 | ||||
-rw-r--r-- | src/libs/qtcreatorcdbext/symbolgroupvalue.h | 2 |
6 files changed, 6 insertions, 6 deletions
diff --git a/src/libs/3rdparty/cplusplus/FullySpecifiedType.h b/src/libs/3rdparty/cplusplus/FullySpecifiedType.h index 498e190330..4c7a21ddc3 100644 --- a/src/libs/3rdparty/cplusplus/FullySpecifiedType.h +++ b/src/libs/3rdparty/cplusplus/FullySpecifiedType.h @@ -33,7 +33,7 @@ public: ~FullySpecifiedType(); bool isValid() const; - operator bool() const; + explicit operator bool() const; Type *type() const; void setType(Type *type); diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp index d3b4995364..fa96c54176 100644 --- a/src/libs/cplusplus/pp-engine.cpp +++ b/src/libs/cplusplus/pp-engine.cpp @@ -297,7 +297,7 @@ public: trivial.utf16charOffset = last->utf16charOffset; } - inline operator bool() const + inline explicit operator bool() const { return first != last; } inline bool isValid() const diff --git a/src/libs/glsl/glslsemantic.h b/src/libs/glsl/glslsemantic.h index 3c99251414..cb8dc464a7 100644 --- a/src/libs/glsl/glslsemantic.h +++ b/src/libs/glsl/glslsemantic.h @@ -56,7 +56,7 @@ public: return true; } - operator bool() const { return isValid(); } + explicit operator bool() const { return isValid(); } const Type *type; bool isConstant; diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.h b/src/libs/qmljs/qmljsmodelmanagerinterface.h index 18ed602fc4..551db94da5 100644 --- a/src/libs/qmljs/qmljsmodelmanagerinterface.h +++ b/src/libs/qmljs/qmljsmodelmanagerinterface.h @@ -78,7 +78,7 @@ public: , tryQmlDump(false), qmlDumpHasRelocatableFlag(true) { } - operator bool() const + explicit operator bool() const { return ! project.isNull(); } bool isValid() const diff --git a/src/libs/qtcreatorcdbext/iinterfacepointer.h b/src/libs/qtcreatorcdbext/iinterfacepointer.h index 4fbbad1590..674e880a9a 100644 --- a/src/libs/qtcreatorcdbext/iinterfacepointer.h +++ b/src/libs/qtcreatorcdbext/iinterfacepointer.h @@ -51,7 +51,7 @@ public: inline IInterface *operator->() const { return m_instance; } inline IInterface *data() const { return m_instance; } inline bool isNull() const { return m_instance == 0; } - inline operator bool() const { return !isNull(); } + explicit inline operator bool() const { return !isNull(); } inline HRESULT hr() const { return m_hr; } // This is for creating a IDebugClient from scratch. Not matches by a constructor, diff --git a/src/libs/qtcreatorcdbext/symbolgroupvalue.h b/src/libs/qtcreatorcdbext/symbolgroupvalue.h index 9bbef1ff82..9a36d02e38 100644 --- a/src/libs/qtcreatorcdbext/symbolgroupvalue.h +++ b/src/libs/qtcreatorcdbext/symbolgroupvalue.h @@ -63,7 +63,7 @@ public: explicit SymbolGroupValue(SymbolGroupNode *node, const SymbolGroupValueContext &c); SymbolGroupValue(); - operator bool() const { return isValid(); } + explicit operator bool() const { return isValid(); } bool isValid() const; // Access children by name or index (0-based) |