aboutsummaryrefslogtreecommitdiff
path: root/include/clang
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-11-12 16:49:45 +0000
committerDouglas Gregor <dgregor@apple.com>2009-11-12 16:49:45 +0000
commitcffecd08f1974dc7cc328bd620b2f69daf442fda (patch)
treefc937d2b4d338a4509ddd028ecb0c8e751797ede /include/clang
parent11de6de25a0110cd7be97eef761ef3b189781da6 (diff)
Give CanQual<T> an implicit conversion to bool, so that it can be used
in "if" statements like: if (CanQual<ReferenceType> RefType = T.getAs<ReferenceType>()) Thanks to Clang for pointing out this mistake :) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86995 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang')
-rw-r--r--include/clang/AST/CanonicalType.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/clang/AST/CanonicalType.h b/include/clang/AST/CanonicalType.h
index a775051709..a53f2f48fd 100644
--- a/include/clang/AST/CanonicalType.h
+++ b/include/clang/AST/CanonicalType.h
@@ -71,6 +71,9 @@ public:
/// \brief Implicit conversion to a qualified type.
operator QualType() const { return Stored; }
+ /// \brief Implicit conversion to bool.
+ operator bool() const { return !isNull(); }
+
bool isNull() const {
return Stored.isNull();
}