]> granicus.if.org Git - clang/commitdiff
Follow-up to r246338: use getParentFunctionOrMethod
authorHans Wennborg <hans@hanshq.net>
Fri, 28 Aug 2015 22:56:21 +0000 (22:56 +0000)
committerHans Wennborg <hans@hanshq.net>
Fri, 28 Aug 2015 22:56:21 +0000 (22:56 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246348 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp

index 1fe6a5c18f1c7a9e3f7dbf03de57485e396e0a69..c74bb8351e859eddab83e2a57ac5287392c0e8bf 100644 (file)
@@ -9967,7 +9967,7 @@ Sema::FinalizeDeclaration(Decl *ThisDecl) {
   // dllimport/dllexport variables cannot be thread local, their TLS index
   // isn't exported with the variable.
   if (DLLAttr && VD->getTLSKind()) {
-    FunctionDecl *F = dyn_cast<FunctionDecl>(VD->getDeclContext());
+    auto *F = dyn_cast_or_null<FunctionDecl>(VD->getParentFunctionOrMethod());
     if (F && getDLLAttr(F)) {
       assert(VD->isStaticLocal());
       // But if this is a static local in a dlimport/dllexport function, the