aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Lex/HeaderMap.cpp
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/Lex/HeaderMap.cpp
parent041f1aa3e276fe098af1be43076b0d63ce5a002f (diff)
downloadllvm-7d17010db5971ae7bb2bad2d1fc191c442ad0388.zip
llvm-7d17010db5971ae7bb2bad2d1fc191c442ad0388.tar.gz
llvm-7d17010db5971ae7bb2bad2d1fc191c442ad0388.tar.bz2
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/Lex/HeaderMap.cpp')
-rw-r--r--clang/lib/Lex/HeaderMap.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Lex/HeaderMap.cpp b/clang/lib/Lex/HeaderMap.cpp
index dcf1f0c..478462c 100644
--- a/clang/lib/Lex/HeaderMap.cpp
+++ b/clang/lib/Lex/HeaderMap.cpp
@@ -82,7 +82,7 @@ const HeaderMap *HeaderMap::Create(const FileEntry *FE, FileManager &FM) {
if (FileSize <= sizeof(HMapHeader)) return 0;
OwningPtr<const llvm::MemoryBuffer> FileBuffer(FM.getBufferForFile(FE));
- if (FileBuffer == 0) return 0; // Unreadable file?
+ if (!FileBuffer) return 0; // Unreadable file?
const char *FileStart = FileBuffer->getBufferStart();
// We know the file is at least as big as the header, check it now.