<div dir="ltr">Thanks! investigating.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 20, 2014 at 10:37 AM, David Majnemer <span dir="ltr"><<a href="mailto:david.majnemer@gmail.com" target="_blank">david.majnemer@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I've reproduced it independently:<div><div>template <int (*)()> void g() {}</div><div>struct S {</div><div> static int f();</div><div>};</div><div>auto x = g<S::f>;</div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 20, 2014 at 10:31 AM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Mon, Oct 20, 2014 at 10:28 AM, Yaron Keren <span dir="ltr"><<a href="mailto:yaron.keren@gmail.com" target="_blank">yaron.keren@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="rtl"><div dir="ltr">Here is the failing code, an example from boost::multiprecision. The boost version is 1.56 (the latest). Compiled with -c -g, nothing special. Maybe you'd like to add this as a test? boost::multiprecision is very demanding code.</div></div></blockquote><div><br></div></span><div>It'd be helpful if you could provide the preprocessed source (or the include-processed source) - the Clang crash handler should've mentioned two files (foo-42.sh and foo-42.cpp) that make it easy to reproduce crashers without the need to install external dependencies, etc.<span><font color="#888888"><br><br>- David</font></span></div><div><div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="rtl"><span><font color="#888888"><div dir="ltr"><br></div><div dir="ltr">Yaron</div><div dir="ltr"><br></div></font></span></div><div><div><div class="gmail_extra"><div dir="ltr"><br><div class="gmail_quote">2014-10-20 19:59 GMT+03:00 David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 .8ex;border-left:1px #ccc solid;border-right:1px #ccc solid;padding-left:1ex;padding-right:1ex"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Mon, Oct 20, 2014 at 9:32 AM, Yaron Keren <span dir="ltr"><<a href="mailto:yaron.keren@gmail.com" target="_blank">yaron.keren@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="rtl"><div dir="ltr">Hi David,</div><div dir="ltr"><br></div><div dir="ltr">Beyond renaming <span style="font-family:arial,sans-serif;font-size:12.7272720336914px">getTypeForDecl()</span>, this revision also introduced functionality changes in <span style="font-size:12.7272720336914px;font-family:arial,sans-serif">CGDebugInfo.cpp, </span></div></div></blockquote><div><br></div></span><div>Yep, sorry - I could've separated those patches.</div><span><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="rtl"><div dir="ltr"><span style="font-size:12.7272720336914px;font-family:arial,sans-serif">specifically the </span></div><div dir="ltr"><span style="font-family:arial,sans-serif;font-size:12.7272720336914px"><br></span></div><div dir="ltr"><span style="font-family:arial,sans-serif;font-size:12.7272720336914px"> if (InstanceMember) {</span><span style="font-family:arial,sans-serif;font-size:12.7272720336914px"><br></span></div><div dir="ltr"><span style="font-family:arial,sans-serif;font-size:12.7272720336914px"><br></span></div><div dir="ltr"><span style="font-family:arial,sans-serif;font-size:12.7272720336914px">test was removed, </span><span style="font-family:arial,sans-serif;font-size:12.7272720336914px">leading to</span></div><div dir="ltr"><span style="font-family:arial,sans-serif;font-size:12.7272720336914px"><br></span></div><div dir="ltr"><font face="arial, sans-serif"> <a href="http://llvm.org/bugs/show_bug.cgi?id=21312" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=21312</a></font><br></div><div dir="ltr"><font face="arial, sans-serif"><br></font></div><div dir="ltr"><font face="arial, sans-serif">Was the condition removed by mistake?</font></div></div></blockquote></span><div><br>Not exactly - I intentionally removed it, but of course causing bugs was a mistake.<br><br>Do you have a (preferably minimized) reproduction of this crash?<br> </div><div><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="rtl"><span><font color="#888888"><div dir="ltr"><font face="arial, sans-serif"><br></font></div><div dir="ltr"><font face="arial, sans-serif">Yaron</font></div><div dir="ltr"><font face="arial, sans-serif"><br></font></div><div dir="ltr"><font face="arial, sans-serif"><br></font></div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote"><div dir="ltr">2014-10-17 21:00 GMT+03:00 David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span>:</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: dblaikie<br>
Date: Fri Oct 17 13:00:12 2014<br>
New Revision: 220060<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=220060&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=220060&view=rev</a><br>
Log:<br>
Rename TemplateArgument::getTypeForDecl to getParamTypeForDecl for clarity<br>
<br>
Code review feedback from Richard Smith on r219900.<br>
<br>
Modified:<br>
cfe/trunk/include/clang/AST/TemplateBase.h<br>
cfe/trunk/lib/AST/ASTContext.cpp<br>
cfe/trunk/lib/AST/ASTImporter.cpp<br>
cfe/trunk/lib/AST/ItaniumMangle.cpp<br>
cfe/trunk/lib/AST/MicrosoftMangle.cpp<br>
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br>
cfe/trunk/lib/Serialization/ASTWriter.cpp<br>
<br>
Modified: cfe/trunk/include/clang/AST/TemplateBase.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TemplateBase.h?rev=220060&r1=220059&r2=220060&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TemplateBase.h?rev=220060&r1=220059&r2=220060&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/AST/TemplateBase.h (original)<br>
+++ cfe/trunk/include/clang/AST/TemplateBase.h Fri Oct 17 13:00:12 2014<br>
@@ -249,7 +249,7 @@ public:<br>
return DeclArg.D;<br>
}<br>
<br>
- QualType getTypeForDecl() const {<br>
+ QualType getParamTypeForDecl() const {<br>
assert(getKind() == Declaration && "Unexpected kind");<br>
return QualType::getFromOpaquePtr(DeclArg.QT);<br>
}<br>
<br>
Modified: cfe/trunk/lib/AST/ASTContext.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=220060&r1=220059&r2=220060&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=220060&r1=220059&r2=220060&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/AST/ASTContext.cpp (original)<br>
+++ cfe/trunk/lib/AST/ASTContext.cpp Fri Oct 17 13:00:12 2014<br>
@@ -4099,7 +4099,7 @@ ASTContext::getCanonicalTemplateArgument<br>
<br>
case TemplateArgument::Declaration: {<br>
ValueDecl *D = cast<ValueDecl>(Arg.getAsDecl()->getCanonicalDecl());<br>
- return TemplateArgument(D, Arg.getTypeForDecl());<br>
+ return TemplateArgument(D, Arg.getParamTypeForDecl());<br>
}<br>
<br>
case TemplateArgument::NullPtr:<br>
<br>
Modified: cfe/trunk/lib/AST/ASTImporter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=220060&r1=220059&r2=220060&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=220060&r1=220059&r2=220060&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)<br>
+++ cfe/trunk/lib/AST/ASTImporter.cpp Fri Oct 17 13:00:12 2014<br>
@@ -2094,7 +2094,7 @@ ASTNodeImporter::ImportTemplateArgument(<br>
case TemplateArgument::Declaration: {<br>
ValueDecl *FromD = From.getAsDecl();<br>
if (ValueDecl *To = cast_or_null<ValueDecl>(Importer.Import(FromD)))<br>
- return TemplateArgument(To, From.getTypeForDecl());<br>
+ return TemplateArgument(To, From.getParamTypeForDecl());<br>
return TemplateArgument();<br>
}<br>
<br>
<br>
Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=220060&r1=220059&r2=220060&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=220060&r1=220059&r2=220060&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/AST/ItaniumMangle.cpp (original)<br>
+++ cfe/trunk/lib/AST/ItaniumMangle.cpp Fri Oct 17 13:00:12 2014<br>
@@ -3403,7 +3403,7 @@ void CXXNameMangler::mangleTemplateArg(T<br>
// and pointer-to-function expressions are represented as a declaration not<br>
// an expression. We compensate for it here to produce the correct mangling.<br>
ValueDecl *D = A.getAsDecl();<br>
- bool compensateMangling = !A.getTypeForDecl()->isReferenceType();<br>
+ bool compensateMangling = !A.getParamTypeForDecl()->isReferenceType();<br>
if (compensateMangling) {<br>
Out << 'X';<br>
mangleOperatorName(OO_Amp, 1);<br>
<br>
Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=220060&r1=220059&r2=220060&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=220060&r1=220059&r2=220060&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)<br>
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Fri Oct 17 13:00:12 2014<br>
@@ -1139,7 +1139,7 @@ void MicrosoftCXXNameMangler::mangleTemp<br>
else<br>
mangle(FD, "$1?");<br>
} else {<br>
- mangle(ND, TA.getTypeForDecl()->isReferenceType() ? "$E?" : "$1?");<br>
+ mangle(ND, TA.getParamTypeForDecl()->isReferenceType() ? "$E?" : "$1?");<br>
}<br>
break;<br>
}<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=220060&r1=220059&r2=220060&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=220060&r1=220059&r2=220060&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Oct 17 13:00:12 2014<br>
@@ -1255,32 +1255,29 @@ CollectTemplateParams(const TemplatePara<br>
} break;<br>
case TemplateArgument::Declaration: {<br>
const ValueDecl *D = TA.getAsDecl();<br>
- bool InstanceMember = D->isCXXInstanceMember();<br>
- QualType T = TA.getTypeForDecl();<br>
+ QualType T = TA.getParamTypeForDecl();<br>
llvm::DIType TTy = getOrCreateType(T, Unit);<br>
llvm::Value *V = nullptr;<br>
// Variable pointer template parameters have a value that is the address<br>
// of the variable.<br>
- if (const VarDecl *VD = dyn_cast<VarDecl>(D))<br>
+ if (const auto *VD = dyn_cast<VarDecl>(D))<br>
V = CGM.GetAddrOfGlobalVar(VD);<br>
// Member function pointers have special support for building them, though<br>
// this is currently unsupported in LLVM CodeGen.<br>
- if (InstanceMember) {<br>
- if (const CXXMethodDecl *method = dyn_cast<CXXMethodDecl>(D))<br>
+ else if (const auto *method = dyn_cast<CXXMethodDecl>(D))<br>
V = CGM.getCXXABI().EmitMemberPointer(method);<br>
- } else if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D))<br>
+ else if (const auto *FD = dyn_cast<FunctionDecl>(D))<br>
V = CGM.GetAddrOfFunction(FD);<br>
// Member data pointers have special handling too to compute the fixed<br>
// offset within the object.<br>
- if (isa<FieldDecl>(D) || isa<IndirectFieldDecl>(D)) {<br>
+ else if (const auto *MPT = dyn_cast<MemberPointerType>(T.getTypePtr())) {<br>
// These five lines (& possibly the above member function pointer<br>
// handling) might be able to be refactored to use similar code in<br>
// CodeGenModule::getMemberPointerConstant<br>
uint64_t fieldOffset = CGM.getContext().getFieldOffset(D);<br>
CharUnits chars =<br>
CGM.getContext().toCharUnitsFromBits((int64_t) fieldOffset);<br>
- V = CGM.getCXXABI().EmitMemberDataPointer(<br>
- cast<MemberPointerType>(T.getTypePtr()), chars);<br>
+ V = CGM.getCXXABI().EmitMemberDataPointer(MPT, chars);<br>
}<br>
llvm::DITemplateValueParameter TVP =<br>
DBuilder.createTemplateValueParameter(TheCU, Name, TTy,<br>
<br>
Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=220060&r1=220059&r2=220060&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=220060&r1=220059&r2=220060&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)<br>
+++ cfe/trunk/lib/Serialization/ASTWriter.cpp Fri Oct 17 13:00:12 2014<br>
@@ -5372,7 +5372,7 @@ void ASTWriter::AddTemplateArgument(cons<br>
break;<br>
case TemplateArgument::Declaration:<br>
AddDeclRef(Arg.getAsDecl(), Record);<br>
- AddTypeRef(Arg.getTypeForDecl(), Record);<br>
+ AddTypeRef(Arg.getParamTypeForDecl(), Record);<br>
break;<br>
case TemplateArgument::NullPtr:<br>
AddTypeRef(Arg.getNullPtrType(), Record);<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div></div></div><br></div></blockquote></div></div></div>
</div></div></blockquote></div></div></div><br></div></div>
<br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>