Author Topic: Use Clang AST for parsing C/C++  (Read 1743 times)

Kaiser

  • Community Member
  • Posts: 5
  • Hero Points: 1
Use Clang AST for parsing C/C++
« on: December 17, 2011, 06:14:15 pm »
I'd love to see libclang integrated as Slickedit's default C, C++, and Objective-C parser.  Slickedit's editing features are great, but the the formatting features (custom colors, etc.) for obscure type variants can be slow, very slow.  I presume this is because the parsing is regexp based, or written in an interpreted language.  Let's just use libclang and be done with it.  Having colors magically appear two seconds after a scroll event is just horrible.

brainsalad

  • Community Member
  • Posts: 11
  • Hero Points: 2
Re: Use Clang AST for parsing C/C++
« Reply #1 on: November 08, 2012, 05:17:28 pm »
Use the parse tree and IF output from Clang incremental compilation to generate tagging information in the manner of XCode and Codelite.  This would allow SlickEdit to provide completion and type information for even the most complex macro generated C functions, C++ code with templated inheritance, and Objective-C classes with categories and automatically synthesized properties.

Improving the SlickEdit c/c++/obj-c tagger ever closer to perfection means that it will evolve ever closer towards being a complete c/c++/obj-c frontend - which Clang already is!  Using the current SlickEdit tagger for quick, on the fly tagging, and Clang for 100% complete deep tagging of projects that SlickEdit knows how to build (e.g. XCode projects and C/C++ projects with builds managed through the SlickEdit interface) would be a dream for me and a huge must-have feature that would attract a great deal of interest from potential new users.

geneg1

  • Community Member
  • Posts: 51
  • Hero Points: 4
Re: Use Clang AST for parsing C/C++
« Reply #2 on: November 08, 2012, 05:26:41 pm »
I agree with brainsalad... using Clang for tagging, completion etc. would be amazing.

Phil Barila

  • Senior Community Member
  • Posts: 742
  • Hero Points: 61
Re: Use Clang AST for parsing C/C++
« Reply #3 on: November 08, 2012, 06:47:12 pm »
I'm with brainsalad and geneg1, abstract the interfaces and use clang and the new Roslyn compilers from MSFT as your parsing/tagging engine, and fall back to your own tagging engine when they don't support the language.  I hope you can go there some time in the not-too-distant future.

brainsalad

  • Community Member
  • Posts: 11
  • Hero Points: 2
Re: Use Clang AST for parsing C/C++
« Reply #4 on: November 13, 2012, 03:18:53 pm »
I'm with brainsalad and geneg1, abstract the interfaces and use clang and the new Roslyn compilers from MSFT as your parsing/tagging engine, and fall back to your own tagging engine when they don't support the language.  I hope you can go there some time in the not-too-distant future.

Oh yes, hooking into the Microsoft compilers for tagging information as Visual Studio does would be awesome for coding on Windows.

Right now, the IDEs have better tagging support than SlickEdit  :'(  SlickEdit is better in so many other ways, but I barely use it for Objective-C coding since XCode's completion and error detection is just lightyears better.  If the demand for iOS work keeps up, I'm going to have a hard time justifying renewing my SlickEdit all platform license.

I've given some thought to using slick-C to interpret Clang parse trees in order to produce SlickEdit tagging info, but I just have too much on my plate already.

I hope the SlickEdit team reads these posts.  Come on SlickEdit!  We want next gen tagging!  Ctags style tagging is SO last century!!

Ian Ameline

  • Community Member
  • Posts: 70
  • Hero Points: 7
Re: Use Clang AST for parsing C/C++
« Reply #5 on: October 19, 2014, 06:17:08 pm »
I'd like to see support for c++ x11 features.
1: get auto complete on the -> when using shared pointers or unique pointers
2: support for auto variables. And to get support for the . and -> completion on those
eg;
   for (auto &id : getVertexIds()) {
      id.memberfcn(foo); // <<< would like slickedit to know what type id is referencing
   }

You might want to look into using the clang ast to parse c++ for you -- I've been using it in a recent project, and it is amazing...

Have a look at http://clang.llvm.org/docs/IntroductionToTheClangAST.html

-- Ian.