clang API Documentation

ProgramPoint.cpp
Go to the documentation of this file.
00001 //==- ProgramPoint.cpp - Program Points for Path-Sensitive Analysis -*- C++ -*-/
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 //  This file defines the interface ProgramPoint, which identifies a
00011 //  distinct location in a function.
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #include "clang/Analysis/ProgramPoint.h"
00016 
00017 using namespace clang;
00018 
00019 ProgramPointTag::~ProgramPointTag() {}
00020 
00021 ProgramPoint ProgramPoint::getProgramPoint(const Stmt *S, ProgramPoint::Kind K,
00022                                            const LocationContext *LC,
00023                                            const ProgramPointTag *tag){
00024   switch (K) {
00025     default:
00026       llvm_unreachable("Unhandled ProgramPoint kind");
00027     case ProgramPoint::PreStmtKind:
00028       return PreStmt(S, LC, tag);
00029     case ProgramPoint::PostStmtKind:
00030       return PostStmt(S, LC, tag);
00031     case ProgramPoint::PreLoadKind:
00032       return PreLoad(S, LC, tag);
00033     case ProgramPoint::PostLoadKind:
00034       return PostLoad(S, LC, tag);
00035     case ProgramPoint::PreStoreKind:
00036       return PreStore(S, LC, tag);
00037     case ProgramPoint::PostLValueKind:
00038       return PostLValue(S, LC, tag);
00039     case ProgramPoint::PostStmtPurgeDeadSymbolsKind:
00040       return PostStmtPurgeDeadSymbols(S, LC, tag);
00041     case ProgramPoint::PreStmtPurgeDeadSymbolsKind:
00042       return PreStmtPurgeDeadSymbols(S, LC, tag);
00043   }
00044 }
00045 
00046 SimpleProgramPointTag::SimpleProgramPointTag(StringRef MsgProvider, 
00047                                              StringRef Msg)
00048   : Desc((MsgProvider + " : " + Msg).str()) {}
00049 
00050 StringRef SimpleProgramPointTag::getTagDescription() const {
00051   return Desc;
00052 }