Anastasia added inline comments.

================
Comment at: test/SemaOpenCL/implicit-typedef.cl:3
@@ +2,3 @@
+// RUN: %clang_cc1 %s -cl-std=CL2.0 -fsyntax-only
+
+#if defined(TEST_WARNINGS)
----------------
ichesnokov wrote:
> Anastasia wrote:
> > ichesnokov wrote:
> > > Are you mean another text of warning? Notice that actual patch will work 
> > > not only in OpenCL, but any language. If builtin functions present, it 
> > > will prevent the crash. The single message "redefinition of typedef 
> > > 'atomic_flag' is a C11 feature" is default for all targets.
> > > Do you want to have specific warning text for OpenCL?
> > No, you can use select{OpenCL|C11} or you can pass 'OpenCL' or 'C11' as a 
> > string to the diagnostic as an argument.
> > 
> > You can take a look at err_opencl_unknown_type_specifier as an example, 
> > that uses both approaches.
> > 
> > LangOpts.OpenCL will help you to detect the language mode for 
> > selecting/passing the right string.
> > 
> I can't find anything like select{} in my local copy (there's LLVM and Clang).
> I also can't find err_opencl_unknown_type_specifier, such file is not 
> presernt in my WC (updated today).
> 
> > LangOpts.OpenCL will help you to detect the language mode for 
> > selecting/passing the right string.
> Currently it checks both Microsoft and Itanium manglers on all platforms, 
> with one test case.
> I am not sure how to use LangOpts.OpenCL... We are making .cl test suite and 
> C++ classes will be unavailble here.
> 
> Excuse me, could you please explain more?
Example of select is in include/clang/Basic/DiagnosticSemaKinds.td line 7707 at 
revision 259811.
  def err_opencl_unknown_type_specifier : Error<
    "OpenCL does not support the '%0' %select{type qualifier|storage class 
specifier}1">;


Regarding the OpenCL check you can call getLangOpts().OpenCL to check if you 
compile for OpenCL (see examples in lib/Sema/SemaDecl.cpp).
You can do something like:
  bool IsOpenCL  = getLangOpts().OpenCL ? 1: 0;  
  Diag(New->getLocation(), diag::ext_redefinition_of_typedef)
              << New->getDeclName() << IsOpenCL;




http://reviews.llvm.org/D16351



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

Reply via email to