Anastasia added inline comments.

================
Comment at: lib/Sema/SemaInit.cpp:6945
@@ +6944,3 @@
+          // get the integer literal.
+          Init = cast<ImplicitCastExpr>(const_cast<Expr*>(
+            Var->getInit()))->getSubExpr();
----------------
Could you please take a look at the new diagnostics you are adding in 
DiagnosticSemaKinds.td. I don't think they are all covered by your tests.

I understand that you have to insert the cast even though it looks a bit hacky, 
so we might need to put more comments here to explain why this is needed. But 
certainly diagnostics code seems to be doing extra work. For the following code:
 
  constant sampler_t glb_smp = 1L;
  void foo(sampler_t);
  void bar(){
    foo(glb_smp);
  }

I get diagnostics reported twice:
  sampler.cl:1:20: error: sampler_t initialization requires 32-bit integer, not 
'long'
  constant sampler_t glb_smp = 1L;
  sampler.cl:6:5: error: sampler_t initialization requires 32-bit integer, not 
'long'
  foo(glb_smp);

The second diagnostic doesn't seem right at all.

Could you please take a look.


https://reviews.llvm.org/D21567



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to