From 30a7ec2d1f756162b0cb56028e9e47e4a404d811 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Wed, 12 Aug 2015 23:59:02 +0000 Subject: [PATCH] Wdeprecated: LambdaScopeInfos need to be copied, so make the ScopeInfo hierarchy safely copyable Making the base class's copy ctor protected and the derived classes final to avoid any slicing-prone APIs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244843 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Sema/ScopeInfo.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/include/clang/Sema/ScopeInfo.h b/include/clang/Sema/ScopeInfo.h index 15ee8a4ba7..472e294bd8 100644 --- a/include/clang/Sema/ScopeInfo.h +++ b/include/clang/Sema/ScopeInfo.h @@ -291,6 +291,9 @@ private: /// Part of the implementation of -Wrepeated-use-of-weak. WeakObjectUseMap WeakObjectUses; +protected: + FunctionScopeInfo(const FunctionScopeInfo&) = default; + public: /// Record that a weak object was accessed. /// @@ -364,6 +367,9 @@ public: }; class CapturingScopeInfo : public FunctionScopeInfo { +protected: + CapturingScopeInfo(const CapturingScopeInfo&) = default; + public: enum ImplicitCaptureStyle { ImpCap_None, ImpCap_LambdaByval, ImpCap_LambdaByref, ImpCap_Block, @@ -549,7 +555,7 @@ public: }; /// \brief Retains information about a block that is currently being parsed. -class BlockScopeInfo : public CapturingScopeInfo { +class BlockScopeInfo final : public CapturingScopeInfo { public: BlockDecl *TheDecl; @@ -576,7 +582,7 @@ public: }; /// \brief Retains information about a captured region. -class CapturedRegionScopeInfo: public CapturingScopeInfo { +class CapturedRegionScopeInfo final : public CapturingScopeInfo { public: /// \brief The CapturedDecl for this statement. CapturedDecl *TheCapturedDecl; @@ -617,7 +623,7 @@ public: } }; -class LambdaScopeInfo : public CapturingScopeInfo { +class LambdaScopeInfo final : public CapturingScopeInfo { public: /// \brief The class that describes the lambda. CXXRecordDecl *Lambda; -- 2.40.0