Verification of the type of language (C or C++) within the body of a function/method


Is there any way to verify that the code within the body or a function or method is pure C or if it has C++ statements?



I don't think this is a valid question to ask. You can have C-like
constructs that actually use C++ features that are not visible in
syntax. For example, function overloading:

void f(void *);
void f(int);

void g() {

"g" uses only statements that exist in C, but it depends on overload
resolution and you can not determine that based on syntax only.


Well actually the CXXRecordDecl considers something like this by means of the "isCLike()", but for the whole class and not for the statements within a given method. It says about isCLike():

"True if this class is C-like, without C++-specific features, e.g. it contains only public fields, no bases, tag kind is not 'class', etc."

But in my case I am interested on not having C++ statements in the methods such as "try-catch", etc. In features like function overloading is not something I need to verify.