[clang] [analyzer] Add time-trace scopes for high-level analyzer steps (PR #125508)
Arseniy Zaostrovnykh via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 4 06:04:35 PST 2025
================
@@ -119,6 +121,28 @@ class CacheInitializer : public DynamicRecursiveASTVisitor {
Ranges &Result;
};
+std::string timeScopeName(const Decl *DeclWithIssue) {
+ if (!llvm::timeTraceProfilerEnabled())
+ return "";
+ return llvm::formatv(
+ "BugSuppression::isSuppressed init suppressions cache for {0}",
+ DeclWithIssue->getDeclKindName())
+ .str();
+}
+
+llvm::TimeTraceMetadata getDeclTimeTraceMetadata(const Decl *DeclWithIssue) {
+ assert(DeclWithIssue);
+ assert(llvm::timeTraceProfilerEnabled());
+ std::string name = "<noname>";
+ if (auto ND = dyn_cast<NamedDecl>(DeclWithIssue)) {
+ name = ND->getNameAsString();
+ }
+ const auto &SM = DeclWithIssue->getASTContext().getSourceManager();
+ auto line = SM.getPresumedLineNumber(DeclWithIssue->getBeginLoc());
+ auto fname = SM.getFilename(DeclWithIssue->getBeginLoc());
+ return llvm::TimeTraceMetadata{name, fname.str(), static_cast<int>(line)};
----------------
necto wrote:
Moved, thanks
a63907b742f6 [NFC] Move some strings
https://github.com/llvm/llvm-project/pull/125508
More information about the cfe-commits
mailing list