<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hello,</div><div><br></div><div><div>Check if your checker is properly registered. You can use the following command to view the registered checkers:</div>$ clang -cc1 -analyzer-checker-help<div>Only some of them will get executed when scan-build is run (If you see your checker listed in scan-build output, it should be executed). </div><div><br></div><div>Are there if statements in your test program? You would see the output only when an if statement is processed.</div><div><br></div><div><div><div></div></div></div></div><div>While developing/debugging a checker, you can use the following command (this will execute only the specified checker):</div><div>$ clang -cc1 -analyze -analyzer-checker=core.StackAddressEscape input.cpp</div><div><br></div><div><div><div>You can print debug messages with:</div><div><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">llvm::</span><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; "><span style="text-decoration: underline; ">errs</span></span><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">()<<</span><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; "><span style="color: rgb(51, 68, 252); ">"Hello"</span></span><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">;</span></div><div><font class="Apple-style-span" face="Monaco"><span class="Apple-style-span" style="font-size: 11px; ">llvm::outs()<<"Hello";<br></span></font><div><div></div></div></div></div></div><div><br></div><div>Cheers,</div><div>Anna.</div><div><div><div><div><br></div><div>On Sep 28, 2011, at 9:48 AM, funceval wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi,<div><br></div><div>How do I find out if my checker has run or not? There doesn't seem to be any option in scan-build that tells us which checkers were run. I tried printing to std::cout, std::cerr but nothing got printed. I tried generating a bug report but that didn't get generated either. But my checker does show up in the list of checkers when I run scan-build. I have even entered the details in Checkers.td. </div>

<div><br></div><div>Here is what I have tried far:</div><div><br></div><div><div>namespace {</div><div>          class ConstantConditionChecker : public Checker<check::PostStmt<IfStmt> >{</div><div>              mutable llvm::OwningPtr<BuiltinBug> BT;</div>

<div>          public:</div><div>                  void checkPostStmt(const IfStmt *ifStmt, CheckerContext &C) const;</div><div>          };</div><div>  }</div><div><br></div><div>  void ConstantConditionChecker::checkPostStmt(const IfStmt *ifStmt, CheckerContext &C) const</div>

<div>  {</div><div>      ASTContext& astContext = C.getASTContext();</div><div>      std::string sbuf;</div><div>      llvm::raw_string_ostream Out(sbuf);</div><div><br></div><div>      ifStmt->getCond()->printPretty(Out, NULL, PrintingPolicy(astContext.getLangOptions()));</div>

<div>      std::cerr << Out.str() << std::endl;</div><div>      std::cout << "Hello\n" << std::endl;</div><div>      std::cerr << "Hello cerr" << std::endl;</div><div>

      if (!BT)</div><div>          BT.reset(new BuiltinBug(Out.str().c_str()));</div><div>      BugReport* R = new BugReport(*BT, BT->getDescription(), C.getPredecessor());</div><div>      R->addRange(ifStmt->getSourceRange());</div>

<div>      C.EmitReport(R);</div><div><br></div><div>  }</div><div><br></div><div>  void ento::registerConstantConditionChecker(CheckerManager &mgr) {</div><div>      mgr.registerChecker<ConstantConditionChecker>();</div>

<div>  }</div></div><div><br></div>
_______________________________________________<br>cfe-dev mailing list<br><a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev<br></blockquote></div><br></div></div></body></html>