Changes missed from r245810
llvm-svn: 245811
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp
index 00d7d32..c34126e 100644
--- a/clang/lib/AST/DeclBase.cpp
+++ b/clang/lib/AST/DeclBase.cpp
@@ -268,13 +268,13 @@
bool Decl::isLexicallyWithinFunctionOrMethod() const {
const DeclContext *LDC = getLexicalDeclContext();
- do {
+ while (true) {
if (LDC->isFunctionOrMethod())
return true;
if (!isa<TagDecl>(LDC))
return false;
- LDC = LDC->getParent();
- } while (LDC);
+ LDC = LDC->getLexicalParent();
+ }
return false;
}