[clang] f223c96 - [clang][Interp][NFC] Return a const Descriptor from a getter

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 6 05:52:30 PDT 2023


Author: Timm Bäder
Date: 2023-07-06T14:52:05+02:00
New Revision: f223c964df86b239f76946b30a1400cb9b7adaa3

URL: https://github.com/llvm/llvm-project/commit/f223c964df86b239f76946b30a1400cb9b7adaa3
DIFF: https://github.com/llvm/llvm-project/commit/f223c964df86b239f76946b30a1400cb9b7adaa3.diff

LOG: [clang][Interp][NFC] Return a const Descriptor from a getter

They are generally immutable anyway. Also fix some doc comments.

Added: 
    

Modified: 
    clang/lib/AST/Interp/InterpBlock.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/InterpBlock.h b/clang/lib/AST/Interp/InterpBlock.h
index edcbec232e23d8..8c95d8e122be48 100644
--- a/clang/lib/AST/Interp/InterpBlock.h
+++ b/clang/lib/AST/Interp/InterpBlock.h
@@ -48,7 +48,7 @@ enum PrimType : unsigned;
 ///
 class Block final {
 public:
-  // Creates a new block.
+  /// Creates a new block.
   Block(const std::optional<unsigned> &DeclID, Descriptor *Desc,
         bool IsStatic = false, bool IsExtern = false)
       : DeclID(DeclID), IsStatic(IsStatic), IsExtern(IsExtern), Desc(Desc) {}
@@ -58,7 +58,7 @@ class Block final {
         Desc(Desc) {}
 
   /// Returns the block's descriptor.
-  Descriptor *getDescriptor() const { return Desc; }
+  const Descriptor *getDescriptor() const { return Desc; }
   /// Checks if the block has any live pointers.
   bool hasPointers() const { return Pointers; }
   /// Checks if the block is extern.
@@ -104,7 +104,7 @@ class Block final {
                    /*isActive=*/true, Desc);
   }
 
-  // Invokes the Destructor.
+  /// Invokes the Destructor.
   void invokeDtor() {
     if (Desc->DtorFn)
       Desc->DtorFn(this, data(), Desc);


        


More information about the cfe-commits mailing list