ahatanak added a comment.

Sorry for the delay in replying.



================
Comment at: lib/Serialization/ASTReaderDecl.cpp:2715
     return (FuncX->getLinkageInternal() == FuncY->getLinkageInternal()) &&
       FuncX->getASTContext().hasSameType(FuncX->getType(), FuncY->getType());
   }
----------------
rsmith wrote:
> Instead of your change, can we change this to use `typesAreCompatible` 
> instead of `hasSameType`?
Using typesAreCompatible instead of hasSameType fixes the crash in the test 
case I added.

However, if I declare the prototype in merge-non-prototype-fn.c and the 
non-prototype function in header2.h, the call to func1 in foo1 picks the 
non-prototype function. It seems to me that we should do something similar to 
what Sema::MergeFunctionDecl does, which is to copy the ParamDecls of the 
prototype to the non-prototype function, but I'm not sure how to go about it. 
Should we duplicate the logic in ASTReaderDecl.cpp? Or perhaps we should change 
the code that does the lookup for func1 to pick the prototype when we are 
handling modules (which seems to be what you are suggesting)?


https://reviews.llvm.org/D25001



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to