We may query their liveness because they are added to store when passing
argument values.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97562
91177308-0d34-0410-b5e6-
96231b3b80d8
RegisterDecls R(getAnalysisData());
cfg.VisitBlockStmts(R);
+
+ // Register all parameters even if they didn't occur in the function body.
+ if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(AC.getDecl()))
+ for (FunctionDecl::param_const_iterator PI = FD->param_begin(),
+ PE = FD->param_end(); PI != PE; ++PI)
+ getAnalysisData().Register(*PI);
}
//===----------------------------------------------------------------------===//
--- /dev/null
+// RUN: %clang_cc1 -analyze -inline-call -analyzer-store region -analyze-function f2 -verify %s
+
+// Test parameter 'a' is registered to LiveVariables analysis data although it
+// is not referenced in the function body.
+int f1(int a) {
+ return 1;
+}
+
+void f2() {
+ int x;
+ x = f1(1);
+}