[cfe-dev] Using Clang AST classes to generate LLVM IR for a compiler front-end

Dmitri Gribenko gribozavr at gmail.com
Mon Dec 24 11:50:49 PST 2012


On Mon, Dec 24, 2012 at 9:31 PM, Sean Silva <silvas at purdue.edu> wrote:
>> So my question is: Would it be worth the trouble to learn and use the Clang
>> AST library so that my font-end can use it, and would it be a good option
>> for the future?
>
> In short: it probably won't be worth your effort. Clang's AST is
> extremely complicated (reflective of the complexity of C++).

I agree.  But it is a good idea to look briefly at Clang architecture
and copy it as much as makes sense for your project.  You can even
take whole classes like SourceManager/SourceLocation or diagnostics
infrastructure (after decoupling from preprocessor since you don't
have one), or use LLVM's ADT library.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the cfe-dev mailing list