Any C/C++ Refactoring Tool Based on Libclang? (Even Simplest "Toy Example" )

Getting AST for C++?

You can use clang and especially libclang to parse C++ code. It's a very high quality, hand written library for lexing, parsing and compiling C++ code but it can also generate an AST.

Clang also supports C, Objective-C and Objective-C++. Clang itself is written in C++.

Writing an update query in asp.net (access database) (visual basic)

I think the missing is SET.

Try: UPDATE table SET field = newvalue WHERE criteria;

Just modify:

sql = "UPDATE tblAccounts SET balance = " & CDbl(balance + value) & " WHERE(accountID = " & accountID & ")"

http://office.microsoft.com/en-us/access/HA100765271033.aspx

Using FromBase64Transform with CryptoStream?

I always the the Convert class to convert the string into an array of Byte.

An example:

    public static string DeCryptString(string s) {
byte[] b = System.Convert.FromBase64String(s);

using (MemoryStream ms = new MemoryStream(b))
using (CryptoStream cs = /* Create decrypting stream here */)
using (StreamReader sr = new StreamReader(cs)) {
string buf = sr.ReadToEnd();
return buf;
}
} // DeCryptString

Changing global variable names

just some suggestions, from my experience:

  • use eclipse: the C++ indexer is very good, and when dealing with a large project I find it very useful to track variables. shift+ctrl+g (I have forgotten how to access to it from menus!) let you search all the references, ctrl+alt+h (open call hierarchy) the caller-callee trees...

  • use eclipse: it has good refactoring tools, that is able to rename a variable without touching same-name-different-scope variables. (it often fails in case there are templates involved. I find it good, better than visual studio 2008 counterpart).

  • use eclipse: I know, it get some time to get started with it, but after you get it, it's very powerful. It can deal easily with the existing makefile based project (file -> new -> project -> makefile project with existing code).

  • I would consider not to use class members, but accessors: it's possibile that some of them will be shared among threads, and need some locking in order to be properly used. So I would prefer: classinstance->get_global_name()

As a final note, I don't know whether using the eclipse indexer at command-line would be helpful for your task. You can find some examples googling for it.

This question/answer can give you some more hints: any C/C++ refactoring tool based on libclang? (even simplest "toy example" ). In particular I do quote "...C++ is a bitch of a language to transform"



Related Topics



Leave a reply



Submit