From adecec39481f925701e63d7fe3b8bf02dd7ddf01 Mon Sep 17 00:00:00 2001 From: Anna Zaks Date: Fri, 8 Feb 2013 23:55:50 +0000 Subject: [PATCH] [analyzer] Move DefaultBool so that all checkers can share it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174782 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/StaticAnalyzer/Core/Checker.h | 8 ++++++++ .../StaticAnalyzer/Core/PathSensitive/CheckerContext.h | 8 -------- lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp | 7 ------- lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp | 7 ------- 4 files changed, 8 insertions(+), 22 deletions(-) diff --git a/include/clang/StaticAnalyzer/Core/Checker.h b/include/clang/StaticAnalyzer/Core/Checker.h index 82bac7dd07..305ae2579d 100644 --- a/include/clang/StaticAnalyzer/Core/Checker.h +++ b/include/clang/StaticAnalyzer/Core/Checker.h @@ -471,6 +471,14 @@ struct ImplicitNullDerefEvent { BugReporter *BR; }; +/// \brief A helper class which wraps a boolean value set to false by default. +struct DefaultBool { + bool val; + DefaultBool() : val(false) {} + operator bool() const { return val; } + DefaultBool &operator=(bool b) { val = b; return *this; } +}; + } // end ento namespace } // end clang namespace diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h index 42e50abbbe..ce495c9754 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h @@ -303,14 +303,6 @@ private: } }; -/// \brief A helper class which wraps a boolean value set to false by default. -struct DefaultBool { - bool Val; - DefaultBool() : Val(false) {} - operator bool() const { return Val; } - DefaultBool &operator=(bool b) { Val = b; return *this; } -}; - } // end GR namespace } // end clang namespace diff --git a/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp b/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp index 43f1eb7a54..7ef13ab538 100644 --- a/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp +++ b/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp @@ -36,13 +36,6 @@ static bool isArc4RandomAvailable(const ASTContext &Ctx) { } namespace { -struct DefaultBool { - bool val; - DefaultBool() : val(false) {} - operator bool() const { return val; } - DefaultBool &operator=(bool b) { val = b; return *this; } -}; - struct ChecksFilter { DefaultBool check_gets; DefaultBool check_getpw; diff --git a/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp b/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp index e41ecf4b65..6262cb8ef9 100644 --- a/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp @@ -43,13 +43,6 @@ using namespace clang; using namespace ento; namespace { -// TODO: move this somewhere? -struct DefaultBool { - bool val; - DefaultBool() : val(false) {} - operator bool() const { return val; } - DefaultBool &operator=(bool b) { val = b; return *this; } -}; struct ChecksFilter { /// Check for missing invalidation method declarations.