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

            Bug ID: 16560
           Summary: getSourceRange() for InitListExpr does not return full
                    range for vector initliazation
           Product: clang
           Version: 3.2
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

I'm getting some strange behaviour, when I'm trying to get source range for
vector initalizations.

I have declaration (in global scope):

__constant float4 base_factor = (float4)(1.0f,2.0f,3.0f,4.0f);

Which is parsed to following AST:

(InitListExpr 0x7f8a9bcd3cf0 'float4':'float
__attribute__((ext_vector_type(4)))'
  (FloatingLiteral 0x7f8a9bcd3c18 'float' 1.000000e+00)
  (FloatingLiteral 0x7f8a9bcd3c38 'float' 2.000000e+00)
  (FloatingLiteral 0x7f8a9bcd3c58 'float' 3.000000e+00)
  (FloatingLiteral 0x7f8a9bcd3c78 'float' 4.000000e+00))

However when I'm trying to get them as string from rewriter with
getRewrittenText(init->getSourceRange())

I get only the first parenthesis:

(float4)

As a comparison, when I test normal table initialization everything seems fine:

__constant float base_table[] = { 1.0f,2.0f,3.0f,4.0f };

(InitListExpr 0x7fb470cd3fe8 '__constant float [4]'
  (FloatingLiteral 0x7fb470cd3f08 'float' 1.000000e+00)
  (FloatingLiteral 0x7fb470cd3f28 'float' 2.000000e+00)
  (FloatingLiteral 0x7fb470cd3f48 'float' 3.000000e+00)
  (FloatingLiteral 0x7fb470cd3f68 'float' 4.000000e+00))

Source location returns: { 1,2,3,4 }

Sounds like a similar problem to http://llvm.org/bugs/show_bug.cgi?id=3365 ,
which was fixed few years ago.

Thanks, Mikael

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to