1 //==- ProgramPoint.cpp - Program Points for Path-Sensitive Analysis -*- C++ -*-/
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 // This file defines the interface ProgramPoint, which identifies a
11 // distinct location in a function.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #include "clang/Analysis/ProgramPoint.h"
16
17 using namespace clang;
18
~ProgramPointTag()19 ProgramPointTag::~ProgramPointTag() {}
20
getProgramPoint(const Stmt * S,ProgramPoint::Kind K,const LocationContext * LC,const ProgramPointTag * tag)21 ProgramPoint ProgramPoint::getProgramPoint(const Stmt *S, ProgramPoint::Kind K,
22 const LocationContext *LC,
23 const ProgramPointTag *tag){
24 switch (K) {
25 default:
26 llvm_unreachable("Unhandled ProgramPoint kind");
27 case ProgramPoint::PreStmtKind:
28 return PreStmt(S, LC, tag);
29 case ProgramPoint::PostStmtKind:
30 return PostStmt(S, LC, tag);
31 case ProgramPoint::PreLoadKind:
32 return PreLoad(S, LC, tag);
33 case ProgramPoint::PostLoadKind:
34 return PostLoad(S, LC, tag);
35 case ProgramPoint::PreStoreKind:
36 return PreStore(S, LC, tag);
37 case ProgramPoint::PostLValueKind:
38 return PostLValue(S, LC, tag);
39 case ProgramPoint::PostStmtPurgeDeadSymbolsKind:
40 return PostStmtPurgeDeadSymbols(S, LC, tag);
41 case ProgramPoint::PreStmtPurgeDeadSymbolsKind:
42 return PreStmtPurgeDeadSymbols(S, LC, tag);
43 }
44 }
45
SimpleProgramPointTag(StringRef MsgProvider,StringRef Msg)46 SimpleProgramPointTag::SimpleProgramPointTag(StringRef MsgProvider,
47 StringRef Msg)
48 : Desc((MsgProvider + " : " + Msg).str()) {}
49
getTagDescription() const50 StringRef SimpleProgramPointTag::getTagDescription() const {
51 return Desc;
52 }
53