As suggested by Argyrios, revert r76159 and make "FindImmediateParent"
a public static method of ASTLocation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76166 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Index/ASTLocation.cpp b/lib/Index/ASTLocation.cpp
index 3beff3f..4184605 100644
--- a/lib/Index/ASTLocation.cpp
+++ b/lib/Index/ASTLocation.cpp
@@ -33,7 +33,7 @@
return false;
}
-static Decl *FindImmediateParent(Decl *D, Stmt *Node) {
+Decl *ASTLocation::FindImmediateParent(Decl *D, Stmt *Node) {
assert(D && Node && "Passed null Decl or null Stmt");
if (VarDecl *VD = dyn_cast<VarDecl>(D)) {
@@ -61,16 +61,6 @@
return 0;
}
-ASTLocation::ASTLocation(const Decl *d, const Stmt *stm)
- : D(const_cast<Decl*>(d)), Stm(const_cast<Stmt*>(stm)) {
- if (Stm) {
- Decl *Parent = FindImmediateParent(D, Stm);
- assert(Parent);
- D = Parent;
- }
-}
-
-
bool ASTLocation::isImmediateParent(Decl *D, Stmt *Node) {
assert(D && Node && "Passed null Decl or null Stmt");
return D == FindImmediateParent(D, Node);