AnalysisConsumer.cpp revision 27af04bcca46f8a3374586be1301477f9123f5e1
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 "AnalysisConsumer.h" 15#include "clang/AST/ASTConsumer.h" 16#include "clang/AST/Decl.h" 17#include "clang/AST/DeclCXX.h" 18#include "clang/AST/DeclObjC.h" 19#include "clang/AST/ParentMap.h" 20#include "clang/Analysis/Analyses/LiveVariables.h" 21#include "clang/Analysis/Analyses/UninitializedValues.h" 22#include "clang/Analysis/CFG.h" 23#include "clang/StaticAnalyzer/Frontend/CheckerRegistration.h" 24#include "clang/StaticAnalyzer/Core/CheckerManager.h" 25#include "clang/StaticAnalyzer/Checkers/LocalCheckers.h" 26#include "clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h" 27#include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h" 28#include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h" 29#include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h" 30#include "clang/StaticAnalyzer/Core/PathSensitive/TransferFuncs.h" 31#include "clang/StaticAnalyzer/Core/PathDiagnosticClients.h" 32 33// FIXME: Restructure checker registration. 34#include "../Checkers/ClangSACheckers.h" 35#include "../Checkers/ExperimentalChecks.h" 36#include "../Checkers/InternalChecks.h" 37 38#include "clang/Basic/FileManager.h" 39#include "clang/Basic/SourceManager.h" 40#include "clang/Frontend/AnalyzerOptions.h" 41#include "clang/Lex/Preprocessor.h" 42#include "llvm/Support/raw_ostream.h" 43#include "llvm/Support/Path.h" 44#include "llvm/Support/Program.h" 45#include "llvm/ADT/OwningPtr.h" 46 47using namespace clang; 48using namespace ento; 49 50static ExplodedNode::Auditor* CreateUbiViz(); 51 52//===----------------------------------------------------------------------===// 53// Special PathDiagnosticClients. 54//===----------------------------------------------------------------------===// 55 56static PathDiagnosticClient* 57createPlistHTMLDiagnosticClient(const std::string& prefix, 58 const Preprocessor &PP) { 59 PathDiagnosticClient *PD = 60 createHTMLDiagnosticClient(llvm::sys::path::parent_path(prefix), PP); 61 return createPlistDiagnosticClient(prefix, PP, PD); 62} 63 64//===----------------------------------------------------------------------===// 65// AnalysisConsumer declaration. 66//===----------------------------------------------------------------------===// 67 68namespace { 69 70class AnalysisConsumer : public ASTConsumer { 71public: 72 typedef void (*CodeAction)(AnalysisConsumer &C, AnalysisManager &M, Decl *D); 73 typedef void (*TUAction)(AnalysisConsumer &C, AnalysisManager &M, 74 TranslationUnitDecl &TU); 75 76private: 77 typedef std::vector<CodeAction> Actions; 78 typedef std::vector<TUAction> TUActions; 79 80 Actions FunctionActions; 81 Actions ObjCMethodActions; 82 Actions ObjCImplementationActions; 83 Actions CXXMethodActions; 84 TUActions TranslationUnitActions; // Remove this. 85 86public: 87 ASTContext* Ctx; 88 const Preprocessor &PP; 89 const std::string OutDir; 90 AnalyzerOptions Opts; 91 92 // PD is owned by AnalysisManager. 93 PathDiagnosticClient *PD; 94 95 StoreManagerCreator CreateStoreMgr; 96 ConstraintManagerCreator CreateConstraintMgr; 97 98 llvm::OwningPtr<CheckerManager> checkerMgr; 99 llvm::OwningPtr<AnalysisManager> Mgr; 100 101 AnalysisConsumer(const Preprocessor& pp, 102 const std::string& outdir, 103 const AnalyzerOptions& opts) 104 : Ctx(0), PP(pp), OutDir(outdir), 105 Opts(opts), PD(0) { 106 DigestAnalyzerOptions(); 107 } 108 109 void DigestAnalyzerOptions() { 110 // Create the PathDiagnosticClient. 111 if (!OutDir.empty()) { 112 switch (Opts.AnalysisDiagOpt) { 113 default: 114#define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATEFN, AUTOCREATE) \ 115 case PD_##NAME: PD = CREATEFN(OutDir, PP); break; 116#include "clang/Frontend/Analyses.def" 117 } 118 } else if (Opts.AnalysisDiagOpt == PD_TEXT) { 119 // Create the text client even without a specified output file since 120 // it just uses diagnostic notes. 121 PD = createTextPathDiagnosticClient("", PP); 122 } 123 124 // Create the analyzer component creators. 125 switch (Opts.AnalysisStoreOpt) { 126 default: 127 assert(0 && "Unknown store manager."); 128#define ANALYSIS_STORE(NAME, CMDFLAG, DESC, CREATEFN) \ 129 case NAME##Model: CreateStoreMgr = CREATEFN; break; 130#include "clang/Frontend/Analyses.def" 131 } 132 133 switch (Opts.AnalysisConstraintsOpt) { 134 default: 135 assert(0 && "Unknown store manager."); 136#define ANALYSIS_CONSTRAINTS(NAME, CMDFLAG, DESC, CREATEFN) \ 137 case NAME##Model: CreateConstraintMgr = CREATEFN; break; 138#include "clang/Frontend/Analyses.def" 139 } 140 } 141 142 void DisplayFunction(const Decl *D) { 143 if (!Opts.AnalyzerDisplayProgress) 144 return; 145 146 SourceManager &SM = Mgr->getASTContext().getSourceManager(); 147 PresumedLoc Loc = SM.getPresumedLoc(D->getLocation()); 148 if (Loc.isValid()) { 149 llvm::errs() << "ANALYZE: " << Loc.getFilename(); 150 151 if (isa<FunctionDecl>(D) || isa<ObjCMethodDecl>(D)) { 152 const NamedDecl *ND = cast<NamedDecl>(D); 153 llvm::errs() << ' ' << ND << '\n'; 154 } 155 else if (isa<BlockDecl>(D)) { 156 llvm::errs() << ' ' << "block(line:" << Loc.getLine() << ",col:" 157 << Loc.getColumn() << '\n'; 158 } 159 else if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) { 160 Selector S = MD->getSelector(); 161 llvm::errs() << ' ' << S.getAsString(); 162 } 163 } 164 } 165 166 void addCodeAction(CodeAction action) { 167 FunctionActions.push_back(action); 168 ObjCMethodActions.push_back(action); 169 CXXMethodActions.push_back(action); 170 } 171 172 void addTranslationUnitAction(TUAction action) { 173 TranslationUnitActions.push_back(action); 174 } 175 176 void addObjCImplementationAction(CodeAction action) { 177 ObjCImplementationActions.push_back(action); 178 } 179 180 virtual void Initialize(ASTContext &Context) { 181 Ctx = &Context; 182 checkerMgr.reset(registerCheckers(Opts, PP.getDiagnostics())); 183 Mgr.reset(new AnalysisManager(*Ctx, PP.getDiagnostics(), 184 PP.getLangOptions(), PD, 185 CreateStoreMgr, CreateConstraintMgr, 186 checkerMgr.get(), 187 /* Indexer */ 0, 188 Opts.MaxNodes, Opts.MaxLoop, 189 Opts.VisualizeEGDot, Opts.VisualizeEGUbi, 190 Opts.PurgeDead, Opts.EagerlyAssume, 191 Opts.TrimGraph, Opts.InlineCall, 192 Opts.UnoptimizedCFG, Opts.CFGAddImplicitDtors, 193 Opts.CFGAddInitializers, 194 Opts.EagerlyTrimEGraph)); 195 } 196 197 virtual void HandleTranslationUnit(ASTContext &C); 198 void HandleDeclContext(ASTContext &C, DeclContext *dc); 199 200 void HandleCode(Decl *D, Actions& actions); 201}; 202} // end anonymous namespace 203 204//===----------------------------------------------------------------------===// 205// AnalysisConsumer implementation. 206//===----------------------------------------------------------------------===// 207 208void AnalysisConsumer::HandleDeclContext(ASTContext &C, DeclContext *dc) { 209 for (DeclContext::decl_iterator I = dc->decls_begin(), E = dc->decls_end(); 210 I != E; ++I) { 211 Decl *D = *I; 212 213 switch (D->getKind()) { 214 case Decl::Namespace: { 215 HandleDeclContext(C, cast<NamespaceDecl>(D)); 216 break; 217 } 218 case Decl::CXXConstructor: 219 case Decl::CXXDestructor: 220 case Decl::CXXConversion: 221 case Decl::CXXMethod: 222 case Decl::Function: { 223 FunctionDecl* FD = cast<FunctionDecl>(D); 224 // We skip function template definitions, as their semantics is 225 // only determined when they are instantiated. 226 if (FD->isThisDeclarationADefinition() && 227 !FD->isDependentContext()) { 228 if (!Opts.AnalyzeSpecificFunction.empty() && 229 FD->getDeclName().getAsString() != Opts.AnalyzeSpecificFunction) 230 break; 231 DisplayFunction(FD); 232 HandleCode(FD, FunctionActions); 233 } 234 break; 235 } 236 237 case Decl::ObjCImplementation: { 238 ObjCImplementationDecl* ID = cast<ObjCImplementationDecl>(*I); 239 HandleCode(ID, ObjCImplementationActions); 240 241 for (ObjCImplementationDecl::method_iterator MI = ID->meth_begin(), 242 ME = ID->meth_end(); MI != ME; ++MI) { 243 if ((*MI)->isThisDeclarationADefinition()) { 244 if (!Opts.AnalyzeSpecificFunction.empty() && 245 Opts.AnalyzeSpecificFunction != (*MI)->getSelector().getAsString()) 246 break; 247 DisplayFunction(*MI); 248 HandleCode(*MI, ObjCMethodActions); 249 } 250 } 251 break; 252 } 253 254 default: 255 break; 256 } 257 } 258} 259 260void AnalysisConsumer::HandleTranslationUnit(ASTContext &C) { 261 TranslationUnitDecl *TU = C.getTranslationUnitDecl(); 262 HandleDeclContext(C, TU); 263 264 for (TUActions::iterator I = TranslationUnitActions.begin(), 265 E = TranslationUnitActions.end(); I != E; ++I) { 266 (*I)(*this, *Mgr, *TU); 267 } 268 269 // Explicitly destroy the PathDiagnosticClient. This will flush its output. 270 // FIXME: This should be replaced with something that doesn't rely on 271 // side-effects in PathDiagnosticClient's destructor. This is required when 272 // used with option -disable-free. 273 Mgr.reset(NULL); 274} 275 276static void FindBlocks(DeclContext *D, llvm::SmallVectorImpl<Decl*> &WL) { 277 if (BlockDecl *BD = dyn_cast<BlockDecl>(D)) 278 WL.push_back(BD); 279 280 for (DeclContext::decl_iterator I = D->decls_begin(), E = D->decls_end(); 281 I!=E; ++I) 282 if (DeclContext *DC = dyn_cast<DeclContext>(*I)) 283 FindBlocks(DC, WL); 284} 285 286void AnalysisConsumer::HandleCode(Decl *D, Actions& actions) { 287 288 // Don't run the actions if an error has occured with parsing the file. 289 Diagnostic &Diags = PP.getDiagnostics(); 290 if (Diags.hasErrorOccurred() || Diags.hasFatalErrorOccurred()) 291 return; 292 293 // Don't run the actions on declarations in header files unless 294 // otherwise specified. 295 SourceManager &SM = Ctx->getSourceManager(); 296 SourceLocation SL = SM.getInstantiationLoc(D->getLocation()); 297 if (!Opts.AnalyzeAll && !SM.isFromMainFile(SL)) 298 return; 299 300 // Clear the AnalysisManager of old AnalysisContexts. 301 Mgr->ClearContexts(); 302 303 // Dispatch on the actions. 304 llvm::SmallVector<Decl*, 10> WL; 305 WL.push_back(D); 306 307 if (D->hasBody() && Opts.AnalyzeNestedBlocks) 308 FindBlocks(cast<DeclContext>(D), WL); 309 310 for (Actions::iterator I = actions.begin(), E = actions.end(); I != E; ++I) 311 for (llvm::SmallVectorImpl<Decl*>::iterator WI=WL.begin(), WE=WL.end(); 312 WI != WE; ++WI) 313 (*I)(*this, *Mgr, *WI); 314} 315 316//===----------------------------------------------------------------------===// 317// Analyses 318//===----------------------------------------------------------------------===// 319 320static void ActionWarnDeadStores(AnalysisConsumer &C, AnalysisManager& mgr, 321 Decl *D) { 322 if (LiveVariables *L = mgr.getLiveVariables(D)) { 323 BugReporter BR(mgr); 324 CheckDeadStores(*mgr.getCFG(D), *L, mgr.getParentMap(D), BR); 325 } 326} 327 328static void ActionWarnUninitVals(AnalysisConsumer &C, AnalysisManager& mgr, 329 Decl *D) { 330 if (CFG* c = mgr.getCFG(D)) { 331 CheckUninitializedValues(*c, mgr.getASTContext(), mgr.getDiagnostic()); 332 } 333} 334 335 336static void ActionExprEngine(AnalysisConsumer &C, AnalysisManager& mgr, 337 Decl *D, 338 TransferFuncs* tf) { 339 340 llvm::OwningPtr<TransferFuncs> TF(tf); 341 342 // Construct the analysis engine. We first query for the LiveVariables 343 // information to see if the CFG is valid. 344 // FIXME: Inter-procedural analysis will need to handle invalid CFGs. 345 if (!mgr.getLiveVariables(D)) 346 return; 347 ExprEngine Eng(mgr, TF.take()); 348 349 if (C.Opts.EnableExperimentalInternalChecks) 350 RegisterExperimentalInternalChecks(Eng); 351 352 RegisterAppleChecks(Eng, *D); 353 354 if (C.Opts.EnableExperimentalChecks) 355 RegisterExperimentalChecks(Eng); 356 357 if (C.Opts.ObjCSelfInitCheck && isa<ObjCMethodDecl>(D)) 358 registerObjCSelfInitChecker(Eng); 359 360 // Enable idempotent operation checking if it was explicitly turned on, or if 361 // we are running experimental checks (i.e. everything) 362 if (C.Opts.IdempotentOps || C.Opts.EnableExperimentalChecks 363 || C.Opts.EnableExperimentalInternalChecks) 364 RegisterIdempotentOperationChecker(Eng); 365 366 if (C.Opts.BufferOverflows) 367 RegisterArrayBoundCheckerV2(Eng); 368 369 // Enable AnalyzerStatsChecker if it was given as an argument 370 if (C.Opts.AnalyzerStats) 371 RegisterAnalyzerStatsChecker(Eng); 372 373 // Set the graph auditor. 374 llvm::OwningPtr<ExplodedNode::Auditor> Auditor; 375 if (mgr.shouldVisualizeUbigraph()) { 376 Auditor.reset(CreateUbiViz()); 377 ExplodedNode::SetAuditor(Auditor.get()); 378 } 379 380 // Execute the worklist algorithm. 381 Eng.ExecuteWorkList(mgr.getStackFrame(D, 0), mgr.getMaxNodes()); 382 383 // Release the auditor (if any) so that it doesn't monitor the graph 384 // created BugReporter. 385 ExplodedNode::SetAuditor(0); 386 387 // Visualize the exploded graph. 388 if (mgr.shouldVisualizeGraphviz()) 389 Eng.ViewGraph(mgr.shouldTrimGraph()); 390 391 // Display warnings. 392 Eng.getBugReporter().FlushReports(); 393} 394 395static void ActionObjCMemCheckerAux(AnalysisConsumer &C, AnalysisManager& mgr, 396 Decl *D, bool GCEnabled) { 397 398 TransferFuncs* TF = MakeCFRefCountTF(mgr.getASTContext(), 399 GCEnabled, 400 mgr.getLangOptions()); 401 402 ActionExprEngine(C, mgr, D, TF); 403} 404 405static void ActionObjCMemChecker(AnalysisConsumer &C, AnalysisManager& mgr, 406 Decl *D) { 407 408 switch (mgr.getLangOptions().getGCMode()) { 409 default: 410 assert (false && "Invalid GC mode."); 411 case LangOptions::NonGC: 412 ActionObjCMemCheckerAux(C, mgr, D, false); 413 break; 414 415 case LangOptions::GCOnly: 416 ActionObjCMemCheckerAux(C, mgr, D, true); 417 break; 418 419 case LangOptions::HybridGC: 420 ActionObjCMemCheckerAux(C, mgr, D, false); 421 ActionObjCMemCheckerAux(C, mgr, D, true); 422 break; 423 } 424} 425 426static void ActionDisplayLiveVariables(AnalysisConsumer &C, 427 AnalysisManager& mgr, Decl *D) { 428 if (LiveVariables* L = mgr.getLiveVariables(D)) { 429 L->dumpBlockLiveness(mgr.getSourceManager()); 430 } 431} 432 433static void ActionCFGDump(AnalysisConsumer &C, AnalysisManager& mgr, Decl *D) { 434 if (CFG *cfg = mgr.getCFG(D)) { 435 cfg->dump(mgr.getLangOptions()); 436 } 437} 438 439static void ActionCFGView(AnalysisConsumer &C, AnalysisManager& mgr, Decl *D) { 440 if (CFG *cfg = mgr.getCFG(D)) { 441 cfg->viewCFG(mgr.getLangOptions()); 442 } 443} 444 445static void ActionSecuritySyntacticChecks(AnalysisConsumer &C, 446 AnalysisManager &mgr, Decl *D) { 447 BugReporter BR(mgr); 448 CheckSecuritySyntaxOnly(D, BR); 449} 450 451static void ActionLLVMConventionChecker(AnalysisConsumer &C, 452 AnalysisManager &mgr, 453 TranslationUnitDecl &TU) { 454 BugReporter BR(mgr); 455 CheckLLVMConventions(TU, BR); 456} 457 458static void ActionWarnObjCDealloc(AnalysisConsumer &C, AnalysisManager& mgr, 459 Decl *D) { 460 if (mgr.getLangOptions().getGCMode() == LangOptions::GCOnly) 461 return; 462 BugReporter BR(mgr); 463 CheckObjCDealloc(cast<ObjCImplementationDecl>(D), mgr.getLangOptions(), BR); 464} 465 466static void ActionWarnObjCUnusedIvars(AnalysisConsumer &C, AnalysisManager& mgr, 467 Decl *D) { 468 BugReporter BR(mgr); 469 CheckObjCUnusedIvar(cast<ObjCImplementationDecl>(D), BR); 470} 471 472static void ActionWarnObjCMethSigs(AnalysisConsumer &C, AnalysisManager& mgr, 473 Decl *D) { 474 BugReporter BR(mgr); 475 CheckObjCInstMethSignature(cast<ObjCImplementationDecl>(D), BR); 476} 477 478static void ActionWarnSizeofPointer(AnalysisConsumer &C, AnalysisManager &mgr, 479 Decl *D) { 480 BugReporter BR(mgr); 481 CheckSizeofPointer(D, BR); 482} 483 484//===----------------------------------------------------------------------===// 485// AnalysisConsumer creation. 486//===----------------------------------------------------------------------===// 487 488ASTConsumer* ento::CreateAnalysisConsumer(const Preprocessor& pp, 489 const std::string& OutDir, 490 const AnalyzerOptions& Opts) { 491 llvm::OwningPtr<AnalysisConsumer> C(new AnalysisConsumer(pp, OutDir, Opts)); 492 493 for (unsigned i = 0; i < Opts.AnalysisList.size(); ++i) 494 switch (Opts.AnalysisList[i]) { 495#define ANALYSIS(NAME, CMD, DESC, SCOPE)\ 496 case NAME:\ 497 C->add ## SCOPE ## Action(&Action ## NAME);\ 498 break; 499#include "clang/Frontend/Analyses.def" 500 default: break; 501 } 502 503 // Last, disable the effects of '-Werror' when using the AnalysisConsumer. 504 pp.getDiagnostics().setWarningsAsErrors(false); 505 506 return C.take(); 507} 508 509//===----------------------------------------------------------------------===// 510// Ubigraph Visualization. FIXME: Move to separate file. 511//===----------------------------------------------------------------------===// 512 513namespace { 514 515class UbigraphViz : public ExplodedNode::Auditor { 516 llvm::OwningPtr<llvm::raw_ostream> Out; 517 llvm::sys::Path Dir, Filename; 518 unsigned Cntr; 519 520 typedef llvm::DenseMap<void*,unsigned> VMap; 521 VMap M; 522 523public: 524 UbigraphViz(llvm::raw_ostream* out, llvm::sys::Path& dir, 525 llvm::sys::Path& filename); 526 527 ~UbigraphViz(); 528 529 virtual void AddEdge(ExplodedNode* Src, ExplodedNode* Dst); 530}; 531 532} // end anonymous namespace 533 534static ExplodedNode::Auditor* CreateUbiViz() { 535 std::string ErrMsg; 536 537 llvm::sys::Path Dir = llvm::sys::Path::GetTemporaryDirectory(&ErrMsg); 538 if (!ErrMsg.empty()) 539 return 0; 540 541 llvm::sys::Path Filename = Dir; 542 Filename.appendComponent("llvm_ubi"); 543 Filename.makeUnique(true,&ErrMsg); 544 545 if (!ErrMsg.empty()) 546 return 0; 547 548 llvm::errs() << "Writing '" << Filename.str() << "'.\n"; 549 550 llvm::OwningPtr<llvm::raw_fd_ostream> Stream; 551 Stream.reset(new llvm::raw_fd_ostream(Filename.c_str(), ErrMsg)); 552 553 if (!ErrMsg.empty()) 554 return 0; 555 556 return new UbigraphViz(Stream.take(), Dir, Filename); 557} 558 559void UbigraphViz::AddEdge(ExplodedNode* Src, ExplodedNode* Dst) { 560 561 assert (Src != Dst && "Self-edges are not allowed."); 562 563 // Lookup the Src. If it is a new node, it's a root. 564 VMap::iterator SrcI= M.find(Src); 565 unsigned SrcID; 566 567 if (SrcI == M.end()) { 568 M[Src] = SrcID = Cntr++; 569 *Out << "('vertex', " << SrcID << ", ('color','#00ff00'))\n"; 570 } 571 else 572 SrcID = SrcI->second; 573 574 // Lookup the Dst. 575 VMap::iterator DstI= M.find(Dst); 576 unsigned DstID; 577 578 if (DstI == M.end()) { 579 M[Dst] = DstID = Cntr++; 580 *Out << "('vertex', " << DstID << ")\n"; 581 } 582 else { 583 // We have hit DstID before. Change its style to reflect a cache hit. 584 DstID = DstI->second; 585 *Out << "('change_vertex_style', " << DstID << ", 1)\n"; 586 } 587 588 // Add the edge. 589 *Out << "('edge', " << SrcID << ", " << DstID 590 << ", ('arrow','true'), ('oriented', 'true'))\n"; 591} 592 593UbigraphViz::UbigraphViz(llvm::raw_ostream* out, llvm::sys::Path& dir, 594 llvm::sys::Path& filename) 595 : Out(out), Dir(dir), Filename(filename), Cntr(0) { 596 597 *Out << "('vertex_style_attribute', 0, ('shape', 'icosahedron'))\n"; 598 *Out << "('vertex_style', 1, 0, ('shape', 'sphere'), ('color', '#ffcc66')," 599 " ('size', '1.5'))\n"; 600} 601 602UbigraphViz::~UbigraphViz() { 603 Out.reset(0); 604 llvm::errs() << "Running 'ubiviz' program... "; 605 std::string ErrMsg; 606 llvm::sys::Path Ubiviz = llvm::sys::Program::FindProgramByName("ubiviz"); 607 std::vector<const char*> args; 608 args.push_back(Ubiviz.c_str()); 609 args.push_back(Filename.c_str()); 610 args.push_back(0); 611 612 if (llvm::sys::Program::ExecuteAndWait(Ubiviz, &args[0],0,0,0,0,&ErrMsg)) { 613 llvm::errs() << "Error viewing graph: " << ErrMsg << "\n"; 614 } 615 616 // Delete the directory. 617 Dir.eraseFromDisk(true); 618} 619