<html><head></head><body><div class="yahoo-style-wrap" style="font-family:times new roman, new york, times, serif;font-size:13px;"><div dir="ltr" data-setdir="false">Hi all,</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">I have  C++ DSL that defines its own primitive types and operators and I want to provide some debugging facilities during compilation to display the source location (filename, line number) for uninitialized DSL objects.</div><div dir="ltr" data-setdir="false">To capture the source line information for a given DSL object, I'm using <span>__builtin_LINE(x) inside the class constructor, where 'x' is the function nesting depth (see below).</span></div><div dir="ltr" data-setdir="false"><span>I would like to implement this functionality using a clang plugging such that the feature is automatically used during compilation.</span></div><div dir="ltr" data-setdir="false"><span><span><span style="color: rgb(0, 0, 0); font-family: "times new roman", "new york", times, serif;">I don't know if this is feasible with the current Clang plugin API.</span></span></span></div><div dir="ltr" data-setdir="false"><span>I was wondering someone has some experience with the plugin and how this can be done.</span></div><div dir="ltr" data-setdir="false"><span>Thank you so much.</span></div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false"><span><span style="color: rgb(0, 0, 0); font-family: "times new roman", "new york", times, serif;">eg: DSLObject  myobj;</span></span><br></div><div dir="ltr" data-setdir="false"><span><span style="color: rgb(0, 0, 0); font-family: "times new roman", "new york", times, serif;"><br></span></span></div><div dir="ltr" data-setdir="false"><span><span style="color: rgb(0, 0, 0); font-family: "times new roman", "new york", times, serif;">--------------------------</span></span></div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">class DSLObject {</div><div dir="ltr" data-setdir="false">public:</div><div dir="ltr" data-setdir="false"><span><span style="color: rgb(0, 0, 0); font-family: "times new roman", "new york", times, serif;">    DSLObject() {</span></span></div><div dir="ltr" data-setdir="false"><span><span style="color: rgb(0, 0, 0); font-family: "times new roman", "new york", times, serif;">        <span><span style="color: rgb(0, 0, 0); font-family: "times new roman", "new york", times, serif;">lineno_ = <span>__builtin_LINE(1);</span></span></span><br></span></span></div><div dir="ltr" data-setdir="false"><span><span style="color: rgb(0, 0, 0); font-family: "times new roman", "new york", times, serif;">    }</span></span></div><div dir="ltr" data-setdir="false"><span><span style="color: rgb(0, 0, 0); font-family: "times new roman", "new york", times, serif;">private:</span></span></div><div dir="ltr" data-setdir="false"><span><span style="color: rgb(0, 0, 0); font-family: "times new roman", "new york", times, serif;">    int lineno_;<br></span></span></div><div dir="ltr" data-setdir="false">};</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false"><br></div></div></body></html>