zturner created this revision. To be honest I don't really understand anything about this code. I encountered a situation when running `include-what-you-use` against LLVM where `TUScope` was null here, triggering a segfault. Some surrounding comments and code suggests that this variable is specific to Objective C, but I don't really grok whether null is indicative here of an earlier problem or whether it should actually be handled. There are other places in this file where it is checked for null, so there is at least some precedent for it in Sema.
https://reviews.llvm.org/D31697 Files: clang/lib/Sema/SemaDecl.cpp Index: clang/lib/Sema/SemaDecl.cpp =================================================================== --- clang/lib/Sema/SemaDecl.cpp +++ clang/lib/Sema/SemaDecl.cpp @@ -1906,7 +1906,8 @@ // entirely, but we're not there yet. DeclContext *SavedContext = CurContext; CurContext = Parent; - PushOnScopeChains(New, TUScope); + if (TUScope) + PushOnScopeChains(New, TUScope); CurContext = SavedContext; return New; }
Index: clang/lib/Sema/SemaDecl.cpp =================================================================== --- clang/lib/Sema/SemaDecl.cpp +++ clang/lib/Sema/SemaDecl.cpp @@ -1906,7 +1906,8 @@ // entirely, but we're not there yet. DeclContext *SavedContext = CurContext; CurContext = Parent; - PushOnScopeChains(New, TUScope); + if (TUScope) + PushOnScopeChains(New, TUScope); CurContext = SavedContext; return New; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits