[cfe-dev] Doubt about Decl::getDeclContext()

Abramo Bagnara abramo.bagnara at gmail.com
Wed May 26 04:55:24 PDT 2010


I've just noted that unexpectedly (at least for me) getDeclContext()
applied to an extern VarDecl returns the FunctionDecl instead of the
TranslationUnitDecl:

int f() {
  extern int a;
}

Is this expected or a symptom of a bug?

The documentation say that getDeclContext() should return the semantic
DC of the declaration and I was using this to get the decl of parent
object of the declared object.

Should I do something different?



More information about the cfe-dev mailing list