[cfe-users] Dealing with invalid code in clang

Fuyao Zhao via cfe-users cfe-users at lists.llvm.org
Fri Sep 30 13:38:34 PDT 2016


I'm developing a code browsing tool based on clang. And one problem I have
is how to handle invalid code. e.g.

#include "B.h"

class A {
  B b;

if clang can't find B.h so that B is undefined, then it seems
RecursiveASTVisitor don't even let you visit the AST for invalid "B" under

However, in my use case, I really want to go to that AST node "B" and find
out that it is a invalid AST and then try do to search the symbol from
other places (e.g. database).

So is there anyway we could potentially access the invalid AST?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20160930/0b9eab28/attachment.html>

More information about the cfe-users mailing list