[clang] d634b23 - [clang][dataflow] Expose getReferencedDecls for a Stmt. (#89444)

via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 19 13:23:47 PDT 2024


Author: Samira Bazuzi
Date: 2024-04-19T16:23:43-04:00
New Revision: d634b233640dc38cf5f673a9cfcd1fe55124430a

URL: https://github.com/llvm/llvm-project/commit/d634b233640dc38cf5f673a9cfcd1fe55124430a
DIFF: https://github.com/llvm/llvm-project/commit/d634b233640dc38cf5f673a9cfcd1fe55124430a.diff

LOG: [clang][dataflow] Expose getReferencedDecls for a Stmt. (#89444)

Added: 
    

Modified: 
    clang/include/clang/Analysis/FlowSensitive/ASTOps.h
    clang/lib/Analysis/FlowSensitive/ASTOps.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Analysis/FlowSensitive/ASTOps.h b/clang/include/clang/Analysis/FlowSensitive/ASTOps.h
index f9fd3db1fb67fc..05748f300a932f 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 6f179c1403b6f5..619bf772bba5ee 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


        


More information about the cfe-commits mailing list