Re: [PATCH] D14184: [clang] Add initial support for -meabi flag

2015-10-30 Thread Vinicius Tinti via cfe-commits
tinti removed rL LLVM as the repository for this revision.
tinti updated this revision to Diff 38803.
tinti added a comment.

Add context


http://reviews.llvm.org/D14184

Files:
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.h
  lib/CodeGen/BackendUtil.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/arm-eabi.c
  test/Driver/eabi.c

Index: test/Driver/eabi.c
===
--- /dev/null
+++ test/Driver/eabi.c
@@ -0,0 +1,15 @@
+// RUN: %clang %s -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-DEFAULT %s
+// RUN: %clang %s -meabi default -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-DEFAULT %s
+// RUN: %clang %s -meabi 4 -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-EABI4 %s
+// RUN: %clang %s -meabi 5 -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-EABI5 %s
+// RUN: %clang %s -meabi gnu -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-GNUEABI %s
+
+// CHECK-DEFAULT: "-meabi" "default"
+// CHECK-EABI4: "-meabi" "4"
+// CHECK-EABI5: "-meabi" "5"
+// CHECK-GNUEABI: "-meabi" "gnu"
Index: test/CodeGen/arm-eabi.c
===
--- /dev/null
+++ test/CodeGen/arm-eabi.c
@@ -0,0 +1,20 @@
+// REQUIRES: arm-registered-target
+// RUN: %clang -target arm-none-eabi -S -o - %s | FileCheck -check-prefix=CHECK-EABI %s
+// RUN: %clang -target arm-none-eabi -S -meabi gnu -o - %s | FileCheck -check-prefix=CHECK-GNUEABI %s
+// RUN: %clang -target arm-none-eabihf -S -o - %s | FileCheck -check-prefix=CHECK-EABI %s
+// RUN: %clang -target arm-none-eabihf -S -meabi gnu -o - %s | FileCheck -check-prefix=CHECK-GNUEABI %s
+// RUN: %clang -target arm-none-gnueabi -S -o - %s | FileCheck -check-prefix=CHECK-GNUEABI %s
+// RUN: %clang -target arm-none-gnueabi -S -meabi 5 -o - %s | FileCheck -check-prefix=CHECK-EABI %s
+// RUN: %clang -target arm-none-gnueabihf -S -o - %s | FileCheck -check-prefix=CHECK-GNUEABI %s
+// RUN: %clang -target arm-none-gnueabihf -S -meabi 5 -o - %s | FileCheck -check-prefix=CHECK-EABI %s
+
+struct my_s {
+  unsigned long a[18];
+};
+
+// CHECK-LABEL: foo
+// CHECK-EABI: bl __aeabi_memcpy4
+// CHECK-GNUEABI: bl memcpy
+void foo(unsigned long *t) {
+  *(struct my_s *)t = *((struct my_s *)(1UL));
+}
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -453,6 +453,20 @@
   Opts.DisableFree = Args.hasArg(OPT_disable_free);
   Opts.DisableTailCalls = Args.hasArg(OPT_mdisable_tail_calls);
   Opts.FloatABI = Args.getLastArgValue(OPT_mfloat_abi);
+  if (Arg *A = Args.getLastArg(OPT_meabi)) {
+StringRef Value = A->getValue();
+bool Valid = llvm::StringSwitch(Value)
+  .Case("default", true)
+  .Case("gnu", true)
+  .Case("4",   true)
+  .Case("5",   true)
+  .Default(false);
+if (!Valid)
+  Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args)
+  << Value;
+else
+  Opts.EABIVersion = Value;
+  }
   Opts.LessPreciseFPMAD = Args.hasArg(OPT_cl_mad_enable);
   Opts.LimitFloatPrecision = Args.getLastArgValue(OPT_mlimit_float_precision);
   Opts.NoInfsFPMath = (Args.hasArg(OPT_menable_no_infinities) ||
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3385,6 +3385,12 @@
 }
   }
 
+  CmdArgs.push_back("-meabi");
+  if (Arg *A = Args.getLastArg(options::OPT_meabi))
+CmdArgs.push_back(A->getValue());
+  else
+CmdArgs.push_back("default");
+
   CmdArgs.push_back("-mthread-model");
   if (Arg *A = Args.getLastArg(options::OPT_mthread_model))
 CmdArgs.push_back(A->getValue());
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -515,6 +515,15 @@
   Options.UseInitArray = CodeGenOpts.UseInitArray;
   Options.DisableIntegratedAS = CodeGenOpts.DisableIntegratedAS;
   Options.CompressDebugSections = CodeGenOpts.CompressDebugSections;
+
+  // Set EABI version.
+  Options.EABIVersion =
+llvm::StringSwitch(CodeGenOpts.EABIVersion)
+  .Case("4",   llvm::EABI::Eabi4)
+  .Case("5",   llvm::EABI::Eabi5)
+  .Case("gnu", llvm::EABI::Gnu)
+  .Default(llvm::EABI::Default);
+
   Options.LessPreciseFPMADOption = CodeGenOpts.LessPreciseFPMAD;
   Options.NoInfsFPMath = CodeGenOpts.NoInfsFPMath;
   Options.NoNaNsFPMath = CodeGenOpts.NoNaNsFPMath;
Index: include/clang/Frontend/CodeGenOptions.h
===
--- include/clang/Frontend/CodeGenOptions.h
+++ include/clang/Frontend/CodeGenOptions.h
@@ -167,6 +167,9 @@
   /// Name of the profile file to use as input for -fprofile-instr-use
   std::string I

Re: [PATCH] D14184: [clang] Add initial support for -meabi flag

2015-10-30 Thread Vinicius Tinti via cfe-commits
tinti added inline comments.


Comment at: lib/CodeGen/BackendUtil.cpp:524
@@ +523,3 @@
+  .Case("5",   llvm::EABI::Eabi5)
+  .Case("gnu", llvm::EABI::Gnu)
+  .Default(llvm::EABI::Default);

compnerd wrote:
> I'd really rather see this written in the LLVM Style:
> 
> EABI4, EABI5, GNU
> 
> since all of them are initialisms.
> 
> BTW, please clang-format this change.
Agreed.


Comment at: lib/Frontend/CompilerInvocation.cpp:458
@@ +457,3 @@
+StringRef Value = A->getValue();
+bool Valid = llvm::StringSwitch(Value)
+  .Case("default", true)

compnerd wrote:
> If `llvm::EABI::EABIVersionType` had an `Invalid` value in the enumeration, 
> you could convert directly to the value here, and report the error if the 
> value was `Invalid`.
I chose this way because none of the other target options have it [1].

Do you prefer with it?

[1] 
https://github.com/llvm-mirror/llvm/blob/master/include/llvm/Target/TargetOptions.h#L27


http://reviews.llvm.org/D14184



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


Re: [PATCH] D14184: [clang] Add initial support for -meabi flag

2015-10-30 Thread Vinicius Tinti via cfe-commits
tinti added inline comments.


Comment at: lib/Frontend/CompilerInvocation.cpp:458
@@ +457,3 @@
+StringRef Value = A->getValue();
+bool Valid = llvm::StringSwitch(Value)
+  .Case("default", true)

tinti wrote:
> compnerd wrote:
> > If `llvm::EABI::EABIVersionType` had an `Invalid` value in the enumeration, 
> > you could convert directly to the value here, and report the error if the 
> > value was `Invalid`.
> I chose this way because none of the other target options have it [1].
> 
> Do you prefer with it?
> 
> [1] 
> https://github.com/llvm-mirror/llvm/blob/master/include/llvm/Target/TargetOptions.h#L27
Looks like that in LLVM the Invalid is not defined but in Clang there are 
target specific enums that define them [1].

[1] https://github.com/llvm-mirror/clang/blob/master/lib/Driver/Tools.h#L263


http://reviews.llvm.org/D14184



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


Re: [PATCH] D14184: [clang] Add initial support for -meabi flag

2015-11-03 Thread Vinicius Tinti via cfe-commits
tinti set the repository for this revision to rL LLVM.
tinti updated this revision to Diff 39108.
tinti added a comment.

- Clang format code.
- Update eabi names to match new LLVM patch.


Repository:
  rL LLVM

http://reviews.llvm.org/D14184

Files:
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.h
  lib/CodeGen/BackendUtil.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/arm-eabi.c
  test/Driver/eabi.c

Index: test/Driver/eabi.c
===
--- /dev/null
+++ test/Driver/eabi.c
@@ -0,0 +1,15 @@
+// RUN: %clang %s -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-DEFAULT %s
+// RUN: %clang %s -meabi default -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-DEFAULT %s
+// RUN: %clang %s -meabi 4 -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-EABI4 %s
+// RUN: %clang %s -meabi 5 -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-EABI5 %s
+// RUN: %clang %s -meabi gnu -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-GNUEABI %s
+
+// CHECK-DEFAULT: "-meabi" "default"
+// CHECK-EABI4: "-meabi" "4"
+// CHECK-EABI5: "-meabi" "5"
+// CHECK-GNUEABI: "-meabi" "gnu"
Index: test/CodeGen/arm-eabi.c
===
--- /dev/null
+++ test/CodeGen/arm-eabi.c
@@ -0,0 +1,20 @@
+// REQUIRES: arm-registered-target
+// RUN: %clang -target arm-none-eabi -S -o - %s | FileCheck -check-prefix=CHECK-EABI %s
+// RUN: %clang -target arm-none-eabi -S -meabi gnu -o - %s | FileCheck -check-prefix=CHECK-GNUEABI %s
+// RUN: %clang -target arm-none-eabihf -S -o - %s | FileCheck -check-prefix=CHECK-EABI %s
+// RUN: %clang -target arm-none-eabihf -S -meabi gnu -o - %s | FileCheck -check-prefix=CHECK-GNUEABI %s
+// RUN: %clang -target arm-none-gnueabi -S -o - %s | FileCheck -check-prefix=CHECK-GNUEABI %s
+// RUN: %clang -target arm-none-gnueabi -S -meabi 5 -o - %s | FileCheck -check-prefix=CHECK-EABI %s
+// RUN: %clang -target arm-none-gnueabihf -S -o - %s | FileCheck -check-prefix=CHECK-GNUEABI %s
+// RUN: %clang -target arm-none-gnueabihf -S -meabi 5 -o - %s | FileCheck -check-prefix=CHECK-EABI %s
+
+struct my_s {
+  unsigned long a[18];
+};
+
+// CHECK-LABEL: foo
+// CHECK-EABI: bl __aeabi_memcpy4
+// CHECK-GNUEABI: bl memcpy
+void foo(unsigned long *t) {
+  *(struct my_s *)t = *((struct my_s *)(1UL));
+}
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -454,6 +454,20 @@
   Opts.DisableFree = Args.hasArg(OPT_disable_free);
   Opts.DisableTailCalls = Args.hasArg(OPT_mdisable_tail_calls);
   Opts.FloatABI = Args.getLastArgValue(OPT_mfloat_abi);
+  if (Arg *A = Args.getLastArg(OPT_meabi)) {
+StringRef Value = A->getValue();
+bool Valid = llvm::StringSwitch(Value)
+ .Case("default", true)
+ .Case("4", true)
+ .Case("5", true)
+ .Case("gnu", true)
+ .Default(false);
+if (!Valid)
+  Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args)
+<< Value;
+else
+  Opts.EABIVersion = Value;
+  }
   Opts.LessPreciseFPMAD = Args.hasArg(OPT_cl_mad_enable);
   Opts.LimitFloatPrecision = Args.getLastArgValue(OPT_mlimit_float_precision);
   Opts.NoInfsFPMath = (Args.hasArg(OPT_menable_no_infinities) ||
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3412,6 +3412,12 @@
 }
   }
 
+  CmdArgs.push_back("-meabi");
+  if (Arg *A = Args.getLastArg(options::OPT_meabi))
+CmdArgs.push_back(A->getValue());
+  else
+CmdArgs.push_back("default");
+
   CmdArgs.push_back("-mthread-model");
   if (Arg *A = Args.getLastArg(options::OPT_mthread_model))
 CmdArgs.push_back(A->getValue());
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -515,6 +515,15 @@
   Options.UseInitArray = CodeGenOpts.UseInitArray;
   Options.DisableIntegratedAS = CodeGenOpts.DisableIntegratedAS;
   Options.CompressDebugSections = CodeGenOpts.CompressDebugSections;
+
+  // Set EABI version.
+  Options.EABIVersion =
+  llvm::StringSwitch(CodeGenOpts.EABIVersion)
+  .Case("4", llvm::EABI::EABI4)
+  .Case("5", llvm::EABI::EABI5)
+  .Case("gnu", llvm::EABI::GNU)
+  .Default(llvm::EABI::Default);
+
   Options.LessPreciseFPMADOption = CodeGenOpts.LessPreciseFPMAD;
   Options.NoInfsFPMath = CodeGenOpts.NoInfsFPMath;
   Options.NoNaNsFPMath = CodeGenOpts.NoNaNsFPMath;
Index: include/clang/Frontend/CodeGenOptions.h
===
--- include/

Re: [PATCH] D14184: [clang] Add initial support for -meabi flag

2015-11-04 Thread Vinicius Tinti via cfe-commits
tinti updated this revision to Diff 39304.
tinti added a comment.

Clang format.


Repository:
  rL LLVM

http://reviews.llvm.org/D14184

Files:
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.h
  lib/CodeGen/BackendUtil.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/arm-eabi.c
  test/Driver/eabi.c

Index: test/Driver/eabi.c
===
--- /dev/null
+++ test/Driver/eabi.c
@@ -0,0 +1,15 @@
+// RUN: %clang %s -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-DEFAULT %s
+// RUN: %clang %s -meabi default -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-DEFAULT %s
+// RUN: %clang %s -meabi 4 -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-EABI4 %s
+// RUN: %clang %s -meabi 5 -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-EABI5 %s
+// RUN: %clang %s -meabi gnu -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-GNUEABI %s
+
+// CHECK-DEFAULT: "-meabi" "default"
+// CHECK-EABI4: "-meabi" "4"
+// CHECK-EABI5: "-meabi" "5"
+// CHECK-GNUEABI: "-meabi" "gnu"
Index: test/CodeGen/arm-eabi.c
===
--- /dev/null
+++ test/CodeGen/arm-eabi.c
@@ -0,0 +1,20 @@
+// REQUIRES: arm-registered-target
+// RUN: %clang -target arm-none-eabi -S -o - %s | FileCheck -check-prefix=CHECK-EABI %s
+// RUN: %clang -target arm-none-eabi -S -meabi gnu -o - %s | FileCheck -check-prefix=CHECK-GNUEABI %s
+// RUN: %clang -target arm-none-eabihf -S -o - %s | FileCheck -check-prefix=CHECK-EABI %s
+// RUN: %clang -target arm-none-eabihf -S -meabi gnu -o - %s | FileCheck -check-prefix=CHECK-GNUEABI %s
+// RUN: %clang -target arm-none-gnueabi -S -o - %s | FileCheck -check-prefix=CHECK-GNUEABI %s
+// RUN: %clang -target arm-none-gnueabi -S -meabi 5 -o - %s | FileCheck -check-prefix=CHECK-EABI %s
+// RUN: %clang -target arm-none-gnueabihf -S -o - %s | FileCheck -check-prefix=CHECK-GNUEABI %s
+// RUN: %clang -target arm-none-gnueabihf -S -meabi 5 -o - %s | FileCheck -check-prefix=CHECK-EABI %s
+
+struct my_s {
+  unsigned long a[18];
+};
+
+// CHECK-LABEL: foo
+// CHECK-EABI: bl __aeabi_memcpy4
+// CHECK-GNUEABI: bl memcpy
+void foo(unsigned long *t) {
+  *(struct my_s *)t = *((struct my_s *)(1UL));
+}
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -454,6 +454,20 @@
   Opts.DisableFree = Args.hasArg(OPT_disable_free);
   Opts.DisableTailCalls = Args.hasArg(OPT_mdisable_tail_calls);
   Opts.FloatABI = Args.getLastArgValue(OPT_mfloat_abi);
+  if (Arg *A = Args.getLastArg(OPT_meabi)) {
+StringRef Value = A->getValue();
+bool Valid = llvm::StringSwitch(Value)
+ .Case("default", true)
+ .Case("4", true)
+ .Case("5", true)
+ .Case("gnu", true)
+ .Default(false);
+if (!Valid)
+  Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args)
+<< Value;
+else
+  Opts.EABIVersion = Value;
+  }
   Opts.LessPreciseFPMAD = Args.hasArg(OPT_cl_mad_enable);
   Opts.LimitFloatPrecision = Args.getLastArgValue(OPT_mlimit_float_precision);
   Opts.NoInfsFPMath = (Args.hasArg(OPT_menable_no_infinities) ||
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3412,6 +3412,12 @@
 }
   }
 
+  CmdArgs.push_back("-meabi");
+  if (Arg *A = Args.getLastArg(options::OPT_meabi))
+CmdArgs.push_back(A->getValue());
+  else
+CmdArgs.push_back("default");
+
   CmdArgs.push_back("-mthread-model");
   if (Arg *A = Args.getLastArg(options::OPT_mthread_model))
 CmdArgs.push_back(A->getValue());
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -515,6 +515,14 @@
   Options.UseInitArray = CodeGenOpts.UseInitArray;
   Options.DisableIntegratedAS = CodeGenOpts.DisableIntegratedAS;
   Options.CompressDebugSections = CodeGenOpts.CompressDebugSections;
+
+  // Set EABI version.
+  Options.EABIVersion = llvm::StringSwitch(CodeGenOpts.EABIVersion)
+.Case("4", llvm::EABI::EABI4)
+.Case("5", llvm::EABI::EABI5)
+.Case("gnu", llvm::EABI::GNU)
+.Default(llvm::EABI::Default);
+
   Options.LessPreciseFPMADOption = CodeGenOpts.LessPreciseFPMAD;
   Options.NoInfsFPMath = CodeGenOpts.NoInfsFPMath;
   Options.NoNaNsFPMath = CodeGenOpts.NoNaNsFPMath;
Index: include/clang/Frontend/CodeGenOptions.h
===
--- include/clang/Frontend/CodeGenOptions.h
+++ includ

Re: [PATCH] D14184: [clang] Add initial support for -meabi flag

2015-11-04 Thread Vinicius Tinti via cfe-commits
tinti marked 2 inline comments as done.


Comment at: lib/Frontend/CompilerInvocation.cpp:459
@@ +458,3 @@
+StringRef Value = A->getValue();
+bool Valid = llvm::StringSwitch(Value)
+ .Case("default", true)

This part of the code does not include TargetOptions.h (so EABI is an undefined 
type). Can I add it here?


Repository:
  rL LLVM

http://reviews.llvm.org/D14184



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


Re: [PATCH] D14184: [clang] Add initial support for -meabi flag

2015-11-06 Thread Vinicius Tinti via cfe-commits
tinti removed rL LLVM as the repository for this revision.
tinti updated this revision to Diff 39579.

http://reviews.llvm.org/D14184

Files:
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.h
  lib/CodeGen/BackendUtil.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/arm-eabi.c
  test/Driver/eabi.c

Index: test/Driver/eabi.c
===
--- /dev/null
+++ test/Driver/eabi.c
@@ -0,0 +1,10 @@
+// RUN: %clang %s -meabi 4 -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-EABI4 %s
+// RUN: %clang %s -meabi 5 -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-EABI5 %s
+// RUN: %clang %s -meabi gnu -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-GNUEABI %s
+
+// CHECK-EABI4: "-meabi" "4"
+// CHECK-EABI5: "-meabi" "5"
+// CHECK-GNUEABI: "-meabi" "gnu"
Index: test/CodeGen/arm-eabi.c
===
--- /dev/null
+++ test/CodeGen/arm-eabi.c
@@ -0,0 +1,20 @@
+// REQUIRES: arm-registered-target
+// RUN: %clang -target arm-none-eabi -S -o - %s | FileCheck -check-prefix=CHECK-EABI %s
+// RUN: %clang -target arm-none-eabi -S -meabi gnu -o - %s | FileCheck -check-prefix=CHECK-GNUEABI %s
+// RUN: %clang -target arm-none-eabihf -S -o - %s | FileCheck -check-prefix=CHECK-EABI %s
+// RUN: %clang -target arm-none-eabihf -S -meabi gnu -o - %s | FileCheck -check-prefix=CHECK-GNUEABI %s
+// RUN: %clang -target arm-none-gnueabi -S -o - %s | FileCheck -check-prefix=CHECK-GNUEABI %s
+// RUN: %clang -target arm-none-gnueabi -S -meabi 5 -o - %s | FileCheck -check-prefix=CHECK-EABI %s
+// RUN: %clang -target arm-none-gnueabihf -S -o - %s | FileCheck -check-prefix=CHECK-GNUEABI %s
+// RUN: %clang -target arm-none-gnueabihf -S -meabi 5 -o - %s | FileCheck -check-prefix=CHECK-EABI %s
+
+struct my_s {
+  unsigned long a[18];
+};
+
+// CHECK-LABEL: foo
+// CHECK-EABI: bl __aeabi_memcpy4
+// CHECK-GNUEABI: bl memcpy
+void foo(unsigned long *t) {
+  *(struct my_s *)t = *((struct my_s *)(1UL));
+}
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -36,6 +36,7 @@
 #include "llvm/Support/Host.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Process.h"
+#include "llvm/Target/TargetOptions.h"
 #include 
 #include 
 #include 
@@ -454,6 +455,20 @@
   Opts.DisableFree = Args.hasArg(OPT_disable_free);
   Opts.DisableTailCalls = Args.hasArg(OPT_mdisable_tail_calls);
   Opts.FloatABI = Args.getLastArgValue(OPT_mfloat_abi);
+  if (Arg *A = Args.getLastArg(OPT_meabi)) {
+StringRef Value = A->getValue();
+llvm::EABI EABIVersion = llvm::StringSwitch(Value)
+ .Case("default", llvm::EABI::Default)
+ .Case("4", llvm::EABI::EABI4)
+ .Case("5", llvm::EABI::EABI5)
+ .Case("gnu", llvm::EABI::GNU)
+ .Default(llvm::EABI::Unknown);
+if (EABIVersion == llvm::EABI::Unknown)
+  Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args)
+<< Value;
+else
+  Opts.EABIVersion = Value;
+  }
   Opts.LessPreciseFPMAD = Args.hasArg(OPT_cl_mad_enable);
   Opts.LimitFloatPrecision = Args.getLastArgValue(OPT_mlimit_float_precision);
   Opts.NoInfsFPMath = (Args.hasArg(OPT_menable_no_infinities) ||
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3412,6 +3412,11 @@
 }
   }
 
+  if (Arg *A = Args.getLastArg(options::OPT_meabi)) {
+CmdArgs.push_back("-meabi");
+CmdArgs.push_back(A->getValue());
+  }
+
   CmdArgs.push_back("-mthread-model");
   if (Arg *A = Args.getLastArg(options::OPT_mthread_model))
 CmdArgs.push_back(A->getValue());
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -515,6 +515,14 @@
   Options.UseInitArray = CodeGenOpts.UseInitArray;
   Options.DisableIntegratedAS = CodeGenOpts.DisableIntegratedAS;
   Options.CompressDebugSections = CodeGenOpts.CompressDebugSections;
+
+  // Set EABI version.
+  Options.EABIVersion = llvm::StringSwitch(CodeGenOpts.EABIVersion)
+.Case("4", llvm::EABI::EABI4)
+.Case("5", llvm::EABI::EABI5)
+.Case("gnu", llvm::EABI::GNU)
+.Default(llvm::EABI::Default);
+
   Options.LessPreciseFPMADOption = CodeGenOpts.LessPreciseFPMAD;
   Options.NoInfsFPMath = CodeGenOpts.NoInfsFPMath;
   Options.NoNaNsFPMath = CodeGenOpts.NoNaNsFPMath;
Index: include/clang/Frontend/CodeGenOptions.h
==

Re: [PATCH] D14184: [clang] Add initial support for -meabi flag

2015-11-06 Thread Vinicius Tinti via cfe-commits
tinti set the repository for this revision to rL LLVM.
tinti updated this revision to Diff 39596.
tinti marked an inline comment as done.
tinti added a comment.

- Add test for error check
- Change StringSwitch to use lllvm::EABI type


Repository:
  rL LLVM

http://reviews.llvm.org/D14184

Files:
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.h
  lib/CodeGen/BackendUtil.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/arm-eabi.c
  test/Driver/eabi.c

Index: test/Driver/eabi.c
===
--- /dev/null
+++ test/Driver/eabi.c
@@ -0,0 +1,13 @@
+// RUN: %clang %s -meabi 4 -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-EABI4 %s
+// RUN: %clang %s -meabi 5 -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-EABI5 %s
+// RUN: %clang %s -meabi gnu -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-GNUEABI %s
+// RUN: not %clang %s -meabi unknown 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-UNKNOWN %s
+
+// CHECK-EABI4: "-meabi" "4"
+// CHECK-EABI5: "-meabi" "5"
+// CHECK-GNUEABI: "-meabi" "gnu"
+// CHECK-UNKNOWN: error: invalid value 'unknown' in '-meabi unknown'
Index: test/CodeGen/arm-eabi.c
===
--- /dev/null
+++ test/CodeGen/arm-eabi.c
@@ -0,0 +1,20 @@
+// REQUIRES: arm-registered-target
+// RUN: %clang -target arm-none-eabi -S -o - %s | FileCheck -check-prefix=CHECK-EABI %s
+// RUN: %clang -target arm-none-eabi -S -meabi gnu -o - %s | FileCheck -check-prefix=CHECK-GNUEABI %s
+// RUN: %clang -target arm-none-eabihf -S -o - %s | FileCheck -check-prefix=CHECK-EABI %s
+// RUN: %clang -target arm-none-eabihf -S -meabi gnu -o - %s | FileCheck -check-prefix=CHECK-GNUEABI %s
+// RUN: %clang -target arm-none-gnueabi -S -o - %s | FileCheck -check-prefix=CHECK-GNUEABI %s
+// RUN: %clang -target arm-none-gnueabi -S -meabi 5 -o - %s | FileCheck -check-prefix=CHECK-EABI %s
+// RUN: %clang -target arm-none-gnueabihf -S -o - %s | FileCheck -check-prefix=CHECK-GNUEABI %s
+// RUN: %clang -target arm-none-gnueabihf -S -meabi 5 -o - %s | FileCheck -check-prefix=CHECK-EABI %s
+
+struct my_s {
+  unsigned long a[18];
+};
+
+// CHECK-LABEL: foo
+// CHECK-EABI: bl __aeabi_memcpy4
+// CHECK-GNUEABI: bl memcpy
+void foo(unsigned long *t) {
+  *(struct my_s *)t = *((struct my_s *)(1UL));
+}
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -36,6 +36,7 @@
 #include "llvm/Support/Host.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Process.h"
+#include "llvm/Target/TargetOptions.h"
 #include 
 #include 
 #include 
@@ -454,6 +455,20 @@
   Opts.DisableFree = Args.hasArg(OPT_disable_free);
   Opts.DisableTailCalls = Args.hasArg(OPT_mdisable_tail_calls);
   Opts.FloatABI = Args.getLastArgValue(OPT_mfloat_abi);
+  if (Arg *A = Args.getLastArg(OPT_meabi)) {
+StringRef Value = A->getValue();
+llvm::EABI EABIVersion = llvm::StringSwitch(Value)
+ .Case("default", llvm::EABI::Default)
+ .Case("4", llvm::EABI::EABI4)
+ .Case("5", llvm::EABI::EABI5)
+ .Case("gnu", llvm::EABI::GNU)
+ .Default(llvm::EABI::Unknown);
+if (EABIVersion == llvm::EABI::Unknown)
+  Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args)
+<< Value;
+else
+  Opts.EABIVersion = Value;
+  }
   Opts.LessPreciseFPMAD = Args.hasArg(OPT_cl_mad_enable);
   Opts.LimitFloatPrecision = Args.getLastArgValue(OPT_mlimit_float_precision);
   Opts.NoInfsFPMath = (Args.hasArg(OPT_menable_no_infinities) ||
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3412,6 +3412,11 @@
 }
   }
 
+  if (Arg *A = Args.getLastArg(options::OPT_meabi)) {
+CmdArgs.push_back("-meabi");
+CmdArgs.push_back(A->getValue());
+  }
+
   CmdArgs.push_back("-mthread-model");
   if (Arg *A = Args.getLastArg(options::OPT_mthread_model))
 CmdArgs.push_back(A->getValue());
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -515,6 +515,14 @@
   Options.UseInitArray = CodeGenOpts.UseInitArray;
   Options.DisableIntegratedAS = CodeGenOpts.DisableIntegratedAS;
   Options.CompressDebugSections = CodeGenOpts.CompressDebugSections;
+
+  // Set EABI version.
+  Options.EABIVersion = llvm::StringSwitch(CodeGenOpts.EABIVersion)
+.Case("4", llvm::EABI::EABI4)
+.Case("5", llvm::EABI::EABI5)
+.Case("gnu", llvm::EABI::GNU)
+  

Re: [PATCH] D14184: [clang] Add initial support for -meabi flag

2015-11-06 Thread Vinicius Tinti via cfe-commits
tinti marked 6 inline comments as done.


Comment at: lib/Driver/Tools.cpp:3415
@@ -3414,1 +3414,3 @@
 
+  if (Arg *A = Args.getLastArg(options::OPT_meabi)) {
+CmdArgs.push_back("-meabi");

Good point! Fixed.


Comment at: lib/Frontend/CompilerInvocation.cpp:460
@@ +459,3 @@
+StringRef Value = A->getValue();
+llvm::EABI EABIVersion = llvm::StringSwitch(Value)
+ .Case("default", llvm::EABI::Default)

I have added. It requires to add an invalid or more apropriate name Unknown 
version.

If the backend ever sees an Unknown it will consider it as a Default.
The frontend considers Unknown as an invalid state and raises an error.


Repository:
  rL LLVM

http://reviews.llvm.org/D14184



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


[PATCH] D14804: [clang] Disable Unicode in asm files

2015-11-18 Thread Vinicius Tinti via cfe-commits
tinti created this revision.
tinti added reviewers: rengolin, zatrazz, compnerd.
tinti added a subscriber: cfe-commits.
tinti set the repository for this revision to rL LLVM.

Clang should not convert tokens to Unicode when preprocessing assembly
files.

Fixes PR25558

Repository:
  rL LLVM

http://reviews.llvm.org/D14804

Files:
  lib/Lex/Lexer.cpp
  test/CodeGen/asm-unicode.S
  test/CodeGen/c-unicode.c

Index: test/CodeGen/c-unicode.c
===
--- test/CodeGen/c-unicode.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// RUN: %clang -S %s -o - | FileCheck %s -check-prefix=ALLOWED
-// RUN: not %clang -std=c89 -S %s -o - 2>&1 | FileCheck %s -check-prefix=DENIED
-int \uaccess = 0;
-// ALLOWED: "곎ss":
-// ALLOWED-NOT: "\uaccess":
-// DENIED: warning: universal character names are only valid in C99 or C++; 
treating as '\' followed by identifier [-Wunicode]
-// DENIED: error: expected identifier or '('
Index: test/CodeGen/asm-unicode.S
===
--- test/CodeGen/asm-unicode.S
+++ /dev/null
@@ -1,12 +0,0 @@
-// RUN: %clang -S %s -o - | FileCheck %s
-.macro  my_macro, trace=1, uaccess=1
-.if \uaccess
-// CHECK: .if \uaccess
-// CHECK-NOT: .if 곎ss
-// CHECK: my_macro trace=1
-my_macro trace=1
-.endif
-.endm
-
-foo:
-my_macro trace=0
Index: lib/Lex/Lexer.cpp
===
--- lib/Lex/Lexer.cpp
+++ lib/Lex/Lexer.cpp
@@ -1354,9 +1354,7 @@
 }
 
 static bool isAllowedIDChar(uint32_t C, const LangOptions &LangOpts) {
-  if (LangOpts.AsmPreprocessor) {
-return false;
-  } else if (LangOpts.CPlusPlus11 || LangOpts.C11) {
+  if (LangOpts.CPlusPlus11 || LangOpts.C11) {
 static const llvm::sys::UnicodeCharSet C11AllowedIDChars(
 C11AllowedIDCharRanges);
 return C11AllowedIDChars.contains(C);
@@ -1373,9 +1371,7 @@
 
 static bool isAllowedInitiallyIDChar(uint32_t C, const LangOptions &LangOpts) {
   assert(isAllowedIDChar(C, LangOpts));
-  if (LangOpts.AsmPreprocessor) {
-return false;
-  } else if (LangOpts.CPlusPlus11 || LangOpts.C11) {
+  if (LangOpts.CPlusPlus11 || LangOpts.C11) {
 static const llvm::sys::UnicodeCharSet C11DisallowedInitialIDChars(
 C11DisallowedInitialIDCharRanges);
 return !C11DisallowedInitialIDChars.contains(C);


Index: test/CodeGen/c-unicode.c
===
--- test/CodeGen/c-unicode.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// RUN: %clang -S %s -o - | FileCheck %s -check-prefix=ALLOWED
-// RUN: not %clang -std=c89 -S %s -o - 2>&1 | FileCheck %s -check-prefix=DENIED
-int \uaccess = 0;
-// ALLOWED: "곎ss":
-// ALLOWED-NOT: "\uaccess":
-// DENIED: warning: universal character names are only valid in C99 or C++; treating as '\' followed by identifier [-Wunicode]
-// DENIED: error: expected identifier or '('
Index: test/CodeGen/asm-unicode.S
===
--- test/CodeGen/asm-unicode.S
+++ /dev/null
@@ -1,12 +0,0 @@
-// RUN: %clang -S %s -o - | FileCheck %s
-.macro  my_macro, trace=1, uaccess=1
-.if \uaccess
-// CHECK: .if \uaccess
-// CHECK-NOT: .if 곎ss
-// CHECK: my_macro trace=1
-my_macro trace=1
-.endif
-.endm
-
-foo:
-my_macro trace=0
Index: lib/Lex/Lexer.cpp
===
--- lib/Lex/Lexer.cpp
+++ lib/Lex/Lexer.cpp
@@ -1354,9 +1354,7 @@
 }
 
 static bool isAllowedIDChar(uint32_t C, const LangOptions &LangOpts) {
-  if (LangOpts.AsmPreprocessor) {
-return false;
-  } else if (LangOpts.CPlusPlus11 || LangOpts.C11) {
+  if (LangOpts.CPlusPlus11 || LangOpts.C11) {
 static const llvm::sys::UnicodeCharSet C11AllowedIDChars(
 C11AllowedIDCharRanges);
 return C11AllowedIDChars.contains(C);
@@ -1373,9 +1371,7 @@
 
 static bool isAllowedInitiallyIDChar(uint32_t C, const LangOptions &LangOpts) {
   assert(isAllowedIDChar(C, LangOpts));
-  if (LangOpts.AsmPreprocessor) {
-return false;
-  } else if (LangOpts.CPlusPlus11 || LangOpts.C11) {
+  if (LangOpts.CPlusPlus11 || LangOpts.C11) {
 static const llvm::sys::UnicodeCharSet C11DisallowedInitialIDChars(
 C11DisallowedInitialIDCharRanges);
 return !C11DisallowedInitialIDChars.contains(C);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14804: [clang] Disable Unicode in asm files

2015-11-18 Thread Vinicius Tinti via cfe-commits
tinti removed rL LLVM as the repository for this revision.
tinti updated this revision to Diff 40595.

http://reviews.llvm.org/D14804

Files:
  lib/Lex/Lexer.cpp
  test/CodeGen/asm-unicode.S
  test/CodeGen/c-unicode.c

Index: test/CodeGen/c-unicode.c
===
--- /dev/null
+++ test/CodeGen/c-unicode.c
@@ -0,0 +1,7 @@
+// RUN: %clang -S %s -o - | FileCheck %s -check-prefix=ALLOWED
+// RUN: not %clang -std=c89 -S %s -o - 2>&1 | FileCheck %s -check-prefix=DENIED
+int \uaccess = 0;
+// ALLOWED: "곎ss":
+// ALLOWED-NOT: "\uaccess":
+// DENIED: warning: universal character names are only valid in C99 or C++; 
treating as '\' followed by identifier [-Wunicode]
+// DENIED: error: expected identifier or '('
Index: test/CodeGen/asm-unicode.S
===
--- /dev/null
+++ test/CodeGen/asm-unicode.S
@@ -0,0 +1,12 @@
+// RUN: %clang -S %s -o - | FileCheck %s
+.macro  my_macro, trace=1, uaccess=1
+.if \uaccess
+// CHECK: .if \uaccess
+// CHECK-NOT: .if 곎ss
+// CHECK: my_macro trace=1
+my_macro trace=1
+.endif
+.endm
+
+foo:
+my_macro trace=0
Index: lib/Lex/Lexer.cpp
===
--- lib/Lex/Lexer.cpp
+++ lib/Lex/Lexer.cpp
@@ -1354,7 +1354,9 @@
 }
 
 static bool isAllowedIDChar(uint32_t C, const LangOptions &LangOpts) {
-  if (LangOpts.CPlusPlus11 || LangOpts.C11) {
+  if (LangOpts.AsmPreprocessor) {
+return false;
+  } else if (LangOpts.CPlusPlus11 || LangOpts.C11) {
 static const llvm::sys::UnicodeCharSet C11AllowedIDChars(
 C11AllowedIDCharRanges);
 return C11AllowedIDChars.contains(C);
@@ -1371,7 +1373,9 @@
 
 static bool isAllowedInitiallyIDChar(uint32_t C, const LangOptions &LangOpts) {
   assert(isAllowedIDChar(C, LangOpts));
-  if (LangOpts.CPlusPlus11 || LangOpts.C11) {
+  if (LangOpts.AsmPreprocessor) {
+return false;
+  } else if (LangOpts.CPlusPlus11 || LangOpts.C11) {
 static const llvm::sys::UnicodeCharSet C11DisallowedInitialIDChars(
 C11DisallowedInitialIDCharRanges);
 return !C11DisallowedInitialIDChars.contains(C);


Index: test/CodeGen/c-unicode.c
===
--- /dev/null
+++ test/CodeGen/c-unicode.c
@@ -0,0 +1,7 @@
+// RUN: %clang -S %s -o - | FileCheck %s -check-prefix=ALLOWED
+// RUN: not %clang -std=c89 -S %s -o - 2>&1 | FileCheck %s -check-prefix=DENIED
+int \uaccess = 0;
+// ALLOWED: "곎ss":
+// ALLOWED-NOT: "\uaccess":
+// DENIED: warning: universal character names are only valid in C99 or C++; treating as '\' followed by identifier [-Wunicode]
+// DENIED: error: expected identifier or '('
Index: test/CodeGen/asm-unicode.S
===
--- /dev/null
+++ test/CodeGen/asm-unicode.S
@@ -0,0 +1,12 @@
+// RUN: %clang -S %s -o - | FileCheck %s
+.macro  my_macro, trace=1, uaccess=1
+.if \uaccess
+// CHECK: .if \uaccess
+// CHECK-NOT: .if 곎ss
+// CHECK: my_macro trace=1
+my_macro trace=1
+.endif
+.endm
+
+foo:
+my_macro trace=0
Index: lib/Lex/Lexer.cpp
===
--- lib/Lex/Lexer.cpp
+++ lib/Lex/Lexer.cpp
@@ -1354,7 +1354,9 @@
 }
 
 static bool isAllowedIDChar(uint32_t C, const LangOptions &LangOpts) {
-  if (LangOpts.CPlusPlus11 || LangOpts.C11) {
+  if (LangOpts.AsmPreprocessor) {
+return false;
+  } else if (LangOpts.CPlusPlus11 || LangOpts.C11) {
 static const llvm::sys::UnicodeCharSet C11AllowedIDChars(
 C11AllowedIDCharRanges);
 return C11AllowedIDChars.contains(C);
@@ -1371,7 +1373,9 @@
 
 static bool isAllowedInitiallyIDChar(uint32_t C, const LangOptions &LangOpts) {
   assert(isAllowedIDChar(C, LangOpts));
-  if (LangOpts.CPlusPlus11 || LangOpts.C11) {
+  if (LangOpts.AsmPreprocessor) {
+return false;
+  } else if (LangOpts.CPlusPlus11 || LangOpts.C11) {
 static const llvm::sys::UnicodeCharSet C11DisallowedInitialIDChars(
 C11DisallowedInitialIDCharRanges);
 return !C11DisallowedInitialIDChars.contains(C);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r253738 - [clang] Disable Unicode in asm files

2015-11-20 Thread Vinicius Tinti via cfe-commits
Author: tinti
Date: Fri Nov 20 17:42:39 2015
New Revision: 253738

URL: http://llvm.org/viewvc/llvm-project?rev=253738&view=rev
Log:
[clang] Disable Unicode in asm files

Clang should not convert tokens to Unicode when preprocessing assembly
files.

Fixes PR25558.

Added:
cfe/trunk/test/CodeGen/asm-unicode.S
cfe/trunk/test/CodeGen/c-unicode.c
Modified:
cfe/trunk/lib/Lex/Lexer.cpp

Modified: cfe/trunk/lib/Lex/Lexer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Lexer.cpp?rev=253738&r1=253737&r2=253738&view=diff
==
--- cfe/trunk/lib/Lex/Lexer.cpp (original)
+++ cfe/trunk/lib/Lex/Lexer.cpp Fri Nov 20 17:42:39 2015
@@ -1354,7 +1354,9 @@ void Lexer::SkipBytes(unsigned Bytes, bo
 }
 
 static bool isAllowedIDChar(uint32_t C, const LangOptions &LangOpts) {
-  if (LangOpts.CPlusPlus11 || LangOpts.C11) {
+  if (LangOpts.AsmPreprocessor) {
+return false;
+  } else if (LangOpts.CPlusPlus11 || LangOpts.C11) {
 static const llvm::sys::UnicodeCharSet C11AllowedIDChars(
 C11AllowedIDCharRanges);
 return C11AllowedIDChars.contains(C);
@@ -1371,7 +1373,9 @@ static bool isAllowedIDChar(uint32_t C,
 
 static bool isAllowedInitiallyIDChar(uint32_t C, const LangOptions &LangOpts) {
   assert(isAllowedIDChar(C, LangOpts));
-  if (LangOpts.CPlusPlus11 || LangOpts.C11) {
+  if (LangOpts.AsmPreprocessor) {
+return false;
+  } else if (LangOpts.CPlusPlus11 || LangOpts.C11) {
 static const llvm::sys::UnicodeCharSet C11DisallowedInitialIDChars(
 C11DisallowedInitialIDCharRanges);
 return !C11DisallowedInitialIDChars.contains(C);

Added: cfe/trunk/test/CodeGen/asm-unicode.S
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/asm-unicode.S?rev=253738&view=auto
==
--- cfe/trunk/test/CodeGen/asm-unicode.S (added)
+++ cfe/trunk/test/CodeGen/asm-unicode.S Fri Nov 20 17:42:39 2015
@@ -0,0 +1,12 @@
+// RUN: %clang -S %s -o - | FileCheck %s
+.macro  my_macro, trace=1, uaccess=1
+.if \uaccess
+// CHECK: .if \uaccess
+// CHECK-NOT: .if 곎ss
+// CHECK: my_macro trace=1
+my_macro trace=1
+.endif
+.endm
+
+foo:
+my_macro trace=0

Added: cfe/trunk/test/CodeGen/c-unicode.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/c-unicode.c?rev=253738&view=auto
==
--- cfe/trunk/test/CodeGen/c-unicode.c (added)
+++ cfe/trunk/test/CodeGen/c-unicode.c Fri Nov 20 17:42:39 2015
@@ -0,0 +1,7 @@
+// RUN: %clang -S %s -o - | FileCheck %s -check-prefix=ALLOWED
+// RUN: not %clang -std=c89 -S %s -o - 2>&1 | FileCheck %s -check-prefix=DENIED
+int \uaccess = 0;
+// ALLOWED: "곎ss":
+// ALLOWED-NOT: "\uaccess":
+// DENIED: warning: universal character names are only valid in C99 or C++; 
treating as '\' followed by identifier [-Wunicode]
+// DENIED: error: expected identifier or '('


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


Re: [PATCH] D14804: [clang] Disable Unicode in asm files

2015-11-20 Thread Vinicius Tinti via cfe-commits
tinti closed this revision.
tinti added a comment.

r253738


Repository:
  rL LLVM

http://reviews.llvm.org/D14804



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