@@ -1922,9 +1922,12 @@ void MicrosoftCXXNameMangler::mangleTemplateArgValue(QualType T,
1922
1922
if (WithScalarType)
1923
1923
mangleType (T, SourceRange (), QMM_Escape);
1924
1924
1925
- // We don't know how to mangle past-the-end pointers yet.
1926
- if (V.isLValueOnePastTheEnd ())
1927
- break ;
1925
+ // msvc does not support this, so no mangling will ever be "right", so this
1926
+ // was picked arbitrarily.
1927
+ if (V.isLValueOnePastTheEnd ()) {
1928
+ Out << " @IN" ; // for "invalid pointer" since it always is invalid.
1929
+ return ;
1930
+ }
1928
1931
1929
1932
APValue::LValueBase Base = V.getLValueBase ();
1930
1933
if (!V.hasLValuePath () || V.getLValuePath ().empty ()) {
@@ -1938,12 +1941,23 @@ void MicrosoftCXXNameMangler::mangleTemplateArgValue(QualType T,
1938
1941
mangleNumber (V.getLValueOffset ().getQuantity ());
1939
1942
} else if (!V.hasLValuePath ()) {
1940
1943
// FIXME: This can only happen as an extension. Invent a mangling.
1941
- break ;
1944
+ DiagnosticsEngine &Diags = Context.getDiags ();
1945
+ unsigned DiagID =
1946
+ Diags.getCustomDiagID (DiagnosticsEngine::Error,
1947
+ " cannot mangle this template argument yet "
1948
+ " (non-null base with null lvalue path)" );
1949
+ Diags.Report (DiagID);
1950
+ return ;
1942
1951
} else if (auto *VD = Base.dyn_cast <const ValueDecl*>()) {
1943
1952
Out << " E" ;
1944
1953
mangle (VD);
1945
1954
} else {
1946
- break ;
1955
+ DiagnosticsEngine &Diags = Context.getDiags ();
1956
+ unsigned DiagID = Diags.getCustomDiagID (
1957
+ DiagnosticsEngine::Error,
1958
+ " cannot mangle this template argument yet (empty lvalue path)" );
1959
+ Diags.Report (DiagID);
1960
+ return ;
1947
1961
}
1948
1962
} else {
1949
1963
if (TAK == TplArgKind::ClassNTTP && T->isPointerType ())
@@ -1988,8 +2002,14 @@ void MicrosoftCXXNameMangler::mangleTemplateArgValue(QualType T,
1988
2002
Out << *I;
1989
2003
1990
2004
auto *VD = Base.dyn_cast <const ValueDecl*>();
1991
- if (!VD)
1992
- break ;
2005
+ if (!VD) {
2006
+ DiagnosticsEngine &Diags = Context.getDiags ();
2007
+ unsigned DiagID = Diags.getCustomDiagID (
2008
+ DiagnosticsEngine::Error,
2009
+ " cannot mangle this template argument yet (null value decl)" );
2010
+ Diags.Report (DiagID);
2011
+ return ;
2012
+ }
1993
2013
Out << (TAK == TplArgKind::ClassNTTP ? ' E' : ' 1' );
1994
2014
mangle (VD);
1995
2015
@@ -2104,15 +2124,24 @@ void MicrosoftCXXNameMangler::mangleTemplateArgValue(QualType T,
2104
2124
return ;
2105
2125
}
2106
2126
2107
- case APValue::AddrLabelDiff:
2108
- case APValue::FixedPoint:
2109
- break ;
2127
+ case APValue::AddrLabelDiff: {
2128
+ DiagnosticsEngine &Diags = Context.getDiags ();
2129
+ unsigned DiagID = Diags.getCustomDiagID (
2130
+ DiagnosticsEngine::Error, " cannot mangle this template argument yet "
2131
+ " (value type: address label diff)" );
2132
+ Diags.Report (DiagID);
2133
+ return ;
2110
2134
}
2111
2135
2112
- DiagnosticsEngine &Diags = Context.getDiags ();
2113
- unsigned DiagID = Diags.getCustomDiagID (
2114
- DiagnosticsEngine::Error, " cannot mangle this template argument yet" );
2115
- Diags.Report (DiagID);
2136
+ case APValue::FixedPoint: {
2137
+ DiagnosticsEngine &Diags = Context.getDiags ();
2138
+ unsigned DiagID = Diags.getCustomDiagID (
2139
+ DiagnosticsEngine::Error,
2140
+ " cannot mangle this template argument yet (value type: fixed point)" );
2141
+ Diags.Report (DiagID);
2142
+ return ;
2143
+ }
2144
+ }
2116
2145
}
2117
2146
2118
2147
void MicrosoftCXXNameMangler::mangleObjCProtocol (const ObjCProtocolDecl *PD) {
0 commit comments