[cfe-dev] Few questions related to type checking in clang

Amila Jayasekara thejaka.amila at gmail.com
Tue Sep 2 23:30:34 PDT 2014


Hi Nikola,

Thanks a lot for the response.


On Wed, Sep 3, 2014 at 1:56 AM, Nikola Smiljanic <popizdeh at gmail.com> wrote:

> 1. Sema is responsible for building the ast, after doing all the checks.
> Act methods are 'hooks' that Parser uses to call into Sema. Build methods
> are used to build the actual ast nodes.
>
> 2. Various declaration classes have methods that return QualType, see
> http://clang.llvm.org/docs/InternalsManual.html#the-qualtype-class. So
> VarDecl has getType but FunctionDecl in addtion has getReturnType and
> getFunctionType, etc.
>

I am actually looking for the class which contains all VarDecl's for a
program. As an example, if I have a program as follows;

int a;
bool b;
...
...

I am assuming there is a some sort of a container in clang which keeps all
declaration data.
Suppose the container is named as TypeEnvironment for the moment. Then I
need to query type information about each declaration with code similar to
following;

TypeEnvironment.get("a")
TypeEnvironment.get("b")

etc ...

So I am looking for the closest implementation in clang, which gives me the
functionality of TypeEnvironment (in example above).

Thanks
-Thejaka Amila



>
>
> On Wed, Sep 3, 2014 at 1:02 PM, Amila Jayasekara <thejaka.amila at gmail.com>
> wrote:
>
>> Hi All,
>>
>> I am fairly new to clang. I am trying to implement experimental type
>> checking rules for lambda functions. I would mainly like to get feedback on
>> following;
>>
>> 1. I believe clang/lib/Sema is responsible for carrying out type
>> checking. In the files in clang/lib/Sema I mainly saw 2 types of functions;
>> a. BuildXXX functions and ActOnXXX functions. Which function pattern
>> contains actual type checking implementations ? (In other words in which
>> functions we do type checking ? e.g. :- function type checking etc ...)
>>
>> 2. In clang where (the class responsible) do we keep the information
>> about type environment (i.e. type information about each variable, function
>> etc ...) and how to retrieve/update type information ?
>>
>> Will be great if I could get feedback on above.
>>
>> Thank you in advance.
>>
>> Regards
>> Thejaka Amila
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140903/c73f49ed/attachment.html>


More information about the cfe-dev mailing list