[cfe-dev] Creating a representation for __declspec(thread) in the AST

Will Wilson will at indefiant.com
Tue Jan 15 11:27:08 PST 2013


Hi All,

Currently the parser can handle the extended SC modifier
"__declspec(thread)" however there's no representation for it in the AST.
This unfortunately means some fairly important information is lost - if, as
in my case, you're doing source analysis of code targeting MSVC.

My first question is: What is the best representation for
__declspec(thread) in the AST, should it mirror the representation for
__thread? Alternatively, what about treating it as an attribute along the
lines of DLLExportAttr? My gut feeling is it should be an alias for
__thread. But that leads to a second question...

The Windows* targets currently set TLSSupported to false, but this has the
unfortunate side effect of preventing VarDecl::setThreadSpecified(true)
from being called in Sema::ActOnVariableDeclarator() when the variable is
declared with __thread. On one hand it's good that the validation is being
performed as early as possible, however surely the error can still be
issued and setThreadSpecified(true) called in order to correctly reflect
the original code in the AST - even if it's invalid for the target?

- Will.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130115/910a5634/attachment.html>


More information about the cfe-dev mailing list