summaryrefslogtreecommitdiffstats
path: root/clang/lib/Rewrite
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-05-15 07:37:26 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-05-15 07:37:26 +0000
commit7d17010db5971ae7bb2bad2d1fc191c442ad0388 (patch)
treec3eeea42026a99490e4167f397bca68a3ecc0e29 /clang/lib/Rewrite
parent041f1aa3e276fe098af1be43076b0d63ce5a002f (diff)
downloadbcm5719-llvm-7d17010db5971ae7bb2bad2d1fc191c442ad0388.tar.gz
bcm5719-llvm-7d17010db5971ae7bb2bad2d1fc191c442ad0388.zip
Use only explicit bool conversion operator
The most common (non-buggy) case are where such objects are used as return expressions in bool-returning functions or as boolean function arguments. In those cases I've used (& added if necessary) a named function to provide the equivalent (or sometimes negative, depending on convenient wording) test. DiagnosticBuilder kept its implicit conversion operator owing to the prevalent use of it in return statements. One bug was found in ExprConstant.cpp involving a comparison of two PointerUnions (PointerUnion did not previously have an operator==, so instead both operands were converted to bool & then compared). A test is included in test/SemaCXX/constant-expression-cxx1y.cpp for the fix (adding operator== to PointerUnion in LLVM). llvm-svn: 181869
Diffstat (limited to 'clang/lib/Rewrite')
-rw-r--r--clang/lib/Rewrite/Core/Rewriter.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Rewrite/Core/Rewriter.cpp b/clang/lib/Rewrite/Core/Rewriter.cpp
index c1c6595d162..540e8b27fd0 100644
--- a/clang/lib/Rewrite/Core/Rewriter.cpp
+++ b/clang/lib/Rewrite/Core/Rewriter.cpp
@@ -463,7 +463,7 @@ public:
}
}
- bool ok() { return FileStream; }
+ bool ok() { return FileStream.isValid(); }
raw_ostream &getStream() { return *FileStream; }
private:
OpenPOWER on IntegriCloud