]> granicus.if.org Git - clang/commit
Use only explicit bool conversion operator
authorDavid Blaikie <dblaikie@gmail.com>
Wed, 15 May 2013 07:37:26 +0000 (07:37 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Wed, 15 May 2013 07:37:26 +0000 (07:37 +0000)
commit7247c88d1e41514a41085f83ebf03dd5220e054a
tree7672e55dc561fa1fb210fc9b219d010995529f4a
parentfcec0c991edbb011a1eeb85d8de836502f799aed
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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181869 91177308-0d34-0410-b5e6-96231b3b80d8
45 files changed:
include/clang/AST/CanonicalType.h
include/clang/AST/DeclFriend.h
include/clang/AST/DeclObjC.h
include/clang/AST/DeclarationName.h
include/clang/AST/ExprCXX.h
include/clang/AST/ExternalASTSource.h
include/clang/AST/NestedNameSpecifier.h
include/clang/AST/StmtIterator.h
include/clang/AST/Type.h
include/clang/AST/TypeLoc.h
include/clang/Analysis/Analyses/FormatString.h
include/clang/Analysis/CFG.h
include/clang/Basic/Diagnostic.h
include/clang/Frontend/ASTUnit.h
include/clang/Frontend/CompilerInstance.h
include/clang/Frontend/FrontendAction.h
include/clang/Lex/HeaderSearch.h
include/clang/Lex/MacroInfo.h
include/clang/Lex/ModuleMap.h
include/clang/Lex/Preprocessor.h
include/clang/Sema/Initialization.h
include/clang/Sema/Ownership.h
include/clang/Sema/Sema.h
include/clang/Sema/TypoCorrection.h
include/clang/Serialization/ASTReader.h
include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
include/clang/StaticAnalyzer/Core/Checker.h
include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
lib/AST/ASTDumper.cpp
lib/AST/ASTImporter.cpp
lib/AST/Decl.cpp
lib/AST/Expr.cpp
lib/AST/ExprConstant.cpp
lib/Analysis/CFG.cpp
lib/CodeGen/CodeGenFunction.h
lib/Lex/HeaderMap.cpp
lib/Lex/PPDirectives.cpp
lib/Lex/PPLexerChange.cpp
lib/Parse/ParseDecl.cpp
lib/Rewrite/Core/Rewriter.cpp
lib/Sema/SemaDeclCXX.cpp
lib/Sema/SemaDeclObjC.cpp
lib/Sema/SemaExpr.cpp
test/SemaCXX/constant-expression-cxx1y.cpp
unittests/Tooling/CompilationDatabaseTest.cpp