[PATCH] D74112: [clangd] Filter out implicit references while renaming

2020-02-06 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev created this revision.
kbobyrev added a reviewer: hokein.
Herald added subscribers: usaxena95, kadircet, arphaman, jkorous, MaskRay, 
ilya-biryukov.
Herald added a project: clang.

This patch is based on D72746  and prevents 
non-spelled references from
being renamed which would cause incorrect behavior otherwise.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74112

Files:
  clang-tools-extra/clangd/refactor/Rename.cpp
  clang-tools-extra/clangd/unittests/RenameTests.cpp


Index: clang-tools-extra/clangd/unittests/RenameTests.cpp
===
--- clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -33,7 +33,7 @@
 // Convert a Range to a Ref.
 Ref refWithRange(const clangd::Range &Range, const std::string &URI) {
   Ref Result;
-  Result.Kind = RefKind::Reference;
+  Result.Kind = RefKind::Reference | RefKind::Spelled;
   Result.Location.Start.setLine(Range.start.line);
   Result.Location.Start.setColumn(Range.start.character);
   Result.Location.End.setLine(Range.end.line);
@@ -892,6 +892,22 @@
 }
   )cpp",
   },
+  {
+  // Implicit references in macro expansions.
+  R"cpp(
+class [[Fo^o]] {};
+#define FooFoo Foo
+#define FOO Foo
+  )cpp",
+  R"cpp(
+#include "foo.h"
+void bar() {
+  [[Foo]] x;
+  FOO y;
+  FooFoo z;
+}
+  )cpp",
+  },
   };
 
   for (const auto& T : Cases) {
Index: clang-tools-extra/clangd/refactor/Rename.cpp
===
--- clang-tools-extra/clangd/refactor/Rename.cpp
+++ clang-tools-extra/clangd/refactor/Rename.cpp
@@ -306,6 +306,8 @@
   bool HasMore = Index.refs(RQuest, [&](const Ref &R) {
 if (AffectedFiles.size() > MaxLimitFiles)
   return;
+if ((R.Kind & RefKind::Spelled) == RefKind::Unknown)
+  return;
 if (auto RefFilePath = filePath(R.Location, /*HintFilePath=*/MainFile)) {
   if (*RefFilePath != MainFile)
 AffectedFiles[*RefFilePath].push_back(toRange(R.Location));


Index: clang-tools-extra/clangd/unittests/RenameTests.cpp
===
--- clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -33,7 +33,7 @@
 // Convert a Range to a Ref.
 Ref refWithRange(const clangd::Range &Range, const std::string &URI) {
   Ref Result;
-  Result.Kind = RefKind::Reference;
+  Result.Kind = RefKind::Reference | RefKind::Spelled;
   Result.Location.Start.setLine(Range.start.line);
   Result.Location.Start.setColumn(Range.start.character);
   Result.Location.End.setLine(Range.end.line);
@@ -892,6 +892,22 @@
 }
   )cpp",
   },
+  {
+  // Implicit references in macro expansions.
+  R"cpp(
+class [[Fo^o]] {};
+#define FooFoo Foo
+#define FOO Foo
+  )cpp",
+  R"cpp(
+#include "foo.h"
+void bar() {
+  [[Foo]] x;
+  FOO y;
+  FooFoo z;
+}
+  )cpp",
+  },
   };
 
   for (const auto& T : Cases) {
Index: clang-tools-extra/clangd/refactor/Rename.cpp
===
--- clang-tools-extra/clangd/refactor/Rename.cpp
+++ clang-tools-extra/clangd/refactor/Rename.cpp
@@ -306,6 +306,8 @@
   bool HasMore = Index.refs(RQuest, [&](const Ref &R) {
 if (AffectedFiles.size() > MaxLimitFiles)
   return;
+if ((R.Kind & RefKind::Spelled) == RefKind::Unknown)
+  return;
 if (auto RefFilePath = filePath(R.Location, /*HintFilePath=*/MainFile)) {
   if (*RefFilePath != MainFile)
 AffectedFiles[*RefFilePath].push_back(toRange(R.Location));
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74112: [clangd] Filter out implicit references while renaming

2020-02-06 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision.
hokein added a comment.
This revision is now accepted and ready to land.

looks good, thanks.




Comment at: clang-tools-extra/clangd/refactor/Rename.cpp:309
   return;
+if ((R.Kind & RefKind::Spelled) == RefKind::Unknown)
+  return;

nit: I'd use ` if (!static_cast(R.Kind & RefKind::Spelled))`.



Comment at: clang-tools-extra/clangd/unittests/RenameTests.cpp:896
+  {
+  // Implicit references in macro expansions.
+  R"cpp(

nit: "only rename spelled references"


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74112/new/

https://reviews.llvm.org/D74112



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


[clang] 863d975 - [SYCL][Driver] Add clang driver option to enable SYCL compilation mode

2020-02-06 Thread Alexey Bader via cfe-commits

Author: Alexey Bader
Date: 2020-02-06T08:42:31+03:00
New Revision: 863d9752105f390b31b3d08d1980d2888c15b034

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

LOG: [SYCL][Driver] Add clang driver option to enable SYCL compilation mode

Summary:
As a first step this implementation enables compilation of the offload
code.

Reviewers: ABataev

Subscribers: ebevhan, Anastasia, cfe-commits

Tags: #clang

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

Added: 
clang/test/Driver/sycl.c

Modified: 
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Clang.cpp

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 2c925d018da7..2dea0ac2ba5c 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -124,6 +124,9 @@ def pedantic_Group : OptionGroup<"">, 
Group,
 def opencl_Group : OptionGroup<"">, Group,
DocName<"OpenCL flags">;
 
+def sycl_Group : OptionGroup<"">, Group,
+ DocName<"SYCL flags">;
+
 def m_Group : OptionGroup<"">, Group,
   DocName<"Target-dependent compilation options">;
 
@@ -3407,6 +3410,11 @@ defm stack_arrays : BooleanFFlag<"stack-arrays">, 
Group;
 defm underscoring : BooleanFFlag<"underscoring">, Group;
 defm whole_file : BooleanFFlag<"whole-file">, Group;
 
+// C++ SYCL options
+def fsycl : Flag<["-"], "fsycl">, Group,
+  HelpText<"Enable SYCL kernels compilation for device">;
+def fno_sycl : Flag<["-"], "fno-sycl">, Group,
+  HelpText<"Disable SYCL kernels compilation for device">;
 
 include "CC1Options.td"
 

diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index ccdfbe8c604f..0bed933185f6 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -4023,6 +4023,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction 
&JA,
 CmdArgs.push_back(Args.MakeArgString(NormalizedTriple));
   }
 
+  if (Args.hasFlag(options::OPT_fsycl, options::OPT_fno_sycl, false))
+CmdArgs.push_back("-fsycl-is-device");
+
   if (IsOpenMPDevice) {
 // We have to pass the triple of the host if compiling for an OpenMP 
device.
 std::string NormalizedTriple =

diff  --git a/clang/test/Driver/sycl.c b/clang/test/Driver/sycl.c
new file mode 100644
index ..6c4b291f387b
--- /dev/null
+++ b/clang/test/Driver/sycl.c
@@ -0,0 +1,10 @@
+// RUN: %clang -### -fsycl -c %s 2>&1 | FileCheck %s --check-prefix=ENABLED
+// RUN: %clang -### -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED
+// RUN: %clang -### -fno-sycl -fsycl %s 2>&1 | FileCheck %s 
--check-prefix=ENABLED
+// RUN: %clangxx -### -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED
+// RUN: %clangxx -### -fno-sycl %s 2>&1 | FileCheck %s --check-prefix=DISABLED
+// RUN: %clangxx -### -fsycl -fno-sycl %s 2>&1 | FileCheck %s 
--check-prefix=DISABLED
+// RUN: %clangxx -### %s 2>&1 | FileCheck %s --check-prefix=DISABLED
+
+// ENABLED: "-cc1"{{.*}} "-fsycl-is-device"
+// DISABLED-NOT: "-fsycl-is-device"



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


[PATCH] D73842: [xray][clang] Always add xray-skip-entry/exit and xray-ignore-loops attrs

2020-02-06 Thread Ian Levesque via Phabricator via cfe-commits
ianlevesque added a comment.

@hiraditya or @smeenai can i get a merge?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73842/new/

https://reviews.llvm.org/D73842



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


[PATCH] D72932: [ARM] Follow AACPS standard for volatile bit-fields access width

2020-02-06 Thread Diogo N. Sampaio via Phabricator via cfe-commits
dnsampaio updated this revision to Diff 242823.
dnsampaio added a comment.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.



- Removed test
- Added clear at the end of run as well, to clear waste
- Moved clearing to a more sensible position


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72932/new/

https://reviews.llvm.org/D72932

Files:
  llvm/lib/CodeGen/TypePromotion.cpp


Index: llvm/lib/CodeGen/TypePromotion.cpp
===
--- llvm/lib/CodeGen/TypePromotion.cpp
+++ llvm/lib/CodeGen/TypePromotion.cpp
@@ -847,8 +847,7 @@
 
   // Iterate through, and add to, a tree of operands and users in the use-def.
   while (!WorkList.empty()) {
-Value *V = WorkList.back();
-WorkList.pop_back();
+Value *V = WorkList.pop_back_val();
 if (CurrentVisited.count(V))
   continue;
 
@@ -917,7 +916,7 @@
  ++ToPromote;
}
 
-  // DAG optimisations should be able to handle these cases better, especially
+  // DAG optimizations should be able to handle these cases better, especially
   // for function arguments.
   if (ToPromote < 2 || (Blocks.size() == 1 && (NonFreeArgs > SafeWrap.size(
 return false;
@@ -941,6 +940,9 @@
   if (!TPC)
 return false;
 
+  AllVisited.clear();
+  SafeToPromote.clear();
+  SafeWrap.clear();
   bool MadeChange = false;
   const DataLayout &DL = F.getParent()->getDataLayout();
   const TargetMachine &TM = TPC->getTM();
@@ -998,6 +1000,10 @@
   if (MadeChange)
 LLVM_DEBUG(dbgs() << "After TypePromotion: " << F << "\n");
 
+  AllVisited.clear();
+  SafeToPromote.clear();
+  SafeWrap.clear();
+
   return MadeChange;
 }
 


Index: llvm/lib/CodeGen/TypePromotion.cpp
===
--- llvm/lib/CodeGen/TypePromotion.cpp
+++ llvm/lib/CodeGen/TypePromotion.cpp
@@ -847,8 +847,7 @@
 
   // Iterate through, and add to, a tree of operands and users in the use-def.
   while (!WorkList.empty()) {
-Value *V = WorkList.back();
-WorkList.pop_back();
+Value *V = WorkList.pop_back_val();
 if (CurrentVisited.count(V))
   continue;
 
@@ -917,7 +916,7 @@
  ++ToPromote;
}
 
-  // DAG optimisations should be able to handle these cases better, especially
+  // DAG optimizations should be able to handle these cases better, especially
   // for function arguments.
   if (ToPromote < 2 || (Blocks.size() == 1 && (NonFreeArgs > SafeWrap.size(
 return false;
@@ -941,6 +940,9 @@
   if (!TPC)
 return false;
 
+  AllVisited.clear();
+  SafeToPromote.clear();
+  SafeWrap.clear();
   bool MadeChange = false;
   const DataLayout &DL = F.getParent()->getDataLayout();
   const TargetMachine &TM = TPC->getTM();
@@ -998,6 +1000,10 @@
   if (MadeChange)
 LLVM_DEBUG(dbgs() << "After TypePromotion: " << F << "\n");
 
+  AllVisited.clear();
+  SafeToPromote.clear();
+  SafeWrap.clear();
+
   return MadeChange;
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74054: [clangd] Include the underlying decls in go-to-definition.

2020-02-06 Thread Haojian Wu via Phabricator via cfe-commits
hokein planned changes to this revision.
hokein marked an inline comment as done.
hokein added inline comments.



Comment at: clang-tools-extra/clangd/unittests/XRefsTests.cpp:674
 
-c^allback foo;
-  )cpp");
-  auto AST = TestTU::withCode(T.code()).build();
-  EXPECT_THAT(locateSymbolAt(AST, T.point()), ElementsAre(Sym("callback")));
+  c^allback foo;
+)cpp",

we need to avoid the underlying decl in this case.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74054/new/

https://reviews.llvm.org/D74054



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


[PATCH] D74048: [SYCL][Driver] Add clang driver option to enable SYCL compilation mode

2020-02-06 Thread Alexey Bader via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG863d9752105f: [SYCL][Driver] Add clang driver option to 
enable SYCL compilation mode (authored by bader).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74048/new/

https://reviews.llvm.org/D74048

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/sycl.c


Index: clang/test/Driver/sycl.c
===
--- /dev/null
+++ clang/test/Driver/sycl.c
@@ -0,0 +1,10 @@
+// RUN: %clang -### -fsycl -c %s 2>&1 | FileCheck %s --check-prefix=ENABLED
+// RUN: %clang -### -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED
+// RUN: %clang -### -fno-sycl -fsycl %s 2>&1 | FileCheck %s 
--check-prefix=ENABLED
+// RUN: %clangxx -### -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED
+// RUN: %clangxx -### -fno-sycl %s 2>&1 | FileCheck %s --check-prefix=DISABLED
+// RUN: %clangxx -### -fsycl -fno-sycl %s 2>&1 | FileCheck %s 
--check-prefix=DISABLED
+// RUN: %clangxx -### %s 2>&1 | FileCheck %s --check-prefix=DISABLED
+
+// ENABLED: "-cc1"{{.*}} "-fsycl-is-device"
+// DISABLED-NOT: "-fsycl-is-device"
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -4023,6 +4023,9 @@
 CmdArgs.push_back(Args.MakeArgString(NormalizedTriple));
   }
 
+  if (Args.hasFlag(options::OPT_fsycl, options::OPT_fno_sycl, false))
+CmdArgs.push_back("-fsycl-is-device");
+
   if (IsOpenMPDevice) {
 // We have to pass the triple of the host if compiling for an OpenMP 
device.
 std::string NormalizedTriple =
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -124,6 +124,9 @@
 def opencl_Group : OptionGroup<"">, Group,
DocName<"OpenCL flags">;
 
+def sycl_Group : OptionGroup<"">, Group,
+ DocName<"SYCL flags">;
+
 def m_Group : OptionGroup<"">, Group,
   DocName<"Target-dependent compilation options">;
 
@@ -3407,6 +3410,11 @@
 defm underscoring : BooleanFFlag<"underscoring">, Group;
 defm whole_file : BooleanFFlag<"whole-file">, Group;
 
+// C++ SYCL options
+def fsycl : Flag<["-"], "fsycl">, Group,
+  HelpText<"Enable SYCL kernels compilation for device">;
+def fno_sycl : Flag<["-"], "fno-sycl">, Group,
+  HelpText<"Disable SYCL kernels compilation for device">;
 
 include "CC1Options.td"
 


Index: clang/test/Driver/sycl.c
===
--- /dev/null
+++ clang/test/Driver/sycl.c
@@ -0,0 +1,10 @@
+// RUN: %clang -### -fsycl -c %s 2>&1 | FileCheck %s --check-prefix=ENABLED
+// RUN: %clang -### -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED
+// RUN: %clang -### -fno-sycl -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED
+// RUN: %clangxx -### -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED
+// RUN: %clangxx -### -fno-sycl %s 2>&1 | FileCheck %s --check-prefix=DISABLED
+// RUN: %clangxx -### -fsycl -fno-sycl %s 2>&1 | FileCheck %s --check-prefix=DISABLED
+// RUN: %clangxx -### %s 2>&1 | FileCheck %s --check-prefix=DISABLED
+
+// ENABLED: "-cc1"{{.*}} "-fsycl-is-device"
+// DISABLED-NOT: "-fsycl-is-device"
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -4023,6 +4023,9 @@
 CmdArgs.push_back(Args.MakeArgString(NormalizedTriple));
   }
 
+  if (Args.hasFlag(options::OPT_fsycl, options::OPT_fno_sycl, false))
+CmdArgs.push_back("-fsycl-is-device");
+
   if (IsOpenMPDevice) {
 // We have to pass the triple of the host if compiling for an OpenMP device.
 std::string NormalizedTriple =
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -124,6 +124,9 @@
 def opencl_Group : OptionGroup<"">, Group,
DocName<"OpenCL flags">;
 
+def sycl_Group : OptionGroup<"">, Group,
+ DocName<"SYCL flags">;
+
 def m_Group : OptionGroup<"">, Group,
   DocName<"Target-dependent compilation options">;
 
@@ -3407,6 +3410,11 @@
 defm underscoring : BooleanFFlag<"underscoring">, Group;
 defm whole_file : BooleanFFlag<"whole-file">, Group;
 
+// C++ SYCL options
+def fsycl : Flag<["-"], "fsycl">, Group,
+  HelpText<"Enable SYCL kernels compilation for device">;
+def fno_sycl : Flag<["-"], "fno-sycl">, Group,
+  HelpText<"Disable SYCL kernels compilation for device">;
 
 include "CC1Options.td"
 
___
cfe-commits mailing lis

[PATCH] D74112: [clangd] Filter out implicit references while renaming

2020-02-06 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev updated this revision to Diff 242822.
kbobyrev marked 2 inline comments as done.
kbobyrev added a comment.

Address review comments.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74112/new/

https://reviews.llvm.org/D74112

Files:
  clang-tools-extra/clangd/refactor/Rename.cpp
  clang-tools-extra/clangd/unittests/RenameTests.cpp


Index: clang-tools-extra/clangd/unittests/RenameTests.cpp
===
--- clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -33,7 +33,7 @@
 // Convert a Range to a Ref.
 Ref refWithRange(const clangd::Range &Range, const std::string &URI) {
   Ref Result;
-  Result.Kind = RefKind::Reference;
+  Result.Kind = RefKind::Reference | RefKind::Spelled;
   Result.Location.Start.setLine(Range.start.line);
   Result.Location.Start.setColumn(Range.start.character);
   Result.Location.End.setLine(Range.end.line);
@@ -892,6 +892,22 @@
 }
   )cpp",
   },
+  {
+  // Rename only spelled references.
+  R"cpp(
+class [[Fo^o]] {};
+#define FooFoo Foo
+#define FOO Foo
+  )cpp",
+  R"cpp(
+#include "foo.h"
+void bar() {
+  [[Foo]] x;
+  FOO y;
+  FooFoo z;
+}
+  )cpp",
+  },
   };
 
   for (const auto& T : Cases) {
Index: clang-tools-extra/clangd/refactor/Rename.cpp
===
--- clang-tools-extra/clangd/refactor/Rename.cpp
+++ clang-tools-extra/clangd/refactor/Rename.cpp
@@ -306,6 +306,8 @@
   bool HasMore = Index.refs(RQuest, [&](const Ref &R) {
 if (AffectedFiles.size() > MaxLimitFiles)
   return;
+if (!static_cast(R.Kind & RefKind::Spelled))
+  return;
 if (auto RefFilePath = filePath(R.Location, /*HintFilePath=*/MainFile)) {
   if (*RefFilePath != MainFile)
 AffectedFiles[*RefFilePath].push_back(toRange(R.Location));


Index: clang-tools-extra/clangd/unittests/RenameTests.cpp
===
--- clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -33,7 +33,7 @@
 // Convert a Range to a Ref.
 Ref refWithRange(const clangd::Range &Range, const std::string &URI) {
   Ref Result;
-  Result.Kind = RefKind::Reference;
+  Result.Kind = RefKind::Reference | RefKind::Spelled;
   Result.Location.Start.setLine(Range.start.line);
   Result.Location.Start.setColumn(Range.start.character);
   Result.Location.End.setLine(Range.end.line);
@@ -892,6 +892,22 @@
 }
   )cpp",
   },
+  {
+  // Rename only spelled references.
+  R"cpp(
+class [[Fo^o]] {};
+#define FooFoo Foo
+#define FOO Foo
+  )cpp",
+  R"cpp(
+#include "foo.h"
+void bar() {
+  [[Foo]] x;
+  FOO y;
+  FooFoo z;
+}
+  )cpp",
+  },
   };
 
   for (const auto& T : Cases) {
Index: clang-tools-extra/clangd/refactor/Rename.cpp
===
--- clang-tools-extra/clangd/refactor/Rename.cpp
+++ clang-tools-extra/clangd/refactor/Rename.cpp
@@ -306,6 +306,8 @@
   bool HasMore = Index.refs(RQuest, [&](const Ref &R) {
 if (AffectedFiles.size() > MaxLimitFiles)
   return;
+if (!static_cast(R.Kind & RefKind::Spelled))
+  return;
 if (auto RefFilePath = filePath(R.Location, /*HintFilePath=*/MainFile)) {
   if (*RefFilePath != MainFile)
 AffectedFiles[*RefFilePath].push_back(toRange(R.Location));
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74070: [Clang] Don't let gen crash diagnostics fail when '#pragma clang __debug crash' is used

2020-02-06 Thread Hans Wennborg via Phabricator via cfe-commits
hans accepted this revision.
hans added inline comments.
This revision is now accepted and ready to land.



Comment at: clang/lib/Lex/Pragma.cpp:1108
-  DebugOverflowStack();
-} else if (II->isStr("handle_crash")) {
-  llvm::CrashRecoveryContext *CRC 
=llvm::CrashRecoveryContext::GetCurrent();

Maybe also add to the description that you're removing this one. And does this 
mean we can drop the CrashRecoveryContext.h include?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74070/new/

https://reviews.llvm.org/D74070



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


[PATCH] D72932: [ARM] Follow AACPS standard for volatile bit-fields access width

2020-02-06 Thread Diogo N. Sampaio via Phabricator via cfe-commits
dnsampaio planned changes to this revision.
dnsampaio added a comment.

Updated wrong patch here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72932/new/

https://reviews.llvm.org/D72932



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


[PATCH] D73675: Avoid many std::tie/tuple instantiations in ASTImporter

2020-02-06 Thread Raphael Isemann via Phabricator via cfe-commits
teemperor added a comment.

I ran the patch on macOS and Linux through check-lldb and there were no 
regressions, so this is LGTM. The libc++ failures should go away when you add 
`libcxx;libcxxabi` to LLVM_ENABLE_PROJECTS (the tests are using libc++).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73675/new/

https://reviews.llvm.org/D73675



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


[clang-tools-extra] 10540e4 - [clangd] Filter out implicit references while renaming

2020-02-06 Thread Kirill Bobyrev via cfe-commits

Author: Kirill Bobyrev
Date: 2020-02-06T11:28:23+01:00
New Revision: 10540e480dfb243d992ff77db14219f696cc774a

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

LOG: [clangd] Filter out implicit references while renaming

This patch is based on D72746 and prevents non-spelled references from
being renamed which would cause incorrect behavior otherwise.

Reviewed by: hokein

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

Added: 


Modified: 
clang-tools-extra/clangd/refactor/Rename.cpp
clang-tools-extra/clangd/unittests/RenameTests.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/refactor/Rename.cpp 
b/clang-tools-extra/clangd/refactor/Rename.cpp
index 83f3a02d80d7..31fabc787625 100644
--- a/clang-tools-extra/clangd/refactor/Rename.cpp
+++ b/clang-tools-extra/clangd/refactor/Rename.cpp
@@ -306,6 +306,8 @@ findOccurrencesOutsideFile(const NamedDecl &RenameDecl,
   bool HasMore = Index.refs(RQuest, [&](const Ref &R) {
 if (AffectedFiles.size() > MaxLimitFiles)
   return;
+if ((R.Kind & RefKind::Spelled) == RefKind::Unknown)
+  return;
 if (auto RefFilePath = filePath(R.Location, /*HintFilePath=*/MainFile)) {
   if (*RefFilePath != MainFile)
 AffectedFiles[*RefFilePath].push_back(toRange(R.Location));

diff  --git a/clang-tools-extra/clangd/unittests/RenameTests.cpp 
b/clang-tools-extra/clangd/unittests/RenameTests.cpp
index 94f78ac0d977..43e6c778a7ad 100644
--- a/clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ b/clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -33,7 +33,7 @@ using testing::UnorderedElementsAreArray;
 // Convert a Range to a Ref.
 Ref refWithRange(const clangd::Range &Range, const std::string &URI) {
   Ref Result;
-  Result.Kind = RefKind::Reference;
+  Result.Kind = RefKind::Reference | RefKind::Spelled;
   Result.Location.Start.setLine(Range.start.line);
   Result.Location.Start.setColumn(Range.start.character);
   Result.Location.End.setLine(Range.end.line);
@@ -440,6 +440,23 @@ TEST(RenameTest, WithinFileRename) {
 template  class Z> struct Bar { };
 template <> struct Bar<[[Foo]]> {};
   )cpp",
+
+  {
+  // Implicit references in macro expansions.
+  R"cpp(
+class [[Fo^o]] {};
+#define FooFoo Foo
+#define FOO Foo
+  )cpp",
+  R"cpp(
+#include "foo.h"
+void bar() {
+  [[Foo]] x;
+  FOO y;
+  FooFoo z;
+}
+  )cpp",
+  },
   };
   for (llvm::StringRef T : Tests) {
 SCOPED_TRACE(T);



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


[PATCH] D74112: [clangd] Filter out implicit references while renaming

2020-02-06 Thread Kirill Bobyrev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG10540e480dfb: [clangd] Filter out implicit references while 
renaming (authored by kbobyrev).

Changed prior to commit:
  https://reviews.llvm.org/D74112?vs=242822&id=242844#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74112/new/

https://reviews.llvm.org/D74112

Files:
  clang-tools-extra/clangd/refactor/Rename.cpp
  clang-tools-extra/clangd/unittests/RenameTests.cpp


Index: clang-tools-extra/clangd/unittests/RenameTests.cpp
===
--- clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -33,7 +33,7 @@
 // Convert a Range to a Ref.
 Ref refWithRange(const clangd::Range &Range, const std::string &URI) {
   Ref Result;
-  Result.Kind = RefKind::Reference;
+  Result.Kind = RefKind::Reference | RefKind::Spelled;
   Result.Location.Start.setLine(Range.start.line);
   Result.Location.Start.setColumn(Range.start.character);
   Result.Location.End.setLine(Range.end.line);
@@ -440,6 +440,23 @@
 template  class Z> struct Bar { };
 template <> struct Bar<[[Foo]]> {};
   )cpp",
+
+  {
+  // Implicit references in macro expansions.
+  R"cpp(
+class [[Fo^o]] {};
+#define FooFoo Foo
+#define FOO Foo
+  )cpp",
+  R"cpp(
+#include "foo.h"
+void bar() {
+  [[Foo]] x;
+  FOO y;
+  FooFoo z;
+}
+  )cpp",
+  },
   };
   for (llvm::StringRef T : Tests) {
 SCOPED_TRACE(T);
Index: clang-tools-extra/clangd/refactor/Rename.cpp
===
--- clang-tools-extra/clangd/refactor/Rename.cpp
+++ clang-tools-extra/clangd/refactor/Rename.cpp
@@ -306,6 +306,8 @@
   bool HasMore = Index.refs(RQuest, [&](const Ref &R) {
 if (AffectedFiles.size() > MaxLimitFiles)
   return;
+if ((R.Kind & RefKind::Spelled) == RefKind::Unknown)
+  return;
 if (auto RefFilePath = filePath(R.Location, /*HintFilePath=*/MainFile)) {
   if (*RefFilePath != MainFile)
 AffectedFiles[*RefFilePath].push_back(toRange(R.Location));


Index: clang-tools-extra/clangd/unittests/RenameTests.cpp
===
--- clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -33,7 +33,7 @@
 // Convert a Range to a Ref.
 Ref refWithRange(const clangd::Range &Range, const std::string &URI) {
   Ref Result;
-  Result.Kind = RefKind::Reference;
+  Result.Kind = RefKind::Reference | RefKind::Spelled;
   Result.Location.Start.setLine(Range.start.line);
   Result.Location.Start.setColumn(Range.start.character);
   Result.Location.End.setLine(Range.end.line);
@@ -440,6 +440,23 @@
 template  class Z> struct Bar { };
 template <> struct Bar<[[Foo]]> {};
   )cpp",
+
+  {
+  // Implicit references in macro expansions.
+  R"cpp(
+class [[Fo^o]] {};
+#define FooFoo Foo
+#define FOO Foo
+  )cpp",
+  R"cpp(
+#include "foo.h"
+void bar() {
+  [[Foo]] x;
+  FOO y;
+  FooFoo z;
+}
+  )cpp",
+  },
   };
   for (llvm::StringRef T : Tests) {
 SCOPED_TRACE(T);
Index: clang-tools-extra/clangd/refactor/Rename.cpp
===
--- clang-tools-extra/clangd/refactor/Rename.cpp
+++ clang-tools-extra/clangd/refactor/Rename.cpp
@@ -306,6 +306,8 @@
   bool HasMore = Index.refs(RQuest, [&](const Ref &R) {
 if (AffectedFiles.size() > MaxLimitFiles)
   return;
+if ((R.Kind & RefKind::Spelled) == RefKind::Unknown)
+  return;
 if (auto RefFilePath = filePath(R.Location, /*HintFilePath=*/MainFile)) {
   if (*RefFilePath != MainFile)
 AffectedFiles[*RefFilePath].push_back(toRange(R.Location));
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] d5e6e0a - Fix build after D74112

2020-02-06 Thread Kirill Bobyrev via cfe-commits

Author: Kirill Bobyrev
Date: 2020-02-06T11:41:17+01:00
New Revision: d5e6e0a58b188627084d4714a4b2862c529870f8

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

LOG: Fix build after D74112

Added: 


Modified: 
clang-tools-extra/clangd/unittests/RenameTests.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/unittests/RenameTests.cpp 
b/clang-tools-extra/clangd/unittests/RenameTests.cpp
index 43e6c778a7ad..2aaf45eb7563 100644
--- a/clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ b/clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -440,23 +440,6 @@ TEST(RenameTest, WithinFileRename) {
 template  class Z> struct Bar { };
 template <> struct Bar<[[Foo]]> {};
   )cpp",
-
-  {
-  // Implicit references in macro expansions.
-  R"cpp(
-class [[Fo^o]] {};
-#define FooFoo Foo
-#define FOO Foo
-  )cpp",
-  R"cpp(
-#include "foo.h"
-void bar() {
-  [[Foo]] x;
-  FOO y;
-  FooFoo z;
-}
-  )cpp",
-  },
   };
   for (llvm::StringRef T : Tests) {
 SCOPED_TRACE(T);
@@ -909,6 +892,22 @@ TEST(CrossFileRenameTests, WithUpToDateIndex) {
 }
   )cpp",
   },
+  {
+  // Implicit references in macro expansions.
+  R"cpp(
+class [[Fo^o]] {};
+#define FooFoo Foo
+#define FOO Foo
+  )cpp",
+  R"cpp(
+#include "foo.h"
+void bar() {
+  [[Foo]] x;
+  FOO y;
+  FooFoo z;
+}
+  )cpp",
+  },
   };
 
   for (const auto& T : Cases) {



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


[PATCH] D72857: [SYCL] Driver option to enable SYCL mode and select SYCL version

2020-02-06 Thread Alexey Bader via Phabricator via cfe-commits
bader updated this revision to Diff 242845.
bader added a comment.

Applied suggestions from Alexey and Ruyman and rebased on ToT.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72857/new/

https://reviews.llvm.org/D72857

Files:
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Basic/LangOptions.h
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Frontend/InitPreprocessor.cpp
  clang/test/Preprocessor/sycl-macro.cpp

Index: clang/test/Preprocessor/sycl-macro.cpp
===
--- clang/test/Preprocessor/sycl-macro.cpp
+++ clang/test/Preprocessor/sycl-macro.cpp
@@ -1,5 +1,9 @@
 // RUN: %clang_cc1 %s -E -dM | FileCheck %s
-// RUN: %clang_cc1 %s -fsycl-is-device -E -dM | FileCheck --check-prefix=CHECK-SYCL %s
+// RUN: %clang_cc1 %s -sycl-std=2015 -E -dM | FileCheck --check-prefix=CHECK-SYCL-STD %s
+// RUN: %clang_cc1 %s -sycl-std=1.2.1 -E -dM | FileCheck --check-prefix=CHECK-SYCL-STD %s
+// RUN: %clang_cc1 %s -fsycl-is-device -E -dM | FileCheck --check-prefixes=CHECK-SYCL,CHECK-SYCL-STD %s
 
 // CHECK-NOT:#define __SYCL_DEVICE_ONLY__ 1
+// CHECK-NOT:#define CL_SYCL_LANGUAGE_VERSION 121
+// CHECK-SYCL-STD:#define CL_SYCL_LANGUAGE_VERSION 121
 // CHECK-SYCL:#define __SYCL_DEVICE_ONLY__ 1
Index: clang/lib/Frontend/InitPreprocessor.cpp
===
--- clang/lib/Frontend/InitPreprocessor.cpp
+++ clang/lib/Frontend/InitPreprocessor.cpp
@@ -450,6 +450,16 @@
 if (LangOpts.FastRelaxedMath)
   Builder.defineMacro("__FAST_RELAXED_MATH__");
   }
+
+  // SYCL Version is set to a value when building SYCL applications
+  switch (LangOpts.getSYCLVersion()) {
+  case LangOptions::SYCLVersionList::SYCL_2015:
+Builder.defineMacro("CL_SYCL_LANGUAGE_VERSION", "121");
+break;
+  case LangOptions::SYCLVersionList::undefined:
+break;
+  }
+
   // Not "standard" per se, but available even with the -undef flag.
   if (LangOpts.AsmPreprocessor)
 Builder.defineMacro("__ASSEMBLER__");
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -2544,6 +2544,25 @@
   LangStd = OpenCLLangStd;
   }
 
+  // -sycl-std applies to any SYCL source, not only those containing kernels,
+  // but also those using the SYCL API
+  if (const Arg *A = Args.getLastArg(OPT_sycl_std_EQ)) {
+Opts.setSYCLVersion(
+llvm::StringSwitch(A->getValue())
+.Cases("2015", "1.2.1", "121", "sycl-1.2.1",
+   LangOptions::SYCLVersionList::SYCL_2015)
+.Default(LangOptions::SYCLVersionList::undefined));
+
+if (Opts.getSYCLVersion() == LangOptions::SYCLVersionList::undefined) {
+  // User has passed an invalid value to the flag, this is an error
+  Diags.Report(diag::err_drv_invalid_value)
+  << A->getAsString(Args) << A->getValue();
+}
+  } else if (Args.hasArg(options::OPT_fsycl_is_device) ||
+ Args.hasArg(options::OPT_fsycl)) {
+Opts.setSYCLVersion(LangOptions::SYCLVersionList::SYCL_2015);
+  }
+
   Opts.IncludeDefaultHeader = Args.hasArg(OPT_finclude_default_header);
   Opts.DeclareOpenCLBuiltins = Args.hasArg(OPT_fdeclare_opencl_builtins);
 
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -4023,9 +4023,17 @@
 CmdArgs.push_back(Args.MakeArgString(NormalizedTriple));
   }
 
-  if (Args.hasFlag(options::OPT_fsycl, options::OPT_fno_sycl, false))
+  bool IsSYCL = Args.hasFlag(options::OPT_fsycl, options::OPT_fno_sycl, false);
+  if (IsSYCL)
 CmdArgs.push_back("-fsycl-is-device");
 
+  if (Arg *A = Args.getLastArg(options::OPT_sycl_std_EQ)) {
+A->render(Args, CmdArgs);
+  } else if (IsSYCL) {
+// Ensure the default version in SYCL mode is 1.2.1 (aka 2015)
+CmdArgs.push_back("-sycl-std=2015");
+  }
+
   if (IsOpenMPDevice) {
 // We have to pass the triple of the host if compiling for an OpenMP device.
 std::string NormalizedTriple =
@@ -5293,6 +5301,9 @@
options::OPT_fno_hip_new_launch_api, false))
 CmdArgs.push_back("-fhip-new-launch-api");
 
+  // Forward -sycl-std option to -cc1
+  Args.AddLastArg(CmdArgs, options::OPT_sycl_std_EQ);
+
   if (Arg *A = Args.getLastArg(options::OPT_fcf_protection_EQ)) {
 CmdArgs.push_back(
 Args.MakeArgString(Twine("-fcf-protection=") + A->getValue()));
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -3415,6 +3415,8 @@
   HelpText<"Enable SYCL kernels compila

[PATCH] D74063: [Clang] Remove #pragma clang __debug handle_crash

2020-02-06 Thread Hans Wennborg via Phabricator via cfe-commits
hans accepted this revision.
hans added inline comments.
This revision is now accepted and ready to land.



Comment at: clang/lib/Lex/Pragma.cpp:42
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/CrashRecoveryContext.h"
 #include "llvm/Support/Compiler.h"

I think this can be removed now.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74063/new/

https://reviews.llvm.org/D74063



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


[PATCH] D74070: [Clang] Don't let gen crash diagnostics fail when '#pragma clang __debug crash' is used

2020-02-06 Thread Hans Wennborg via Phabricator via cfe-commits
hans added inline comments.



Comment at: clang/lib/Lex/Pragma.cpp:1108
-  DebugOverflowStack();
-} else if (II->isStr("handle_crash")) {
-  llvm::CrashRecoveryContext *CRC 
=llvm::CrashRecoveryContext::GetCurrent();

hans wrote:
> Maybe also add to the description that you're removing this one. And does 
> this mean we can drop the CrashRecoveryContext.h include?
Oh, I see, that's in D74063.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74070/new/

https://reviews.llvm.org/D74070



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


[PATCH] D72857: [SYCL] Driver option to enable SYCL mode and select SYCL version

2020-02-06 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

{icon question-circle color=gray} Unit tests: unknown.

{icon check-circle color=green} clang-tidy: pass.

{icon times-circle color=red} clang-format: fail. Please format your changes 
with clang-format by running `git-clang-format HEAD^` or applying this patch 
.

Build artifacts 
: 
clang-tidy.txt 
,
 clang-format.patch 
,
 CMakeCache.txt 
,
 console-log.txt 


//Pre-merge checks is in beta. Report issue 
.
 Please join beta  or enable 
it for your project 
.//


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72857/new/

https://reviews.llvm.org/D72857



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


[PATCH] D74116: [Sema][C++] Strawman patch to propagate conversion type in order to specialize the diagnostics

2020-02-06 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia created this revision.
Anastasia added a reviewer: rjmccall.
Herald added a subscriber: ebevhan.
Anastasia edited the summary of this revision.

Currently in C++ we don't set/propagate what type of implicit conversions 
occurs on assignments/initializations/params/etc. Therefore the diagnostic 
provided is more generic than in C mode. This patch attempt to propagate the 
conversion kind through layers of C++ semantic checks. It is currently only 
used for address spaces conversion of nested pointers (from 
https://reviews.llvm.org/D73360). Setting this for other conversions would be 
quite a lot of work and I am not sure I feel confident to get it right. We 
could potentially gradually modify it as we go along. Although this is not an 
actively modified code base at the moment so not sure whether it will happen 
and when.

Feedback welcome!


https://reviews.llvm.org/D74116

Files:
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaExceptionSpec.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaInit.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/lib/Sema/SemaTemplate.cpp
  clang/lib/Sema/SemaTemplateDeduction.cpp
  clang/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl

Index: clang/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl
===
--- clang/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl
+++ clang/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl
@@ -515,11 +515,7 @@
   // Case 3: Corresponded inner pointees has overlapping but not equivalent address spaces.
   var_as_as_int = var_asc_asc_int;
 #ifdef GENERIC
-#if !__OPENCL_CPP_VERSION__
-// expected-error@-3 {{assigning '__local int *__local *__private' to '__generic int *__generic *__private' changes address space of nested pointer}}
-#else
-// expected-error@-5 {{assigning to '__generic int *__generic *' from incompatible type '__local int *__local *__private'}}
-#endif
+// expected-error-re@-2{{assigning '__local int *__local *__private' to '__generic int *__generic {{\*|\*__private}}' changes address space of nested pointer}}
 #endif
 
   var_as_as_int = (AS int *AS *)var_asc_asc_int;
Index: clang/lib/Sema/SemaTemplateDeduction.cpp
===
--- clang/lib/Sema/SemaTemplateDeduction.cpp
+++ clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -3286,9 +3286,10 @@
   // function types (recursively).
   bool ObjCLifetimeConversion = false;
   QualType ResultTy;
+  Sema::AssignConvertType ConvType = Sema::Compatible;
   if ((A->isAnyPointerType() || A->isMemberPointerType()) &&
   (S.IsQualificationConversion(A, DeducedA, false,
-   ObjCLifetimeConversion) ||
+   ObjCLifetimeConversion, ConvType) ||
S.IsFunctionConversion(A, DeducedA, ResultTy)))
 return Sema::TDK_Success;
 
Index: clang/lib/Sema/SemaTemplate.cpp
===
--- clang/lib/Sema/SemaTemplate.cpp
+++ clang/lib/Sema/SemaTemplate.cpp
@@ -5847,9 +5847,10 @@
!EvalResult.Val.getMemberPointerDecl())) {
 // If our expression has an appropriate type, we've succeeded.
 bool ObjCLifetimeConversion;
+Sema::AssignConvertType ConvType = Sema::Compatible;
 if (S.Context.hasSameUnqualifiedType(Arg->getType(), ParamType) ||
 S.IsQualificationConversion(Arg->getType(), ParamType, false,
- ObjCLifetimeConversion))
+ ObjCLifetimeConversion, ConvType))
   return NPV_NullPointer;
 
 // The types didn't match, but we know we got a null pointer; complain,
@@ -5884,10 +5885,11 @@
 Sema &S, NonTypeTemplateParmDecl *Param, QualType ParamType, Expr *ArgIn,
 Expr *Arg, QualType ArgType) {
   bool ObjCLifetimeConversion;
+  Sema::AssignConvertType ConvType = Sema::Compatible;
   if (ParamType->isPointerType() &&
   !ParamType->castAs()->getPointeeType()->isFunctionType() &&
   S.IsQualificationConversion(ArgType, ParamType, false,
-  ObjCLifetimeConversion)) {
+  ObjCLifetimeConversion, ConvType)) {
 // For pointer-to-object types, qualification conversions are
 // permitted.
   } else {
@@ -6303,10 +6305,10 @@
   case NPV_NotNullPointer:
 break;
   }
-
+  Sema::AssignConvertType ConvType = Sema::Compatible;
   if (S.IsQualificationConversion(ResultArg->getType(),
   ParamType.getNonReferenceType(), false,
-  ObjCLifetimeConversion)) {
+  ObjCLifetimeConversion, ConvType)) {
 ResultArg = S.ImpCastExprToType(ResultArg, ParamType, CK_NoOp,
 ResultArg->getValueKind())
 .get();
Index: clang/lib/Sema/SemaOverload.cpp
==

[PATCH] D74054: [clangd] Include the underlying decls in go-to-definition.

2020-02-06 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 242855.
hokein added a comment.

no regression on non-definition of renaming alias.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74054/new/

https://reviews.llvm.org/D74054

Files:
  clang-tools-extra/clangd/XRefs.cpp
  clang-tools-extra/clangd/unittests/XRefsTests.cpp

Index: clang-tools-extra/clangd/unittests/XRefsTests.cpp
===
--- clang-tools-extra/clangd/unittests/XRefsTests.cpp
+++ clang-tools-extra/clangd/unittests/XRefsTests.cpp
@@ -45,6 +45,11 @@
 MATCHER_P2(FileRange, File, Range, "") {
   return Location{URIForFile::canonicalize(File, testRoot()), Range} == arg;
 }
+MATCHER(DeclRange, "") {
+  const LocatedSymbol &Sym = ::testing::get<0>(arg);
+  const Range &Range = ::testing::get<1>(arg);
+  return Sym.PreferredDeclaration.range == Range;
+}
 
 // Extracts ranges from an annotated example, and constructs a matcher for a
 // highlight set. Ranges should be named $read/$write as appropriate.
@@ -660,17 +665,72 @@
Sym("baz", T.range("StaticOverload2";
 }
 
-TEST(LocateSymbol, TemplateTypedefs) {
-  auto T = Annotations(R"cpp(
-template  struct function {};
-template  using callback = function;
+TEST(LocateSymbol, Alias) {
+  const char *Tests[] = {
+R"cpp(
+  template  struct function {};
+  template  using [[callback]] = function;
 
-c^allback foo;
-  )cpp");
-  auto AST = TestTU::withCode(T.code()).build();
-  EXPECT_THAT(locateSymbolAt(AST, T.point()), ElementsAre(Sym("callback")));
+  c^allback foo;
+)cpp",
+
+// triggered on non-definition of a renaming alias: should not give any
+// underlying decls.
+R"cpp(
+  class Foo {};
+  typedef Foo [[Bar]];
+
+  B^ar b;
+)cpp",
+R"cpp(
+  class Foo {};
+  using [[Bar]] = Foo; // definition
+  Ba^r b;
+)cpp",
+
+// triggered on definition of a non-renaming alias: should give underlying
+// decls.
+R"cpp(
+  namespace ns { class [[Foo]] {}; }
+  using ns::[[F^oo]];
+)cpp",
+
+// other cases that don't matter much.
+R"cpp(
+  class Foo {};
+  typedef Foo [[Ba^r]];
+)cpp",
+R"cpp(
+  class Foo {};
+  using [[B^ar]] = Foo;
+)cpp",
+R"cpp(
+  namespace ns { class [[Foo]] {}; }
+  using ns::Foo;
+  F^oo f;
+)cpp",
+  };
+
+  for (const auto* Case : Tests) {
+SCOPED_TRACE(Case);
+auto T = Annotations(Case);
+auto AST = TestTU::withCode(T.code()).build();
+EXPECT_THAT(locateSymbolAt(AST, T.point()),
+::testing::UnorderedPointwise(DeclRange(), T.ranges()));
+  }
 }
 
+// TEST(LocateSymbol, TemplateTypedefs) {
+//   auto T = Annotations(R"cpp(
+// template  struct function {};
+// template  using callback = function;
+
+// c^allback foo;
+//   )cpp");
+//   auto AST = TestTU::withCode(T.code()).build();
+//   EXPECT_THAT(locateSymbolAt(AST, T.point()), ElementsAre(Sym("callback")));
+// }
+
 TEST(LocateSymbol, RelPathsInCompileCommand) {
   // The source is in "/clangd-test/src".
   // We build in "/clangd-test/build".
Index: clang-tools-extra/clangd/XRefs.cpp
===
--- clang-tools-extra/clangd/XRefs.cpp
+++ clang-tools-extra/clangd/XRefs.cpp
@@ -21,6 +21,7 @@
 #include "index/Relation.h"
 #include "index/SymbolLocation.h"
 #include "clang/AST/ASTContext.h"
+#include "clang/AST/ASTTypeTraits.h"
 #include "clang/AST/Attr.h"
 #include "clang/AST/Attrs.inc"
 #include "clang/AST/Decl.h"
@@ -301,6 +302,14 @@
   }
 }
 
+// Give the underlying decla if navigation is triggered on a non-renaming
+// alias.
+if (llvm::isa(D)) {
+  llvm::for_each(targetDecl(ast_type_traits::DynTypedNode::create(*D),
+DeclRelation::Underlying),
+ [&](const NamedDecl *UD) { AddResultDecl(UD); });
+}
+
 // Otherwise the target declaration is the right one.
 AddResultDecl(D);
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73360: [OpenCL] Restrict address space conversions in nested pointers

2020-02-06 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment.

In D73360#1857073 , @rjmccall wrote:

> Okay, we can go with this for now, since it does fix a bug.


Thanks! Btw I uploaded straw-man patch for improving the diagnostics: 
https://reviews.llvm.org/D74116.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73360/new/

https://reviews.llvm.org/D73360



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


[PATCH] D74054: [clangd] Include the underlying decls in go-to-definition.

2020-02-06 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 242856.
hokein added a comment.

remove an accident change.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74054/new/

https://reviews.llvm.org/D74054

Files:
  clang-tools-extra/clangd/XRefs.cpp
  clang-tools-extra/clangd/unittests/XRefsTests.cpp

Index: clang-tools-extra/clangd/unittests/XRefsTests.cpp
===
--- clang-tools-extra/clangd/unittests/XRefsTests.cpp
+++ clang-tools-extra/clangd/unittests/XRefsTests.cpp
@@ -45,6 +45,11 @@
 MATCHER_P2(FileRange, File, Range, "") {
   return Location{URIForFile::canonicalize(File, testRoot()), Range} == arg;
 }
+MATCHER(DeclRange, "") {
+  const LocatedSymbol &Sym = ::testing::get<0>(arg);
+  const Range &Range = ::testing::get<1>(arg);
+  return Sym.PreferredDeclaration.range == Range;
+}
 
 // Extracts ranges from an annotated example, and constructs a matcher for a
 // highlight set. Ranges should be named $read/$write as appropriate.
@@ -660,15 +665,59 @@
Sym("baz", T.range("StaticOverload2";
 }
 
-TEST(LocateSymbol, TemplateTypedefs) {
-  auto T = Annotations(R"cpp(
-template  struct function {};
-template  using callback = function;
+TEST(LocateSymbol, Alias) {
+  const char *Tests[] = {
+R"cpp(
+  template  struct function {};
+  template  using [[callback]] = function;
 
-c^allback foo;
-  )cpp");
-  auto AST = TestTU::withCode(T.code()).build();
-  EXPECT_THAT(locateSymbolAt(AST, T.point()), ElementsAre(Sym("callback")));
+  c^allback foo;
+)cpp",
+
+// triggered on non-definition of a renaming alias: should not give any
+// underlying decls.
+R"cpp(
+  class Foo {};
+  typedef Foo [[Bar]];
+
+  B^ar b;
+)cpp",
+R"cpp(
+  class Foo {};
+  using [[Bar]] = Foo; // definition
+  Ba^r b;
+)cpp",
+
+// triggered on definition of a non-renaming alias: should give underlying
+// decls.
+R"cpp(
+  namespace ns { class [[Foo]] {}; }
+  using ns::[[F^oo]];
+)cpp",
+
+// other cases that don't matter much.
+R"cpp(
+  class Foo {};
+  typedef Foo [[Ba^r]];
+)cpp",
+R"cpp(
+  class Foo {};
+  using [[B^ar]] = Foo;
+)cpp",
+R"cpp(
+  namespace ns { class [[Foo]] {}; }
+  using ns::Foo;
+  F^oo f;
+)cpp",
+  };
+
+  for (const auto* Case : Tests) {
+SCOPED_TRACE(Case);
+auto T = Annotations(Case);
+auto AST = TestTU::withCode(T.code()).build();
+EXPECT_THAT(locateSymbolAt(AST, T.point()),
+::testing::UnorderedPointwise(DeclRange(), T.ranges()));
+  }
 }
 
 TEST(LocateSymbol, RelPathsInCompileCommand) {
Index: clang-tools-extra/clangd/XRefs.cpp
===
--- clang-tools-extra/clangd/XRefs.cpp
+++ clang-tools-extra/clangd/XRefs.cpp
@@ -21,6 +21,7 @@
 #include "index/Relation.h"
 #include "index/SymbolLocation.h"
 #include "clang/AST/ASTContext.h"
+#include "clang/AST/ASTTypeTraits.h"
 #include "clang/AST/Attr.h"
 #include "clang/AST/Attrs.inc"
 #include "clang/AST/Decl.h"
@@ -301,6 +302,14 @@
   }
 }
 
+// Give the underlying decla if navigation is triggered on a non-renaming
+// alias.
+if (llvm::isa(D)) {
+  llvm::for_each(targetDecl(ast_type_traits::DynTypedNode::create(*D),
+DeclRelation::Underlying),
+ [&](const NamedDecl *UD) { AddResultDecl(UD); });
+}
+
 // Otherwise the target declaration is the right one.
 AddResultDecl(D);
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74087: [Sema] Fix Sema checkArgCount function

2020-02-06 Thread Yi-Hong Lyu via Phabricator via cfe-commits
Yi-Hong.Lyu requested changes to this revision.
Yi-Hong.Lyu added a comment.
This revision now requires changes to proceed.

Please add tests


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74087/new/

https://reviews.llvm.org/D74087



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


[PATCH] D74117: [AArch64][SVE] SVE2 intrinsics for character match & histogram generation

2020-02-06 Thread Kerry McLaughlin via Phabricator via cfe-commits
kmclaughlin created this revision.
kmclaughlin added reviewers: c-rhodes, sdesmalen, dancgr, efriedma.
Herald added subscribers: psnobl, rkruppe, hiraditya, kristof.beyls, tschuett.
Herald added a reviewer: rengolin.
Herald added a project: LLVM.

Implements the following intrinsics:

- @llvm.aarch64.sve.histcnt
- @llvm.aarch64.sve.histseg
- @llvm.aarch64.sve.match
- @llvm.aarch64.sve.nmatch


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74117

Files:
  llvm/include/llvm/IR/IntrinsicsAArch64.td
  llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
  llvm/lib/Target/AArch64/SVEInstrFormats.td
  llvm/test/CodeGen/AArch64/sve2-intrinsics-character-match.ll
  llvm/test/CodeGen/AArch64/sve2-intrinsics-vec-hist-count.ll

Index: llvm/test/CodeGen/AArch64/sve2-intrinsics-vec-hist-count.ll
===
--- /dev/null
+++ llvm/test/CodeGen/AArch64/sve2-intrinsics-vec-hist-count.ll
@@ -0,0 +1,42 @@
+; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve2 -asm-verbose=0 < %s | FileCheck %s
+
+;
+; HISTCNT
+;
+
+define  @histcnt_i32( %pg,  %a,  %b) {
+; CHECK-LABEL: histcnt_i32:
+; CHECK: histcnt z0.s, p0/z, z0.s, z1.s
+; CHECK-NEXT: ret
+  %out = call  @llvm.aarch64.sve.histcnt.nxv4i32( %pg,
+%a,
+%b)
+  ret  %out
+}
+
+define  @histcnt_i64( %pg,  %a,  %b) {
+; CHECK-LABEL: histcnt_i64:
+; CHECK: histcnt z0.d, p0/z, z0.d, z1.d
+; CHECK-NEXT: ret
+  %out = call  @llvm.aarch64.sve.histcnt.nxv2i64( %pg,
+%a,
+%b)
+  ret  %out
+}
+
+;
+; HISTSEG
+;
+
+define  @histseg( %a,  %b) {
+; CHECK-LABEL: histseg:
+; CHECK: histseg z0.b, z0.b, z1.b
+; CHECK-NEXT: ret
+  %out = call  @llvm.aarch64.sve.histseg.nxv16i8( %a,
+%b)
+  ret  %out
+}
+
+declare  @llvm.aarch64.sve.histcnt.nxv4i32(, , )
+declare  @llvm.aarch64.sve.histcnt.nxv2i64(, , )
+declare  @llvm.aarch64.sve.histseg.nxv16i8(, )
Index: llvm/test/CodeGen/AArch64/sve2-intrinsics-character-match.ll
===
--- /dev/null
+++ llvm/test/CodeGen/AArch64/sve2-intrinsics-character-match.ll
@@ -0,0 +1,54 @@
+; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve2 -asm-verbose=0 < %s | FileCheck %s
+
+;
+; MATCH
+;
+
+define  @match_i8( %pg,  %a,  %b) {
+; CHECK-LABEL: match_i8:
+; CHECK: match p0.b, p0/z, z0.b, z1.b
+; CHECK-NEXT: ret
+  %out = call  @llvm.aarch64.sve.match.nxv16i8( %pg,
+  %a,
+  %b)
+  ret  %out
+}
+
+define  @match_i16( %pg,  %a,  %b) {
+; CHECK-LABEL: match_i16:
+; CHECK: match p0.h, p0/z, z0.h, z1.h
+; CHECK-NEXT: ret
+  %out = call  @llvm.aarch64.sve.match.nxv8i16( %pg,
+ %a,
+ %b)
+  ret  %out
+}
+
+;
+; NMATCH
+;
+
+define  @nmatch_i8( %pg,  %a,  %b) {
+; CHECK-LABEL: nmatch_i8:
+; CHECK: match p0.b, p0/z, z0.b, z1.b
+; CHECK-NEXT: ret
+  %out = call  @llvm.aarch64.sve.nmatch.nxv16i8( %pg,
+   %a,
+   %b)
+  ret  %out
+}
+
+define  @nmatch_i16( %pg,  %a,  %b) {
+; CHECK-LABEL: nmatch_i16:
+; CHECK: match p0.h, p0/z, z0.h, z1.h
+; CHECK-NEXT: ret
+  %out = call  @llvm.aarch64.sve.nmatch.nxv8i16( %pg,
+  %a,
+  %b)
+  ret  %out
+}
+
+declare  @llvm.aarch64.sve.match.nxv16i8(, , )
+declare  @llvm.aarch64.sve.match.nxv8i16(, , )
+declare  @llvm.aarch64.sve.nmatch.nxv16i8(, , )
+declare  @llvm.aarch64.sve.nmatch.nxv8i16(, , )
Index: llvm/lib/Target/AArch64/SVEInstrFormats.td
===
--- llvm/lib/Target/AArch64/SVEInstrFormats.td
+++ llvm/lib/Target/AArch64/SVEInstrFormats.td
@@ -6818,20 +6818,23 @@
   let Defs = [NZCV];
 }
 
-multiclass sve2_char_match {
+multiclass sve2_char_match {
   def _B : sve2_char_match<0b0, opc, asm, PPR8, ZPR8>;
   def _H : sve2_char_match<0b1, opc, asm, PPR16, ZPR16>;
+
+  def : SVE_3_Op_Pat(NAME # _B)>;
+  def : SVE_3_Op_Pat(NAME # _H)>;
 }
 
 //===--===//
 // SVE2 Histogram Computation - Segment Group
 //===--===//
 
-class sve2_hist_gen_segment
+class sve2_hist_gen_segment
 : I<(outs ZPR8:$Zd), (ins ZPR8:$Zn, ZPR8:$Zm),
   asm, "\t$Zd, $Zn, $Zm",
   "",
-  []>, Sched<[]> {
+  [(set nxv16

[PATCH] D73966: [analyzer] Add 10.0.0 release notes.

2020-02-06 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus marked 3 inline comments as done.
Szelethus added inline comments.



Comment at: clang/docs/ReleaseNotes.rst:405
 
+- New checker: ``fuchsia.HandleChecker`` to detect leaks related to Fuchsia
+  handles.

xazax.hun wrote:
> NoQ wrote:
> > D74004
> > 
> > 1) The checker is now in alpha.
> > 2) This checker wasn't enabled in the release either, as far as i 
> > understand.
> It was! This is about the HandleChecker the other is about the LockChecker.
Yup, this seems to be correct in the release notes.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73966/new/

https://reviews.llvm.org/D73966



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


[PATCH] D73966: [analyzer] Add 10.0.0 release notes.

2020-02-06 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus updated this revision to Diff 242860.
Szelethus marked an inline comment as done.
Szelethus added a comment.

//Actually// update the revision.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73966/new/

https://reviews.llvm.org/D73966

Files:
  clang/docs/ReleaseNotes.rst


Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -402,31 +402,24 @@
 Static Analyzer
 ---
 
+- New checker: ``alpha.cplusplus.PlacementNew`` to detect whether the storage
+  provided for default placement new is sufficiently large.
+
 - New checker: ``fuchsia.HandleChecker`` to detect leaks related to Fuchsia
   handles.
 
-- New checker: ``alpha.plusplus.PlacementNew`` to detect whether the storage
-  provided for default placement new is sufficiently large.
+- New checker: ``security.insecureAPI.decodeValueOfObjCType`` warns about
+  potential buffer overflows when using ``[NSCoder decodeValueOfObjCType:at:]``
 
-- The Clang analyzer checker ``DeadStores`` gets a new option called
-  ``WarnForDeadNestedAssignments`` to detect nested dead assignments
-  (enabled by default).
+- ``deadcode.DeadStores`` now warns about nested dead stores.
 
-- Condition values that greatly affect the occurance of a bug are now far 
better
-  explained in bug reports (further reading on the related
-  `GSoC'19 summary page `_).
+- Condition values that are relevant to the occurance of a bug are far better
+  explained in bug reports.
 
-- Despite still in being in alpha stage, checkers implementing taint analyses
+- Despite still being at an alpha stage, checkers implementing taint analyses
   and C++ iterator rules were improved greatly.
 
-- Analyses on LLVM's own source code are far more precise due to the modeling 
of
-  several LLVM specific techniques, like its custom RTTI, informing the 
analyzer
-  of the return values of core functions, and much more (further reading on the
-  related `GSoC'19 summary page 
`_)
 .
-
-- ObjectiveC++ changes:
-
-- Numerous smaller false positive fixes.
+- Numerous smaller fixes.
 
 .. _release-notes-ubsan:
 


Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -402,31 +402,24 @@
 Static Analyzer
 ---
 
+- New checker: ``alpha.cplusplus.PlacementNew`` to detect whether the storage
+  provided for default placement new is sufficiently large.
+
 - New checker: ``fuchsia.HandleChecker`` to detect leaks related to Fuchsia
   handles.
 
-- New checker: ``alpha.plusplus.PlacementNew`` to detect whether the storage
-  provided for default placement new is sufficiently large.
+- New checker: ``security.insecureAPI.decodeValueOfObjCType`` warns about
+  potential buffer overflows when using ``[NSCoder decodeValueOfObjCType:at:]``
 
-- The Clang analyzer checker ``DeadStores`` gets a new option called
-  ``WarnForDeadNestedAssignments`` to detect nested dead assignments
-  (enabled by default).
+- ``deadcode.DeadStores`` now warns about nested dead stores.
 
-- Condition values that greatly affect the occurance of a bug are now far better
-  explained in bug reports (further reading on the related
-  `GSoC'19 summary page `_).
+- Condition values that are relevant to the occurance of a bug are far better
+  explained in bug reports.
 
-- Despite still in being in alpha stage, checkers implementing taint analyses
+- Despite still being at an alpha stage, checkers implementing taint analyses
   and C++ iterator rules were improved greatly.
 
-- Analyses on LLVM's own source code are far more precise due to the modeling of
-  several LLVM specific techniques, like its custom RTTI, informing the analyzer
-  of the return values of core functions, and much more (further reading on the
-  related `GSoC'19 summary page `_) .
-
-- ObjectiveC++ changes:
-
-- Numerous smaller false positive fixes.
+- Numerous smaller fixes.
 
 .. _release-notes-ubsan:
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73966: [analyzer] Add 10.0.0 release notes.

2020-02-06 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus updated this revision to Diff 242869.
Szelethus added a comment.

//Actually//, **actually** upload the correct one. Getting rusty eh.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73966/new/

https://reviews.llvm.org/D73966

Files:
  clang/docs/ReleaseNotes.rst


Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -402,10 +402,24 @@
 Static Analyzer
 ---
 
-- The Clang analyzer checker ``DeadStores`` gets a new option called
-  ``WarnForDeadNestedAssignments`` to detect nested dead assignments
-  (enabled by default).
-- ...
+- New checker: ``alpha.cplusplus.PlacementNew`` to detect whether the storage
+  provided for default placement new is sufficiently large.
+
+- New checker: ``fuchsia.HandleChecker`` to detect leaks related to Fuchsia
+  handles.
+
+- New checker: ``security.insecureAPI.decodeValueOfObjCType`` warns about
+  potential buffer overflows when using ``[NSCoder decodeValueOfObjCType:at:]``
+
+- ``deadcode.DeadStores`` now warns about nested dead stores.
+
+- Condition values that are relevant to the occurance of a bug are far better
+  explained in bug reports.
+
+- Despite still being at an alpha stage, checkers implementing taint analyses
+  and C++ iterator rules were improved greatly.
+
+- Numerous smaller fixes.
 
 .. _release-notes-ubsan:
 


Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -402,10 +402,24 @@
 Static Analyzer
 ---
 
-- The Clang analyzer checker ``DeadStores`` gets a new option called
-  ``WarnForDeadNestedAssignments`` to detect nested dead assignments
-  (enabled by default).
-- ...
+- New checker: ``alpha.cplusplus.PlacementNew`` to detect whether the storage
+  provided for default placement new is sufficiently large.
+
+- New checker: ``fuchsia.HandleChecker`` to detect leaks related to Fuchsia
+  handles.
+
+- New checker: ``security.insecureAPI.decodeValueOfObjCType`` warns about
+  potential buffer overflows when using ``[NSCoder decodeValueOfObjCType:at:]``
+
+- ``deadcode.DeadStores`` now warns about nested dead stores.
+
+- Condition values that are relevant to the occurance of a bug are far better
+  explained in bug reports.
+
+- Despite still being at an alpha stage, checkers implementing taint analyses
+  and C++ iterator rules were improved greatly.
+
+- Numerous smaller fixes.
 
 .. _release-notes-ubsan:
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74036: [clangd] don't rename on protobuf symbols.

2020-02-06 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet accepted this revision.
kadircet added inline comments.
This revision is now accepted and ready to land.



Comment at: clang-tools-extra/clangd/refactor/Rename.cpp:99
 
 bool isBlacklisted(const NamedDecl &RenameDecl) {
+  if (isProtoFile(RenameDecl.getLocation(),

nit: I would put some comments on what and why this function blacklists, as the 
name is too generic.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74036/new/

https://reviews.llvm.org/D74036



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


[clang] 09a8812 - [clang][driver][ARM] Clean up ARM target & feature checking in clang driver.

2020-02-06 Thread Michael Liao via cfe-commits

Author: Michael Liao
Date: 2020-02-06T08:57:52-05:00
New Revision: 09a88120c9269a9af0d80bc59afb2cb5806140ff

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

LOG: [clang][driver][ARM] Clean up ARM target & feature checking in clang 
driver.

Summary:
- Similar to other targets, instead of passing a toolchain, a driver
  argument should be passed into `arm::getARMTargetFeatures`. Aslo, that
  routine should honor the specified triple. Refactor
  `arm::getARMFloatABI` with 2 separate interfaces. One has the original
  parameters and the other uses the driver and the specified triple.
- That fixes an issue when target & features are queried during the
  offload compilation, where the specified triple should be checked
  instead of a effective triple. A previously failed test is re-enabled.

Subscribers: kristof.beyls, cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang/lib/Driver/ToolChains/Arch/ARM.cpp
clang/lib/Driver/ToolChains/Arch/ARM.h
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/cuda-simple.cu

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Arch/ARM.cpp 
b/clang/lib/Driver/ToolChains/Arch/ARM.cpp
index ce3990038a4b..18bd1317fbc2 100644
--- a/clang/lib/Driver/ToolChains/Arch/ARM.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/ARM.cpp
@@ -137,9 +137,8 @@ bool arm::useAAPCSForMachO(const llvm::Triple &T) {
 }
 
 // Select mode for reading thread pointer (-mtp=soft/cp15).
-arm::ReadTPMode arm::getReadTPMode(const ToolChain &TC, const ArgList &Args) {
+arm::ReadTPMode arm::getReadTPMode(const Driver &D, const ArgList &Args) {
   if (Arg *A = Args.getLastArg(options::OPT_mtp_mode_EQ)) {
-const Driver &D = TC.getDriver();
 arm::ReadTPMode ThreadPointer =
 llvm::StringSwitch(A->getValue())
 .Case("cp15", ReadTPMode::Cp15)
@@ -156,11 +155,14 @@ arm::ReadTPMode arm::getReadTPMode(const ToolChain &TC, 
const ArgList &Args) {
   return ReadTPMode::Soft;
 }
 
+arm::FloatABI arm::getARMFloatABI(const ToolChain &TC, const ArgList &Args) {
+  return arm::getARMFloatABI(TC.getDriver(), TC.getEffectiveTriple(), Args);
+}
+
 // Select the float ABI as determined by -msoft-float, -mhard-float, and
 // -mfloat-abi=.
-arm::FloatABI arm::getARMFloatABI(const ToolChain &TC, const ArgList &Args) {
-  const Driver &D = TC.getDriver();
-  const llvm::Triple &Triple = TC.getEffectiveTriple();
+arm::FloatABI arm::getARMFloatABI(const Driver &D, const llvm::Triple &Triple,
+  const ArgList &Args) {
   auto SubArch = getARMSubArchVersionNumber(Triple);
   arm::FloatABI ABI = FloatABI::Invalid;
   if (Arg *A =
@@ -276,18 +278,13 @@ arm::FloatABI arm::getARMFloatABI(const ToolChain &TC, 
const ArgList &Args) {
   return ABI;
 }
 
-void arm::getARMTargetFeatures(const ToolChain &TC,
-   const llvm::Triple &Triple,
-   const ArgList &Args,
-   ArgStringList &CmdArgs,
-   std::vector &Features,
-   bool ForAS) {
-  const Driver &D = TC.getDriver();
-
+void arm::getARMTargetFeatures(const Driver &D, const llvm::Triple &Triple,
+   const ArgList &Args, ArgStringList &CmdArgs,
+   std::vector &Features, bool ForAS) {
   bool KernelOrKext =
   Args.hasArg(options::OPT_mkernel, options::OPT_fapple_kext);
-  arm::FloatABI ABI = arm::getARMFloatABI(TC, Args);
-  arm::ReadTPMode ThreadPointer = arm::getReadTPMode(TC, Args);
+  arm::FloatABI ABI = arm::getARMFloatABI(D, Triple, Args);
+  arm::ReadTPMode ThreadPointer = arm::getReadTPMode(D, Args);
   const Arg *WaCPU = nullptr, *WaFPU = nullptr;
   const Arg *WaHDiv = nullptr, *WaArch = nullptr;
 

diff  --git a/clang/lib/Driver/ToolChains/Arch/ARM.h 
b/clang/lib/Driver/ToolChains/Arch/ARM.h
index 5640f8371262..0ba1a59852aa 100644
--- a/clang/lib/Driver/ToolChains/Arch/ARM.h
+++ b/clang/lib/Driver/ToolChains/Arch/ARM.h
@@ -48,13 +48,15 @@ enum class FloatABI {
 };
 
 FloatABI getARMFloatABI(const ToolChain &TC, const llvm::opt::ArgList &Args);
-ReadTPMode getReadTPMode(const ToolChain &TC, const llvm::opt::ArgList &Args);
+FloatABI getARMFloatABI(const Driver &D, const llvm::Triple &Triple,
+const llvm::opt::ArgList &Args);
+ReadTPMode getReadTPMode(const Driver &D, const llvm::opt::ArgList &Args);
 
 bool useAAPCSForMachO(const llvm::Triple &T);
 void getARMArchCPUFromArgs(const llvm::opt::ArgList &Args,
llvm::StringRef &Arch, llvm::StringRef &CPU,
bool FromAs = false);
-void getARMTargetFeatures(const ToolChain &TC, const llvm::Triple &Triple,
+void

[PATCH] D73693: [clang][DeclPrinter] Implement visitors for {TemplateType,NonTypeTemplate}Parms

2020-02-06 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet updated this revision to Diff 242883.
kadircet added a comment.

- Add unittests to ASTDeclPrinter


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73693/new/

https://reviews.llvm.org/D73693

Files:
  clang-tools-extra/clangd/unittests/FindTargetTests.cpp
  clang/lib/AST/DeclPrinter.cpp
  clang/unittests/AST/DeclPrinterTest.cpp

Index: clang/unittests/AST/DeclPrinterTest.cpp
===
--- clang/unittests/AST/DeclPrinterTest.cpp
+++ clang/unittests/AST/DeclPrinterTest.cpp
@@ -22,6 +22,7 @@
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "clang/Tooling/Tooling.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringRef.h"
 #include "gtest/gtest.h"
 
 using namespace clang;
@@ -1273,6 +1274,15 @@
 // Should be: with semicolon
 }
 
+TEST(DeclPrinter, TestTemplateArgumentList16) {
+  llvm::StringLiteral Code = "template struct Z {};";
+  ASSERT_TRUE(PrintedDeclCXX11Matches(Code, "T1", "typename T1"));
+  ASSERT_TRUE(PrintedDeclCXX11Matches(Code, "T2", "typename T2 = bool"));
+  ASSERT_TRUE(PrintedDeclCXX11Matches(Code, "NT1", "int NT1"));
+  ASSERT_TRUE(PrintedDeclCXX11Matches(Code, "NT2", "int NT2 = 5"));
+}
+
 TEST(DeclPrinter, TestStaticAssert1) {
   ASSERT_TRUE(PrintedDeclCXX1ZMatches(
 "static_assert(true);",
Index: clang/lib/AST/DeclPrinter.cpp
===
--- clang/lib/AST/DeclPrinter.cpp
+++ clang/lib/AST/DeclPrinter.cpp
@@ -105,6 +105,8 @@
 void VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D);
 void VisitOMPDeclareMapperDecl(OMPDeclareMapperDecl *D);
 void VisitOMPCapturedExprDecl(OMPCapturedExprDecl *D);
+void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *TTP);
+void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *NTTP);
 
 void printTemplateParameters(const TemplateParameterList *Params,
  bool OmitTemplateKW = false);
@@ -1051,37 +1053,10 @@
 else
   NeedComma = true;
 
-if (auto TTP = dyn_cast(Param)) {
-
-  if (const TypeConstraint *TC = TTP->getTypeConstraint())
-TC->print(Out, Policy);
-  else if (TTP->wasDeclaredWithTypename())
-Out << "typename";
-  else
-Out << "class";
-
-  if (TTP->isParameterPack())
-Out << " ...";
-  else if (!TTP->getName().empty())
-Out << ' ';
-
-  Out << *TTP;
-
-  if (TTP->hasDefaultArgument()) {
-Out << " = ";
-Out << TTP->getDefaultArgument().getAsString(Policy);
-  };
+if (const auto *TTP = dyn_cast(Param)) {
+  VisitTemplateTypeParmDecl(TTP);
 } else if (auto NTTP = dyn_cast(Param)) {
-  StringRef Name;
-  if (IdentifierInfo *II = NTTP->getIdentifier())
-Name = II->getName();
-  printDeclType(NTTP->getType(), Name, NTTP->isParameterPack());
-
-  if (NTTP->hasDefaultArgument()) {
-Out << " = ";
-NTTP->getDefaultArgument()->printPretty(Out, nullptr, Policy,
-Indentation);
-  }
+  VisitNonTypeTemplateParmDecl(NTTP);
 } else if (auto TTPD = dyn_cast(Param)) {
   VisitTemplateDecl(TTPD);
   // FIXME: print the default argument, if present.
@@ -1705,3 +1680,36 @@
   D->getInit()->printPretty(Out, nullptr, Policy, Indentation);
 }
 
+void DeclPrinter::VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *TTP) {
+  if (const TypeConstraint *TC = TTP->getTypeConstraint())
+TC->print(Out, Policy);
+  else if (TTP->wasDeclaredWithTypename())
+Out << "typename";
+  else
+Out << "class";
+
+  if (TTP->isParameterPack())
+Out << " ...";
+  else if (!TTP->getName().empty())
+Out << ' ';
+
+  Out << *TTP;
+
+  if (TTP->hasDefaultArgument()) {
+Out << " = ";
+Out << TTP->getDefaultArgument().getAsString(Policy);
+  }
+}
+
+void DeclPrinter::VisitNonTypeTemplateParmDecl(
+const NonTypeTemplateParmDecl *NTTP) {
+  StringRef Name;
+  if (IdentifierInfo *II = NTTP->getIdentifier())
+Name = II->getName();
+  printDeclType(NTTP->getType(), Name, NTTP->isParameterPack());
+
+  if (NTTP->hasDefaultArgument()) {
+Out << " = ";
+NTTP->getDefaultArgument()->printPretty(Out, nullptr, Policy, Indentation);
+  }
+}
Index: clang-tools-extra/clangd/unittests/FindTargetTests.cpp
===
--- clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -215,8 +215,7 @@
 template 
 int x = [[T::]]y;
   )cpp";
-  // FIXME: We don't do a good job printing TemplateTypeParmDecls, apparently!
-  EXPECT_DECLS("NestedNameSpecifierLoc", "");
+  EXPECT_DECLS("NestedNameSpecifierLoc", "typename T");
 
   Code = R"cpp(
 namespace a { int x; }
@@ -256,8 +255,7 @@
 template
 void foo() { [[T]] x; }
   )cpp";
-  // FIXME: We don't do a good job p

[PATCH] D74020: [ARM] Clean up ARM target & feature checking in clang driver.

2020-02-06 Thread Michael Liao via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG09a88120c926: [clang][driver][ARM] Clean up ARM target & 
feature checking in clang driver. (authored by hliao).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74020/new/

https://reviews.llvm.org/D74020

Files:
  clang/lib/Driver/ToolChains/Arch/ARM.cpp
  clang/lib/Driver/ToolChains/Arch/ARM.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/cuda-simple.cu

Index: clang/test/Driver/cuda-simple.cu
===
--- clang/test/Driver/cuda-simple.cu
+++ clang/test/Driver/cuda-simple.cu
@@ -1,7 +1,6 @@
 // Verify that we can parse a simple CUDA file with or without -save-temps
 // http://llvm.org/PR22936
 // RUN: %clang -nocudainc -nocudalib -Werror -fsyntax-only -c %s
-// XFAIL: arm
 //
 // Verify that we pass -x cuda-cpp-output to compiler after
 // preprocessing a CUDA file
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -326,7 +326,7 @@
   case llvm::Triple::armeb:
   case llvm::Triple::thumb:
   case llvm::Triple::thumbeb:
-arm::getARMTargetFeatures(TC, Triple, Args, CmdArgs, Features, ForAS);
+arm::getARMTargetFeatures(D, Triple, Args, CmdArgs, Features, ForAS);
 break;
 
   case llvm::Triple::ppc:
Index: clang/lib/Driver/ToolChains/Arch/ARM.h
===
--- clang/lib/Driver/ToolChains/Arch/ARM.h
+++ clang/lib/Driver/ToolChains/Arch/ARM.h
@@ -48,13 +48,15 @@
 };
 
 FloatABI getARMFloatABI(const ToolChain &TC, const llvm::opt::ArgList &Args);
-ReadTPMode getReadTPMode(const ToolChain &TC, const llvm::opt::ArgList &Args);
+FloatABI getARMFloatABI(const Driver &D, const llvm::Triple &Triple,
+const llvm::opt::ArgList &Args);
+ReadTPMode getReadTPMode(const Driver &D, const llvm::opt::ArgList &Args);
 
 bool useAAPCSForMachO(const llvm::Triple &T);
 void getARMArchCPUFromArgs(const llvm::opt::ArgList &Args,
llvm::StringRef &Arch, llvm::StringRef &CPU,
bool FromAs = false);
-void getARMTargetFeatures(const ToolChain &TC, const llvm::Triple &Triple,
+void getARMTargetFeatures(const Driver &D, const llvm::Triple &Triple,
   const llvm::opt::ArgList &Args,
   llvm::opt::ArgStringList &CmdArgs,
   std::vector &Features, bool ForAS);
Index: clang/lib/Driver/ToolChains/Arch/ARM.cpp
===
--- clang/lib/Driver/ToolChains/Arch/ARM.cpp
+++ clang/lib/Driver/ToolChains/Arch/ARM.cpp
@@ -137,9 +137,8 @@
 }
 
 // Select mode for reading thread pointer (-mtp=soft/cp15).
-arm::ReadTPMode arm::getReadTPMode(const ToolChain &TC, const ArgList &Args) {
+arm::ReadTPMode arm::getReadTPMode(const Driver &D, const ArgList &Args) {
   if (Arg *A = Args.getLastArg(options::OPT_mtp_mode_EQ)) {
-const Driver &D = TC.getDriver();
 arm::ReadTPMode ThreadPointer =
 llvm::StringSwitch(A->getValue())
 .Case("cp15", ReadTPMode::Cp15)
@@ -156,11 +155,14 @@
   return ReadTPMode::Soft;
 }
 
+arm::FloatABI arm::getARMFloatABI(const ToolChain &TC, const ArgList &Args) {
+  return arm::getARMFloatABI(TC.getDriver(), TC.getEffectiveTriple(), Args);
+}
+
 // Select the float ABI as determined by -msoft-float, -mhard-float, and
 // -mfloat-abi=.
-arm::FloatABI arm::getARMFloatABI(const ToolChain &TC, const ArgList &Args) {
-  const Driver &D = TC.getDriver();
-  const llvm::Triple &Triple = TC.getEffectiveTriple();
+arm::FloatABI arm::getARMFloatABI(const Driver &D, const llvm::Triple &Triple,
+  const ArgList &Args) {
   auto SubArch = getARMSubArchVersionNumber(Triple);
   arm::FloatABI ABI = FloatABI::Invalid;
   if (Arg *A =
@@ -276,18 +278,13 @@
   return ABI;
 }
 
-void arm::getARMTargetFeatures(const ToolChain &TC,
-   const llvm::Triple &Triple,
-   const ArgList &Args,
-   ArgStringList &CmdArgs,
-   std::vector &Features,
-   bool ForAS) {
-  const Driver &D = TC.getDriver();
-
+void arm::getARMTargetFeatures(const Driver &D, const llvm::Triple &Triple,
+   const ArgList &Args, ArgStringList &CmdArgs,
+   std::vector &Features, bool ForAS) {
   bool KernelOrKext =
   Args.hasArg(options::OPT_mkernel, options::OPT_fapple_kext);
-  arm::FloatABI ABI = arm::getARMFloatABI(TC, Args);
-  arm::ReadTPMode ThreadPointer = arm::getReadTPMode(TC, Args);
+  arm::FloatABI ABI = arm::getARMFloatABI(D, Triple, Args);
+  arm::ReadTPMode ThreadPointer = arm::getReadTPMode(D

[PATCH] D74112: [clangd] Filter out implicit references while renaming

2020-02-06 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment.

In D74112#1861285 , @kbobyrev wrote:

> Address review comments.


looks like the code you submitted is the old version, not the one you addressed 
comments.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74112/new/

https://reviews.llvm.org/D74112



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


[PATCH] D74125: [clangd] Set "spelled" flag for constructor references.

2020-02-06 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision.
hokein added a reviewer: kbobyrev.
Herald added subscribers: usaxena95, kadircet, arphaman, jkorous, MaskRay, 
ilya-biryukov.
Herald added a project: clang.

DeclarationName for cxx constructor is special, it is not an identifier.
thus the "Spelled" flag are not set for all ctor references, this patch
fixes it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74125

Files:
  clang-tools-extra/clangd/index/SymbolCollector.cpp
  clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp

Index: clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
===
--- clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
+++ clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
@@ -700,39 +700,70 @@
   EXPECT_THAT(Refs, IsEmpty());
 }
 
-TEST_F(SymbolCollectorTest, SpelledReference) {
-  Annotations Header(R"cpp(
-  struct Foo;
-  #define MACRO Foo
-  )cpp");
-  Annotations Main(R"cpp(
-  struct $spelled[[Foo]] {
-$spelled[[Foo]]();
-~$spelled[[Foo]]();
+TEST_F(SymbolCollectorTest, SpelledReferences) {
+  struct {
+llvm::StringRef Header;
+llvm::StringRef Main;
+llvm::StringRef TargetSymbolName;
+  } TestCases[] = {
+{
+  R"cpp(
+struct Foo;
+#define MACRO Foo
+  )cpp",
+  R"cpp(
+struct $spelled[[Foo]] {
+  $spelled[[Foo]]();
+  ~$spelled[[Foo]]();
+};
+$spelled[[Foo]] Variable1;
+$implicit[[MACRO]] Variable2;
+  )cpp",
+  "Foo",
+},
+{
+  R"cpp(
+class Foo {
+public:
+  Foo() = default;
+};
+  )cpp",
+  R"cpp(
+void f() { Foo $implicit[[f]]; f = $spelled[[Foo]]();}
+  )cpp",
+  "Foo::Foo" /// constructor.
+},
   };
-  $spelled[[Foo]] Variable1;
-  $implicit[[MACRO]] Variable2;
-  )cpp");
   CollectorOpts.RefFilter = RefKind::All;
   CollectorOpts.RefsInHeaders = false;
-  runSymbolCollector(Header.code(), Main.code());
-  const auto SpelledRanges = Main.ranges("spelled");
-  const auto ImplicitRanges = Main.ranges("implicit");
-  RefSlab::Builder SpelledSlabBuilder, ImplicitSlabBuilder;
-  for (const auto &SymbolAndRefs : Refs) {
-const auto Symbol = SymbolAndRefs.first;
-for (const auto &Ref : SymbolAndRefs.second)
-  if ((Ref.Kind & RefKind::Spelled) != RefKind::Unknown)
-SpelledSlabBuilder.insert(Symbol, Ref);
-  else
-ImplicitSlabBuilder.insert(Symbol, Ref);
+  for (const auto& T : TestCases) {
+Annotations Header(T.Header);
+Annotations Main(T.Main);
+// Reset the file system.
+InMemoryFileSystem = new llvm::vfs::InMemoryFileSystem;
+runSymbolCollector(Header.code(), Main.code());
+
+const auto SpelledRanges = Main.ranges("spelled");
+const auto ImplicitRanges = Main.ranges("implicit");
+RefSlab::Builder SpelledSlabBuilder, ImplicitSlabBuilder;
+const auto TargetID = findSymbol(Symbols, T.TargetSymbolName).ID;
+for (const auto &SymbolAndRefs : Refs) {
+  const auto ID = SymbolAndRefs.first;
+  if (!(ID == TargetID))
+continue;
+  for (const auto &Ref : SymbolAndRefs.second)
+if ((Ref.Kind & RefKind::Spelled) != RefKind::Unknown)
+  SpelledSlabBuilder.insert(ID, Ref);
+else
+  ImplicitSlabBuilder.insert(ID, Ref);
+}
+const auto SpelledRefs = std::move(SpelledSlabBuilder).build(),
+   ImplicitRefs = std::move(ImplicitSlabBuilder).build();
+EXPECT_THAT(SpelledRefs,
+Contains(Pair(TargetID, HaveRanges(SpelledRanges;
+EXPECT_THAT(ImplicitRefs,
+Contains(Pair(TargetID, HaveRanges(ImplicitRanges;
   }
-  const auto SpelledRefs = std::move(SpelledSlabBuilder).build(),
- ImplicitRefs = std::move(ImplicitSlabBuilder).build();
-  EXPECT_THAT(SpelledRefs, Contains(Pair(findSymbol(Symbols, "Foo").ID,
- HaveRanges(SpelledRanges;
-  EXPECT_THAT(ImplicitRefs, Contains(Pair(findSymbol(Symbols, "Foo").ID,
-  HaveRanges(ImplicitRanges;
 }
 
 TEST_F(SymbolCollectorTest, NameReferences) {
Index: clang-tools-extra/clangd/index/SymbolCollector.cpp
===
--- clang-tools-extra/clangd/index/SymbolCollector.cpp
+++ clang-tools-extra/clangd/index/SymbolCollector.cpp
@@ -574,12 +574,18 @@
   // FIXME: All MacroRefs are marked as Spelled now, but this should be checked.
   for (const auto &IDAndRefs : MacroRefs)
 for (const auto &LocAndRole : IDAndRefs.second)
-  CollectRef(IDAndRefs.first, LocAndRole);
+  CollectRef(IDAndRefs.first, LocAndRole, /*Spelled=*/true);
   // Populate Refs slab from DeclRefs.
   llvm::DenseMap> FilesToTokensCache;
   for (auto &DeclAndRef : DeclRefs) {
 if (auto ID = getSymbolID(DeclAndRef.first)) {
   for (auto &LocAndRole : DeclAndRef.second)

[PATCH] D74125: [clangd] Set "spelled" flag for constructor references.

2020-02-06 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 242890.
hokein added a comment.

update.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74125/new/

https://reviews.llvm.org/D74125

Files:
  clang-tools-extra/clangd/index/SymbolCollector.cpp
  clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp

Index: clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
===
--- clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
+++ clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
@@ -700,39 +700,70 @@
   EXPECT_THAT(Refs, IsEmpty());
 }
 
-TEST_F(SymbolCollectorTest, SpelledReference) {
-  Annotations Header(R"cpp(
-  struct Foo;
-  #define MACRO Foo
-  )cpp");
-  Annotations Main(R"cpp(
-  struct $spelled[[Foo]] {
-$spelled[[Foo]]();
-~$spelled[[Foo]]();
+TEST_F(SymbolCollectorTest, SpelledReferences) {
+  struct {
+llvm::StringRef Header;
+llvm::StringRef Main;
+llvm::StringRef TargetSymbolName;
+  } TestCases[] = {
+{
+  R"cpp(
+struct Foo;
+#define MACRO Foo
+  )cpp",
+  R"cpp(
+struct $spelled[[Foo]] {
+  $spelled[[Foo]]();
+  ~$spelled[[Foo]]();
+};
+$spelled[[Foo]] Variable1;
+$implicit[[MACRO]] Variable2;
+  )cpp",
+  "Foo",
+},
+{
+  R"cpp(
+class Foo {
+public:
+  Foo() = default;
+};
+  )cpp",
+  R"cpp(
+void f() { Foo $implicit[[f]]; f = $spelled[[Foo]]();}
+  )cpp",
+  "Foo::Foo" /// constructor.
+},
   };
-  $spelled[[Foo]] Variable1;
-  $implicit[[MACRO]] Variable2;
-  )cpp");
   CollectorOpts.RefFilter = RefKind::All;
   CollectorOpts.RefsInHeaders = false;
-  runSymbolCollector(Header.code(), Main.code());
-  const auto SpelledRanges = Main.ranges("spelled");
-  const auto ImplicitRanges = Main.ranges("implicit");
-  RefSlab::Builder SpelledSlabBuilder, ImplicitSlabBuilder;
-  for (const auto &SymbolAndRefs : Refs) {
-const auto Symbol = SymbolAndRefs.first;
-for (const auto &Ref : SymbolAndRefs.second)
-  if ((Ref.Kind & RefKind::Spelled) != RefKind::Unknown)
-SpelledSlabBuilder.insert(Symbol, Ref);
-  else
-ImplicitSlabBuilder.insert(Symbol, Ref);
+  for (const auto& T : TestCases) {
+Annotations Header(T.Header);
+Annotations Main(T.Main);
+// Reset the file system.
+InMemoryFileSystem = new llvm::vfs::InMemoryFileSystem;
+runSymbolCollector(Header.code(), Main.code());
+
+const auto SpelledRanges = Main.ranges("spelled");
+const auto ImplicitRanges = Main.ranges("implicit");
+RefSlab::Builder SpelledSlabBuilder, ImplicitSlabBuilder;
+const auto TargetID = findSymbol(Symbols, T.TargetSymbolName).ID;
+for (const auto &SymbolAndRefs : Refs) {
+  const auto ID = SymbolAndRefs.first;
+  if (!(ID == TargetID))
+continue;
+  for (const auto &Ref : SymbolAndRefs.second)
+if ((Ref.Kind & RefKind::Spelled) != RefKind::Unknown)
+  SpelledSlabBuilder.insert(ID, Ref);
+else
+  ImplicitSlabBuilder.insert(ID, Ref);
+}
+const auto SpelledRefs = std::move(SpelledSlabBuilder).build(),
+   ImplicitRefs = std::move(ImplicitSlabBuilder).build();
+EXPECT_THAT(SpelledRefs,
+Contains(Pair(TargetID, HaveRanges(SpelledRanges;
+EXPECT_THAT(ImplicitRefs,
+Contains(Pair(TargetID, HaveRanges(ImplicitRanges;
   }
-  const auto SpelledRefs = std::move(SpelledSlabBuilder).build(),
- ImplicitRefs = std::move(ImplicitSlabBuilder).build();
-  EXPECT_THAT(SpelledRefs, Contains(Pair(findSymbol(Symbols, "Foo").ID,
- HaveRanges(SpelledRanges;
-  EXPECT_THAT(ImplicitRefs, Contains(Pair(findSymbol(Symbols, "Foo").ID,
-  HaveRanges(ImplicitRanges;
 }
 
 TEST_F(SymbolCollectorTest, NameReferences) {
Index: clang-tools-extra/clangd/index/SymbolCollector.cpp
===
--- clang-tools-extra/clangd/index/SymbolCollector.cpp
+++ clang-tools-extra/clangd/index/SymbolCollector.cpp
@@ -574,7 +574,7 @@
   // FIXME: All MacroRefs are marked as Spelled now, but this should be checked.
   for (const auto &IDAndRefs : MacroRefs)
 for (const auto &LocAndRole : IDAndRefs.second)
-  CollectRef(IDAndRefs.first, LocAndRole);
+  CollectRef(IDAndRefs.first, LocAndRole, /*Spelled=*/true);
   // Populate Refs slab from DeclRefs.
   llvm::DenseMap> FilesToTokensCache;
   for (auto &DeclAndRef : DeclRefs) {
@@ -592,7 +592,10 @@
 const auto *IdentifierToken =
 spelledIdentifierTouching(LocAndRole.first, Tokens);
 DeclarationName Name = DeclAndRef.first->getDeclName();
-bool Spelled = IdentifierToken && Name.isIdentifier() &&
+auto NameKind = Name.getNameKind();

[PATCH] D74125: [clangd] Set "spelled" flag for constructor references.

2020-02-06 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added inline comments.



Comment at: clang-tools-extra/clangd/index/SymbolCollector.cpp:597
+bool IsTargetKind = NameKind == DeclarationName::Identifier ||
+  NameKind == DeclarationName::CXXConstructorName;
+bool Spelled = IdentifierToken && IsTargetKind &&

drive-by: what about destructors?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74125/new/

https://reviews.llvm.org/D74125



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


[PATCH] D74125: [clangd] Set "spelled" flag for constructor references.

2020-02-06 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev accepted this revision.
kbobyrev added inline comments.
This revision is now accepted and ready to land.



Comment at: clang-tools-extra/clangd/index/SymbolCollector.cpp:595
 DeclarationName Name = DeclAndRef.first->getDeclName();
-bool Spelled = IdentifierToken && Name.isIdentifier() &&
+auto NameKind = Name.getNameKind();
+bool IsTargetKind = NameKind == DeclarationName::Identifier ||

nit: const auto?



Comment at: clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp:752
+  const auto ID = SymbolAndRefs.first;
+  if (!(ID == TargetID))
+continue;

nit: maybe add operator != to SymbolKind instead?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74125/new/

https://reviews.llvm.org/D74125



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


[PATCH] D72857: [SYCL] Driver option to enable SYCL mode and select SYCL version

2020-02-06 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: clang/include/clang/Basic/LangOptions.h:122
 
+  enum class SYCLVersionList { SYCL_2015, SYCL_1_2_1 = SYCL_2015, undefined };
+

s/undefined/Undefined/g



Comment at: clang/include/clang/Basic/LangOptions.h:122
 
+  enum class SYCLVersionList { SYCL_2015, SYCL_1_2_1 = SYCL_2015, undefined };
+

ABataev wrote:
> s/undefined/Undefined/g
Do you use `SYCL_1_2_1` anywhere in the code? I don't see it is used and you 
can drop this enum.



Comment at: clang/lib/Frontend/CompilerInvocation.cpp:2552-2553
+llvm::StringSwitch(A->getValue())
+.Cases("2015", "1.2.1", "121", "sycl-1.2.1",
+   LangOptions::SYCLVersionList::SYCL_2015)
+.Default(LangOptions::SYCLVersionList::undefined));

It does not match the list of values in `Options.td` file



Comment at: clang/lib/Frontend/CompilerInvocation.cpp:2562
+  } else if (Args.hasArg(options::OPT_fsycl_is_device) ||
+ Args.hasArg(options::OPT_fsycl)) {
+Opts.setSYCLVersion(LangOptions::SYCLVersionList::SYCL_2015);

Can `OPT_fsycl` flag be ever passed to the frontend? Also, seems to me the 
driver has a special case already for `device` mode, so this code must be the 
dead code, actually.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72857/new/

https://reviews.llvm.org/D72857



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


[clang-tools-extra] d6da8a1 - [clangd] don't rename on protobuf symbols.

2020-02-06 Thread Haojian Wu via cfe-commits

Author: Haojian Wu
Date: 2020-02-06T15:40:14+01:00
New Revision: d6da8a1d945361327b8da79195dbfccc2e533e87

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

LOG: [clangd] don't rename on protobuf symbols.

Reviewers: kadircet

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang-tools-extra/clangd/refactor/Rename.cpp
clang-tools-extra/clangd/unittests/RenameTests.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/refactor/Rename.cpp 
b/clang-tools-extra/clangd/refactor/Rename.cpp
index 31fabc787625..44ebdbce628d 100644
--- a/clang-tools-extra/clangd/refactor/Rename.cpp
+++ b/clang-tools-extra/clangd/refactor/Rename.cpp
@@ -96,7 +96,13 @@ llvm::DenseSet locateDeclAt(ParsedAST 
&AST,
   return Result;
 }
 
+// By default, we blacklist C++ standard symbols and protobuf symbols as rename
+// these symbols would change system/generated files which are unlikely to be
+// modified.
 bool isBlacklisted(const NamedDecl &RenameDecl) {
+  if (isProtoFile(RenameDecl.getLocation(),
+  RenameDecl.getASTContext().getSourceManager()))
+return true;
   static const auto *StdSymbols = new llvm::DenseSet({
 #define SYMBOL(Name, NameSpace, Header) {#NameSpace #Name},
 #include "StdSymbolMap.inc"

diff  --git a/clang-tools-extra/clangd/unittests/RenameTests.cpp 
b/clang-tools-extra/clangd/unittests/RenameTests.cpp
index 2aaf45eb7563..a9446865e664 100644
--- a/clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ b/clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -630,6 +630,21 @@ TEST(RenameTest, MainFileReferencesOnly) {
 expectedResult(Code, NewName));
 }
 
+TEST(RenameTest, ProtobufSymbolIsBlacklisted) {
+  Annotations Code("Prot^obuf buf;");
+  auto TU = TestTU::withCode(Code.code());
+  TU.HeaderCode =
+  R"cpp(// Generated by the protocol buffer compiler.  DO NOT EDIT!
+  class Protobuf {};
+  )cpp";
+  TU.HeaderFilename = "protobuf.pb.h";
+  auto AST = TU.build();
+  auto Results = rename({Code.point(), "newName", AST, testPath(TU.Filename)});
+  EXPECT_FALSE(Results);
+  EXPECT_THAT(llvm::toString(Results.takeError()),
+  testing::HasSubstr("not a supported kind"));
+}
+
 TEST(CrossFileRenameTests, DirtyBuffer) {
   Annotations FooCode("class [[Foo]] {};");
   std::string FooPath = testPath("foo.cc");



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


[PATCH] D74036: [clangd] don't rename on protobuf symbols.

2020-02-06 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 242892.
hokein added a comment.

address comments


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74036/new/

https://reviews.llvm.org/D74036

Files:
  clang-tools-extra/clangd/refactor/Rename.cpp
  clang-tools-extra/clangd/unittests/RenameTests.cpp


Index: clang-tools-extra/clangd/unittests/RenameTests.cpp
===
--- clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -630,6 +630,21 @@
 expectedResult(Code, NewName));
 }
 
+TEST(RenameTest, ProtobufSymbolIsBlacklisted) {
+  Annotations Code("Prot^obuf buf;");
+  auto TU = TestTU::withCode(Code.code());
+  TU.HeaderCode =
+  R"cpp(// Generated by the protocol buffer compiler.  DO NOT EDIT!
+  class Protobuf {};
+  )cpp";
+  TU.HeaderFilename = "protobuf.pb.h";
+  auto AST = TU.build();
+  auto Results = rename({Code.point(), "newName", AST, testPath(TU.Filename)});
+  EXPECT_FALSE(Results);
+  EXPECT_THAT(llvm::toString(Results.takeError()),
+  testing::HasSubstr("not a supported kind"));
+}
+
 TEST(CrossFileRenameTests, DirtyBuffer) {
   Annotations FooCode("class [[Foo]] {};");
   std::string FooPath = testPath("foo.cc");
Index: clang-tools-extra/clangd/refactor/Rename.cpp
===
--- clang-tools-extra/clangd/refactor/Rename.cpp
+++ clang-tools-extra/clangd/refactor/Rename.cpp
@@ -96,7 +96,13 @@
   return Result;
 }
 
+// By default, we blacklist C++ standard symbols and protobuf symbols as rename
+// these symbols would change system/generated files which are unlikely to be
+// modified.
 bool isBlacklisted(const NamedDecl &RenameDecl) {
+  if (isProtoFile(RenameDecl.getLocation(),
+  RenameDecl.getASTContext().getSourceManager()))
+return true;
   static const auto *StdSymbols = new llvm::DenseSet({
 #define SYMBOL(Name, NameSpace, Header) {#NameSpace #Name},
 #include "StdSymbolMap.inc"


Index: clang-tools-extra/clangd/unittests/RenameTests.cpp
===
--- clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -630,6 +630,21 @@
 expectedResult(Code, NewName));
 }
 
+TEST(RenameTest, ProtobufSymbolIsBlacklisted) {
+  Annotations Code("Prot^obuf buf;");
+  auto TU = TestTU::withCode(Code.code());
+  TU.HeaderCode =
+  R"cpp(// Generated by the protocol buffer compiler.  DO NOT EDIT!
+  class Protobuf {};
+  )cpp";
+  TU.HeaderFilename = "protobuf.pb.h";
+  auto AST = TU.build();
+  auto Results = rename({Code.point(), "newName", AST, testPath(TU.Filename)});
+  EXPECT_FALSE(Results);
+  EXPECT_THAT(llvm::toString(Results.takeError()),
+  testing::HasSubstr("not a supported kind"));
+}
+
 TEST(CrossFileRenameTests, DirtyBuffer) {
   Annotations FooCode("class [[Foo]] {};");
   std::string FooPath = testPath("foo.cc");
Index: clang-tools-extra/clangd/refactor/Rename.cpp
===
--- clang-tools-extra/clangd/refactor/Rename.cpp
+++ clang-tools-extra/clangd/refactor/Rename.cpp
@@ -96,7 +96,13 @@
   return Result;
 }
 
+// By default, we blacklist C++ standard symbols and protobuf symbols as rename
+// these symbols would change system/generated files which are unlikely to be
+// modified.
 bool isBlacklisted(const NamedDecl &RenameDecl) {
+  if (isProtoFile(RenameDecl.getLocation(),
+  RenameDecl.getASTContext().getSourceManager()))
+return true;
   static const auto *StdSymbols = new llvm::DenseSet({
 #define SYMBOL(Name, NameSpace, Header) {#NameSpace #Name},
 #include "StdSymbolMap.inc"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74127: [clangd] Bump index version number.

2020-02-06 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision.
hokein added a reviewer: kadircet.
Herald added subscribers: usaxena95, arphaman, jkorous, MaskRay, ilya-biryukov.
Herald added a project: clang.

Though we don't have new changes to the index format, we have changes to
symbol collector, e.g. collect marcos, spelled references. Bump the
version to force background-index to rebuild.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74127

Files:
  clang-tools-extra/clangd/index/Serialization.cpp


Index: clang-tools-extra/clangd/index/Serialization.cpp
===
--- clang-tools-extra/clangd/index/Serialization.cpp
+++ clang-tools-extra/clangd/index/Serialization.cpp
@@ -419,7 +419,7 @@
 // The current versioning scheme is simple - non-current versions are rejected.
 // If you make a breaking change, bump this version number to invalidate stored
 // data. Later we may want to support some backward compatibility.
-constexpr static uint32_t Version = 12;
+constexpr static uint32_t Version = 13;
 
 llvm::Expected readRIFF(llvm::StringRef Data) {
   auto RIFF = riff::readFile(Data);


Index: clang-tools-extra/clangd/index/Serialization.cpp
===
--- clang-tools-extra/clangd/index/Serialization.cpp
+++ clang-tools-extra/clangd/index/Serialization.cpp
@@ -419,7 +419,7 @@
 // The current versioning scheme is simple - non-current versions are rejected.
 // If you make a breaking change, bump this version number to invalidate stored
 // data. Later we may want to support some backward compatibility.
-constexpr static uint32_t Version = 12;
+constexpr static uint32_t Version = 13;
 
 llvm::Expected readRIFF(llvm::StringRef Data) {
   auto RIFF = riff::readFile(Data);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74036: [clangd] don't rename on protobuf symbols.

2020-02-06 Thread Haojian Wu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd6da8a1d9453: [clangd] don't rename on protobuf 
symbols. (authored by hokein).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74036/new/

https://reviews.llvm.org/D74036

Files:
  clang-tools-extra/clangd/refactor/Rename.cpp
  clang-tools-extra/clangd/unittests/RenameTests.cpp


Index: clang-tools-extra/clangd/unittests/RenameTests.cpp
===
--- clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -630,6 +630,21 @@
 expectedResult(Code, NewName));
 }
 
+TEST(RenameTest, ProtobufSymbolIsBlacklisted) {
+  Annotations Code("Prot^obuf buf;");
+  auto TU = TestTU::withCode(Code.code());
+  TU.HeaderCode =
+  R"cpp(// Generated by the protocol buffer compiler.  DO NOT EDIT!
+  class Protobuf {};
+  )cpp";
+  TU.HeaderFilename = "protobuf.pb.h";
+  auto AST = TU.build();
+  auto Results = rename({Code.point(), "newName", AST, testPath(TU.Filename)});
+  EXPECT_FALSE(Results);
+  EXPECT_THAT(llvm::toString(Results.takeError()),
+  testing::HasSubstr("not a supported kind"));
+}
+
 TEST(CrossFileRenameTests, DirtyBuffer) {
   Annotations FooCode("class [[Foo]] {};");
   std::string FooPath = testPath("foo.cc");
Index: clang-tools-extra/clangd/refactor/Rename.cpp
===
--- clang-tools-extra/clangd/refactor/Rename.cpp
+++ clang-tools-extra/clangd/refactor/Rename.cpp
@@ -96,7 +96,13 @@
   return Result;
 }
 
+// By default, we blacklist C++ standard symbols and protobuf symbols as rename
+// these symbols would change system/generated files which are unlikely to be
+// modified.
 bool isBlacklisted(const NamedDecl &RenameDecl) {
+  if (isProtoFile(RenameDecl.getLocation(),
+  RenameDecl.getASTContext().getSourceManager()))
+return true;
   static const auto *StdSymbols = new llvm::DenseSet({
 #define SYMBOL(Name, NameSpace, Header) {#NameSpace #Name},
 #include "StdSymbolMap.inc"


Index: clang-tools-extra/clangd/unittests/RenameTests.cpp
===
--- clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -630,6 +630,21 @@
 expectedResult(Code, NewName));
 }
 
+TEST(RenameTest, ProtobufSymbolIsBlacklisted) {
+  Annotations Code("Prot^obuf buf;");
+  auto TU = TestTU::withCode(Code.code());
+  TU.HeaderCode =
+  R"cpp(// Generated by the protocol buffer compiler.  DO NOT EDIT!
+  class Protobuf {};
+  )cpp";
+  TU.HeaderFilename = "protobuf.pb.h";
+  auto AST = TU.build();
+  auto Results = rename({Code.point(), "newName", AST, testPath(TU.Filename)});
+  EXPECT_FALSE(Results);
+  EXPECT_THAT(llvm::toString(Results.takeError()),
+  testing::HasSubstr("not a supported kind"));
+}
+
 TEST(CrossFileRenameTests, DirtyBuffer) {
   Annotations FooCode("class [[Foo]] {};");
   std::string FooPath = testPath("foo.cc");
Index: clang-tools-extra/clangd/refactor/Rename.cpp
===
--- clang-tools-extra/clangd/refactor/Rename.cpp
+++ clang-tools-extra/clangd/refactor/Rename.cpp
@@ -96,7 +96,13 @@
   return Result;
 }
 
+// By default, we blacklist C++ standard symbols and protobuf symbols as rename
+// these symbols would change system/generated files which are unlikely to be
+// modified.
 bool isBlacklisted(const NamedDecl &RenameDecl) {
+  if (isProtoFile(RenameDecl.getLocation(),
+  RenameDecl.getASTContext().getSourceManager()))
+return true;
   static const auto *StdSymbols = new llvm::DenseSet({
 #define SYMBOL(Name, NameSpace, Header) {#NameSpace #Name},
 #include "StdSymbolMap.inc"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 0fff659 - [OpenCL] Reduce size of builtin function tables

2020-02-06 Thread Sven van Haastregt via cfe-commits

Author: Sven van Haastregt
Date: 2020-02-06T15:08:32Z
New Revision: 0fff6593f8962784d1e2e4d2ad986f2759a8

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

LOG: [OpenCL] Reduce size of builtin function tables

Reduce the size of some of the TableGen'ed OpenCL builtin function
tables:

 - Use bit fields for bools such that they are packed together.  This
   saves about 7kb.

 - Use unsigned short for SignatureTable.  This saves about 10kb.

Added: 


Modified: 
clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp

Removed: 




diff  --git a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp 
b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
index 85933e6d3bd3..b930f2daed42 100644
--- a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
+++ b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
@@ -313,11 +313,11 @@ struct OpenCLTypeStruct {
   // Vector size (if applicable; 0 for scalars and generic types).
   const unsigned VectorWidth;
   // 0 if the type is not a pointer.
-  const bool IsPointer;
+  const bool IsPointer : 1;
   // 0 if the type is not const.
-  const bool IsConst;
+  const bool IsConst : 1;
   // 0 if the type is not volatile.
-  const bool IsVolatile;
+  const bool IsVolatile : 1;
   // Access qualifier.
   const OpenCLAccessQual AccessQualifier;
   // Address space of the pointer (if applicable).
@@ -333,11 +333,11 @@ struct OpenCLBuiltinStruct {
   // index SigTableIndex is the return type.
   const unsigned NumTypes;
   // Function attribute __attribute__((pure))
-  const bool IsPure;
+  const bool IsPure : 1;
   // Function attribute __attribute__((const))
-  const bool IsConst;
+  const bool IsConst : 1;
   // Function attribute __attribute__((convergent))
-  const bool IsConv;
+  const bool IsConv : 1;
   // OpenCL extension(s) required for this overload.
   const unsigned short Extension;
   // First OpenCL version in which this overload was introduced (e.g. CL20).
@@ -473,11 +473,18 @@ void BuiltinNameEmitter::EmitSignatureTable() {
   // Store a type (e.g. int, float, int2, ...). The type is stored as an index
   // of a struct OpenCLType table. Multiple entries following each other form a
   // signature.
-  OS << "static const unsigned SignatureTable[] = {\n";
+  OS << "static const unsigned short SignatureTable[] = {\n";
   for (const auto &P : SignaturesList) {
 OS << "  // " << P.second << "\n  ";
 for (const Record *R : P.first) {
-  OS << TypeMap.find(R)->second << ", ";
+  unsigned Entry = TypeMap.find(R)->second;
+  if (Entry > USHRT_MAX) {
+// Report an error when seeing an entry that is too large for the
+// current index type (unsigned short).  When hitting this, the type
+// of SignatureTable will need to be changed.
+PrintFatalError("Entry in SignatureTable exceeds limit.");
+  }
+  OS << Entry << ", ";
 }
 OS << "\n";
   }



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


[PATCH] D68896: PR43080: Do not build context-sensitive expressions during name classification.

2020-02-06 Thread Kian Moniri via Phabricator via cfe-commits
kianm added a comment.

In D68896#1861048 , @rsmith wrote:

> In D68896#1861040 , @rsmith wrote:
>
> > In D68896#1778193 , @kianm wrote:
> >
> > > Hi, I am still seeing problems with this assertion. Could we please get a 
> > > fix? I've posted the reduced test case and reproducible command on this 
> > > Phabricator patch.
> >
> >
> > Are you still seeing problems?
>
>
> For future Phabricator visitors, this was fixed in rG2e48be09b 
> .


No I am not seeing problems, they were fixed in rG2e48be09b 
. Thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68896/new/

https://reviews.llvm.org/D68896



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


[PATCH] D74127: [clangd] Bump index version number.

2020-02-06 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet accepted this revision.
kadircet added a comment.
This revision is now accepted and ready to land.

i've thought change introducing `RefKind::Spelled` would've already bumped it. 
Please make sure to bump it only if it didn't


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74127/new/

https://reviews.llvm.org/D74127



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


[PATCH] D72705: [analyzer] Added new checker 'alpha.unix.ErrorReturn'.

2020-02-06 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 242900.
balazske added a comment.

Uploading new diff with added comments and renaming.
(And a new feature of leaking pointer detection.)
The code is at least saved here, can be used as starting point for smaller 
changes.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72705/new/

https://reviews.llvm.org/D72705

Files:
  clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
  clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt
  clang/lib/StaticAnalyzer/Checkers/ErrorReturnChecker.cpp
  clang/test/Analysis/Inputs/system-header-simulator.h
  clang/test/Analysis/error-return.c

Index: clang/test/Analysis/error-return.c
===
--- /dev/null
+++ clang/test/Analysis/error-return.c
@@ -0,0 +1,556 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=alpha.unix.ErrorReturn -verify %s
+
+#include "Inputs/system-header-simulator.h"
+
+/*
+Functions from CERT ERR33-C that should be checked for error:
+https://wiki.sei.cmu.edu/confluence/display/c/ERR33-C.+Detect+and+handle+standard+library+errors
+
+void *aligned_alloc( size_t alignment, size_t size );
+errno_t asctime_s(char *buf, rsize_t bufsz, const struct tm *time_ptr);
+int at_quick_exit( void (*func)(void) );
+int atexit( void (*func)(void) );
+void* bsearch( const void *key, const void *ptr, size_t count, size_t size,
+   int (*comp)(const void*, const void*) );
+void* bsearch_s( const void *key, const void *ptr, rsize_t count, rsize_t size,
+ int (*comp)(const void *, const void *, void *),
+ void *context );
+wint_t btowc( int c );
+size_t c16rtomb( char * restrict s, char16_t c16, mbstate_t * restrict ps );
+size_t c32rtomb( char * restrict s, char32_t c32, mbstate_t * restrict ps );
+void* calloc( size_t num, size_t size );
+clock_t clock(void);
+int cnd_broadcast( cnd_t *cond );
+int cnd_init( cnd_t* cond );
+int cnd_signal( cnd_t *cond );
+int cnd_timedwait( cnd_t* restrict cond, mtx_t* restrict mutex,
+   const struct timespec* restrict time_point );
+int cnd_wait( cnd_t* cond, mtx_t* mutex );
+errno_t ctime_s(char *buffer, rsize_t bufsz, const time_t *time);
+int fclose( FILE *stream );
+int fflush( FILE *stream );
+int fgetc( FILE *stream );
+int fgetpos( FILE *restrict stream, fpos_t *restrict pos );
+char *fgets( char *restrict str, int count, FILE *restrict stream );
+wint_t fgetwc( FILE *stream );
+FILE *fopen( const char *restrict filename, const char *restrict mode );
+errno_t fopen_s(FILE *restrict *restrict streamptr,
+const char *restrict filename,
+const char *restrict mode);
+int fprintf( FILE *restrict stream, const char *restrict format, ... );
+int fprintf_s(FILE *restrict stream, const char *restrict format, ...);
+int fputc( int ch, FILE *stream );
+int fputs( const char *restrict str, FILE *restrict stream );
+wint_t fputwc( wchar_t ch, FILE *stream );
+int fputws( const wchar_t * restrict str, FILE * restrict stream );
+size_t fread( void *restrict buffer, size_t size, size_t count,
+  FILE *restrict stream );
+FILE *freopen( const char *restrict filename, const char *restrict mode,
+   FILE *restrict stream );
+errno_t freopen_s(FILE *restrict *restrict newstreamptr,
+  const char *restrict filename, const char *restrict mode,
+  FILE *restrict stream);
+int fscanf( FILE *restrict stream, const char *restrict format, ... );
+int fscanf_s(FILE *restrict stream, const char *restrict format, ...);
+int fseek( FILE *stream, long offset, int origin );
+int fsetpos( FILE *stream, const fpos_t *pos );
+long ftell( FILE *stream );
+int fwprintf( FILE *restrict stream,
+  const wchar_t *restrict format, ... );
+int fwprintf_s( FILE *restrict stream,
+const wchar_t *restrict format, ...);
+size_t fwrite( const void *restrict buffer, size_t size, size_t count,
+   FILE *restrict stream ); // more exact error return: < count
+int fwscanf( FILE *restrict stream,
+ const wchar_t *restrict format, ... );
+int fwscanf_s( FILE *restrict stream,
+   const wchar_t *restrict format, ...);
+int getc( FILE *stream );
+int getchar(void);
+char *getenv( const char *name );
+errno_t getenv_s( size_t *restrict len, char *restrict value,
+  rsize_t valuesz, const char *restrict name );
+char *gets_s( char *str, rsize_t n );
+wint_t getwc( FILE *stream );
+wint_t getwchar(void);
+struct tm *gmtime( const time_t *time );
+struct tm *gmtime_s(const time_t *restrict time, struct tm *restrict result);
+struct tm *localtime( const time_t *time );
+struct tm *localtime_s(const time_t *restrict time, struct tm *restrict result);
+void* malloc( size_t size );
+int mblen( const char* s, size_t n );
+size_t mbrlen( const char *restrict s, size_t n, mbstate_t *restrict ps );
+size_t mbrtoc16( char16_t * r

[PATCH] D73967: Implement _ExtInt as an extended int type specifier.

2020-02-06 Thread Erich Keane via Phabricator via cfe-commits
erichkeane marked an inline comment as done.
erichkeane added a comment.

In D73967#1861073 , @rsmith wrote:

> Have you considered how this would interact with our other language 
> extensions? Can we form a vector of `_ExtInt(N)`? A `_Complex _ExtInt(N)`? I 
> expect for some of that to just fall out of the implementation, but we should 
> have documentation and test coverage either way.
>
> I don't see any test coverage for `_Atomic(_ExtInt(N))`, which may not fall 
> out from the other work because (if memory serves) atomic lowering doesn't go 
> through the normal `ConvertTypeForMem` path and instead deals with padding 
> itself.
>
> I would like to see your documentation cover the calling convention used when 
> passing/returning these types by value.


We can do a std::vector or any of the standard containers with no problems.

Extended-vector types don't really make sense for non-powers-of-two (plus have 
some odd gotchas when it comes to vectors of i1 for example), so I've added a 
test that shows that this is rejected.

_Complex _ExtInt(N) is rejected when parsing _Complex.  It doesn't seem to make 
sense to me to support them, so I've added a test that shows it is invalid.  Do 
you disagree?

_Atomic seems to be broken (atomic memory access size mus be byte-sized), but 
I'll continue to work on it to update this patch further.

I've also asked a coworker to better describe the calling convention so that we 
can add that text to the language-extensions.

Thanks!




Comment at: clang/lib/AST/ItaniumMangle.cpp:3472
+  BW = T->getNumBits();
+  mangleIntegerLiteral(getASTContext().UnsignedIntTy, BW);
+}

rsmith wrote:
> This is not a valid vendor-extension mangling. There are two choices here, 
> per the current scheme:
> 
> 1) mangle as a type, using (lowercase) `u` followed by a source-name, such as 
> `u9_ExtInt17` / `u10_UExtInt17`
> 2) mangle as a type qualifier, using (capital) `U` followed by a source-name 
> and optional template-args, such as `U7_ExtIntILi17EEi` / `U7_ExtIntILi17EEj`
> 
> Neither of these gives a particularly nice demangling. If WG14 seems likely 
> to accept the proposal, you should register a proper mangling as part of the 
> Itanium ABI.
Well shucks, I was so close :)  Looks like I'm just missing the last E/i from 
the second one.  

The second seems consistently changable with the one below (for a dependent 
version), so I think I'm stuck with that.  It DOES show up a little weird 
unfortunately, but at least now it demangles.

I'll ask about an official mangling mechanism for ItaniumABI.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73967/new/

https://reviews.llvm.org/D73967



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


[PATCH] D73967: Implement _ExtInt as an extended int type specifier.

2020-02-06 Thread Erich Keane via Phabricator via cfe-commits
erichkeane updated this revision to Diff 242901.
erichkeane added a comment.

Go through @rsmith 's comments.  Current opens:

1- Getting an official mangling. This will likely need to wait until WG14 has 
seen the paper, in the meantime, use @rsmith suggested version.

2- _Atomic _ExtInt creates invalid IR. Patch to fix this is WIP.

3- Document Calling Convention in Language Extensions.  Text is WIP.

4- Determine whether implicit conversions between these types should be 
acceptable. Pending discussion on CFE-dev.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73967/new/

https://reviews.llvm.org/D73967

Files:
  clang/docs/LanguageExtensions.rst
  clang/docs/ReleaseNotes.rst
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/RecursiveASTVisitor.h
  clang/include/clang/AST/Type.h
  clang/include/clang/AST/TypeLoc.h
  clang/include/clang/AST/TypeProperties.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/Specifiers.h
  clang/include/clang/Basic/TokenKinds.def
  clang/include/clang/Basic/TypeNodes.td
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/DeclSpec.h
  clang/include/clang/Sema/Sema.h
  clang/include/clang/Serialization/TypeBitCodes.def
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/ASTStructuralEquivalence.cpp
  clang/lib/AST/ExprConstant.cpp
  clang/lib/AST/ItaniumMangle.cpp
  clang/lib/AST/MicrosoftMangle.cpp
  clang/lib/AST/Type.cpp
  clang/lib/AST/TypePrinter.cpp
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/CodeGen/CGDebugInfo.h
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/CGRecordLayoutBuilder.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/CodeGen/CodeGenTBAA.cpp
  clang/lib/CodeGen/CodeGenTypes.cpp
  clang/lib/CodeGen/CodeGenTypes.h
  clang/lib/CodeGen/ItaniumCXXABI.cpp
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Parse/ParseExpr.cpp
  clang/lib/Parse/ParseExprCXX.cpp
  clang/lib/Parse/ParseTentative.cpp
  clang/lib/Sema/DeclSpec.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaLookup.cpp
  clang/lib/Sema/SemaTemplate.cpp
  clang/lib/Sema/SemaTemplateDeduction.cpp
  clang/lib/Sema/SemaTemplateVariadic.cpp
  clang/lib/Sema/SemaType.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/test/CodeGen/ext-int-sanitizer.cpp
  clang/test/CodeGen/ext-int.cpp
  clang/test/CodeGenCXX/debug-info-template-partial-specialization.cpp
  clang/test/CodeGenOpenCL/ext-int-shift.cl
  clang/test/SemaCXX/ext-int.cpp
  clang/tools/libclang/CIndex.cpp

Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -1804,6 +1804,8 @@
 DEFAULT_TYPELOC_IMPL(SubstTemplateTypeParm, Type)
 DEFAULT_TYPELOC_IMPL(SubstTemplateTypeParmPack, Type)
 DEFAULT_TYPELOC_IMPL(Auto, Type)
+DEFAULT_TYPELOC_IMPL(ExtInt, Type)
+DEFAULT_TYPELOC_IMPL(DependentExtInt, Type)
 
 bool CursorVisitor::VisitCXXRecordDecl(CXXRecordDecl *D) {
   // Visit the nested-name-specifier, if present.
Index: clang/test/SemaCXX/ext-int.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/ext-int.cpp
@@ -0,0 +1,236 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+template
+struct HasExtInt {
+  _ExtInt(Bounds) b;
+  unsigned _ExtInt(Bounds) b2;
+};
+
+// Delcaring variables:
+_ExtInt(33) Declarations(_ExtInt(48) &Param) { // Useable in params and returns.
+  short _ExtInt(43) a; // expected-error {{'short _ExtInt' is invalid}}
+  _ExtInt(43) long b;  // expected-error {{'long _ExtInt' is invalid}}
+
+  // These should all be fine:
+  const _ExtInt(5) c = 3;
+  const unsigned _ExtInt(5) d; // expected-error {{default initialization of an object of const type 'const unsigned _ExtInt(5)'}}
+  unsigned _ExtInt(5) e = 5;
+  _ExtInt(5) unsigned f;
+
+  _ExtInt(-3) g; // expected-error{{signed _ExtInt must have a size of at least 2}}
+  _ExtInt(0) h; // expected-error{{signed _ExtInt must have a size of at least 2}}
+  _ExtInt(1) i; // expected-error{{signed _ExtInt must have a size of at least 2}}
+  _ExtInt(2) j;;
+  unsigned _ExtInt(0) k;// expected-error{{unsigned _ExtInt must have a size of at least 1}}
+  unsigned _ExtInt(1) l;
+  signed _ExtInt(1) m; // expected-error{{signed _ExtInt must have a size of at least 2}}
+
+  constexpr _ExtInt(6) n = 33; // expected-warning{{implicit conversion from 'int' to 'const _ExtInt(6)' changes value from 33 to -31}}
+  constexpr _ExtInt(7) o = 33;
+
+  // Check LLVM imposed max size.
+  _ExtInt(0xFF) p; // expected-error {{signed _ExtInt of sizes greater than 16777215 not supported}}
+  unsigned _ExtInt(0xFF) q; // expected-error {{unsigned _ExtInt of sizes greater than 16777215 not supported}}
+
+// Ensure template params are instantiated correctly.
+  // expected-error@5{{signed _ExtInt must have a

[PATCH] D68720: Support -fstack-clash-protection for x86

2020-02-06 Thread serge via Phabricator via cfe-commits
serge-sans-paille added a comment.

@craig.topper up :-)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68720/new/

https://reviews.llvm.org/D68720



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


[PATCH] D74129: Prefer __vector over vector keyword for altivec use

2020-02-06 Thread serge via Phabricator via cfe-commits
serge-sans-paille added a subscriber: hans.
serge-sans-paille added a comment.

@hans :  clang 10.0.0rc1  doesn't build on ppc64le in Fedora without that patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74129/new/

https://reviews.llvm.org/D74129



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


[PATCH] D74129: Prefer __vector over vector keyword for altivec use

2020-02-06 Thread serge via Phabricator via cfe-commits
serge-sans-paille created this revision.
serge-sans-paille added a reviewer: rsmith.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
serge-sans-paille added a subscriber: hans.
serge-sans-paille added a comment.
serge-sans-paille added a reviewer: hans.

@hans :  clang 10.0.0rc1  doesn't build on ppc64le in Fedora without that patch.


`vector' uses the keyword-and-predefine mode from gcc, while __vector is
reliably supported.

  

As a side effect, it also makes the code consistent in its usage of __vector.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74129

Files:
  clang/lib/Lex/Lexer.cpp


Index: clang/lib/Lex/Lexer.cpp
===
--- clang/lib/Lex/Lexer.cpp
+++ clang/lib/Lex/Lexer.cpp
@@ -2553,7 +2553,7 @@
 '/', '/', '/', '/',  '/', '/', '/', '/'
   };
   while (CurPtr+16 <= BufferEnd &&
- !vec_any_eq(*(const vector unsigned char*)CurPtr, Slashes))
+ !vec_any_eq(*(const __vector unsigned char*)CurPtr, Slashes))
 CurPtr += 16;
 #else
   // Scan for '/' quickly.  Many block comments are very large.


Index: clang/lib/Lex/Lexer.cpp
===
--- clang/lib/Lex/Lexer.cpp
+++ clang/lib/Lex/Lexer.cpp
@@ -2553,7 +2553,7 @@
 '/', '/', '/', '/',  '/', '/', '/', '/'
   };
   while (CurPtr+16 <= BufferEnd &&
- !vec_any_eq(*(const vector unsigned char*)CurPtr, Slashes))
+ !vec_any_eq(*(const __vector unsigned char*)CurPtr, Slashes))
 CurPtr += 16;
 #else
   // Scan for '/' quickly.  Many block comments are very large.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73637: Fix handling of OO_Spaceship in DecodeOperatorCall

2020-02-06 Thread Stephan Bergmann via Phabricator via cfe-commits
sberg added a comment.

ping


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73637/new/

https://reviews.llvm.org/D73637



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


[PATCH] D74131: [analyzer][taint] Add isTainted debug expression inspection check

2020-02-06 Thread Balázs Benics via Phabricator via cfe-commits
steakhal created this revision.
steakhal added reviewers: NoQ, Szelethus.
steakhal added a project: clang.
Herald added subscribers: cfe-commits, Charusso, donat.nagy, mikhail.ramalho, 
a.sidorin, szepet, baloghadamsoftware, xazax.hun, whisperity.

This patch introduces the `clang_analyzer_isTainted` expression inspection 
check for checking taint.

Using this we could query the analyzer whether the expression used as the 
argument is tainted or not.
This would be useful in tests, where we don't want to issue warning for all 
tainted expressions in a given file (like the `debug.TaintTest` would do) but 
only for certain expressions.

Example usage:

  int read_integer() {
int n;
clang_analyzer_isTainted(n); // expected-warning{{NO}}
scanf("%d", &n);
clang_analyzer_isTainted(n); // expected-warning{{YES}}
clang_analyzer_isTainted(n + 2); // expected-warning{{YES}}
clang_analyzer_isTainted(n > 0); // expected-warning{{YES}}
return n;
  }


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74131

Files:
  clang/docs/analyzer/developer-docs/DebugChecks.rst
  clang/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp


Index: clang/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp
@@ -6,6 +6,7 @@
 //
 
//===--===//
 
+#include "Taint.h"
 #include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
 #include "clang/StaticAnalyzer/Checkers/SValExplainer.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
@@ -46,6 +47,7 @@
   void analyzerHashDump(const CallExpr *CE, CheckerContext &C) const;
   void analyzerDenote(const CallExpr *CE, CheckerContext &C) const;
   void analyzerExpress(const CallExpr *CE, CheckerContext &C) const;
+  void analyzerIsTainted(const CallExpr *CE, CheckerContext &C) const;
 
   typedef void (ExprInspectionChecker::*FnCheck)(const CallExpr *,
  CheckerContext &C) const;
@@ -92,6 +94,7 @@
 .Case("clang_analyzer_hashDump", &ExprInspectionChecker::analyzerHashDump)
 .Case("clang_analyzer_denote", &ExprInspectionChecker::analyzerDenote)
 .Case("clang_analyzer_express", &ExprInspectionChecker::analyzerExpress)
+.StartsWith("clang_analyzer_isTainted", 
&ExprInspectionChecker::analyzerIsTainted)
 .Default(nullptr);
 
   if (!Handler)
@@ -412,6 +415,17 @@
   reportBug(*Str, C);
 }
 
+void ExprInspectionChecker::analyzerIsTainted(const CallExpr *CE,
+  CheckerContext &C) const {
+  if (CE->getNumArgs() != 1) {
+reportBug("clang_analyzer_isTainted() requires exactly one argument", C);
+return;
+  }
+  const bool IsTainted =
+  taint::isTainted(C.getState(), CE->getArg(0), C.getLocationContext());
+  reportBug(IsTainted ? "YES" : "NO", C);
+}
+
 void ento::registerExprInspectionChecker(CheckerManager &Mgr) {
   Mgr.registerChecker();
 }
Index: clang/docs/analyzer/developer-docs/DebugChecks.rst
===
--- clang/docs/analyzer/developer-docs/DebugChecks.rst
+++ clang/docs/analyzer/developer-docs/DebugChecks.rst
@@ -275,6 +275,24 @@
 
   See clang_analyzer_denote().
 
+- ``void clang_analyzer_isTainted(a single argument of any type);``
+
+  Queries the analyzer whether the expression used as argument is tainted or 
not.
+  This is useful in tests, where we don't want to issue warning for all tainted
+  expressions but only check for certain expressions.
+
+  Example usage::
+
+int read_integer() {
+  int n;
+  clang_analyzer_isTainted(n); // expected-warning{{NO}}
+  scanf("%d", &n);
+  clang_analyzer_isTainted(n); // expected-warning{{YES}}
+  clang_analyzer_isTainted(n + 2); // expected-warning{{YES}}
+  clang_analyzer_isTainted(n > 0); // expected-warning{{YES}}
+  return n;
+}
+
 Statistics
 ==
 


Index: clang/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp
@@ -6,6 +6,7 @@
 //
 //===--===//
 
+#include "Taint.h"
 #include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
 #include "clang/StaticAnalyzer/Checkers/SValExplainer.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
@@ -46,6 +47,7 @@
   void analyzerHashDump(const CallExpr *CE, CheckerContext &C) const;
   void analyzerDenote(const CallExpr *CE, CheckerContext &C) const;
   void analyzerExpress(const CallExpr *CE, CheckerContext &C) const;
+  void analyzerIsTainted(const CallExpr *CE, C

[clang-tools-extra] ca9fd22 - [clangd] Set "spelled" flag for constructor references.

2020-02-06 Thread Haojian Wu via cfe-commits

Author: Haojian Wu
Date: 2020-02-06T16:59:45+01:00
New Revision: ca9fd22adb5a633429ea85d2d62e5414ca35ab11

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

LOG: [clangd] Set "spelled" flag for constructor references.

Summary:
DeclarationName for cxx constructor is special, it is not an identifier.
thus the "Spelled" flag are not set for all ctor references, this patch
fixes it.

Reviewers: kbobyrev

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, 
cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang-tools-extra/clangd/index/SymbolCollector.cpp
clang-tools-extra/clangd/index/SymbolID.h
clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/index/SymbolCollector.cpp 
b/clang-tools-extra/clangd/index/SymbolCollector.cpp
index 8a08ae894526..06190914ee8d 100644
--- a/clang-tools-extra/clangd/index/SymbolCollector.cpp
+++ b/clang-tools-extra/clangd/index/SymbolCollector.cpp
@@ -574,7 +574,7 @@ void SymbolCollector::finish() {
   // FIXME: All MacroRefs are marked as Spelled now, but this should be 
checked.
   for (const auto &IDAndRefs : MacroRefs)
 for (const auto &LocAndRole : IDAndRefs.second)
-  CollectRef(IDAndRefs.first, LocAndRole);
+  CollectRef(IDAndRefs.first, LocAndRole, /*Spelled=*/true);
   // Populate Refs slab from DeclRefs.
   llvm::DenseMap> FilesToTokensCache;
   for (auto &DeclAndRef : DeclRefs) {
@@ -592,7 +592,10 @@ void SymbolCollector::finish() {
 const auto *IdentifierToken =
 spelledIdentifierTouching(LocAndRole.first, Tokens);
 DeclarationName Name = DeclAndRef.first->getDeclName();
-bool Spelled = IdentifierToken && Name.isIdentifier() &&
+const auto NameKind = Name.getNameKind();
+bool IsTargetKind = NameKind == DeclarationName::Identifier ||
+NameKind == DeclarationName::CXXConstructorName;
+bool Spelled = IdentifierToken && IsTargetKind &&
Name.getAsString() == IdentifierToken->text(SM);
 CollectRef(*ID, LocAndRole, Spelled);
   }

diff  --git a/clang-tools-extra/clangd/index/SymbolID.h 
b/clang-tools-extra/clangd/index/SymbolID.h
index d715f4d0266c..ec7e73301a68 100644
--- a/clang-tools-extra/clangd/index/SymbolID.h
+++ b/clang-tools-extra/clangd/index/SymbolID.h
@@ -36,6 +36,9 @@ class SymbolID {
   bool operator==(const SymbolID &Sym) const {
 return HashValue == Sym.HashValue;
   }
+  bool operator!=(const SymbolID &Sym) const {
+return !(*this == Sym);
+  }
   bool operator<(const SymbolID &Sym) const {
 return HashValue < Sym.HashValue;
   }

diff  --git a/clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp 
b/clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
index 773260c883c0..d3cd9f542de3 100644
--- a/clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
+++ b/clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
@@ -700,39 +700,70 @@ TEST_F(SymbolCollectorTest, MacrosWithRefFilter) {
   EXPECT_THAT(Refs, IsEmpty());
 }
 
-TEST_F(SymbolCollectorTest, SpelledReference) {
-  Annotations Header(R"cpp(
-  struct Foo;
-  #define MACRO Foo
-  )cpp");
-  Annotations Main(R"cpp(
-  struct $spelled[[Foo]] {
-$spelled[[Foo]]();
-~$spelled[[Foo]]();
+TEST_F(SymbolCollectorTest, SpelledReferences) {
+  struct {
+llvm::StringRef Header;
+llvm::StringRef Main;
+llvm::StringRef TargetSymbolName;
+  } TestCases[] = {
+{
+  R"cpp(
+struct Foo;
+#define MACRO Foo
+  )cpp",
+  R"cpp(
+struct $spelled[[Foo]] {
+  $spelled[[Foo]]();
+  ~$spelled[[Foo]]();
+};
+$spelled[[Foo]] Variable1;
+$implicit[[MACRO]] Variable2;
+  )cpp",
+  "Foo",
+},
+{
+  R"cpp(
+class Foo {
+public:
+  Foo() = default;
+};
+  )cpp",
+  R"cpp(
+void f() { Foo $implicit[[f]]; f = $spelled[[Foo]]();}
+  )cpp",
+  "Foo::Foo" /// constructor.
+},
   };
-  $spelled[[Foo]] Variable1;
-  $implicit[[MACRO]] Variable2;
-  )cpp");
   CollectorOpts.RefFilter = RefKind::All;
   CollectorOpts.RefsInHeaders = false;
-  runSymbolCollector(Header.code(), Main.code());
-  const auto SpelledRanges = Main.ranges("spelled");
-  const auto ImplicitRanges = Main.ranges("implicit");
-  RefSlab::Builder SpelledSlabBuilder, ImplicitSlabBuilder;
-  for (const auto &SymbolAndRefs : Refs) {
-const auto Symbol = SymbolAndRefs.first;
-for (const auto &Ref : SymbolAndRefs.second)
-  if ((Ref.Kind & RefKind::Spelled) != RefKind::Unknown)
-SpelledSlabBuilder.insert(Symbol, Ref);
-  else
-I

[PATCH] D74125: [clangd] Set "spelled" flag for constructor references.

2020-02-06 Thread Haojian Wu via Phabricator via cfe-commits
hokein marked 3 inline comments as done.
hokein added inline comments.



Comment at: clang-tools-extra/clangd/index/SymbolCollector.cpp:597
+bool IsTargetKind = NameKind == DeclarationName::Identifier ||
+  NameKind == DeclarationName::CXXConstructorName;
+bool Spelled = IdentifierToken && IsTargetKind &&

kadircet wrote:
> drive-by: what about destructors?
we aren't interested in destructors (particularly the `~`) as there is a `Foo` 
typeloc in "~[[Foo]]". 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74125/new/

https://reviews.llvm.org/D74125



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


[PATCH] D72857: [SYCL] Driver option to enable SYCL mode and select SYCL version

2020-02-06 Thread Alexey Bader via Phabricator via cfe-commits
bader updated this revision to Diff 242909.
bader marked 2 inline comments as done.
bader added a comment.

Applied Alexey's comments.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72857/new/

https://reviews.llvm.org/D72857

Files:
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Basic/LangOptions.h
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Frontend/InitPreprocessor.cpp
  clang/test/Driver/sycl.c
  clang/test/Preprocessor/sycl-macro.cpp

Index: clang/test/Preprocessor/sycl-macro.cpp
===
--- clang/test/Preprocessor/sycl-macro.cpp
+++ clang/test/Preprocessor/sycl-macro.cpp
@@ -1,5 +1,9 @@
 // RUN: %clang_cc1 %s -E -dM | FileCheck %s
-// RUN: %clang_cc1 %s -fsycl-is-device -E -dM | FileCheck --check-prefix=CHECK-SYCL %s
+// RUN: %clang_cc1 %s -sycl-std=2015 -E -dM | FileCheck --check-prefix=CHECK-SYCL-STD %s
+// RUN: %clang_cc1 %s -sycl-std=1.2.1 -E -dM | FileCheck --check-prefix=CHECK-SYCL-STD %s
+// RUN: %clang_cc1 %s -fsycl-is-device -E -dM | FileCheck --check-prefixes=CHECK-SYCL %s
 
 // CHECK-NOT:#define __SYCL_DEVICE_ONLY__ 1
+// CHECK-NOT:#define CL_SYCL_LANGUAGE_VERSION 121
+// CHECK-SYCL-STD:#define CL_SYCL_LANGUAGE_VERSION 121
 // CHECK-SYCL:#define __SYCL_DEVICE_ONLY__ 1
Index: clang/test/Driver/sycl.c
===
--- clang/test/Driver/sycl.c
+++ clang/test/Driver/sycl.c
@@ -1,5 +1,9 @@
 // RUN: %clang -### -fsycl -c %s 2>&1 | FileCheck %s --check-prefix=ENABLED
 // RUN: %clang -### -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED
+// RUN: %clang -### -fsycl -sycl-std=1.2.1 %s 2>&1 | FileCheck %s --check-prefix=ENABLED
+// RUN: %clang -### -fsycl -sycl-std=121 %s 2>&1 | FileCheck %s --check-prefix=ENABLED
+// RUN: %clang -### -fsycl -sycl-std=2015 %s 2>&1 | FileCheck %s --check-prefix=ENABLED
+// RUN: %clang -### -fsycl -sycl-std=sycl-1.2.1 %s 2>&1 | FileCheck %s --check-prefix=ENABLED
 // RUN: %clang -### -fno-sycl -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED
 // RUN: %clangxx -### -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED
 // RUN: %clangxx -### -fno-sycl %s 2>&1 | FileCheck %s --check-prefix=DISABLED
@@ -7,4 +11,6 @@
 // RUN: %clangxx -### %s 2>&1 | FileCheck %s --check-prefix=DISABLED
 
 // ENABLED: "-cc1"{{.*}} "-fsycl-is-device"
+// ENABLED-SAME: "-sycl-std={{[-.sycl0-9]+}}"
 // DISABLED-NOT: "-fsycl-is-device"
+// DISABLED-NOT: "-sycl-std="
Index: clang/lib/Frontend/InitPreprocessor.cpp
===
--- clang/lib/Frontend/InitPreprocessor.cpp
+++ clang/lib/Frontend/InitPreprocessor.cpp
@@ -450,6 +450,16 @@
 if (LangOpts.FastRelaxedMath)
   Builder.defineMacro("__FAST_RELAXED_MATH__");
   }
+
+  // SYCL Version is set to a value when building SYCL applications
+  switch (LangOpts.getSYCLVersion()) {
+  case LangOptions::SYCLVersionList::SYCL_2015:
+Builder.defineMacro("CL_SYCL_LANGUAGE_VERSION", "121");
+break;
+  case LangOptions::SYCLVersionList::Undefined:
+break;
+  }
+
   // Not "standard" per se, but available even with the -undef flag.
   if (LangOpts.AsmPreprocessor)
 Builder.defineMacro("__ASSEMBLER__");
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -2544,6 +2544,22 @@
   LangStd = OpenCLLangStd;
   }
 
+  // -sycl-std applies to any SYCL source, not only those containing kernels,
+  // but also those using the SYCL API
+  if (const Arg *A = Args.getLastArg(OPT_sycl_std_EQ)) {
+Opts.setSYCLVersion(
+llvm::StringSwitch(A->getValue())
+.Cases("2015", "1.2.1", "121", "sycl-1.2.1",
+   LangOptions::SYCLVersionList::SYCL_2015)
+.Default(LangOptions::SYCLVersionList::Undefined));
+
+if (Opts.getSYCLVersion() == LangOptions::SYCLVersionList::Undefined) {
+  // User has passed an invalid value to the flag, this is an error
+  Diags.Report(diag::err_drv_invalid_value)
+  << A->getAsString(Args) << A->getValue();
+}
+  }
+
   Opts.IncludeDefaultHeader = Args.hasArg(OPT_finclude_default_header);
   Opts.DeclareOpenCLBuiltins = Args.hasArg(OPT_fdeclare_opencl_builtins);
 
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -4023,9 +4023,17 @@
 CmdArgs.push_back(Args.MakeArgString(NormalizedTriple));
   }
 
-  if (Args.hasFlag(options::OPT_fsycl, options::OPT_fno_sycl, false))
+  bool IsSYCL = Args.hasFlag(options::OPT_fsycl, options::OPT_fno_sycl, false);
+  if (IsSYCL)
 CmdArgs.push_back("-fsycl-is-device");
 
+  if (Arg *A =

[PATCH] D74125: [clangd] Set "spelled" flag for constructor references.

2020-02-06 Thread Haojian Wu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGca9fd22adb5a: [clangd] Set "spelled" flag for 
constructor references. (authored by hokein).

Changed prior to commit:
  https://reviews.llvm.org/D74125?vs=242890&id=242911#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74125/new/

https://reviews.llvm.org/D74125

Files:
  clang-tools-extra/clangd/index/SymbolCollector.cpp
  clang-tools-extra/clangd/index/SymbolID.h
  clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp

Index: clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
===
--- clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
+++ clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
@@ -700,39 +700,70 @@
   EXPECT_THAT(Refs, IsEmpty());
 }
 
-TEST_F(SymbolCollectorTest, SpelledReference) {
-  Annotations Header(R"cpp(
-  struct Foo;
-  #define MACRO Foo
-  )cpp");
-  Annotations Main(R"cpp(
-  struct $spelled[[Foo]] {
-$spelled[[Foo]]();
-~$spelled[[Foo]]();
+TEST_F(SymbolCollectorTest, SpelledReferences) {
+  struct {
+llvm::StringRef Header;
+llvm::StringRef Main;
+llvm::StringRef TargetSymbolName;
+  } TestCases[] = {
+{
+  R"cpp(
+struct Foo;
+#define MACRO Foo
+  )cpp",
+  R"cpp(
+struct $spelled[[Foo]] {
+  $spelled[[Foo]]();
+  ~$spelled[[Foo]]();
+};
+$spelled[[Foo]] Variable1;
+$implicit[[MACRO]] Variable2;
+  )cpp",
+  "Foo",
+},
+{
+  R"cpp(
+class Foo {
+public:
+  Foo() = default;
+};
+  )cpp",
+  R"cpp(
+void f() { Foo $implicit[[f]]; f = $spelled[[Foo]]();}
+  )cpp",
+  "Foo::Foo" /// constructor.
+},
   };
-  $spelled[[Foo]] Variable1;
-  $implicit[[MACRO]] Variable2;
-  )cpp");
   CollectorOpts.RefFilter = RefKind::All;
   CollectorOpts.RefsInHeaders = false;
-  runSymbolCollector(Header.code(), Main.code());
-  const auto SpelledRanges = Main.ranges("spelled");
-  const auto ImplicitRanges = Main.ranges("implicit");
-  RefSlab::Builder SpelledSlabBuilder, ImplicitSlabBuilder;
-  for (const auto &SymbolAndRefs : Refs) {
-const auto Symbol = SymbolAndRefs.first;
-for (const auto &Ref : SymbolAndRefs.second)
-  if ((Ref.Kind & RefKind::Spelled) != RefKind::Unknown)
-SpelledSlabBuilder.insert(Symbol, Ref);
-  else
-ImplicitSlabBuilder.insert(Symbol, Ref);
+  for (const auto& T : TestCases) {
+Annotations Header(T.Header);
+Annotations Main(T.Main);
+// Reset the file system.
+InMemoryFileSystem = new llvm::vfs::InMemoryFileSystem;
+runSymbolCollector(Header.code(), Main.code());
+
+const auto SpelledRanges = Main.ranges("spelled");
+const auto ImplicitRanges = Main.ranges("implicit");
+RefSlab::Builder SpelledSlabBuilder, ImplicitSlabBuilder;
+const auto TargetID = findSymbol(Symbols, T.TargetSymbolName).ID;
+for (const auto &SymbolAndRefs : Refs) {
+  const auto ID = SymbolAndRefs.first;
+  if (ID != TargetID)
+continue;
+  for (const auto &Ref : SymbolAndRefs.second)
+if ((Ref.Kind & RefKind::Spelled) != RefKind::Unknown)
+  SpelledSlabBuilder.insert(ID, Ref);
+else
+  ImplicitSlabBuilder.insert(ID, Ref);
+}
+const auto SpelledRefs = std::move(SpelledSlabBuilder).build(),
+   ImplicitRefs = std::move(ImplicitSlabBuilder).build();
+EXPECT_THAT(SpelledRefs,
+Contains(Pair(TargetID, HaveRanges(SpelledRanges;
+EXPECT_THAT(ImplicitRefs,
+Contains(Pair(TargetID, HaveRanges(ImplicitRanges;
   }
-  const auto SpelledRefs = std::move(SpelledSlabBuilder).build(),
- ImplicitRefs = std::move(ImplicitSlabBuilder).build();
-  EXPECT_THAT(SpelledRefs, Contains(Pair(findSymbol(Symbols, "Foo").ID,
- HaveRanges(SpelledRanges;
-  EXPECT_THAT(ImplicitRefs, Contains(Pair(findSymbol(Symbols, "Foo").ID,
-  HaveRanges(ImplicitRanges;
 }
 
 TEST_F(SymbolCollectorTest, NameReferences) {
Index: clang-tools-extra/clangd/index/SymbolID.h
===
--- clang-tools-extra/clangd/index/SymbolID.h
+++ clang-tools-extra/clangd/index/SymbolID.h
@@ -36,6 +36,9 @@
   bool operator==(const SymbolID &Sym) const {
 return HashValue == Sym.HashValue;
   }
+  bool operator!=(const SymbolID &Sym) const {
+return !(*this == Sym);
+  }
   bool operator<(const SymbolID &Sym) const {
 return HashValue < Sym.HashValue;
   }
Index: clang-tools-extra/clangd/index/SymbolCollector.cpp
===
--- clang-tools-extra/clangd/index/SymbolCollector.cpp
+++ clang-tools-extra/clangd/index/SymbolCollector.cpp
@@ -574

[PATCH] D72857: [SYCL] Driver option to enable SYCL mode and select SYCL version

2020-02-06 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: clang/lib/Driver/ToolChains/Clang.cpp:4030-4031
 
+  if (Arg *A = Args.getLastArg(options::OPT_sycl_std_EQ)) {
+A->render(Args, CmdArgs);
+  } else if (IsSYCL) {

Should this option also be controlled by `-fsycl`? 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72857/new/

https://reviews.llvm.org/D72857



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


[PATCH] D71830: [OpenMP][Part 2] Use reusable OpenMP context/traits handling

2020-02-06 Thread Kiran Chandramohan via Phabricator via cfe-commits
kiranchandramohan added inline comments.



Comment at: clang/include/clang/Serialization/ASTRecordReader.h:272
+
+  template <> OpenMPTraitInfo *readUserType() { return readOpenMPTraitInfo(); }
+

jdoerfert wrote:
> kiranchandramohan wrote:
> > Compiler throws up this error.
> > error: explicit specialization in non-namespace scope ‘class 
> > clang::ASTRecordReader’
> Oh, my compiler was happy. Let me rebase and see what the pre-merge bots say 
> so I might get some insight into the problem.
Were you able to reproduce the error? I was using gcc 9.2 compiler.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71830/new/

https://reviews.llvm.org/D71830



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


[PATCH] D72857: [SYCL] Driver option to enable SYCL mode and select SYCL version

2020-02-06 Thread Alexey Bader via Phabricator via cfe-commits
bader marked 7 inline comments as done.
bader added inline comments.



Comment at: clang/lib/Driver/ToolChains/Clang.cpp:4030-4031
 
+  if (Arg *A = Args.getLastArg(options::OPT_sycl_std_EQ)) {
+A->render(Args, CmdArgs);
+  } else if (IsSYCL) {

ABataev wrote:
> Should this option also be controlled by `-fsycl`? 
Make sense to me.
@Ruyk, are you okay with that?

@ABataev, do you have any suggestion on what we should we do if `-sycl-std` 
option is used w/o `-fsycl`? Ignore or report warning/error?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72857/new/

https://reviews.llvm.org/D72857



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


[PATCH] D74134: [ARM][MVE] Add fixed point vector conversion intrinsics

2020-02-06 Thread Mikhail Maltsev via Phabricator via cfe-commits
miyuki created this revision.
miyuki added reviewers: simon_tatham, ostannard, MarkMurrayARM, dmgreen.
Herald added subscribers: llvm-commits, cfe-commits, hiraditya, kristof.beyls.
Herald added projects: clang, LLVM.

This patch implements the following Arm ACLE MVE intrinsics:

- vcvtq_n_*
- vcvtq_m_n_*
- vcvtq_x_n_*

and two corresponding LLVM IR intrinsics:

- int_arm_mve_vcvt_fix (vcvtq_n_*)
- int_arm_mve_vcvt_fix_predicated (vcvtq_m_n_*, vcvtq_x_n_*)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74134

Files:
  clang/include/clang/Basic/arm_mve.td
  clang/test/CodeGen/arm-mve-intrinsics/vcvt.c
  clang/test/Sema/arm-mve-immediates.c
  llvm/include/llvm/IR/IntrinsicsARM.td
  llvm/lib/Target/ARM/ARMInstrMVE.td
  llvm/test/CodeGen/Thumb2/mve-intrinsics/vcvt.ll

Index: llvm/test/CodeGen/Thumb2/mve-intrinsics/vcvt.ll
===
--- llvm/test/CodeGen/Thumb2/mve-intrinsics/vcvt.ll
+++ llvm/test/CodeGen/Thumb2/mve-intrinsics/vcvt.ll
@@ -1,6 +1,21 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc -mtriple=thumbv8.1m.main -mattr=+mve.fp -verify-machineinstrs -o - %s | FileCheck %s
 
+declare <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32)
+declare <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32)
+
+declare <8 x half> @llvm.arm.mve.vcvt.narrow(<8 x half>, <4 x float>, i32)
+declare <8 x half> @llvm.arm.mve.vcvt.narrow.predicated(<8 x half>, <4 x float>, i32, <4 x i1>)
+
+declare <8 x half> @llvm.arm.mve.vcvt.fix.v8f16.v8i16(i32, <8 x i16>, i32)
+declare <4 x float> @llvm.arm.mve.vcvt.fix.v4f32.v4i32(i32, <4 x i32>, i32)
+declare <8 x i16> @llvm.arm.mve.vcvt.fix.v8i16.v8f16(i32, <8 x half>, i32)
+declare <4 x i32> @llvm.arm.mve.vcvt.fix.v4i32.v4f32(i32, <4 x float>, i32)
+declare <8 x half> @llvm.arm.mve.vcvt.fix.predicated.v8f16.v8i16.v8i1(i32, <8 x half>, <8 x i16>, i32, <8 x i1>)
+declare <4 x float> @llvm.arm.mve.vcvt.fix.predicated.v4f32.v4i32.v4i1(i32, <4 x float>, <4 x i32>, i32, <4 x i1>)
+declare <8 x i16> @llvm.arm.mve.vcvt.fix.predicated.v8i16.v8f16.v8i1(i32, <8 x i16>, <8 x half>, i32, <8 x i1>)
+declare <4 x i32> @llvm.arm.mve.vcvt.fix.predicated.v4i32.v4f32.v4i1(i32, <4 x i32>, <4 x float>, i32, <4 x i1>)
+
 define arm_aapcs_vfpcc <8 x half> @test_vcvttq_f16_f32(<8 x half> %a, <4 x float> %b) {
 ; CHECK-LABEL: test_vcvttq_f16_f32:
 ; CHECK:   @ %bb.0: @ %entry
@@ -21,8 +36,6 @@
   ret <8 x half> %0
 }
 
-declare <8 x half> @llvm.arm.mve.vcvt.narrow(<8 x half>, <4 x float>, i32)
-
 define arm_aapcs_vfpcc <8 x half> @test_vcvttq_m_f16_f32(<8 x half> %a, <4 x float> %b, i16 zeroext %p) {
 ; CHECK-LABEL: test_vcvttq_m_f16_f32:
 ; CHECK:   @ %bb.0: @ %entry
@@ -51,6 +64,306 @@
   ret <8 x half> %2
 }
 
-declare <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32)
+define arm_aapcs_vfpcc <8 x half> @test_vcvtq_n_f16_s16(<8 x i16> %a) {
+; CHECK-LABEL: test_vcvtq_n_f16_s16:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vcvt.f16.s16 q0, q0, #1
+; CHECK-NEXT:bx lr
+entry:
+  %0 = call <8 x half> @llvm.arm.mve.vcvt.fix.v8f16.v8i16(i32 0, <8 x i16> %a, i32 1)
+  ret <8 x half> %0
+}
 
-declare <8 x half> @llvm.arm.mve.vcvt.narrow.predicated(<8 x half>, <4 x float>, i32, <4 x i1>)
+define arm_aapcs_vfpcc <8 x half> @test_vcvtq_n_f16_u16(<8 x i16> %a) {
+; CHECK-LABEL: test_vcvtq_n_f16_u16:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vcvt.f16.u16 q0, q0, #2
+; CHECK-NEXT:bx lr
+entry:
+  %0 = call <8 x half> @llvm.arm.mve.vcvt.fix.v8f16.v8i16(i32 1, <8 x i16> %a, i32 2)
+  ret <8 x half> %0
+}
+
+define arm_aapcs_vfpcc <4 x float> @test_vcvtq_n_f32_s32(<4 x i32> %a) {
+; CHECK-LABEL: test_vcvtq_n_f32_s32:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vcvt.f32.s32 q0, q0, #3
+; CHECK-NEXT:bx lr
+entry:
+  %0 = call <4 x float> @llvm.arm.mve.vcvt.fix.v4f32.v4i32(i32 0, <4 x i32> %a, i32 3)
+  ret <4 x float> %0
+}
+
+define arm_aapcs_vfpcc <4 x float> @test_vcvtq_n_f32_u32(<4 x i32> %a) {
+; CHECK-LABEL: test_vcvtq_n_f32_u32:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vcvt.f32.u32 q0, q0, #32
+; CHECK-NEXT:bx lr
+entry:
+  %0 = call <4 x float> @llvm.arm.mve.vcvt.fix.v4f32.v4i32(i32 1, <4 x i32> %a, i32 32)
+  ret <4 x float> %0
+}
+
+define arm_aapcs_vfpcc <8 x i16> @test_vcvtq_n_s16_f16(<8 x half> %a) {
+; CHECK-LABEL: test_vcvtq_n_s16_f16:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vcvt.s16.f16 q0, q0, #1
+; CHECK-NEXT:bx lr
+entry:
+  %0 = call <8 x i16> @llvm.arm.mve.vcvt.fix.v8i16.v8f16(i32 0, <8 x half> %a, i32 1)
+  ret <8 x i16> %0
+}
+
+define arm_aapcs_vfpcc <8 x i16> @test_vcvtq_n_u16_f16(<8 x half> %a) {
+; CHECK-LABEL: test_vcvtq_n_u16_f16:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vcvt.u16.f16 q0, q0, #2
+; CHECK-NEXT:bx lr
+entry:
+  %0 = call <8 x i16> @llvm.arm.mve.vcvt.fix.v8i16.v8f16(i32 1, <8 x half> %a, i32 2)
+  ret <8 x i16> %0
+}
+
+define arm_aapcs_vfpcc <4 x i32> @test_vcvtq_n_s32_f32(<4 x float> %a) {
+; CHECK-L

[PATCH] D73644: [Mips] Add intrinsics for 4-byte and 8-byte MSA loads/stores.

2020-02-06 Thread Simon Atanasyan via Phabricator via cfe-commits
atanasyan added a comment.

I see, thanks. Is there the same or similar functionality in GCC?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73644/new/

https://reviews.llvm.org/D73644



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


[clang] 2694cc3 - [ARM][MVE] Add fixed point vector conversion intrinsics

2020-02-06 Thread Mikhail Maltsev via cfe-commits

Author: Mikhail Maltsev
Date: 2020-02-06T16:49:45Z
New Revision: 2694cc3dca94dbaec15eea40bf69872e0b0d8a5c

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

LOG: [ARM][MVE] Add fixed point vector conversion intrinsics

Summary:
This patch implements the following Arm ACLE MVE intrinsics:
* vcvtq_n_*
* vcvtq_m_n_*
* vcvtq_x_n_*

and two corresponding LLVM IR intrinsics:
* int_arm_mve_vcvt_fix (vcvtq_n_*)
* int_arm_mve_vcvt_fix_predicated (vcvtq_m_n_*, vcvtq_x_n_*)

Reviewers: simon_tatham, ostannard, MarkMurrayARM, dmgreen

Reviewed By: MarkMurrayARM

Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

Added: 


Modified: 
clang/include/clang/Basic/arm_mve.td
clang/test/CodeGen/arm-mve-intrinsics/vcvt.c
clang/test/Sema/arm-mve-immediates.c
llvm/include/llvm/IR/IntrinsicsARM.td
llvm/lib/Target/ARM/ARMInstrMVE.td
llvm/test/CodeGen/Thumb2/mve-intrinsics/vcvt.ll

Removed: 




diff  --git a/clang/include/clang/Basic/arm_mve.td 
b/clang/include/clang/Basic/arm_mve.td
index 9c82050be1ce..4edef930f3b4 100644
--- a/clang/include/clang/Basic/arm_mve.td
+++ b/clang/include/clang/Basic/arm_mve.td
@@ -1098,3 +1098,29 @@ let params = T.All in {
   def vsetq_lane: Intrinsic:$e, Vector:$v, 
imm_lane:$lane),
 (ielt_var $v, $e, $lane)>;
 }
+
+foreach desttype = !listconcat(T.Int16, T.Int32, T.Float) in {
+  defvar is_dest_float = !eq(desttype.kind, "f");
+  defvar is_dest_unsigned = !eq(desttype.kind, "u");
+  // First immediate operand of the LLVM intrinsic
+  defvar unsigned_flag = !if(is_dest_float, (unsignedflag Scalar),
+ !if(is_dest_unsigned, V.True, V.False));
+  // For float->int conversions _n and _x_n intrinsics are not polymorphic
+  // because the signedness of the destination type cannot be inferred.
+  defvar pnt_nx = !if(is_dest_float, PNT_2Type, PNT_None);
+
+  let params = !if(is_dest_float,
+   !if(!eq(desttype.size, 16), T.Int16, T.Int32),
+   !if(!eq(desttype.size, 16), [f16], [f32])) in {
+let pnt = pnt_nx in
+  def "vcvtq_n_"#desttype : Intrinsic,
+(args Vector:$a, imm_1toN:$b),
+(IRInt<"vcvt_fix", [VecOf, Vector]> unsigned_flag, $a, $b)>;
+
+defm "vcvtq" : IntrinsicMX,
+  (args Vector:$a, imm_1toN:$b, Predicate:$p),
+  (IRInt<"vcvt_fix_predicated", [VecOf, Vector, Predicate]>
+ unsigned_flag, $inactive, $a, $b, $p),
+  1, "_n_"#desttype, PNT_2Type, pnt_nx>;
+  }
+}

diff  --git a/clang/test/CodeGen/arm-mve-intrinsics/vcvt.c 
b/clang/test/CodeGen/arm-mve-intrinsics/vcvt.c
index ccee9fd76c7c..a1c99de62ebb 100644
--- a/clang/test/CodeGen/arm-mve-intrinsics/vcvt.c
+++ b/clang/test/CodeGen/arm-mve-intrinsics/vcvt.c
@@ -1,5 +1,6 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
 // RUN: %clang_cc1 -triple thumbv8.1m.main-arm-none-eabi -target-feature 
+mve.fp -mfloat-abi hard -fallow-half-arguments-and-returns -O0 
-disable-O0-optnone -S -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s
+// RUN: %clang_cc1 -DPOLYMORPHIC -triple thumbv8.1m.main-arm-none-eabi 
-target-feature +mve.fp -mfloat-abi hard -fallow-half-arguments-and-returns -O0 
-disable-O0-optnone -S -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s
 
 #include 
 
@@ -24,3 +25,339 @@ float16x8_t test_vcvttq_m_f16_f32(float16x8_t a, 
float32x4_t b, mve_pred16_t p)
 {
 return vcvttq_m_f16_f32(a, b, p);
 }
+
+// CHECK-LABEL: @test_vcvtq_n_f16_s16(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = call <8 x half> 
@llvm.arm.mve.vcvt.fix.v8f16.v8i16(i32 0, <8 x i16> [[A:%.*]], i32 1)
+// CHECK-NEXT:ret <8 x half> [[TMP0]]
+//
+float16x8_t test_vcvtq_n_f16_s16(int16x8_t a)
+{
+#ifdef POLYMORPHIC
+return vcvtq_n(a, 1);
+#else
+return vcvtq_n_f16_s16(a, 1);
+#endif
+}
+
+// CHECK-LABEL: @test_vcvtq_n_f16_u16(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = call <8 x half> 
@llvm.arm.mve.vcvt.fix.v8f16.v8i16(i32 1, <8 x i16> [[A:%.*]], i32 2)
+// CHECK-NEXT:ret <8 x half> [[TMP0]]
+//
+float16x8_t test_vcvtq_n_f16_u16(uint16x8_t a)
+{
+#ifdef POLYMORPHIC
+return vcvtq_n(a, 2);
+#else
+return vcvtq_n_f16_u16(a, 2);
+#endif
+}
+
+// CHECK-LABEL: @test_vcvtq_n_f32_s32(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = call <4 x float> 
@llvm.arm.mve.vcvt.fix.v4f32.v4i32(i32 0, <4 x i32> [[A:%.*]], i32 3)
+// CHECK-NEXT:ret <4 x float> [[TMP0]]
+//
+float32x4_t test_vcvtq_n_f32_s32(int32x4_t a)
+{
+#ifdef POLYMORPHIC
+return vcvtq_n(a, 3);
+#else
+return vcvtq_n_f32_s32(a, 3);
+#endif
+}
+
+// CHECK-LABEL: @test_vcvtq_n_f32_u32(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = 

[PATCH] D74134: [ARM][MVE] Add fixed point vector conversion intrinsics

2020-02-06 Thread Mark Murray via Phabricator via cfe-commits
MarkMurrayARM accepted this revision.
MarkMurrayARM added a comment.
This revision is now accepted and ready to land.

This looks familiar and reassuring.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74134/new/

https://reviews.llvm.org/D74134



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


[PATCH] D72857: [SYCL] Driver option to enable SYCL mode and select SYCL version

2020-02-06 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: clang/lib/Driver/ToolChains/Clang.cpp:4030-4031
 
+  if (Arg *A = Args.getLastArg(options::OPT_sycl_std_EQ)) {
+A->render(Args, CmdArgs);
+  } else if (IsSYCL) {

bader wrote:
> ABataev wrote:
> > Should this option also be controlled by `-fsycl`? 
> Make sense to me.
> @Ruyk, are you okay with that?
> 
> @ABataev, do you have any suggestion on what we should we do if `-sycl-std` 
> option is used w/o `-fsycl`? Ignore or report warning/error?
Mark this option as `NoArgumentUnused` (so the compiler does not report unused 
option) and ignore it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72857/new/

https://reviews.llvm.org/D72857



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


[PATCH] D74134: [ARM][MVE] Add fixed point vector conversion intrinsics

2020-02-06 Thread Mikhail Maltsev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2694cc3dca94: [ARM][MVE] Add fixed point vector conversion 
intrinsics (authored by miyuki).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74134/new/

https://reviews.llvm.org/D74134

Files:
  clang/include/clang/Basic/arm_mve.td
  clang/test/CodeGen/arm-mve-intrinsics/vcvt.c
  clang/test/Sema/arm-mve-immediates.c
  llvm/include/llvm/IR/IntrinsicsARM.td
  llvm/lib/Target/ARM/ARMInstrMVE.td
  llvm/test/CodeGen/Thumb2/mve-intrinsics/vcvt.ll

Index: llvm/test/CodeGen/Thumb2/mve-intrinsics/vcvt.ll
===
--- llvm/test/CodeGen/Thumb2/mve-intrinsics/vcvt.ll
+++ llvm/test/CodeGen/Thumb2/mve-intrinsics/vcvt.ll
@@ -1,6 +1,21 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc -mtriple=thumbv8.1m.main -mattr=+mve.fp -verify-machineinstrs -o - %s | FileCheck %s
 
+declare <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32)
+declare <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32)
+
+declare <8 x half> @llvm.arm.mve.vcvt.narrow(<8 x half>, <4 x float>, i32)
+declare <8 x half> @llvm.arm.mve.vcvt.narrow.predicated(<8 x half>, <4 x float>, i32, <4 x i1>)
+
+declare <8 x half> @llvm.arm.mve.vcvt.fix.v8f16.v8i16(i32, <8 x i16>, i32)
+declare <4 x float> @llvm.arm.mve.vcvt.fix.v4f32.v4i32(i32, <4 x i32>, i32)
+declare <8 x i16> @llvm.arm.mve.vcvt.fix.v8i16.v8f16(i32, <8 x half>, i32)
+declare <4 x i32> @llvm.arm.mve.vcvt.fix.v4i32.v4f32(i32, <4 x float>, i32)
+declare <8 x half> @llvm.arm.mve.vcvt.fix.predicated.v8f16.v8i16.v8i1(i32, <8 x half>, <8 x i16>, i32, <8 x i1>)
+declare <4 x float> @llvm.arm.mve.vcvt.fix.predicated.v4f32.v4i32.v4i1(i32, <4 x float>, <4 x i32>, i32, <4 x i1>)
+declare <8 x i16> @llvm.arm.mve.vcvt.fix.predicated.v8i16.v8f16.v8i1(i32, <8 x i16>, <8 x half>, i32, <8 x i1>)
+declare <4 x i32> @llvm.arm.mve.vcvt.fix.predicated.v4i32.v4f32.v4i1(i32, <4 x i32>, <4 x float>, i32, <4 x i1>)
+
 define arm_aapcs_vfpcc <8 x half> @test_vcvttq_f16_f32(<8 x half> %a, <4 x float> %b) {
 ; CHECK-LABEL: test_vcvttq_f16_f32:
 ; CHECK:   @ %bb.0: @ %entry
@@ -21,8 +36,6 @@
   ret <8 x half> %0
 }
 
-declare <8 x half> @llvm.arm.mve.vcvt.narrow(<8 x half>, <4 x float>, i32)
-
 define arm_aapcs_vfpcc <8 x half> @test_vcvttq_m_f16_f32(<8 x half> %a, <4 x float> %b, i16 zeroext %p) {
 ; CHECK-LABEL: test_vcvttq_m_f16_f32:
 ; CHECK:   @ %bb.0: @ %entry
@@ -51,6 +64,306 @@
   ret <8 x half> %2
 }
 
-declare <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32)
+define arm_aapcs_vfpcc <8 x half> @test_vcvtq_n_f16_s16(<8 x i16> %a) {
+; CHECK-LABEL: test_vcvtq_n_f16_s16:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vcvt.f16.s16 q0, q0, #1
+; CHECK-NEXT:bx lr
+entry:
+  %0 = call <8 x half> @llvm.arm.mve.vcvt.fix.v8f16.v8i16(i32 0, <8 x i16> %a, i32 1)
+  ret <8 x half> %0
+}
 
-declare <8 x half> @llvm.arm.mve.vcvt.narrow.predicated(<8 x half>, <4 x float>, i32, <4 x i1>)
+define arm_aapcs_vfpcc <8 x half> @test_vcvtq_n_f16_u16(<8 x i16> %a) {
+; CHECK-LABEL: test_vcvtq_n_f16_u16:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vcvt.f16.u16 q0, q0, #2
+; CHECK-NEXT:bx lr
+entry:
+  %0 = call <8 x half> @llvm.arm.mve.vcvt.fix.v8f16.v8i16(i32 1, <8 x i16> %a, i32 2)
+  ret <8 x half> %0
+}
+
+define arm_aapcs_vfpcc <4 x float> @test_vcvtq_n_f32_s32(<4 x i32> %a) {
+; CHECK-LABEL: test_vcvtq_n_f32_s32:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vcvt.f32.s32 q0, q0, #3
+; CHECK-NEXT:bx lr
+entry:
+  %0 = call <4 x float> @llvm.arm.mve.vcvt.fix.v4f32.v4i32(i32 0, <4 x i32> %a, i32 3)
+  ret <4 x float> %0
+}
+
+define arm_aapcs_vfpcc <4 x float> @test_vcvtq_n_f32_u32(<4 x i32> %a) {
+; CHECK-LABEL: test_vcvtq_n_f32_u32:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vcvt.f32.u32 q0, q0, #32
+; CHECK-NEXT:bx lr
+entry:
+  %0 = call <4 x float> @llvm.arm.mve.vcvt.fix.v4f32.v4i32(i32 1, <4 x i32> %a, i32 32)
+  ret <4 x float> %0
+}
+
+define arm_aapcs_vfpcc <8 x i16> @test_vcvtq_n_s16_f16(<8 x half> %a) {
+; CHECK-LABEL: test_vcvtq_n_s16_f16:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vcvt.s16.f16 q0, q0, #1
+; CHECK-NEXT:bx lr
+entry:
+  %0 = call <8 x i16> @llvm.arm.mve.vcvt.fix.v8i16.v8f16(i32 0, <8 x half> %a, i32 1)
+  ret <8 x i16> %0
+}
+
+define arm_aapcs_vfpcc <8 x i16> @test_vcvtq_n_u16_f16(<8 x half> %a) {
+; CHECK-LABEL: test_vcvtq_n_u16_f16:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vcvt.u16.f16 q0, q0, #2
+; CHECK-NEXT:bx lr
+entry:
+  %0 = call <8 x i16> @llvm.arm.mve.vcvt.fix.v8i16.v8f16(i32 1, <8 x half> %a, i32 2)
+  ret <8 x i16> %0
+}
+
+define arm_aapcs_vfpcc <4 x i32> @test_vcvtq_n_s32_f32(<4 x float> %a) {
+; CHECK-LABEL: test_vcvtq_n_s32_f32:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vcvt.s32.f32 q0, q0, #3
+; CHECK-NEXT:bx lr
+entry:
+  %0 = call <4 x i32> @llvm.arm.mve.vcvt.fix.v4i32.v4f32(i32 0, <4 x floa

[PATCH] D72857: [SYCL] Driver option to enable SYCL mode and select SYCL version

2020-02-06 Thread Alexey Bader via Phabricator via cfe-commits
bader marked an inline comment as done.
bader added inline comments.



Comment at: clang/lib/Driver/ToolChains/Clang.cpp:4030-4031
 
+  if (Arg *A = Args.getLastArg(options::OPT_sycl_std_EQ)) {
+A->render(Args, CmdArgs);
+  } else if (IsSYCL) {

ABataev wrote:
> bader wrote:
> > ABataev wrote:
> > > Should this option also be controlled by `-fsycl`? 
> > Make sense to me.
> > @Ruyk, are you okay with that?
> > 
> > @ABataev, do you have any suggestion on what we should we do if `-sycl-std` 
> > option is used w/o `-fsycl`? Ignore or report warning/error?
> Mark this option as `NoArgumentUnused` (so the compiler does not report 
> unused option) and ignore it.
Ok. Is it okay if we add one more flag - `CoreOption`? We'd like enable these 
options fir `clang-cl` as well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72857/new/

https://reviews.llvm.org/D72857



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


[PATCH] D72857: [SYCL] Driver option to enable SYCL mode and select SYCL version

2020-02-06 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: clang/lib/Driver/ToolChains/Clang.cpp:4030-4031
 
+  if (Arg *A = Args.getLastArg(options::OPT_sycl_std_EQ)) {
+A->render(Args, CmdArgs);
+  } else if (IsSYCL) {

bader wrote:
> ABataev wrote:
> > bader wrote:
> > > ABataev wrote:
> > > > Should this option also be controlled by `-fsycl`? 
> > > Make sense to me.
> > > @Ruyk, are you okay with that?
> > > 
> > > @ABataev, do you have any suggestion on what we should we do if 
> > > `-sycl-std` option is used w/o `-fsycl`? Ignore or report warning/error?
> > Mark this option as `NoArgumentUnused` (so the compiler does not report 
> > unused option) and ignore it.
> Ok. Is it okay if we add one more flag - `CoreOption`? We'd like enable these 
> options fir `clang-cl` as well.
Hard to say, need to look at the patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72857/new/

https://reviews.llvm.org/D72857



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


[PATCH] D71830: [OpenMP][Part 2] Use reusable OpenMP context/traits handling

2020-02-06 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert marked an inline comment as done.
jdoerfert added inline comments.



Comment at: clang/include/clang/Serialization/ASTRecordReader.h:272
+
+  template <> OpenMPTraitInfo *readUserType() { return readOpenMPTraitInfo(); }
+

kiranchandramohan wrote:
> jdoerfert wrote:
> > kiranchandramohan wrote:
> > > Compiler throws up this error.
> > > error: explicit specialization in non-namespace scope ‘class 
> > > clang::ASTRecordReader’
> > Oh, my compiler was happy. Let me rebase and see what the pre-merge bots 
> > say so I might get some insight into the problem.
> Were you able to reproduce the error? I was using gcc 9.2 compiler.
I have not seen the error yet. I build with clang. Do you happen to have an 
idea how to refactor this? I will look into it with a new gcc asap.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71830/new/

https://reviews.llvm.org/D71830



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


[clang] 318d0ed - Fix warning on unused variables. NFC.

2020-02-06 Thread Michael Liao via cfe-commits

Author: Michael Liao
Date: 2020-02-06T12:21:20-05:00
New Revision: 318d0ede572080f18d0106dbc354e11c88329a84

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

LOG: Fix warning on unused variables. NFC.

Added: 


Modified: 
clang/lib/CodeGen/CGDebugInfo.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGDebugInfo.cpp 
b/clang/lib/CodeGen/CGDebugInfo.cpp
index 0e54e9419356..e171082942f6 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -3667,7 +3667,7 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, 
SourceLocation Loc,
   } else {
 Name = Fn->getName();
 
-if (const auto *BD = dyn_cast(D))
+if (isa(D))
   LinkageName = Name;
 
 Flags |= llvm::DINode::FlagPrototyped;



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


[PATCH] D72876: Create a clang-tidy check to warn when -dealloc is implemented inside an ObjC class category.

2020-02-06 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton accepted this revision.
benhamilton added a comment.

LGTM, just one nit-pick.




Comment at: clang-tools-extra/clang-tidy/objc/DeallocInCategoryCheck.h:24
+/// http://clang.llvm.org/extra/clang-tidy/checks/objc-dealloc-in-category.html
+class DeallocInCategoryCheck : public ClangTidyCheck {
+public:

`class DeallocInCategoryCheck final`



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72876/new/

https://reviews.llvm.org/D72876



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


[PATCH] D68720: Support -fstack-clash-protection for x86

2020-02-06 Thread Craig Topper via Phabricator via cfe-commits
craig.topper accepted this revision.
craig.topper added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68720/new/

https://reviews.llvm.org/D68720



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


[PATCH] D68720: Support -fstack-clash-protection for x86

2020-02-06 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added a comment.

Any plans to merge this feature to 10 release?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68720/new/

https://reviews.llvm.org/D68720



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


[clang] 65f0785 - [ubsan] Omit return value check when return block is unreachable

2020-02-06 Thread Vedant Kumar via cfe-commits

Author: Vedant Kumar
Date: 2020-02-06T10:24:03-08:00
New Revision: 65f0785fff0e45f8cd1b9e90328597197beef899

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

LOG: [ubsan] Omit return value check when return block is unreachable

If the return block is unreachable, clang removes it in
CodeGenFunction::FinishFunction(). This removal can leave dangling
references to values defined in the return block if the return block has
successors, which it /would/ if UBSan's return value check is emitted.

In this case, as the UBSan check wouldn't be reachable, it's better to
simply not emit it.

rdar://59196131

Added: 
clang/test/CodeGenObjC/ubsan-nullability-return-unreachable.m

Modified: 
clang/lib/CodeGen/CGCall.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index cdd3ca474edf..b55d5856d92d 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -3035,6 +3035,11 @@ void CodeGenFunction::EmitReturnValueCheck(llvm::Value 
*RV) {
   if (!CurCodeDecl)
 return;
 
+  // If the return block isn't reachable, neither is this check, so don't emit
+  // it.
+  if (ReturnBlock.isValid() && ReturnBlock.getBlock()->use_empty())
+return;
+
   ReturnsNonNullAttr *RetNNAttr = nullptr;
   if (SanOpts.has(SanitizerKind::ReturnsNonnullAttribute))
 RetNNAttr = CurCodeDecl->getAttr();

diff  --git a/clang/test/CodeGenObjC/ubsan-nullability-return-unreachable.m 
b/clang/test/CodeGenObjC/ubsan-nullability-return-unreachable.m
new file mode 100644
index ..eabc33c91e78
--- /dev/null
+++ b/clang/test/CodeGenObjC/ubsan-nullability-return-unreachable.m
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsanitize=nullability-return -emit-llvm %s -o - -triple 
x86_64-apple-macosx10.10.0 -Wno-objc-root-class | FileCheck %s
+
+// CHECK-LABEL: define internal i8* @"\01-[I init]"
+// CHECK: unreachable
+// CHECK-NEXT: }
+
+#pragma clang assume_nonnull begin
+@interface I
+- (instancetype)init __attribute__((unavailable));
+@end
+@implementation I
+- (instancetype)init __attribute__((unavailable)) { __builtin_unreachable(); }
+@end
+#pragma clang assume_nonnull end



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


[PATCH] D68720: Support -fstack-clash-protection for x86

2020-02-06 Thread Sylvestre Ledru via Phabricator via cfe-commits
sylvestre.ledru added a comment.

In D68720#1862050 , @xbolva00 wrote:

> Any plans to merge this feature to 10 release?


I would love to have it in -10 for Firefox !


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68720/new/

https://reviews.llvm.org/D68720



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


[PATCH] D73842: [xray][clang] Always add xray-skip-entry/exit and xray-ignore-loops attrs

2020-02-06 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added a comment.

I can commit this for you, but is it possible to write a test case?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73842/new/

https://reviews.llvm.org/D73842



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


[clang-tools-extra] d5e6e0a - Fix build after D74112

2020-02-06 Thread Kirill Bobyrev via cfe-commits

Author: Kirill Bobyrev
Date: 2020-02-06T11:41:17+01:00
New Revision: d5e6e0a58b188627084d4714a4b2862c529870f8

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

LOG: Fix build after D74112

Added: 


Modified: 
clang-tools-extra/clangd/unittests/RenameTests.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/unittests/RenameTests.cpp 
b/clang-tools-extra/clangd/unittests/RenameTests.cpp
index 43e6c778a7ad..2aaf45eb7563 100644
--- a/clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ b/clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -440,23 +440,6 @@ TEST(RenameTest, WithinFileRename) {
 template  class Z> struct Bar { };
 template <> struct Bar<[[Foo]]> {};
   )cpp",
-
-  {
-  // Implicit references in macro expansions.
-  R"cpp(
-class [[Fo^o]] {};
-#define FooFoo Foo
-#define FOO Foo
-  )cpp",
-  R"cpp(
-#include "foo.h"
-void bar() {
-  [[Foo]] x;
-  FOO y;
-  FooFoo z;
-}
-  )cpp",
-  },
   };
   for (llvm::StringRef T : Tests) {
 SCOPED_TRACE(T);
@@ -909,6 +892,22 @@ TEST(CrossFileRenameTests, WithUpToDateIndex) {
 }
   )cpp",
   },
+  {
+  // Implicit references in macro expansions.
+  R"cpp(
+class [[Fo^o]] {};
+#define FooFoo Foo
+#define FOO Foo
+  )cpp",
+  R"cpp(
+#include "foo.h"
+void bar() {
+  [[Foo]] x;
+  FOO y;
+  FooFoo z;
+}
+  )cpp",
+  },
   };
 
   for (const auto& T : Cases) {



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


[PATCH] D74144: [OPENMP50]Add basic support for array-shaping operation.

2020-02-06 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev created this revision.
ABataev added reviewers: rjmccall, rsmith.
Herald added subscribers: arphaman, guansong.
Herald added a reviewer: jdoerfert.
Herald added a project: clang.

Added basic representation and parsing/sema handling of array-shaping
operations. Array shaping expression is an expression of form ([s0]..[sn])base,
where s0, ..., sn must be a positive integer, base - a pointer. This
expression is a kind of cast operation that converts pointer expression
into an array-like kind of expression.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74144

Files:
  clang/include/clang-c/Index.h
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/BuiltinTypes.def
  clang/include/clang/AST/ExprOpenMP.h
  clang/include/clang/AST/RecursiveASTVisitor.h
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/StmtNodes.td
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/Sema.h
  clang/include/clang/Serialization/ASTBitCodes.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/Expr.cpp
  clang/lib/AST/ExprClassification.cpp
  clang/lib/AST/ExprConstant.cpp
  clang/lib/AST/ItaniumMangle.cpp
  clang/lib/AST/NSAPI.cpp
  clang/lib/AST/StmtPrinter.cpp
  clang/lib/AST/StmtProfile.cpp
  clang/lib/AST/Type.cpp
  clang/lib/AST/TypeLoc.cpp
  clang/lib/Parse/ParseExpr.cpp
  clang/lib/Sema/SemaExceptionSpec.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTCommon.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTReaderStmt.cpp
  clang/lib/Serialization/ASTWriterStmt.cpp
  clang/lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp
  clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
  clang/test/OpenMP/parallel_reduction_messages.c
  clang/test/OpenMP/task_ast_print.cpp
  clang/test/OpenMP/task_depend_messages.cpp
  clang/tools/libclang/CIndex.cpp
  clang/tools/libclang/CXCursor.cpp

Index: clang/tools/libclang/CXCursor.cpp
===
--- clang/tools/libclang/CXCursor.cpp
+++ clang/tools/libclang/CXCursor.cpp
@@ -379,6 +379,10 @@
 K = CXCursor_OMPArraySectionExpr;
 break;
 
+  case Stmt::OMPArrayShapingExprClass:
+K = CXCursor_OMPArrayShapingExpr;
+break;
+
   case Stmt::BinaryOperatorClass:
 K = CXCursor_BinaryOperator;
 break;
Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -5174,6 +5174,8 @@
   return cxstring::createRef("ArraySubscriptExpr");
   case CXCursor_OMPArraySectionExpr:
   return cxstring::createRef("OMPArraySectionExpr");
+  case CXCursor_OMPArrayShapingExpr:
+  return cxstring::createRef("OMPArrayShapingExpr");
   case CXCursor_BinaryOperator:
   return cxstring::createRef("BinaryOperator");
   case CXCursor_CompoundAssignOperator:
Index: clang/test/OpenMP/task_depend_messages.cpp
===
--- clang/test/OpenMP/task_depend_messages.cpp
+++ clang/test/OpenMP/task_depend_messages.cpp
@@ -1,6 +1,8 @@
-// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - -std=c++11 %s -Wuninitialized
+// RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -ferror-limit 100 -o - -std=c++11 %s -Wuninitialized
+// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -fopenmp-version=50 -ferror-limit 100 -o - -std=c++11 %s -Wuninitialized
 
-// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -o - -std=c++11 %s -Wuninitialized
+// RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -ferror-limit 100 -o - -std=c++11 %s -Wuninitialized
+// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -fopenmp-version=50 -ferror-limit 100 -o - -std=c++11 %s -Wuninitialized
 
 void foo() {
 }
@@ -30,14 +32,14 @@
   #pragma omp task depend (source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}}
   #pragma omp task depend (in : argc)) // expected-warning {{extra tokens at the end of '#pragma omp task' are ignored}}
   #pragma omp task depend (out: ) // expected-error {{expected expression}}
-  #pragma omp task depend (inout : foobool(argc)), depend (in, argc) // expected-error {{expected addressable lvalue expression, array element or array section}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected expression}}
+  #pragma omp task depend (inout : foobool(argc)), depend (in, argc) // omp50-error {{expected addressable lvalue expression, array element, array section or array shaping expression}} omp45-error {{expected addressable lvalue expression, array element or array section}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected expression}}
   #pragma omp task depend (out :S1) // expected-error {{'S1' does not 

[PATCH] D68720: Support -fstack-clash-protection for x86

2020-02-06 Thread serge via Phabricator via cfe-commits
serge-sans-paille added a subscriber: hans.
serge-sans-paille added a comment.

I would love too, @hans what do you think?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68720/new/

https://reviews.llvm.org/D68720



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


[PATCH] D72876: Create a clang-tidy check to warn when -dealloc is implemented inside an ObjC class category.

2020-02-06 Thread Michael Wyman via Phabricator via cfe-commits
mwyman updated this revision to Diff 242947.
mwyman marked an inline comment as done.
mwyman added a comment.

Make check class `final`, based on feedback.`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72876/new/

https://reviews.llvm.org/D72876

Files:
  clang-tools-extra/clang-tidy/objc/CMakeLists.txt
  clang-tools-extra/clang-tidy/objc/DeallocInCategoryCheck.cpp
  clang-tools-extra/clang-tidy/objc/DeallocInCategoryCheck.h
  clang-tools-extra/clang-tidy/objc/ObjCTidyModule.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/docs/clang-tidy/checks/objc-dealloc-in-category.rst
  clang-tools-extra/test/clang-tidy/checkers/objc-dealloc-in-category.m

Index: clang-tools-extra/test/clang-tidy/checkers/objc-dealloc-in-category.m
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/objc-dealloc-in-category.m
@@ -0,0 +1,47 @@
+// RUN: %check_clang_tidy %s objc-dealloc-in-category %t
+
+@interface NSObject
+// Used to quash warning about missing base class.
+- (void)dealloc;
+@end
+
+@interface Foo : NSObject
+@end
+
+@implementation Foo
+- (void)dealloc {
+  // No warning should be generated here.
+}
+@end
+
+@interface Bar : NSObject
+@end
+
+@interface Bar (BarCategory)
+@end
+
+@implementation Bar (BarCategory)
++ (void)dealloc {
+  // Should not trigger on class methods.
+}
+
+- (void)dealloc {
+  // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: category 'BarCategory' should not implement -dealloc [objc-dealloc-in-category]
+}
+@end
+
+@interface Baz : NSObject
+@end
+
+@implementation Baz
+- (void)dealloc {
+  // Should not trigger on implementation in the class itself, even with
+  // it declared in the category (below).
+}
+@end
+
+@interface Baz (BazCategory)
+// A declaration in a category @interface does not by itself provide an
+// overriding implementation, and should not generate a warning.
+- (void)dealloc;
+@end
Index: clang-tools-extra/docs/clang-tidy/checks/objc-dealloc-in-category.rst
===
--- /dev/null
+++ clang-tools-extra/docs/clang-tidy/checks/objc-dealloc-in-category.rst
@@ -0,0 +1,13 @@
+.. title:: clang-tidy - objc-dealloc-in-category
+
+objc-dealloc-in-category
+
+
+Finds implementations of ``-dealloc`` in Objective-C categories. The category
+implementation will override any ``-dealloc`` in the class implementation,
+potentially causing issues.
+
+Classes implement ``-dealloc`` to perform important actions to deallocate
+an object. If a category on the class implements ``-dealloc``, it will
+override the class's implementation and unexpected deallocation behavior
+may occur.
Index: clang-tools-extra/docs/clang-tidy/checks/list.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/list.rst
+++ clang-tools-extra/docs/clang-tidy/checks/list.rst
@@ -232,6 +232,7 @@
`mpi-buffer-deref `_, "Yes"
`mpi-type-mismatch `_, "Yes"
`objc-avoid-nserror-init `_,
+   `objc-dealloc-in-category `_,
`objc-forbidden-subclassing `_,
`objc-missing-hash `_,
`objc-property-declaration `_, "Yes"
Index: clang-tools-extra/docs/ReleaseNotes.rst
===
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -81,13 +81,18 @@
   ` check.
 
   Checks for usages of identifiers reserved for use by the implementation.
-  
+
 - New :doc:`cert-oop57-cpp
   ` check.
-  
+
   Flags use of the `C` standard library functions ``memset``, ``memcpy`` and
   ``memcmp`` and similar derivatives on non-trivial types.
 
+- New :doc:`objc-dealloc-in-category
+  ` check.
+
+  Finds implementations of -dealloc in Objective-C categories.
+
 New check aliases
 ^
 
@@ -111,8 +116,8 @@
 
 - Improved :doc:`readability-redundant-string-init
   ` check now supports a
-  `StringNames` option enabling its application to custom string classes. The 
-  check now detects in class initializers and constructor initializers which 
+  `StringNames` option enabling its application to custom string classes. The
+  check now detects in class initializers and constructor initializers which
   are deemed to be redundant.
 
 Renamed checks
Index: clang-tools-extra/clang-tidy/objc/ObjCTidyModule.cpp
===
--- clang-tools-extra/clang-tidy/objc/ObjCTidyModule.cpp
+++ clang-tools-extra/clang-tidy/objc/ObjCTidyModule.cpp
@@ -10,6 +10,7 @@
 #include "../ClangTidyModule.h"
 #include "../ClangTidyModuleRegistry.h"
 #include "AvoidNSErrorInitCheck.h"
+#include "DeallocInCategoryCheck.h"
 #include "ForbiddenSubclassingCheck.h"
 #include "MissingHashCheck.h"
 #include "PropertyDeclarationCheck.h"
@@ -26,6 +27,8 @@
   void addCheckFactories(ClangTi

[PATCH] D72876: Create a clang-tidy check to warn when -dealloc is implemented inside an ObjC class category.

2020-02-06 Thread Michael Wyman via Phabricator via cfe-commits
mwyman added a comment.

Updated based on feedback.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72876/new/

https://reviews.llvm.org/D72876



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


[PATCH] D74146: [SytemZ] Disable vector ABI when using option -march=arch[8|9|10]

2020-02-06 Thread Kai Nacke via Phabricator via cfe-commits
Kai created this revision.
Kai added a reviewer: uweigand.
Herald added subscribers: llvm-commits, cfe-commits, hiraditya.
Herald added projects: clang, LLVM.

When specifying -march=arch[8|9|10], those CPU types do NOT support the vector 
extension. In this case the vector ABI must be disabled. The generated data 
layout should NOT contain 64-v128.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74146

Files:
  clang/test/CodeGen/target-data.c
  llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp


Index: llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp
===
--- llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp
+++ llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp
@@ -42,7 +42,8 @@
   bool VectorABI = true;
   bool SoftFloat = false;
   if (CPU.empty() || CPU == "generic" ||
-  CPU == "z10" || CPU == "z196" || CPU == "zEC12")
+  CPU == "z10" || CPU == "z196" || CPU == "zEC12" ||
+  CPU == "arch8" || CPU == "arch9" || CPU == "arch10")
 VectorABI = false;
 
   SmallVector Features;
Index: clang/test/CodeGen/target-data.c
===
--- clang/test/CodeGen/target-data.c
+++ clang/test/CodeGen/target-data.c
@@ -193,6 +193,18 @@
 
 // RUN: %clang_cc1 -triple s390x-unknown -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=SYSTEMZ
+// RUN: %clang_cc1 -triple s390x-unknown -target-cpu z10 -o - -emit-llvm %s | \
+// RUN: FileCheck %s -check-prefix=SYSTEMZ
+// RUN: %clang_cc1 -triple s390x-unknown -target-cpu arch8 -o - -emit-llvm %s 
| \
+// RUN: FileCheck %s -check-prefix=SYSTEMZ
+// RUN: %clang_cc1 -triple s390x-unknown -target-cpu z196 -o - -emit-llvm %s | 
\
+// RUN: FileCheck %s -check-prefix=SYSTEMZ
+// RUN: %clang_cc1 -triple s390x-unknown -target-cpu arch9 -o - -emit-llvm %s 
| \
+// RUN: FileCheck %s -check-prefix=SYSTEMZ
+// RUN: %clang_cc1 -triple s390x-unknown -target-cpu zEC12 -o - -emit-llvm %s 
| \
+// RUN: FileCheck %s -check-prefix=SYSTEMZ
+// RUN: %clang_cc1 -triple s390x-unknown -target-cpu arch10 -o - -emit-llvm %s 
| \
+// RUN: FileCheck %s -check-prefix=SYSTEMZ
 // RUN: %clang_cc1 -triple s390x-unknown -target-cpu z13 -target-feature 
+soft-float -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=SYSTEMZ
 // SYSTEMZ: target datalayout = 
"E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64"


Index: llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp
===
--- llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp
+++ llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp
@@ -42,7 +42,8 @@
   bool VectorABI = true;
   bool SoftFloat = false;
   if (CPU.empty() || CPU == "generic" ||
-  CPU == "z10" || CPU == "z196" || CPU == "zEC12")
+  CPU == "z10" || CPU == "z196" || CPU == "zEC12" ||
+  CPU == "arch8" || CPU == "arch9" || CPU == "arch10")
 VectorABI = false;
 
   SmallVector Features;
Index: clang/test/CodeGen/target-data.c
===
--- clang/test/CodeGen/target-data.c
+++ clang/test/CodeGen/target-data.c
@@ -193,6 +193,18 @@
 
 // RUN: %clang_cc1 -triple s390x-unknown -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=SYSTEMZ
+// RUN: %clang_cc1 -triple s390x-unknown -target-cpu z10 -o - -emit-llvm %s | \
+// RUN: FileCheck %s -check-prefix=SYSTEMZ
+// RUN: %clang_cc1 -triple s390x-unknown -target-cpu arch8 -o - -emit-llvm %s | \
+// RUN: FileCheck %s -check-prefix=SYSTEMZ
+// RUN: %clang_cc1 -triple s390x-unknown -target-cpu z196 -o - -emit-llvm %s | \
+// RUN: FileCheck %s -check-prefix=SYSTEMZ
+// RUN: %clang_cc1 -triple s390x-unknown -target-cpu arch9 -o - -emit-llvm %s | \
+// RUN: FileCheck %s -check-prefix=SYSTEMZ
+// RUN: %clang_cc1 -triple s390x-unknown -target-cpu zEC12 -o - -emit-llvm %s | \
+// RUN: FileCheck %s -check-prefix=SYSTEMZ
+// RUN: %clang_cc1 -triple s390x-unknown -target-cpu arch10 -o - -emit-llvm %s | \
+// RUN: FileCheck %s -check-prefix=SYSTEMZ
 // RUN: %clang_cc1 -triple s390x-unknown -target-cpu z13 -target-feature +soft-float -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=SYSTEMZ
 // SYSTEMZ: target datalayout = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74103: Implement P1766R1: diagnose giving non-C-compatible classes a typedef name for linkage purposes.

2020-02-06 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

Oh thank goodness, they finally fixed this.




Comment at: clang/lib/Sema/SemaDecl.cpp:4365
+  // C++ [dcl.typedef]p9: [P1766R1]
+  //   An unnamed class with a typedef name for linkage purposes shall not
+  if (RD->isInvalidDecl())

Starting the quote here makes it look like it's describing the invalid-decl 
short-circuit just below.



Comment at: clang/lib/Sema/SemaDecl.cpp:4394
+isa(D))
+  continue;
+

This is essentially part of the next paragraph.

I believe `friend` declarations also do not declare "members", under the same 
logic allowing `static_assert`.



Comment at: clang/lib/Sema/SemaDecl.cpp:4404
+if (MemberRD->isLambda())
+  return {NonCLikeKind::Lambda, MemberRD->getSourceRange()};
+

Do lambdas in nested expressions really get added to the class's decls list?  I 
wouldn't have expected that, but it definitely makes this check a lot easier.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74103/new/

https://reviews.llvm.org/D74103



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


[PATCH] D74094: [IRGen] Emit lifetime intrinsics around temporary aggregate argument allocas

2020-02-06 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: clang/lib/CodeGen/CGCall.cpp:3697
+
+  args.add(EmitAnyExpr(E, ArgSlot), type);
 }

If the argument type has a C++ destructor, will we end its lifetime before we 
call destructors at the end of the full-expression?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74094/new/

https://reviews.llvm.org/D74094



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


[PATCH] D73967: Implement _ExtInt as an extended int type specifier.

2020-02-06 Thread Erich Keane via Phabricator via cfe-commits
erichkeane updated this revision to Diff 242961.
erichkeane added a comment.

Deal with _Atomic.  There isn't really a sensible way to do _Atomics on all 
platforms for these types, so this patch now limits to the LLVM atomic 
instruction limits, which is powers-of-2 >=8.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73967/new/

https://reviews.llvm.org/D73967

Files:
  clang/docs/LanguageExtensions.rst
  clang/docs/ReleaseNotes.rst
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/RecursiveASTVisitor.h
  clang/include/clang/AST/Type.h
  clang/include/clang/AST/TypeLoc.h
  clang/include/clang/AST/TypeProperties.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/Specifiers.h
  clang/include/clang/Basic/TokenKinds.def
  clang/include/clang/Basic/TypeNodes.td
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/DeclSpec.h
  clang/include/clang/Sema/Sema.h
  clang/include/clang/Serialization/TypeBitCodes.def
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/ASTStructuralEquivalence.cpp
  clang/lib/AST/ExprConstant.cpp
  clang/lib/AST/ItaniumMangle.cpp
  clang/lib/AST/MicrosoftMangle.cpp
  clang/lib/AST/Type.cpp
  clang/lib/AST/TypePrinter.cpp
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/CodeGen/CGDebugInfo.h
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/CGRecordLayoutBuilder.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/CodeGen/CodeGenTBAA.cpp
  clang/lib/CodeGen/CodeGenTypes.cpp
  clang/lib/CodeGen/CodeGenTypes.h
  clang/lib/CodeGen/ItaniumCXXABI.cpp
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Parse/ParseExpr.cpp
  clang/lib/Parse/ParseExprCXX.cpp
  clang/lib/Parse/ParseTentative.cpp
  clang/lib/Sema/DeclSpec.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaLookup.cpp
  clang/lib/Sema/SemaTemplate.cpp
  clang/lib/Sema/SemaTemplateDeduction.cpp
  clang/lib/Sema/SemaTemplateVariadic.cpp
  clang/lib/Sema/SemaType.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/test/CodeGen/ext-int-sanitizer.cpp
  clang/test/CodeGen/ext-int.cpp
  clang/test/CodeGenCXX/debug-info-template-partial-specialization.cpp
  clang/test/CodeGenOpenCL/ext-int-shift.cl
  clang/test/SemaCXX/ext-int.cpp
  clang/tools/libclang/CIndex.cpp

Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -1804,6 +1804,8 @@
 DEFAULT_TYPELOC_IMPL(SubstTemplateTypeParm, Type)
 DEFAULT_TYPELOC_IMPL(SubstTemplateTypeParmPack, Type)
 DEFAULT_TYPELOC_IMPL(Auto, Type)
+DEFAULT_TYPELOC_IMPL(ExtInt, Type)
+DEFAULT_TYPELOC_IMPL(DependentExtInt, Type)
 
 bool CursorVisitor::VisitCXXRecordDecl(CXXRecordDecl *D) {
   // Visit the nested-name-specifier, if present.
Index: clang/test/SemaCXX/ext-int.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/ext-int.cpp
@@ -0,0 +1,236 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+template
+struct HasExtInt {
+  _ExtInt(Bounds) b;
+  unsigned _ExtInt(Bounds) b2;
+};
+
+// Delcaring variables:
+_ExtInt(33) Declarations(_ExtInt(48) &Param) { // Useable in params and returns.
+  short _ExtInt(43) a; // expected-error {{'short _ExtInt' is invalid}}
+  _ExtInt(43) long b;  // expected-error {{'long _ExtInt' is invalid}}
+
+  // These should all be fine:
+  const _ExtInt(5) c = 3;
+  const unsigned _ExtInt(5) d; // expected-error {{default initialization of an object of const type 'const unsigned _ExtInt(5)'}}
+  unsigned _ExtInt(5) e = 5;
+  _ExtInt(5) unsigned f;
+
+  _ExtInt(-3) g; // expected-error{{signed _ExtInt must have a size of at least 2}}
+  _ExtInt(0) h; // expected-error{{signed _ExtInt must have a size of at least 2}}
+  _ExtInt(1) i; // expected-error{{signed _ExtInt must have a size of at least 2}}
+  _ExtInt(2) j;;
+  unsigned _ExtInt(0) k;// expected-error{{unsigned _ExtInt must have a size of at least 1}}
+  unsigned _ExtInt(1) l;
+  signed _ExtInt(1) m; // expected-error{{signed _ExtInt must have a size of at least 2}}
+
+  constexpr _ExtInt(6) n = 33; // expected-warning{{implicit conversion from 'int' to 'const _ExtInt(6)' changes value from 33 to -31}}
+  constexpr _ExtInt(7) o = 33;
+
+  // Check LLVM imposed max size.
+  _ExtInt(0xFF) p; // expected-error {{signed _ExtInt of sizes greater than 16777215 not supported}}
+  unsigned _ExtInt(0xFF) q; // expected-error {{unsigned _ExtInt of sizes greater than 16777215 not supported}}
+
+// Ensure template params are instantiated correctly.
+  // expected-error@5{{signed _ExtInt must have a size of at least 2}}
+  // expected-error@6{{unsigned _ExtInt must have a size of at least 1}}
+  // expected-note@+1{{in instantiation of template class }}
+  HasExtInt<-1> r;
+  // expected-error@5{{signed _ExtInt must have a size of at least 2}}

[PATCH] D74150: Update hwasan docs to cover outlined checks and globals.

2020-02-06 Thread Peter Collingbourne via Phabricator via cfe-commits
pcc created this revision.
pcc added reviewers: eugenis, hctim, kcc.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74150

Files:
  clang/docs/HardwareAssistedAddressSanitizerDesign.rst

Index: clang/docs/HardwareAssistedAddressSanitizerDesign.rst
===
--- clang/docs/HardwareAssistedAddressSanitizerDesign.rst
+++ clang/docs/HardwareAssistedAddressSanitizerDesign.rst
@@ -67,43 +67,54 @@
 
 Memory Accesses
 ---
-All memory accesses are prefixed with an inline instruction sequence that
-verifies the tags. Currently, the following sequence is used:
+In the majority of cases, memory accesses are prefixed with a call to
+an outlined instruction sequence that verifies the tags. The code size
+and performance overhead of the call is reduced by using a custom calling
+convention that preserves most registers and is specialized to the register
+containing the address and the type and size of the memory access. Currently,
+the following sequence is used:
 
 .. code-block:: none
 
   // int foo(int *a) { return *a; }
-  // clang -O2 --target=aarch64-linux -fsanitize=hwaddress -fsanitize-recover=hwaddress -c load.c
+  // clang -O2 --target=aarch64-linux-android30 -fsanitize=hwaddress -S -o - load.c
+  [...]
   foo:
-   0:	9008 	adrp	x8, 0 <__hwasan_shadow>
-   4:	f9400108 	ldr	x8, [x8] // shadow base (to be resolved by the loader)
-   8:	d344dc09 	ubfx	x9, x0, #4, #52  // shadow offset
-   c:	38696909 	ldrb	w9, [x8, x9] // load shadow tag
-  10:	d378fc08 	lsr	x8, x0, #56  // extract address tag
-  14:	6b09011f 	cmp	w8, w9   // compare tags
-  18:	5461 	b.ne	24 // jump to short tag handler on mismatch
-  1c:	b940 	ldr	w0, [x0] // original load
-  20:	d65f03c0 	ret
-  24:	7100413f 	cmp	w9, #0x10// is this a short tag?
-  28:	54000142 	b.cs	50 // if not, trap
-  2c:	12000c0a 	and	w10, w0, #0xf// find the address's position in the short granule
-  30:	11000d4a 	add	w10, w10, #0x3   // adjust to the position of the last byte loaded
-  34:	6b09015f 	cmp	w10, w9  // check that position is in bounds
-  38:	54c2 	b.cs	50 // if not, trap
-  3c:	9240dc09 	and	x9, x0, #0xff
-  40:	b2400d29 	orr	x9, x9, #0xf // compute address of last byte of granule
-  44:	39400129 	ldrb	w9, [x9] // load tag from it
-  48:	6b09011f 	cmp	w8, w9   // compare with pointer tag
-  4c:	54fffe80 	b.eq	1c // if so, continue
-  50:	d4212440 	brk	#0x922   // otherwise trap
-  54:	b940 	ldr	w0, [x0] // tail duplicated original load (to handle recovery)
-  58:	d65f03c0 	ret
-
-Alternatively, memory accesses are prefixed with a function call.
-On AArch64, a function call is used by default in trapping mode. The code size
-and performance overhead of the call is reduced by using a custom calling
-convention that preserves most registers and is specialized to the register
-containing the address and the type and size of the memory access.
+  	str	x30, [sp, #-16]!
+	adrp	x9, :got:__hwasan_shadow// load shadow address from GOT into x9
+	ldr	x9, [x9, :got_lo12:__hwasan_shadow]
+	bl	__hwasan_check_x0_2_short   // call outlined tag check
+// (arguments: x0 = address, x9 = shadow base)
+	ldr	w0, [x0]// inline load
+	ldr	x30, [sp], #16
+	ret
+
+  [...]
+  __hwasan_check_x0_2_short:
+  	ubfx	x16, x0, #4, #52// shadow offset
+	ldrb	w16, [x9, x16]  // load shadow tag
+	cmp	x16, x0, lsr #56// extract address tag, compare with shadow tag
+	b.ne	.Ltmp0  // jump to short tag handler on mismatch
+  .Ltmp1:
+	ret
+  .Ltmp0:
+	cmp	w16, #15// is this a short tag?
+	b.hi	.Ltmp2  // if not, error
+	and	x17, x0, #0xf   // find the address's position in the short granule
+	add	x17, x17, #3// adjust to the position of the last byte loaded
+	cmp	w16, w17// check that position is in bounds
+	b.ls	.Ltmp2  // if not, error
+	orr	x16, x0, #0xf   // compute address of last byte of granule
+	ldrb	w16, [x16]  // load tag from it
+	cmp	x16, x0, lsr #56// compare with pointer tag
+	b.eq	.Ltmp1  // if matches, continue
+  .Ltmp2:
+	stp	x0, x1, [sp, #-256]!// save original x0, x1 on stack (they will be overwritten)
+	stp	x29, x30, [sp, #232]// create frame record
+	mov	x1, 

[clang] 208470d - [FPEnv][X86] Platform-specific builtin constrained FP enablement

2020-02-06 Thread Kevin P. Neal via cfe-commits

Author: Kevin P. Neal
Date: 2020-02-06T14:20:44-05:00
New Revision: 208470dd5d0a46bc3c24b66489b687eda4954262

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

LOG: [FPEnv][X86] Platform-specific builtin constrained FP enablement

When constrained floating point is enabled the X86-specific builtins don't
use constrained intrinsics in some cases. Fix that.

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

Added: 
clang/test/CodeGen/avx512f-builtins-constrained.c
clang/test/CodeGen/fma-builtins-constrained.c
clang/test/CodeGen/sse-builtins-constrained.c

Modified: 
clang/lib/CodeGen/CGBuiltin.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 44947b4b1d64..ca41413ae278 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -10094,8 +10094,14 @@ static Value *EmitX86FMAExpr(CodeGenFunction &CGF, 
ArrayRef Ops,
 Res = CGF.Builder.CreateCall(Intr, {A, B, C, Ops.back() });
   } else {
 llvm::Type *Ty = A->getType();
-Function *FMA = CGF.CGM.getIntrinsic(Intrinsic::fma, Ty);
-Res = CGF.Builder.CreateCall(FMA, {A, B, C} );
+Function *FMA;
+if (CGF.Builder.getIsFPConstrained()) {
+  FMA = CGF.CGM.getIntrinsic(Intrinsic::experimental_constrained_fma, Ty);
+  Res = CGF.Builder.CreateConstrainedFPCall(FMA, {A, B, C});
+} else {
+  FMA = CGF.CGM.getIntrinsic(Intrinsic::fma, Ty);
+  Res = CGF.Builder.CreateCall(FMA, {A, B, C});
+}
 
 if (IsAddSub) {
   // Negate even elts in C using a mask.
@@ -10105,7 +10111,11 @@ static Value *EmitX86FMAExpr(CodeGenFunction &CGF, 
ArrayRef Ops,
 Indices[i] = i + (i % 2) * NumElts;
 
   Value *NegC = CGF.Builder.CreateFNeg(C);
-  Value *FMSub = CGF.Builder.CreateCall(FMA, {A, B, NegC} );
+  Value *FMSub;
+  if (CGF.Builder.getIsFPConstrained())
+FMSub = CGF.Builder.CreateConstrainedFPCall(FMA, {A, B, NegC} );
+  else
+FMSub = CGF.Builder.CreateCall(FMA, {A, B, NegC} );
   Res = CGF.Builder.CreateShuffleVector(FMSub, Res, Indices);
 }
   }
@@ -10164,6 +10174,10 @@ EmitScalarFMAExpr(CodeGenFunction &CGF, 
MutableArrayRef Ops,
 Intrinsic::x86_avx512_vfmadd_f64;
 Res = CGF.Builder.CreateCall(CGF.CGM.getIntrinsic(IID),
  {Ops[0], Ops[1], Ops[2], Ops[4]});
+  } else if (CGF.Builder.getIsFPConstrained()) {
+Function *FMA = CGF.CGM.getIntrinsic(
+Intrinsic::experimental_constrained_fma, Ops[0]->getType());
+Res = CGF.Builder.CreateConstrainedFPCall(FMA, Ops.slice(0, 3));
   } else {
 Function *FMA = CGF.CGM.getIntrinsic(Intrinsic::fma, Ops[0]->getType());
 Res = CGF.Builder.CreateCall(FMA, Ops.slice(0, 3));
@@ -11892,8 +11906,15 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned 
BuiltinID,
   case X86::BI__builtin_ia32_sqrtss:
   case X86::BI__builtin_ia32_sqrtsd: {
 Value *A = Builder.CreateExtractElement(Ops[0], (uint64_t)0);
-Function *F = CGM.getIntrinsic(Intrinsic::sqrt, A->getType());
-A = Builder.CreateCall(F, {A});
+Function *F;
+if (Builder.getIsFPConstrained()) {
+  F = CGM.getIntrinsic(Intrinsic::experimental_constrained_sqrt,
+   A->getType());
+  A = Builder.CreateConstrainedFPCall(F, {A});
+} else {
+  F = CGM.getIntrinsic(Intrinsic::sqrt, A->getType());
+  A = Builder.CreateCall(F, {A});
+}
 return Builder.CreateInsertElement(Ops[0], A, (uint64_t)0);
   }
   case X86::BI__builtin_ia32_sqrtsd_round_mask:
@@ -11908,8 +11929,15 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned 
BuiltinID,
   return Builder.CreateCall(CGM.getIntrinsic(IID), Ops);
 }
 Value *A = Builder.CreateExtractElement(Ops[1], (uint64_t)0);
-Function *F = CGM.getIntrinsic(Intrinsic::sqrt, A->getType());
-A = Builder.CreateCall(F, A);
+Function *F;
+if (Builder.getIsFPConstrained()) {
+  F = CGM.getIntrinsic(Intrinsic::experimental_constrained_sqrt,
+   A->getType());
+  A = Builder.CreateConstrainedFPCall(F, A);
+} else {
+  F = CGM.getIntrinsic(Intrinsic::sqrt, A->getType());
+  A = Builder.CreateCall(F, A);
+}
 Value *Src = Builder.CreateExtractElement(Ops[2], (uint64_t)0);
 A = EmitX86ScalarSelect(*this, Ops[3], A, Src);
 return Builder.CreateInsertElement(Ops[0], A, (uint64_t)0);
@@ -11931,8 +11959,14 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned 
BuiltinID,
 return Builder.CreateCall(CGM.getIntrinsic(IID), Ops);
   }
 }
-Function *F = CGM.getIntrinsic(Intrinsic::sqrt, Ops[0]->getType());
-return Builder.CreateCall(F, Ops[0]);
+if (Builder.getIsFPConstrained()) {
+  Function *F = CGM.get

[PATCH] D74087: [Sema] Fix Sema checkArgCount function

2020-02-06 Thread Baptiste Saleil via Phabricator via cfe-commits
bsaleil updated this revision to Diff 242963.
bsaleil added a comment.

Adding test case


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74087/new/

https://reviews.llvm.org/D74087

Files:
  clang/lib/Sema/SemaChecking.cpp
  clang/test/Sema/custom-checking.c


Index: clang/test/Sema/custom-checking.c
===
--- /dev/null
+++ clang/test/Sema/custom-checking.c
@@ -0,0 +1,29 @@
+// RUN: not %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck %s -strict-whitespace
+
+int few_args() {
+  int r = 0;
+  __builtin_add_overflow(1, 2);
+  return r;
+}
+
+// CHECK: error: too few arguments to function call, expected 3, have 2
+// CHECK:   __builtin_add_overflow(1, 2);
+// CHECK:   ~~~^
+
+int many_args() {
+  int r = 0;
+  __builtin_add_overflow(1, 2, &r, 3, 4, 5, 6);
+  return r;
+}
+
+// CHECK: error: too many arguments to function call, expected 3, have 7
+// CHECK:   __builtin_add_overflow(1, 2, &r, 3, 4, 5, 6);
+// CHECK:^~
+
+int equal_args() {
+  int r = 0;
+  __builtin_add_overflow(1, 2, &r);
+  return r;
+}
+
+// CHECK: 2 errors generated.
Index: clang/lib/Sema/SemaChecking.cpp
===
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -121,8 +121,7 @@
 call->getArg(argCount - 1)->getEndLoc());
 
   return S.Diag(range.getBegin(), diag::err_typecheck_call_too_many_args)
-<< 0 /*function call*/ << desiredArgCount << argCount
-<< call->getArg(1)->getSourceRange();
+<< 0 /*function call*/ << desiredArgCount << argCount << range;
 }
 
 /// Check that the first argument to __builtin_annotation is an integer


Index: clang/test/Sema/custom-checking.c
===
--- /dev/null
+++ clang/test/Sema/custom-checking.c
@@ -0,0 +1,29 @@
+// RUN: not %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck %s -strict-whitespace
+
+int few_args() {
+  int r = 0;
+  __builtin_add_overflow(1, 2);
+  return r;
+}
+
+// CHECK: error: too few arguments to function call, expected 3, have 2
+// CHECK:   __builtin_add_overflow(1, 2);
+// CHECK:   ~~~^
+
+int many_args() {
+  int r = 0;
+  __builtin_add_overflow(1, 2, &r, 3, 4, 5, 6);
+  return r;
+}
+
+// CHECK: error: too many arguments to function call, expected 3, have 7
+// CHECK:   __builtin_add_overflow(1, 2, &r, 3, 4, 5, 6);
+// CHECK:^~
+
+int equal_args() {
+  int r = 0;
+  __builtin_add_overflow(1, 2, &r);
+  return r;
+}
+
+// CHECK: 2 errors generated.
Index: clang/lib/Sema/SemaChecking.cpp
===
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -121,8 +121,7 @@
 call->getArg(argCount - 1)->getEndLoc());
 
   return S.Diag(range.getBegin(), diag::err_typecheck_call_too_many_args)
-<< 0 /*function call*/ << desiredArgCount << argCount
-<< call->getArg(1)->getSourceRange();
+<< 0 /*function call*/ << desiredArgCount << argCount << range;
 }
 
 /// Check that the first argument to __builtin_annotation is an integer
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73570: [FPEnv][X86] Platform-specific builtin constrained FP enablement

2020-02-06 Thread Kevin P. Neal via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG208470dd5d0a: [FPEnv][X86] Platform-specific builtin 
constrained FP enablement (authored by kpn).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73570/new/

https://reviews.llvm.org/D73570

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/avx512f-builtins-constrained.c
  clang/test/CodeGen/fma-builtins-constrained.c
  clang/test/CodeGen/sse-builtins-constrained.c

Index: clang/test/CodeGen/sse-builtins-constrained.c
===
--- /dev/null
+++ clang/test/CodeGen/sse-builtins-constrained.c
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefix=UNCONSTRAINED --check-prefix=COMMON --check-prefix=COMMONIR
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse -ffp-exception-behavior=strict -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefix=CONSTRAINED --check-prefix=COMMON --check-prefix=COMMONIR
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse -S %s -o - -Wall -Werror | FileCheck %s --check-prefix=CHECK-ASM --check-prefix=COMMON
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse -ffp-exception-behavior=strict -S %s -o - -Wall -Werror | FileCheck %s --check-prefix=CHECK-ASM --check-prefix=COMMON
+
+
+#include 
+
+__m128 test_mm_sqrt_ps(__m128 x) {
+  // COMMON-LABEL: test_mm_sqrt_ps
+  // UNCONSTRAINED: call <4 x float> @llvm.sqrt.v4f32(<4 x float> {{.*}})
+  // CONSTRAINED: call <4 x float> @llvm.experimental.constrained.sqrt.v4f32(<4 x float> {{.*}}, metadata !{{.*}})
+  // CHECK-ASM: sqrtps
+  return _mm_sqrt_ps(x);
+}
+
+__m128 test_sqrt_ss(__m128 x) {
+  // COMMON-LABEL: test_sqrt_ss
+  // COMMONIR: extractelement <4 x float> {{.*}}, i64 0
+  // UNCONSTRAINED: call float @llvm.sqrt.f32(float {{.*}})
+  // CONSTRAINED: call float @llvm.experimental.constrained.sqrt.f32(float {{.*}}, metadata !{{.*}})
+  // CHECK-ASM: sqrtss
+  // COMMONIR: insertelement <4 x float> {{.*}}, float {{.*}}, i64 0
+  return _mm_sqrt_ss(x);
+}
+
Index: clang/test/CodeGen/fma-builtins-constrained.c
===
--- /dev/null
+++ clang/test/CodeGen/fma-builtins-constrained.c
@@ -0,0 +1,352 @@
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +fma -O -emit-llvm -o - | FileCheck --check-prefix=COMMON --check-prefix=COMMONIR --check-prefix=UNCONSTRAINED %s
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +fma -ffp-exception-behavior=strict -O -emit-llvm -o - | FileCheck --check-prefix=COMMON --check-prefix=COMMONIR --check-prefix=CONSTRAINED %s
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +fma -O -S -o - | FileCheck --check-prefix=COMMON --check-prefix=CHECK-ASM %s
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +fma -O -ffp-exception-behavior=strict -S -o - | FileCheck --check-prefix=COMMON --check-prefix=CHECK-ASM %s
+
+// FIXME: Several of these tests are broken when constrained.
+
+#include 
+
+__m128 test_mm_fmadd_ps(__m128 a, __m128 b, __m128 c) {
+  // COMMON-LABEL: test_mm_fmadd_ps
+  // UNCONSTRAINED: call <4 x float> @llvm.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}})
+  // CONSTRAINED: call <4 x float> @llvm.experimental.constrained.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}, metadata !{{.*}})
+  // CHECK-ASM: vfmadd213ps
+  return _mm_fmadd_ps(a, b, c);
+}
+
+__m128d test_mm_fmadd_pd(__m128d a, __m128d b, __m128d c) {
+  // COMMON-LABEL: test_mm_fmadd_pd
+  // UNCONSTRAINED: call <2 x double> @llvm.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> %{{.*}})
+  // CONSTRAINED: call <2 x double> @llvm.experimental.constrained.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> %{{.*}}, metadata !{{.*}})
+  // CHECK-ASM: vfmadd213pd
+  return _mm_fmadd_pd(a, b, c);
+}
+
+__m128 test_mm_fmadd_ss(__m128 a, __m128 b, __m128 c) {
+  // COMMON-LABEL: test_mm_fmadd_ss
+  // COMMONIR: extractelement <4 x float> %{{.*}}, i64 0
+  // COMMONIR: extractelement <4 x float> %{{.*}}, i64 0
+  // COMMONIR: extractelement <4 x float> %{{.*}}, i64 0
+  // UNCONSTRAINED: call float @llvm.fma.f32(float %{{.*}}, float %{{.*}}, float %{{.*}})
+  // CONSTRAINED: call float @llvm.experimental.constrained.fma.f32(float %{{.*}}, float %{{.*}}, float %{{.*}}, metadata !{{.*}})
+  // CHECK-ASM: vfmadd213ss
+  // COMMONIR: insertelement <4 x float> %{{.*}}, float %{{.*}}, i64 0
+  return _mm_fmadd_ss(a, b, c);
+}
+
+__m128d test_mm_fmadd_sd(__m128d a, __m128d b, __m128d 

[PATCH] D74150: Update hwasan docs to cover outlined checks and globals.

2020-02-06 Thread Evgenii Stepanov via Phabricator via cfe-commits
eugenis accepted this revision.
eugenis added a comment.
This revision is now accepted and ready to land.

LGTM




Comment at: clang/docs/HardwareAssistedAddressSanitizerDesign.rst:87
+   bl  __hwasan_check_x0_2_short   // call outlined tag 
check
+// (arguments: x0 = 
address, x9 = shadow base)
+   ldr w0, [x0]// inline load

mention that "2" encodes access type and size. Do we want to expand on how?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74150/new/

https://reviews.llvm.org/D74150



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


[PATCH] D74150: Update hwasan docs to cover outlined checks and globals.

2020-02-06 Thread Kostya Serebryany via Phabricator via cfe-commits
kcc accepted this revision.
kcc added a comment.

thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74150/new/

https://reviews.llvm.org/D74150



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


[PATCH] D74150: Update hwasan docs to cover outlined checks and globals.

2020-02-06 Thread Mitch Phillips via Phabricator via cfe-commits
hctim added inline comments.



Comment at: clang/docs/HardwareAssistedAddressSanitizerDesign.rst:73
+and performance overhead of the call is reduced by using a custom calling
+convention that preserves most registers and is specialized to the register
+containing the address and the type and size of the memory access. Currently,

Out of breath reading this sentence, maybe break up like:

"...custom calling convention, which: 

1. Preserves most registers, and
2.  Is specialised based on the type and size of the memory access, as well as 
the register that contains the address."



Comment at: clang/docs/HardwareAssistedAddressSanitizerDesign.rst:148
+
+  * The address of each global has a static tag associated with it. These
+tags are pseudo-random; they are computed using the hash of the path

* The first defined global in a translation unit has a pseudorandom tag 
associated with it, based on the hash of the file path. Subsequent global tags 
are incremental from the previously-assigned tag.



Comment at: clang/docs/HardwareAssistedAddressSanitizerDesign.rst:162
+
+  * An associated ``hwasan_globals`` section is emitted for each tagged global,
+which indicates the address of the global, its size and its tag.

We have one section for all globals, right? So /s/section is emitted for each 
tagged global/section is emitted that contains information about the tagged 
globals/


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74150/new/

https://reviews.llvm.org/D74150



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


[PATCH] D73967: Implement _ExtInt as an extended int type specifier.

2020-02-06 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment.

In D73967#1861757 , @erichkeane wrote:

> Extended-vector types don't really make sense for non-powers-of-two (plus 
> have some odd gotchas when it comes to vectors of i1 for example), so I've 
> added a test that shows that this is rejected.


OK, that seems fine to me.

> _Complex _ExtInt(N) is rejected when parsing _Complex.  It doesn't seem to 
> make sense to me to support them, so I've added a test that shows it is 
> invalid.  Do you disagree?

We allow _Complex T for integral types T in general, so this seems 
inconsistent. Are there problems supporting this? Is it just a parser 
limitation or something deeper? If there's some reason it doesn't naturally 
work (as there is for at least non-power-of-two-sized integers in vectors) then 
rejecting it seems fine.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73967/new/

https://reviews.llvm.org/D73967



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


[PATCH] D73967: Implement _ExtInt as an extended int type specifier.

2020-02-06 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

In D73967#1862268 , @rsmith wrote:

> We allow _Complex T for integral types T in general, so this seems 
> inconsistent. Are there problems supporting this? Is it just a parser 
> limitation or something deeper? If there's some reason it doesn't naturally 
> work (as there is for at least non-power-of-two-sized integers in vectors) 
> then rejecting it seems fine.


At the moment it doesn't work because of parsing.  I'm unaware of there is a 
deeper limitation, but I'll look at it.  I was unaware that we allow integral 
types for _Complex, I'd looked it up on cppreference and only saw the FP types 
so I was basically just confused as to what your intent was.  I'll look closer 
now that I've done the _Atomic limitations.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73967/new/

https://reviews.llvm.org/D73967



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


[PATCH] D74094: [IRGen] Emit lifetime intrinsics around temporary aggregate argument allocas

2020-02-06 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington planned changes to this revision.
erik.pilkington marked an inline comment as done.
erik.pilkington added inline comments.



Comment at: clang/lib/CodeGen/CGCall.cpp:3697
+
+  args.add(EmitAnyExpr(E, ArgSlot), type);
 }

rjmccall wrote:
> If the argument type has a C++ destructor, will we end its lifetime before we 
> call destructors at the end of the full-expression?
Yeah, this is broken :/


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74094/new/

https://reviews.llvm.org/D74094



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


[clang] 6f5a159 - [clang][driver] Clean up unnecessary reference to TC. NFC.

2020-02-06 Thread Michael Liao via cfe-commits

Author: Michael Liao
Date: 2020-02-06T15:14:21-05:00
New Revision: 6f5a159eab8d3fecdbbc741a38c970c0149b3c96

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

LOG: [clang][driver] Clean up unnecessary reference to TC. NFC.

Added: 


Modified: 
clang/lib/Driver/ToolChains/Clang.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 37adad152c56..65039ac64b5a 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -307,10 +307,9 @@ static void getWebAssemblyTargetFeatures(const ArgList 
&Args,
   handleTargetFeaturesGroup(Args, Features, 
options::OPT_m_wasm_Features_Group);
 }
 
-static void getTargetFeatures(const ToolChain &TC, const llvm::Triple &Triple,
+static void getTargetFeatures(const Driver &D, const llvm::Triple &Triple,
   const ArgList &Args, ArgStringList &CmdArgs,
   bool ForAS, bool IsAux = false) {
-  const Driver &D = TC.getDriver();
   std::vector Features;
   switch (Triple.getArch()) {
   default:
@@ -1594,7 +1593,7 @@ void Clang::RenderTargetOptions(const llvm::Triple 
&EffectiveTriple,
   const ToolChain &TC = getToolChain();
 
   // Add the target features
-  getTargetFeatures(TC, EffectiveTriple, Args, CmdArgs, false);
+  getTargetFeatures(TC.getDriver(), EffectiveTriple, Args, CmdArgs, false);
 
   // Add target specific flags.
   switch (TC.getArch()) {
@@ -4643,7 +4642,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction 
&JA,
   CmdArgs.push_back("-aux-target-cpu");
   CmdArgs.push_back(Args.MakeArgString(HostCPU));
 }
-getTargetFeatures(TC, *TC.getAuxTriple(), HostArgs, CmdArgs,
+getTargetFeatures(D, *TC.getAuxTriple(), HostArgs, CmdArgs,
   /*ForAS*/ false, /*IsAux*/ true);
   }
 
@@ -6679,7 +6678,7 @@ void ClangAs::ConstructJob(Compilation &C, const 
JobAction &JA,
   }
 
   // Add the target features
-  getTargetFeatures(getToolChain(), Triple, Args, CmdArgs, true);
+  getTargetFeatures(D, Triple, Args, CmdArgs, true);
 
   // Ignore explicit -force_cpusubtype_ALL option.
   (void)Args.hasArg(options::OPT_force__cpusubtype__ALL);



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


[clang-tools-extra] da3dc00 - PR44684: Look through parens and similar constructs when determining

2020-02-06 Thread Richard Smith via cfe-commits

Author: Richard Smith
Date: 2020-02-06T12:21:54-08:00
New Revision: da3dc0011e06c9f1aebe71d76eae92dc76e3db2e

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

LOG: PR44684: Look through parens and similar constructs when determining
whether a call is to a builtin.

We already had a general mechanism to do this but for some reason
weren't using it. In passing, check for the other unary operators that
can intervene in a reasonably-direct function call (we already handled
'&' but missed '*' and '+').

This reverts commit aaae6b1b617378362462c1685e754813ed82b394,
reinstating af80b8ccc5772c14920d4554b7ca7e15f2fad1c4, with a fix to
clang-tidy.

Added: 


Modified: 
clang-tools-extra/clang-tidy/modernize/UseUncaughtExceptionsCheck.cpp
clang/lib/AST/Expr.cpp
clang/lib/AST/ExprConstant.cpp
clang/test/Parser/builtin_classify_type.c
clang/test/Sema/constant-builtins.c

Removed: 




diff  --git 
a/clang-tools-extra/clang-tidy/modernize/UseUncaughtExceptionsCheck.cpp 
b/clang-tools-extra/clang-tidy/modernize/UseUncaughtExceptionsCheck.cpp
index cb3f55135b7d..a7a07465bc53 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseUncaughtExceptionsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseUncaughtExceptionsCheck.cpp
@@ -34,15 +34,18 @@ void 
UseUncaughtExceptionsCheck::registerMatchers(MatchFinder *Finder) {
   .bind("decl_ref_expr"),
   this);
 
+  auto DirectCallToUncaughtException = callee(expr(ignoringImpCasts(
+  declRefExpr(hasDeclaration(functionDecl(hasName(MatchText)));
+
   // CallExpr: warning, fix-it.
-  Finder->addMatcher(callExpr(hasDeclaration(functionDecl(hasName(MatchText))),
+  Finder->addMatcher(callExpr(DirectCallToUncaughtException,
   unless(hasAncestor(initListExpr(
  .bind("call_expr"),
  this);
   // CallExpr in initialisation list: warning, fix-it with avoiding narrowing
   // conversions.
-  Finder->addMatcher(callExpr(hasAncestor(initListExpr()),
-  hasDeclaration(functionDecl(hasName(MatchText
+  Finder->addMatcher(callExpr(DirectCallToUncaughtException,
+  hasAncestor(initListExpr()))
  .bind("init_call_expr"),
  this);
 }

diff  --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index ac4fa127af43..d9291616c66a 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -1446,19 +1446,28 @@ void CallExpr::updateDependenciesFromArg(Expr *Arg) {
 Decl *Expr::getReferencedDeclOfCallee() {
   Expr *CEE = IgnoreParenImpCasts();
 
-  while (SubstNonTypeTemplateParmExpr *NTTP
-= dyn_cast(CEE)) 
{
-CEE = NTTP->getReplacement()->IgnoreParenCasts();
+  while (SubstNonTypeTemplateParmExpr *NTTP =
+ dyn_cast(CEE)) {
+CEE = NTTP->getReplacement()->IgnoreParenImpCasts();
   }
 
   // If we're calling a dereference, look at the pointer instead.
-  if (BinaryOperator *BO = dyn_cast(CEE)) {
-if (BO->isPtrMemOp())
-  CEE = BO->getRHS()->IgnoreParenCasts();
-  } else if (UnaryOperator *UO = dyn_cast(CEE)) {
-if (UO->getOpcode() == UO_Deref)
-  CEE = UO->getSubExpr()->IgnoreParenCasts();
+  while (true) {
+if (BinaryOperator *BO = dyn_cast(CEE)) {
+  if (BO->isPtrMemOp()) {
+CEE = BO->getRHS()->IgnoreParenImpCasts();
+continue;
+  }
+} else if (UnaryOperator *UO = dyn_cast(CEE)) {
+  if (UO->getOpcode() == UO_Deref || UO->getOpcode() == UO_AddrOf ||
+  UO->getOpcode() == UO_Plus) {
+CEE = UO->getSubExpr()->IgnoreParenImpCasts();
+continue;
+  }
+}
+break;
   }
+
   if (DeclRefExpr *DRE = dyn_cast(CEE))
 return DRE->getDecl();
   if (MemberExpr *ME = dyn_cast(CEE))
@@ -1469,28 +1478,11 @@ Decl *Expr::getReferencedDeclOfCallee() {
   return nullptr;
 }
 
-/// getBuiltinCallee - If this is a call to a builtin, return the builtin ID. 
If
-/// not, return 0.
+/// If this is a call to a builtin, return the builtin ID. If not, return 0.
 unsigned CallExpr::getBuiltinCallee() const {
-  // All simple function calls (e.g. func()) are implicitly cast to pointer to
-  // function. As a result, we try and obtain the DeclRefExpr from the
-  // ImplicitCastExpr.
-  const ImplicitCastExpr *ICE = dyn_cast(getCallee());
-  if (!ICE) // FIXME: deal with more complex calls (e.g. (func)(), (*func)()).
-return 0;
-
-  const DeclRefExpr *DRE = dyn_cast(ICE->getSubExpr());
-  if (!DRE)
-return 0;
-
-  const FunctionDecl *FDecl = dyn_cast(DRE->getDecl());
-  if (!FDecl)
-return 0;
-
-  if (!FDecl->getIdentifier())
-return 0;
-
-  return FDecl->getBuiltinID();
+  auto *FDecl =
+  dyn_cast_or_null(getCallee(

[PATCH] D73967: Implement _ExtInt as an extended int type specifier.

2020-02-06 Thread Ronan Keryell via Phabricator via cfe-commits
keryell added a comment.

In D73967#1862273 , @erichkeane wrote:

> At the moment it doesn't work because of parsing.  I'm unaware of there is a 
> deeper limitation, but I'll look at it.  I was unaware that we allow integral 
> types for _Complex, I'd looked it up on cppreference and only saw the FP 
> types so I was basically just confused as to what your intent was.


Nice! Telecommunication applications love complex numbers of weird integers on 
FPGA. Of course, it is outside of any common CPU ABI but useful for HLS 
tool-chains based on Clang. Useful also for SYCL extensions for FPGA.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73967/new/

https://reviews.llvm.org/D73967



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


[clang] 8ecde3a - [Clang] Remove unused #pragma clang __debug handle_crash

2020-02-06 Thread Alexandre Ganea via cfe-commits

Author: Alexandre Ganea
Date: 2020-02-06T15:27:04-05:00
New Revision: 8ecde3ac34bbb5a8d53d8ec5cd32867658646df1

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

LOG: [Clang] Remove unused #pragma clang __debug handle_crash

As discussed in D70568, remove this because it isn't used anywhere, and I think 
it's better to go through real crashes for testing (#pragma clang __debug 
crash).
Also remove the support function llvm::CrashRecoveryContext::HandleCrash() 
which was added at the same time by @ddunbar.

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

Added: 


Modified: 
clang/lib/Lex/Pragma.cpp
llvm/include/llvm/Support/CrashRecoveryContext.h
llvm/lib/Support/CrashRecoveryContext.cpp

Removed: 




diff  --git a/clang/lib/Lex/Pragma.cpp b/clang/lib/Lex/Pragma.cpp
index e4636265a72b..c881bcac9f38 100644
--- a/clang/lib/Lex/Pragma.cpp
+++ b/clang/lib/Lex/Pragma.cpp
@@ -39,7 +39,6 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/CrashRecoveryContext.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/ErrorHandling.h"
 #include 
@@ -1105,10 +1104,6 @@ struct PragmaDebugHandler : public PragmaHandler {
   M->dump();
 } else if (II->isStr("overflow_stack")) {
   DebugOverflowStack();
-} else if (II->isStr("handle_crash")) {
-  llvm::CrashRecoveryContext *CRC 
=llvm::CrashRecoveryContext::GetCurrent();
-  if (CRC)
-CRC->HandleCrash();
 } else if (II->isStr("captured")) {
   HandleCaptured(PP);
 } else {

diff  --git a/llvm/include/llvm/Support/CrashRecoveryContext.h 
b/llvm/include/llvm/Support/CrashRecoveryContext.h
index 9522c4742244..beeb855c7c58 100644
--- a/llvm/include/llvm/Support/CrashRecoveryContext.h
+++ b/llvm/include/llvm/Support/CrashRecoveryContext.h
@@ -97,10 +97,6 @@ class CrashRecoveryContext {
 return RunSafelyOnThread([&]() { Fn(UserData); }, RequestedStackSize);
   }
 
-  /// Explicitly trigger a crash recovery in the current process, and
-  /// return failure from RunSafely(). This function does not return.
-  void HandleCrash();
-
   /// In case of a crash, this is the crash identifier.
   int RetCode = 0;
 

diff  --git a/llvm/lib/Support/CrashRecoveryContext.cpp 
b/llvm/lib/Support/CrashRecoveryContext.cpp
index 510f46abe4b5..a24bf7bf2557 100644
--- a/llvm/lib/Support/CrashRecoveryContext.cpp
+++ b/llvm/lib/Support/CrashRecoveryContext.cpp
@@ -406,14 +406,6 @@ bool CrashRecoveryContext::RunSafely(function_ref 
Fn) {
 
 #endif // !_MSC_VER
 
-void CrashRecoveryContext::HandleCrash() {
-  CrashRecoveryContextImpl *CRCI = (CrashRecoveryContextImpl *) Impl;
-  assert(CRCI && "Crash recovery context never initialized!");
-  // As per convention, -2 indicates a crash or timeout as opposed to failure 
to
-  // execute (see llvm/include/llvm/Support/Program.h)
-  CRCI->HandleCrash(-2, 0);
-}
-
 // FIXME: Portability.
 static void setThreadBackgroundPriority() {
 #ifdef __APPLE__



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


[clang] 80e17e5 - [FPEnv][X86] Speculative fix for failures introduced by eda495426.

2020-02-06 Thread Kevin P. Neal via cfe-commits

Author: Kevin P. Neal
Date: 2020-02-06T15:28:36-05:00
New Revision: 80e17e5fcc09dc5baa940022e6988fcb08c5d92d

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

LOG: [FPEnv][X86] Speculative fix for failures introduced by eda495426.

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

Added: 


Modified: 
clang/test/CodeGen/avx512f-builtins-constrained.c
clang/test/CodeGen/fma-builtins-constrained.c
clang/test/CodeGen/sse-builtins-constrained.c

Removed: 




diff  --git a/clang/test/CodeGen/avx512f-builtins-constrained.c 
b/clang/test/CodeGen/avx512f-builtins-constrained.c
index 1a8df1a85c7c..75fad73d60f6 100644
--- a/clang/test/CodeGen/avx512f-builtins-constrained.c
+++ b/clang/test/CodeGen/avx512f-builtins-constrained.c
@@ -1,9 +1,9 @@
-// RUN: %clang_cc1 -fexperimental-new-pass-manager 
-flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin 
-target-feature +avx512f -emit-llvm -o - -Wall -Werror | FileCheck 
--check-prefix=COMMON --check-prefix=COMMONIR --check-prefix=UNCONSTRAINED %s
+// RUN: %clang_cc1 -fexperimental-new-pass-manager 
-flax-vector-conversions=none -ffreestanding %s 
-triple=x86_64-unknown-linux-gnu -target-feature +avx512f -emit-llvm -o - -Wall 
-Werror | FileCheck --check-prefix=COMMON --check-prefix=COMMONIR 
--check-prefix=UNCONSTRAINED %s
 // RUN: %clang_cc1 -fexperimental-new-pass-manager 
-flax-vector-conversions=none -fms-extensions -fms-compatibility -ffreestanding 
%s -triple=x86_64-windows-msvc -target-feature +avx512f -emit-llvm -o - -Wall 
-Werror | FileCheck --check-prefix=COMMON --check-prefix=COMMONIR 
--check-prefix=UNCONSTRAINED %s
-// RUN: %clang_cc1 -fexperimental-new-pass-manager 
-flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin 
-target-feature +avx512f -ffp-exception-behavior=strict -emit-llvm -o - -Wall 
-Werror | FileCheck --check-prefix=COMMON --check-prefix=COMMONIR 
--check-prefix=CONSTRAINED %s
-// RUN: %clang_cc1 -fexperimental-new-pass-manager 
-flax-vector-conversions=none -fms-compatibility -ffreestanding %s 
-triple=x86_64-apple-darwin -target-feature +avx512f 
-ffp-exception-behavior=strict -emit-llvm -o - -Wall -Werror | FileCheck 
--check-prefix=COMMON --check-prefix=COMMONIR --check-prefix=CONSTRAINED %s
-// RUN: %clang_cc1 -fexperimental-new-pass-manager 
-flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin 
-target-feature +avx512f -S -o - -Wall -Werror | FileCheck 
--check-prefix=COMMON --check-prefix=CHECK-ASM %s
-// RUN: %clang_cc1 -fexperimental-new-pass-manager 
-flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin 
-target-feature +avx512f -ffp-exception-behavior=strict -S -o - -Wall -Werror | 
FileCheck --check-prefix=COMMON --check-prefix=CHECK-ASM %s
+// RUN: %clang_cc1 -fexperimental-new-pass-manager 
-flax-vector-conversions=none -ffreestanding %s 
-triple=x86_64-unknown-linux-gnu -target-feature +avx512f 
-ffp-exception-behavior=strict -emit-llvm -o - -Wall -Werror | FileCheck 
--check-prefix=COMMON --check-prefix=COMMONIR --check-prefix=CONSTRAINED %s
+// RUN: %clang_cc1 -fexperimental-new-pass-manager 
-flax-vector-conversions=none -fms-compatibility -ffreestanding %s 
-triple=x86_64-unknown-linux-gnu -target-feature +avx512f 
-ffp-exception-behavior=strict -emit-llvm -o - -Wall -Werror | FileCheck 
--check-prefix=COMMON --check-prefix=COMMONIR --check-prefix=CONSTRAINED %s
+// RUN: %clang_cc1 -fexperimental-new-pass-manager 
-flax-vector-conversions=none -ffreestanding %s 
-triple=x86_64-unknown-linux-gnu -target-feature +avx512f -S -o - -Wall -Werror 
| FileCheck --check-prefix=COMMON --check-prefix=CHECK-ASM %s
+// RUN: %clang_cc1 -fexperimental-new-pass-manager 
-flax-vector-conversions=none -ffreestanding %s 
-triple=x86_64-unknown-linux-gnu -target-feature +avx512f 
-ffp-exception-behavior=strict -S -o - -Wall -Werror | FileCheck 
--check-prefix=COMMON --check-prefix=CHECK-ASM %s
 
 #include 
 

diff  --git a/clang/test/CodeGen/fma-builtins-constrained.c 
b/clang/test/CodeGen/fma-builtins-constrained.c
index 91e2d25c4d46..8a3ce821a568 100644
--- a/clang/test/CodeGen/fma-builtins-constrained.c
+++ b/clang/test/CodeGen/fma-builtins-constrained.c
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin 
-target-feature +fma -O -emit-llvm -o - | FileCheck --check-prefix=COMMON 
--check-prefix=COMMONIR --check-prefix=UNCONSTRAINED %s
-// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin 
-target-feature +fma -ffp-exception-behavior=strict -O -emit-llvm -o - | 
FileCheck --check-prefix=COMMON --check-prefix=COMMONIR 
--check-prefix=CONSTRAINED %s
-// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin 
-target-feature +fma -O -S -o - | FileCheck --check-pr

[PATCH] D74094: [IRGen] Emit lifetime intrinsics around temporary aggregate argument allocas

2020-02-06 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: clang/lib/CodeGen/CGCall.cpp:3697
+
+  args.add(EmitAnyExpr(E, ArgSlot), type);
 }

erik.pilkington wrote:
> rjmccall wrote:
> > If the argument type has a C++ destructor, will we end its lifetime before 
> > we call destructors at the end of the full-expression?
> Yeah, this is broken :/
Well, we could at least do it for trivially-destructible types.  That probably 
needs to include all kinds of non-trivial destructibility, not just  C++, 
though.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74094/new/

https://reviews.llvm.org/D74094



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


  1   2   >