diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
index 2ef306d7b1b24a507976f2de70466016afaf892c..d5eb95193ee3d05d71c8ba3703a6fbcdc9da10df 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
@@ -142,6 +142,21 @@ public:
     Eng.getBugReporter().EmitReport(R);
   }
 
+  /// \brief Get the name of the called function (path-sensitive).
+  StringRef getCalleeName(const CallExpr *CE) {
+    const ProgramState *State = getState();
+    const Expr *Callee = CE->getCallee();
+    SVal L = State->getSVal(Callee);
+
+    const FunctionDecl *funDecl = L.getAsFunctionDecl();
+    if (!funDecl)
+      return StringRef();
+    IdentifierInfo *funI = funDecl->getIdentifier();
+    if (!funI)
+      return StringRef();
+    return funI->getName();
+  }
+
 private:
   ExplodedNode *addTransitionImpl(const ProgramState *State,
                                  bool MarkAsSink,
diff --git a/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp b/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
index 6dc51a4aceba9bcca315a3211050fed0ca725692..c9de38c4a09be493d04ef045eddbfd8e936337aa 100644
--- a/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
@@ -440,16 +440,7 @@ void MacOSKeychainAPIChecker::checkPreStmt(const CallExpr *CE,
 void MacOSKeychainAPIChecker::checkPostStmt(const CallExpr *CE,
                                             CheckerContext &C) const {
   const ProgramState *State = C.getState();
-  const Expr *Callee = CE->getCallee();
-  SVal L = State->getSVal(Callee);
-
-  const FunctionDecl *funDecl = L.getAsFunctionDecl();
-  if (!funDecl)
-    return;
-  IdentifierInfo *funI = funDecl->getIdentifier();
-  if (!funI)
-    return;
-  StringRef funName = funI->getName();
+  StringRef funName = C.getCalleeName(CE);
 
   // If a value has been allocated, add it to the set for tracking.
   unsigned idx = getTrackedFunctionIndex(funName, true);