[clang-tools-extra] c2c5c39 - [pseudo] Fix a suspicious usage of `sizeof(this)`.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 9 12:49:25 PDT 2022


Author: Haojian Wu
Date: 2022-08-09T21:46:56+02:00
New Revision: c2c5c39c401b39d2057ebb19b843f53deb950f6e

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

LOG: [pseudo] Fix a suspicious usage of `sizeof(this)`.

It should be `sizeof(*this)`.

Added: 
    

Modified: 
    clang-tools-extra/pseudo/include/clang-pseudo/Forest.h

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/pseudo/include/clang-pseudo/Forest.h b/clang-tools-extra/pseudo/include/clang-pseudo/Forest.h
index 130cf1ac7ef1a..f25e4cf1dd119 100644
--- a/clang-tools-extra/pseudo/include/clang-pseudo/Forest.h
+++ b/clang-tools-extra/pseudo/include/clang-pseudo/Forest.h
@@ -179,7 +179,7 @@ class ForestArena {
   }
 
   size_t nodeCount() const { return NodeCount; }
-  size_t bytes() const { return Arena.getBytesAllocated() + sizeof(this); }
+  size_t bytes() const { return Arena.getBytesAllocated() + sizeof(*this); }
 
 private:
   ForestNode &create(ForestNode::Kind K, SymbolID SID, Token::Index Start,


        


More information about the cfe-commits mailing list