[LLVMdev] Variable declarations vs. definitions

Dustin Laurence dllaurence at dslextreme.com
Sat Jan 9 19:13:06 PST 2010


On 01/09/2010 06:53 PM, Chris Lattner wrote:

> Patches welcome!

Well, the time I'm motivated to write about something is when I'm
learning and it's relevant to me.  But the IR Reference is a reference,
and should be rigorously correct.  I can't be that, most of all on this
linkage stuff.  For example, the 'external' keyword almost doesn't
appear in the manual, but how and where precisely it should be described
I probably don't know enough to say.  Does it count as a linkage
specification?

The single thing that would make the IR reference more useful would be
more examples, since I often couldn't quite reverse engineer the details
from the description and there was no example, or the given example
didn't cover my use case.  If you are willing to devote more space to
expanding the example snippets, perhaps that's doable for an amateur.
There certainly are plenty in my source tree.

If I'm the only guy on the planet writing extensive IR by hand, perhaps
the issues I want to resolve are uncommon ones.  Who else worries about
how to declare global variables in preprocessed header files? :-)  If
you're machine-generating source, I imagine you don't need header files.
 You just emit the declarations as many times as you need them.  As I am
not a machine, I need consistency and "once and only once" definitions.

Dustin



More information about the llvm-dev mailing list