1f4a2713aSLionel Sambuc //==- ProgramPoint.cpp - Program Points for Path-Sensitive Analysis -*- C++ -*-/
2f4a2713aSLionel Sambuc //
3f4a2713aSLionel Sambuc // The LLVM Compiler Infrastructure
4f4a2713aSLionel Sambuc //
5f4a2713aSLionel Sambuc // This file is distributed under the University of Illinois Open Source
6f4a2713aSLionel Sambuc // License. See LICENSE.TXT for details.
7f4a2713aSLionel Sambuc //
8f4a2713aSLionel Sambuc //===----------------------------------------------------------------------===//
9f4a2713aSLionel Sambuc //
10f4a2713aSLionel Sambuc // This file defines the interface ProgramPoint, which identifies a
11f4a2713aSLionel Sambuc // distinct location in a function.
12f4a2713aSLionel Sambuc //
13f4a2713aSLionel Sambuc //===----------------------------------------------------------------------===//
14f4a2713aSLionel Sambuc
15f4a2713aSLionel Sambuc #include "clang/Analysis/ProgramPoint.h"
16f4a2713aSLionel Sambuc
17f4a2713aSLionel Sambuc using namespace clang;
18f4a2713aSLionel Sambuc
~ProgramPointTag()19f4a2713aSLionel Sambuc ProgramPointTag::~ProgramPointTag() {}
20f4a2713aSLionel Sambuc
getProgramPoint(const Stmt * S,ProgramPoint::Kind K,const LocationContext * LC,const ProgramPointTag * tag)21f4a2713aSLionel Sambuc ProgramPoint ProgramPoint::getProgramPoint(const Stmt *S, ProgramPoint::Kind K,
22f4a2713aSLionel Sambuc const LocationContext *LC,
23f4a2713aSLionel Sambuc const ProgramPointTag *tag){
24f4a2713aSLionel Sambuc switch (K) {
25f4a2713aSLionel Sambuc default:
26f4a2713aSLionel Sambuc llvm_unreachable("Unhandled ProgramPoint kind");
27f4a2713aSLionel Sambuc case ProgramPoint::PreStmtKind:
28f4a2713aSLionel Sambuc return PreStmt(S, LC, tag);
29f4a2713aSLionel Sambuc case ProgramPoint::PostStmtKind:
30f4a2713aSLionel Sambuc return PostStmt(S, LC, tag);
31f4a2713aSLionel Sambuc case ProgramPoint::PreLoadKind:
32f4a2713aSLionel Sambuc return PreLoad(S, LC, tag);
33f4a2713aSLionel Sambuc case ProgramPoint::PostLoadKind:
34f4a2713aSLionel Sambuc return PostLoad(S, LC, tag);
35f4a2713aSLionel Sambuc case ProgramPoint::PreStoreKind:
36f4a2713aSLionel Sambuc return PreStore(S, LC, tag);
37f4a2713aSLionel Sambuc case ProgramPoint::PostLValueKind:
38f4a2713aSLionel Sambuc return PostLValue(S, LC, tag);
39f4a2713aSLionel Sambuc case ProgramPoint::PostStmtPurgeDeadSymbolsKind:
40f4a2713aSLionel Sambuc return PostStmtPurgeDeadSymbols(S, LC, tag);
41f4a2713aSLionel Sambuc case ProgramPoint::PreStmtPurgeDeadSymbolsKind:
42f4a2713aSLionel Sambuc return PreStmtPurgeDeadSymbols(S, LC, tag);
43f4a2713aSLionel Sambuc }
44f4a2713aSLionel Sambuc }
45f4a2713aSLionel Sambuc
SimpleProgramPointTag(StringRef MsgProvider,StringRef Msg)46*0a6a1f1dSLionel Sambuc SimpleProgramPointTag::SimpleProgramPointTag(StringRef MsgProvider,
47*0a6a1f1dSLionel Sambuc StringRef Msg)
48*0a6a1f1dSLionel Sambuc : Desc((MsgProvider + " : " + Msg).str()) {}
49f4a2713aSLionel Sambuc
getTagDescription() const50f4a2713aSLionel Sambuc StringRef SimpleProgramPointTag::getTagDescription() const {
51*0a6a1f1dSLionel Sambuc return Desc;
52f4a2713aSLionel Sambuc }
53