When determining whether we can use "this", make sure to look through
enum contexts (along with block contexts, which we already did). Fixes
PR7196.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104444 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index 5e365de..523b196 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -305,7 +305,7 @@
DeclContext *Sema::getFunctionLevelDeclContext() {
DeclContext *DC = CurContext;
- while (isa<BlockDecl>(DC))
+ while (isa<BlockDecl>(DC) || isa<EnumDecl>(DC))
DC = DC->getParent();
return DC;