r355989 - Add XCOFF triple object format type for AIX

2019-03-12 Thread Jason Liu via cfe-commits
Author: jasonliu
Date: Tue Mar 12 15:01:10 2019
New Revision: 355989

URL: http://llvm.org/viewvc/llvm-project?rev=355989&view=rev
Log:
Add XCOFF triple object format type for AIX

This patch adds an XCOFF triple object format type into LLVM.
This XCOFF triple object file type will be used later by object file and 
assembly generation for the AIX platform.

Differential Revision: https://reviews.llvm.org/D58930

Modified:
cfe/trunk/lib/CodeGen/BackendUtil.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.cpp

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=355989&r1=355988&r2=355989&view=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Tue Mar 12 15:01:10 2019
@@ -1447,6 +1447,9 @@ static const char* getSectionNameForBitc
   case Triple::Wasm:
   case Triple::UnknownObjectFormat:
 return ".llvmbc";
+  case Triple::XCOFF:
+llvm_unreachable("XCOFF is not yet implemented");
+break;
   }
   llvm_unreachable("Unimplemented ObjectFormatType");
 }
@@ -1460,6 +1463,9 @@ static const char* getSectionNameForComm
   case Triple::Wasm:
   case Triple::UnknownObjectFormat:
 return ".llvmcmd";
+  case Triple::XCOFF:
+llvm_unreachable("XCOFF is not yet implemented");
+break;
   }
   llvm_unreachable("Unimplemented ObjectFormatType");
 }

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=355989&r1=355988&r2=355989&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Tue Mar 12 15:01:10 2019
@@ -4406,6 +4406,8 @@ CodeGenModule::GetAddrOfConstantCFString
   switch (Triple.getObjectFormat()) {
   case llvm::Triple::UnknownObjectFormat:
 llvm_unreachable("unknown file format");
+  case llvm::Triple::XCOFF:
+llvm_unreachable("XCOFF is not yet implemented");
   case llvm::Triple::COFF:
   case llvm::Triple::ELF:
   case llvm::Triple::Wasm:


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


r356060 - Add AIX Target Info

2019-03-13 Thread Jason Liu via cfe-commits
Author: jasonliu
Date: Wed Mar 13 09:02:26 2019
New Revision: 356060

URL: http://llvm.org/viewvc/llvm-project?rev=356060&view=rev
Log:
Add AIX Target Info

Summary:
A first pass over platform-specific properties of the C API/ABI
on AIX for both 32-bit and 64-bit modes.
This is a continuation of D18360 by Andrew Paprocki and further work by Wu Zhao.

Patch by Andus Yu

Reviewers: apaprocki, chandlerc, hubert.reinterpretcast, jasonliu,
xingxue, sfertile

Reviewed by: hubert.reinterpretcast, apaprocki, sfertile

Differential Revision: https://reviews.llvm.org/D59048

Added:
cfe/trunk/test/Headers/max_align.c
cfe/trunk/test/Sema/varargs-aix.c
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Basic/Targets/OSTargets.h
cfe/trunk/lib/Basic/Targets/PPC.cpp
cfe/trunk/lib/Basic/Targets/PPC.h
cfe/trunk/test/Driver/types.c
cfe/trunk/test/Preprocessor/init.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=356060&r1=356059&r2=356060&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed Mar 13 09:02:26 2019
@@ -332,6 +332,8 @@ TargetInfo *AllocateTarget(const llvm::T
   return new OpenBSDTargetInfo(Triple, Opts);
 case llvm::Triple::RTEMS:
   return new RTEMSTargetInfo(Triple, Opts);
+case llvm::Triple::AIX:
+  return new AIXPPC32TargetInfo(Triple, Opts);
 default:
   return new PPC32TargetInfo(Triple, Opts);
 }
@@ -348,6 +350,8 @@ TargetInfo *AllocateTarget(const llvm::T
   return new FreeBSDTargetInfo(Triple, Opts);
 case llvm::Triple::NetBSD:
   return new NetBSDTargetInfo(Triple, Opts);
+case llvm::Triple::AIX:
+  return new AIXPPC64TargetInfo(Triple, Opts);
 default:
   return new PPC64TargetInfo(Triple, Opts);
 }

Modified: cfe/trunk/lib/Basic/Targets/OSTargets.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/OSTargets.h?rev=356060&r1=356059&r2=356060&view=diff
==
--- cfe/trunk/lib/Basic/Targets/OSTargets.h (original)
+++ cfe/trunk/lib/Basic/Targets/OSTargets.h Wed Mar 13 09:02:26 2019
@@ -613,6 +613,53 @@ public:
   }
 };
 
+// AIX Target
+template 
+class AIXTargetInfo : public OSTargetInfo {
+protected:
+  void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
+MacroBuilder &Builder) const override {
+DefineStd(Builder, "unix", Opts);
+Builder.defineMacro("_IBMR2");
+Builder.defineMacro("_POWER");
+
+// FIXME: Define AIX OS-Version Macros.
+Builder.defineMacro("_AIX");
+
+// FIXME: Do not define _LONG_LONG when -fno-long-long is specified.
+Builder.defineMacro("_LONG_LONG");
+
+if (Opts.POSIXThreads) {
+  Builder.defineMacro("_THREAD_SAFE");
+}
+
+if (this->PointerWidth == 64) {
+  Builder.defineMacro("__64BIT__");
+}
+
+// Define _WCHAR_T when it is a fundamental type
+// (i.e., for C++ without -fno-wchar).
+if (Opts.CPlusPlus && Opts.WChar) {
+  Builder.defineMacro("_WCHAR_T");
+}
+  }
+
+public:
+  AIXTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
+  : OSTargetInfo(Triple, Opts) {
+if (this->PointerWidth == 64) {
+  this->WCharType = this->UnsignedInt;
+} else {
+  this->WCharType = this->UnsignedShort;
+}
+this->UseZeroLengthBitfieldAlignment = true;
+  }
+
+  // AIX sets FLT_EVAL_METHOD to be 1.
+  unsigned getFloatEvalMethod() const override { return 1; }
+  bool hasInt128Type() const override { return false; }
+};
+
 // Windows target
 template 
 class LLVM_LIBRARY_VISIBILITY WindowsTargetInfo : public OSTargetInfo {

Modified: cfe/trunk/lib/Basic/Targets/PPC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/PPC.cpp?rev=356060&r1=356059&r2=356060&view=diff
==
--- cfe/trunk/lib/Basic/Targets/PPC.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/PPC.cpp Wed Mar 13 09:02:26 2019
@@ -100,7 +100,9 @@ void PPCTargetInfo::getTargetDefines(con
 Builder.defineMacro("_CALL_LINUX", "1");
 
   // Subtarget options.
-  Builder.defineMacro("__NATURAL_ALIGNMENT__");
+  if (!getTriple().isOSAIX()){
+Builder.defineMacro("__NATURAL_ALIGNMENT__");
+  }
   Builder.defineMacro("__REGISTER_PREFIX__", "");
 
   // FIXME: Should be controlled by command line option.

Modified: cfe/trunk/lib/Basic/Targets/PPC.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/PPC.h?rev=356060&r1=356059&r2=356060&view=diff
==
--- cfe/trunk/lib/Basic/Targets/PPC.h (original)
+++ cfe/trunk/lib/Basic/Targets/PPC.h Wed Mar 13 09:02:26 2019
@@ -325,6 +325,12 @@ public:
   PtrDiffType = SignedInt;
   IntPt

r356070 - Revert "Add AIX Target Info"

2019-03-13 Thread Jason Liu via cfe-commits
Author: jasonliu
Date: Wed Mar 13 10:57:23 2019
New Revision: 356070

URL: http://llvm.org/viewvc/llvm-project?rev=356070&view=rev
Log:
Revert "Add AIX Target Info"

This reverts commit 4e192d0e1e72ce32fabf1bccc06ac31ab5385e78.
The newly added test case max_align.c do not work on all platforms.

original llvm-svn: 356060

Removed:
cfe/trunk/test/Headers/max_align.c
cfe/trunk/test/Sema/varargs-aix.c
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Basic/Targets/OSTargets.h
cfe/trunk/lib/Basic/Targets/PPC.cpp
cfe/trunk/lib/Basic/Targets/PPC.h
cfe/trunk/test/Driver/types.c
cfe/trunk/test/Preprocessor/init.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=356070&r1=356069&r2=356070&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed Mar 13 10:57:23 2019
@@ -332,8 +332,6 @@ TargetInfo *AllocateTarget(const llvm::T
   return new OpenBSDTargetInfo(Triple, Opts);
 case llvm::Triple::RTEMS:
   return new RTEMSTargetInfo(Triple, Opts);
-case llvm::Triple::AIX:
-  return new AIXPPC32TargetInfo(Triple, Opts);
 default:
   return new PPC32TargetInfo(Triple, Opts);
 }
@@ -350,8 +348,6 @@ TargetInfo *AllocateTarget(const llvm::T
   return new FreeBSDTargetInfo(Triple, Opts);
 case llvm::Triple::NetBSD:
   return new NetBSDTargetInfo(Triple, Opts);
-case llvm::Triple::AIX:
-  return new AIXPPC64TargetInfo(Triple, Opts);
 default:
   return new PPC64TargetInfo(Triple, Opts);
 }

Modified: cfe/trunk/lib/Basic/Targets/OSTargets.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/OSTargets.h?rev=356070&r1=356069&r2=356070&view=diff
==
--- cfe/trunk/lib/Basic/Targets/OSTargets.h (original)
+++ cfe/trunk/lib/Basic/Targets/OSTargets.h Wed Mar 13 10:57:23 2019
@@ -613,53 +613,6 @@ public:
   }
 };
 
-// AIX Target
-template 
-class AIXTargetInfo : public OSTargetInfo {
-protected:
-  void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
-MacroBuilder &Builder) const override {
-DefineStd(Builder, "unix", Opts);
-Builder.defineMacro("_IBMR2");
-Builder.defineMacro("_POWER");
-
-// FIXME: Define AIX OS-Version Macros.
-Builder.defineMacro("_AIX");
-
-// FIXME: Do not define _LONG_LONG when -fno-long-long is specified.
-Builder.defineMacro("_LONG_LONG");
-
-if (Opts.POSIXThreads) {
-  Builder.defineMacro("_THREAD_SAFE");
-}
-
-if (this->PointerWidth == 64) {
-  Builder.defineMacro("__64BIT__");
-}
-
-// Define _WCHAR_T when it is a fundamental type
-// (i.e., for C++ without -fno-wchar).
-if (Opts.CPlusPlus && Opts.WChar) {
-  Builder.defineMacro("_WCHAR_T");
-}
-  }
-
-public:
-  AIXTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
-  : OSTargetInfo(Triple, Opts) {
-if (this->PointerWidth == 64) {
-  this->WCharType = this->UnsignedInt;
-} else {
-  this->WCharType = this->UnsignedShort;
-}
-this->UseZeroLengthBitfieldAlignment = true;
-  }
-
-  // AIX sets FLT_EVAL_METHOD to be 1.
-  unsigned getFloatEvalMethod() const override { return 1; }
-  bool hasInt128Type() const override { return false; }
-};
-
 // Windows target
 template 
 class LLVM_LIBRARY_VISIBILITY WindowsTargetInfo : public OSTargetInfo {

Modified: cfe/trunk/lib/Basic/Targets/PPC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/PPC.cpp?rev=356070&r1=356069&r2=356070&view=diff
==
--- cfe/trunk/lib/Basic/Targets/PPC.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/PPC.cpp Wed Mar 13 10:57:23 2019
@@ -100,9 +100,7 @@ void PPCTargetInfo::getTargetDefines(con
 Builder.defineMacro("_CALL_LINUX", "1");
 
   // Subtarget options.
-  if (!getTriple().isOSAIX()){
-Builder.defineMacro("__NATURAL_ALIGNMENT__");
-  }
+  Builder.defineMacro("__NATURAL_ALIGNMENT__");
   Builder.defineMacro("__REGISTER_PREFIX__", "");
 
   // FIXME: Should be controlled by command line option.

Modified: cfe/trunk/lib/Basic/Targets/PPC.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/PPC.h?rev=356070&r1=356069&r2=356070&view=diff
==
--- cfe/trunk/lib/Basic/Targets/PPC.h (original)
+++ cfe/trunk/lib/Basic/Targets/PPC.h Wed Mar 13 10:57:23 2019
@@ -325,12 +325,6 @@ public:
   PtrDiffType = SignedInt;
   IntPtrType = SignedInt;
   break;
-case llvm::Triple::AIX:
-  SizeType = UnsignedLong;
-  PtrDiffType = SignedLong;
-  IntPtrType = SignedLong;
-  SuitableAlign = 64;
-  break;
 default:
   break;
 }
@@ -339,8 +

r356197 - Reland part of "Add AIX Target Info"

2019-03-14 Thread Jason Liu via cfe-commits
Author: jasonliu
Date: Thu Mar 14 13:27:39 2019
New Revision: 356197

URL: http://llvm.org/viewvc/llvm-project?rev=356197&view=rev
Log:
Reland part of "Add AIX Target Info"

This patch reland the test case max_align.c which is failing at
Windows and PS4 platform in the previous commit.

Differential Revision: https://reviews.llvm.org/D59048

original llvm-svn: 356060

Added:
cfe/trunk/test/Headers/max_align.c

Added: cfe/trunk/test/Headers/max_align.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/max_align.c?rev=356197&view=auto
==
--- cfe/trunk/test/Headers/max_align.c (added)
+++ cfe/trunk/test/Headers/max_align.c Thu Mar 14 13:27:39 2019
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c11 -verify %s
+// expected-no-diagnostics
+
+// XFAIL: windows-
+
+#ifndef __BIGGEST_ALIGNMENT__
+#error __BIGGEST_ALIGNMENT__ not defined
+#endif
+
+#include 
+
+_Static_assert(__BIGGEST_ALIGNMENT__ == _Alignof(max_align_t), "");


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


r356208 - Reland the rest of "Add AIX Target Info"

2019-03-14 Thread Jason Liu via cfe-commits
Author: jasonliu
Date: Thu Mar 14 14:54:30 2019
New Revision: 356208

URL: http://llvm.org/viewvc/llvm-project?rev=356208&view=rev
Log:
Reland the rest of "Add AIX Target Info"

llvm-svn 356197 relanded previously failing test case max_align.c.
This commit will reland the rest of llvm-svn 356060 commit.

Differential Revision: https://reviews.llvm.org/D59048

Added:
cfe/trunk/test/Sema/varargs-aix.c
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Basic/Targets/OSTargets.h
cfe/trunk/lib/Basic/Targets/PPC.cpp
cfe/trunk/lib/Basic/Targets/PPC.h
cfe/trunk/test/Driver/types.c
cfe/trunk/test/Preprocessor/init.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=356208&r1=356207&r2=356208&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu Mar 14 14:54:30 2019
@@ -332,6 +332,8 @@ TargetInfo *AllocateTarget(const llvm::T
   return new OpenBSDTargetInfo(Triple, Opts);
 case llvm::Triple::RTEMS:
   return new RTEMSTargetInfo(Triple, Opts);
+case llvm::Triple::AIX:
+  return new AIXPPC32TargetInfo(Triple, Opts);
 default:
   return new PPC32TargetInfo(Triple, Opts);
 }
@@ -348,6 +350,8 @@ TargetInfo *AllocateTarget(const llvm::T
   return new FreeBSDTargetInfo(Triple, Opts);
 case llvm::Triple::NetBSD:
   return new NetBSDTargetInfo(Triple, Opts);
+case llvm::Triple::AIX:
+  return new AIXPPC64TargetInfo(Triple, Opts);
 default:
   return new PPC64TargetInfo(Triple, Opts);
 }

Modified: cfe/trunk/lib/Basic/Targets/OSTargets.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/OSTargets.h?rev=356208&r1=356207&r2=356208&view=diff
==
--- cfe/trunk/lib/Basic/Targets/OSTargets.h (original)
+++ cfe/trunk/lib/Basic/Targets/OSTargets.h Thu Mar 14 14:54:30 2019
@@ -613,6 +613,53 @@ public:
   }
 };
 
+// AIX Target
+template 
+class AIXTargetInfo : public OSTargetInfo {
+protected:
+  void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
+MacroBuilder &Builder) const override {
+DefineStd(Builder, "unix", Opts);
+Builder.defineMacro("_IBMR2");
+Builder.defineMacro("_POWER");
+
+// FIXME: Define AIX OS-Version Macros.
+Builder.defineMacro("_AIX");
+
+// FIXME: Do not define _LONG_LONG when -fno-long-long is specified.
+Builder.defineMacro("_LONG_LONG");
+
+if (Opts.POSIXThreads) {
+  Builder.defineMacro("_THREAD_SAFE");
+}
+
+if (this->PointerWidth == 64) {
+  Builder.defineMacro("__64BIT__");
+}
+
+// Define _WCHAR_T when it is a fundamental type
+// (i.e., for C++ without -fno-wchar).
+if (Opts.CPlusPlus && Opts.WChar) {
+  Builder.defineMacro("_WCHAR_T");
+}
+  }
+
+public:
+  AIXTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
+  : OSTargetInfo(Triple, Opts) {
+if (this->PointerWidth == 64) {
+  this->WCharType = this->UnsignedInt;
+} else {
+  this->WCharType = this->UnsignedShort;
+}
+this->UseZeroLengthBitfieldAlignment = true;
+  }
+
+  // AIX sets FLT_EVAL_METHOD to be 1.
+  unsigned getFloatEvalMethod() const override { return 1; }
+  bool hasInt128Type() const override { return false; }
+};
+
 // Windows target
 template 
 class LLVM_LIBRARY_VISIBILITY WindowsTargetInfo : public OSTargetInfo {

Modified: cfe/trunk/lib/Basic/Targets/PPC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/PPC.cpp?rev=356208&r1=356207&r2=356208&view=diff
==
--- cfe/trunk/lib/Basic/Targets/PPC.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/PPC.cpp Thu Mar 14 14:54:30 2019
@@ -100,7 +100,9 @@ void PPCTargetInfo::getTargetDefines(con
 Builder.defineMacro("_CALL_LINUX", "1");
 
   // Subtarget options.
-  Builder.defineMacro("__NATURAL_ALIGNMENT__");
+  if (!getTriple().isOSAIX()){
+Builder.defineMacro("__NATURAL_ALIGNMENT__");
+  }
   Builder.defineMacro("__REGISTER_PREFIX__", "");
 
   // FIXME: Should be controlled by command line option.

Modified: cfe/trunk/lib/Basic/Targets/PPC.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/PPC.h?rev=356208&r1=356207&r2=356208&view=diff
==
--- cfe/trunk/lib/Basic/Targets/PPC.h (original)
+++ cfe/trunk/lib/Basic/Targets/PPC.h Thu Mar 14 14:54:30 2019
@@ -325,6 +325,12 @@ public:
   PtrDiffType = SignedInt;
   IntPtrType = SignedInt;
   break;
+case llvm::Triple::AIX:
+  SizeType = UnsignedLong;
+  PtrDiffType = SignedLong;
+  IntPtrType = SignedLong;
+  SuitableAlign = 64;
+  break;
 default:
   break;
 }
@@ -333,6 +339

[PATCH] D13289: [libc++] Provide additional templates for valarray transcendentals that satisfy the standard synopsis

2016-11-22 Thread Jason Liu via cfe-commits
jasonliu added a comment.

Ping.
Any review for this patch? It would be great if we can get this issue fixed.


https://reviews.llvm.org/D13289



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


[PATCH] D22698: [libcxx] Missing member types 'traits_type' and 'string_type' in class basic_regex

2016-07-22 Thread Jason Liu via cfe-commits
jasonliu created this revision.
jasonliu added reviewers: mclow.lists, rsmith, hubert.reinterpretcast.
jasonliu added a subscriber: cfe-commits.

In standard 28.8 p3, class basic_regex is supposed to have 'traits_type' and 
'string_type' as its member types. However, they are missing from the library's 
implementation. Unexpected error occurs when user have lines like 
"std::basic_regex::traits_type" or "std::basic_regex::string_type".

https://reviews.llvm.org/D22698

Files:
  include/regex
  test/std/re/re.regex/types.pass.cpp

Index: test/std/re/re.regex/types.pass.cpp
===
--- test/std/re/re.regex/types.pass.cpp
+++ test/std/re/re.regex/types.pass.cpp
@@ -15,6 +15,8 @@
 // public:
 // // types:
 // typedef charT   value_type;
+// typedef traits  traits_type;
+// typedef typename traits::string_typestring_type;
 // typedef regex_constants::syntax_option_type flag_type;
 // typedef typename traits::locale_typelocale_type;
 
@@ -25,11 +27,15 @@
 int main()
 {
 static_assert((std::is_same::value_type, 
char>::value), "");
+static_assert((std::is_same::traits_type, 
std::regex_traits >::value), "");
+static_assert((std::is_same::string_type, 
std::basic_string >::value), "");
 static_assert((std::is_same::flag_type,
 
std::regex_constants::syntax_option_type>::value), "");
 static_assert((std::is_same::locale_type, 
std::locale>::value), "");
 
 static_assert((std::is_same::value_type, 
wchar_t>::value), "");
+static_assert((std::is_same::traits_type, 
std::regex_traits >::value), "");
+static_assert((std::is_same::string_type, 
std::basic_string >::value), "");
 static_assert((std::is_same::flag_type,
 
std::regex_constants::syntax_option_type>::value), "");
 static_assert((std::is_same::locale_type, 
std::locale>::value), "");
Index: include/regex
===
--- include/regex
+++ include/regex
@@ -127,6 +127,8 @@
 public:
 // types:
 typedef charT   value_type;
+typedef traits  traits_type;
+typedef typename traits::string_typestring_type;
 typedef regex_constants::syntax_option_type flag_type;
 typedef typename traits::locale_typelocale_type;
 
@@ -2475,6 +2477,8 @@
 public:
 // types:
 typedef _CharT  value_type;
+typedef _Traits traits_type;
+typedef typename _Traits::string_type   string_type;
 typedef regex_constants::syntax_option_type flag_type;
 typedef typename _Traits::locale_type   locale_type;
 


Index: test/std/re/re.regex/types.pass.cpp
===
--- test/std/re/re.regex/types.pass.cpp
+++ test/std/re/re.regex/types.pass.cpp
@@ -15,6 +15,8 @@
 // public:
 // // types:
 // typedef charT   value_type;
+// typedef traits  traits_type;
+// typedef typename traits::string_typestring_type;
 // typedef regex_constants::syntax_option_type flag_type;
 // typedef typename traits::locale_typelocale_type;
 
@@ -25,11 +27,15 @@
 int main()
 {
 static_assert((std::is_same::value_type, char>::value), "");
+static_assert((std::is_same::traits_type, std::regex_traits >::value), "");
+static_assert((std::is_same::string_type, std::basic_string >::value), "");
 static_assert((std::is_same::flag_type,
 std::regex_constants::syntax_option_type>::value), "");
 static_assert((std::is_same::locale_type, std::locale>::value), "");
 
 static_assert((std::is_same::value_type, wchar_t>::value), "");
+static_assert((std::is_same::traits_type, std::regex_traits >::value), "");
+static_assert((std::is_same::string_type, std::basic_string >::value), "");
 static_assert((std::is_same::flag_type,
 std::regex_constants::syntax_option_type>::value), "");
 static_assert((std::is_same::locale_type, std::locale>::value), "");
Index: include/regex
===
--- include/regex
+++ include/regex
@@ -127,6 +127,8 @@
 public:
 // types:
 typedef charT   value_type;
+typedef traits  traits_type;
+typedef typename traits::string_typestring_type;
 typedef regex_constants::syntax_option_type flag_type;
 typedef typename traits::locale_typelocale_type;
 
@@ -2475,6 +2477,8 @@
 public:
 // types:
 typedef _CharT  value_type;
+typedef _Traits traits_type;
+typedef typename

[PATCH] D22702: [libcxx]Missing default argument for flag_type parameter in one of std::basic_regex constructors

2016-07-22 Thread Jason Liu via cfe-commits
jasonliu created this revision.
jasonliu added reviewers: mclow.lists, rsmith, hubert.reinterpretcast.
jasonliu added a subscriber: cfe-commits.

Standard 28.8 p3 indicates the 3-argument constructor have a default argument 
for flag_type parameter:
basic_regex(const charT* p, size_t len, flag_type f = 
regex_constants::ECMAScript);
However, it is missing from the library's implementation. 

https://reviews.llvm.org/D22702

Files:
  include/regex
  test/std/re/re.regex/re.regex.construct/ptr_size.pass.cpp

Index: test/std/re/re.regex/re.regex.construct/ptr_size.pass.cpp
===
--- test/std/re/re.regex/re.regex.construct/ptr_size.pass.cpp
+++ test/std/re/re.regex/re.regex.construct/ptr_size.pass.cpp
@@ -0,0 +1,34 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+
+// template > class 
basic_regex;
+
+// basic_regex(const charT* p, size_t len);
+
+#include 
+#include 
+
+template 
+void
+test(const CharT* p, std::size_t len, unsigned mc)
+{
+std::basic_regex r(p, len);
+assert(r.flags() == std::regex_constants::ECMAScript);
+assert(r.mark_count() == mc);
+}
+
+int main()
+{
+test("\\(a\\)", 5, 0);
+test("\\(a[bc]\\)", 9, 0);
+test("\\(a\\([bc]\\)\\)", 13, 0);
+test("(a([bc]))", 9, 2);
+}
Index: include/regex
===
--- include/regex
+++ include/regex
@@ -145,7 +145,7 @@
 // construct/copy/destroy:
 basic_regex();
 explicit basic_regex(const charT* p, flag_type f = 
regex_constants::ECMAScript);
-basic_regex(const charT* p, size_t len, flag_type f);
+basic_regex(const charT* p, size_t len, flag_type f = 
regex_constants::ECMAScript);
 basic_regex(const basic_regex&);
 basic_regex(basic_regex&&) noexcept;
 template 
@@ -2515,7 +2515,7 @@
   __end_(0)
 {__parse(__p, __p + __traits_.length(__p));}
 _LIBCPP_INLINE_VISIBILITY
-basic_regex(const value_type* __p, size_t __len, flag_type __f)
+basic_regex(const value_type* __p, size_t __len, flag_type __f = 
regex_constants::ECMAScript)
 : __flags_(__f), __marked_count_(0), __loop_count_(0), 
__open_count_(0),
   __end_(0)
 {__parse(__p, __p + __len);}


Index: test/std/re/re.regex/re.regex.construct/ptr_size.pass.cpp
===
--- test/std/re/re.regex/re.regex.construct/ptr_size.pass.cpp
+++ test/std/re/re.regex/re.regex.construct/ptr_size.pass.cpp
@@ -0,0 +1,34 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+
+// template > class basic_regex;
+
+// basic_regex(const charT* p, size_t len);
+
+#include 
+#include 
+
+template 
+void
+test(const CharT* p, std::size_t len, unsigned mc)
+{
+std::basic_regex r(p, len);
+assert(r.flags() == std::regex_constants::ECMAScript);
+assert(r.mark_count() == mc);
+}
+
+int main()
+{
+test("\\(a\\)", 5, 0);
+test("\\(a[bc]\\)", 9, 0);
+test("\\(a\\([bc]\\)\\)", 13, 0);
+test("(a([bc]))", 9, 2);
+}
Index: include/regex
===
--- include/regex
+++ include/regex
@@ -145,7 +145,7 @@
 // construct/copy/destroy:
 basic_regex();
 explicit basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript);
-basic_regex(const charT* p, size_t len, flag_type f);
+basic_regex(const charT* p, size_t len, flag_type f = regex_constants::ECMAScript);
 basic_regex(const basic_regex&);
 basic_regex(basic_regex&&) noexcept;
 template 
@@ -2515,7 +2515,7 @@
   __end_(0)
 {__parse(__p, __p + __traits_.length(__p));}
 _LIBCPP_INLINE_VISIBILITY
-basic_regex(const value_type* __p, size_t __len, flag_type __f)
+basic_regex(const value_type* __p, size_t __len, flag_type __f = regex_constants::ECMAScript)
 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
   __end_(0)
 {__parse(__p, __p + __len);}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D22698: [libcxx] Missing member types 'traits_type' and 'string_type' in class basic_regex

2016-07-29 Thread Jason Liu via cfe-commits
jasonliu added a comment.

Ping?


https://reviews.llvm.org/D22698



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


Re: [PATCH] D22702: [libcxx]Missing default argument for flag_type parameter in one of std::basic_regex constructors

2016-07-29 Thread Jason Liu via cfe-commits
jasonliu updated this revision to Diff 66153.
jasonliu added a comment.

Address @hubert.reinterpretcast 's comment about the test case. Added more 
cases to test "size" parameter in the constructor.


https://reviews.llvm.org/D22702

Files:
  include/regex
  test/std/re/re.regex/re.regex.construct/ptr_size.pass.cpp

Index: test/std/re/re.regex/re.regex.construct/ptr_size.pass.cpp
===
--- test/std/re/re.regex/re.regex.construct/ptr_size.pass.cpp
+++ test/std/re/re.regex/re.regex.construct/ptr_size.pass.cpp
@@ -0,0 +1,39 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+
+// template > class 
basic_regex;
+
+// basic_regex(const charT* p, size_t len);
+
+#include 
+#include 
+
+template 
+void
+test(const CharT* p, std::size_t len, unsigned mc)
+{
+std::basic_regex r(p, len);
+assert(r.flags() == std::regex_constants::ECMAScript);
+assert(r.mark_count() == mc);
+}
+
+int main()
+{
+test("\\(a\\)", 5, 0);
+test("\\(a[bc]\\)", 9, 0);
+test("\\(a\\([bc]\\)\\)", 13, 0);
+test("(a([bc]))", 9, 2);
+   
+test("(\0)(b)(c)(d)", 12, 4);
+test("(\0)(b)(c)(d)", 9, 3);
+test("(\0)(b)(c)(d)", 3, 1);
+test("(\0)(b)(c)(d)", 0, 0);
+}
Index: include/regex
===
--- include/regex
+++ include/regex
@@ -145,7 +145,7 @@
 // construct/copy/destroy:
 basic_regex();
 explicit basic_regex(const charT* p, flag_type f = 
regex_constants::ECMAScript);
-basic_regex(const charT* p, size_t len, flag_type f);
+basic_regex(const charT* p, size_t len, flag_type f = 
regex_constants::ECMAScript);
 basic_regex(const basic_regex&);
 basic_regex(basic_regex&&) noexcept;
 template 
@@ -2515,7 +2515,7 @@
   __end_(0)
 {__parse(__p, __p + __traits_.length(__p));}
 _LIBCPP_INLINE_VISIBILITY
-basic_regex(const value_type* __p, size_t __len, flag_type __f)
+basic_regex(const value_type* __p, size_t __len, flag_type __f = 
regex_constants::ECMAScript)
 : __flags_(__f), __marked_count_(0), __loop_count_(0), 
__open_count_(0),
   __end_(0)
 {__parse(__p, __p + __len);}


Index: test/std/re/re.regex/re.regex.construct/ptr_size.pass.cpp
===
--- test/std/re/re.regex/re.regex.construct/ptr_size.pass.cpp
+++ test/std/re/re.regex/re.regex.construct/ptr_size.pass.cpp
@@ -0,0 +1,39 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+
+// template > class basic_regex;
+
+// basic_regex(const charT* p, size_t len);
+
+#include 
+#include 
+
+template 
+void
+test(const CharT* p, std::size_t len, unsigned mc)
+{
+std::basic_regex r(p, len);
+assert(r.flags() == std::regex_constants::ECMAScript);
+assert(r.mark_count() == mc);
+}
+
+int main()
+{
+test("\\(a\\)", 5, 0);
+test("\\(a[bc]\\)", 9, 0);
+test("\\(a\\([bc]\\)\\)", 13, 0);
+test("(a([bc]))", 9, 2);
+   
+test("(\0)(b)(c)(d)", 12, 4);
+test("(\0)(b)(c)(d)", 9, 3);
+test("(\0)(b)(c)(d)", 3, 1);
+test("(\0)(b)(c)(d)", 0, 0);
+}
Index: include/regex
===
--- include/regex
+++ include/regex
@@ -145,7 +145,7 @@
 // construct/copy/destroy:
 basic_regex();
 explicit basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript);
-basic_regex(const charT* p, size_t len, flag_type f);
+basic_regex(const charT* p, size_t len, flag_type f = regex_constants::ECMAScript);
 basic_regex(const basic_regex&);
 basic_regex(basic_regex&&) noexcept;
 template 
@@ -2515,7 +2515,7 @@
   __end_(0)
 {__parse(__p, __p + __traits_.length(__p));}
 _LIBCPP_INLINE_VISIBILITY
-basic_regex(const value_type* __p, size_t __len, flag_type __f)
+basic_regex(const value_type* __p, size_t __len, flag_type __f = regex_constants::ECMAScript)
 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
   __end_(0)
 {__parse(__p, __p + __len);}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D22702: [libcxx]Missing default argument for flag_type parameter in one of std::basic_regex constructors

2016-07-29 Thread Jason Liu via cfe-commits
jasonliu marked an inline comment as done.


Comment at: test/std/re/re.regex/re.regex.construct/ptr_size.pass.cpp:31
@@ +30,3 @@
+test("\\(a\\)", 5, 0);
+test("\\(a[bc]\\)", 9, 0);
+test("\\(a\\([bc]\\)\\)", 13, 0);

Comment addressed in the new patch. Thanks!


https://reviews.llvm.org/D22702



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


Re: [PATCH] D22702: [libcxx]Missing default argument for flag_type parameter in one of std::basic_regex constructors

2016-08-05 Thread Jason Liu via cfe-commits
jasonliu marked an inline comment as done.
jasonliu added a comment.

Gentle ping?


https://reviews.llvm.org/D22702



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


[clang] fe177a1 - Fix assertion when passing function into inline asm's input operand

2021-08-27 Thread Jason Liu via cfe-commits

Author: Jason Liu
Date: 2021-08-27T13:39:41-04:00
New Revision: fe177a1773e4f88dde1aa37d34a0d3f8cb582f14

URL: 
https://github.com/llvm/llvm-project/commit/fe177a1773e4f88dde1aa37d34a0d3f8cb582f14
DIFF: 
https://github.com/llvm/llvm-project/commit/fe177a1773e4f88dde1aa37d34a0d3f8cb582f14.diff

LOG: Fix assertion when passing function into inline asm's input operand

This seem to be a regression caused by this change:
https://reviews.llvm.org/D60943.
Since we delayed report the error, we would run into some invalid
state in clang and llvm.

Without this fix, clang would assert when passing function into
inline asm's input operand.

Differential Revision: https://reviews.llvm.org/D107941

Added: 
clang/test/CodeGen/asm-call-func.c

Modified: 
clang/lib/Sema/SemaStmtAsm.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaStmtAsm.cpp b/clang/lib/Sema/SemaStmtAsm.cpp
index 243d0b921cd7e..603611b2d86b1 100644
--- a/clang/lib/Sema/SemaStmtAsm.cpp
+++ b/clang/lib/Sema/SemaStmtAsm.cpp
@@ -393,30 +393,31 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, 
bool IsSimple,
   diag::err_asm_invalid_lvalue_in_input)
  << Info.getConstraintStr()
  << InputExpr->getSourceRange());
-} else if (Info.requiresImmediateConstant() && !Info.allowsRegister()) {
-  if (!InputExpr->isValueDependent()) {
-Expr::EvalResult EVResult;
-if (InputExpr->EvaluateAsRValue(EVResult, Context, true)) {
-  // For compatibility with GCC, we also allow pointers that would be
-  // integral constant expressions if they were cast to int.
-  llvm::APSInt IntResult;
-  if (EVResult.Val.toIntegralConstant(IntResult, InputExpr->getType(),
-   Context))
-if (!Info.isValidAsmImmediate(IntResult))
-  return StmtError(Diag(InputExpr->getBeginLoc(),
-diag::err_invalid_asm_value_for_constraint)
-   << toString(IntResult, 10)
-   << Info.getConstraintStr()
-   << InputExpr->getSourceRange());
-}
-  }
-
 } else {
   ExprResult Result = DefaultFunctionArrayLvalueConversion(Exprs[i]);
   if (Result.isInvalid())
 return StmtError();
 
-  Exprs[i] = Result.get();
+  InputExpr = Exprs[i] = Result.get();
+
+  if (Info.requiresImmediateConstant() && !Info.allowsRegister()) {
+if (!InputExpr->isValueDependent()) {
+  Expr::EvalResult EVResult;
+  if (InputExpr->EvaluateAsRValue(EVResult, Context, true)) {
+// For compatibility with GCC, we also allow pointers that would be
+// integral constant expressions if they were cast to int.
+llvm::APSInt IntResult;
+if (EVResult.Val.toIntegralConstant(IntResult, 
InputExpr->getType(),
+Context))
+  if (!Info.isValidAsmImmediate(IntResult))
+return StmtError(
+Diag(InputExpr->getBeginLoc(),
+ diag::err_invalid_asm_value_for_constraint)
+<< toString(IntResult, 10) << Info.getConstraintStr()
+<< InputExpr->getSourceRange());
+  }
+}
+  }
 }
 
 if (Info.allowsRegister()) {

diff  --git a/clang/test/CodeGen/asm-call-func.c 
b/clang/test/CodeGen/asm-call-func.c
new file mode 100644
index 0..851dcc093e76e
--- /dev/null
+++ b/clang/test/CodeGen/asm-call-func.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple x86_64-unknown-linux-gnu| 
FileCheck %s
+
+void callee(void);
+void caller() {
+  //CHECK: call void asm sideeffect "rcall $0", 
"n,~{dirflag},~{fpsr},~{flags}"(void ()* @callee)
+  asm("rcall %0" ::"n"(callee));
+}



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