<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 12/26/2016 7:08 PM, Andrew Gozillon
via cfe-dev wrote:<br>
</div>
<blockquote
cite="mid:DB3PR01MB07483C9F64D8E1ADB58767BFA8940@DB3PR01MB0748.eurprd01.prod.exchangelabs.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper"
style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;"
dir="ltr">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt;
color:#000000; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi Erik,</p>
<p><br>
</p>
<p>Thanks very much for the quick reply and the great answer!
I will try elaborate on my first question a little bit to
try and clear it up (I apologise if it doesn't, I'm not
great for explanations). </p>
<p><br>
</p>
<p>Within SemaType.cpp some of the type attributes take in
integer parameters, however they can not be dependent or
value dependent (for example by a template'd const int) as
shown by the below snippet from the HandleVectorSizeAttr
function which will emit an error if its tried: </p>
<p><a moz-do-not-send="true" class="code" href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html" style="color: rgb(70, 101, 162); text-decoration: none; font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">Expr</a><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">
*sizeExpr = </span><span class="keyword" style="color: rgb(0, 128, 0); font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">static_cast<</span><a moz-do-not-send="true" class="code" href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html" style="color: rgb(70, 101, 162); text-decoration: none; font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">Expr</a><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">
*</span><span class="keyword" style="color: rgb(0, 128, 0); font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">></span><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">(Attr.</span><a moz-do-not-send="true" class="code" href="http://clang.llvm.org/doxygen/classclang_1_1AttributeList.html#a265d2e7800361a5124d7455fdd432424" style="color: rgb(70, 101, 162); text-decoration: none; font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">getArgAsExpr</a><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">(0));</span></p>
<p><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);"><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">llvm::APSInt
vecSize(32);</span>
</span></p>
<p><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);"><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);"><span class="keywordflow" style="color: rgb(224, 128, 0); font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">if</span><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">
(sizeExpr-></span><a moz-do-not-send="true" class="code" href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html#a48cd7038510f42d44e314d1b8d294824" style="color: rgb(70, 101, 162); text-decoration: none; font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">isTypeDependent</a><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">()
|| sizeExpr-></span><a moz-do-not-send="true" class="code" href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html#a34f1652a9072dfd3c7119d23e1a14fa5" style="color: rgb(70, 101, 162); text-decoration: none; font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">isValueDependent</a><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">()
|| <span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">
!sizeExpr-></span><a moz-do-not-send="true" class="code" href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html#a664cbf5948aae551f2080170628ea5ac" style="color: rgb(70, 101, 162); text-decoration: none; font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">isIntegerConstantExpr</a><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">(vecSize,
S.</span><a moz-do-not-send="true" class="code" href="http://clang.llvm.org/doxygen/classclang_1_1Sema.html#a3ccddacb1f4f71b084296175cc9e5b0e" style="color: rgb(70, 101, 162); text-decoration: none; font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">Context</a><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">))
{ <span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">
S.</span><a moz-do-not-send="true" class="code" href="http://clang.llvm.org/doxygen/classclang_1_1Sema.html#ad29dfd1f2677772bf6b1da186a7583c3" style="color: rgb(70, 101, 162); text-decoration: none; font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">Diag</a><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">(Attr.</span><a moz-do-not-send="true" class="code" href="http://clang.llvm.org/doxygen/classclang_1_1AttributeList.html#a764e55754a52aa43b991dbbb24fa1450" style="color: rgb(70, 101, 162); text-decoration: none; font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">getLoc</a><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">(),
diag::err_attribute_argument_type)</span><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);"><< Attr.</span><a moz-do-not-send="true" class="code" href="http://clang.llvm.org/doxygen/classclang_1_1AttributeList.html#ad33e72a3989e9a61697da22d0211bf15" style="color: rgb(70, 101, 162); text-decoration: none; font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">getName</a><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">()
<< </span><a moz-do-not-send="true" class="code" href="http://clang.llvm.org/doxygen/namespaceclang.html#a702b0ec61c5bb9df98d3364a170c0dfca026f679d45ce5b7f618b89ac18d8595e" style="color: rgb(70, 101, 162); text-decoration: none; font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">AANT_ArgumentIntegerConstant</a><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">
<< sizeExpr-></span><a moz-do-not-send="true" class="code" href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html#a6844392ee6148b5fe821f211b95e5d1b" style="color: rgb(70, 101, 162); text-decoration: none; font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">getSourceRange</a><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">();</span><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">
Attr.</span><a moz-do-not-send="true" class="code" href="http://clang.llvm.org/doxygen/classclang_1_1AttributeList.html#ad2ce5246eed483669e582893448602d8" style="color: rgb(70, 101, 162); text-decoration: none; font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">setInvalid</a><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">();</span></span></span></span></span></p>
<p><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);"><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);"><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);"><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);"><span class="keywordflow" style="color: rgb(224, 128, 0); font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">return</span><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">;</span></span></span>
</span></span></p>
<p><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);"><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);"><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);"><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);"><span style="font-family: monospace, fixed; font-size: 13px; text-indent: -53px; white-space: pre-wrap; background-color: rgb(251, 252, 253);">}</span></span></span></span></span></p>
<br>
</div>
</div>
</blockquote>
<br>
vector_size in particular doesn't work just because it isn't
implemented... attributes which affect the type system require some
relatively complicated handling to make template instantiation work
correctly. ext_vector_type is an example of an attribute which
takes an integer parameter which is allowed to be dependent; see
Sema::BuildExtVectorType / TransformDependentSizedExtVectorType in
TreeTransform.h / etc.<br>
<br>
-Eli<br>
<p><br>
</p>
<pre class="moz-signature" cols="72">--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project</pre>
</body>
</html>