<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - clang_Cursor_Evaluate does not support aggregate or complex initializers"
href="https://bugs.llvm.org/show_bug.cgi?id=36576">36576</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang_Cursor_Evaluate does not support aggregate or complex initializers
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>libclang
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>matti.niemenmaa+llvmbugs@iki.fi
</td>
</tr>
<tr>
<th>CC</th>
<td>klimek@google.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>At the time of writing (2018-03-02, SVN r326551) clang_Cursor_Evaluate only
supports integers, doubles, and strings, as is evident from the structure it
returns:
struct ExprEvalResult {
CXEvalResultKind EvalType;
union {
unsigned long long unsignedVal;
long long intVal;
double floatVal;
char *stringVal;
} EvalData;
bool IsUnsignedInt;
// destructor omitted
}
This means that attempting to examine the values of e.g. any of the following
constants results in a null pointer instead of any useful information:
const int array[] = {1, 2, 3};
const struct { int x, y; } structure = { .x = 1, .y = 2 };
const union { int x, y; } my_union = { .y = 3 };
#include <complex.h>
const float complex complex_float = 1 + 2*I;
As far as I can tell there is no way of discovering those values using
libclang. One user that would benefit from this information is Rust's binding
generation tool, bindgen:
<a href="https://github.com/rust-lang-nursery/rust-bindgen/issues/1266">https://github.com/rust-lang-nursery/rust-bindgen/issues/1266</a></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>