[llvm-commits] [PATCH] removing a newline when printing a Global Variable

Saša Tomić tomic80 at gmail.com
Fri Sep 7 04:19:28 PDT 2012


Hi Duncan,

I'm not sure how to add a testcase, but I'll try to explain the issue at 
hand.

// You have: Value *a, *b, *c; And you call:
dbgs() << *a << "\n";
dbgs() << *b << "\n";
dbgs() << *c << "\n";

This should print *a, *b, and *c with consistent formatting. For example:
---------
@shared = common global i32** null, align 8
%arrayidx = getelementptr inbounds i32** %4, i64 %idxprom, !dbg !26
%i = alloca i32, align 4
---------

However, if 'a' happens to be a global variable, its .print() method 
will append one more newline, like this:
---------
@shared = common global i32** null, align 8

%arrayidx = getelementptr inbounds i32** %4, i64 %idxprom, !dbg !26
%i = alloca i32, align 4
---------

I hope I was clear enough.


Best regards,
Saša

On 09/07/2012 12:33 PM, Duncan Sands wrote:
> Hi Saša, welcome to LLVM!
>
> On 07/09/12 10:25, Saša Tomić wrote:
>> And of course, the first patch was wrong -- it included git color 
>> codes. :(
>> Here's the correct one.
>
> Thanks for the patch, but: why is it correct - what is the issue you 
> are fixing?
> Can you give an example?  Also, please add a testcase.
>
> Best wishes, Duncan.
>
>>
>> On 09/07/2012 10:23 AM, Saša Tomić wrote:
>>> Hi to all,
>>>
>>> this is my first patch for LLVM. I'm not really aware of all the 
>>> rules and the
>>> norms that should be followed here.
>>> I did read the text at http://llvm.org/docs/DeveloperPolicy.html
>>>
>>> This is just a minor fix, dropping a newline when a global variable 
>>> is printed.
>>> So here is the patch (in the attachment).
>>>
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

-- 
best regards,
Saša




More information about the llvm-commits mailing list