r253843 - [MS ABI] Tolerate invokes of __RTDynamicCast

2015-11-22 Thread David Majnemer via cfe-commits
Author: majnemer
Date: Sun Nov 22 21:01:14 2015
New Revision: 253843

URL: http://llvm.org/viewvc/llvm-project?rev=253843=rev
Log:
[MS ABI] Tolerate invokes of __RTDynamicCast

The pointer returned by __RTDynamicCast must be bitcasted.  However, it
was not expected that __RTDynamicCast would be invoked, resulting in the
bitcast occuring in a different BasicBlock than the invoke.  This caused
a down-stream PHI to get confused about which BasicBlock the incomming
value was from.

This fixes PR25606.

Modified:
cfe/trunk/lib/CodeGen/CGExprCXX.cpp
cfe/trunk/test/CodeGenCXX/microsoft-abi-dynamic-cast.cpp

Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=253843=253842=253843=diff
==
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Sun Nov 22 21:01:14 2015
@@ -1904,6 +1904,7 @@ llvm::Value *CodeGenFunction::EmitDynami
"destination type must be a record type!");
 Value = CGM.getCXXABI().EmitDynamicCastCall(*this, ThisAddr, SrcRecordTy,
 DestTy, DestRecordTy, CastEnd);
+CastNotNull = Builder.GetInsertBlock();
   }
 
   if (ShouldNullCheckSrcValue) {

Modified: cfe/trunk/test/CodeGenCXX/microsoft-abi-dynamic-cast.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/microsoft-abi-dynamic-cast.cpp?rev=253843=253842=253843=diff
==
--- cfe/trunk/test/CodeGenCXX/microsoft-abi-dynamic-cast.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/microsoft-abi-dynamic-cast.cpp Sun Nov 22 
21:01:14 2015
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -O1 -o - -triple=i386-pc-win32 %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -O1 -o - -fexceptions -triple=i386-pc-win32 %s | 
FileCheck %s
 
 struct S { char a; };
 struct V { virtual void f(); };
@@ -122,3 +122,22 @@ void* test9(B* x) { return dynamic_cast<
 // CHECK:[[RET:%.*]] = phi i8*
 // CHECK-NEXT:   ret i8* [[RET]]
 
+namespace PR25606 {
+struct Cleanup {
+  ~Cleanup();
+};
+struct S1 { virtual ~S1(); };
+struct S2 : virtual S1 {};
+struct S3 : S2 {};
+
+S3 *f(S2 ) {
+  Cleanup c;
+  return dynamic_cast();
+}
+// CHECK-LABEL: define %"struct.PR25606::S3"* 
@"\01?f@PR25606@@YAPAUS3@1@AAUS2@1@@Z"(
+// CHECK:[[CALL:%.*]] = invoke i8* @__RTDynamicCast
+
+// CHECK:[[BC:%.*]] = bitcast i8* [[CALL]] to %"struct.PR25606::S3"*
+// CHECK:call x86_thiscallcc void @"\01??_DCleanup@PR25606@@QAE@XZ"(
+// CHECK:ret %"struct.PR25606::S3"* [[BC]]
+}


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


r253851 - Revert r253846 (build bot failure))

2015-11-22 Thread Xinliang David Li via cfe-commits
Author: davidxl
Date: Sun Nov 22 23:41:05 2015
New Revision: 253851

URL: http://llvm.org/viewvc/llvm-project?rev=253851=rev
Log:
Revert r253846 (build bot failure))

Removed:
cfe/trunk/test/CodeGen/x86_64-profiling-keep-fp.c
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=253851=253850=253851=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Sun Nov 22 23:41:05 2015
@@ -2794,8 +2794,6 @@ static bool shouldUseFramePointer(const
   if (Arg *A = Args.getLastArg(options::OPT_fno_omit_frame_pointer,
options::OPT_fomit_frame_pointer))
 return A->getOption().matches(options::OPT_fno_omit_frame_pointer);
-  if (Args.hasArg(options::OPT_pg))
-return true;
 
   return shouldUseFramePointerForTarget(Args, Triple);
 }
@@ -2805,8 +2803,6 @@ static bool shouldUseLeafFramePointer(co
   if (Arg *A = Args.getLastArg(options::OPT_mno_omit_leaf_frame_pointer,
options::OPT_momit_leaf_frame_pointer))
 return A->getOption().matches(options::OPT_mno_omit_leaf_frame_pointer);
-  if (Args.hasArg(options::OPT_pg))
-return true;
 
   if (Triple.isPS4CPU())
 return false;

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=253851=253850=253851=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Sun Nov 22 23:41:05 2015
@@ -453,8 +453,7 @@ static bool ParseCodeGenArgs(CodeGenOpti
   Opts.CXXCtorDtorAliases = Args.hasArg(OPT_mconstructor_aliases);
   Opts.CodeModel = getCodeModel(Args, Diags);
   Opts.DebugPass = Args.getLastArgValue(OPT_mdebug_pass);
-  Opts.DisableFPElim =
-  (Args.hasArg(OPT_mdisable_fp_elim) || Args.hasArg(OPT_pg));
+  Opts.DisableFPElim = Args.hasArg(OPT_mdisable_fp_elim);
   Opts.DisableFree = Args.hasArg(OPT_disable_free);
   Opts.DisableTailCalls = Args.hasArg(OPT_mdisable_tail_calls);
   Opts.FloatABI = Args.getLastArgValue(OPT_mfloat_abi);

Removed: cfe/trunk/test/CodeGen/x86_64-profiling-keep-fp.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_64-profiling-keep-fp.c?rev=253850=auto
==
--- cfe/trunk/test/CodeGen/x86_64-profiling-keep-fp.c (original)
+++ cfe/trunk/test/CodeGen/x86_64-profiling-keep-fp.c (removed)
@@ -1,13 +0,0 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -O3 -pg -S -o - %s | \
-// RUN:   FileCheck %s
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -O3 
-momit-leaf-frame-pointer -pg -S -o - %s | \
-// RUN:   FileCheck %s
-
-// Test that the frame pointer is kept when compiling with
-// profiling.
-
-//CHECK: pushq %rbp
-int main(void)
-{
-  return 0;
-}


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


Re: [PATCH] D14134: [OpenMP] Parsing and sema support for map clause

2015-11-22 Thread Kelvin Li via cfe-commits
kkwli0 closed this revision.
kkwli0 added a comment.

Committed revision 253849.
Committed revision 253850.


http://reviews.llvm.org/D14134



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


r253846 - Disable frame pointer elimination when using -pg

2015-11-22 Thread Xinliang David Li via cfe-commits
Author: davidxl
Date: Sun Nov 22 23:09:10 2015
New Revision: 253846

URL: http://llvm.org/viewvc/llvm-project?rev=253846=rev
Log:
Disable frame pointer elimination when using -pg

This diff makes sure that the driver does not pass
-fomit-frame-pointer or -momit-leaf-frame-pointer to
the frontend when -pg is used. Currently, clang gives 
an error if -fomit-frame-pointer is used in combination 
with -pg, but -momit-leaf-frame-pointer was forgotten.
Also, disable frame pointer elimination in the frontend 
when -pg is set.

Patch by Stefan Kempf.

Added:
cfe/trunk/test/CodeGen/x86_64-profiling-keep-fp.c
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=253846=253845=253846=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Sun Nov 22 23:09:10 2015
@@ -2794,6 +2794,8 @@ static bool shouldUseFramePointer(const
   if (Arg *A = Args.getLastArg(options::OPT_fno_omit_frame_pointer,
options::OPT_fomit_frame_pointer))
 return A->getOption().matches(options::OPT_fno_omit_frame_pointer);
+  if (Args.hasArg(options::OPT_pg))
+return true;
 
   return shouldUseFramePointerForTarget(Args, Triple);
 }
@@ -2803,6 +2805,8 @@ static bool shouldUseLeafFramePointer(co
   if (Arg *A = Args.getLastArg(options::OPT_mno_omit_leaf_frame_pointer,
options::OPT_momit_leaf_frame_pointer))
 return A->getOption().matches(options::OPT_mno_omit_leaf_frame_pointer);
+  if (Args.hasArg(options::OPT_pg))
+return true;
 
   if (Triple.isPS4CPU())
 return false;

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=253846=253845=253846=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Sun Nov 22 23:09:10 2015
@@ -453,7 +453,8 @@ static bool ParseCodeGenArgs(CodeGenOpti
   Opts.CXXCtorDtorAliases = Args.hasArg(OPT_mconstructor_aliases);
   Opts.CodeModel = getCodeModel(Args, Diags);
   Opts.DebugPass = Args.getLastArgValue(OPT_mdebug_pass);
-  Opts.DisableFPElim = Args.hasArg(OPT_mdisable_fp_elim);
+  Opts.DisableFPElim =
+  (Args.hasArg(OPT_mdisable_fp_elim) || Args.hasArg(OPT_pg));
   Opts.DisableFree = Args.hasArg(OPT_disable_free);
   Opts.DisableTailCalls = Args.hasArg(OPT_mdisable_tail_calls);
   Opts.FloatABI = Args.getLastArgValue(OPT_mfloat_abi);

Added: cfe/trunk/test/CodeGen/x86_64-profiling-keep-fp.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_64-profiling-keep-fp.c?rev=253846=auto
==
--- cfe/trunk/test/CodeGen/x86_64-profiling-keep-fp.c (added)
+++ cfe/trunk/test/CodeGen/x86_64-profiling-keep-fp.c Sun Nov 22 23:09:10 2015
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -O3 -pg -S -o - %s | \
+// RUN:   FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -O3 
-momit-leaf-frame-pointer -pg -S -o - %s | \
+// RUN:   FileCheck %s
+
+// Test that the frame pointer is kept when compiling with
+// profiling.
+
+//CHECK: pushq %rbp
+int main(void)
+{
+  return 0;
+}


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


r253849 - [OpenMP] Parsing and sema support for map clause

2015-11-22 Thread Kelvin Li via cfe-commits
Author: kli
Date: Sun Nov 22 23:32:03 2015
New Revision: 253849

URL: http://llvm.org/viewvc/llvm-project?rev=253849=rev
Log:
[OpenMP] Parsing and sema support for map clause

http://reviews.llvm.org/D14134 

Modified:
cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h
cfe/trunk/include/clang/AST/OpenMPClause.h
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Basic/OpenMPKinds.def
cfe/trunk/include/clang/Basic/OpenMPKinds.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/OpenMPClause.cpp
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/AST/StmtProfile.cpp
cfe/trunk/lib/Basic/OpenMPKinds.cpp
cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
cfe/trunk/lib/Parse/ParseOpenMP.cpp
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
cfe/trunk/test/OpenMP/target_ast_print.cpp
cfe/trunk/test/OpenMP/target_data_ast_print.cpp
cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h?rev=253849=253848=253849=diff
==
--- cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h Sun Nov 22 23:32:03 
2015
@@ -2707,6 +2707,12 @@ bool RecursiveASTVisitor::Visit
   return true;
 }
 
+template 
+bool RecursiveASTVisitor::VisitOMPMapClause(OMPMapClause *C) {
+  TRY_TO(VisitOMPClauseList(C));
+  return true;
+}
+
 // FIXME: look at the following tricky-seeming exprs to see if we
 // need to recurse on anything.  These are ones that have methods
 // returning decls or qualtypes or nestednamespecifier -- though I'm

Modified: cfe/trunk/include/clang/AST/OpenMPClause.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OpenMPClause.h?rev=253849=253848=253849=diff
==
--- cfe/trunk/include/clang/AST/OpenMPClause.h (original)
+++ cfe/trunk/include/clang/AST/OpenMPClause.h Sun Nov 22 23:32:03 2015
@@ -2613,6 +2613,121 @@ public:
   }
 };
 
+/// \brief This represents clause 'map' in the '#pragma omp ...'
+/// directives.
+///
+/// \code
+/// #pragma omp target map(a,b)
+/// \endcode
+/// In this example directive '#pragma omp target' has clause 'map'
+/// with the variables 'a' and 'b'.
+///
+class OMPMapClause : public OMPVarListClause {
+  friend class OMPClauseReader;
+
+  /// \brief Map type modifier for the 'map' clause.
+  OpenMPMapClauseKind MapTypeModifier;
+  /// \brief Map type for the 'map' clause.
+  OpenMPMapClauseKind MapType;
+  /// \brief Location of the map type.
+  SourceLocation MapLoc;
+  /// \brief Colon location.
+  SourceLocation ColonLoc;
+
+  /// \brief Set type modifier for the clause.
+  ///
+  /// \param T Type Modifier for the clause.
+  ///
+  void setMapTypeModifier(OpenMPMapClauseKind T) { MapTypeModifier = T; }
+
+  /// \brief Set type for the clause.
+  ///
+  /// \param T Type for the clause.
+  ///
+  void setMapType(OpenMPMapClauseKind T) { MapType = T; }
+
+  /// \brief Set type location.
+  ///
+  /// \param TLoc Type location.
+  ///
+  void setMapLoc(SourceLocation TLoc) { MapLoc = TLoc; }
+
+  /// \brief Set colon location.
+  void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
+
+  /// \brief Build clause with number of variables \a N.
+  ///
+  /// \param MayTypeModifier Map type modifier.
+  /// \param MapType Map type.
+  /// \param MapLoc Location of the map type.
+  /// \param StartLoc Starting location of the clause.
+  /// \param EndLoc Ending location of the clause.
+  /// \param N Number of the variables in the clause.
+  ///
+  explicit OMPMapClause(OpenMPMapClauseKind MapTypeModifier,
+OpenMPMapClauseKind MapType, SourceLocation MapLoc,
+SourceLocation StartLoc, SourceLocation LParenLoc,
+SourceLocation EndLoc, unsigned N)
+: OMPVarListClause(OMPC_map, StartLoc, LParenLoc, EndLoc, N),
+  MapTypeModifier(MapTypeModifier), MapType(MapType), MapLoc(MapLoc) {}
+
+  /// \brief Build an empty clause.
+  ///
+  /// \param N Number of variables.
+  ///
+  explicit OMPMapClause(unsigned N)
+  : OMPVarListClause(OMPC_map, SourceLocation(),
+   SourceLocation(), SourceLocation(), N),
+MapTypeModifier(OMPC_MAP_unknown), MapType(OMPC_MAP_unknown), MapLoc() 
{}
+
+public:
+  /// \brief Creates clause with a list of variables \a VL.
+  ///
+  /// \param C AST context.
+  /// \brief StartLoc Starting location of the clause.
+  /// \brief EndLoc Ending location of the clause.
+  /// 

r253854 - OpenMPClause.h: Fix typos. [-Wdocumentation]

2015-11-22 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Mon Nov 23 00:41:50 2015
New Revision: 253854

URL: http://llvm.org/viewvc/llvm-project?rev=253854=rev
Log:
OpenMPClause.h: Fix typos. [-Wdocumentation]

Modified:
cfe/trunk/include/clang/AST/OpenMPClause.h

Modified: cfe/trunk/include/clang/AST/OpenMPClause.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OpenMPClause.h?rev=253854=253853=253854=diff
==
--- cfe/trunk/include/clang/AST/OpenMPClause.h (original)
+++ cfe/trunk/include/clang/AST/OpenMPClause.h Mon Nov 23 00:41:50 2015
@@ -2657,7 +2657,7 @@ class OMPMapClause : public OMPVarListCl
 
   /// \brief Build clause with number of variables \a N.
   ///
-  /// \param MayTypeModifier Map type modifier.
+  /// \param MapTypeModifier Map type modifier.
   /// \param MapType Map type.
   /// \param MapLoc Location of the map type.
   /// \param StartLoc Starting location of the clause.
@@ -2684,8 +2684,8 @@ public:
   /// \brief Creates clause with a list of variables \a VL.
   ///
   /// \param C AST context.
-  /// \brief StartLoc Starting location of the clause.
-  /// \brief EndLoc Ending location of the clause.
+  /// \param StartLoc Starting location of the clause.
+  /// \param EndLoc Ending location of the clause.
   /// \param VL List of references to the variables.
   /// \param TypeModifier Map type modifier.
   /// \param Type Map type.


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


Re: [PATCH] D13802: [OPENMP] Make -fopenmp to turn on OpenMP support by default.

2015-11-22 Thread Alexey Bataev via cfe-commits
ABataev added a comment.

Chandler, gcc buildbot greenified, tests for clang are fixed. Hans Wennborg 
accepted this patch. Could accept this patch?


http://reviews.llvm.org/D13802



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


r253850 - [OpenMP] Parsing and sema support for map clause - add test case

2015-11-22 Thread Kelvin Li via cfe-commits
Author: kli
Date: Sun Nov 22 23:36:37 2015
New Revision: 253850

URL: http://llvm.org/viewvc/llvm-project?rev=253850=rev
Log:
[OpenMP] Parsing and sema support for map clause - add test case

http://reviews.llvm.org/D14134 


Added:
cfe/trunk/test/OpenMP/target_map_messages.cpp

Added: cfe/trunk/test/OpenMP/target_map_messages.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_map_messages.cpp?rev=253850=auto
==
--- cfe/trunk/test/OpenMP/target_map_messages.cpp (added)
+++ cfe/trunk/test/OpenMP/target_map_messages.cpp Sun Nov 22 23:36:37 2015
@@ -0,0 +1,207 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
+
+void foo() {
+}
+
+bool foobool(int argc) {
+  return argc;
+}
+
+struct S1; // expected-note 2 {{declared here}}
+extern S1 a;
+class S2 {
+  mutable int a;
+public:
+  S2():a(0) { }
+  S2(S2 ):a(s2.a) { }
+  static float S2s; // expected-note 4 {{mappable type cannot contain static 
members}}
+  static const float S2sc; // expected-note 4 {{mappable type cannot contain 
static members}}
+};
+const float S2::S2sc = 0;
+const S2 b;
+const S2 ba[5];
+class S3 {
+  int a;
+public:
+  S3():a(0) { }
+  S3(S3 ):a(s3.a) { }
+};
+const S3 c;
+const S3 ca[5];
+extern const int f;
+class S4 {
+  int a;
+  S4();
+  S4(const S4 );
+public:
+  S4(int v):a(v) { }
+};
+class S5 {
+  int a;
+  S5():a(0) {}
+  S5(const S5 ):a(s5.a) { }
+public:
+  S5(int v):a(v) { }
+};
+
+S3 h;
+#pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or 
thread local}}
+
+typedef int from;
+
+template  // expected-note {{declared here}}
+T tmain(T argc) {
+  const T d = 5;
+  const T da[5] = { 0 };
+  S4 e(4);
+  S5 g(5);
+  T i, t[20];
+  T  = i;
+  T *k = 
+  T x;
+  T y;
+  T to, tofrom, always;
+  const T ()[5] = da;
+
+
+#pragma omp target map // expected-error {{expected '(' after 'map'}}
+#pragma omp target map( // expected-error {{expected ')'}} expected-note {{to 
match this '('}} expected-error {{expected expression}}
+#pragma omp target map() // expected-error {{expected expression}}
+#pragma omp target map(alloc) // expected-error {{use of undeclared identifier 
'alloc'}}
+#pragma omp target map(to argc // expected-error {{expected ')'}} 
expected-note {{to match this '('}} expected-error {{expected ',' or ')' in 
'map' clause}}
+#pragma omp target map(to:) // expected-error {{expected expression}}
+#pragma omp target map(from: argc, // expected-error {{expected expression}} 
expected-error {{expected ')'}} expected-note {{to match this '('}}
+#pragma omp target map(x: y) // expected-error {{incorrect map type, expected 
one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
+#pragma omp target map(x)
+  foo();
+#pragma omp target map(tofrom: t[:I])
+  foo();
+#pragma omp target map(T: a) // expected-error {{incorrect map type, expected 
one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
+  foo();
+#pragma omp target map(T) // expected-error {{'T' does not refer to a value}}
+  foo();
+#pragma omp target map(I) // expected-error 2 {{expected variable name, array 
element or array section}}
+  foo();
+#pragma omp target map(S2::S2s)
+  foo();
+#pragma omp target map(S2::S2sc)
+  foo();
+#pragma omp target map(x)
+  foo();
+#pragma omp target map(to: x)
+  foo();
+#pragma omp target map(to: to)
+  foo();
+#pragma omp target map(to)
+  foo();
+#pragma omp target map(to, x)
+  foo();
+#pragma omp target map(to x) // expected-error {{expected ',' or ')' in 'map' 
clause}}
+#pragma omp target map(tofrom: argc > 0 ? x : y) // expected-error 2 
{{expected variable name, array element or array section}} 
+#pragma omp target map(argc)
+#pragma omp target map(S1) // expected-error {{'S1' does not refer to a value}}
+#pragma omp target map(a, b, c, d, f) // expected-error {{incomplete type 'S1' 
where a complete type is required}} expected-error 2 {{type 'S2' is not 
mappable to target}}
+#pragma omp target map(ba) // expected-error 2 {{type 'S2' is not mappable to 
target}}
+#pragma omp target map(ca)
+#pragma omp target map(da)
+#pragma omp target map(S2::S2s)
+#pragma omp target map(S2::S2sc)
+#pragma omp target map(e, g)
+#pragma omp target map(h) // expected-error {{threadprivate variables are not 
allowed in map clause}}
+#pragma omp target map(k), map(k) // expected-error 2 {{variable already 
marked as mapped in current construct}} expected-note 2 {{used here}}
+#pragma omp target map(k), map(k[:5]) // expected-error 2 {{variable already 
marked as mapped in current construct}} expected-note 2 {{used here}}
+  foo();
+#pragma omp target map(da)
+#pragma omp target map(da[:4])
+  foo();
+#pragma omp target map(k, j, l) // expected-note 4 {{used here}}
+#pragma omp target map(k[:4]) // expected-error 2 {{variable already marked as 
mapped in current construct}}
+#pragma omp target map(j)
+#pragma omp target map(l[:5]) // expected-error 2 {{variable already marked as 

r253853 - [Driver] Mark isForDiagnostics as const. NFC.

2015-11-22 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Mon Nov 23 00:40:49 2015
New Revision: 253853

URL: http://llvm.org/viewvc/llvm-project?rev=253853=rev
Log:
[Driver] Mark isForDiagnostics as const. NFC.

Modified:
cfe/trunk/include/clang/Driver/Compilation.h

Modified: cfe/trunk/include/clang/Driver/Compilation.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Compilation.h?rev=253853=253852=253853=diff
==
--- cfe/trunk/include/clang/Driver/Compilation.h (original)
+++ cfe/trunk/include/clang/Driver/Compilation.h Mon Nov 23 00:40:49 2015
@@ -193,7 +193,7 @@ public:
   void initCompilationForDiagnostics();
 
   /// Return true if we're compiling for diagnostics.
-  bool isForDiagnostics() { return ForDiagnostics; }
+  bool isForDiagnostics() const { return ForDiagnostics; }
 };
 
 } // end namespace driver


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


Re: [PATCH] D14877: Fix ICE on lowering of constexpr vector splats

2015-11-22 Thread George Burgess IV via cfe-commits
george.burgess.iv updated this revision to Diff 40895.
george.burgess.iv added a comment.

We now add implicit casts to splatted literals, as Richard suggested, instead 
of trying to handle this as a special case in `ExprConstant`.


http://reviews.llvm.org/D14877

Files:
  include/clang/Sema/Sema.h
  lib/AST/ExprConstant.cpp
  lib/CodeGen/CGExprConstant.cpp
  lib/Sema/SemaCast.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaExprCXX.cpp
  test/CodeGenCXX/builtins-systemz-zvector.cpp

Index: test/CodeGenCXX/builtins-systemz-zvector.cpp
===
--- /dev/null
+++ test/CodeGenCXX/builtins-systemz-zvector.cpp
@@ -0,0 +1,50 @@
+// REQUIRES: systemz-registered-target
+// RUN: %clang_cc1 -target-cpu z13 -triple s390x-linux-gnu \
+// RUN: -fzvector -fno-lax-vector-conversions -std=c++11 \
+// RUN: -Wall -Wno-unused -Werror -emit-llvm %s -o - | FileCheck %s
+
+bool gb;
+
+// There was an issue where we weren't properly converting constexprs to
+// vectors with elements of the appropriate width. (e.g.
+// (vector signed short)0 would be lowered as [4 x i32] in some cases)
+
+// CHECK-LABEL: @_Z8testIntsDv4_i
+void testInts(vector int VI) {
+  constexpr vector int CI1 = (vector int)0LL;
+  // CHECK: icmp
+  gb = (VI == CI1)[0];
+
+  // Likewise for float inits.
+  constexpr vector int CI2 = (vector int)char(0);
+  // CHECK: icmp
+  gb = (VI == CI2)[0];
+
+  constexpr vector int CF1 = (vector int)0.0;
+  // CHECK: icmp
+  gb = (VI == CF1)[0];
+
+  constexpr vector int CF2 = (vector int)0.0f;
+  // CHECK: icmp
+  gb = (VI == CF2)[0];
+}
+
+// CHECK-LABEL: @_Z10testFloatsDv2_d
+void testFloats(vector double VD) {
+  constexpr vector double CI1 = (vector double)0LL;
+  // CHECK: fcmp
+  gb = (VD == CI1)[0];
+
+  // Likewise for float inits.
+  constexpr vector double CI2 = (vector double)char(0);
+  // CHECK: fcmp
+  gb = (VD == CI2)[0];
+
+  constexpr vector double CF1 = (vector double)0.0;
+  // CHECK: fcmp
+  gb = (VD == CF1)[0];
+
+  constexpr vector double CF2 = (vector double)0.0f;
+  // CHECK: fcmp
+  gb = (VD == CF2)[0];
+}
Index: lib/Sema/SemaExprCXX.cpp
===
--- lib/Sema/SemaExprCXX.cpp
+++ lib/Sema/SemaExprCXX.cpp
@@ -3352,15 +3352,9 @@
 
   case ICK_Vector_Splat:
 // Vector splat from any arithmetic type to a vector.
-// Cast to the element type.
 {
-  QualType elType = ToType->getAs()->getElementType();
-  if (elType != From->getType()) {
-ExprResult E = From;
-From = ImpCastExprToType(From, elType,
- PrepareScalarCast(E, elType)).get();
-  }
-  From = ImpCastExprToType(From, ToType, CK_VectorSplat,
+  Expr *Elem = prepareVectorSplat(ToType, From).get();
+  From = ImpCastExprToType(Elem, ToType, CK_VectorSplat,
VK_RValue, /*BasePath=*/nullptr, CCK).get();
 }
 break;
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -5563,6 +5563,19 @@
   return false;
 }
 
+ExprResult Sema::prepareVectorSplat(QualType VectorTy, Expr *SplattedExpr) {
+  QualType DestElemTy = VectorTy->castAs()->getElementType();
+
+  if (DestElemTy == SplattedExpr->getType())
+return SplattedExpr;
+
+  ExprResult CastExprRes = SplattedExpr;
+  CastKind CK = PrepareScalarCast(CastExprRes, DestElemTy);
+  if (CastExprRes.isInvalid())
+return ExprError();
+  return ImpCastExprToType(CastExprRes.get(), DestElemTy, CK);
+}
+
 ExprResult Sema::CheckExtVectorCast(SourceRange R, QualType DestTy,
 Expr *CastExpr, CastKind ) {
   assert(DestTy->isExtVectorType() && "Not an extended vector type!");
@@ -5593,15 +5606,8 @@
 diag::err_invalid_conversion_between_vector_and_scalar)
   << DestTy << SrcTy << R;
 
-  QualType DestElemTy = DestTy->getAs()->getElementType();
-  ExprResult CastExprRes = CastExpr;
-  CastKind CK = PrepareScalarCast(CastExprRes, DestElemTy);
-  if (CastExprRes.isInvalid())
-return ExprError();
-  CastExpr = ImpCastExprToType(CastExprRes.get(), DestElemTy, CK).get();
-
   Kind = CK_VectorSplat;
-  return CastExpr;
+  return prepareVectorSplat(DestTy, CastExpr);
 }
 
 ExprResult
@@ -6942,13 +6948,9 @@
 if (RHSType->isExtVectorType())
   return Incompatible;
 if (RHSType->isArithmeticType()) {
-  // CK_VectorSplat does T -> vector T, so first cast to the
-  // element type.
-  QualType elType = cast(LHSType)->getElementType();
-  if (elType != RHSType && ConvertRHS) {
-Kind = PrepareScalarCast(RHS, elType);
-RHS = ImpCastExprToType(RHS.get(), elType, Kind);
-  }
+  // CK_VectorSplat does T -> vector T, so first cast to the element type.
+  if (ConvertRHS)
+RHS = prepareVectorSplat(LHSType, RHS.get());
   Kind = CK_VectorSplat;
   return Compatible;
 }
@@ 

Re: [PATCH] D14877: Fix ICE on lowering of constexpr vector splats

2015-11-22 Thread George Burgess IV via cfe-commits
george.burgess.iv added inline comments.


Comment at: lib/CodeGen/CGExprConstant.cpp:1362-1363
@@ -1360,3 +1361,4 @@
+Inits[I] = llvm::ConstantFP::get(VMContext, Elt.getFloat());
   else
-Inits.push_back(llvm::ConstantFP::get(VMContext, Elt.getFloat()));
+llvm_unreachable("unsupported vector element type");
 }

majnemer wrote:
> Is this unreachable for vectors of pointer type?
Might you have an example of how to use a vector of pointers in clang? My 
knowledge of vectors as a whole is super limited, so I'm probably missing 
something obvious, but I can't seem to get any of the vector types mentioned 
here 
http://clang.llvm.org/docs/LanguageExtensions.html#vectors-and-extended-vectors 
to accept a pointer element type, nor is my grep-fu good enough to find e.g. a 
`vector (int*)` in `test/`. 


http://reviews.llvm.org/D14877



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


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-11-22 Thread Milian Wolff via cfe-commits
milianw accepted this revision.
milianw added a comment.
This revision is now accepted and ready to land.

From my POV this is still fine. Manuel, Sergey - could you have a look at this 
please and push it upstream if you agree with me?

Thanks


http://reviews.llvm.org/D10833



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