ProgramPoint.cpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. #include "clang/Analysis/ProgramPoint.h"
  15. using namespace clang;
  16. ProgramPointTag::~ProgramPointTag() {}
  17. ProgramPoint ProgramPoint::getProgramPoint(const Stmt *S, ProgramPoint::Kind K,
  18. const LocationContext *LC,
  19. const ProgramPointTag *tag){
  20. switch (K) {
  21. default:
  22. llvm_unreachable("Unhandled ProgramPoint kind");
  23. case ProgramPoint::PreStmtKind:
  24. return PreStmt(S, LC, tag);
  25. case ProgramPoint::PostStmtKind:
  26. return PostStmt(S, LC, tag);
  27. case ProgramPoint::PreLoadKind:
  28. return PreLoad(S, LC, tag);
  29. case ProgramPoint::PostLoadKind:
  30. return PostLoad(S, LC, tag);
  31. case ProgramPoint::PreStoreKind:
  32. return PreStore(S, LC, tag);
  33. case ProgramPoint::PostLValueKind:
  34. return PostLValue(S, LC, tag);
  35. case ProgramPoint::PostStmtPurgeDeadSymbolsKind:
  36. return PostStmtPurgeDeadSymbols(S, LC, tag);
  37. case ProgramPoint::PreStmtPurgeDeadSymbolsKind:
  38. return PreStmtPurgeDeadSymbols(S, LC, tag);
  39. }
  40. }
  41. SimpleProgramPointTag::SimpleProgramPointTag(StringRef MsgProvider,
  42. StringRef Msg)
  43. : Desc((MsgProvider + " : " + Msg).str()) {}
  44. StringRef SimpleProgramPointTag::getTagDescription() const {
  45. return Desc;
  46. }