Ted Kremenek | f4381fd | 2008-07-02 00:03:09 +0000 | [diff] [blame] | 1 | //===--- AnalysisConsumer.cpp - ASTConsumer for running Analyses ----------===// |
| 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 | // |
| 10 | // "Meta" ASTConsumer for running different source analyses. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "ASTConsumers.h" |
Ted Kremenek | b35a74a | 2008-07-02 00:44:58 +0000 | [diff] [blame] | 15 | #include "HTMLDiagnostics.h" |
Ted Kremenek | f4381fd | 2008-07-02 00:03:09 +0000 | [diff] [blame] | 16 | #include "clang/AST/ASTConsumer.h" |
| 17 | #include "clang/AST/Decl.h" |
| 18 | #include "clang/AST/DeclObjC.h" |
| 19 | #include "llvm/Support/Compiler.h" |
| 20 | #include "llvm/ADT/ImmutableList.h" |
| 21 | #include "llvm/ADT/OwningPtr.h" |
| 22 | #include "clang/AST/CFG.h" |
| 23 | #include "clang/Analysis/Analyses/LiveVariables.h" |
| 24 | #include "clang/Analysis/PathDiagnostic.h" |
| 25 | #include "clang/Basic/SourceManager.h" |
| 26 | #include "clang/Basic/FileManager.h" |
| 27 | #include "clang/AST/ParentMap.h" |
Ted Kremenek | c095997 | 2008-07-02 21:24:01 +0000 | [diff] [blame^] | 28 | #include "clang/Analysis/PathSensitive/BugReporter.h" |
Ted Kremenek | f4381fd | 2008-07-02 00:03:09 +0000 | [diff] [blame] | 29 | #include "clang/Analysis/Analyses/LiveVariables.h" |
| 30 | #include "clang/Analysis/LocalCheckers.h" |
| 31 | #include "clang/Analysis/PathSensitive/GRTransferFuncs.h" |
| 32 | #include "clang/Analysis/PathSensitive/GRExprEngine.h" |
Ted Kremenek | 34d7734 | 2008-07-02 16:49:11 +0000 | [diff] [blame] | 33 | #include "llvm/Support/Streams.h" |
Ted Kremenek | f4381fd | 2008-07-02 00:03:09 +0000 | [diff] [blame] | 34 | |
| 35 | using namespace clang; |
| 36 | |
| 37 | |
| 38 | //===----------------------------------------------------------------------===// |
| 39 | // Basic type definitions. |
| 40 | //===----------------------------------------------------------------------===// |
| 41 | |
| 42 | namespace { |
| 43 | |
| 44 | class AnalysisManager; |
| 45 | typedef void (*CodeAction)(AnalysisManager& Mgr); |
| 46 | |
| 47 | } // end anonymous namespace |
| 48 | |
| 49 | //===----------------------------------------------------------------------===// |
| 50 | // AnalysisConsumer declaration. |
| 51 | //===----------------------------------------------------------------------===// |
| 52 | |
| 53 | namespace { |
| 54 | |
| 55 | class VISIBILITY_HIDDEN AnalysisConsumer : public ASTConsumer { |
| 56 | typedef llvm::ImmutableList<CodeAction> Actions; |
| 57 | Actions FunctionActions; |
| 58 | Actions ObjCMethodActions; |
| 59 | |
| 60 | Actions::Factory F; |
| 61 | |
| 62 | public: |
| 63 | const bool Visualize; |
| 64 | const bool TrimGraph; |
| 65 | const LangOptions& LOpts; |
| 66 | Diagnostic &Diags; |
| 67 | ASTContext* Ctx; |
| 68 | Preprocessor* PP; |
| 69 | PreprocessorFactory* PPF; |
| 70 | const std::string HTMLDir; |
| 71 | const std::string FName; |
| 72 | llvm::OwningPtr<PathDiagnosticClient> PD; |
| 73 | bool AnalyzeAll; |
| 74 | |
| 75 | AnalysisConsumer(Diagnostic &diags, Preprocessor* pp, |
| 76 | PreprocessorFactory* ppf, |
| 77 | const LangOptions& lopts, |
| 78 | const std::string& fname, |
| 79 | const std::string& htmldir, |
| 80 | bool visualize, bool trim, bool analyzeAll) |
| 81 | : FunctionActions(F.GetEmptyList()), ObjCMethodActions(F.GetEmptyList()), |
| 82 | Visualize(visualize), TrimGraph(trim), LOpts(lopts), Diags(diags), |
| 83 | Ctx(0), PP(pp), PPF(ppf), |
| 84 | HTMLDir(htmldir), |
| 85 | FName(fname), |
| 86 | AnalyzeAll(analyzeAll) {} |
| 87 | |
| 88 | void addCodeAction(CodeAction action) { |
| 89 | FunctionActions = F.Concat(action, FunctionActions); |
| 90 | ObjCMethodActions = F.Concat(action, ObjCMethodActions); |
| 91 | } |
| 92 | |
| 93 | virtual void Initialize(ASTContext &Context) { |
| 94 | Ctx = &Context; |
| 95 | } |
| 96 | |
| 97 | virtual void HandleTopLevelDecl(Decl *D); |
| 98 | void HandleCode(Decl* D, Stmt* Body, Actions actions); |
| 99 | }; |
| 100 | |
| 101 | |
Ted Kremenek | c095997 | 2008-07-02 21:24:01 +0000 | [diff] [blame^] | 102 | class VISIBILITY_HIDDEN AnalysisManager : public BugReporterData { |
Ted Kremenek | f4381fd | 2008-07-02 00:03:09 +0000 | [diff] [blame] | 103 | Decl* D; |
| 104 | Stmt* Body; |
| 105 | AnalysisConsumer& C; |
Ted Kremenek | 34d7734 | 2008-07-02 16:49:11 +0000 | [diff] [blame] | 106 | bool DisplayedFunction; |
Ted Kremenek | f4381fd | 2008-07-02 00:03:09 +0000 | [diff] [blame] | 107 | |
| 108 | llvm::OwningPtr<CFG> cfg; |
| 109 | llvm::OwningPtr<LiveVariables> liveness; |
| 110 | llvm::OwningPtr<ParentMap> PM; |
Ted Kremenek | b35a74a | 2008-07-02 00:44:58 +0000 | [diff] [blame] | 111 | llvm::OwningPtr<PathDiagnosticClient> PD; |
Ted Kremenek | f4381fd | 2008-07-02 00:03:09 +0000 | [diff] [blame] | 112 | |
| 113 | public: |
| 114 | AnalysisManager(AnalysisConsumer& c, Decl* d, Stmt* b) |
Ted Kremenek | 34d7734 | 2008-07-02 16:49:11 +0000 | [diff] [blame] | 115 | : D(d), Body(b), C(c), DisplayedFunction(false) {} |
Ted Kremenek | f4381fd | 2008-07-02 00:03:09 +0000 | [diff] [blame] | 116 | |
| 117 | |
| 118 | Decl* getCodeDecl() const { return D; } |
| 119 | Stmt* getBody() const { return Body; } |
| 120 | |
Ted Kremenek | c095997 | 2008-07-02 21:24:01 +0000 | [diff] [blame^] | 121 | virtual CFG& getCFG() { |
Ted Kremenek | f4381fd | 2008-07-02 00:03:09 +0000 | [diff] [blame] | 122 | if (!cfg) cfg.reset(CFG::buildCFG(getBody())); |
Ted Kremenek | c095997 | 2008-07-02 21:24:01 +0000 | [diff] [blame^] | 123 | return *cfg.get(); |
Ted Kremenek | f4381fd | 2008-07-02 00:03:09 +0000 | [diff] [blame] | 124 | } |
| 125 | |
Ted Kremenek | c095997 | 2008-07-02 21:24:01 +0000 | [diff] [blame^] | 126 | virtual ParentMap& getParentMap() { |
Ted Kremenek | f4381fd | 2008-07-02 00:03:09 +0000 | [diff] [blame] | 127 | if (!PM) PM.reset(new ParentMap(getBody())); |
Ted Kremenek | c095997 | 2008-07-02 21:24:01 +0000 | [diff] [blame^] | 128 | return *PM.get(); |
Ted Kremenek | f4381fd | 2008-07-02 00:03:09 +0000 | [diff] [blame] | 129 | } |
| 130 | |
Ted Kremenek | c095997 | 2008-07-02 21:24:01 +0000 | [diff] [blame^] | 131 | virtual ASTContext& getContext() { |
Ted Kremenek | f4381fd | 2008-07-02 00:03:09 +0000 | [diff] [blame] | 132 | return *C.Ctx; |
| 133 | } |
| 134 | |
Ted Kremenek | c095997 | 2008-07-02 21:24:01 +0000 | [diff] [blame^] | 135 | virtual SourceManager& getSourceManager() { |
Ted Kremenek | 235e031 | 2008-07-02 18:11:29 +0000 | [diff] [blame] | 136 | return getContext().getSourceManager(); |
| 137 | } |
| 138 | |
Ted Kremenek | c095997 | 2008-07-02 21:24:01 +0000 | [diff] [blame^] | 139 | virtual Diagnostic& getDiagnostic() { |
Ted Kremenek | f4381fd | 2008-07-02 00:03:09 +0000 | [diff] [blame] | 140 | return C.Diags; |
| 141 | } |
Ted Kremenek | b35a74a | 2008-07-02 00:44:58 +0000 | [diff] [blame] | 142 | |
| 143 | const LangOptions& getLangOptions() const { |
| 144 | return C.LOpts; |
| 145 | } |
| 146 | |
Ted Kremenek | c095997 | 2008-07-02 21:24:01 +0000 | [diff] [blame^] | 147 | virtual PathDiagnosticClient* getPathDiagnosticClient() { |
Ted Kremenek | b35a74a | 2008-07-02 00:44:58 +0000 | [diff] [blame] | 148 | if (PD.get() == 0 && !C.HTMLDir.empty()) |
| 149 | PD.reset(CreateHTMLDiagnosticClient(C.HTMLDir, C.PP, C.PPF)); |
| 150 | |
| 151 | return PD.get(); |
| 152 | } |
Ted Kremenek | f4381fd | 2008-07-02 00:03:09 +0000 | [diff] [blame] | 153 | |
Ted Kremenek | c095997 | 2008-07-02 21:24:01 +0000 | [diff] [blame^] | 154 | virtual LiveVariables& getLiveVariables() { |
Ted Kremenek | 235e031 | 2008-07-02 18:11:29 +0000 | [diff] [blame] | 155 | if (!liveness) { |
Ted Kremenek | c095997 | 2008-07-02 21:24:01 +0000 | [diff] [blame^] | 156 | liveness.reset(new LiveVariables(getCFG())); |
| 157 | liveness->runOnCFG(getCFG()); |
| 158 | liveness->runOnAllBlocks(getCFG(), 0, true); |
Ted Kremenek | 235e031 | 2008-07-02 18:11:29 +0000 | [diff] [blame] | 159 | } |
Ted Kremenek | c095997 | 2008-07-02 21:24:01 +0000 | [diff] [blame^] | 160 | |
| 161 | return *liveness.get(); |
Ted Kremenek | f4381fd | 2008-07-02 00:03:09 +0000 | [diff] [blame] | 162 | } |
Ted Kremenek | 34d7734 | 2008-07-02 16:49:11 +0000 | [diff] [blame] | 163 | |
| 164 | bool shouldVisualize() const { |
| 165 | return C.Visualize; |
| 166 | } |
| 167 | |
| 168 | bool shouldTrimGraph() const { |
| 169 | return C.TrimGraph; |
| 170 | } |
| 171 | |
| 172 | void DisplayFunction() { |
| 173 | |
| 174 | if (DisplayedFunction) |
| 175 | return; |
| 176 | |
| 177 | DisplayedFunction = true; |
| 178 | |
| 179 | if (FunctionDecl *FD = dyn_cast<FunctionDecl>(getCodeDecl())) { |
| 180 | llvm::cerr << "ANALYZE: " |
| 181 | << getContext().getSourceManager().getSourceName(FD->getLocation()) |
| 182 | << ' ' |
| 183 | << FD->getIdentifier()->getName() |
| 184 | << '\n'; |
| 185 | } |
| 186 | else if (ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(getCodeDecl())) { |
| 187 | llvm::cerr << "ANALYZE (ObjC Method): " |
| 188 | << getContext().getSourceManager().getSourceName(MD->getLocation()) |
| 189 | << " '" |
| 190 | << MD->getSelector().getName() << "'\n"; |
| 191 | } |
| 192 | } |
Ted Kremenek | f4381fd | 2008-07-02 00:03:09 +0000 | [diff] [blame] | 193 | }; |
| 194 | |
| 195 | } // end anonymous namespace |
| 196 | |
| 197 | namespace llvm { |
| 198 | template <> struct FoldingSetTrait<CodeAction> { |
| 199 | static inline void Profile(CodeAction X, FoldingSetNodeID& ID) { |
| 200 | ID.AddPointer(reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(X))); |
| 201 | } |
| 202 | }; |
| 203 | } |
| 204 | |
| 205 | //===----------------------------------------------------------------------===// |
| 206 | // AnalysisConsumer implementation. |
| 207 | //===----------------------------------------------------------------------===// |
| 208 | |
| 209 | void AnalysisConsumer::HandleTopLevelDecl(Decl *D) { |
| 210 | switch (D->getKind()) { |
| 211 | case Decl::Function: { |
| 212 | FunctionDecl* FD = cast<FunctionDecl>(D); |
Ted Kremenek | 235e031 | 2008-07-02 18:11:29 +0000 | [diff] [blame] | 213 | |
| 214 | if (FName.size() > 0 && FName != FD->getIdentifier()->getName()) |
| 215 | break; |
| 216 | |
Ted Kremenek | f4381fd | 2008-07-02 00:03:09 +0000 | [diff] [blame] | 217 | Stmt* Body = FD->getBody(); |
| 218 | if (Body) HandleCode(FD, Body, FunctionActions); |
| 219 | break; |
| 220 | } |
| 221 | |
| 222 | case Decl::ObjCMethod: { |
| 223 | ObjCMethodDecl* MD = cast<ObjCMethodDecl>(D); |
Ted Kremenek | 235e031 | 2008-07-02 18:11:29 +0000 | [diff] [blame] | 224 | |
| 225 | if (FName.size() > 0 && FName != MD->getSelector().getName()) |
| 226 | return; |
| 227 | |
Ted Kremenek | f4381fd | 2008-07-02 00:03:09 +0000 | [diff] [blame] | 228 | Stmt* Body = MD->getBody(); |
| 229 | if (Body) HandleCode(MD, Body, ObjCMethodActions); |
| 230 | break; |
| 231 | } |
| 232 | |
| 233 | default: |
| 234 | break; |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | void AnalysisConsumer::HandleCode(Decl* D, Stmt* Body, Actions actions) { |
| 239 | |
| 240 | // Don't run the actions if an error has occured with parsing the file. |
| 241 | if (Diags.hasErrorOccurred()) |
| 242 | return; |
| 243 | |
| 244 | SourceLocation Loc = D->getLocation(); |
| 245 | |
| 246 | // Only run actions on declarations defined in actual source. |
| 247 | if (!Loc.isFileID()) |
| 248 | return; |
| 249 | |
| 250 | // Don't run the actions on declarations in header files unless |
| 251 | // otherwise specified. |
| 252 | if (!AnalyzeAll && !Ctx->getSourceManager().isFromMainFile(Loc)) |
| 253 | return; |
| 254 | |
| 255 | // Create an AnalysisManager that will manage the state for analyzing |
| 256 | // this method/function. |
| 257 | AnalysisManager mgr(*this, D, Body); |
| 258 | |
| 259 | // Dispatch on the actions. |
Ted Kremenek | c095997 | 2008-07-02 21:24:01 +0000 | [diff] [blame^] | 260 | for (Actions::iterator I = actions.begin(), |
Ted Kremenek | f4381fd | 2008-07-02 00:03:09 +0000 | [diff] [blame] | 261 | E = actions.end(); I != E; ++I) |
| 262 | ((*I).getHead())(mgr); |
| 263 | } |
| 264 | |
| 265 | //===----------------------------------------------------------------------===// |
| 266 | // Analyses |
| 267 | //===----------------------------------------------------------------------===// |
| 268 | |
| 269 | static void ActionDeadStores(AnalysisManager& mgr) { |
Ted Kremenek | c095997 | 2008-07-02 21:24:01 +0000 | [diff] [blame^] | 270 | CheckDeadStores(mgr.getCFG(), mgr.getContext(), |
| 271 | mgr.getLiveVariables(), mgr.getParentMap(), |
Ted Kremenek | f4381fd | 2008-07-02 00:03:09 +0000 | [diff] [blame] | 272 | mgr.getDiagnostic()); |
| 273 | } |
| 274 | |
| 275 | static void ActionUninitVals(AnalysisManager& mgr) { |
Ted Kremenek | c095997 | 2008-07-02 21:24:01 +0000 | [diff] [blame^] | 276 | CheckUninitializedValues(mgr.getCFG(), mgr.getContext(), |
Ted Kremenek | f4381fd | 2008-07-02 00:03:09 +0000 | [diff] [blame] | 277 | mgr.getDiagnostic()); |
| 278 | } |
| 279 | |
Ted Kremenek | b35a74a | 2008-07-02 00:44:58 +0000 | [diff] [blame] | 280 | |
Ted Kremenek | bc46f34 | 2008-07-02 16:35:50 +0000 | [diff] [blame] | 281 | static void ActionGRExprEngine(AnalysisManager& mgr, GRTransferFuncs* tf) { |
Ted Kremenek | b35a74a | 2008-07-02 00:44:58 +0000 | [diff] [blame] | 282 | |
Ted Kremenek | bc46f34 | 2008-07-02 16:35:50 +0000 | [diff] [blame] | 283 | llvm::OwningPtr<GRTransferFuncs> TF(tf); |
| 284 | |
Ted Kremenek | 34d7734 | 2008-07-02 16:49:11 +0000 | [diff] [blame] | 285 | // Display progress. |
| 286 | if (!mgr.shouldVisualize()) |
| 287 | mgr.DisplayFunction(); |
| 288 | |
Ted Kremenek | bc46f34 | 2008-07-02 16:35:50 +0000 | [diff] [blame] | 289 | // Construct the analysis engine. |
Ted Kremenek | c095997 | 2008-07-02 21:24:01 +0000 | [diff] [blame^] | 290 | GRExprEngine Eng(mgr.getCFG(), *mgr.getCodeDecl(), mgr.getContext(), |
| 291 | mgr.getLiveVariables()); |
Ted Kremenek | bc46f34 | 2008-07-02 16:35:50 +0000 | [diff] [blame] | 292 | Eng.setTransferFunctions(tf); |
| 293 | |
Ted Kremenek | b35a74a | 2008-07-02 00:44:58 +0000 | [diff] [blame] | 294 | // Execute the worklist algorithm. |
| 295 | Eng.ExecuteWorkList(); |
Ted Kremenek | bc46f34 | 2008-07-02 16:35:50 +0000 | [diff] [blame] | 296 | |
Ted Kremenek | b35a74a | 2008-07-02 00:44:58 +0000 | [diff] [blame] | 297 | // Display warnings. |
Ted Kremenek | c095997 | 2008-07-02 21:24:01 +0000 | [diff] [blame^] | 298 | Eng.EmitWarnings(mgr); |
Ted Kremenek | 34d7734 | 2008-07-02 16:49:11 +0000 | [diff] [blame] | 299 | |
| 300 | // Visualize the exploded graph. |
| 301 | if (mgr.shouldVisualize()) |
| 302 | Eng.ViewGraph(mgr.shouldTrimGraph()); |
Ted Kremenek | bc46f34 | 2008-07-02 16:35:50 +0000 | [diff] [blame] | 303 | } |
| 304 | |
| 305 | static void ActionRefLeakCheckerAux(AnalysisManager& mgr, bool GCEnabled, |
| 306 | bool StandardWarnings) { |
| 307 | |
| 308 | GRTransferFuncs* TF = MakeCFRefCountTF(mgr.getContext(), |
| 309 | GCEnabled, |
| 310 | StandardWarnings, |
| 311 | mgr.getLangOptions()); |
| 312 | |
| 313 | ActionGRExprEngine(mgr, TF); |
Ted Kremenek | b35a74a | 2008-07-02 00:44:58 +0000 | [diff] [blame] | 314 | } |
| 315 | |
| 316 | static void ActionRefLeakChecker(AnalysisManager& mgr) { |
| 317 | |
| 318 | switch (mgr.getLangOptions().getGCMode()) { |
| 319 | default: |
| 320 | assert (false && "Invalid GC mode."); |
| 321 | case LangOptions::NonGC: |
| 322 | ActionRefLeakCheckerAux(mgr, false, true); |
| 323 | break; |
| 324 | |
| 325 | case LangOptions::GCOnly: |
| 326 | ActionRefLeakCheckerAux(mgr, true, true); |
| 327 | break; |
| 328 | |
| 329 | case LangOptions::HybridGC: |
| 330 | ActionRefLeakCheckerAux(mgr, false, true); |
| 331 | ActionRefLeakCheckerAux(mgr, true, false); |
| 332 | break; |
| 333 | } |
| 334 | } |
| 335 | |
Ted Kremenek | bc46f34 | 2008-07-02 16:35:50 +0000 | [diff] [blame] | 336 | static void ActionSimpleChecks(AnalysisManager& mgr) { |
| 337 | ActionGRExprEngine(mgr, MakeGRSimpleValsTF()); |
| 338 | } |
| 339 | |
Ted Kremenek | 235e031 | 2008-07-02 18:11:29 +0000 | [diff] [blame] | 340 | static void ActionLiveness(AnalysisManager& mgr) { |
| 341 | mgr.DisplayFunction(); |
Ted Kremenek | c095997 | 2008-07-02 21:24:01 +0000 | [diff] [blame^] | 342 | mgr.getLiveVariables().dumpBlockLiveness(mgr.getSourceManager()); |
Ted Kremenek | 235e031 | 2008-07-02 18:11:29 +0000 | [diff] [blame] | 343 | } |
| 344 | |
Ted Kremenek | 902141f | 2008-07-02 18:23:21 +0000 | [diff] [blame] | 345 | static void ActionCFGDump(AnalysisManager& mgr) { |
| 346 | mgr.DisplayFunction(); |
Ted Kremenek | c095997 | 2008-07-02 21:24:01 +0000 | [diff] [blame^] | 347 | mgr.getCFG().dump(); |
Ted Kremenek | 902141f | 2008-07-02 18:23:21 +0000 | [diff] [blame] | 348 | } |
| 349 | |
| 350 | static void ActionCFGView(AnalysisManager& mgr) { |
| 351 | mgr.DisplayFunction(); |
Ted Kremenek | c095997 | 2008-07-02 21:24:01 +0000 | [diff] [blame^] | 352 | mgr.getCFG().viewCFG(); |
Ted Kremenek | 902141f | 2008-07-02 18:23:21 +0000 | [diff] [blame] | 353 | } |
| 354 | |
Ted Kremenek | f4381fd | 2008-07-02 00:03:09 +0000 | [diff] [blame] | 355 | //===----------------------------------------------------------------------===// |
| 356 | // AnalysisConsumer creation. |
| 357 | //===----------------------------------------------------------------------===// |
| 358 | |
| 359 | ASTConsumer* clang::CreateAnalysisConsumer(Analyses* Beg, Analyses* End, |
| 360 | Diagnostic &diags, Preprocessor* pp, |
| 361 | PreprocessorFactory* ppf, |
| 362 | const LangOptions& lopts, |
| 363 | const std::string& fname, |
| 364 | const std::string& htmldir, |
| 365 | bool visualize, bool trim, |
| 366 | bool analyzeAll) { |
| 367 | |
| 368 | llvm::OwningPtr<AnalysisConsumer> |
| 369 | C(new AnalysisConsumer(diags, pp, ppf, lopts, fname, htmldir, |
| 370 | visualize, trim, analyzeAll)); |
| 371 | |
| 372 | for ( ; Beg != End ; ++Beg) |
| 373 | switch (*Beg) { |
| 374 | case WarnDeadStores: |
| 375 | C->addCodeAction(&ActionDeadStores); |
| 376 | break; |
| 377 | |
| 378 | case WarnUninitVals: |
| 379 | C->addCodeAction(&ActionUninitVals); |
| 380 | break; |
Ted Kremenek | 235e031 | 2008-07-02 18:11:29 +0000 | [diff] [blame] | 381 | |
| 382 | case DisplayLiveVariables: |
| 383 | C->addCodeAction(&ActionLiveness); |
| 384 | break; |
Ted Kremenek | f4381fd | 2008-07-02 00:03:09 +0000 | [diff] [blame] | 385 | |
Ted Kremenek | b35a74a | 2008-07-02 00:44:58 +0000 | [diff] [blame] | 386 | case CheckerCFRef: |
| 387 | C->addCodeAction(&ActionRefLeakChecker); |
| 388 | break; |
| 389 | |
Ted Kremenek | bc46f34 | 2008-07-02 16:35:50 +0000 | [diff] [blame] | 390 | case CheckerSimple: |
| 391 | C->addCodeAction(&ActionSimpleChecks); |
| 392 | break; |
| 393 | |
Ted Kremenek | 902141f | 2008-07-02 18:23:21 +0000 | [diff] [blame] | 394 | case CFGDump: |
| 395 | C->addCodeAction(&ActionCFGDump); |
| 396 | break; |
| 397 | |
| 398 | case CFGView: |
| 399 | C->addCodeAction(&ActionCFGView); |
| 400 | break; |
| 401 | |
Ted Kremenek | f4381fd | 2008-07-02 00:03:09 +0000 | [diff] [blame] | 402 | default: break; |
| 403 | } |
| 404 | |
| 405 | return C.take(); |
| 406 | } |
| 407 | |