[llvm-bugs] [Bug 35861] New: retain ignored attributes in AST

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 8 11:45:51 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=35861

            Bug ID: 35861
           Summary: retain ignored attributes in AST
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: aaron at aaronballman.com, llvm-bugs at lists.llvm.org

One of the goals of the Clang AST is to retain full source fidelity, tracking
not just the semantics of source-level constructs but also the syntactic form
used to reach those semantics. We do not achieve that for attributes; one major
hole is that ignored attributes are discarded entirely.

One possible way to rectify this:

 * build an AST node for IgnoredAttr, and use that for all unknown attributes
 * store a list of tokens on each IgnoredAttr if the attribute has parameters
 * when discarding any known attribute (because it is inappropriately applied
or has invalid attributes), convert it to an IgnoredAttr instead

There are probably better approaches. (In particular, in the "discarding an
otherwise-known attribute case, we don't have the tokens, and it doesn't seem
reasonable to retain them just for this case, so perhaps an IgnoredKnownAttr
that contains an Attr* instead of a list of tokens might work better?)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180108/3f806429/attachment.html>


More information about the llvm-bugs mailing list