]> granicus.if.org Git - clang/commitdiff
Changes missed from r245810
authorSerge Pavlov <sepavloff@gmail.com>
Sun, 23 Aug 2015 11:09:40 +0000 (11:09 +0000)
committerSerge Pavlov <sepavloff@gmail.com>
Sun, 23 Aug 2015 11:09:40 +0000 (11:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245811 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/DeclBase.cpp

index 00d7d323b72b65587d12dbb15bfc06384bfda224..c34126ee18d07889c6a8b81a3a8089b6aaad2376 100644 (file)
@@ -268,13 +268,13 @@ void Decl::setDeclContextsImpl(DeclContext *SemaDC, DeclContext *LexicalDC,
 
 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;
 }