// BugReporterVisitors.cpp - Helpers for reporting bugs -----------*- C++ -*--////// The LLVM Compiler Infrastructure//// This file is distributed under the University of Illinois Open Source// License. See LICENSE.TXT for details.////===----------------------------------------------------------------------===////// This file defines a set of BugReporter "visitors" which can be used to// enhance the diagnostics reported for a bug.////===----------------------------------------------------------------------===//#include"clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h"#include"clang/AST/Expr.h"#include"clang/AST/ExprObjC.h"#include"clang/StaticAnalyzer/Core/BugReporter/BugReporter.h"#include"clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h"#include"clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"#include"clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h"#include"clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h"#include"clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"#include"llvm/ADT/SmallString.h"#include"llvm/ADT/StringExtras.h"#include"llvm/Support/raw_ostream.h"usingnamespaceclang;usingnamespaceento;usingllvm::FoldingSetNodeID;//===----------------------------------------------------------------------===//// Utility functions.//===----------------------------------------------------------------------===//boolbugreporter::isDeclRefExprToReference(constExpr*E){if(constDeclRefExpr*DRE=dyn_cast<DeclRefExpr>(E)){returnDRE->getDecl()->getType()->isReferenceType();}returnfalse;}constExpr*bugreporter::getDerefExpr(constStmt*S){// Pattern match for a few useful cases (do something smarter later):// a[0], p->f, *pconstExpr*E=