Ericsson / clang

Cross Translation Unit analysis capability for Clang Static Analyzer. (Fork of official clang at http://llvm.org/git/clang)
http://clang.llvm.org/
Other
15 stars 10 forks source link

Use ExtInfo in structural equivalency #529

Closed martong closed 5 years ago

martong commented 5 years ago

This is related to: https://reviews.llvm.org/D53699

Alexey draws my attention to that we should not discard all info from the ExtInfo struct. We definitely want to check e.g. the calling convention bits.

balazske commented 5 years ago

It may be correct to check these values. But I am not sure if these are set correctly at the time of the check during import (in the imported FunctionProtoType), these are copied at import but maybe updated later like isUsed?

martong commented 5 years ago

These are valid questions so I made my homework:

In VisitFunctionProtoType or in VisitFunctionNoProtoType we do not check any structural equivalency. We do check, however, in VisitFunctionDecl: in that function before we create the FunctionDecl we first import the type which will end up calling VisitFunction[No]ProtoType. Consequently, when we check for structural eq of two FunctionDecls we already have the ExtInfo and their type properly initialized and set. Also I checked that the ExtInfo is modified (copied) only in VisitFunctionProtoType and in VisitFunctionNoProtoType. So this seems safe to me.

martong commented 5 years ago

Any objections to merge this?

martong commented 5 years ago

https://reviews.llvm.org/D53699