[cfe-dev] Semantic Analysis in Clang

Dmitri Gribenko gribozavr at gmail.com
Fri Jan 25 04:20:54 PST 2013


On Fri, Jan 25, 2013 at 2:13 PM, Mohammad Adil <madil90 at gmail.com> wrote:
> Thanks for the reply. Well, here's the detailed problem. Once all the syntax
> checking has been done, the next step before generating IR is to do semantic
> analysis and type checking. Let us say that I encounter a code like this:
>
> string b;
> vector<T> a;
> cout<<b;
> cout<<a;
>
>       How does clang figure out that the 3rd statement is valid because an
> operator for string exists, while the 4rth statement is not valid. More
> specifically, I want to know how clang searches through all the operators
> (or functions). I have to use this functionality. Does the clang api allow
> me to do this easily or will I have to replicate this functionality?

Search for 'overload resolution'.

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