> > Not sure > > what 'internal' would mean in this context. > > > > But then the implementation looks at callee->externally_visible which > > matches hidden visibility... externally_visible is probably not > > the very best thing to look at depending on what we intend to do. > > from the comments of callee->externally_visible in cgraph.h: > > /* Set when function is visible by other units. */ > unsigned externally_visible : 1; > > My understand of this “externally_visible” is: > > this function is visible from other compilation units. > > Is this correct?
Yes, but the catch is that we may "localize" previously visible function into invisible by clonning, see my previous email. > > Note you shouldn't look at individual cgraph_node fields but use > > some of the accessors with more well-constrained semantics. > > Why are you not simply checking !TREE_PUBLIC? > > Yes, looks like that TREE_PUBLIC(node->decl) might be better for this purpose. externally_visible is better approximation, TREE_PUBLIC is false i.e. for weakref aliases. But we need to check places where externally visible functions are turned to local. What about comdats in general? What is the intended behaviour? If you prevent inlining them completely, C++ programs will be very slow. Also we still can analyze the body and derive some facts about them to drive optimization (such as discovering that they are const/pure etc). Do we want to disable this too? Honza