Zhongxing Xu | d02174c | 2009-11-24 04:45:44 +0000 | [diff] [blame] | 1 | //===--- CallAndMessageChecker.cpp ------------------------------*- C++ -*--==// |
Zhongxing Xu | 8958fff | 2009-11-03 06:46:03 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
Zhongxing Xu | d02174c | 2009-11-24 04:45:44 +0000 | [diff] [blame] | 10 | // This defines CallAndMessageChecker, a builtin checker that checks for various |
| 11 | // errors of call and objc message expressions. |
Zhongxing Xu | 8958fff | 2009-11-03 06:46:03 +0000 | [diff] [blame] | 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
Argyrios Kyrtzidis | d84f422 | 2011-02-28 01:28:13 +0000 | [diff] [blame] | 15 | #include "ClangSACheckers.h" |
Chandler Carruth | 55fc873 | 2012-12-04 09:13:33 +0000 | [diff] [blame] | 16 | #include "clang/AST/ParentMap.h" |
| 17 | #include "clang/Basic/TargetInfo.h" |
| 18 | #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h" |
Argyrios Kyrtzidis | ec8605f | 2011-03-01 01:16:21 +0000 | [diff] [blame] | 19 | #include "clang/StaticAnalyzer/Core/Checker.h" |
Argyrios Kyrtzidis | d84f422 | 2011-02-28 01:28:13 +0000 | [diff] [blame] | 20 | #include "clang/StaticAnalyzer/Core/CheckerManager.h" |
Jordan Rose | f540c54 | 2012-07-26 21:39:41 +0000 | [diff] [blame] | 21 | #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h" |
Argyrios Kyrtzidis | d84f422 | 2011-02-28 01:28:13 +0000 | [diff] [blame] | 22 | #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h" |
Benjamin Kramer | 8fe83e1 | 2012-02-04 13:45:25 +0000 | [diff] [blame] | 23 | #include "llvm/ADT/SmallString.h" |
Benjamin Kramer | a93d0f2 | 2012-12-01 17:12:56 +0000 | [diff] [blame] | 24 | #include "llvm/Support/raw_ostream.h" |
Zhongxing Xu | 8958fff | 2009-11-03 06:46:03 +0000 | [diff] [blame] | 25 | |
| 26 | using namespace clang; |
Ted Kremenek | 9ef6537 | 2010-12-23 07:20:52 +0000 | [diff] [blame] | 27 | using namespace ento; |
Zhongxing Xu | 8958fff | 2009-11-03 06:46:03 +0000 | [diff] [blame] | 28 | |
Ted Kremenek | f493f49 | 2009-11-11 05:50:44 +0000 | [diff] [blame] | 29 | namespace { |
Kovarththanan Rajaratnam | ba5fb5a | 2009-11-28 06:07:30 +0000 | [diff] [blame] | 30 | class CallAndMessageChecker |
Jordan Rose | fe6a011 | 2012-07-02 19:28:21 +0000 | [diff] [blame] | 31 | : public Checker< check::PreStmt<CallExpr>, check::PreObjCMessage, |
| 32 | check::PreCall > { |
Dylan Noblesmith | 6f42b62 | 2012-02-05 02:12:40 +0000 | [diff] [blame] | 33 | mutable OwningPtr<BugType> BT_call_null; |
| 34 | mutable OwningPtr<BugType> BT_call_undef; |
Ted Kremenek | fc999ac | 2012-07-26 00:22:32 +0000 | [diff] [blame] | 35 | mutable OwningPtr<BugType> BT_cxx_call_null; |
| 36 | mutable OwningPtr<BugType> BT_cxx_call_undef; |
Dylan Noblesmith | 6f42b62 | 2012-02-05 02:12:40 +0000 | [diff] [blame] | 37 | mutable OwningPtr<BugType> BT_call_arg; |
| 38 | mutable OwningPtr<BugType> BT_msg_undef; |
Ted Kremenek | b673a41 | 2012-02-18 20:53:30 +0000 | [diff] [blame] | 39 | mutable OwningPtr<BugType> BT_objc_prop_undef; |
Jordan Rose | 8919e68 | 2012-07-18 21:59:51 +0000 | [diff] [blame] | 40 | mutable OwningPtr<BugType> BT_objc_subscript_undef; |
Dylan Noblesmith | 6f42b62 | 2012-02-05 02:12:40 +0000 | [diff] [blame] | 41 | mutable OwningPtr<BugType> BT_msg_arg; |
| 42 | mutable OwningPtr<BugType> BT_msg_ret; |
Pavel Labath | 37926da | 2013-06-19 08:19:56 +0000 | [diff] [blame^] | 43 | mutable OwningPtr<BugType> BT_call_few_args; |
Ted Kremenek | f493f49 | 2009-11-11 05:50:44 +0000 | [diff] [blame] | 44 | public: |
Zhongxing Xu | 2055eff | 2009-11-24 07:06:39 +0000 | [diff] [blame] | 45 | |
Argyrios Kyrtzidis | d84f422 | 2011-02-28 01:28:13 +0000 | [diff] [blame] | 46 | void checkPreStmt(const CallExpr *CE, CheckerContext &C) const; |
Jordan Rose | de507ea | 2012-07-02 19:28:04 +0000 | [diff] [blame] | 47 | void checkPreObjCMessage(const ObjCMethodCall &msg, CheckerContext &C) const; |
Jordan Rose | fe6a011 | 2012-07-02 19:28:21 +0000 | [diff] [blame] | 48 | void checkPreCall(const CallEvent &Call, CheckerContext &C) const; |
Ted Kremenek | fee96e0 | 2009-11-24 21:41:28 +0000 | [diff] [blame] | 49 | |
Ted Kremenek | c79d7d4 | 2009-11-21 01:25:37 +0000 | [diff] [blame] | 50 | private: |
Jordan Rose | fe6a011 | 2012-07-02 19:28:21 +0000 | [diff] [blame] | 51 | static bool PreVisitProcessArg(CheckerContext &C, SVal V, |
| 52 | SourceRange argRange, const Expr *argEx, |
Jordan Rose | 8919e68 | 2012-07-18 21:59:51 +0000 | [diff] [blame] | 53 | bool IsFirstArgument, bool checkUninitFields, |
| 54 | const CallEvent &Call, OwningPtr<BugType> &BT); |
Ted Kremenek | 8133716 | 2010-03-18 03:22:29 +0000 | [diff] [blame] | 55 | |
Jordan Rose | 9da59a6 | 2012-08-03 23:08:49 +0000 | [diff] [blame] | 56 | static void emitBadCall(BugType *BT, CheckerContext &C, const Expr *BadE); |
Jordan Rose | de507ea | 2012-07-02 19:28:04 +0000 | [diff] [blame] | 57 | void emitNilReceiverBug(CheckerContext &C, const ObjCMethodCall &msg, |
Argyrios Kyrtzidis | d84f422 | 2011-02-28 01:28:13 +0000 | [diff] [blame] | 58 | ExplodedNode *N) const; |
Ted Kremenek | 091b588 | 2010-03-18 02:17:27 +0000 | [diff] [blame] | 59 | |
Ted Kremenek | 18c66fd | 2011-08-15 22:09:50 +0000 | [diff] [blame] | 60 | void HandleNilReceiver(CheckerContext &C, |
Ted Kremenek | 8bef823 | 2012-01-26 21:29:00 +0000 | [diff] [blame] | 61 | ProgramStateRef state, |
Jordan Rose | de507ea | 2012-07-02 19:28:04 +0000 | [diff] [blame] | 62 | const ObjCMethodCall &msg) const; |
Ted Kremenek | 091b588 | 2010-03-18 02:17:27 +0000 | [diff] [blame] | 63 | |
Dylan Noblesmith | 6f42b62 | 2012-02-05 02:12:40 +0000 | [diff] [blame] | 64 | static void LazyInit_BT(const char *desc, OwningPtr<BugType> &BT) { |
Ted Kremenek | 8133716 | 2010-03-18 03:22:29 +0000 | [diff] [blame] | 65 | if (!BT) |
Argyrios Kyrtzidis | d84f422 | 2011-02-28 01:28:13 +0000 | [diff] [blame] | 66 | BT.reset(new BuiltinBug(desc)); |
Ted Kremenek | 091b588 | 2010-03-18 02:17:27 +0000 | [diff] [blame] | 67 | } |
Ted Kremenek | f493f49 | 2009-11-11 05:50:44 +0000 | [diff] [blame] | 68 | }; |
| 69 | } // end anonymous namespace |
| 70 | |
Jordan Rose | 9da59a6 | 2012-08-03 23:08:49 +0000 | [diff] [blame] | 71 | void CallAndMessageChecker::emitBadCall(BugType *BT, CheckerContext &C, |
| 72 | const Expr *BadE) { |
Ted Kremenek | d048c6e | 2010-12-20 21:19:09 +0000 | [diff] [blame] | 73 | ExplodedNode *N = C.generateSink(); |
Ted Kremenek | c79d7d4 | 2009-11-21 01:25:37 +0000 | [diff] [blame] | 74 | if (!N) |
| 75 | return; |
Ted Kremenek | 091b588 | 2010-03-18 02:17:27 +0000 | [diff] [blame] | 76 | |
Anna Zaks | e172e8b | 2011-08-17 23:00:25 +0000 | [diff] [blame] | 77 | BugReport *R = new BugReport(*BT, BT->getName(), N); |
Jordan Rose | 9da59a6 | 2012-08-03 23:08:49 +0000 | [diff] [blame] | 78 | if (BadE) { |
| 79 | R->addRange(BadE->getSourceRange()); |
Jordan Rose | 44ec3f0 | 2013-01-26 01:28:23 +0000 | [diff] [blame] | 80 | if (BadE->isGLValue()) |
| 81 | BadE = bugreporter::getDerefExpr(BadE); |
Jordan Rose | a1f81bb | 2012-08-28 00:50:51 +0000 | [diff] [blame] | 82 | bugreporter::trackNullOrUndefValue(N, BadE, *R); |
Jordan Rose | 9da59a6 | 2012-08-03 23:08:49 +0000 | [diff] [blame] | 83 | } |
Jordan Rose | 785950e | 2012-11-02 01:53:40 +0000 | [diff] [blame] | 84 | C.emitReport(R); |
Ted Kremenek | c79d7d4 | 2009-11-21 01:25:37 +0000 | [diff] [blame] | 85 | } |
| 86 | |
Benjamin Kramer | da88536 | 2012-09-10 11:57:16 +0000 | [diff] [blame] | 87 | static StringRef describeUninitializedArgumentInCall(const CallEvent &Call, |
| 88 | bool IsFirstArgument) { |
Jordan Rose | 8919e68 | 2012-07-18 21:59:51 +0000 | [diff] [blame] | 89 | switch (Call.getKind()) { |
| 90 | case CE_ObjCMessage: { |
| 91 | const ObjCMethodCall &Msg = cast<ObjCMethodCall>(Call); |
| 92 | switch (Msg.getMessageKind()) { |
| 93 | case OCM_Message: |
| 94 | return "Argument in message expression is an uninitialized value"; |
| 95 | case OCM_PropertyAccess: |
| 96 | assert(Msg.isSetter() && "Getters have no args"); |
| 97 | return "Argument for property setter is an uninitialized value"; |
| 98 | case OCM_Subscript: |
| 99 | if (Msg.isSetter() && IsFirstArgument) |
| 100 | return "Argument for subscript setter is an uninitialized value"; |
| 101 | return "Subscript index is an uninitialized value"; |
| 102 | } |
| 103 | llvm_unreachable("Unknown message kind."); |
| 104 | } |
| 105 | case CE_Block: |
| 106 | return "Block call argument is an uninitialized value"; |
| 107 | default: |
| 108 | return "Function call argument is an uninitialized value"; |
| 109 | } |
| 110 | } |
| 111 | |
Ted Kremenek | 8133716 | 2010-03-18 03:22:29 +0000 | [diff] [blame] | 112 | bool CallAndMessageChecker::PreVisitProcessArg(CheckerContext &C, |
Argyrios Kyrtzidis | 432424d | 2011-01-25 00:03:53 +0000 | [diff] [blame] | 113 | SVal V, SourceRange argRange, |
| 114 | const Expr *argEx, |
Jordan Rose | 8919e68 | 2012-07-18 21:59:51 +0000 | [diff] [blame] | 115 | bool IsFirstArgument, |
| 116 | bool checkUninitFields, |
| 117 | const CallEvent &Call, |
Dylan Noblesmith | 6f42b62 | 2012-02-05 02:12:40 +0000 | [diff] [blame] | 118 | OwningPtr<BugType> &BT) { |
Ted Kremenek | 8133716 | 2010-03-18 03:22:29 +0000 | [diff] [blame] | 119 | if (V.isUndef()) { |
Ted Kremenek | d048c6e | 2010-12-20 21:19:09 +0000 | [diff] [blame] | 120 | if (ExplodedNode *N = C.generateSink()) { |
Jordan Rose | fe6a011 | 2012-07-02 19:28:21 +0000 | [diff] [blame] | 121 | LazyInit_BT("Uninitialized argument value", BT); |
Ted Kremenek | 8133716 | 2010-03-18 03:22:29 +0000 | [diff] [blame] | 122 | |
| 123 | // Generate a report for this bug. |
Jordan Rose | 8919e68 | 2012-07-18 21:59:51 +0000 | [diff] [blame] | 124 | StringRef Desc = describeUninitializedArgumentInCall(Call, |
| 125 | IsFirstArgument); |
| 126 | BugReport *R = new BugReport(*BT, Desc, N); |
Argyrios Kyrtzidis | 432424d | 2011-01-25 00:03:53 +0000 | [diff] [blame] | 127 | R->addRange(argRange); |
| 128 | if (argEx) |
Jordan Rose | a1f81bb | 2012-08-28 00:50:51 +0000 | [diff] [blame] | 129 | bugreporter::trackNullOrUndefValue(N, argEx, *R); |
Jordan Rose | 785950e | 2012-11-02 01:53:40 +0000 | [diff] [blame] | 130 | C.emitReport(R); |
Ted Kremenek | 8133716 | 2010-03-18 03:22:29 +0000 | [diff] [blame] | 131 | } |
| 132 | return true; |
| 133 | } |
| 134 | |
Ted Kremenek | e4d653b | 2012-03-05 23:57:14 +0000 | [diff] [blame] | 135 | if (!checkUninitFields) |
| 136 | return false; |
David Blaikie | 5251abe | 2013-02-20 05:52:05 +0000 | [diff] [blame] | 137 | |
David Blaikie | dc84cd5 | 2013-02-20 22:23:23 +0000 | [diff] [blame] | 138 | if (Optional<nonloc::LazyCompoundVal> LV = |
David Blaikie | 5251abe | 2013-02-20 05:52:05 +0000 | [diff] [blame] | 139 | V.getAs<nonloc::LazyCompoundVal>()) { |
Ted Kremenek | 8133716 | 2010-03-18 03:22:29 +0000 | [diff] [blame] | 140 | |
| 141 | class FindUninitializedField { |
| 142 | public: |
Chris Lattner | 5f9e272 | 2011-07-23 10:55:15 +0000 | [diff] [blame] | 143 | SmallVector<const FieldDecl *, 10> FieldChain; |
Ted Kremenek | 8133716 | 2010-03-18 03:22:29 +0000 | [diff] [blame] | 144 | private: |
Ted Kremenek | 8133716 | 2010-03-18 03:22:29 +0000 | [diff] [blame] | 145 | StoreManager &StoreMgr; |
| 146 | MemRegionManager &MrMgr; |
| 147 | Store store; |
| 148 | public: |
Benjamin Kramer | facde17 | 2012-06-06 17:32:50 +0000 | [diff] [blame] | 149 | FindUninitializedField(StoreManager &storeMgr, |
Ted Kremenek | 8133716 | 2010-03-18 03:22:29 +0000 | [diff] [blame] | 150 | MemRegionManager &mrMgr, Store s) |
Benjamin Kramer | facde17 | 2012-06-06 17:32:50 +0000 | [diff] [blame] | 151 | : StoreMgr(storeMgr), MrMgr(mrMgr), store(s) {} |
Ted Kremenek | 8133716 | 2010-03-18 03:22:29 +0000 | [diff] [blame] | 152 | |
Ted Kremenek | 9697934 | 2011-08-12 20:02:48 +0000 | [diff] [blame] | 153 | bool Find(const TypedValueRegion *R) { |
Zhongxing Xu | 018220c | 2010-08-11 06:10:55 +0000 | [diff] [blame] | 154 | QualType T = R->getValueType(); |
Ted Kremenek | 8133716 | 2010-03-18 03:22:29 +0000 | [diff] [blame] | 155 | if (const RecordType *RT = T->getAsStructureType()) { |
| 156 | const RecordDecl *RD = RT->getDecl()->getDefinition(); |
| 157 | assert(RD && "Referred record has no definition"); |
| 158 | for (RecordDecl::field_iterator I = |
| 159 | RD->field_begin(), E = RD->field_end(); I!=E; ++I) { |
David Blaikie | 581deb3 | 2012-06-06 20:45:41 +0000 | [diff] [blame] | 160 | const FieldRegion *FR = MrMgr.getFieldRegion(*I, R); |
| 161 | FieldChain.push_back(*I); |
David Blaikie | 262bc18 | 2012-04-30 02:36:29 +0000 | [diff] [blame] | 162 | T = I->getType(); |
Ted Kremenek | 8133716 | 2010-03-18 03:22:29 +0000 | [diff] [blame] | 163 | if (T->getAsStructureType()) { |
| 164 | if (Find(FR)) |
| 165 | return true; |
| 166 | } |
| 167 | else { |
Anna Zaks | 1437425 | 2012-01-12 02:22:40 +0000 | [diff] [blame] | 168 | const SVal &V = StoreMgr.getBinding(store, loc::MemRegionVal(FR)); |
Ted Kremenek | 8133716 | 2010-03-18 03:22:29 +0000 | [diff] [blame] | 169 | if (V.isUndef()) |
| 170 | return true; |
| 171 | } |
| 172 | FieldChain.pop_back(); |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | return false; |
| 177 | } |
| 178 | }; |
| 179 | |
| 180 | const LazyCompoundValData *D = LV->getCVData(); |
Benjamin Kramer | facde17 | 2012-06-06 17:32:50 +0000 | [diff] [blame] | 181 | FindUninitializedField F(C.getState()->getStateManager().getStoreManager(), |
Ted Kremenek | c8413fd | 2010-12-02 07:49:45 +0000 | [diff] [blame] | 182 | C.getSValBuilder().getRegionManager(), |
Ted Kremenek | 8133716 | 2010-03-18 03:22:29 +0000 | [diff] [blame] | 183 | D->getStore()); |
| 184 | |
| 185 | if (F.Find(D->getRegion())) { |
Ted Kremenek | d048c6e | 2010-12-20 21:19:09 +0000 | [diff] [blame] | 186 | if (ExplodedNode *N = C.generateSink()) { |
Jordan Rose | 8919e68 | 2012-07-18 21:59:51 +0000 | [diff] [blame] | 187 | LazyInit_BT("Uninitialized argument value", BT); |
Dylan Noblesmith | f7ccbad | 2012-02-05 02:13:05 +0000 | [diff] [blame] | 188 | SmallString<512> Str; |
Ted Kremenek | 8133716 | 2010-03-18 03:22:29 +0000 | [diff] [blame] | 189 | llvm::raw_svector_ostream os(Str); |
| 190 | os << "Passed-by-value struct argument contains uninitialized data"; |
| 191 | |
| 192 | if (F.FieldChain.size() == 1) |
Benjamin Kramer | b8989f2 | 2011-10-14 18:45:37 +0000 | [diff] [blame] | 193 | os << " (e.g., field: '" << *F.FieldChain[0] << "')"; |
Ted Kremenek | 8133716 | 2010-03-18 03:22:29 +0000 | [diff] [blame] | 194 | else { |
| 195 | os << " (e.g., via the field chain: '"; |
| 196 | bool first = true; |
Chris Lattner | 5f9e272 | 2011-07-23 10:55:15 +0000 | [diff] [blame] | 197 | for (SmallVectorImpl<const FieldDecl *>::iterator |
Ted Kremenek | 8133716 | 2010-03-18 03:22:29 +0000 | [diff] [blame] | 198 | DI = F.FieldChain.begin(), DE = F.FieldChain.end(); DI!=DE;++DI){ |
| 199 | if (first) |
| 200 | first = false; |
| 201 | else |
| 202 | os << '.'; |
Benjamin Kramer | b8989f2 | 2011-10-14 18:45:37 +0000 | [diff] [blame] | 203 | os << **DI; |
Ted Kremenek | 8133716 | 2010-03-18 03:22:29 +0000 | [diff] [blame] | 204 | } |
| 205 | os << "')"; |
| 206 | } |
| 207 | |
| 208 | // Generate a report for this bug. |
Anna Zaks | e172e8b | 2011-08-17 23:00:25 +0000 | [diff] [blame] | 209 | BugReport *R = new BugReport(*BT, os.str(), N); |
Argyrios Kyrtzidis | 432424d | 2011-01-25 00:03:53 +0000 | [diff] [blame] | 210 | R->addRange(argRange); |
Ted Kremenek | 8133716 | 2010-03-18 03:22:29 +0000 | [diff] [blame] | 211 | |
| 212 | // FIXME: enhance track back for uninitialized value for arbitrary |
| 213 | // memregions |
Jordan Rose | 785950e | 2012-11-02 01:53:40 +0000 | [diff] [blame] | 214 | C.emitReport(R); |
Ted Kremenek | 8133716 | 2010-03-18 03:22:29 +0000 | [diff] [blame] | 215 | } |
| 216 | return true; |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | return false; |
| 221 | } |
| 222 | |
Argyrios Kyrtzidis | d84f422 | 2011-02-28 01:28:13 +0000 | [diff] [blame] | 223 | void CallAndMessageChecker::checkPreStmt(const CallExpr *CE, |
| 224 | CheckerContext &C) const{ |
Ted Kremenek | 091b588 | 2010-03-18 02:17:27 +0000 | [diff] [blame] | 225 | |
Ted Kremenek | c79d7d4 | 2009-11-21 01:25:37 +0000 | [diff] [blame] | 226 | const Expr *Callee = CE->getCallee()->IgnoreParens(); |
Jordan Rose | 55037cd | 2012-07-02 19:27:46 +0000 | [diff] [blame] | 227 | ProgramStateRef State = C.getState(); |
Ted Kremenek | 5eca482 | 2012-01-06 22:09:28 +0000 | [diff] [blame] | 228 | const LocationContext *LCtx = C.getLocationContext(); |
Jordan Rose | 55037cd | 2012-07-02 19:27:46 +0000 | [diff] [blame] | 229 | SVal L = State->getSVal(Callee, LCtx); |
Ted Kremenek | 091b588 | 2010-03-18 02:17:27 +0000 | [diff] [blame] | 230 | |
Ted Kremenek | c79d7d4 | 2009-11-21 01:25:37 +0000 | [diff] [blame] | 231 | if (L.isUndef()) { |
| 232 | if (!BT_call_undef) |
Argyrios Kyrtzidis | d84f422 | 2011-02-28 01:28:13 +0000 | [diff] [blame] | 233 | BT_call_undef.reset(new BuiltinBug("Called function pointer is an " |
| 234 | "uninitalized pointer value")); |
Jordan Rose | 9da59a6 | 2012-08-03 23:08:49 +0000 | [diff] [blame] | 235 | emitBadCall(BT_call_undef.get(), C, Callee); |
Ted Kremenek | c79d7d4 | 2009-11-21 01:25:37 +0000 | [diff] [blame] | 236 | return; |
| 237 | } |
Ted Kremenek | 091b588 | 2010-03-18 02:17:27 +0000 | [diff] [blame] | 238 | |
Jordan Rose | a869518 | 2012-08-04 01:04:52 +0000 | [diff] [blame] | 239 | ProgramStateRef StNonNull, StNull; |
David Blaikie | 5251abe | 2013-02-20 05:52:05 +0000 | [diff] [blame] | 240 | llvm::tie(StNonNull, StNull) = |
| 241 | State->assume(L.castAs<DefinedOrUnknownSVal>()); |
Jordan Rose | a869518 | 2012-08-04 01:04:52 +0000 | [diff] [blame] | 242 | |
Jordan Rose | a869518 | 2012-08-04 01:04:52 +0000 | [diff] [blame] | 243 | if (StNull && !StNonNull) { |
Ted Kremenek | c79d7d4 | 2009-11-21 01:25:37 +0000 | [diff] [blame] | 244 | if (!BT_call_null) |
Argyrios Kyrtzidis | d84f422 | 2011-02-28 01:28:13 +0000 | [diff] [blame] | 245 | BT_call_null.reset( |
| 246 | new BuiltinBug("Called function pointer is null (null dereference)")); |
Jordan Rose | 9da59a6 | 2012-08-03 23:08:49 +0000 | [diff] [blame] | 247 | emitBadCall(BT_call_null.get(), C, Callee); |
Ted Kremenek | 091b588 | 2010-03-18 02:17:27 +0000 | [diff] [blame] | 248 | } |
Jordan Rose | 7f66085 | 2012-08-15 21:56:23 +0000 | [diff] [blame] | 249 | |
| 250 | C.addTransition(StNonNull); |
Jordan Rose | fe6a011 | 2012-07-02 19:28:21 +0000 | [diff] [blame] | 251 | } |
Ted Kremenek | 091b588 | 2010-03-18 02:17:27 +0000 | [diff] [blame] | 252 | |
Jordan Rose | fe6a011 | 2012-07-02 19:28:21 +0000 | [diff] [blame] | 253 | void CallAndMessageChecker::checkPreCall(const CallEvent &Call, |
| 254 | CheckerContext &C) const { |
Jordan Rose | 7f66085 | 2012-08-15 21:56:23 +0000 | [diff] [blame] | 255 | ProgramStateRef State = C.getState(); |
| 256 | |
Ted Kremenek | fc999ac | 2012-07-26 00:22:32 +0000 | [diff] [blame] | 257 | // If this is a call to a C++ method, check if the callee is null or |
| 258 | // undefined. |
Jordan Rose | 9da59a6 | 2012-08-03 23:08:49 +0000 | [diff] [blame] | 259 | if (const CXXInstanceCall *CC = dyn_cast<CXXInstanceCall>(&Call)) { |
Ted Kremenek | fc999ac | 2012-07-26 00:22:32 +0000 | [diff] [blame] | 260 | SVal V = CC->getCXXThisVal(); |
| 261 | if (V.isUndef()) { |
| 262 | if (!BT_cxx_call_undef) |
| 263 | BT_cxx_call_undef.reset(new BuiltinBug("Called C++ object pointer is " |
| 264 | "uninitialized")); |
Jordan Rose | 9da59a6 | 2012-08-03 23:08:49 +0000 | [diff] [blame] | 265 | emitBadCall(BT_cxx_call_undef.get(), C, CC->getCXXThisExpr()); |
Ted Kremenek | fc999ac | 2012-07-26 00:22:32 +0000 | [diff] [blame] | 266 | return; |
| 267 | } |
Jordan Rose | a869518 | 2012-08-04 01:04:52 +0000 | [diff] [blame] | 268 | |
Jordan Rose | a869518 | 2012-08-04 01:04:52 +0000 | [diff] [blame] | 269 | ProgramStateRef StNonNull, StNull; |
David Blaikie | 5251abe | 2013-02-20 05:52:05 +0000 | [diff] [blame] | 270 | llvm::tie(StNonNull, StNull) = |
| 271 | State->assume(V.castAs<DefinedOrUnknownSVal>()); |
Jordan Rose | a869518 | 2012-08-04 01:04:52 +0000 | [diff] [blame] | 272 | |
Jordan Rose | a869518 | 2012-08-04 01:04:52 +0000 | [diff] [blame] | 273 | if (StNull && !StNonNull) { |
Ted Kremenek | fc999ac | 2012-07-26 00:22:32 +0000 | [diff] [blame] | 274 | if (!BT_cxx_call_null) |
| 275 | BT_cxx_call_null.reset(new BuiltinBug("Called C++ object pointer " |
| 276 | "is null")); |
Jordan Rose | 9da59a6 | 2012-08-03 23:08:49 +0000 | [diff] [blame] | 277 | emitBadCall(BT_cxx_call_null.get(), C, CC->getCXXThisExpr()); |
Ted Kremenek | fc999ac | 2012-07-26 00:22:32 +0000 | [diff] [blame] | 278 | return; |
| 279 | } |
Jordan Rose | 7f66085 | 2012-08-15 21:56:23 +0000 | [diff] [blame] | 280 | |
| 281 | State = StNonNull; |
Ted Kremenek | fc999ac | 2012-07-26 00:22:32 +0000 | [diff] [blame] | 282 | } |
| 283 | |
Pavel Labath | 37926da | 2013-06-19 08:19:56 +0000 | [diff] [blame^] | 284 | const Decl *D = Call.getDecl(); |
| 285 | if (const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(D)) { |
| 286 | // If we have a declaration, we can make sure we pass enough parameters to |
| 287 | // the function. |
| 288 | unsigned Params = FD->getNumParams(); |
| 289 | if (Call.getNumArgs() < Params) { |
| 290 | ExplodedNode *N = C.generateSink(); |
| 291 | if (!N) |
| 292 | return; |
| 293 | |
| 294 | LazyInit_BT("Function call with too few arguments", BT_call_few_args); |
| 295 | |
| 296 | SmallString<512> Str; |
| 297 | llvm::raw_svector_ostream os(Str); |
| 298 | os << "Function taking " << Params << " argument" |
| 299 | << (Params == 1 ? "" : "s") << " is called with less (" |
| 300 | << Call.getNumArgs() << ")"; |
| 301 | |
| 302 | BugReport *R = new BugReport(*BT_call_few_args, os.str(), N); |
| 303 | C.emitReport(R); |
| 304 | } |
| 305 | } |
| 306 | |
Jordan Rose | fe6a011 | 2012-07-02 19:28:21 +0000 | [diff] [blame] | 307 | // Don't check for uninitialized field values in arguments if the |
| 308 | // caller has a body that is available and we have the chance to inline it. |
| 309 | // This is a hack, but is a reasonable compromise betweens sometimes warning |
| 310 | // and sometimes not depending on if we decide to inline a function. |
Jordan Rose | fe6a011 | 2012-07-02 19:28:21 +0000 | [diff] [blame] | 311 | const bool checkUninitFields = |
Ted Kremenek | fc999ac | 2012-07-26 00:22:32 +0000 | [diff] [blame] | 312 | !(C.getAnalysisManager().shouldInlineCall() && (D && D->getBody())); |
Jordan Rose | fe6a011 | 2012-07-02 19:28:21 +0000 | [diff] [blame] | 313 | |
| 314 | OwningPtr<BugType> *BT; |
Jordan Rose | 8919e68 | 2012-07-18 21:59:51 +0000 | [diff] [blame] | 315 | if (isa<ObjCMethodCall>(Call)) |
Jordan Rose | fe6a011 | 2012-07-02 19:28:21 +0000 | [diff] [blame] | 316 | BT = &BT_msg_arg; |
Jordan Rose | 8919e68 | 2012-07-18 21:59:51 +0000 | [diff] [blame] | 317 | else |
Jordan Rose | fe6a011 | 2012-07-02 19:28:21 +0000 | [diff] [blame] | 318 | BT = &BT_call_arg; |
Jordan Rose | fe6a011 | 2012-07-02 19:28:21 +0000 | [diff] [blame] | 319 | |
| 320 | for (unsigned i = 0, e = Call.getNumArgs(); i != e; ++i) |
Jordan Rose | 8919e68 | 2012-07-18 21:59:51 +0000 | [diff] [blame] | 321 | if (PreVisitProcessArg(C, Call.getArgSVal(i), Call.getArgSourceRange(i), |
| 322 | Call.getArgExpr(i), /*IsFirstArgument=*/i == 0, |
| 323 | checkUninitFields, Call, *BT)) |
Jordan Rose | fe6a011 | 2012-07-02 19:28:21 +0000 | [diff] [blame] | 324 | return; |
Jordan Rose | 7f66085 | 2012-08-15 21:56:23 +0000 | [diff] [blame] | 325 | |
| 326 | // If we make it here, record our assumptions about the callee. |
| 327 | C.addTransition(State); |
Ted Kremenek | 64fa858 | 2009-11-21 00:49:41 +0000 | [diff] [blame] | 328 | } |
| 329 | |
Jordan Rose | de507ea | 2012-07-02 19:28:04 +0000 | [diff] [blame] | 330 | void CallAndMessageChecker::checkPreObjCMessage(const ObjCMethodCall &msg, |
Argyrios Kyrtzidis | d84f422 | 2011-02-28 01:28:13 +0000 | [diff] [blame] | 331 | CheckerContext &C) const { |
Jordan Rose | de507ea | 2012-07-02 19:28:04 +0000 | [diff] [blame] | 332 | SVal recVal = msg.getReceiverSVal(); |
| 333 | if (recVal.isUndef()) { |
| 334 | if (ExplodedNode *N = C.generateSink()) { |
| 335 | BugType *BT = 0; |
Jordan Rose | 8919e68 | 2012-07-18 21:59:51 +0000 | [diff] [blame] | 336 | switch (msg.getMessageKind()) { |
| 337 | case OCM_Message: |
Jordan Rose | de507ea | 2012-07-02 19:28:04 +0000 | [diff] [blame] | 338 | if (!BT_msg_undef) |
| 339 | BT_msg_undef.reset(new BuiltinBug("Receiver in message expression " |
| 340 | "is an uninitialized value")); |
| 341 | BT = BT_msg_undef.get(); |
Jordan Rose | 8919e68 | 2012-07-18 21:59:51 +0000 | [diff] [blame] | 342 | break; |
| 343 | case OCM_PropertyAccess: |
| 344 | if (!BT_objc_prop_undef) |
| 345 | BT_objc_prop_undef.reset(new BuiltinBug("Property access on an " |
| 346 | "uninitialized object " |
| 347 | "pointer")); |
| 348 | BT = BT_objc_prop_undef.get(); |
| 349 | break; |
| 350 | case OCM_Subscript: |
| 351 | if (!BT_objc_subscript_undef) |
| 352 | BT_objc_subscript_undef.reset(new BuiltinBug("Subscript access on an " |
| 353 | "uninitialized object " |
| 354 | "pointer")); |
| 355 | BT = BT_objc_subscript_undef.get(); |
| 356 | break; |
Jordan Rose | de507ea | 2012-07-02 19:28:04 +0000 | [diff] [blame] | 357 | } |
Jordan Rose | 8919e68 | 2012-07-18 21:59:51 +0000 | [diff] [blame] | 358 | assert(BT && "Unknown message kind."); |
| 359 | |
Jordan Rose | de507ea | 2012-07-02 19:28:04 +0000 | [diff] [blame] | 360 | BugReport *R = new BugReport(*BT, BT->getName(), N); |
Jordan Rose | 8919e68 | 2012-07-18 21:59:51 +0000 | [diff] [blame] | 361 | const ObjCMessageExpr *ME = msg.getOriginExpr(); |
| 362 | R->addRange(ME->getReceiverRange()); |
Ted Kremenek | 64fa858 | 2009-11-21 00:49:41 +0000 | [diff] [blame] | 363 | |
Jordan Rose | de507ea | 2012-07-02 19:28:04 +0000 | [diff] [blame] | 364 | // FIXME: getTrackNullOrUndefValueVisitor can't handle "super" yet. |
Jordan Rose | 8919e68 | 2012-07-18 21:59:51 +0000 | [diff] [blame] | 365 | if (const Expr *ReceiverE = ME->getInstanceReceiver()) |
Jordan Rose | a1f81bb | 2012-08-28 00:50:51 +0000 | [diff] [blame] | 366 | bugreporter::trackNullOrUndefValue(N, ReceiverE, *R); |
Jordan Rose | 785950e | 2012-11-02 01:53:40 +0000 | [diff] [blame] | 367 | C.emitReport(R); |
Jordan Rose | de507ea | 2012-07-02 19:28:04 +0000 | [diff] [blame] | 368 | } |
| 369 | return; |
| 370 | } else { |
| 371 | // Bifurcate the state into nil and non-nil ones. |
David Blaikie | 5251abe | 2013-02-20 05:52:05 +0000 | [diff] [blame] | 372 | DefinedOrUnknownSVal receiverVal = recVal.castAs<DefinedOrUnknownSVal>(); |
Jordan Rose | de507ea | 2012-07-02 19:28:04 +0000 | [diff] [blame] | 373 | |
| 374 | ProgramStateRef state = C.getState(); |
| 375 | ProgramStateRef notNilState, nilState; |
| 376 | llvm::tie(notNilState, nilState) = state->assume(receiverVal); |
| 377 | |
| 378 | // Handle receiver must be nil. |
| 379 | if (nilState && !notNilState) { |
| 380 | HandleNilReceiver(C, state, msg); |
Ted Kremenek | c79d7d4 | 2009-11-21 01:25:37 +0000 | [diff] [blame] | 381 | return; |
| 382 | } |
Argyrios Kyrtzidis | d84f422 | 2011-02-28 01:28:13 +0000 | [diff] [blame] | 383 | } |
Zhongxing Xu | a46e4d9 | 2009-12-02 05:49:12 +0000 | [diff] [blame] | 384 | } |
Zhongxing Xu | 2055eff | 2009-11-24 07:06:39 +0000 | [diff] [blame] | 385 | |
Ted Kremenek | c8413fd | 2010-12-02 07:49:45 +0000 | [diff] [blame] | 386 | void CallAndMessageChecker::emitNilReceiverBug(CheckerContext &C, |
Jordan Rose | de507ea | 2012-07-02 19:28:04 +0000 | [diff] [blame] | 387 | const ObjCMethodCall &msg, |
Argyrios Kyrtzidis | d84f422 | 2011-02-28 01:28:13 +0000 | [diff] [blame] | 388 | ExplodedNode *N) const { |
Ted Kremenek | 091b588 | 2010-03-18 02:17:27 +0000 | [diff] [blame] | 389 | |
Ted Kremenek | fee96e0 | 2009-11-24 21:41:28 +0000 | [diff] [blame] | 390 | if (!BT_msg_ret) |
Argyrios Kyrtzidis | d84f422 | 2011-02-28 01:28:13 +0000 | [diff] [blame] | 391 | BT_msg_ret.reset( |
Anna Zaks | 841f168 | 2013-04-03 19:28:19 +0000 | [diff] [blame] | 392 | new BuiltinBug("Receiver in message expression is 'nil'")); |
Ted Kremenek | 091b588 | 2010-03-18 02:17:27 +0000 | [diff] [blame] | 393 | |
Jordan Rose | 8919e68 | 2012-07-18 21:59:51 +0000 | [diff] [blame] | 394 | const ObjCMessageExpr *ME = msg.getOriginExpr(); |
| 395 | |
Anna Zaks | 841f168 | 2013-04-03 19:28:19 +0000 | [diff] [blame] | 396 | QualType ResTy = msg.getResultType(); |
| 397 | |
Dylan Noblesmith | f7ccbad | 2012-02-05 02:13:05 +0000 | [diff] [blame] | 398 | SmallString<200> buf; |
Ted Kremenek | fee96e0 | 2009-11-24 21:41:28 +0000 | [diff] [blame] | 399 | llvm::raw_svector_ostream os(buf); |
Jordan Rose | 8919e68 | 2012-07-18 21:59:51 +0000 | [diff] [blame] | 400 | os << "The receiver of message '" << ME->getSelector().getAsString() |
Anna Zaks | 841f168 | 2013-04-03 19:28:19 +0000 | [diff] [blame] | 401 | << "' is nil"; |
| 402 | if (ResTy->isReferenceType()) { |
| 403 | os << ", which results in forming a null reference"; |
| 404 | } else { |
| 405 | os << " and returns a value of type '"; |
| 406 | msg.getResultType().print(os, C.getLangOpts()); |
| 407 | os << "' that will be garbage"; |
| 408 | } |
Ted Kremenek | 091b588 | 2010-03-18 02:17:27 +0000 | [diff] [blame] | 409 | |
Anna Zaks | e172e8b | 2011-08-17 23:00:25 +0000 | [diff] [blame] | 410 | BugReport *report = new BugReport(*BT_msg_ret, os.str(), N); |
Jordan Rose | 8919e68 | 2012-07-18 21:59:51 +0000 | [diff] [blame] | 411 | report->addRange(ME->getReceiverRange()); |
Jordan Rose | de507ea | 2012-07-02 19:28:04 +0000 | [diff] [blame] | 412 | // FIXME: This won't track "self" in messages to super. |
Jordan Rose | 8919e68 | 2012-07-18 21:59:51 +0000 | [diff] [blame] | 413 | if (const Expr *receiver = ME->getInstanceReceiver()) { |
Jordan Rose | a1f81bb | 2012-08-28 00:50:51 +0000 | [diff] [blame] | 414 | bugreporter::trackNullOrUndefValue(N, receiver, *report); |
Douglas Gregor | 04badcf | 2010-04-21 00:45:42 +0000 | [diff] [blame] | 415 | } |
Jordan Rose | 785950e | 2012-11-02 01:53:40 +0000 | [diff] [blame] | 416 | C.emitReport(report); |
Ted Kremenek | fee96e0 | 2009-11-24 21:41:28 +0000 | [diff] [blame] | 417 | } |
| 418 | |
Ted Kremenek | c8413fd | 2010-12-02 07:49:45 +0000 | [diff] [blame] | 419 | static bool supportsNilWithFloatRet(const llvm::Triple &triple) { |
Bob Wilson | 8f1e656 | 2012-01-31 23:52:54 +0000 | [diff] [blame] | 420 | return (triple.getVendor() == llvm::Triple::Apple && |
| 421 | (triple.getOS() == llvm::Triple::IOS || |
| 422 | !triple.isMacOSXVersionLT(10,5))); |
Ted Kremenek | f81330c | 2009-11-24 22:48:18 +0000 | [diff] [blame] | 423 | } |
| 424 | |
Ted Kremenek | fee96e0 | 2009-11-24 21:41:28 +0000 | [diff] [blame] | 425 | void CallAndMessageChecker::HandleNilReceiver(CheckerContext &C, |
Ted Kremenek | 8bef823 | 2012-01-26 21:29:00 +0000 | [diff] [blame] | 426 | ProgramStateRef state, |
Jordan Rose | de507ea | 2012-07-02 19:28:04 +0000 | [diff] [blame] | 427 | const ObjCMethodCall &Msg) const { |
Argyrios Kyrtzidis | 432424d | 2011-01-25 00:03:53 +0000 | [diff] [blame] | 428 | ASTContext &Ctx = C.getASTContext(); |
Anna Zaks | 4a49df3 | 2013-03-27 17:35:58 +0000 | [diff] [blame] | 429 | static SimpleProgramPointTag Tag("CallAndMessageChecker : NilReceiver"); |
Ted Kremenek | 091b588 | 2010-03-18 02:17:27 +0000 | [diff] [blame] | 430 | |
Ted Kremenek | fee96e0 | 2009-11-24 21:41:28 +0000 | [diff] [blame] | 431 | // Check the return type of the message expression. A message to nil will |
| 432 | // return different values depending on the return type and the architecture. |
Jordan Rose | de507ea | 2012-07-02 19:28:04 +0000 | [diff] [blame] | 433 | QualType RetTy = Msg.getResultType(); |
Ted Kremenek | f81330c | 2009-11-24 22:48:18 +0000 | [diff] [blame] | 434 | CanQualType CanRetTy = Ctx.getCanonicalType(RetTy); |
Ted Kremenek | 5eca482 | 2012-01-06 22:09:28 +0000 | [diff] [blame] | 435 | const LocationContext *LCtx = C.getLocationContext(); |
Ted Kremenek | fee96e0 | 2009-11-24 21:41:28 +0000 | [diff] [blame] | 436 | |
Douglas Gregor | fb87b89 | 2010-04-26 21:31:17 +0000 | [diff] [blame] | 437 | if (CanRetTy->isStructureOrClassType()) { |
Ted Kremenek | 4a037c7 | 2011-10-28 19:05:10 +0000 | [diff] [blame] | 438 | // Structure returns are safe since the compiler zeroes them out. |
Jordan Rose | de507ea | 2012-07-02 19:28:04 +0000 | [diff] [blame] | 439 | SVal V = C.getSValBuilder().makeZeroVal(RetTy); |
Anna Zaks | 4a49df3 | 2013-03-27 17:35:58 +0000 | [diff] [blame] | 440 | C.addTransition(state->BindExpr(Msg.getOriginExpr(), LCtx, V), &Tag); |
Ted Kremenek | fee96e0 | 2009-11-24 21:41:28 +0000 | [diff] [blame] | 441 | return; |
| 442 | } |
| 443 | |
Ted Kremenek | 4a037c7 | 2011-10-28 19:05:10 +0000 | [diff] [blame] | 444 | // Other cases: check if sizeof(return type) > sizeof(void*) |
Anna Zaks | a2a8603 | 2011-11-01 22:41:01 +0000 | [diff] [blame] | 445 | if (CanRetTy != Ctx.VoidTy && C.getLocationContext()->getParentMap() |
Jordan Rose | de507ea | 2012-07-02 19:28:04 +0000 | [diff] [blame] | 446 | .isConsumedExpr(Msg.getOriginExpr())) { |
Ted Kremenek | fee96e0 | 2009-11-24 21:41:28 +0000 | [diff] [blame] | 447 | // Compute: sizeof(void *) and sizeof(return type) |
Ted Kremenek | 091b588 | 2010-03-18 02:17:27 +0000 | [diff] [blame] | 448 | const uint64_t voidPtrSize = Ctx.getTypeSize(Ctx.VoidPtrTy); |
Ted Kremenek | f81330c | 2009-11-24 22:48:18 +0000 | [diff] [blame] | 449 | const uint64_t returnTypeSize = Ctx.getTypeSize(CanRetTy); |
Ted Kremenek | fee96e0 | 2009-11-24 21:41:28 +0000 | [diff] [blame] | 450 | |
Anna Zaks | 841f168 | 2013-04-03 19:28:19 +0000 | [diff] [blame] | 451 | if (CanRetTy.getTypePtr()->isReferenceType()|| |
| 452 | (voidPtrSize < returnTypeSize && |
| 453 | !(supportsNilWithFloatRet(Ctx.getTargetInfo().getTriple()) && |
| 454 | (Ctx.FloatTy == CanRetTy || |
| 455 | Ctx.DoubleTy == CanRetTy || |
| 456 | Ctx.LongDoubleTy == CanRetTy || |
| 457 | Ctx.LongLongTy == CanRetTy || |
| 458 | Ctx.UnsignedLongLongTy == CanRetTy)))) { |
Anna Zaks | 4a49df3 | 2013-03-27 17:35:58 +0000 | [diff] [blame] | 459 | if (ExplodedNode *N = C.generateSink(state, 0 , &Tag)) |
Jordan Rose | de507ea | 2012-07-02 19:28:04 +0000 | [diff] [blame] | 460 | emitNilReceiverBug(C, Msg, N); |
Ted Kremenek | fee96e0 | 2009-11-24 21:41:28 +0000 | [diff] [blame] | 461 | return; |
| 462 | } |
| 463 | |
| 464 | // Handle the safe cases where the return value is 0 if the |
| 465 | // receiver is nil. |
| 466 | // |
| 467 | // FIXME: For now take the conservative approach that we only |
| 468 | // return null values if we *know* that the receiver is nil. |
| 469 | // This is because we can have surprises like: |
| 470 | // |
| 471 | // ... = [[NSScreens screens] objectAtIndex:0]; |
| 472 | // |
| 473 | // What can happen is that [... screens] could return nil, but |
| 474 | // it most likely isn't nil. We should assume the semantics |
| 475 | // of this case unless we have *a lot* more knowledge. |
| 476 | // |
Jordan Rose | de507ea | 2012-07-02 19:28:04 +0000 | [diff] [blame] | 477 | SVal V = C.getSValBuilder().makeZeroVal(RetTy); |
Anna Zaks | 4a49df3 | 2013-03-27 17:35:58 +0000 | [diff] [blame] | 478 | C.addTransition(state->BindExpr(Msg.getOriginExpr(), LCtx, V), &Tag); |
Ted Kremenek | fee96e0 | 2009-11-24 21:41:28 +0000 | [diff] [blame] | 479 | return; |
| 480 | } |
Ted Kremenek | 091b588 | 2010-03-18 02:17:27 +0000 | [diff] [blame] | 481 | |
Anna Zaks | 0bd6b11 | 2011-10-26 21:06:34 +0000 | [diff] [blame] | 482 | C.addTransition(state); |
Zhongxing Xu | 8958fff | 2009-11-03 06:46:03 +0000 | [diff] [blame] | 483 | } |
Argyrios Kyrtzidis | d84f422 | 2011-02-28 01:28:13 +0000 | [diff] [blame] | 484 | |
| 485 | void ento::registerCallAndMessageChecker(CheckerManager &mgr) { |
| 486 | mgr.registerChecker<CallAndMessageChecker>(); |
| 487 | } |