annotations not working with functions

Annotations work with global variables but do not work with functions. Is it supposed to work or am I missing something?

I have test case :

void foo() attribute((annotate(“test”)));

int global attribute ((annotate(“test_global”)));

int i;

void foo() {

i =20;

}

The .ll generated for it is :

target triple = “i386-pc-linux-gnu”

type { i8*, i8*, i8*, i32 } ; type %0

@i = common global i32 0, align 4 ; <i32*> [#uses=1]

@global = common global i32 0, align 4 ; <i32*> [#uses=1]

@global.str = internal global [12 x i8] c"test_global\00" ; <[12 x i8]*> [#uses=1]

@.str = internal global [7 x i8] c"test.c\00" ; <[7 x i8]*> [#uses=1]

@llvm.global.annotations = appending global [1 x %0] [%0 { i8* bitcast (i32* @global to i8*), i8* getelementptr ([12 x i8]* @global.str, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str, i32 0, i32 0), i32 2 }], section “llvm.metadata” ; <[1 x %0]*> [#uses=0]

define void @foo() nounwind {

entry:

store i32 20, i32* @i

ret void

}

Regards

Vasudev

http://llvm.org/bugs/show_bug.cgi?id=2490

-Eli

Is anyone working on this?

I would especially be interested in something where it is possible to annotate local variables and types as well.

For example:

typedef struct foo {

} foo __attribute__((annote("blah"));

It would be really nice if this could pass on the annotation to llvm (possibly by applying the annotation to all variables of the type).

/ Mattias

Eli Friedman wrote:

Is anyone working on this?

I would especially be interested in something where it is possible to
annotate local variables and types as well.

For example:

typedef struct foo {

} foo __attribute__((annote("blah"));

It would be really nice if this could pass on the annotation to llvm
(possibly by applying the annotation to all variables of the type).

I'm not aware of anyone working on this, but it shouldn't be too hard to add. It's a great beginner project :slight_smile:

-Chris

I will probably start working on this after a paper deadline next week.

A few practical questions:

Do I submit patches here or on the commit list?

Are the git clones of clang and llvm at http://repo.or.cz/ semi-official? Or are there some other source for a more official git based clone of the SVN repo? Not that I mind using SVN, but it is just slow when diffing revisions.

I will probably come more questions later on.

/Mattias

Chris Lattner wrote:

I will probably start working on this after a paper deadline next week.

A few practical questions:

Do I submit patches here or on the commit list?

Either is fine. My suggestion: if it's a large patch that's likely to cause discussion, send it here. For smaller fixes, send them to the commit list.

Are the git clones of clang and llvm at http://repo.or.cz/
semi-official? Or are there some other source for a more official git
based clone of the SVN repo? Not that I mind using SVN, but it is just
slow when diffing revisions.

I don't think we have any official/semi-official git clones, but perhaps someone else can correct me.

  - Doug

Its probably fair to say that the clones at repo.or.cz are
"semi-official", they are maintained by Anton, an active LLVM
developer.

- Daniel