diff options
author | Puyan Lotfi <puyan@puyan.org> | 2020-01-13 15:22:08 -0500 |
---|---|---|
committer | Puyan Lotfi <puyan@puyan.org> | 2020-01-13 16:04:27 -0500 |
commit | bd8c8827d96f09be502f0da6897c1aef89e45c30 (patch) | |
tree | d1c516f2b6a93bd37f3a59029ca090d544ebd726 /clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp | |
parent | b7526cc21ce55c8b53250df3d659fbdae3f894a7 (diff) | |
download | llvm-bd8c8827d96f09be502f0da6897c1aef89e45c30.zip llvm-bd8c8827d96f09be502f0da6897c1aef89e45c30.tar.gz llvm-bd8c8827d96f09be502f0da6897c1aef89e45c30.tar.bz2 |
[clang][IFS] Prevent Clang-IFS from Leaking symbols from inside a block.
Built libdispatch with clang interface stubs. Ran into some block
related issues. Basically VarDecl symbols can leak out because I wasn't
checking the case where a VarDecl is contained inside a BlockDecl
(versus a method or function).
This patch checks that a VarDecl is not a child decl of a BlockDecl.
This patch also does something very similar for c++ lambdas as well.
Differential Revision: https://reviews.llvm.org/D71301
Diffstat (limited to 'clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp')
-rw-r--r-- | clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp b/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp index e7d6fee..7241081 100644 --- a/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp +++ b/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp @@ -53,6 +53,10 @@ class InterfaceStubFunctionsConsumer : public ASTConsumer { return true; if (const VarDecl *VD = dyn_cast<VarDecl>(ND)) { + if (const auto *Parent = VD->getParentFunctionOrMethod()) + if (isa<BlockDecl>(Parent) || isa<CXXMethodDecl>(Parent)) + return true; + if ((VD->getStorageClass() == StorageClass::SC_Extern) || (VD->getStorageClass() == StorageClass::SC_Static && VD->getParentFunctionOrMethod() == nullptr)) |