Page MenuHomePhabricator

[Clang] Allow processing of attributes on statements by plugins

Authored by Qix- on Apr 5 2021, 1:56 AM.



Pretty cut and dry; currently plugins can create attributes for declarations but any that are not recognized produce a diagnostic, leaving no hook for plugins to react to them.

This adds a quick check to the attribute to see if the implementation would like to handle it first, akin to how declarations are handled.

Compatible with D99861.

Diff Detail

Unit TestsFailed

270 msx64 windows > Clang.Index::complete-preamble.cpp
Script: -- : 'RUN: at line 6'; env CINDEXTEST_EDITING=1 LIBCLANG_TIMING=1 c:\ws\w16c2-1\llvm-project\premerge-checks\build\bin\c-index-test.exe -code-completion-at=C:\ws\w16c2-1\llvm-project\premerge-checks\clang\test\Index\complete-preamble.cpp:3:8 C:\ws\w16c2-1\llvm-project\premerge-checks\clang\test\Index\complete-preamble.cpp -o - 2>&1 | c:\ws\w16c2-1\llvm-project\premerge-checks\build\bin\filecheck.exe -check-prefix=CHECK-CC1 -check-prefix=SECOND C:\ws\w16c2-1\llvm-project\premerge-checks\clang\test\Index\complete-preamble.cpp

Event Timeline

Qix- requested review of this revision.Apr 5 2021, 1:56 AM
Qix- created this revision.
Qix- edited the summary of this revision. (Show Details)Apr 5 2021, 1:57 AM

Thank you for the patch! Btw, can you add more context to the patch when you generate it (I usually use -U 999 when making patches)?

The changes look good so far, but I think docs\ClangPlugins.rst should be updated to document the new functionality and it would be nice to add example usage (in lieu of tests) to examples\Attribute.

Qix- updated this revision to Diff 336172.Apr 8 2021, 11:05 AM
Qix- planned changes to this revision.Apr 9 2021, 11:05 AM
Qix- abandoned this revision.Apr 22 2021, 6:35 AM

Closing in favor of more complete plugin attribute changes discussed in IRC.