aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamira Bazuzi <bazuzi@google.com>2024-04-19 16:23:43 -0400
committerGitHub <noreply@github.com>2024-04-19 16:23:43 -0400
commitd634b233640dc38cf5f673a9cfcd1fe55124430a (patch)
tree3a4cc41160849219d8cdda38fae4bf9cfa643b2f
parent08163cd9d82690e808c28515523b5fd0923d7b38 (diff)
downloadllvm-d634b233640dc38cf5f673a9cfcd1fe55124430a.zip
llvm-d634b233640dc38cf5f673a9cfcd1fe55124430a.tar.gz
llvm-d634b233640dc38cf5f673a9cfcd1fe55124430a.tar.bz2
[clang][dataflow] Expose getReferencedDecls for a Stmt. (#89444)
-rw-r--r--clang/include/clang/Analysis/FlowSensitive/ASTOps.h3
-rw-r--r--clang/lib/Analysis/FlowSensitive/ASTOps.cpp6
2 files changed, 9 insertions, 0 deletions
diff --git a/clang/include/clang/Analysis/FlowSensitive/ASTOps.h b/clang/include/clang/Analysis/FlowSensitive/ASTOps.h
index f9fd3db..05748f3 100644
--- a/clang/include/clang/Analysis/FlowSensitive/ASTOps.h
+++ b/clang/include/clang/Analysis/FlowSensitive/ASTOps.h
@@ -96,6 +96,9 @@ struct ReferencedDecls {
/// Returns declarations that are declared in or referenced from `FD`.
ReferencedDecls getReferencedDecls(const FunctionDecl &FD);
+/// Returns declarations that are declared in or referenced from `S`.
+ReferencedDecls getReferencedDecls(const Stmt &S);
+
} // namespace dataflow
} // namespace clang
diff --git a/clang/lib/Analysis/FlowSensitive/ASTOps.cpp b/clang/lib/Analysis/FlowSensitive/ASTOps.cpp
index 6f179c1..619bf77 100644
--- a/clang/lib/Analysis/FlowSensitive/ASTOps.cpp
+++ b/clang/lib/Analysis/FlowSensitive/ASTOps.cpp
@@ -261,4 +261,10 @@ ReferencedDecls getReferencedDecls(const FunctionDecl &FD) {
return Result;
}
+ReferencedDecls getReferencedDecls(const Stmt &S) {
+ ReferencedDecls Result;
+ getReferencedDecls(S, Result);
+ return Result;
+}
+
} // namespace clang::dataflow