r244843 - Wdeprecated: LambdaScopeInfos need to be copied, so make the ScopeInfo hierarchy safely copyable

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 12 16:59:03 PDT 2015


Author: dblaikie
Date: Wed Aug 12 18:59:02 2015
New Revision: 244843

URL: http://llvm.org/viewvc/llvm-project?rev=244843&view=rev
Log:
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.

Modified:
    cfe/trunk/include/clang/Sema/ScopeInfo.h

Modified: cfe/trunk/include/clang/Sema/ScopeInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/ScopeInfo.h?rev=244843&r1=244842&r2=244843&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/ScopeInfo.h (original)
+++ cfe/trunk/include/clang/Sema/ScopeInfo.h Wed Aug 12 18:59:02 2015
@@ -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;




More information about the cfe-commits mailing list