================
@@ -6676,8 +6676,7 @@ void ASTWriter::WriteDeclUpdatesBlocks(ASTContext 
&Context,
         break;
 
       case DeclUpdateKind::CXXInstantiatedDefaultArgument:
-        Record.writeStmtRef(
-            cast<ParmVarDecl>(Update.getDecl())->getDefaultArg());
+        Record.writeStmtRef(cast<ParmVarDecl>(Update.getDecl())->getInit());
----------------
8Keep wrote:

Yes, this is the same change as #76473. This is the core of the pr, changing 
getDefaultArg() to getInit(). The asymmetry is actually correct imo. It's kinda 
the naming of these functions that is the problem, but that's beside the point 
of this pr.


Function | What it really does
-- | --
setDefaultArg(x) | stores x, untouched
getInit() | returns what is stored, untouched
getDefaultArg() | returns what is stored minus its outer wrapper node

`setDefaultArg(getDefaultArg())` is lossy. `setDefaultArg(x->getInit())` is the 
way to copy a default argument.

in clang there are 3 places where this pattern happens today:

`clang/lib/Sema/SemaDeclCXX.cpp:574`
`clang/lib/Sema/SemaDeclCXX.cpp:617` (with that comment)
`clang/lib/Parse/ParseCXXInlineMethods.cpp:469`

The earliest case I could find of someone hitting this is here: 
https://github.com/llvm/llvm-project/commit/e61b02bcaf8a in 2010



https://github.com/llvm/llvm-project/pull/240633
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to