[clang] [analyzer] Add time-trace scopes for high-level analyzer steps (PR #125508)
Gábor Horváth via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 3 09:05:02 PST 2025
================
@@ -49,6 +49,127 @@ LLVM_DUMP_METHOD void ProgramPoint::dump() const {
return printJson(llvm::errs());
}
+const char *ProgramPoint::kindToStr(Kind K) {
+ switch (K) {
+ case BlockEdgeKind:
+ return "BlockEdge";
+ case BlockEntranceKind:
+ return "BlockEntrance";
+ case BlockExitKind:
+ return "BlockExit";
+ case PreStmtKind:
+ return "PreStmt";
+ case PreStmtPurgeDeadSymbolsKind:
+ return "PreStmtPurgeDeadSymbols";
+ case PostStmtPurgeDeadSymbolsKind:
+ return "PostStmtPurgeDeadSymbols";
+ case PostStmtKind:
+ return "PostStmt";
+ case PreLoadKind:
+ return "PreLoad";
+ case PostLoadKind:
+ return "PostLoad";
+ case PreStoreKind:
+ return "PreStore";
+ case PostStoreKind:
+ return "PostStore";
+ case PostConditionKind:
+ return "PostCondition";
+ case PostLValueKind:
+ return "PostLValue";
+ case PostAllocatorCallKind:
+ return "PostAllocatorCall";
+ case PostInitializerKind:
+ return "PostInitializer";
+ case CallEnterKind:
+ return "CallEnter";
+ case CallExitBeginKind:
+ return "CallExitBegin";
+ case CallExitEndKind:
+ return "CallExitEnd";
+ case FunctionExitKind:
+ return "FunctionExit";
+ case PreImplicitCallKind:
+ return "PreImplicitCall";
+ case PostImplicitCallKind:
+ return "PostImplicitCall";
+ case LoopExitKind:
+ return "LoopExit";
+ case EpsilonKind:
+ return "Epsilon";
+ }
+ llvm_unreachable("Unknown ProgramPoint kind");
+}
+
+std::optional<SourceLocation> ProgramPoint::getSourceLocation() const {
+ switch (getKind()) {
+ case BlockEdgeKind:
+ // return castAs<BlockEdge>().getSrc()->getTerminatorStmt()->getBeginLoc();
+ return std::nullopt;
+ case BlockEntranceKind:
+ // return castAs<BlockEntrance>().getBlock()->getLabel()->getBeginLoc();
+ return std::nullopt;
+ case BlockExitKind:
+ // return
+ // castAs<BlockExit>().getBlock()->getTerminatorStmt()->getBeginLoc();
+ return std::nullopt;
+ case PreStmtKind:
+ [[fallthrough]];
----------------
Xazax-hun wrote:
Do we actually need fall through annotations for empty cases? I'd expect the compiler to not warn on those.
https://github.com/llvm/llvm-project/pull/125508
More information about the cfe-commits
mailing list