[PATCH] D24508: PR28752: Do not instantiate var decls which are not visible.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 10 15:48:58 PDT 2016


rsmith accepted this revision.
rsmith added inline comments.
This revision is now accepted and ready to land.


================
Comment at: include/clang/AST/Decl.h:1222
+  void demoteThisDefinitionToDeclaration() {
+    assert (!isThisDeclarationADemotedDefinition() && "Aleady demoted!");
+    assert (isThisDeclarationADefinition() && "Not a definition!");
----------------
You can remove this; it's covered by the next line.


================
Comment at: lib/AST/Decl.cpp:2284
+      while (auto *NewVD = VD->getInstantiatedFromStaticDataMember())
+        VD = NewVD;
+      return VD->getDefinition();
----------------
Missing a member specialization check here.


================
Comment at: lib/Serialization/ASTReaderDecl.cpp:3086-3090
+      if (CurD->isThisDeclarationADemotedDefinition()) {
+        VD->demoteThisDefinitionToDeclaration();
+        break;
+      }
+      if (CurD->isThisDeclarationADefinition()) {
----------------
Maybe combine these two `if`s into one, since their bodies are identical?


https://reviews.llvm.org/D24508





More information about the cfe-commits mailing list