[cfe-commits] r86288 - in /cfe/trunk: include/clang/Analysis/PathSensitive/Checkers/DivZeroChecker.h lib/Analysis/DivZeroChecker.cpp lib/Analysis/GRExprEngineInternalChecks.cpp lib/Analysis/GRExprEngineInternalChecks.h
Ted Kremenek
kremenek at apple.com
Fri Nov 6 12:47:51 PST 2009
Author: kremenek
Date: Fri Nov 6 14:47:51 2009
New Revision: 86288
URL: http://llvm.org/viewvc/llvm-project?rev=86288&view=rev
Log:
Make the implementation of DivZeroChecker private.
Removed:
cfe/trunk/include/clang/Analysis/PathSensitive/Checkers/DivZeroChecker.h
Modified:
cfe/trunk/lib/Analysis/DivZeroChecker.cpp
cfe/trunk/lib/Analysis/GRExprEngineInternalChecks.cpp
cfe/trunk/lib/Analysis/GRExprEngineInternalChecks.h
Removed: cfe/trunk/include/clang/Analysis/PathSensitive/Checkers/DivZeroChecker.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/Checkers/DivZeroChecker.h?rev=86287&view=auto
==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/Checkers/DivZeroChecker.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/Checkers/DivZeroChecker.h (removed)
@@ -1,28 +0,0 @@
-//== DivZeroChecker.h - Division by zero checker ----------------*- C++ -*--==//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This defines DivZeroChecker, a builtin check in GRExprEngine that performs
-// checks for division by zeros.
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang/Analysis/PathSensitive/CheckerVisitor.h"
-
-namespace clang {
-
-class DivZeroChecker : public CheckerVisitor<DivZeroChecker> {
- BuiltinBug *BT;
-public:
- DivZeroChecker() : BT(0) {}
-
- static void *getTag();
- void PreVisitBinaryOperator(CheckerContext &C, const BinaryOperator *B);
-};
-
-}
Modified: cfe/trunk/lib/Analysis/DivZeroChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/DivZeroChecker.cpp?rev=86288&r1=86287&r2=86288&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/DivZeroChecker.cpp (original)
+++ cfe/trunk/lib/Analysis/DivZeroChecker.cpp Fri Nov 6 14:47:51 2009
@@ -12,10 +12,25 @@
//
//===----------------------------------------------------------------------===//
-#include "clang/Analysis/PathSensitive/Checkers/DivZeroChecker.h"
+#include "clang/Analysis/PathSensitive/CheckerVisitor.h"
+#include "GRExprEngineInternalChecks.h"
using namespace clang;
+namespace {
+class VISIBILITY_HIDDEN DivZeroChecker : public CheckerVisitor<DivZeroChecker> {
+ BuiltinBug *BT;
+public:
+ DivZeroChecker() : BT(0) {}
+ static void *getTag();
+ void PreVisitBinaryOperator(CheckerContext &C, const BinaryOperator *B);
+};
+} // end anonymous namespace
+
+void clang::RegisterDivZeroChecker(GRExprEngine &Eng) {
+ Eng.registerCheck(new DivZeroChecker());
+}
+
void *DivZeroChecker::getTag() {
static int x;
return &x;
Modified: cfe/trunk/lib/Analysis/GRExprEngineInternalChecks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/GRExprEngineInternalChecks.cpp?rev=86288&r1=86287&r2=86288&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/GRExprEngineInternalChecks.cpp (original)
+++ cfe/trunk/lib/Analysis/GRExprEngineInternalChecks.cpp Fri Nov 6 14:47:51 2009
@@ -17,7 +17,6 @@
#include "clang/Analysis/PathSensitive/GRExprEngine.h"
#include "clang/Analysis/PathSensitive/CheckerVisitor.h"
#include "clang/Analysis/PathSensitive/Checkers/DereferenceChecker.h"
-#include "clang/Analysis/PathSensitive/Checkers/DivZeroChecker.h"
#include "clang/Analysis/PathSensitive/Checkers/BadCallChecker.h"
#include "clang/Analysis/PathSensitive/Checkers/UndefinedArgChecker.h"
#include "clang/Analysis/PathSensitive/Checkers/UndefinedAssignmentChecker.h"
@@ -398,19 +397,22 @@
BR.Register(new NilReceiverStructRet(this));
BR.Register(new NilReceiverLargerThanVoidPtrRet(this));
+ RegisterDivZeroChecker(*this);
+ RegisterReturnStackAddressChecker(*this);
+ RegisterReturnUndefChecker(*this);
+
+ // Note that this must be registered after ReturnStackAddressChecker.
+ RegisterReturnPointerRangeChecker(*this);
+
// The following checks do not need to have their associated BugTypes
// explicitly registered with the BugReporter. If they issue any BugReports,
// their associated BugType will get registered with the BugReporter
// automatically. Note that the check itself is owned by the GRExprEngine
- // object.
- RegisterReturnStackAddressChecker(*this);
- RegisterReturnUndefChecker(*this);
- RegisterReturnPointerRangeChecker(*this);
+ // object.
registerCheck(new AttrNonNullChecker());
registerCheck(new UndefinedArgChecker());
registerCheck(new UndefinedAssignmentChecker());
registerCheck(new BadCallChecker());
- registerCheck(new DivZeroChecker());
registerCheck(new UndefDerefChecker());
registerCheck(new NullDerefChecker());
registerCheck(new UndefSizedVLAChecker());
Modified: cfe/trunk/lib/Analysis/GRExprEngineInternalChecks.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/GRExprEngineInternalChecks.h?rev=86288&r1=86287&r2=86288&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/GRExprEngineInternalChecks.h (original)
+++ cfe/trunk/lib/Analysis/GRExprEngineInternalChecks.h Fri Nov 6 14:47:51 2009
@@ -19,9 +19,10 @@
class GRExprEngine;
-void RegisterReturnStackAddressChecker(GRExprEngine &Eng);
-void RegisterReturnUndefChecker(GRExprEngine &Eng);
+void RegisterDivZeroChecker(GRExprEngine &Eng);
void RegisterReturnPointerRangeChecker(GRExprEngine &Eng);
+void RegisterReturnStackAddressChecker(GRExprEngine &Eng);
+void RegisterReturnUndefChecker(GRExprEngine &Eng);
} // end clang namespace
#endif
More information about the cfe-commits
mailing list