[PATCH] D20302: Remove LazyDefinitionDataPtr and rely on getMostRecentDecl. Fixes PR27754.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Mon May 16 14:47:28 PDT 2016


rsmith added inline comments.

================
Comment at: include/clang/AST/DeclCXX.h:522
@@ -545,7 +521,3 @@
 
-  typedef LazyDefinitionDataPtr<CXXRecordDecl, struct DefinitionData>
-      DefinitionDataPtr;
-  friend class LazyDefinitionDataPtr<CXXRecordDecl, struct DefinitionData>;
-
-  mutable DefinitionDataPtr DefinitionData;
+  mutable DefinitionData* DefinitionData;
 
----------------
Does this still need to be `mutable`?

Also, you need to use `struct DefinitionData *DefinitionData;` here or this is ill-formed (no diagnostic required) by [basic.scope.class]p1 rule 2.

================
Comment at: include/clang/AST/DeclCXX.h:672
@@ -698,3 +671,3 @@
   CXXRecordDecl *getDefinition() const {
-    auto *DD = DefinitionData.get();
+    auto *DD = DefinitionData;
     return DD ? DD->Definition : nullptr;
----------------
This also needs to perform an update. Maybe factor out a function for this and `data()` to call?

================
Comment at: include/clang/AST/DeclCXX.h:676
@@ -702,3 +675,3 @@
 
-  bool hasDefinition() const { return DefinitionData.get(); }
+  bool hasDefinition() const { return DefinitionData; }
 
----------------
Likewise, we need an update here if `DefinitionData` is null.


Repository:
  rL LLVM

http://reviews.llvm.org/D20302





More information about the cfe-commits mailing list