[PATCH] D92006: Refactoring the attribute plugin example to fit the new API

2020-12-20 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 marked an inline comment as done. psionic12 added a comment. Hi, could anyone help to commit this? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D92006/new/ https://reviews.llvm.org/D92006 ___ c

[PATCH] D92155: Load plugins when creating a CompilerInvocation.

2020-12-14 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 added a comment. In D92155#2450474 , @nridge wrote: > In D92155#2419549 , @sammccall wrote: > >> In D92155#2419346 , @psionic12 >> wrote: >> >>> Or, could you help

[PATCH] D92006: Refactoring the attrubute plugin example to fit the new API

2020-12-09 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 marked 5 inline comments as done. psionic12 added inline comments. Comment at: clang/test/Frontend/plugin-attribute.cpp:1 -// RUN: %clang -fplugin=%llvmshlibdir/Attribute%pluginext -emit-llvm -S %s -o - 2>&1 | FileCheck %s --check-prefix=ATTRIBUTE -// RUN: not %clang -

[PATCH] D92155: Load plugins when creating a CompilerInvocation.

2020-12-08 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 added a comment. > (One idea we've been playing with is that traversal of the AST usually goes > through TranslationUnitDecls::decls_begin(), which triggers loading from the > preamble. We could add a stateful flag to DeclContext that causes this to > behave like noload_decls_begin in

[PATCH] D92006: Refactoring the attrubute plugin example to fit the new API

2020-12-08 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 updated this revision to Diff 310401. psionic12 added a comment. Fix grammar Simplify the test case Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D92006/new/ https://reviews.llvm.org/D92006 Files: clang/examples/Attribute/Attribute.cpp

[PATCH] D92006: Refactoring the attrubute plugin example to fit the new API

2020-12-07 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 added inline comments. Comment at: clang/examples/Attribute/Attribute.cpp:81 +D->addAttr(AnnotateAttr::Create(S.Context, "example", &Arg0, +Attr.getNumArgs(), Attr.getRange())); return AttributeApplied; psion

[PATCH] D92006: Refactoring the attrubute plugin example to fit the new API

2020-12-07 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 updated this revision to Diff 309853. psionic12 marked 2 inline comments as done. psionic12 added a comment. Use a vector to collect arguments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D92006/new/ https://reviews.llvm.org/D92006 Files

[PATCH] D92006: Refactoring the attrubute plugin example to fit the new API

2020-12-07 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 marked 4 inline comments as done. psionic12 added inline comments. Comment at: clang/examples/Attribute/Attribute.cpp:81 +D->addAttr(AnnotateAttr::Create(S.Context, "example", &Arg0, +Attr.getNumArgs(), Attr.getRange())); ret

[PATCH] D92006: Refactoring the attrubute plugin example to fit the new API

2020-12-06 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 updated this revision to Diff 309814. psionic12 marked an inline comment as done. psionic12 added a comment. Fix grammar Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D92006/new/ https://reviews.llvm.org/D92006 Files: clang/examples/Att

[PATCH] D92006: Refactoring the attrubute plugin example to fit the new API

2020-12-06 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 updated this revision to Diff 309813. psionic12 added a comment. Add tests to check if attributes are attached to AST Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D92006/new/ https://reviews.llvm.org/D92006 Files: clang/examples/Attrib

[PATCH] D92647: Refactor codes and tests to make it work in PCH builds

2020-12-04 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 created this revision. psionic12 added reviewers: aaron.ballman, john.brawn. psionic12 requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. The former codes won't work for cases which PCH involves  in a build workflow, this patch fixes

[PATCH] D92155: Load plugins when creating a CompilerInvocation.

2020-11-27 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 added a comment. > - code completion: this shouldn't run plugins I believe: latency is critical > and we don't emit any diagnostics Totally agree. > - main file AST build: Important to run plugins here but it's critical they > don't traverse the whole preamble (can degrade latency by

[PATCH] D92155: Load plugins when creating a CompilerInvocation.

2020-11-27 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 added a comment. > This is exactly the problem, filenames specified in *clang* flags are > *supposed* to be read from the VFS. (In practice this probably just means > we'd need to disable this feature in environments where VFS is used) I don't thinks so, plugins are loaded by using `-

[PATCH] D92155: Load plugins when creating a CompilerInvocation.

2020-11-26 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 added a comment. > clangd (and other clang tools) get deployed in environments where all access > to the filesystem goes through a llvm::vfs::Filesystem, and all filenames > referred to in the compile command are within that virtual filesystem rather > than the real one. > (Again, thi

[PATCH] D92006: Refactoring the attrubute plugin example to fit the new API

2020-11-26 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 added a comment. ping Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D92006/new/ https://reviews.llvm.org/D92006 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi

[PATCH] D92155: Load plugins when creating a CompilerInvocation.

2020-11-26 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 added a comment. > Right, I understand (a little bit, at least!) what plugins *can* do. What I'm > asking specifically is: this feature has a cost, how important is supporting > it? Are there codebases where these attributes are widely used, and > enforcement at development time is pa

[PATCH] D92155: Load plugins when creating a CompilerInvocation.

2020-11-26 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 added inline comments. Comment at: clang/lib/Frontend/CompilerInvocation.cpp:3902 + // Load any requested plugins. + for (const std::string &Path : Res.getFrontendOpts().Plugins) { sammccall wrote: > how does this code behave if CLANG_PLUGIN_SUPPORT

[PATCH] D92155: Load plugins when creating a CompilerInvocation.

2020-11-26 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 added a comment. In D92155#2418617 , @sammccall wrote: > - what are the plugins you want to use with clangd? (i.e what kinds of > plugins are most important, what are they useful for) Any plugins which will report diagnostics, especially custom

[PATCH] D92155: Load plugins when creating a CompilerInvocation.

2020-11-26 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 added a comment. And I checked the CMakeList.txt for the driver, if `CLANG_PLUGIN_SUPPORT` is off, I guess the "undefined symbol` problem will also happens, I think this maybe one reason that option `CLANG_PLUGIN_SUPPORT ` is as `ON` by default. Repository: rG LLVM Github Monorepo

[PATCH] D92155: Load plugins when creating a CompilerInvocation.

2020-11-26 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 added a comment. In D92155#2417758 , @njames93 wrote: > Is it possible to write tests for this, obviously they will only work with > plugin support on the current platform. > Also now that this is loaded from the command line, how will this play

[PATCH] D92155: Load plugins when creating a CompilerInvocation.

2020-11-25 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 updated this revision to Diff 307763. psionic12 added a comment. Fix some syntax Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D92155/new/ https://reviews.llvm.org/D92155 Files: clang-tools-extra/clangd/tool/CMakeLists.txt clang/lib/F

[PATCH] D92155: Load plugins when creating a CompilerInvocation.

2020-11-25 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 created this revision. psionic12 added reviewers: njames93, grosser, chapuni, john.brawn, alexfh, sammccall, nridge. Herald added subscribers: cfe-commits, usaxena95, kadircet, arphaman, mgorny. Herald added a project: clang. psionic12 requested review of this revision. Herald added a su

[PATCH] D92006: Refactoring the attrubute plugin example to fit the new API

2020-11-23 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 created this revision. psionic12 added reviewers: john.brawn, aaron.ballman, Tyker. Herald added a project: clang. Herald added a subscriber: cfe-commits. psionic12 requested review of this revision. Make the example compiled and the test case passed. Repository: rG LLVM Github Monor

[PATCH] D91047: Add a call super attribute plugin example

2020-11-19 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 added a comment. @aaron.ballman That would be nice if your could help, and `Yafei Liu ` is okay. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D91047/new/ https://reviews.llvm.org/D91047 ___ cf

[PATCH] D91047: Add a call super attribute plugin example

2020-11-18 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 updated this revision to Diff 306283. psionic12 added a comment. Simplify the test case Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D91047/new/ https://reviews.llvm.org/D91047 Files: clang/examples/CMakeLists.txt clang/examples/Call

[PATCH] D91047: Add a call super attribute plugin example

2020-11-17 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 marked an inline comment as done. psionic12 added inline comments. Comment at: clang/test/Frontend/plugin-call-super.cpp:18-19 +struct Derive2 : public Base1, public Base2 { void Test() override { Base1::Test(); Base2::Test();}}; +// BADCALLSUPER: warning: virtual fu

[PATCH] D91047: Add a call super attribute plugin example

2020-11-17 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 added inline comments. Comment at: clang/docs/ClangPlugins.rst:116 +Defining CallSuperAttr +== After a whole day's research of `Sphinx`, I figured out that `ClangPlugins.rst` is the "proto-type" of https://clang.llvm.org/docs/Cl

[PATCH] D91047: Add a call super attribute plugin example

2020-11-17 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 updated this revision to Diff 305725. psionic12 added a comment. use `VerifyDiagnosticConsumer` (-verify) instead of `FileCheck` for syntax only feature test. remove illustration in ClangPlugins.rst (which is not very appropriate) Repository: rG LLVM Github Monorepo CHANGES SINCE L

[PATCH] D91047: Add a call super attribute plugin example

2020-11-15 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 marked 6 inline comments as done. psionic12 added inline comments. Comment at: clang/docs/ClangPlugins.rst:117 +Defining CallSuperAttr +=== + aaron.ballman wrote: > psionic12 wrote: > > aaron.ballman wrote: > > > aaron.ballman wrote: > >

[PATCH] D91047: Add a call super attribute plugin example

2020-11-15 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 updated this revision to Diff 305405. psionic12 added a comment. Fix the grammar Simplify the code logic Simplify the test case Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D91047/new/ https://reviews.llvm.org/D91047 Files: clang/docs/

[PATCH] D91047: Add a call super attribute plugin example

2020-11-12 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 added a comment. I just enabled `LLVM_ENABLE_DOXYGEN` `LLVM_BUILD_DOCS`, and use `make doxygen-clang`, it seems no error with my newest patch, is this > This still appears to be incorrect and will cause build errors for the > documentation. use the same way? Repository: rG LLVM G

[PATCH] D91047: Add a call super attribute plugin example

2020-11-12 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 marked 5 inline comments as done. psionic12 added inline comments. Comment at: clang/docs/ClangPlugins.rst:117 +Defining CallSuperAttr +=== + aaron.ballman wrote: > aaron.ballman wrote: > > The number of underlines here looks off -- can

[PATCH] D91047: Add a call super attribute plugin example

2020-11-12 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 updated this revision to Diff 305011. psionic12 marked an inline comment as done. psionic12 added a comment. fix grammer errors in warning messages and documents Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D91047/new/ https://reviews.llv

[PATCH] D91239: Update attribute example to fit the new Annotation API

2020-11-11 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 added inline comments. Comment at: clang/examples/Attribute/Attribute.cpp:59 + +// First we have to create an `StringLiteralExpr`. +StringRef AnnotationString = "example"; `AnnotationAttr` is used as an extra information in attribute plugin desi

[PATCH] D91239: Update attribute example to fit the new Annotation API

2020-11-11 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 created this revision. psionic12 added reviewers: john.brawn, aaron.ballman, Tyker, erichkeane. Herald added a project: clang. Herald added a subscriber: cfe-commits. psionic12 requested review of this revision. Since AnnotationAttr can add extra arguments now, update Attribute plugin ex

[PATCH] D91047: Add a call super attribute plugin example

2020-11-10 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 added inline comments. Comment at: clang/examples/CallSuperAttribute/CallSuperAttrInfo.cpp:133 + PluginASTAction::ActionType getActionType() override { +return AddBeforeMainAction; + } `AddAfterMainAction` will get run after IR codes were generate

[PATCH] D91047: Add a call super attribute plugin example

2020-11-10 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 updated this revision to Diff 304129. psionic12 added a comment. Add more detail in ClangPlugins.rst. Re-design overridden usage checking. Fix some code style issues. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D91047/new/ https://review

[PATCH] D91047: Add a call super attribute plugin example

2020-11-10 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 added inline comments. Comment at: clang/docs/ClangPlugins.rst:119 + +Attribute plugin to mark a virtual method as call_super, sub-classes must call it in overridden the method. + psionic12 wrote: > aaron.ballman wrote: > > aaron.ballman wrote: > > > S

[PATCH] D91047: Add a call super attribute plugin example

2020-11-09 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 added inline comments. Comment at: clang/docs/ClangPlugins.rst:119 + +Attribute plugin to mark a virtual method as call_super, sub-classes must call it in overridden the method. + aaron.ballman wrote: > aaron.ballman wrote: > > Should add backticks aro

[PATCH] D91047: Add a call super attribute plugin example

2020-11-09 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 added inline comments. Comment at: clang/test/Frontend/plugin-call-super.cpp:7 +struct Base2 { [[call_super]] virtual void Test() {} }; +struct Derive : public Base1, public Base2 { [[call_super]] virtual void Test() override final; }; +// CALLSUPER: warning: call_supe

[PATCH] D91047: Add a call super attribute plugin example

2020-11-09 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 updated this revision to Diff 303772. psionic12 added a comment. add final attribute checking Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D91047/new/ https://reviews.llvm.org/D91047 Files: clang/docs/ClangPlugins.rst clang/examples/

[PATCH] D91047: Add a call super attribute plugin example

2020-11-08 Thread Yafei Liu via Phabricator via cfe-commits
psionic12 created this revision. psionic12 added a reviewer: aaron.ballman. Herald added subscribers: cfe-commits, mgorny. Herald added a project: clang. psionic12 requested review of this revision. If a virtual method is marked as call_super, the override method must call it, simpler feature like