<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><DIV><BLOCKQUOTE type="cite"> </BLOCKQUOTE></DIV><DIV>I've been playing around with clang/LLVM looking at adding partial support for the draft technical report for embedded C extensions (TR18037, <A href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1169.pdf">http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1169.pdf</A>), in particular: memory spaces. It's been fairly simple to thread memory space ID's through LLVM so far, but I'm new to FE's and the language from the TR has left me wondering about the best way to implement this in clang. From TR18037:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><I>Clause 6.2.5 - Types, replace the second sentence of paragraph 25 with: </I></DIV><DIV><I> <BR class="khtml-block-placeholder"></I></DIV><DIV><I>Each unqualified type has several qualified versions of its type,38) corresponding to the combinations </I></DIV><DIV><I>of one, two, or all three of the const, volatile, and restrict qualifiers, and all combinations </I></DIV><DIV><I>of any subset of these three qualifiers with one address space qualifier.  (Syntactically, an address </I></DIV><DIV><I>space qualifier is an address space name, so there is an address space qualifier for each visible </I></DIV><DIV><I>address space name.)</I></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>The question I have is, how to track this info without adding memory space id's to QualType, which seems </DIV><DIV>(1) infeasible given the implementation of QualType as a smart pointer with only a few bits for additional data, and</DIV><DIV>(2) would loose the performance benefit of the current QualType implementation (and thus the whole purpose of QualTypes existence, it seems) if QualType were made extensible.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>My first thought was to create a new Type subclass called MemSpacedType that would essentially just be used to store the memory space ID in addition to the QualType of the underlying type. Is this the way to go? I'm deep in new territory and need some seasoned advice.</DIV><DIV><BR class="khtml-block-placeholder"></DIV>Thanks<BR><DIV><DIV>--</DIV><DIV>Christopher Lamb</DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR class="Apple-interchange-newline"></DIV><BR></BODY></HTML>