ProgramPoint.cpp revision 3d7c44e01d568e5d5c0fac9c6ccb3f080157ba19
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
17using namespace clang;
18
19ProgramPointTag::~ProgramPointTag() {}
20
21ProgramPoint 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::PostPurgeDeadSymbolsKind:
40      return PostPurgeDeadSymbols(S, LC, tag);
41  }
42}
43
44SimpleProgramPointTag::SimpleProgramPointTag(StringRef description)
45  : desc(description) {}
46
47StringRef SimpleProgramPointTag::getTagDescription() const {
48  return desc;
49}
50