[PATCH] D84520: [Analyzer] Improve invalid dereference bug reporting in DereferenceChecker.

2020-08-10 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 284588.
balazske marked an inline comment as done.
balazske added a comment.

Rebase (bug category is LogicError).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84520

Files:
  clang/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp
  clang/test/Analysis/invalid-deref.c
  clang/test/Analysis/misc-ps-region-store.m

Index: clang/test/Analysis/misc-ps-region-store.m
===
--- clang/test/Analysis/misc-ps-region-store.m
+++ clang/test/Analysis/misc-ps-region-store.m
@@ -1157,7 +1157,7 @@
 struct list_pr8141 *
 pr8141 (void) {
   struct list_pr8141 *items;
-  for (;; items = ({ do { } while (0); items->tail; })) // expected-warning{{Dereference of undefined pointer value}}
+  for (;; items = ({ do { } while (0); items->tail; })) // expected-warning{{dereference of an undefined pointer value}}
 {
 }
 }
Index: clang/test/Analysis/invalid-deref.c
===
--- /dev/null
+++ clang/test/Analysis/invalid-deref.c
@@ -0,0 +1,32 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s
+
+typedef unsigned uintptr_t;
+
+void f1() {
+  int *p;
+  *p = 0; // expected-warning{{Dereference of undefined pointer value}}
+}
+
+struct foo_struct {
+  int x;
+};
+
+int f2() {
+  struct foo_struct *p;
+
+  return p->x++; // expected-warning{{Access to field 'x' results in a dereference of an undefined pointer value (loaded from variable 'p')}}
+}
+
+int f3() {
+  char *x;
+  int i = 2;
+
+  return x[i + 1]; // expected-warning{{Array access (from variable 'x') results in an undefined pointer dereference}}
+}
+
+int f3_b() {
+  char *x;
+  int i = 2;
+
+  return x[i + 1]++; // expected-warning{{Array access (from variable 'x') results in an undefined pointer dereference}}
+}
Index: clang/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp
@@ -30,11 +30,14 @@
 : public Checker< check::Location,
   check::Bind,
   EventDispatcher > {
+  enum DerefKind { NullPointer, UndefinedPointerValue };
+
   BugType BT_Null{this, "Dereference of null pointer", categories::LogicError};
   BugType BT_Undef{this, "Dereference of undefined pointer value",
categories::LogicError};
 
-  void reportBug(ProgramStateRef State, const Stmt *S, CheckerContext &C) const;
+  void reportBug(DerefKind K, ProgramStateRef State, const Stmt *S,
+ CheckerContext &C) const;
 
 public:
   void checkLocation(SVal location, bool isLoad, const Stmt* S,
@@ -117,8 +120,24 @@
   return false;
 }
 
-void DereferenceChecker::reportBug(ProgramStateRef State, const Stmt *S,
-   CheckerContext &C) const {
+void DereferenceChecker::reportBug(DerefKind K, ProgramStateRef State,
+   const Stmt *S, CheckerContext &C) const {
+  const BugType *BT = nullptr;
+  llvm::StringRef DerefStr1;
+  llvm::StringRef DerefStr2;
+  switch (K) {
+  case DerefKind::NullPointer:
+BT = &BT_Null;
+DerefStr1 = " results in a null pointer dereference";
+DerefStr2 = " results in a dereference of a null pointer";
+break;
+  case DerefKind::UndefinedPointerValue:
+BT = &BT_Undef;
+DerefStr1 = " results in an undefined pointer dereference";
+DerefStr2 = " results in a dereference of an undefined pointer value";
+break;
+  };
+
   // Generate an error node.
   ExplodedNode *N = C.generateErrorNode(State);
   if (!N)
@@ -135,7 +154,7 @@
 const ArraySubscriptExpr *AE = cast(S);
 AddDerefSource(os, Ranges, AE->getBase()->IgnoreParenCasts(),
State.get(), N->getLocationContext());
-os << " results in a null pointer dereference";
+os << DerefStr1;
 break;
   }
   case Stmt::OMPArraySectionExprClass: {
@@ -143,11 +162,11 @@
 const OMPArraySectionExpr *AE = cast(S);
 AddDerefSource(os, Ranges, AE->getBase()->IgnoreParenCasts(),
State.get(), N->getLocationContext());
-os << " results in a null pointer dereference";
+os << DerefStr1;
 break;
   }
   case Stmt::UnaryOperatorClass: {
-os << "Dereference of null pointer";
+os << BT->getDescription();
 const UnaryOperator *U = cast(S);
 AddDerefSource(os, Ranges, U->getSubExpr()->IgnoreParens(),
State.get(), N->getLocationContext(), true);
@@ -156,8 +175,7 @@
   case Stmt::MemberExprClass: {
 const MemberExpr *M = cast(S);
 if (M->isArrow() || isDeclRefExprToReference(M->getBase())) {
-  os << "Access to field '" << M->getMemberNameInfo()
- << "' results in a dereference of a null pointer";
+  os << "Access to field '" 

[PATCH] D59615: [AArch64] When creating SISD intrinsic calls widen scalar args into a zero vectors, not undef

2020-08-10 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment.

I see two issues here:

1. We're still generating the wrong instruction.
2. The intrinsic is marked readnone, so any code that depends on whether it 
sets saturation flags is likely broken anyway.

Given the layers of wrongness here, this seems like a marginal improvement.

Despite all that, I guess this is an improvement... but please at least make 
the comment in the code reflect this discussion.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59615

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


[PATCH] D59615: [AArch64] When creating SISD intrinsic calls widen scalar args into a zero vectors, not undef

2020-08-10 Thread Amara Emerson via Phabricator via cfe-commits
aemerson added a comment.
Herald added a subscriber: danielkiss.

Does anyone object to this? I'd like to get it off my review dashboard one way 
or the other.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59615

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


[PATCH] D84520: [Analyzer] Improve invalid dereference bug reporting in DereferenceChecker.

2020-08-10 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

Also thanks, let's land!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84520

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


[PATCH] D83536: [clangd] Index refs to main-file symbols as well

2020-08-10 Thread Nathan Ridge via Phabricator via cfe-commits
nridge updated this revision to Diff 284576.
nridge marked 4 inline comments as done.
nridge added a comment.

Address review comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83536

Files:
  clang-tools-extra/clangd/ClangdServer.cpp
  clang-tools-extra/clangd/ClangdServer.h
  clang-tools-extra/clangd/index/Background.cpp
  clang-tools-extra/clangd/index/Background.h
  clang-tools-extra/clangd/index/FileIndex.cpp
  clang-tools-extra/clangd/index/FileIndex.h
  clang-tools-extra/clangd/index/SymbolCollector.cpp
  clang-tools-extra/clangd/index/SymbolCollector.h
  clang-tools-extra/clangd/tool/ClangdMain.cpp
  clang-tools-extra/clangd/unittests/BackgroundIndexTests.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
@@ -613,6 +613,7 @@
   )");
   CollectorOpts.RefFilter = RefKind::All;
   CollectorOpts.CollectMacro = true;
+  CollectorOpts.CollectMainFileRefs = true;
   runSymbolCollector(Header.code(),
  (Main.code() + SymbolsOnlyInMainCode.code()).str());
   EXPECT_THAT(Refs, Contains(Pair(findSymbol(Symbols, "Foo").ID,
@@ -624,15 +625,13 @@
   EXPECT_THAT(Refs, Not(Contains(Pair(findSymbol(Symbols, "NS").ID, _;
   EXPECT_THAT(Refs, Contains(Pair(findSymbol(Symbols, "MACRO").ID,
   HaveRanges(Main.ranges("macro");
-  // Symbols *only* in the main file:
-  // - (a, b) externally visible and should have refs.
-  // - (c, FUNC) externally invisible and had no refs collected.
-  auto MainSymbols =
-  TestTU::withHeaderCode(SymbolsOnlyInMainCode.code()).headerSymbols();
-  EXPECT_THAT(Refs, Contains(Pair(findSymbol(MainSymbols, "a").ID, _)));
-  EXPECT_THAT(Refs, Contains(Pair(findSymbol(MainSymbols, "b").ID, _)));
-  EXPECT_THAT(Refs, Not(Contains(Pair(findSymbol(MainSymbols, "c").ID, _;
-  EXPECT_THAT(Refs, Not(Contains(Pair(findSymbol(MainSymbols, "FUNC").ID, _;
+  // Symbols *only* in the main file (a, b, c) should have refs collected
+  // as well.
+  EXPECT_THAT(Refs, Contains(Pair(findSymbol(Symbols, "a").ID, _)));
+  EXPECT_THAT(Refs, Contains(Pair(findSymbol(Symbols, "b").ID, _)));
+  EXPECT_THAT(Refs, Contains(Pair(findSymbol(Symbols, "c").ID, _)));
+  // However, references to main-file macros are not collected.
+  EXPECT_THAT(Refs, Not(Contains(Pair(findSymbol(Symbols, "FUNC").ID, _;
 }
 
 TEST_F(SymbolCollectorTest, MacroRefInHeader) {
@@ -708,12 +707,12 @@
 llvm::StringRef Main;
 llvm::StringRef TargetSymbolName;
   } TestCases[] = {
-{
-  R"cpp(
+  {
+  R"cpp(
 struct Foo;
 #define MACRO Foo
   )cpp",
-  R"cpp(
+  R"cpp(
 struct $spelled[[Foo]] {
   $spelled[[Foo]]();
   ~$spelled[[Foo]]();
@@ -721,24 +720,24 @@
 $spelled[[Foo]] Variable1;
 $implicit[[MACRO]] Variable2;
   )cpp",
-  "Foo",
-},
-{
-  R"cpp(
+  "Foo",
+  },
+  {
+  R"cpp(
 class Foo {
 public:
   Foo() = default;
 };
   )cpp",
-  R"cpp(
+  R"cpp(
 void f() { Foo $implicit[[f]]; f = $spelled[[Foo]]();}
   )cpp",
-  "Foo::Foo" /// constructor.
-},
+  "Foo::Foo" /// constructor.
+  },
   };
   CollectorOpts.RefFilter = RefKind::All;
   CollectorOpts.RefsInHeaders = false;
-  for (const auto& T : TestCases) {
+  for (const auto &T : TestCases) {
 Annotations Header(T.Header);
 Annotations Main(T.Main);
 // Reset the file system.
@@ -818,8 +817,9 @@
 $Foo[[Foo]] fo;
   }
   )");
-  // The main file is normal .cpp file, we should collect the refs
-  // for externally visible symbols.
+  // We should collect refs to main-file symbols in all cases:
+
+  // 1. The main file is normal .cpp file.
   TestFileName = testPath("foo.cpp");
   runSymbolCollector("", Header.code());
   EXPECT_THAT(Refs,
@@ -828,7 +828,7 @@
Pair(findSymbol(Symbols, "Func").ID,
 HaveRanges(Header.ranges("Func");
 
-  // Run the .h file as main file, we should collect the refs.
+  // 2. Run the .h file as main file.
   TestFileName = testPath("foo.h");
   runSymbolCollector("", Header.code(),
  /*ExtraArgs=*/{"-xobjective-c++-header"});
@@ -839,8 +839,7 @@
Pair(findSymbol(Symbols, "Func").ID,
 HaveRanges(Header.ranges("Func");
 
-  // Run the .hh file as main file (without "-x c++-header"), we should collect
-  // the refs as well.
+  // 3. Run the .hh file as main file (without "-x c++-header").
   TestFileName = testPa

[PATCH] D85621: [clang] Allow DynTypedNode to store a TemplateArgumentLoc

2020-08-10 Thread Nathan Ridge via Phabricator via cfe-commits
nridge added a comment.

In D85621#2205944 , @njames93 wrote:

> In D85621#2205856 , @nridge wrote:
>
>> In D85621#2205803 , @hokein wrote:
>>
>>> Please run `clang/docs/tools/dump_ast_matchers.py` script to update the 
>>> `LibASTMatchersReference.html` file.
>>
>> Done. Note, it looks like this script needs to be run with python 2. Should 
>> we document this somewhere?
>
> Given that python2 is EOL I think the correct course of action is to make it 
> work with python3.

Filed https://bugs.llvm.org/show_bug.cgi?id=47102 for this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85621

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


[PATCH] D85099: [UpdateTestChecks] Match unnamed values like "@[0-9]+" and "![0-9]+"

2020-08-10 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

LGTM. I don't have further comments. Worth waiting for other opinions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85099

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


[PATCH] D85645: [AST] Fix the CXXFoldExpr source range when parentheses range is invalid.

2020-08-10 Thread Nathan Ridge via Phabricator via cfe-commits
nridge added inline comments.



Comment at: clang/include/clang/AST/ExprCXX.h:4587
+  return RParenLoc;
+return getPattern()->getEndLoc();
+  }

Wouldn't `EllipsisLoc` be more accurate?



Comment at: clang/test/AST/ast-dump-concepts.cpp:16
+template 
+concept triple_concept = true;
+

naming suggestion: `variadic_concept`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85645

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


Buildbot numbers for the week of 08/02/2020 - 08/08/2020

2020-08-10 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the last week of 08/02/2020 -
08/08/2020.

Please see the same data in attached csv files:

The longest time each builder was red during the week;
"Status change ratio" by active builder (percent of builds that changed the
builder status from green to red or from red to green);
Count of commits by project;
Number of completed builds, failed builds and average build time for
successful builds per active builder;
Average waiting time for a revision to get build result per active builder
(response time).

Thanks

Galina


The longest time each builder was red during the week:
   buildername|  was_red
--+--
 clang-cmake-aarch64-lld  | 149:59:42
 sanitizer-x86_64-linux-android   | 113:14:14
 sanitizer-x86_64-linux   | 113:08:02
 llvm-sphinx-docs | 80:44:55
 clang-ppc64le-rhel   | 79:23:51
 clang-ppc64le-linux-multistage   | 78:58:39
 ppc64le-lld-multistage-test  | 78:32:55
 clang-cmake-aarch64-full | 66:57:52
 llvm-clang-win-x-armv7l  | 62:32:02
 llvm-clang-win-x-aarch64 | 61:46:15
 flang-aarch64-ubuntu-clang   | 61:17:55
 clang-cmake-aarch64-global-isel  | 60:49:47
 clang-cmake-armv7-global-isel| 60:30:33
 clang-cmake-armv7-quick  | 60:25:13
 clang-cmake-armv8-lld| 60:16:17
 flang-aarch64-ubuntu | 60:13:56
 clang-cmake-aarch64-quick| 60:07:38
 polly-arm-linux  | 44:29:16
 polly-x86_64-linux   | 44:17:09
 aosp-O3-polly-before-vectorizer-unprofitable | 41:16:39
 llvm-clang-x86_64-expensive-checks-win   | 30:59:47
 llvm-clang-x86_64-expensive-checks-ubuntu| 27:55:30
 llvm-clang-x86_64-expensive-checks-debian| 27:31:07
 lldb-arm-ubuntu  | 20:51:59
 lldb-aarch64-ubuntu  | 20:20:20
 lldb-x64-windows-ninja   | 19:39:12
 lldb-x86_64-debian   | 19:00:08
 mlir-windows | 13:57:41
 clang-ppc64le-linux  | 09:45:52
 sanitizer-x86_64-linux-bootstrap-ubsan   | 08:43:21
 lld-x86_64-darwin| 08:02:08
 clang-with-lto-ubuntu| 07:53:41
 sanitizer-x86_64-linux-fast  | 07:44:19
 clang-armv7-linux-build-cache| 07:10:38
 sanitizer-ppc64be-linux  | 05:31:04
 sanitizer-x86_64-linux-bootstrap-msan| 04:49:20
 sanitizer-x86_64-linux-autoconf  | 04:40:34
 sanitizer-x86_64-linux-bootstrap | 04:33:18
 clang-ppc64le-linux-lnt  | 04:23:07
 clang-ppc64be-linux-multistage   | 04:13:11
 mlir-nvidia  | 04:12:43
 lld-perf-testsuite   | 04:06:19
 clang-with-thin-lto-ubuntu   | 03:59:05
 fuchsia-x86_64-linux | 03:58:56
 clang-aarch64-linux-build-cache  | 03:51:21
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast   | 03:49:43
 lld-x86_64-win   | 03:44:24
 openmp-gcc-x86_64-linux-debian   | 03:41:37
 clang-native-arm-lnt-perf| 03:37:14
 clang-x86_64-debian-fast | 03:36:25
 clang-x86_64-debian-new-pass-manager-fast| 03:36:24
 openmp-clang-x86_64-linux-debian | 03:34:49
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast | 03:27:59
 clang-s390x-linux-multistage | 03:24:56
 clang-ppc64be-linux-lnt  | 02:26:56
 clang-cmake-x86_64-avx2-linux| 01:57:59
 llvm-avr-linux   | 01:53:01
 llvm-clang-x86_64-win-fast   | 01:36:18
 sanitizer-x86_64-linux-fuzzer| 01:35:52
 clang-s390x-linux| 01:18:45
 sanitizer-windows| 01:14:39
 clang-cmake-x86_64-sde-avx512-linux  | 01:06:06
 clang-ppc64be-linux  | 00:55:16
 lld-x86_64-ubuntu-fast   | 00:54:40
 clang-cmake-armv7-lnt| 00:42:31
 clang-x86_64-linux-abi-test  | 00:39:38
 polly-x86_64-linux-test-suite| 00:34:48
 publish-sphinx-docs  | 00:33:54
 libc-x86_64-debian   | 00:29:38
 libc-x86_64-debian-dbg

Buildbot numbers for the week of 07/26/2020 - 08/01/2020

2020-08-10 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the week of 07/26/2020 - 08/01/2020.

Please see the same data in attached csv files:

The longest time each builder was red during the week;
"Status change ratio" by active builder (percent of builds that changed the
builder status from green to red or from red to green);
Count of commits by project;
Number of completed builds, failed builds and average build time for
successful builds per active builder;
Average waiting time for a revision to get build result per active builder
(response time).

Thanks

Galina


The longest time each builder was red during the week:
  buildername  | was_red
---+-
 polly-x86_64-linux| 81:11:51
 aosp-O3-polly-before-vectorizer-unprofitable  | 80:28:05
 polly-arm-linux   | 79:10:10
 clang-s390x-linux-multistage  | 60:56:34
 clang-s390x-linux | 54:50:42
 clang-ppc64be-linux-multistage| 54:27:42
 clang-ppc64be-linux-lnt   | 52:41:39
 clang-ppc64be-linux   | 52:24:35
 clang-ppc64le-rhel| 43:57:24
 llvm-avr-linux| 40:46:49
 clang-cmake-aarch64-lld   | 33:45:15
 publish-sphinx-docs   | 23:28:17
 libcxx-libcxxabi-libunwind-aarch64-linux-noexceptions | 19:18:08
 libcxx-libcxxabi-libunwind-armv8-linux-noexceptions   | 19:14:52
 libcxx-libcxxabi-libunwind-x86_64-linux-debian| 17:56:02
 libcxx-libcxxabi-x86_64-linux-debian-noexceptions | 17:55:52
 libcxx-libcxxabi-x86_64-linux-debian  | 17:55:01
 libcxx-libcxxabi-singlethreaded-x86_64-linux-debian   | 17:54:29
 clang-cmake-aarch64-full  | 16:30:22
 libcxx-libcxxabi-libunwind-armv7-linux-noexceptions   | 16:26:18
 libcxx-libcxxabi-libunwind-armv7-linux| 16:26:06
 clang-with-lto-ubuntu | 14:57:27
 libcxx-libcxxabi-libunwind-armv8-linux| 13:39:23
 libcxx-libcxxabi-libunwind-aarch64-linux  | 13:25:19
 clang-cmake-armv8-lld | 13:00:06
 clang-with-thin-lto-ubuntu| 12:37:12
 fuchsia-x86_64-linux  | 12:28:21
 ppc64le-lld-multistage-test   | 12:20:14
 sanitizer-x86_64-linux-bootstrap  | 12:17:40
 lldb-x64-windows-ninja| 10:26:17
 lldb-arm-ubuntu   | 10:26:05
 lldb-aarch64-ubuntu   | 10:24:08
 lldb-x86_64-debian| 10:13:50
 clang-ppc64le-linux-multistage| 08:49:46
 lld-x86_64-win| 07:42:36
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast  | 07:25:37
 lld-x86_64-darwin | 07:24:17
 llvm-clang-x86_64-expensive-checks-win| 05:33:22
 llvm-clang-x86_64-expensive-checks-ubuntu | 05:16:24
 sanitizer-x86_64-linux| 03:57:39
 clang-cuda-t4 | 03:55:31
 sanitizer-ppc64be-linux   | 03:35:58
 clang-ppc64le-linux   | 03:17:56
 llvm-clang-x86_64-expensive-checks-debian | 02:54:46
 libc-x86_64-debian-dbg-asan   | 02:52:05
 sanitizer-x86_64-linux-fast   | 02:38:18
 clang-ppc64le-linux-lnt   | 02:17:51
 llvm-clang-win-x-armv7l   | 02:03:39
 sanitizer-x86_64-linux-bootstrap-ubsan| 02:02:59
 clang-cmake-x86_64-avx2-linux | 01:52:23
 sanitizer-x86_64-linux-fuzzer | 01:48:23
 mlir-windows  | 01:34:56
 clang-cmake-armv7-quick   | 01:29:33
 flang-aarch64-ubuntu  | 01:26:09
 flang-aarch64-ubuntu-clang| 01:22:34
 sanitizer-x86_64-linux-bootstrap-msan | 01:20:25
 clang-x86_64-debian-new-pass-manager-fast | 01:11:05
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast| 01:10:55
 clang-x86_64-debian-fast  | 01:10:42
 clang-cmake-armv7-global-isel | 01:09:38
 clang-x86_64-linux-abi-test   | 01:05:19
 openmp-gcc-x86_64-linux-debian| 01:04:02
 clang-cmake-aarch64-quick | 01:03:19
 mlir-nvidia   | 00:58:53
 llvm-clang-win-

Buildbot numbers for the week of 07/19/2020 - 07/25/2020

2020-08-10 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the week of 07/19/2020 - 07/25/2020.

Please see the same data in attached csv files:

The longest time each builder was red during the week;
"Status change ratio" by active builder (percent of builds that changed the
builder status from green to red or from red to green);
Count of commits by project;
Number of completed builds, failed builds and average build time for
successful builds per active builder;
Average waiting time for a revision to get build result per active builder
(response time).

Thanks

Galina


The longest time each builder was red during the week:
   buildername   |  was_red
-+--
 polly-arm-linux | 108:46:13
 aosp-O3-polly-before-vectorizer-unprofitable| 107:14:37
 polly-x86_64-linux  | 106:44:58
 sanitizer-x86_64-linux-android  | 80:01:07
 clang-armv7-linux-build-cache   | 51:39:03
 clang-cmake-aarch64-lld | 49:08:27
 lldb-x64-windows-ninja  | 45:34:57
 clang-cmake-aarch64-full| 44:02:11
 libcxx-libcxxabi-x86_64-linux-debian| 33:34:26
 clang-ppc64le-rhel  | 32:53:02
 ppc64le-lld-multistage-test | 29:20:02
 clang-native-arm-lnt-perf   | 27:41:10
 clang-cmake-armv8-lld   | 26:15:16
 sanitizer-ppc64be-linux | 25:56:13
 sanitizer-windows   | 24:45:02
 flang-aarch64-ubuntu-clang  | 18:45:51
 llvm-avr-linux  | 17:48:39
 clang-ppc64le-linux-multistage  | 13:37:02
 lldb-arm-ubuntu | 11:50:01
 lldb-aarch64-ubuntu | 11:44:22
 sanitizer-x86_64-linux  | 09:08:54
 sanitizer-x86_64-linux-autoconf | 06:01:01
 clang-ppc64be-linux-multistage  | 05:31:43
 openmp-clang-x86_64-linux-debian| 05:23:02
 llvm-clang-win-x-armv7l | 04:59:39
 clang-cmake-aarch64-global-isel | 04:46:55
 clang-with-lto-ubuntu   | 04:40:39
 clang-cmake-aarch64-quick   | 04:38:40
 clang-ppc64le-linux-lnt | 04:35:27
 clang-s390x-linux   | 04:31:14
 clang-ppc64le-linux | 04:18:58
 clang-cmake-armv7-global-isel   | 04:17:17
 clang-cmake-armv7-lnt   | 04:14:00
 clang-s390x-linux-multistage| 04:12:48
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast| 04:07:37
 clang-ppc64be-linux-lnt | 04:07:26
 fuchsia-x86_64-linux| 04:04:57
 llvm-clang-win-x-aarch64| 04:03:39
 clang-ppc64be-linux | 04:00:12
 clang-cmake-armv7-quick | 03:58:08
 clang-x86_64-debian-new-pass-manager-fast   | 03:49:12
 clang-x86_64-debian-fast| 03:49:04
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast  | 03:45:50
 libc-x86_64-debian-dbg-asan | 03:42:16
 libc-x86_64-debian-dbg  | 03:41:48
 libc-x86_64-debian  | 03:41:27
 sanitizer-x86_64-linux-fast | 03:31:22
 clang-with-thin-lto-ubuntu  | 02:57:56
 sanitizer-x86_64-linux-fuzzer   | 02:49:31
 clang-x86_64-linux-abi-test | 02:45:03
 sanitizer-x86_64-linux-bootstrap| 02:44:38
 llvm-clang-x86_64-expensive-checks-win  | 02:43:37
 lld-x86_64-darwin   | 02:16:03
 sanitizer-x86_64-linux-bootstrap-msan   | 02:10:55
 lld-x86_64-win  | 02:07:04
 lldb-x86_64-debian  | 02:04:15
 clang-cmake-x86_64-avx2-linux   | 01:58:58
 sanitizer-x86_64-linux-bootstrap-ubsan  | 01:58:53
 clang-cmake-x86_64-sde-avx512-linux | 01:44:04
 lld-x86_64-ubuntu-fast  | 01:40:16
 llvm-clang-x86_64-expensive-checks-debian   | 01:38:13
 flang-aarch64-ubuntu| 01:37:45
 publish-sphinx

[clang] 5fe1713 - [Sparc] Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP macros on SPARCv9

2020-08-10 Thread Brad Smith via cfe-commits

Author: Brad Smith
Date: 2020-08-11T00:04:24-04:00
New Revision: 5fe171321c018a811debc306a776dbdf27a306dd

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

LOG: [Sparc] Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP macros on SPARCv9

Added: 


Modified: 
clang/lib/Basic/Targets/Sparc.cpp
clang/test/Preprocessor/predefined-arch-macros.c

Removed: 




diff  --git a/clang/lib/Basic/Targets/Sparc.cpp 
b/clang/lib/Basic/Targets/Sparc.cpp
index 13aa964d4716..48f36c5ba1c6 100644
--- a/clang/lib/Basic/Targets/Sparc.cpp
+++ b/clang/lib/Basic/Targets/Sparc.cpp
@@ -240,6 +240,11 @@ void SparcV9TargetInfo::getTargetDefines(const LangOptions 
&Opts,
 Builder.defineMacro("__sparc_v9__");
 Builder.defineMacro("__sparcv9__");
   }
+
+  Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
+  Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
+  Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
+  Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
 }
 
 void SparcV9TargetInfo::fillValidCPUList(

diff  --git a/clang/test/Preprocessor/predefined-arch-macros.c 
b/clang/test/Preprocessor/predefined-arch-macros.c
index e457a0479b33..abab9274ffbb 100644
--- a/clang/test/Preprocessor/predefined-arch-macros.c
+++ b/clang/test/Preprocessor/predefined-arch-macros.c
@@ -3174,6 +3174,14 @@
 // CHECK_SPARCV9: #define __sparcv9 1
 // CHECK_SPARCV9: #define __sparcv9__ 1
 
+// RUN: %clang -E -dM %s -o - 2>&1 \
+// RUN: -target sparcv9-unknown-linux \
+// RUN:   | FileCheck -match-full-lines %s 
-check-prefix=CHECK_SPARCV9_GCC_ATOMICS
+// CHECK_SPARCV9_GCC_ATOMICS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
+// CHECK_SPARCV9_GCC_ATOMICS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
+// CHECK_SPARCV9_GCC_ATOMICS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
+// CHECK_SPARCV9_GCC_ATOMICS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
+
 // Begin SystemZ/GCC/Linux tests 
 
 // RUN: %clang -march=arch8 -E -dM %s -o - 2>&1 \



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


[PATCH] D85576: [clang][Fuchsia] Add relative-vtables multilib

2020-08-10 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 284573.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85576

Files:
  clang/cmake/caches/Fuchsia-stage2.cmake
  clang/lib/Driver/ToolChains/Fuchsia.cpp
  
clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-fuchsia/c++/relative-vtables+noexcept/libc++.so
  
clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-fuchsia/c++/relative-vtables/libc++.so
  
clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/c++/relative-vtables+noexcept/libc++.so
  
clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/c++/relative-vtables/libc++.so
  clang/test/Driver/fuchsia.cpp

Index: clang/test/Driver/fuchsia.cpp
===
--- clang/test/Driver/fuchsia.cpp
+++ clang/test/Driver/fuchsia.cpp
@@ -86,8 +86,20 @@
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN: -fuse-ld=lld 2>&1\
 // RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-ASAN-NOEXCEPT-X86
+// RUN: %clangxx %s -### --target=x86_64-fuchsia -fexperimental-relative-c++-abi-vtables \
+// RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
+// RUN: -fuse-ld=lld 2>&1\
+// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-RELATIVE-VTABLES-X86
+// RUN: %clangxx %s -### --target=x86_64-fuchsia -fexperimental-relative-c++-abi-vtables -fno-exceptions \
+// RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
+// RUN: -fuse-ld=lld 2>&1\
+// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-RELATIVE-VTABLES-NOEXCEPT-X86
 // CHECK-MULTILIB-X86: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-MULTILIB-ASAN-X86: "-L{{.*}}{{/|}}..{{/|}}lib{{/|}}x86_64-fuchsia{{/|}}c++{{/|}}asan"
 // CHECK-MULTILIB-NOEXCEPT-X86: "-L{{.*}}{{/|}}..{{/|}}lib{{/|}}x86_64-fuchsia{{/|}}c++{{/|}}noexcept"
 // CHECK-MULTILIB-ASAN-NOEXCEPT-X86: "-L{{.*}}{{/|}}..{{/|}}lib{{/|}}x86_64-fuchsia{{/|}}c++{{/|}}asan+noexcept"
+// CHECK-MULTILIB-RELATIVE-VTABLES-X86: "-L{{.*}}{{/|}}..{{/|}}lib{{/|}}x86_64-fuchsia{{/|}}c++{{/|}}relative-vtables"
+// CHECK-MULTILIB-RELATIVE-VTABLES-NOEXCEPT-X86: "-L{{.*}}{{/|}}..{{/|}}lib{{/|}}x86_64-fuchsia{{/|}}c++{{/|}}relative-vtables+noexcept"
 // CHECK-MULTILIB-X86: "-L{{.*}}{{/|}}..{{/|}}lib{{/|}}x86_64-fuchsia{{/|}}c++"
Index: clang/lib/Driver/ToolChains/Fuchsia.cpp
===
--- clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -164,6 +164,12 @@
   CmdArgs.push_back("-lc");
   }
 
+  if (Args.hasFlag(options::OPT_fexperimental_relative_cxx_abi_vtables,
+   options::OPT_fno_experimental_relative_cxx_abi_vtables,
+   /*default=*/false)) {
+CmdArgs.push_back("-fexperimental-relative-c++-abi-vtables");
+  }
+
   C.addCommand(std::make_unique(JA, *this, ResponseFileSupport::None(),
  Exec, CmdArgs, Inputs));
 }
@@ -208,6 +214,13 @@
   .flag("+fsanitize=address")
   .flag("-fexceptions")
   .flag("+fno-exceptions"));
+  // Use the relative vtables ABI.
+  Multilibs.push_back(Multilib("relative-vtables", {}, {}, 4)
+  .flag("+fexperimental-relative-c++-abi-vtables"));
+  Multilibs.push_back(Multilib("relative-vtables+noexcept", {}, {}, 5)
+  .flag("+fexperimental-relative-c++-abi-vtables")
+  .flag("-fexceptions")
+  .flag("+fno-exceptions"));
   Multilibs.FilterOut([&](const Multilib &M) {
 std::vector RD = FilePaths(M);
 return std::all_of(RD.begin(), RD.end(), [&](std::string P) {
@@ -220,6 +233,25 @@
   Args.hasFlag(options::OPT_fexceptions, options::OPT_fno_exceptions, true),
   "fexceptions", Flags);
   addMultilibFlag(getSanitizerArgs().needsAsanRt(), "fsanitize=address", Flags);
+
+  bool UsingRelativeVtables =
+  Args.hasFlag(options::OPT_fexperimental_relative_cxx_abi_vtables,
+   options::OPT_fno_experimental_relative_cxx_abi_vtables,
+   /*default=*/false);
+
+  // At this point in the pipeline, -Xclang flags haven't been parsed yet, so
+  // -fexperimental-relative-c++-abi-vtables will not be parsed into an option.
+  // Instead we can just check if -Xclang was used with this as a value.
+  for (const std::string &Flag : Args.getAllArgValues(options::OPT_Xclang)) {
+if (Flag == "-fexperimental-relative-c++-abi-vtables") {
+  UsingRelativeVtables = true;
+  break;
+   

[PATCH] D37809: [analyzer] PthreadLock: Refactor, use PostCall API. NFC.

2020-08-10 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.
Herald added subscribers: steakhal, ASDenysPetrov, martong, Charusso, dkrupp, 
donat.nagy, Szelethus, mikhail.ramalho, rnkovacs, szepet, baloghadamsoftware.

This patch has already landed as rG152bc7ffdcd8f62b2279803642f162610154cd2e 
. I forgot 
the magic word.


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

https://reviews.llvm.org/D37809

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


[PATCH] D84600: [Analyzer] Support note tags for smart ptr checker

2020-08-10 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision.
NoQ added a comment.

Let's land this! Damn, we've learned //a lot// from this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84600

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


[PATCH] D84520: [Analyzer] Improve invalid dereference bug reporting in DereferenceChecker.

2020-08-10 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

In D84520#2206077 , @balazske wrote:

> Do the null pointer and invalid pointer dereference belong to the same 
> checker, that is called //NullDereference//?

Yup. And that's bad.

Note that the only reason to have checker names is to allow users to 
enable/disable the checkers. Given that enabling/disabling core checkers was 
never supported to begin with, this wasn't much of an issue. Now that we're 
moving into the direction of allowing users to //silence// core checkers 
without disabling their modeling benefits, this becomes much more of a problem 
and there's a number of checker name inconsistencies that we'll have to 
revisit. Another famous inconsistency is having a popular case of null 
dereference, "calling a C++ method on a null pointer", is in fact checked by 
the `core.CallAndMessage` checker rather than by `core.NullDereference`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84520

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


[PATCH] D85431: [analyzer] Implement a new checker ThreadPrimitivesChecker

2020-08-10 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

Umm, why don't you extend `PthreadLockChecker` instead?


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

https://reviews.llvm.org/D85431

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


[clang] 4aaa977 - [Sema] Fix missing warning on initializer lists on field initializers with overloaded operators

2020-08-10 Thread Zequan Wu via cfe-commits

Author: Zequan Wu
Date: 2020-08-10T19:32:59-07:00
New Revision: 4aaa97700377a811dbcaf88a81ec068a5b517a4d

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

LOG: [Sema] Fix missing warning on initializer lists on field initializers with 
overloaded operators

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

Added: 


Modified: 
clang/lib/Sema/SemaDeclCXX.cpp
clang/test/SemaCXX/uninitialized.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 057062a7372f..ea3f6786d151 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -3577,8 +3577,10 @@ namespace {
 Base = SubME->getBase();
   }
 
-  if (!isa(Base->IgnoreParenImpCasts()))
+  if (!isa(Base->IgnoreParenImpCasts())) {
+Visit(Base);
 return;
+  }
 
   if (AddressOf && AllPODFields)
 return;

diff  --git a/clang/test/SemaCXX/uninitialized.cpp 
b/clang/test/SemaCXX/uninitialized.cpp
index cdfcb2a9cbed..0c7b13a56ee8 100644
--- a/clang/test/SemaCXX/uninitialized.cpp
+++ b/clang/test/SemaCXX/uninitialized.cpp
@@ -1303,6 +1303,20 @@ namespace init_list {
   d3{ d3.b, num } // expected-warning{{uninitialized}}
 {}
   };
+  
+  struct E {
+E();
+E foo();
+E* operator->();
+  };
+
+  struct F { F(E); };
+
+  struct EFComposed {
+F f;
+E e;
+EFComposed() : f{ e->foo() }, e() {} // expected-warning{{uninitialized}}
+  };
 }
 
 namespace template_class {



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


[PATCH] D85574: [Sema] Fix missing warning on initializer lists on field initializers with overloaded operators

2020-08-10 Thread Zequan Wu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4aaa97700377: [Sema] Fix missing warning on initializer 
lists on field initializers with… (authored by zequanwu).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85574

Files:
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/SemaCXX/uninitialized.cpp


Index: clang/test/SemaCXX/uninitialized.cpp
===
--- clang/test/SemaCXX/uninitialized.cpp
+++ clang/test/SemaCXX/uninitialized.cpp
@@ -1303,6 +1303,20 @@
   d3{ d3.b, num } // expected-warning{{uninitialized}}
 {}
   };
+  
+  struct E {
+E();
+E foo();
+E* operator->();
+  };
+
+  struct F { F(E); };
+
+  struct EFComposed {
+F f;
+E e;
+EFComposed() : f{ e->foo() }, e() {} // expected-warning{{uninitialized}}
+  };
 }
 
 namespace template_class {
Index: clang/lib/Sema/SemaDeclCXX.cpp
===
--- clang/lib/Sema/SemaDeclCXX.cpp
+++ clang/lib/Sema/SemaDeclCXX.cpp
@@ -3577,8 +3577,10 @@
 Base = SubME->getBase();
   }
 
-  if (!isa(Base->IgnoreParenImpCasts()))
+  if (!isa(Base->IgnoreParenImpCasts())) {
+Visit(Base);
 return;
+  }
 
   if (AddressOf && AllPODFields)
 return;


Index: clang/test/SemaCXX/uninitialized.cpp
===
--- clang/test/SemaCXX/uninitialized.cpp
+++ clang/test/SemaCXX/uninitialized.cpp
@@ -1303,6 +1303,20 @@
   d3{ d3.b, num } // expected-warning{{uninitialized}}
 {}
   };
+  
+  struct E {
+E();
+E foo();
+E* operator->();
+  };
+
+  struct F { F(E); };
+
+  struct EFComposed {
+F f;
+E e;
+EFComposed() : f{ e->foo() }, e() {} // expected-warning{{uninitialized}}
+  };
 }
 
 namespace template_class {
Index: clang/lib/Sema/SemaDeclCXX.cpp
===
--- clang/lib/Sema/SemaDeclCXX.cpp
+++ clang/lib/Sema/SemaDeclCXX.cpp
@@ -3577,8 +3577,10 @@
 Base = SubME->getBase();
   }
 
-  if (!isa(Base->IgnoreParenImpCasts()))
+  if (!isa(Base->IgnoreParenImpCasts())) {
+Visit(Base);
 return;
+  }
 
   if (AddressOf && AllPODFields)
 return;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D85545: [Diagnostics] Diagnose missing comma in string array initialization

2020-08-10 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

After not warning on structs, this did find a real missing comma in the 
Chromium codebase, so thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85545

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


[PATCH] D85696: [AST] add parenthesis locations for IfStmt and SwitchStmt

2020-08-10 Thread Zequan Wu via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG94c6ceab539e: [AST] add parenthesis locations for IfStmt and 
SwitchStmt (authored by zequanwu).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85696

Files:
  clang/include/clang/AST/Stmt.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/Stmt.cpp
  clang/lib/Analysis/BodyFarm.cpp
  clang/lib/Parse/ParseStmt.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReaderStmt.cpp
  clang/lib/Serialization/ASTWriterStmt.cpp

Index: clang/lib/Serialization/ASTWriterStmt.cpp
===
--- clang/lib/Serialization/ASTWriterStmt.cpp
+++ clang/lib/Serialization/ASTWriterStmt.cpp
@@ -152,6 +152,8 @@
 Record.AddStmt(S->getInit());
 
   Record.AddSourceLocation(S->getIfLoc());
+  Record.AddSourceLocation(S->getLParenLoc());
+  Record.AddSourceLocation(S->getRParenLoc());
   if (HasElse)
 Record.AddSourceLocation(S->getElseLoc());
 
@@ -175,6 +177,8 @@
 Record.AddDeclRef(S->getConditionVariable());
 
   Record.AddSourceLocation(S->getSwitchLoc());
+  Record.AddSourceLocation(S->getLParenLoc());
+  Record.AddSourceLocation(S->getRParenLoc());
 
   for (SwitchCase *SC = S->getSwitchCaseList(); SC;
SC = SC->getNextSwitchCase())
Index: clang/lib/Serialization/ASTReaderStmt.cpp
===
--- clang/lib/Serialization/ASTReaderStmt.cpp
+++ clang/lib/Serialization/ASTReaderStmt.cpp
@@ -226,6 +226,8 @@
 S->setInit(Record.readSubStmt());
 
   S->setIfLoc(readSourceLocation());
+  S->setLParenLoc(readSourceLocation());
+  S->setRParenLoc(readSourceLocation());
   if (HasElse)
 S->setElseLoc(readSourceLocation());
 }
@@ -247,6 +249,8 @@
 S->setConditionVariable(Record.getContext(), readDeclAs());
 
   S->setSwitchLoc(readSourceLocation());
+  S->setLParenLoc(readSourceLocation());
+  S->setRParenLoc(readSourceLocation());
 
   SwitchCase *PrevSC = nullptr;
   for (auto E = Record.size(); Record.getIdx() != E; ) {
Index: clang/lib/Sema/TreeTransform.h
===
--- clang/lib/Sema/TreeTransform.h
+++ clang/lib/Sema/TreeTransform.h
@@ -1319,19 +1319,23 @@
   /// By default, performs semantic analysis to build the new statement.
   /// Subclasses may override this routine to provide different behavior.
   StmtResult RebuildIfStmt(SourceLocation IfLoc, bool IsConstexpr,
-   Sema::ConditionResult Cond, Stmt *Init, Stmt *Then,
+   SourceLocation LParenLoc, Sema::ConditionResult Cond,
+   SourceLocation RParenLoc, Stmt *Init, Stmt *Then,
SourceLocation ElseLoc, Stmt *Else) {
-return getSema().ActOnIfStmt(IfLoc, IsConstexpr, Init, Cond, Then,
- ElseLoc, Else);
+return getSema().ActOnIfStmt(IfLoc, IsConstexpr, LParenLoc, Init, Cond,
+ RParenLoc, Then, ElseLoc, Else);
   }
 
   /// Start building a new switch statement.
   ///
   /// By default, performs semantic analysis to build the new statement.
   /// Subclasses may override this routine to provide different behavior.
-  StmtResult RebuildSwitchStmtStart(SourceLocation SwitchLoc, Stmt *Init,
-Sema::ConditionResult Cond) {
-return getSema().ActOnStartOfSwitchStmt(SwitchLoc, Init, Cond);
+  StmtResult RebuildSwitchStmtStart(SourceLocation SwitchLoc,
+SourceLocation LParenLoc, Stmt *Init,
+Sema::ConditionResult Cond,
+SourceLocation RParenLoc) {
+return getSema().ActOnStartOfSwitchStmt(SwitchLoc, LParenLoc, Init, Cond,
+RParenLoc);
   }
 
   /// Attach the body to the switch statement.
@@ -7289,9 +7293,9 @@
   Else.get() == S->getElse())
 return S;
 
-  return getDerived().RebuildIfStmt(S->getIfLoc(), S->isConstexpr(), Cond,
-Init.get(), Then.get(), S->getElseLoc(),
-Else.get());
+  return getDerived().RebuildIfStmt(
+  S->getIfLoc(), S->isConstexpr(), S->getLParenLoc(), Cond,
+  S->getRParenLoc(), Init.get(), Then.get(), S->getElseLoc(), Else.get());
 }
 
 template
@@ -7310,8 +7314,9 @@
 return StmtError();
 
   // Rebuild the switch statement.
-  StmtResult Switch
-= getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), Init.get(), Cond);
+  StmtResult Switch =
+  getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
+  Init.get(), C

[clang] 94c6cea - [AST] add parenthesis locations for IfStmt and SwitchStmt

2020-08-10 Thread Zequan Wu via cfe-commits

Author: Zequan Wu
Date: 2020-08-10T19:19:51-07:00
New Revision: 94c6ceab539efe26a1707124e803f444139c1b12

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

LOG: [AST] add parenthesis locations for IfStmt and SwitchStmt

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

Added: 


Modified: 
clang/include/clang/AST/Stmt.h
clang/include/clang/Sema/Sema.h
clang/lib/AST/ASTImporter.cpp
clang/lib/AST/Stmt.cpp
clang/lib/Analysis/BodyFarm.cpp
clang/lib/Parse/ParseStmt.cpp
clang/lib/Sema/SemaDeclCXX.cpp
clang/lib/Sema/SemaStmt.cpp
clang/lib/Sema/TreeTransform.h
clang/lib/Serialization/ASTReaderStmt.cpp
clang/lib/Serialization/ASTWriterStmt.cpp

Removed: 




diff  --git a/clang/include/clang/AST/Stmt.h b/clang/include/clang/AST/Stmt.h
index 13f265223ac1..726c61cb0126 100644
--- a/clang/include/clang/AST/Stmt.h
+++ b/clang/include/clang/AST/Stmt.h
@@ -1895,6 +1895,8 @@ class IfStmt final
   //Present if and only if hasElseStorage().
   enum { InitOffset = 0, ThenOffsetFromCond = 1, ElseOffsetFromCond = 2 };
   enum { NumMandatoryStmtPtr = 2 };
+  SourceLocation LParenLoc;
+  SourceLocation RParenLoc;
 
   unsigned numTrailingObjects(OverloadToken) const {
 return NumMandatoryStmtPtr + hasElseStorage() + hasVarStorage() +
@@ -1915,7 +1917,8 @@ class IfStmt final
 
   /// Build an if/then/else statement.
   IfStmt(const ASTContext &Ctx, SourceLocation IL, bool IsConstexpr, Stmt 
*Init,
- VarDecl *Var, Expr *Cond, Stmt *Then, SourceLocation EL, Stmt *Else);
+ VarDecl *Var, Expr *Cond, SourceLocation LParenLoc,
+ SourceLocation RParenLoc, Stmt *Then, SourceLocation EL, Stmt *Else);
 
   /// Build an empty if/then/else statement.
   explicit IfStmt(EmptyShell Empty, bool HasElse, bool HasVar, bool HasInit);
@@ -1924,7 +1927,8 @@ class IfStmt final
   /// Create an IfStmt.
   static IfStmt *Create(const ASTContext &Ctx, SourceLocation IL,
 bool IsConstexpr, Stmt *Init, VarDecl *Var, Expr *Cond,
-Stmt *Then, SourceLocation EL = SourceLocation(),
+SourceLocation LPL, SourceLocation RPL, Stmt *Then,
+SourceLocation EL = SourceLocation(),
 Stmt *Else = nullptr);
 
   /// Create an empty IfStmt optionally with storage for an else statement,
@@ -2054,6 +2058,10 @@ class IfStmt final
   return getElse()->getEndLoc();
 return getThen()->getEndLoc();
   }
+  SourceLocation getLParenLoc() const { return LParenLoc; }
+  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
+  SourceLocation getRParenLoc() const { return RParenLoc; }
+  void setRParenLoc(SourceLocation Loc) { RParenLoc = Loc; }
 
   // Iterators over subexpressions.  The iterators will include iterating
   // over the initialization expression referenced by the condition variable.
@@ -2101,6 +2109,8 @@ class SwitchStmt final : public Stmt,
   //Always present.
   enum { InitOffset = 0, BodyOffsetFromCond = 1 };
   enum { NumMandatoryStmtPtr = 2 };
+  SourceLocation LParenLoc;
+  SourceLocation RParenLoc;
 
   unsigned numTrailingObjects(OverloadToken) const {
 return NumMandatoryStmtPtr + hasInitStorage() + hasVarStorage();
@@ -2114,7 +2124,8 @@ class SwitchStmt final : public Stmt,
   unsigned bodyOffset() const { return condOffset() + BodyOffsetFromCond; }
 
   /// Build a switch statement.
-  SwitchStmt(const ASTContext &Ctx, Stmt *Init, VarDecl *Var, Expr *Cond);
+  SwitchStmt(const ASTContext &Ctx, Stmt *Init, VarDecl *Var, Expr *Cond,
+ SourceLocation LParenLoc, SourceLocation RParenLoc);
 
   /// Build a empty switch statement.
   explicit SwitchStmt(EmptyShell Empty, bool HasInit, bool HasVar);
@@ -2122,7 +2133,8 @@ class SwitchStmt final : public Stmt,
 public:
   /// Create a switch statement.
   static SwitchStmt *Create(const ASTContext &Ctx, Stmt *Init, VarDecl *Var,
-Expr *Cond);
+Expr *Cond, SourceLocation LParenLoc,
+SourceLocation RParenLoc);
 
   /// Create an empty switch statement optionally with storage for
   /// an init expression and a condition variable.
@@ -2210,6 +,10 @@ class SwitchStmt final : public Stmt,
 
   SourceLocation getSwitchLoc() const { return SwitchStmtBits.SwitchLoc; }
   void setSwitchLoc(SourceLocation L) { SwitchStmtBits.SwitchLoc = L; }
+  SourceLocation getLParenLoc() const { return LParenLoc; }
+  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
+  SourceLocation getRParenLoc() const { return RParenLoc; }
+  void setRParenLoc(SourceLocation Loc) { RParenLoc = Loc; }
 
   void setBody(Stmt *S, SourceLocation SL) {
 setBody(S);

diff  --git a/clang/include/clang/Sema

[PATCH] D85696: [AST] add parenthesis locations for IfStmt and SwitchStmt

2020-08-10 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu updated this revision to Diff 284557.
zequanwu marked 3 inline comments as done.
zequanwu added a comment.

Address comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85696

Files:
  clang/include/clang/AST/Stmt.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/Stmt.cpp
  clang/lib/Analysis/BodyFarm.cpp
  clang/lib/Parse/ParseStmt.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReaderStmt.cpp
  clang/lib/Serialization/ASTWriterStmt.cpp

Index: clang/lib/Serialization/ASTWriterStmt.cpp
===
--- clang/lib/Serialization/ASTWriterStmt.cpp
+++ clang/lib/Serialization/ASTWriterStmt.cpp
@@ -152,6 +152,8 @@
 Record.AddStmt(S->getInit());
 
   Record.AddSourceLocation(S->getIfLoc());
+  Record.AddSourceLocation(S->getLParenLoc());
+  Record.AddSourceLocation(S->getRParenLoc());
   if (HasElse)
 Record.AddSourceLocation(S->getElseLoc());
 
@@ -175,6 +177,8 @@
 Record.AddDeclRef(S->getConditionVariable());
 
   Record.AddSourceLocation(S->getSwitchLoc());
+  Record.AddSourceLocation(S->getLParenLoc());
+  Record.AddSourceLocation(S->getRParenLoc());
 
   for (SwitchCase *SC = S->getSwitchCaseList(); SC;
SC = SC->getNextSwitchCase())
Index: clang/lib/Serialization/ASTReaderStmt.cpp
===
--- clang/lib/Serialization/ASTReaderStmt.cpp
+++ clang/lib/Serialization/ASTReaderStmt.cpp
@@ -226,6 +226,8 @@
 S->setInit(Record.readSubStmt());
 
   S->setIfLoc(readSourceLocation());
+  S->setLParenLoc(readSourceLocation());
+  S->setRParenLoc(readSourceLocation());
   if (HasElse)
 S->setElseLoc(readSourceLocation());
 }
@@ -247,6 +249,8 @@
 S->setConditionVariable(Record.getContext(), readDeclAs());
 
   S->setSwitchLoc(readSourceLocation());
+  S->setLParenLoc(readSourceLocation());
+  S->setRParenLoc(readSourceLocation());
 
   SwitchCase *PrevSC = nullptr;
   for (auto E = Record.size(); Record.getIdx() != E; ) {
Index: clang/lib/Sema/TreeTransform.h
===
--- clang/lib/Sema/TreeTransform.h
+++ clang/lib/Sema/TreeTransform.h
@@ -1319,19 +1319,23 @@
   /// By default, performs semantic analysis to build the new statement.
   /// Subclasses may override this routine to provide different behavior.
   StmtResult RebuildIfStmt(SourceLocation IfLoc, bool IsConstexpr,
-   Sema::ConditionResult Cond, Stmt *Init, Stmt *Then,
+   SourceLocation LParenLoc, Sema::ConditionResult Cond,
+   SourceLocation RParenLoc, Stmt *Init, Stmt *Then,
SourceLocation ElseLoc, Stmt *Else) {
-return getSema().ActOnIfStmt(IfLoc, IsConstexpr, Init, Cond, Then,
- ElseLoc, Else);
+return getSema().ActOnIfStmt(IfLoc, IsConstexpr, LParenLoc, Init, Cond,
+ RParenLoc, Then, ElseLoc, Else);
   }
 
   /// Start building a new switch statement.
   ///
   /// By default, performs semantic analysis to build the new statement.
   /// Subclasses may override this routine to provide different behavior.
-  StmtResult RebuildSwitchStmtStart(SourceLocation SwitchLoc, Stmt *Init,
-Sema::ConditionResult Cond) {
-return getSema().ActOnStartOfSwitchStmt(SwitchLoc, Init, Cond);
+  StmtResult RebuildSwitchStmtStart(SourceLocation SwitchLoc,
+SourceLocation LParenLoc, Stmt *Init,
+Sema::ConditionResult Cond,
+SourceLocation RParenLoc) {
+return getSema().ActOnStartOfSwitchStmt(SwitchLoc, LParenLoc, Init, Cond,
+RParenLoc);
   }
 
   /// Attach the body to the switch statement.
@@ -7289,9 +7293,9 @@
   Else.get() == S->getElse())
 return S;
 
-  return getDerived().RebuildIfStmt(S->getIfLoc(), S->isConstexpr(), Cond,
-Init.get(), Then.get(), S->getElseLoc(),
-Else.get());
+  return getDerived().RebuildIfStmt(
+  S->getIfLoc(), S->isConstexpr(), S->getLParenLoc(), Cond,
+  S->getRParenLoc(), Init.get(), Then.get(), S->getElseLoc(), Else.get());
 }
 
 template
@@ -7310,8 +7314,9 @@
 return StmtError();
 
   // Rebuild the switch statement.
-  StmtResult Switch
-= getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), Init.get(), Cond);
+  StmtResult Switch =
+  getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), S->getLParenLoc(),
+  Init.get(), Cond, S->getRParenLoc());
   if (Switch.isInvalid())
 return StmtError();
 
Index: clang/lib/Sema/SemaStmt.

[PATCH] D85574: [Sema] Fix missing warning on initializer lists on field initializers with overloaded operators

2020-08-10 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu accepted this revision.
rtrieu 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/D85574/new/

https://reviews.llvm.org/D85574

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


[PATCH] D85385: [X86][FPEnv] Teach X86 mask compare intrinsics to respect strict FP semantics.

2020-08-10 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/D85385/new/

https://reviews.llvm.org/D85385

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


[PATCH] D85574: [Sema] Fix missing warning on initializer lists on field initializers with overloaded operators

2020-08-10 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu added inline comments.



Comment at: clang/lib/Sema/SemaDeclCXX.cpp:3584-3585
 
   if (!isa(Base->IgnoreParenImpCasts()))
 return;
 

rtrieu wrote:
> Does the warning work if it was changed to be "Visit(Base);" before the 
> return here instead of the change above?
Yes, done.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85574

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


[PATCH] D85574: [Sema] Fix missing warning on initializer lists on field initializers with overloaded operators

2020-08-10 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu updated this revision to Diff 284551.
zequanwu marked an inline comment as done.
zequanwu added a comment.

Address comment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85574

Files:
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/SemaCXX/uninitialized.cpp


Index: clang/test/SemaCXX/uninitialized.cpp
===
--- clang/test/SemaCXX/uninitialized.cpp
+++ clang/test/SemaCXX/uninitialized.cpp
@@ -1303,6 +1303,20 @@
   d3{ d3.b, num } // expected-warning{{uninitialized}}
 {}
   };
+  
+  struct E {
+E();
+E foo();
+E* operator->();
+  };
+
+  struct F { F(E); };
+
+  struct EFComposed {
+F f;
+E e;
+EFComposed() : f{ e->foo() }, e() {} // expected-warning{{uninitialized}}
+  };
 }
 
 namespace template_class {
Index: clang/lib/Sema/SemaDeclCXX.cpp
===
--- clang/lib/Sema/SemaDeclCXX.cpp
+++ clang/lib/Sema/SemaDeclCXX.cpp
@@ -3577,8 +3577,10 @@
 Base = SubME->getBase();
   }
 
-  if (!isa(Base->IgnoreParenImpCasts()))
+  if (!isa(Base->IgnoreParenImpCasts())) {
+Visit(Base);
 return;
+  }
 
   if (AddressOf && AllPODFields)
 return;


Index: clang/test/SemaCXX/uninitialized.cpp
===
--- clang/test/SemaCXX/uninitialized.cpp
+++ clang/test/SemaCXX/uninitialized.cpp
@@ -1303,6 +1303,20 @@
   d3{ d3.b, num } // expected-warning{{uninitialized}}
 {}
   };
+  
+  struct E {
+E();
+E foo();
+E* operator->();
+  };
+
+  struct F { F(E); };
+
+  struct EFComposed {
+F f;
+E e;
+EFComposed() : f{ e->foo() }, e() {} // expected-warning{{uninitialized}}
+  };
 }
 
 namespace template_class {
Index: clang/lib/Sema/SemaDeclCXX.cpp
===
--- clang/lib/Sema/SemaDeclCXX.cpp
+++ clang/lib/Sema/SemaDeclCXX.cpp
@@ -3577,8 +3577,10 @@
 Base = SubME->getBase();
   }
 
-  if (!isa(Base->IgnoreParenImpCasts()))
+  if (!isa(Base->IgnoreParenImpCasts())) {
+Visit(Base);
 return;
+  }
 
   if (AddressOf && AllPODFields)
 return;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D85385: [X86][FPEnv] Teach X86 mask compare intrinsics to respect strict FP semantics.

2020-08-10 Thread Pengfei Wang via Phabricator via cfe-commits
pengfei added inline comments.



Comment at: clang/test/CodeGen/avx512f-builtins-constrained-cmp.c:793
   // CHECK-LABEL: test_mm512_mask_cmp_pd_mask_true_us
-  // CHECK: [[CMP:%.*]] = call <8 x i1> @llvm.x86.avx512.cmp.pd.512(<8 x 
double> %{{.*}}, <8 x double> %{{.*}}, i32 31, i32 4)
-  // CHECK: and <8 x i1> [[CMP]], {{.*}}
+  // CHECK: call <8 x i1> @llvm.x86.avx512.mask.cmp.pd.512(<8 x double> 
%{{.*}}, <8 x double> %{{.*}}, i32 31, <8 x i1> {{.*}}, i32 4) #2
   return _mm512_mask_cmp_pd_mask(m, a, b, _CMP_TRUE_US);

craig.topper wrote:
> I missed this in our internal review. All of these check lines check "#2" at 
> the end, do we need that? 
No. I forgot to remove them. Thank you.



Comment at: llvm/lib/IR/AutoUpgrade.cpp:3764
+
+if (NumElts < 8) {
+  int Indices[8];

craig.topper wrote:
> Can we use getX86MaskVec here?
Sure. It's more clean now. Thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85385

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


[PATCH] D85099: [UpdateTestChecks] Match unnamed values like "@[0-9]+" and "![0-9]+"

2020-08-10 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

(I'm going to sneak in `!range !` as well)




Comment at: llvm/utils/UpdateTestChecks/common.py:330
+IR_VALUE_REGEXP_STRING += nameless_value.ir_prefix + r'(' + 
nameless_value.ir_regexp + r')'
+IR_VALUE_REGEXP_SUFFIX = r'([,\s\(\)]|\Z)'
+IR_VALUE_RE = re.compile(IR_VALUE_REGEXP_PREFIX + r'(' + 
IR_VALUE_REGEXP_STRING + r')' + IR_VALUE_REGEXP_SUFFIX)

MaskRay wrote:
> Can the suffix use `(?:...)`?
We use the captured value later, and I guess people want to keep the exact same 
"spaces". TBH, it won't make much difference to the logic anywhere (we'd still 
use `match.lastindex`). All it would do is it would make us "unify" the output, 
unsure if that is what we want.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85099

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


[PATCH] D85099: [UpdateTestChecks] Match unnamed values like "@[0-9]+" and "![0-9]+"

2020-08-10 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert updated this revision to Diff 284543.
jdoerfert marked an inline comment as done.
jdoerfert added a comment.

added @MaskRays's tweaks


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85099

Files:
  clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp.expected
  clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.funcattrs.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.plain.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/scrub_attrs.ll.plain.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.expected
  llvm/test/tools/UpdateTestChecks/update_test_checks/various_ir_values.test
  llvm/utils/UpdateTestChecks/asm.py
  llvm/utils/UpdateTestChecks/common.py
  llvm/utils/update_cc_test_checks.py
  llvm/utils/update_test_checks.py

Index: llvm/utils/update_test_checks.py
===
--- llvm/utils/update_test_checks.py
+++ llvm/utils/update_test_checks.py
@@ -101,6 +101,7 @@
   # now, we just ignore all but the last.
   prefix_list.append((check_prefixes, tool_cmd_args))
 
+global_vars_seen_dict = {}
 func_dict = {}
 for prefixes, _ in prefix_list:
   for prefix in prefixes:
@@ -134,7 +135,8 @@
 
 # Print out the various check lines here.
 common.add_ir_checks(output_lines, ';', prefix_list, func_dict,
- func_name, args.preserve_names, args.function_signature)
+ func_name, args.preserve_names, args.function_signature,
+ global_vars_seen_dict)
 is_in_function_start = False
 
   if is_in_function:
Index: llvm/utils/update_cc_test_checks.py
===
--- llvm/utils/update_cc_test_checks.py
+++ llvm/utils/update_cc_test_checks.py
@@ -262,6 +262,7 @@
   for k, v in get_line2spell_and_mangled(ti.args, clang_args).items():
 line2spell_and_mangled_list[k].append(v)
 
+global_vars_seen_dict = {}
 prefix_set = set([prefix for p in run_list for prefix in p[0]])
 output_lines = []
 for line_info in ti.iterlines(output_lines):
@@ -293,7 +294,7 @@
   output_lines.append('//')
 added.add(mangled)
 common.add_ir_checks(output_lines, '//', run_list, func_dict, mangled,
- False, args.function_signature)
+ False, args.function_signature, global_vars_seen_dict)
 if line.rstrip('\n') == '//':
   include_line = False
 
Index: llvm/utils/UpdateTestChecks/common.py
===
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -229,12 +229,12 @@
   def is_same_except_arg_names(self, extrascrub, args_and_sig, attrs):
 arg_names = set()
 def drop_arg_names(match):
-arg_names.add(match.group(2))
-return match.group(1) + match.group(3)
+arg_names.add(match.group(3))
+return match.group(1) + match.group(match.lastindex)
 def repl_arg_names(match):
-if match.group(2) in arg_names:
-return match.group(1) + match.group(3)
-return match.group(1) + match.group(2) + match.group(3)
+if match.group(3) in arg_names:
+return match.group(1) + match.group(match.lastindex)
+return match.group(1) + match.group(2) + match.group(match.lastindex)
 if self.attrs != attrs:
   return False
 ans0 = IR_VALUE_RE.sub(drop_arg_names, self.args_and_sig)
@@ -297,49 +297,110 @@
 
 SCRUB_IR_COMMENT_RE = re.compile(r'\s*;.*')
 
-# Match things that look at identifiers, but only if they are followed by
-# spaces, commas, paren, or end of the string
-IR_VALUE_RE = re.compile(r'(\s+)%([\w.-]+?)([,\s\(\)]|\Z)')
-
-NAMELESS_PREFIX = "TMP"
+# TODO: We should also derive check lines for global, debug, loop declarations, etc..
+
+class NamelessValue:
+def __init__(self, check_prefix, ir_prefix, ir_regexp):
+self.check_prefix = check_prefix
+self.ir_prefix = ir_prefix
+self.ir_regexp = ir_regexp
+
+# Description of the different "unnamed" values we match in the IR, e.g.,
+# (local) ssa values, (debug) metadata, etc.
+nameless_values = [
+NamelessValue(r'TMP',  r'%',r'[\w.-]+?'),
+NamelessValue(r'GLOB', r'@',r'[0-9]+?'),
+NamelessValue(r'ATTR', r'#',r'[0-9]+?'),
+NamelessValue(r'DBG',  r'!dbg !',   r'[0-9]+?'),
+   

[PATCH] D83088: Introduce CfgTraits abstraction

2020-08-10 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

This seems like a strange hybrid between a static-polymorphism (with traits) 
and dynamic polymorphism (with base classes/virtual functions). Could this more 
readily be just one or the other? (sounds like you're leaning towards dynamic 
polymorphism)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83088

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


[PATCH] D85696: [AST] add parenthesis locations for IfStmt and SwitchStmt

2020-08-10 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

Only relatively trivial comments; please feel free to commit once they're 
addressed.




Comment at: clang/include/clang/Sema/Sema.h:4382-4393
+  StmtResult ActOnIfStmt(SourceLocation IfLoc, bool IsConstexpr, Stmt 
*InitStmt,
+ ConditionResult Cond, SourceLocation LParenLoc,
+ SourceLocation RParenLoc, Stmt *ThenVal,
  SourceLocation ElseLoc, Stmt *ElseVal);
-  StmtResult BuildIfStmt(SourceLocation IfLoc, bool IsConstexpr,
- Stmt *InitStmt,
- ConditionResult Cond, Stmt *ThenVal,
+  StmtResult BuildIfStmt(SourceLocation IfLoc, bool IsConstexpr, Stmt 
*InitStmt,
+ ConditionResult Cond, SourceLocation LParenLoc,
+ SourceLocation RParenLoc, Stmt *ThenVal,

Generally we put the parameters to the `ActOn*` functions in syntactic order, 
so `LParenLoc` should precede `InitStmt` in each of the above functions.



Comment at: clang/lib/Sema/SemaDeclCXX.cpp:8028-8029
   Sema::ConditionKind::Boolean),
- ReturnFalse.get(), SourceLocation(), nullptr);
+ SourceLocation(), SourceLocation(), ReturnFalse.get(),
+ SourceLocation(), nullptr);
   }

This code is generally using `Loc` as the location of all of its components. 
Perhaps we should do the same for the location of the parentheses?



Comment at: clang/lib/Sema/SemaDeclCXX.cpp:8182
   return S.ActOnIfStmt(Loc, /*IsConstexpr=*/false, InitStmt, Cond,
+   /*LPL=*/SourceLocation(), /*RPL=*/SourceLocation(),
ReturnStmt.get(), /*ElseLoc=*/SourceLocation(),

Likewise here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85696

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


[clang] ed66df6 - test commit

2020-08-10 Thread Albion Fung via cfe-commits

Author: Albion Fung
Date: 2020-08-10T21:18:36-04:00
New Revision: ed66df6705a9dffc36fecc3468cc3ab430849182

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

LOG: test commit

Added: 


Modified: 
clang/test/CodeGen/builtins-ppc-p10vector.c

Removed: 




diff  --git a/clang/test/CodeGen/builtins-ppc-p10vector.c 
b/clang/test/CodeGen/builtins-ppc-p10vector.c
index 5bab616921b3..2279d9c57c86 100644
--- a/clang/test/CodeGen/builtins-ppc-p10vector.c
+++ b/clang/test/CodeGen/builtins-ppc-p10vector.c
@@ -2,7 +2,6 @@
 // RUN: %clang_cc1 -target-feature +vsx \
 // RUN:   -target-cpu pwr10 -triple powerpc64-unknown-unknown -emit-llvm %s \
 // RUN:   -o - | FileCheck %s -check-prefixes=CHECK-BE,CHECK
-
 // RUN: %clang_cc1 -target-feature +vsx \
 // RUN:   -target-cpu pwr10 -triple powerpc64le-unknown-unknown -emit-llvm %s \
 // RUN:   -o - | FileCheck %s -check-prefixes=CHECK-LE,CHECK



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


[PATCH] D85601: Fixes an assertion when IntRange processes a throw expression

2020-08-10 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments.



Comment at: clang/lib/Sema/SemaChecking.cpp:10164
 const BuiltinType *BT = cast(T);
-assert(BT->isInteger());
+if (!BT->isInteger()) {
+  // This can happen in a conditional expression with a throw statement

Mordante wrote:
> rsmith wrote:
> > Can we handle this in code that's specific to conditional expressions 
> > instead? Presumably somewhere higher up in the call graph, some code is 
> > assuming that it can recurse from a conditional expression to its 
> > subexpressions, and that assumption is wrong.
> I can take  a look at it if you want. However I feel this fix is better. If 
> the conditional doesn't throw it can properly evaluate the required IntRange. 
> If it throws the range doesn't matter, therefore I didn't want to increment 
> the required range.
> Do you agree?
> Should I add more comment to clarify the design decission?
In order to get here, we need to have called functions that are documented as 
taking only integer types but passing them a `void` type. So the bug has 
already occurred before we got here.



Comment at: clang/lib/Sema/SemaChecking.cpp:10317-10320
 IntRange L =
 GetExprRange(C, CO->getTrueExpr(), MaxWidth, InConstantContext);
 IntRange R =
 GetExprRange(C, CO->getFalseExpr(), MaxWidth, InConstantContext);

It seems to me that the bug is here. `GetExprRange` is documented as 
"Pseudo-evaluate the given **integer** expression", but the true and false 
expressions here might not be integer expressions -- specifically, one of them 
could be of type `void` if it's a //throw-expression//. In that case, we should 
only call `GetExprRange` on the other expression. The expression range of the 
`void`-typed expression is irrelevant in this case, because that expression 
never returns.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85601

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


[PATCH] D85574: [Sema] Fix missing warning on initializer lists on field initializers with overloaded operators

2020-08-10 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added inline comments.



Comment at: clang/lib/Sema/SemaDeclCXX.cpp:3584-3585
 
   if (!isa(Base->IgnoreParenImpCasts()))
 return;
 

Does the warning work if it was changed to be "Visit(Base);" before the return 
here instead of the change above?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85574

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


[PATCH] D85099: [UpdateTestChecks] Match unnamed values like "@[0-9]+" and "![0-9]+"

2020-08-10 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

Mostly looks good.




Comment at: llvm/utils/UpdateTestChecks/common.py:309
+
+nameless_values = []
+# Description of the different "unnamed" values we match in the IR, e.g.,

```lang=python
nameless_values = [
NamelessValue(r'TMP',  r'%',r'[\w.-]+?'),
NamelessValue(r'TMP',  r'%',r'[\w.-]+?'),
...
]
```



Comment at: llvm/utils/UpdateTestChecks/common.py:330
+IR_VALUE_REGEXP_STRING += nameless_value.ir_prefix + r'(' + 
nameless_value.ir_regexp + r')'
+IR_VALUE_REGEXP_SUFFIX = r'([,\s\(\)]|\Z)'
+IR_VALUE_RE = re.compile(IR_VALUE_REGEXP_PREFIX + r'(' + 
IR_VALUE_REGEXP_STRING + r')' + IR_VALUE_REGEXP_SUFFIX)

Can the suffix use `(?:...)`?



Comment at: llvm/utils/UpdateTestChecks/common.py:402
+  while changed:
+  (lines[i], changed) = IR_VALUE_RE.subn(transform_line_vars, lines[i])
   return lines

jdoerfert wrote:
> MaskRay wrote:
> > Do you have an example that not substituting repeatedly can fail?
> Line 8 in 
> `llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.expected`
>  :)
This is indeed strange. If we don't have a good explanation, probably worth 
adding `count=1`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85099

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


[PATCH] D85699: PR47099: Split out of .

2020-08-10 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith created this revision.
rsmith added reviewers: hans, BillyONeal.
Herald added subscribers: cfe-commits, jfb, mgorny.
Herald added a project: clang.
rsmith requested review of this revision.

This aims to be compatible with Visual C++'s , but not
exactly match it. The contents of  are a subset of 
that provide the parts that the STL needs without pulling in all of
. We don't want to hardcode exactly which things are in
, as that changes over time depending on the needs of the
STL, so instead include all the MS-specific functions, and none of the
 functions except for the ones that we know the MS STL
needs -- specifically, _tzcnt_u*.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85699

Files:
  clang/lib/Headers/CMakeLists.txt
  clang/lib/Headers/bmiintrin.h
  clang/lib/Headers/intrin.h
  clang/lib/Headers/intrin0.h
  clang/test/Headers/ms-intrin0.cpp

Index: clang/test/Headers/ms-intrin0.cpp
===
--- /dev/null
+++ clang/test/Headers/ms-intrin0.cpp
@@ -0,0 +1,40 @@
+// RUN: %clang_cc1 -triple x86_64-pc-win32  \
+// RUN: -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
+// RUN: -ffreestanding -emit-obj -o /dev/null -Werror \
+// RUN: -isystem %S/Inputs/include %s
+
+// RUN: %clang_cc1 -triple i386-pc-win32 \
+// RUN: -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
+// RUN: -ffreestanding -emit-obj -o /dev/null -Werror \
+// RUN: -isystem %S/Inputs/include %s
+
+// RUN: %clang_cc1 -triple thumbv7--windows \
+// RUN: -fms-compatibility -fms-compatibility-version=17.00 \
+// RUN: -ffreestanding -fsyntax-only -Werror \
+// RUN: -isystem %S/Inputs/include %s
+
+// REQUIRES: x86-registered-target
+
+#include 
+
+// Use some C++ to make sure we closed the extern "C" brackets.
+template 
+void foo(T V) {}
+
+void f(long *lp, unsigned long *ulp) {
+  _BitScanForward(ulp, 123L);
+  _bittest(lp, 3);
+  _InterlockedExchange(lp, 123L);
+  _InterlockedIncrement(lp);
+  const volatile __int64 x = 0;
+  __iso_volatile_load64(&x);
+
+#if defined _M_IX86 || defined _M_X64
+  _tzcnt_u32(123);
+#endif
+
+#ifdef _M_ARM
+  __yield();
+  __dmb(123);
+#endif
+}
Index: clang/lib/Headers/intrin0.h
===
--- clang/lib/Headers/intrin0.h
+++ clang/lib/Headers/intrin0.h
@@ -1,4 +1,4 @@
-/* === intrin.h ---===
+/* === intrin0.h --===
  *
  * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  * See https://llvm.org/LICENSE.txt for license information.
@@ -7,30 +7,17 @@
  *===---===
  */
 
+#ifndef __CLANG_INTRIN0_H
+#define __CLANG_INTRIN0_H
+
 /* Only include this if we're compiling for the windows platform. */
 #ifndef _MSC_VER
-#include_next 
+#include_next 
 #else
 
-#ifndef __INTRIN_H
-#define __INTRIN_H
-
-/* First include the standard intrinsics. */
+/* _tzcnt_u32 and _tzcnt_u64 are provided by . */
 #if defined(__i386__) || defined(__x86_64__)
-#include 
-#endif
-
-#if defined(__arm__)
-#include 
-#endif
-
-#if defined(__aarch64__)
-#include 
-#endif
-
-/* For the definition of jmp_buf. */
-#if __STDC_HOSTED__
-#include 
+#include 
 #endif
 
 /* Define the default attributes for the functions in this file. */
@@ -46,13 +33,10 @@
 extern "C" {
 #endif
 
-#if defined(__MMX__)
-/* And the random ones that aren't in those files. */
-__m64 _m_from_float(float);
-float _m_to_float(__m64);
-#endif
-
 /* Other assorted instruction intrinsics. */
+/* FIXME: We could cut this down substantially by checking which of
+ * these MSVC actually provides in its .
+ */
 void __addfsbyte(unsigned long, unsigned char);
 void __addfsdword(unsigned long, unsigned long);
 void __addfsword(unsigned long, unsigned short);
@@ -594,5 +578,5 @@
 
 #undef __DEFAULT_FN_ATTRS
 
-#endif /* __INTRIN_H */
 #endif /* _MSC_VER */
+#endif /* __CLANG_INTRIN0_H */
Index: clang/lib/Headers/intrin.h
===
--- clang/lib/Headers/intrin.h
+++ clang/lib/Headers/intrin.h
@@ -7,14 +7,14 @@
  *===---===
  */
 
+#ifndef __CLANG_INTRIN_H
+#define __CLANG_INTRIN_H
+
 /* Only include this if we're compiling for the windows platform. */
 #ifndef _MSC_VER
 #include_next 
 #else
 
-#ifndef __INTRIN_H
-#define __INTRIN_H
-
 /* First include the standard intrinsics. */
 #if defined(__i386__) || defined(__x86_64__)
 #include 
@@ -33,566 +33,20 @@
 #include 
 #endif
 
-/* Define the default attributes for the functions in this file. */
-#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
-
-#if __x86_64__
-#define __LPTRINT_TYPE__ __int64
-#else
-#define __LPTRINT_TYPE__ long
-#endif
-
-#ifdef __cplusplus
-e

[PATCH] D85099: [UpdateTestChecks] Match unnamed values like "@[0-9]+" and "![0-9]+"

2020-08-10 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert updated this revision to Diff 284537.
jdoerfert added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Update clang tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85099

Files:
  clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp.expected
  clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.funcattrs.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.plain.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/scrub_attrs.ll.plain.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.expected
  llvm/test/tools/UpdateTestChecks/update_test_checks/various_ir_values.test
  llvm/utils/UpdateTestChecks/asm.py
  llvm/utils/UpdateTestChecks/common.py
  llvm/utils/update_cc_test_checks.py
  llvm/utils/update_test_checks.py

Index: llvm/utils/update_test_checks.py
===
--- llvm/utils/update_test_checks.py
+++ llvm/utils/update_test_checks.py
@@ -101,6 +101,7 @@
   # now, we just ignore all but the last.
   prefix_list.append((check_prefixes, tool_cmd_args))
 
+global_vars_seen_dict = {}
 func_dict = {}
 for prefixes, _ in prefix_list:
   for prefix in prefixes:
@@ -134,7 +135,8 @@
 
 # Print out the various check lines here.
 common.add_ir_checks(output_lines, ';', prefix_list, func_dict,
- func_name, args.preserve_names, args.function_signature)
+ func_name, args.preserve_names, args.function_signature,
+ global_vars_seen_dict)
 is_in_function_start = False
 
   if is_in_function:
Index: llvm/utils/update_cc_test_checks.py
===
--- llvm/utils/update_cc_test_checks.py
+++ llvm/utils/update_cc_test_checks.py
@@ -262,6 +262,7 @@
   for k, v in get_line2spell_and_mangled(ti.args, clang_args).items():
 line2spell_and_mangled_list[k].append(v)
 
+global_vars_seen_dict = {}
 prefix_set = set([prefix for p in run_list for prefix in p[0]])
 output_lines = []
 for line_info in ti.iterlines(output_lines):
@@ -293,7 +294,7 @@
   output_lines.append('//')
 added.add(mangled)
 common.add_ir_checks(output_lines, '//', run_list, func_dict, mangled,
- False, args.function_signature)
+ False, args.function_signature, global_vars_seen_dict)
 if line.rstrip('\n') == '//':
   include_line = False
 
Index: llvm/utils/UpdateTestChecks/common.py
===
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -229,12 +229,12 @@
   def is_same_except_arg_names(self, extrascrub, args_and_sig, attrs):
 arg_names = set()
 def drop_arg_names(match):
-arg_names.add(match.group(2))
-return match.group(1) + match.group(3)
+arg_names.add(match.group(3))
+return match.group(1) + match.group(match.lastindex)
 def repl_arg_names(match):
-if match.group(2) in arg_names:
-return match.group(1) + match.group(3)
-return match.group(1) + match.group(2) + match.group(3)
+if match.group(3) in arg_names:
+return match.group(1) + match.group(match.lastindex)
+return match.group(1) + match.group(2) + match.group(match.lastindex)
 if self.attrs != attrs:
   return False
 ans0 = IR_VALUE_RE.sub(drop_arg_names, self.args_and_sig)
@@ -297,49 +297,110 @@
 
 SCRUB_IR_COMMENT_RE = re.compile(r'\s*;.*')
 
-# Match things that look at identifiers, but only if they are followed by
-# spaces, commas, paren, or end of the string
-IR_VALUE_RE = re.compile(r'(\s+)%([\w.-]+?)([,\s\(\)]|\Z)')
-
-NAMELESS_PREFIX = "TMP"
+# TODO: We should also derive check lines for global, debug, loop declarations, etc..
+
+class NamelessValue:
+def __init__(self, check_prefix, ir_prefix, ir_regexp):
+self.check_prefix = check_prefix
+self.ir_prefix = ir_prefix
+self.ir_regexp = ir_regexp
+
+
+nameless_values = []
+# Description of the different "unnamed" values we match in the IR, e.g.,
+# (local) ssa values, (debug) metadata, etc.
+nameless_values.append(NamelessValue(r'TMP',  r'%',r'[\w.-]+?'))
+nameless_values.append(NamelessValue(r'GLOB', r'@',r'[0-9]+?'))
+nameless_values.append(NamelessValue(r'ATTR', r'#',  

[PATCH] D79773: [clang-format] Improve clang-formats handling of concepts

2020-08-10 Thread Johel Ernesto Guerrero Peña via Phabricator via cfe-commits
JohelEGP added a comment.

I found another case. See how everything after the //requires-clause// is 
indented for constructors with just the constructor's name (it works otherwise, 
maybe because it looks like a function).

  class [[nodiscard]] data_t
  {
  public:
  template 
  requires std::same_as, 
flippable_tile_id>
  /*explicit*/ data_t(R&& ids, const format_t f = encoding_t::csv)
: format_t{f}, tile_ids_{ranges::to_vector(std::forward(ids))}
  {
  }
  
  [[nodiscard]] bool operator==(const data_t&) const = default;
  };


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

https://reviews.llvm.org/D79773

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


[PATCH] D85385: [X86][FPEnv] Teach X86 mask compare intrinsics to respect strict FP semantics.

2020-08-10 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: clang/test/CodeGen/avx512f-builtins-constrained-cmp.c:793
   // CHECK-LABEL: test_mm512_mask_cmp_pd_mask_true_us
-  // CHECK: [[CMP:%.*]] = call <8 x i1> @llvm.x86.avx512.cmp.pd.512(<8 x 
double> %{{.*}}, <8 x double> %{{.*}}, i32 31, i32 4)
-  // CHECK: and <8 x i1> [[CMP]], {{.*}}
+  // CHECK: call <8 x i1> @llvm.x86.avx512.mask.cmp.pd.512(<8 x double> 
%{{.*}}, <8 x double> %{{.*}}, i32 31, <8 x i1> {{.*}}, i32 4) #2
   return _mm512_mask_cmp_pd_mask(m, a, b, _CMP_TRUE_US);

I missed this in our internal review. All of these check lines check "#2" at 
the end, do we need that? 



Comment at: llvm/lib/IR/AutoUpgrade.cpp:3764
+
+if (NumElts < 8) {
+  int Indices[8];

Can we use getX86MaskVec here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85385

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


[PATCH] D85695: [OpenMP] split execution of a long test into smaller parts.

2020-08-10 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev accepted this revision.
ABataev added a comment.
This revision is now accepted and ready to land.

LG


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85695

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


[PATCH] D85619: [clang][OpenMP][OMPBuilder] Use OMPBuilder to CG `omp single`

2020-08-10 Thread Fady Ghanim via Phabricator via cfe-commits
fghanim added a comment.

In D85619#2208425 , @kiranchandramohan 
wrote:

> Before I start, Why is this change all new code and no modification or 
> deletion of existing Clang functionality for omp single/copyprivate?

Because the OMPBuilder currently is not the default way to CG OMP code in 
clang, which means the old way needs to keep working. So, we cannot delete or 
modify anything, we can only add the OMPBuilder specific code, and condition 
its usage on whether `-fopenmp-enable-irbuilder` flag has been issued, or not.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85619

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


[PATCH] D85385: [X86][FPEnv] Teach X86 mask compare intrinsics to respect strict FP semantics.

2020-08-10 Thread Pengfei Wang via Phabricator via cfe-commits
pengfei added a comment.

Ping.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85385

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


[PATCH] D85697: [clang-tidy] Add cppcoreguidelines-prefer-scoped-enums-over-unscoped

2020-08-10 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added a comment.

Please mention new check in Release Notes.




Comment at: 
clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-prefer-scoped-enums-over-unscoped.rst:22
+
+After the fix is applied, the enum will become:
+

Please enclose enum in double back-ticks.



Comment at: 
clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-prefer-scoped-enums-over-unscoped.rst:65
+  CREATE_ENUM(class Foo);
\ No newline at end of file


Please add newline.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85697

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


[PATCH] D85685: [WIP] Support dwarf fission for wasm object files

2020-08-10 Thread Wouter van Oortmerssen via Phabricator via cfe-commits
aardappel accepted this revision.
aardappel added a comment.
This revision is now accepted and ready to land.

Nice, fairly unintrusive actually. If you desperately wanted to fix the need 
for changing `W` dynamically, you could instead make it allocate a second 
`WasmObjectWriter` to write the `dwo` version? :)




Comment at: llvm/lib/MC/MCAsmBackend.cpp:66
+  default:
 report_fatal_error("dwo only supported with ELF");
+  }

change error message


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85685

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


[PATCH] D85696: [AST] add parenthesis locations for IfStmt and SwitchStmt

2020-08-10 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu updated this revision to Diff 284532.
zequanwu added a comment.

Forgot changes on ASTReaderStmt.cpp, added now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85696

Files:
  clang/include/clang/AST/Stmt.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/Stmt.cpp
  clang/lib/Analysis/BodyFarm.cpp
  clang/lib/Parse/ParseStmt.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReaderStmt.cpp
  clang/lib/Serialization/ASTWriterStmt.cpp

Index: clang/lib/Serialization/ASTWriterStmt.cpp
===
--- clang/lib/Serialization/ASTWriterStmt.cpp
+++ clang/lib/Serialization/ASTWriterStmt.cpp
@@ -152,6 +152,8 @@
 Record.AddStmt(S->getInit());
 
   Record.AddSourceLocation(S->getIfLoc());
+  Record.AddSourceLocation(S->getLParenLoc());
+  Record.AddSourceLocation(S->getRParenLoc());
   if (HasElse)
 Record.AddSourceLocation(S->getElseLoc());
 
@@ -175,6 +177,8 @@
 Record.AddDeclRef(S->getConditionVariable());
 
   Record.AddSourceLocation(S->getSwitchLoc());
+  Record.AddSourceLocation(S->getLParenLoc());
+  Record.AddSourceLocation(S->getRParenLoc());
 
   for (SwitchCase *SC = S->getSwitchCaseList(); SC;
SC = SC->getNextSwitchCase())
Index: clang/lib/Serialization/ASTReaderStmt.cpp
===
--- clang/lib/Serialization/ASTReaderStmt.cpp
+++ clang/lib/Serialization/ASTReaderStmt.cpp
@@ -226,6 +226,8 @@
 S->setInit(Record.readSubStmt());
 
   S->setIfLoc(readSourceLocation());
+  S->setLParenLoc(readSourceLocation());
+  S->setRParenLoc(readSourceLocation());
   if (HasElse)
 S->setElseLoc(readSourceLocation());
 }
@@ -247,6 +249,8 @@
 S->setConditionVariable(Record.getContext(), readDeclAs());
 
   S->setSwitchLoc(readSourceLocation());
+  S->setLParenLoc(readSourceLocation());
+  S->setRParenLoc(readSourceLocation());
 
   SwitchCase *PrevSC = nullptr;
   for (auto E = Record.size(); Record.getIdx() != E; ) {
Index: clang/lib/Sema/TreeTransform.h
===
--- clang/lib/Sema/TreeTransform.h
+++ clang/lib/Sema/TreeTransform.h
@@ -1319,10 +1319,11 @@
   /// By default, performs semantic analysis to build the new statement.
   /// Subclasses may override this routine to provide different behavior.
   StmtResult RebuildIfStmt(SourceLocation IfLoc, bool IsConstexpr,
-   Sema::ConditionResult Cond, Stmt *Init, Stmt *Then,
+   Sema::ConditionResult Cond, SourceLocation LParenLoc,
+   SourceLocation RParenLoc, Stmt *Init, Stmt *Then,
SourceLocation ElseLoc, Stmt *Else) {
-return getSema().ActOnIfStmt(IfLoc, IsConstexpr, Init, Cond, Then,
- ElseLoc, Else);
+return getSema().ActOnIfStmt(IfLoc, IsConstexpr, Init, Cond, LParenLoc,
+ RParenLoc, Then, ElseLoc, Else);
   }
 
   /// Start building a new switch statement.
@@ -1330,8 +1331,11 @@
   /// By default, performs semantic analysis to build the new statement.
   /// Subclasses may override this routine to provide different behavior.
   StmtResult RebuildSwitchStmtStart(SourceLocation SwitchLoc, Stmt *Init,
-Sema::ConditionResult Cond) {
-return getSema().ActOnStartOfSwitchStmt(SwitchLoc, Init, Cond);
+Sema::ConditionResult Cond,
+SourceLocation LParenLoc,
+SourceLocation RParenLoc) {
+return getSema().ActOnStartOfSwitchStmt(SwitchLoc, Init, Cond, LParenLoc,
+RParenLoc);
   }
 
   /// Attach the body to the switch statement.
@@ -7289,9 +7293,9 @@
   Else.get() == S->getElse())
 return S;
 
-  return getDerived().RebuildIfStmt(S->getIfLoc(), S->isConstexpr(), Cond,
-Init.get(), Then.get(), S->getElseLoc(),
-Else.get());
+  return getDerived().RebuildIfStmt(
+  S->getIfLoc(), S->isConstexpr(), Cond, S->getLParenLoc(),
+  S->getRParenLoc(), Init.get(), Then.get(), S->getElseLoc(), Else.get());
 }
 
 template
@@ -7310,8 +7314,9 @@
 return StmtError();
 
   // Rebuild the switch statement.
-  StmtResult Switch
-= getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), Init.get(), Cond);
+  StmtResult Switch =
+  getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), Init.get(), Cond,
+  S->getLParenLoc(), S->getRParenLoc());
   if (Switch.isInvalid())
 return StmtError();
 
Index: clang/lib/Sema/SemaStmt.cpp
===

[PATCH] D85697: [clang-tidy] Add cppcoreguidelines-prefer-scoped-enums-over-unscoped

2020-08-10 Thread János Benjamin Antal via Phabricator via cfe-commits
janosbenjaminantal created this revision.
janosbenjaminantal added reviewers: alexfh, njames93, xazax.hun, Eugene.Zelenko.
Herald added subscribers: cfe-commits, aaron.ballman, rnkovacs, kbarton, 
mgorny, nemanjai.
Herald added a project: clang.
janosbenjaminantal requested review of this revision.
Herald added a subscriber: wuzish.

This check aims to flag every occurence of unscoped enumerations and provide 
useful fix to convert them to scoped enumerations.

It works for the most cases, except when an enumeration is defined within a 
macro, but the name of enumeration is a macro argument. This is indicated in 
the documentation.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85697

Files:
  clang-tools-extra/clang-tidy/cppcoreguidelines/CMakeLists.txt
  clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
  
clang-tools-extra/clang-tidy/cppcoreguidelines/PreferScopedEnumsOverUnscopedCheck.cpp
  
clang-tools-extra/clang-tidy/cppcoreguidelines/PreferScopedEnumsOverUnscopedCheck.h
  
clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-prefer-scoped-enums-over-unscoped.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-prefer-scoped-enums-over-unscoped.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-prefer-scoped-enums-over-unscoped.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-prefer-scoped-enums-over-unscoped.cpp
@@ -0,0 +1,33 @@
+// RUN: %check_clang_tidy %s cppcoreguidelines-prefer-scoped-enums-over-unscoped %t --
+
+enum UnscopedEnum {
+  // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: enumeration 'UnscopedEnum' is not a scoped enumeration [cppcoreguidelines-prefer-scoped-enums-over-unscoped]
+  UE_FirstValue,
+  UE_SecondValue,
+};
+// CHECK-FIXES: {{^}}enum class UnscopedEnum {{{$}}
+
+enum UnscopedEnumWithFixedUnderlyingType : char {
+  // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: enumeration 'UnscopedEnumWithFixedUnderlyingType' is not a scoped enumeration [cppcoreguidelines-prefer-scoped-enums-over-unscoped]
+  UEWFUT_FirstValue,
+  UEWFUT_SecondValue,
+};
+// CHECK-FIXES: {{^}}enum class UnscopedEnumWithFixedUnderlyingType : char {{{$}}
+
+enum OpaqueUnscopedEnum : char;
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: enumeration 'OpaqueUnscopedEnum' is not a scoped enumeration [cppcoreguidelines-prefer-scoped-enums-over-unscoped]
+// CHECK-FIXES: {{^}}enum class OpaqueUnscopedEnum : char;{{$}}
+
+enum class ScopedEnumWithClass {
+  SEWC_FirstValue,
+  SEWC_SecondValue,
+};
+
+enum struct ScopedEnumWithStruct {
+  SEWC_FirstValue,
+  SEWC_SecondValue,
+};
+
+enum class OpaqueScopedEnum;
+
+enum class OpaqueScopedEnumWithFixedUnderlyingType : unsigned;
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
@@ -141,6 +141,7 @@
`cppcoreguidelines-narrowing-conversions `_,
`cppcoreguidelines-no-malloc `_,
`cppcoreguidelines-owning-memory `_,
+   `cppcoreguidelines-prefer-scoped-enums-over-unscoped `_, "Yes"
`cppcoreguidelines-pro-bounds-array-to-pointer-decay `_,
`cppcoreguidelines-pro-bounds-constant-array-index `_, "Yes"
`cppcoreguidelines-pro-bounds-pointer-arithmetic `_,
Index: clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-prefer-scoped-enums-over-unscoped.rst
===
--- /dev/null
+++ clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-prefer-scoped-enums-over-unscoped.rst
@@ -0,0 +1,64 @@
+.. title:: clang-tidy - cppcoreguidelines-prefer-scoped-enums-over-unscoped
+
+cppcoreguidelines-prefer-scoped-enums-over-unscoped
+===
+
+Values of unscoped enumerations are implicitly-convertible to integral types.
+To avoid such unwanted conversions, use scoped enumerations.
+
+This check implements 
+`Enum.3 `_ 
+from the CppCoreGuidelines.
+
+Example:
+
+.. code-block:: c++
+
+  enum Foo {
+A,
+B
+  }
+
+After the fix is applied, the enum will become:
+
+.. code-block:: c++
+
+  enum class Foo {
+A,
+B
+  }
+
+Note: Although ``enum struct`` and ``enum class`` are exactly equivalent, the
+latter is used mainly.
+
+Limitations
+===
+
+If the enumeration is generated via a macro and the enumeration name is
+received as a parameter, then the suggested fix would append the ``class``
+word before the name of enumeration at the macro invocation instead of the
+macro definition.
+
+Example:
+
+.. code-block:: c++
+
+  #define CREATE_ENUM(Name) \
+  enum Name {   \
+A,  \
+B   \

[clang] 0fd3d37 - Improve diagnostic for an expression that's not constant because it uses

2020-08-10 Thread Richard Smith via cfe-commits

Author: Richard Smith
Date: 2020-08-10T17:03:19-07:00
New Revision: 0fd3d379e26da3cb02b6d960198e2efbc5190650

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

LOG: Improve diagnostic for an expression that's not constant because it uses
the address of a constexpr local variable.

Suggest adding 'static' to give the constexpr local variable a constant
address.

Added: 


Modified: 
clang/include/clang/Basic/DiagnosticASTKinds.td
clang/lib/AST/ExprConstant.cpp
clang/test/SemaCXX/builtins.cpp
clang/test/SemaCXX/constant-expression-cxx11.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticASTKinds.td 
b/clang/include/clang/Basic/DiagnosticASTKinds.td
index 10bedaaf7aba..9be75f375119 100644
--- a/clang/include/clang/Basic/DiagnosticASTKinds.td
+++ b/clang/include/clang/Basic/DiagnosticASTKinds.td
@@ -54,6 +54,9 @@ def note_constexpr_nonliteral : Note<
 def note_constexpr_non_global : Note<
   "%select{pointer|reference}0 to %select{|subobject of }1"
   "%select{temporary|%3}2 is not a constant expression">;
+def note_constexpr_not_static : Note<
+  "address of non-static constexpr variable %0 may 
diff er on each invocation "
+  "of the enclosing function; add 'static' to give it a constant address">;
 def note_constexpr_dynamic_alloc : Note<
   "%select{pointer|reference}0 to %select{|subobject of }1"
   "heap-allocated object is not a constant expression">;

diff  --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 11ba8db24355..4238adb5a947 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -2055,7 +2055,20 @@ static bool CheckLValueConstantExpression(EvalInfo 
&Info, SourceLocation Loc,
   Info.FFDiag(Loc, diag::note_constexpr_non_global, 1)
 << IsReferenceType << !Designator.Entries.empty()
 << !!VD << VD;
-  NoteLValueLocation(Info, Base);
+
+  auto *VarD = dyn_cast_or_null(VD);
+  if (VarD && VarD->isConstexpr()) {
+// Non-static local constexpr variables have unintuitive semantics:
+//   constexpr int a = 1;
+//   constexpr const int *p = &a;
+// ... is invalid because the address of 'a' is not constant. Suggest
+// adding a 'static' in this case.
+Info.Note(VarD->getLocation(), diag::note_constexpr_not_static)
+<< VarD
+<< FixItHint::CreateInsertion(VarD->getBeginLoc(), "static ");
+  } else {
+NoteLValueLocation(Info, Base);
+  }
 } else {
   Info.FFDiag(Loc);
 }

diff  --git a/clang/test/SemaCXX/builtins.cpp b/clang/test/SemaCXX/builtins.cpp
index 80f75c8232c2..8869b6bef04c 100644
--- a/clang/test/SemaCXX/builtins.cpp
+++ b/clang/test/SemaCXX/builtins.cpp
@@ -113,7 +113,7 @@ static_assert(&const_int == const_ptr, "");
 static_assert(const_ptr != test_constexpr_launder(&const_int2), "");
 
 void test_non_constexpr() {
-  constexpr int i = 42;// expected-note {{declared 
here}}
+  constexpr int i = 42;// expected-note {{address 
of non-static constexpr variable 'i' may 
diff er on each invocation}}
   constexpr const int *ip = __builtin_launder(&i); // expected-error 
{{constexpr variable 'ip' must be initialized by a constant expression}}
   // expected-note@-1 {{pointer to 'i' is not a constant expression}}
 }

diff  --git a/clang/test/SemaCXX/constant-expression-cxx11.cpp 
b/clang/test/SemaCXX/constant-expression-cxx11.cpp
index 14d36543cb20..c3529fc68266 100644
--- a/clang/test/SemaCXX/constant-expression-cxx11.cpp
+++ b/clang/test/SemaCXX/constant-expression-cxx11.cpp
@@ -2343,3 +2343,8 @@ namespace flexible_array {
   // constant-evaluate it properly.
   constexpr A c = {1, 2, 3}; // expected-error {{initialization of flexible 
array member}}
 }
+
+void local_constexpr_var() {
+  constexpr int a = 0; // expected-note {{address of non-static constexpr 
variable 'a' may 
diff er on each invocation of the enclosing function; add 'static' to give it a 
constant address}}
+  constexpr const int *p = &a; // expected-error {{constant expression}} 
expected-note {{pointer to 'a' is not a constant expression}}
+}



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


[PATCH] D85696: [AST] add parenthesis locations for IfStmt and SwitchStmt

2020-08-10 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu created this revision.
zequanwu added a reviewer: rsmith.
Herald added subscribers: cfe-commits, martong.
Herald added a reviewer: shafik.
Herald added a project: clang.
zequanwu requested review of this revision.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85696

Files:
  clang/include/clang/AST/Stmt.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/Stmt.cpp
  clang/lib/Analysis/BodyFarm.cpp
  clang/lib/Parse/ParseStmt.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTWriterStmt.cpp

Index: clang/lib/Serialization/ASTWriterStmt.cpp
===
--- clang/lib/Serialization/ASTWriterStmt.cpp
+++ clang/lib/Serialization/ASTWriterStmt.cpp
@@ -152,6 +152,8 @@
 Record.AddStmt(S->getInit());
 
   Record.AddSourceLocation(S->getIfLoc());
+  Record.AddSourceLocation(S->getLParenLoc());
+  Record.AddSourceLocation(S->getRParenLoc());
   if (HasElse)
 Record.AddSourceLocation(S->getElseLoc());
 
@@ -175,6 +177,8 @@
 Record.AddDeclRef(S->getConditionVariable());
 
   Record.AddSourceLocation(S->getSwitchLoc());
+  Record.AddSourceLocation(S->getLParenLoc());
+  Record.AddSourceLocation(S->getRParenLoc());
 
   for (SwitchCase *SC = S->getSwitchCaseList(); SC;
SC = SC->getNextSwitchCase())
Index: clang/lib/Sema/TreeTransform.h
===
--- clang/lib/Sema/TreeTransform.h
+++ clang/lib/Sema/TreeTransform.h
@@ -1319,10 +1319,11 @@
   /// By default, performs semantic analysis to build the new statement.
   /// Subclasses may override this routine to provide different behavior.
   StmtResult RebuildIfStmt(SourceLocation IfLoc, bool IsConstexpr,
-   Sema::ConditionResult Cond, Stmt *Init, Stmt *Then,
+   Sema::ConditionResult Cond, SourceLocation LParenLoc,
+   SourceLocation RParenLoc, Stmt *Init, Stmt *Then,
SourceLocation ElseLoc, Stmt *Else) {
-return getSema().ActOnIfStmt(IfLoc, IsConstexpr, Init, Cond, Then,
- ElseLoc, Else);
+return getSema().ActOnIfStmt(IfLoc, IsConstexpr, Init, Cond, LParenLoc,
+ RParenLoc, Then, ElseLoc, Else);
   }
 
   /// Start building a new switch statement.
@@ -1330,8 +1331,11 @@
   /// By default, performs semantic analysis to build the new statement.
   /// Subclasses may override this routine to provide different behavior.
   StmtResult RebuildSwitchStmtStart(SourceLocation SwitchLoc, Stmt *Init,
-Sema::ConditionResult Cond) {
-return getSema().ActOnStartOfSwitchStmt(SwitchLoc, Init, Cond);
+Sema::ConditionResult Cond,
+SourceLocation LParenLoc,
+SourceLocation RParenLoc) {
+return getSema().ActOnStartOfSwitchStmt(SwitchLoc, Init, Cond, LParenLoc,
+RParenLoc);
   }
 
   /// Attach the body to the switch statement.
@@ -7289,7 +7293,8 @@
   Else.get() == S->getElse())
 return S;
 
-  return getDerived().RebuildIfStmt(S->getIfLoc(), S->isConstexpr(), Cond,
+  return getDerived().RebuildIfStmt(S->getIfLoc(), S->isConstexpr(), Cond, 
+S->getLParenLoc(), S->getRParenLoc(),
 Init.get(), Then.get(), S->getElseLoc(),
 Else.get());
 }
@@ -7310,8 +7315,9 @@
 return StmtError();
 
   // Rebuild the switch statement.
-  StmtResult Switch
-= getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), Init.get(), Cond);
+  StmtResult Switch = getDerived().RebuildSwitchStmtStart(
+  S->getSwitchLoc(), Init.get(), Cond, S->getLParenLoc(),
+  S->getRParenLoc());
   if (Switch.isInvalid())
 return StmtError();
 
Index: clang/lib/Sema/SemaStmt.cpp
===
--- clang/lib/Sema/SemaStmt.cpp
+++ clang/lib/Sema/SemaStmt.cpp
@@ -574,11 +574,11 @@
 };
 }
 
-StmtResult
-Sema::ActOnIfStmt(SourceLocation IfLoc, bool IsConstexpr, Stmt *InitStmt,
-  ConditionResult Cond,
-  Stmt *thenStmt, SourceLocation ElseLoc,
-  Stmt *elseStmt) {
+StmtResult Sema::ActOnIfStmt(SourceLocation IfLoc, bool IsConstexpr,
+ Stmt *InitStmt, ConditionResult Cond,
+ SourceLocation LParenLoc, SourceLocation RParenLoc,
+ Stmt *thenStmt, SourceLocation ElseLoc,
+ Stmt *elseStmt) {
   if (Cond.isInvalid())
 Cond = ConditionResult(
 *this, nullptr,
@@ -597,12 +597,13 @@
 DiagnoseEmptyStmtBody(CondExpr->getEndLoc(), thenStmt,
   di

[PATCH] D84068: AMDGPU/clang: Search resource directory for device libraries

2020-08-10 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment.

In D84068#2208394 , @arsenm wrote:

>> 
>
> Long term, I'd rather aim for merging rocm-device-libs into libclc and making 
> it an llvm project. They're largely forks of the same original sources from 
> about 5 years ago, and it's an unfortunate split of effort. I also 
> specifically do not want distros to be shuffling this around, and want it to 
> behave exactly like compiler-rt. As far as I can tell cuda clang does not 
> actually work with the Ubuntu packaged cuda, which arbitrarily moved the nvvm 
> binaries, and I don't really want a repeat of this situation. I also do want 
> the device libs build to support a non-rocm package to install to a standard 
> distro clang package, which is different than the rocm libraries trying to 
> support every clang in the universe. Ideally just a regular clang works 
> without any formal rocm installation.

I like the idea of making rocm-device-libs part of llvm-projects, but I think 
rocm-device-libs is not an OpenCL device library. That said, before 
rocm-device-library become part of llvm-project, we need to support 
rocm-device-library at other locations.


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

https://reviews.llvm.org/D84068

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


[PATCH] D85619: [clang][OpenMP][OMPBuilder] Use OMPBuilder to CG `omp single`

2020-08-10 Thread Kiran Chandramohan via Phabricator via cfe-commits
kiranchandramohan added a comment.

Before I start, Why is this change all new code and no modification or deletion 
of existing Clang functionality for omp single/copyprivate?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85619

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


[clang] fb04d7b - [CUDA][HIP] Do not externalize implicit constant static variable

2020-08-10 Thread Yaxun Liu via cfe-commits

Author: Yaxun (Sam) Liu
Date: 2020-08-10T19:02:49-04:00
New Revision: fb04d7b4a69831f6b999b1776da738557b108e0d

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

LOG: [CUDA][HIP] Do not externalize implicit constant static variable

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

Added: 


Modified: 
clang/include/clang/AST/ASTContext.h
clang/lib/AST/ASTContext.cpp
clang/lib/Sema/SemaExpr.cpp
clang/test/CodeGenCUDA/static-device-var-no-rdc.cu

Removed: 




diff  --git a/clang/include/clang/AST/ASTContext.h 
b/clang/include/clang/AST/ASTContext.h
index 78207a4aad31..b5fb1a4da480 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -3034,6 +3034,9 @@ OPT_LIST(V)
   /// Return a new OMPTraitInfo object owned by this context.
   OMPTraitInfo &getNewOMPTraitInfo();
 
+  /// Whether a C++ static variable may be externalized.
+  bool mayExternalizeStaticVar(const Decl *D) const;
+
   /// Whether a C++ static variable should be externalized.
   bool shouldExternalizeStaticVar(const Decl *D) const;
 

diff  --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 61e39dc176a9..7947de3a31fc 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -11191,10 +11191,17 @@ clang::operator<<(const DiagnosticBuilder &DB,
   return DB << "a prior #pragma section";
 }
 
-bool ASTContext::shouldExternalizeStaticVar(const Decl *D) const {
+bool ASTContext::mayExternalizeStaticVar(const Decl *D) const {
   return !getLangOpts().GPURelocatableDeviceCode &&
- (D->hasAttr() || D->hasAttr()) &&
+ ((D->hasAttr() &&
+   !D->getAttr()->isImplicit()) ||
+  (D->hasAttr() &&
+   !D->getAttr()->isImplicit())) &&
  isa(D) && cast(D)->isFileVarDecl() &&
- cast(D)->getStorageClass() == SC_Static &&
+ cast(D)->getStorageClass() == SC_Static;
+}
+
+bool ASTContext::shouldExternalizeStaticVar(const Decl *D) const {
+  return mayExternalizeStaticVar(D) &&
  CUDAStaticDeviceVarReferencedByHost.count(cast(D));
 }

diff  --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 0d7f81e0d01a..79340a9c7d7b 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -17910,8 +17910,7 @@ static void DoMarkVarDeclReferenced(Sema &SemaRef, 
SourceLocation Loc,
   // This also requires the reference of the static device/constant variable by
   // host code to be visible in the device compilation for the compiler to be
   // able to externalize the static device/constant variable.
-  if ((Var->hasAttr() || Var->hasAttr()) &&
-  Var->isFileVarDecl() && Var->getStorageClass() == SC_Static) {
+  if (SemaRef.getASTContext().mayExternalizeStaticVar(Var)) {
 auto *CurContext = SemaRef.CurContext;
 if (!CurContext || !isa(CurContext) ||
 cast(CurContext)->hasAttr() ||

diff  --git a/clang/test/CodeGenCUDA/static-device-var-no-rdc.cu 
b/clang/test/CodeGenCUDA/static-device-var-no-rdc.cu
index 1aea467c2d49..c7beb4c7e1ac 100644
--- a/clang/test/CodeGenCUDA/static-device-var-no-rdc.cu
+++ b/clang/test/CodeGenCUDA/static-device-var-no-rdc.cu
@@ -1,11 +1,11 @@
 // REQUIRES: x86-registered-target
 // REQUIRES: amdgpu-registered-target
 
-// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fcuda-is-device \
+// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fcuda-is-device -std=c++11 \
 // RUN:   -emit-llvm -o - -x hip %s | FileCheck \
 // RUN:   -check-prefixes=DEV %s
 
-// RUN: %clang_cc1 -triple x86_64-gnu-linux \
+// RUN: %clang_cc1 -triple x86_64-gnu-linux -std=c++11 \
 // RUN:   -emit-llvm -o - -x hip %s | FileCheck \
 // RUN:   -check-prefixes=HOST %s
 
@@ -53,6 +53,12 @@ static __constant__ int y;
 // DEV-NOT: @_ZL1z
 static int z;
 
+// Test implicit static constant variable, which should not be externalized.
+// HOST-DAG: @_ZL2z2 = internal constant i32 456
+// DEV-DAG: @_ZL2z2 = internal addrspace(4) constant i32 456
+
+static constexpr int z2 = 456;
+
 // Test static device variable in inline function, which should not be
 // externalized nor registered.
 // DEV-DAG: @_ZZ6devfunPPKiE1p = linkonce_odr addrspace(4) constant i32 2, 
comdat
@@ -72,6 +78,7 @@ __global__ void kernel(int *a, const int **b) {
   a[4] = x4;
   a[5] = x5;
   b[0] = &w;
+  b[1] = &z2;
   devfun(b);
 }
 
@@ -81,11 +88,12 @@ __host__ __device__ void hdf(int *a) {
 
 int* getDeviceSymbol(int *x);
 
-void foo(int *a) {
+void foo(const int **a) {
   getDeviceSymbol(&x);
   getDeviceSymbol(&x5);
   getDeviceSymbol(&y);
   z = 123;
+  a[0] = &z2;
 }
 
 // HOST: __hipRegisterVar({{.*}}@_ZL1x {{.*}}@[[DEVNAMEX]]



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

[PATCH] D85686: [CUDA][HIP] Do not externalize implicit constant static variable

2020-08-10 Thread Yaxun Liu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
yaxunl marked an inline comment as done.
Closed by commit rGfb04d7b4a698: [CUDA][HIP] Do not externalize implicit 
constant static variable (authored by yaxunl).
Herald added a project: clang.

Changed prior to commit:
  https://reviews.llvm.org/D85686?vs=284494&id=284523#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85686

Files:
  clang/include/clang/AST/ASTContext.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/test/CodeGenCUDA/static-device-var-no-rdc.cu

Index: clang/test/CodeGenCUDA/static-device-var-no-rdc.cu
===
--- clang/test/CodeGenCUDA/static-device-var-no-rdc.cu
+++ clang/test/CodeGenCUDA/static-device-var-no-rdc.cu
@@ -1,11 +1,11 @@
 // REQUIRES: x86-registered-target
 // REQUIRES: amdgpu-registered-target
 
-// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fcuda-is-device \
+// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fcuda-is-device -std=c++11 \
 // RUN:   -emit-llvm -o - -x hip %s | FileCheck \
 // RUN:   -check-prefixes=DEV %s
 
-// RUN: %clang_cc1 -triple x86_64-gnu-linux \
+// RUN: %clang_cc1 -triple x86_64-gnu-linux -std=c++11 \
 // RUN:   -emit-llvm -o - -x hip %s | FileCheck \
 // RUN:   -check-prefixes=HOST %s
 
@@ -53,6 +53,12 @@
 // DEV-NOT: @_ZL1z
 static int z;
 
+// Test implicit static constant variable, which should not be externalized.
+// HOST-DAG: @_ZL2z2 = internal constant i32 456
+// DEV-DAG: @_ZL2z2 = internal addrspace(4) constant i32 456
+
+static constexpr int z2 = 456;
+
 // Test static device variable in inline function, which should not be
 // externalized nor registered.
 // DEV-DAG: @_ZZ6devfunPPKiE1p = linkonce_odr addrspace(4) constant i32 2, comdat
@@ -72,6 +78,7 @@
   a[4] = x4;
   a[5] = x5;
   b[0] = &w;
+  b[1] = &z2;
   devfun(b);
 }
 
@@ -81,11 +88,12 @@
 
 int* getDeviceSymbol(int *x);
 
-void foo(int *a) {
+void foo(const int **a) {
   getDeviceSymbol(&x);
   getDeviceSymbol(&x5);
   getDeviceSymbol(&y);
   z = 123;
+  a[0] = &z2;
 }
 
 // HOST: __hipRegisterVar({{.*}}@_ZL1x {{.*}}@[[DEVNAMEX]]
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -17910,8 +17910,7 @@
   // This also requires the reference of the static device/constant variable by
   // host code to be visible in the device compilation for the compiler to be
   // able to externalize the static device/constant variable.
-  if ((Var->hasAttr() || Var->hasAttr()) &&
-  Var->isFileVarDecl() && Var->getStorageClass() == SC_Static) {
+  if (SemaRef.getASTContext().mayExternalizeStaticVar(Var)) {
 auto *CurContext = SemaRef.CurContext;
 if (!CurContext || !isa(CurContext) ||
 cast(CurContext)->hasAttr() ||
Index: clang/lib/AST/ASTContext.cpp
===
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -11191,10 +11191,17 @@
   return DB << "a prior #pragma section";
 }
 
-bool ASTContext::shouldExternalizeStaticVar(const Decl *D) const {
+bool ASTContext::mayExternalizeStaticVar(const Decl *D) const {
   return !getLangOpts().GPURelocatableDeviceCode &&
- (D->hasAttr() || D->hasAttr()) &&
+ ((D->hasAttr() &&
+   !D->getAttr()->isImplicit()) ||
+  (D->hasAttr() &&
+   !D->getAttr()->isImplicit())) &&
  isa(D) && cast(D)->isFileVarDecl() &&
- cast(D)->getStorageClass() == SC_Static &&
+ cast(D)->getStorageClass() == SC_Static;
+}
+
+bool ASTContext::shouldExternalizeStaticVar(const Decl *D) const {
+  return mayExternalizeStaticVar(D) &&
  CUDAStaticDeviceVarReferencedByHost.count(cast(D));
 }
Index: clang/include/clang/AST/ASTContext.h
===
--- clang/include/clang/AST/ASTContext.h
+++ clang/include/clang/AST/ASTContext.h
@@ -3034,6 +3034,9 @@
   /// Return a new OMPTraitInfo object owned by this context.
   OMPTraitInfo &getNewOMPTraitInfo();
 
+  /// Whether a C++ static variable may be externalized.
+  bool mayExternalizeStaticVar(const Decl *D) const;
+
   /// Whether a C++ static variable should be externalized.
   bool shouldExternalizeStaticVar(const Decl *D) const;
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D85695: [OpenMP] split execution of a long test into smaller parts.

2020-08-10 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment.

The test is no longer sticking out: 
https://gist.github.com/Artem-B/d0b05c2e98a49158c02de23f7f4f0279


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85695

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


[PATCH] D85685: [WIP] Support dwarf fission for wasm object files

2020-08-10 Thread Derek Schuff via Phabricator via cfe-commits
dschuff updated this revision to Diff 284522.
dschuff added a comment.

Fix bad diff


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85685

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  llvm/include/llvm/MC/MCWasmObjectWriter.h
  llvm/lib/MC/MCAsmBackend.cpp
  llvm/lib/MC/MCObjectFileInfo.cpp
  llvm/lib/MC/WasmObjectWriter.cpp

Index: llvm/lib/MC/WasmObjectWriter.cpp
===
--- llvm/lib/MC/WasmObjectWriter.cpp
+++ llvm/lib/MC/WasmObjectWriter.cpp
@@ -216,8 +216,12 @@
   Stream.pwrite((char *)Buffer, sizeof(Buffer), Offset);
 }
 
+bool isDwoSection(const MCSection &Sec) {
+  return Sec.getName().endswith(".dwo");
+}
+
 class WasmObjectWriter : public MCObjectWriter {
-  support::endian::Writer W;
+  support::endian::Writer *W;
 
   /// The target specific Wasm writer instance.
   std::unique_ptr TargetObjectWriter;
@@ -260,7 +264,16 @@
   unsigned NumEventImports = 0;
   uint32_t SectionCount = 0;
 
-  // TargetObjectWriter wrappers.
+  enum class DwoMode {
+AllSections,
+NonDwoOnly,
+DwoOnly,
+  };
+  bool IsSplitDwarf = false;
+  raw_pwrite_stream *OS = nullptr;
+  raw_pwrite_stream *DwoOS = nullptr;
+
+  // TargetObjectWriter wranppers.
   bool is64Bit() const { return TargetObjectWriter->is64Bit(); }
   bool isEmscripten() const { return TargetObjectWriter->isEmscripten(); }
 
@@ -270,8 +283,12 @@
 
 public:
   WasmObjectWriter(std::unique_ptr MOTW,
-   raw_pwrite_stream &OS)
-  : W(OS, support::little), TargetObjectWriter(std::move(MOTW)) {}
+   raw_pwrite_stream &OS_)
+  : TargetObjectWriter(std::move(MOTW)), OS(&OS_) {}
+  WasmObjectWriter(std::unique_ptr MOTW,
+   raw_pwrite_stream &OS_, raw_pwrite_stream &DwoOS_)
+  : TargetObjectWriter(std::move(MOTW)), IsSplitDwarf(true), OS(&OS_),
+DwoOS(&DwoOS_) {}
 
 private:
   void reset() override {
@@ -306,24 +323,27 @@
 
   uint64_t writeObject(MCAssembler &Asm, const MCAsmLayout &Layout) override;
 
+  uint64_t writeOneObject(MCAssembler &Asm, const MCAsmLayout &Layout,
+  DwoMode Mode);
+
   void writeString(const StringRef Str) {
-encodeULEB128(Str.size(), W.OS);
-W.OS << Str;
+encodeULEB128(Str.size(), W->OS);
+W->OS << Str;
   }
 
   void writeI32(int32_t val) {
 char Buffer[4];
 support::endian::write32le(Buffer, val);
-W.OS.write(Buffer, sizeof(Buffer));
+W->OS.write(Buffer, sizeof(Buffer));
   }
 
   void writeI64(int64_t val) {
 char Buffer[8];
 support::endian::write64le(Buffer, val);
-W.OS.write(Buffer, sizeof(Buffer));
+W->OS.write(Buffer, sizeof(Buffer));
   }
 
-  void writeValueType(wasm::ValType Ty) { W.OS << static_cast(Ty); }
+  void writeValueType(wasm::ValType Ty) { W->OS << static_cast(Ty); }
 
   void writeTypeSection(ArrayRef Signatures);
   void writeImportSection(ArrayRef Imports, uint64_t DataSize,
@@ -368,17 +388,17 @@
 void WasmObjectWriter::startSection(SectionBookkeeping &Section,
 unsigned SectionId) {
   LLVM_DEBUG(dbgs() << "startSection " << SectionId << "\n");
-  W.OS << char(SectionId);
+  W->OS << char(SectionId);
 
-  Section.SizeOffset = W.OS.tell();
+  Section.SizeOffset = W->OS.tell();
 
   // The section size. We don't know the size yet, so reserve enough space
   // for any 32-bit value; we'll patch it later.
-  encodeULEB128(0, W.OS, 5);
+  encodeULEB128(0, W->OS, 5);
 
   // The position where the section starts, for measuring its size.
-  Section.ContentsOffset = W.OS.tell();
-  Section.PayloadOffset = W.OS.tell();
+  Section.ContentsOffset = W->OS.tell();
+  Section.PayloadOffset = W->OS.tell();
   Section.Index = SectionCount++;
 }
 
@@ -388,19 +408,19 @@
   startSection(Section, wasm::WASM_SEC_CUSTOM);
 
   // The position where the section header ends, for measuring its size.
-  Section.PayloadOffset = W.OS.tell();
+  Section.PayloadOffset = W->OS.tell();
 
   // Custom sections in wasm also have a string identifier.
   writeString(Name);
 
   // The position where the custom section starts.
-  Section.ContentsOffset = W.OS.tell();
+  Section.ContentsOffset = W->OS.tell();
 }
 
 // Now that the section is complete and we know how big it is, patch up the
 // section size field at the start of the section.
 void WasmObjectWriter::endSection(SectionBookkeeping &Section) {
-  uint64_t Size = W.OS.tell();
+  uint64_t Size = W->OS.tell();
   // /dev/null doesn't support seek/tell and can report offset of 0.
   // Simply skip this patching in that case.
   if (!Size)
@@ -414,14 +434,14 @@
 
   // Write the final section size to the payload_len field, which follows
   // the section id byte.
-  writePatchableLEB<5>(static_cast(W.OS), Size,
+  writePatchableLEB<5>(static_cast(W->OS), Size,
Section.SizeOffset);
 }
 
 // Emit the Wasm header.
 void WasmObjectWrit

[PATCH] D84068: AMDGPU/clang: Search resource directory for device libraries

2020-08-10 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm added a comment.

In D84068#2208132 , @tra wrote:

> In D84068#2204713 , @arsenm wrote:
>
>>> If we ship them with clang, who/where/how builds them?
>>> If they come from ROCm packages, how would those packages add stuff into 
>>> *clang* install directory? Resource dir is a rather awkward location if 
>>> contents may be expected to change routinely.
>>
>> Symlinks. I've been building the device libraries as part of 
>> LLVM_EXTERNAL_PROJECTS, and think this should be the preferred way to build 
>> and package the libraries. This is how compiler-rt is packaged on linux 
>> distributions. The compiler-rt binaries are a separate package symlinked 
>> into the resource directory locations. I'm not sure what you mean exactly by 
>> change routinely, the libraries should be an implementation detail invisible 
>> to users, not something they should be directly relying on. Only clang 
>> actually knows how to use them correctly and every other user is buggy
>>
>>> What if I have multiple ROCm versions installed? Which one should provide 
>>> the bitcode in the resource dir?
>>
>> These should be treated as an integral part of clang, and not something to 
>> mix and match. Each rocm version should have its own copy of the device 
>> libraries. It only happens to work most of the time if you mismatch these, 
>> and this isn't a guaranteed property.
>
> I'm still not sure how that's going to work. We have `M clang versions`:`N 
> ROCm versions` relationship here. 
> If I have one clang version, but want to do two different builds, one with 
> ROCm-X and one with ROCm-Y, how would I do that? It sounds like I'll need to 
> have multiple clang installation variants.
>
> Similarly, if I have multiple clang versions installed, how would ROCm know 
> which of those clang installations must be updated?
>
> What if I install yet another clang version *after* ROCm has been installed, 
> how will ROCm package know that it needs up update yet another clang 
> installation.
>
> This will get rather unmanageable as soon as you get beyond the "I only have 
> one clang and one ROCm version" scenario.

What I'm aiming for is a 1 clang : 1 device library copy. Every clang should 
have its own device library build. It's an implementation detail of clang, and 
not an independent component you can do anything with (correctly at least). 
clang is also minimally useful without the libraries

> I think it would make much more sense for clang to treat ROCm's bits as an 
> external dependency, similar to CUDA. Be definition clang/llvm does not 
> control anything outside of its own packages. While ROCm is AMD's package, 
> I'm willing to bet that eventually various Linux distros will start shuffling 
> its bits around the same way it happened to CUDA.

Long term, I'd rather aim for merging rocm-device-libs into libclc and making 
it an llvm project. They're largely forks of the same original sources from 
about 5 years ago, and it's an unfortunate split of effort. I also specifically 
do not want distros to be shuffling this around, and want it to behave exactly 
like compiler-rt. As far as I can tell cuda clang does not actually work with 
the Ubuntu packaged cuda, which arbitrarily moved the nvvm binaries, and I 
don't really want a repeat of this situation. I also do want the device libs 
build to support a non-rocm package to install to a standard distro clang 
package, which is different than the rocm libraries trying to support every 
clang in the universe. Ideally just a regular clang works without any formal 
rocm installation.

>>> As long as explicitly specified `--hip-device-lib-path` can still point to 
>>> the right path, it's probably OK, but it all adds some confusion about who 
>>> controls which parts of the HIP compilation and how it all is supposed to 
>>> work in cases that deviate from the default assumptions.
>>
>> Long term I would rather get rid of --hip-device-lib-path, and only use the 
>> standard -resource_dir flags
>
> Please, please, please keep explicit path option. There are real use cases 
> where you can not expect ROCm to be installed anywhere 'standard'. Or at all. 
> Imagine people embedding libclang into their GUI/tools. There's no resource 
> directory. There may be no ROCm installation, or it may not be possible due 
> to lack of privileges.

This isn't any different that compiler-rt; I would expect these cases to embed 
and mount these in a virtual filesystem.

> I short, I think that tightly coupling clang's expectations to a non-clang 
> project is not a good idea.
> Summoning @echristo for a second opinion.

With the dance of searching for a rocm or cuda installation, it's still a 
coupling. It's just weirder looking and assumes the existing poor, non-standard 
packaging practices. What I want is something that's indistinguishable from 
compiler-rt from a packaging perspective.


CHANGES SINCE LAST ACTION
  h

[PATCH] D85551: [OpenMP] Split OpenMP/target_map_codegen test [NFC]

2020-08-10 Thread Artem Belevich via Phabricator via cfe-commits
tra added inline comments.



Comment at: clang/test/OpenMP/target_map_codegen_18.cpp:5
+
+///==///
+// RUN: %clang_cc1 -DUSE -DCK19 -verify -fopenmp 
-fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple 
powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck 
-allow-deprecated-dag-overlap  %s --check-prefixes=CK19,CK19-64,CK19-USE

jdoerfert wrote:
> tra wrote:
> > This file is still among the longest tests in clang and could use some 
> > further splitting, if possible.
> > Between this and arm-cortex-cpus.c tests there are another 10 seconds we 
> > could shave off the test time.
> Our target codegen is sometimes incredibly slow. I think there is an 
> underlying problem that needs to be addressed anyway.
Turns out it's actually FileCheck & regex that's the bottleneck. 
https://reviews.llvm.org/D85695


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85551

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


[PATCH] D85695: [OpenMP] split execution of a long test into smaller parts.

2020-08-10 Thread Artem Belevich via Phabricator via cfe-commits
tra created this revision.
tra added reviewers: ABataev, jdoerfert.
Herald added subscribers: sanjoy.google, bixia, guansong, yaxunl.
Herald added a project: clang.
tra requested review of this revision.
Herald added a subscriber: sstefan1.

This test is bottlenecked by heavy regex use (~0.6s per FileCheck run) with the
content that can't be further fragmented. Instead, the test body is moved into a
common .inc file and test execution has been split into four roughly equal
parts. This reduces wall time for the test from 14s to ~3.5s.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85695

Files:
  clang/test/OpenMP/target_map_codegen_18.cpp
  clang/test/OpenMP/target_map_codegen_18.inc
  clang/test/OpenMP/target_map_codegen_18a.cpp
  clang/test/OpenMP/target_map_codegen_18b.cpp
  clang/test/OpenMP/target_map_codegen_18c.cpp
  clang/test/OpenMP/target_map_codegen_18d.cpp

Index: clang/test/OpenMP/target_map_codegen_18d.cpp
===
--- /dev/null
+++ clang/test/OpenMP/target_map_codegen_18d.cpp
@@ -0,0 +1,28 @@
+// expected-no-diagnostics
+#ifndef HEADER
+#define HEADER
+
+#include "target_map_codegen_18.inc"
+// For convenience, put the input file in a temp dir, so we don't have to use
+// its full name in every FileCheck command.
+// RUN: cp %S/target_map_codegen_18.inc %t.inc
+
+// RUN: %clang_cc1 -DCK19 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefixes=CK19,CK19-32,CK19-NOUSE %t.inc
+// RUN: %clang_cc1 -DCK19 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefixes=CK19,CK19-32,CK19-NOUSE %t.inc
+
+// RUN: %clang_cc1 -DCK19 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefixes=CK19,CK19-64,CK19-NOUSE %t.inc
+// RUN: %clang_cc1 -DCK19 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefixes=CK19,CK19-64,CK19-NOUSE %t.inc
+// RUN: %clang_cc1 -DCK19 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefixes=CK19,CK19-32,CK19-NOUSE %t.inc
+// RUN: %clang_cc1 -DCK19 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefixes=CK19,CK19-32,CK19-NOUSE %t.inc
+
+// RUN: %clang_cc1 -DCK19 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap  --check-prefix SIMD-ONLY18 %t.inc
+// RUN: %clang_cc1 -DCK19 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap  --check-prefix SIMD-ONLY18 %t.inc
+// RUN: %clang_cc1 -DCK19 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap  --check-prefix SIMD-ONLY18 %t.inc
+// RUN: %clang_cc1 -DCK19 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap  --check-prefix SIMD-ONLY18 %t.inc
+
+#endif
Index: clang/test/OpenMP/target_map_codegen_18c.cpp
===
--- /dev/null
+++ clang/test/OpenMP/target_map_codegen_18c.cpp
@@ -0,0 +1,28 @@
+// expected-no-diagnostics
+#ifndef HEADER
+#define HEADER
+
+#include "target_map_codegen_18.inc"
+// For convenience, put the input 

[clang] 09517a9 - Add regression test from PR46487.

2020-08-10 Thread Richard Smith via cfe-commits

Author: Richard Smith
Date: 2020-08-10T15:55:27-07:00
New Revision: 09517a90682f05f13dca7d976aeaa5437beeb8f3

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

LOG: Add regression test from PR46487.

The underlying crash here has already been fixed, presumably by ongoing
work on error recovery.

Added: 


Modified: 
clang/test/SemaCXX/typo-correction.cpp

Removed: 




diff  --git a/clang/test/SemaCXX/typo-correction.cpp 
b/clang/test/SemaCXX/typo-correction.cpp
index e0325b3ba09b..8b13e43661ee 100644
--- a/clang/test/SemaCXX/typo-correction.cpp
+++ b/clang/test/SemaCXX/typo-correction.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -fspell-checking-limit 0 -verify -Wno-c++11-extensions %s
-// RUN: %clang_cc1 -fspell-checking-limit 0 -verify -Wno-c++11-extensions 
-std=c++20 %s
+// RUN: %clang_cc1 -fspell-checking-limit 0 -verify -Wno-c++11-extensions 
-fcxx-exceptions %s
+// RUN: %clang_cc1 -fspell-checking-limit 0 -verify -Wno-c++11-extensions 
-fcxx-exceptions -std=c++20 %s
 
 namespace PR21817{
 int a(-rsing[2]); // expected-error {{undeclared identifier 'rsing'; did you 
mean 'using'?}}
@@ -745,3 +745,15 @@ void ns::create_test2() { // expected-error {{out-of-line 
definition of 'create_
 void ns::create_test() {
 }
 }
+
+namespace PR46487 {
+  bool g_var_bool; // expected-note {{here}}
+  const char g_volatile_char = 5; // expected-note {{here}}
+  // FIXME: We shouldn't suggest a typo-correction to 'g_var_bool' here,
+  // because it doesn't make the expression valid.
+  // expected-error@+2 {{did you mean 'g_var_bool'}}
+  // expected-error@+1 {{assigning to 'bool' from incompatible type 'void'}}
+  enum : decltype((g_var_long = throw))::a {
+b = g_volatile_uchar // expected-error {{did you mean 'g_volatile_char'}}
+  };
+}



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


Re: [PATCH] D85545: [Diagnostics] Diagnose missing comma in string array initialization

2020-08-10 Thread Dávid Bolvanský via cfe-commits
Pushed fix. It should not warn for structs or long texts.

ut 11. 8. 2020 o 0:34 Arthur Eubanks via Phabricator
 napísal(a):
>
> aeubanks added a comment.
>
> In D85545#2208266 , @arthur.j.odwyer 
> wrote:
>
> > To decrease the number of false-positives, you could emit the warning only
> > if *exactly one* comma was missing.
> >
> >   const char *likely_a_bug[] = { "a", "b", "c" "d", "e", "f", "g", "h",
> >
> > "i" };
> >
> >   const char *likely_not_a_bug[] = { "a", "b" "c", "d" "e", "f" "g" };
> >   const char *oops_still_a_bug[] = { "a", "b", "c" "d", "e", "f" "g",
> >
> > "h", "i" };
> >
> > However, as `oops_still_a_bug` shows, that tactic would also decrease the
> > number of true positives, and it would confuse the end-user, for whom
> > predictability is key.
> >
> > I still think it would be appropriate to *stop issuing the warning for
> > structs*, though.
> > Here's my struct example from below in Godbolt: https://godbolt.org/z/6jjv6a
> > Speaking of predictability, I don't understand why `struct Y` avoids the
> > warning whereas `struct X` hits it.
> > After removing the warning for structs, neither `X` nor `Y` should hit it,
> > and that should fix pretty much all the Firefox hits as I understand them.
> >
> > –Arthur
>
> +1 to ignoring structs. See https://crbug.com/1114873 and 
> https://source.chromium.org/chromium/chromium/src/+/master:third_party/dawn/src/dawn_native/Toggles.cpp;drc=80f927d763211ea8e6a6377f86282809c86dc107;l=32.
>
>
> Repository:
>   rG LLVM Github Monorepo
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D85545/new/
>
> https://reviews.llvm.org/D85545
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 4b59dc7 - [Diagnostics] Ignore structs and long text for -Wstring-concatenation

2020-08-10 Thread Dávid Bolvanský via cfe-commits

Author: Dávid Bolvanský
Date: 2020-08-11T00:49:58+02:00
New Revision: 4b59dc77dc473bba849c1b08f3a1ab7be5733ad1

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

LOG: [Diagnostics] Ignore structs and long text for -Wstring-concatenation

Added: 


Modified: 
clang/lib/Sema/SemaExpr.cpp
clang/test/Sema/string-concat.c

Removed: 




diff  --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 28ac1dfeb082..0d7f81e0d01a 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -6865,6 +6865,7 @@ Sema::ActOnInitList(SourceLocation LBraceLoc, 
MultiExprArg InitArgList,
   bool DiagnosedArrayDesignator = false;
   bool DiagnosedNestedDesignator = false;
   bool DiagnosedMixedDesignator = false;
+  bool DiagnosedMissingComma = false;
 
   // Check that any designated initializers are syntactically valid in the
   // current language mode.
@@ -6908,22 +6909,34 @@ Sema::ActOnInitList(SourceLocation LBraceLoc, 
MultiExprArg InitArgList,
 << InitArgList[I]->getSourceRange();
 } else if (const auto *SL = dyn_cast(InitArgList[I])) {
   unsigned NumConcat = SL->getNumConcatenated();
-  const auto *SLPrev =
-  dyn_cast(InitArgList[I == 0 ? E - 1 : I - 1]);
   // Diagnose missing comma in string array initialization.
   // Do not warn when all the elements in the initializer are concatenated
   // together. Do not warn for macros too.
-  if (NumConcat > 1 && E > 2 && !SL->getBeginLoc().isMacroID() &&
-  isa(InitArgList[0]) && SLPrev &&
-  NumConcat != SLPrev->getNumConcatenated()) {
-SmallVector Hints;
-for (unsigned i = 0; i < NumConcat - 1; ++i)
-  Hints.push_back(FixItHint::CreateInsertion(
-  PP.getLocForEndOfToken(SL->getStrTokenLoc(i)), ","));
-
-Diag(SL->getStrTokenLoc(1), diag::warn_concatenated_literal_array_init)
-<< Hints;
-Diag(SL->getBeginLoc(), 
diag::note_concatenated_string_literal_silence);
+  if (!DiagnosedMissingComma && NumConcat == 2 && E > 2 && 
!SL->getBeginLoc().isMacroID()) {
+bool OnlyOneMissingComma = true;
+for (unsigned J = 0; J < E; ++J) {
+  if (J == I)
+continue;
+  const auto *SLJ = dyn_cast(InitArgList[J]);
+  if (!SLJ || SLJ->getNumConcatenated() > 1) {
+OnlyOneMissingComma = false;
+break;
+  }
+}
+
+if (OnlyOneMissingComma) {
+  SmallVector Hints;
+  for (unsigned i = 0; i < NumConcat - 1; ++i)
+Hints.push_back(FixItHint::CreateInsertion(
+PP.getLocForEndOfToken(SL->getStrTokenLoc(i)), ","));
+
+  Diag(SL->getStrTokenLoc(1),
+   diag::warn_concatenated_literal_array_init)
+  << Hints;
+  Diag(SL->getBeginLoc(),
+   diag::note_concatenated_string_literal_silence);
+  DiagnosedMissingComma = true;
+}
   }
 }
   }

diff  --git a/clang/test/Sema/string-concat.c b/clang/test/Sema/string-concat.c
index 4e5ed4424e7c..3dcde8844dff 100644
--- a/clang/test/Sema/string-concat.c
+++ b/clang/test/Sema/string-concat.c
@@ -32,12 +32,6 @@ const char *missing_comma_u8[] = {
 };
 #endif
 
-const char *missing_two_commas[] = {"basic_filebuf",
-   "basic_ios" // expected-note{{place parentheses around 
the string literal to silence warning}}
-   "future"// expected-warning{{suspicious 
concatenation of string literals in an array initialization; did you mean to 
separate the elements with a comma?}}
-   "optional",
-   "packaged_task"};
-
 const char *missing_comma_same_line[] = {"basic_filebuf", "basic_ios",
"future" "optional", // expected-note{{place 
parentheses around the string literal to silence warning}}
"packaged_task", "promise"}; // 
expected-warning@-1{{suspicious concatenation of string literals in an array 
initialization; did you mean to separate the elements with a comma?}}
@@ -56,12 +50,20 @@ char missing_comma_inner[][5] = {
 "d" // expected-warning{{suspicious concatenation of string literals in an 
array initialization; did you mean to separate the elements with a comma?}}
 };
 
+const char *warn[] = { "cpll", "gpll", "hdmiphy" "usb480m" }; // 
expected-note{{place parentheses around the string literal to silence warning}}
+// expected-warning@-1{{suspicious concatenation of string literals in an 
array initialization; did you mean to separate the elements with a comma?}}
+
+const char *missing_two_commas_ignore[] = {"basic_filebuf",
+   "basic_ios" 
+   "future"  
+   "optio

[PATCH] D73865: [CodeGenModule] Assume dso_local for -fpic -fno-semantic-interposition

2020-08-10 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay abandoned this revision.
MaskRay added a comment.
Herald added subscribers: aaron.ballman, sstefan1.

Landed with a change that only changes the explicit -fno-semantic-interposition 
behavior, so there was very little test change.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73865

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


[PATCH] D85612: [Sema] Use proper integral cast for an enumerate with a fixed bool type

2020-08-10 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments.



Comment at: clang/test/AST/ast-dump-enum-bool.cpp:1
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown -fsyntax-only 
-ast-dump %s | FileCheck %s
+

I don't think we really need a dedicated AST test for this. Such tests create a 
maintenance burden, and they don't really capture what we care about here: that 
all non-zero values are correctly converted to the `true` value of the 
enumeration type.



Comment at: clang/test/CodeGen/enum-bool.cpp:7-14
+// CHECK:  ; Function Attrs: noinline nounwind optnone
+// CHECK-NEXT: define i32 @_ZN6dr23381A1aEi(i32 %x) #0 {
+// CHECK-NEXT: entry:
+// CHECK-NEXT:   %x.addr = alloca i32, align 4
+// CHECK-NEXT:   store i32 %x, i32* %x.addr, align 4
+// CHECK-NEXT:   %0 = load i32, i32* %x.addr, align 4
+// CHECK-NEXT:   ret i32 %0

Some general guidance for writing IR testcases:

 - Don't test things that aren't relevant to the test case; doing so will make 
the test brittle as IR generation changes. In particular, don't test the 
function attribute comments, the `#0` introducing function metadata, 
instruction names, alignments.
 - Use `CHECK-LABEL` for each function definition to improve matching semantics 
and diagnostics on mismatches. (The `CHECK-LABEL`s are checked first, then the 
input is sliced up into pieces between them, and those pieces are checked 
independently.)
 - Don't use `CHECK-NEXT` unless it's relevant to your test that no other 
instructions appear in between.



Comment at: clang/test/SemaCXX/cxx2a-consteval.cpp:597-609
+
+namespace dr2338 {
+namespace B {
+enum E : bool { Zero, One };
+consteval E c(int x) { return (E)x; }
+static_assert(static_cast(c(2)) == 1);
+} // namespace B

This DR test should go in `test/CXX/drs/dr23xx.cpp`, along with a suitable 
"magic comment" `// dr2338: 12` to indicate this DR is implemented in Clang 12 
onwards. (We have tooling that generates the 
`clang.llvm.org/cxx_dr_status.html` page from those magic comments.)

I don't think this has anything to do with `consteval`; a more-reduced test 
should work just as well (eg, `static_assert((int)(E)2 == 1, "");`) and would 
allow us to test this in C++11 onwards, not only in C++20.


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

https://reviews.llvm.org/D85612

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


[PATCH] D85686: [CUDA][HIP] Do not externalize implicit constant static variable

2020-08-10 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked an inline comment as done.
yaxunl added inline comments.



Comment at: clang/lib/AST/ASTContext.cpp:11196
   return !getLangOpts().GPURelocatableDeviceCode &&
- (D->hasAttr() || D->hasAttr()) &&
+ (D->hasAttr() ||
+  (D->hasAttr() &&

tra wrote:
> I'd include `__device__` vars into the `!IsImplicit` check. While we may not 
> implicitly add the attribute now, for consistency sake they should be treated 
> the same. 
will do when committing.


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

https://reviews.llvm.org/D85686

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


[PATCH] D85545: [Diagnostics] Diagnose missing comma in string array initialization

2020-08-10 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

In D85545#2208266 , @arthur.j.odwyer 
wrote:

> To decrease the number of false-positives, you could emit the warning only
> if *exactly one* comma was missing.
>
>   const char *likely_a_bug[] = { "a", "b", "c" "d", "e", "f", "g", "h",
>
> "i" };
>
>   const char *likely_not_a_bug[] = { "a", "b" "c", "d" "e", "f" "g" };
>   const char *oops_still_a_bug[] = { "a", "b", "c" "d", "e", "f" "g",
>
> "h", "i" };
>
> However, as `oops_still_a_bug` shows, that tactic would also decrease the
> number of true positives, and it would confuse the end-user, for whom
> predictability is key.
>
> I still think it would be appropriate to *stop issuing the warning for
> structs*, though.
> Here's my struct example from below in Godbolt: https://godbolt.org/z/6jjv6a
> Speaking of predictability, I don't understand why `struct Y` avoids the
> warning whereas `struct X` hits it.
> After removing the warning for structs, neither `X` nor `Y` should hit it,
> and that should fix pretty much all the Firefox hits as I understand them.
>
> –Arthur

+1 to ignoring structs. See https://crbug.com/1114873 and 
https://source.chromium.org/chromium/chromium/src/+/master:third_party/dawn/src/dawn_native/Toggles.cpp;drc=80f927d763211ea8e6a6377f86282809c86dc107;l=32.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85545

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


[PATCH] D85635: [clangd] Compute the interactive code range for semantic highlighting.

2020-08-10 Thread Nathan Ridge via Phabricator via cfe-commits
nridge added a comment.

Do you mean "inactive" (instead of "interactive") in the commit message?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85635

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


[PATCH] D85692: python bindings: fix DeprecationWarning

2020-08-10 Thread Nick Desaulniers via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG05d74dbc3bb1: python bindings: fix DeprecationWarning 
(authored by nickdesaulniers).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85692

Files:
  clang/bindings/python/tests/cindex/test_diagnostics.py


Index: clang/bindings/python/tests/cindex/test_diagnostics.py
===
--- clang/bindings/python/tests/cindex/test_diagnostics.py
+++ clang/bindings/python/tests/cindex/test_diagnostics.py
@@ -41,7 +41,7 @@
 self.assertEqual(tu.diagnostics[0].severity, Diagnostic.Warning)
 self.assertEqual(tu.diagnostics[0].location.line, 1)
 self.assertEqual(tu.diagnostics[0].location.column, 26)
-self.assertRegexpMatches(tu.diagnostics[0].spelling,
+self.assertRegex(tu.diagnostics[0].spelling,
 'use of GNU old-style.*')
 self.assertEqual(len(tu.diagnostics[0].fixits), 1)
 self.assertEqual(tu.diagnostics[0].fixits[0].range.start.line, 1)
@@ -56,7 +56,7 @@
 self.assertEqual(tu.diagnostics[0].severity, Diagnostic.Warning)
 self.assertEqual(tu.diagnostics[0].location.line, 1)
 self.assertEqual(tu.diagnostics[0].location.column, 16)
-self.assertRegexpMatches(tu.diagnostics[0].spelling,
+self.assertRegex(tu.diagnostics[0].spelling,
 'incompatible pointer to.*')
 self.assertEqual(len(tu.diagnostics[0].fixits), 0)
 self.assertEqual(len(tu.diagnostics[0].ranges), 1)
@@ -97,7 +97,7 @@
 children = d.children
 self.assertEqual(len(children), 1)
 self.assertEqual(children[0].severity, Diagnostic.Note)
-self.assertRegexpMatches(children[0].spelling,
+self.assertRegex(children[0].spelling,
 '.*declared here')
 self.assertEqual(children[0].location.line, 1)
 self.assertEqual(children[0].location.column, 6)


Index: clang/bindings/python/tests/cindex/test_diagnostics.py
===
--- clang/bindings/python/tests/cindex/test_diagnostics.py
+++ clang/bindings/python/tests/cindex/test_diagnostics.py
@@ -41,7 +41,7 @@
 self.assertEqual(tu.diagnostics[0].severity, Diagnostic.Warning)
 self.assertEqual(tu.diagnostics[0].location.line, 1)
 self.assertEqual(tu.diagnostics[0].location.column, 26)
-self.assertRegexpMatches(tu.diagnostics[0].spelling,
+self.assertRegex(tu.diagnostics[0].spelling,
 'use of GNU old-style.*')
 self.assertEqual(len(tu.diagnostics[0].fixits), 1)
 self.assertEqual(tu.diagnostics[0].fixits[0].range.start.line, 1)
@@ -56,7 +56,7 @@
 self.assertEqual(tu.diagnostics[0].severity, Diagnostic.Warning)
 self.assertEqual(tu.diagnostics[0].location.line, 1)
 self.assertEqual(tu.diagnostics[0].location.column, 16)
-self.assertRegexpMatches(tu.diagnostics[0].spelling,
+self.assertRegex(tu.diagnostics[0].spelling,
 'incompatible pointer to.*')
 self.assertEqual(len(tu.diagnostics[0].fixits), 0)
 self.assertEqual(len(tu.diagnostics[0].ranges), 1)
@@ -97,7 +97,7 @@
 children = d.children
 self.assertEqual(len(children), 1)
 self.assertEqual(children[0].severity, Diagnostic.Note)
-self.assertRegexpMatches(children[0].spelling,
+self.assertRegex(children[0].spelling,
 '.*declared here')
 self.assertEqual(children[0].location.line, 1)
 self.assertEqual(children[0].location.column, 6)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 05d74db - python bindings: fix DeprecationWarning

2020-08-10 Thread Nick Desaulniers via cfe-commits

Author: Nick Desaulniers
Date: 2020-08-10T15:25:23-07:00
New Revision: 05d74dbc3bb1d943a029e4abea211288c920f559

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

LOG: python bindings: fix DeprecationWarning

Fixes observed warning running `ninja check-all`:
llvm-project/clang/bindings/python/tests/cindex/test_diagnostics.py:100:
DeprecationWarning: Please use assertRegex instead.
  self.assertRegexpMatches(children[0].spelling

Looks like unittest.assertRegexpMatches has been deprecated in favor of
unittest.assertRegex since Python 3.2, according to:
https://docs.python.org/3/library/unittest.html#deprecated-aliases

Reviewed By: MaskRay

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

Added: 


Modified: 
clang/bindings/python/tests/cindex/test_diagnostics.py

Removed: 




diff  --git a/clang/bindings/python/tests/cindex/test_diagnostics.py 
b/clang/bindings/python/tests/cindex/test_diagnostics.py
index 64d0ca2ef9bc..8b0f04256883 100644
--- a/clang/bindings/python/tests/cindex/test_diagnostics.py
+++ b/clang/bindings/python/tests/cindex/test_diagnostics.py
@@ -41,7 +41,7 @@ def test_diagnostic_fixit(self):
 self.assertEqual(tu.diagnostics[0].severity, Diagnostic.Warning)
 self.assertEqual(tu.diagnostics[0].location.line, 1)
 self.assertEqual(tu.diagnostics[0].location.column, 26)
-self.assertRegexpMatches(tu.diagnostics[0].spelling,
+self.assertRegex(tu.diagnostics[0].spelling,
 'use of GNU old-style.*')
 self.assertEqual(len(tu.diagnostics[0].fixits), 1)
 self.assertEqual(tu.diagnostics[0].fixits[0].range.start.line, 1)
@@ -56,7 +56,7 @@ def test_diagnostic_range(self):
 self.assertEqual(tu.diagnostics[0].severity, Diagnostic.Warning)
 self.assertEqual(tu.diagnostics[0].location.line, 1)
 self.assertEqual(tu.diagnostics[0].location.column, 16)
-self.assertRegexpMatches(tu.diagnostics[0].spelling,
+self.assertRegex(tu.diagnostics[0].spelling,
 'incompatible pointer to.*')
 self.assertEqual(len(tu.diagnostics[0].fixits), 0)
 self.assertEqual(len(tu.diagnostics[0].ranges), 1)
@@ -97,7 +97,7 @@ def test_diagnostic_children(self):
 children = d.children
 self.assertEqual(len(children), 1)
 self.assertEqual(children[0].severity, Diagnostic.Note)
-self.assertRegexpMatches(children[0].spelling,
+self.assertRegex(children[0].spelling,
 '.*declared here')
 self.assertEqual(children[0].location.line, 1)
 self.assertEqual(children[0].location.column, 6)



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


[PATCH] D85692: python bindings: fix DeprecationWarning

2020-08-10 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85692

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


[PATCH] D85692: python bindings: fix DeprecationWarning

2020-08-10 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers created this revision.
nickdesaulniers added reviewers: MaskRay, echristo, srhines.
Herald added subscribers: cfe-commits, arphaman.
Herald added a project: clang.
nickdesaulniers requested review of this revision.

Fixes observed warning running `ninja check-all`:
llvm-project/clang/bindings/python/tests/cindex/test_diagnostics.py:100:
DeprecationWarning: Please use assertRegex instead.

  self.assertRegexpMatches(children[0].spelling

Looks like unittest.assertRegexpMatches has been deprecated in favor of
unittest.assertRegex since Python 3.2, according to:
https://docs.python.org/3/library/unittest.html#deprecated-aliases


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85692

Files:
  clang/bindings/python/tests/cindex/test_diagnostics.py


Index: clang/bindings/python/tests/cindex/test_diagnostics.py
===
--- clang/bindings/python/tests/cindex/test_diagnostics.py
+++ clang/bindings/python/tests/cindex/test_diagnostics.py
@@ -41,7 +41,7 @@
 self.assertEqual(tu.diagnostics[0].severity, Diagnostic.Warning)
 self.assertEqual(tu.diagnostics[0].location.line, 1)
 self.assertEqual(tu.diagnostics[0].location.column, 26)
-self.assertRegexpMatches(tu.diagnostics[0].spelling,
+self.assertRegex(tu.diagnostics[0].spelling,
 'use of GNU old-style.*')
 self.assertEqual(len(tu.diagnostics[0].fixits), 1)
 self.assertEqual(tu.diagnostics[0].fixits[0].range.start.line, 1)
@@ -56,7 +56,7 @@
 self.assertEqual(tu.diagnostics[0].severity, Diagnostic.Warning)
 self.assertEqual(tu.diagnostics[0].location.line, 1)
 self.assertEqual(tu.diagnostics[0].location.column, 16)
-self.assertRegexpMatches(tu.diagnostics[0].spelling,
+self.assertRegex(tu.diagnostics[0].spelling,
 'incompatible pointer to.*')
 self.assertEqual(len(tu.diagnostics[0].fixits), 0)
 self.assertEqual(len(tu.diagnostics[0].ranges), 1)
@@ -97,7 +97,7 @@
 children = d.children
 self.assertEqual(len(children), 1)
 self.assertEqual(children[0].severity, Diagnostic.Note)
-self.assertRegexpMatches(children[0].spelling,
+self.assertRegex(children[0].spelling,
 '.*declared here')
 self.assertEqual(children[0].location.line, 1)
 self.assertEqual(children[0].location.column, 6)


Index: clang/bindings/python/tests/cindex/test_diagnostics.py
===
--- clang/bindings/python/tests/cindex/test_diagnostics.py
+++ clang/bindings/python/tests/cindex/test_diagnostics.py
@@ -41,7 +41,7 @@
 self.assertEqual(tu.diagnostics[0].severity, Diagnostic.Warning)
 self.assertEqual(tu.diagnostics[0].location.line, 1)
 self.assertEqual(tu.diagnostics[0].location.column, 26)
-self.assertRegexpMatches(tu.diagnostics[0].spelling,
+self.assertRegex(tu.diagnostics[0].spelling,
 'use of GNU old-style.*')
 self.assertEqual(len(tu.diagnostics[0].fixits), 1)
 self.assertEqual(tu.diagnostics[0].fixits[0].range.start.line, 1)
@@ -56,7 +56,7 @@
 self.assertEqual(tu.diagnostics[0].severity, Diagnostic.Warning)
 self.assertEqual(tu.diagnostics[0].location.line, 1)
 self.assertEqual(tu.diagnostics[0].location.column, 16)
-self.assertRegexpMatches(tu.diagnostics[0].spelling,
+self.assertRegex(tu.diagnostics[0].spelling,
 'incompatible pointer to.*')
 self.assertEqual(len(tu.diagnostics[0].fixits), 0)
 self.assertEqual(len(tu.diagnostics[0].ranges), 1)
@@ -97,7 +97,7 @@
 children = d.children
 self.assertEqual(len(children), 1)
 self.assertEqual(children[0].severity, Diagnostic.Note)
-self.assertRegexpMatches(children[0].spelling,
+self.assertRegex(children[0].spelling,
 '.*declared here')
 self.assertEqual(children[0].location.line, 1)
 self.assertEqual(children[0].location.column, 6)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D85545: [Diagnostics] Diagnose missing comma in string array initialization

2020-08-10 Thread Dávid Bolvanský via cfe-commits
For your godbolt example, you hit the heuristic to not warn, if
literals count is <= 2. (motivated by many false positives; and I
didnt see a true positive case, so..)

>> you could emit the warning only if exactly one comma was missing.

This could work.

ut 11. 8. 2020 o 0:04 Arthur O'Dwyer  napísal(a):
>
> To decrease the number of false-positives, you could emit the warning only if 
> exactly one comma was missing.
>
> const char *likely_a_bug[] = { "a", "b", "c" "d", "e", "f", "g", "h", "i" 
> };
> const char *likely_not_a_bug[] = { "a", "b" "c", "d" "e", "f" "g" };
> const char *oops_still_a_bug[] = { "a", "b", "c" "d", "e", "f" "g", "h", 
> "i" };
>
> However, as `oops_still_a_bug` shows, that tactic would also decrease the 
> number of true positives, and it would confuse the end-user, for whom 
> predictability is key.
>
> I still think it would be appropriate to stop issuing the warning for 
> structs, though.
> Here's my struct example from below in Godbolt: https://godbolt.org/z/6jjv6a
> Speaking of predictability, I don't understand why `struct Y` avoids the 
> warning whereas `struct X` hits it.
> After removing the warning for structs, neither `X` nor `Y` should hit it, 
> and that should fix pretty much all the Firefox hits as I understand them.
>
> –Arthur
>
>
> On Mon, Aug 10, 2020 at 5:51 PM Dávid Bolvanský  
> wrote:
>>
>> Something like this:
>>   const char *Sources[] = {
>> "// \\tparam aaa Bbb\n",
>> "// \\tparam\n"
>> "// aaa Bbb\n",
>> "// \\tparam \n"
>> "// aaa Bbb\n",
>> "// \\tparam aaa\n"
>> "// Bbb\n"
>>   };
>>
>> annoys me :/ Any idea/heuristic how to avoid warning here?
>>
>> po 10. 8. 2020 o 23:48 Dávid Bolvanský  
>> napísal(a):
>> >
>> > For your cases, we currently do not warn. If possible, fetch the
>> > latest Clang trunk and re-evaluate on Firefox.
>> >
>> > po 10. 8. 2020 o 23:46 Arthur O'Dwyer  
>> > napísal(a):
>> > >
>> > > It looks to me as if all of the false-positives so far have been not 
>> > > arrays but structs.
>> > >
>> > > struct X { int a; const char *b; int c; };
>> > > X x = { 41, "forty" "two", 43 };  // false-positive here
>> > >
>> > > The distinguishing feature here is that if you did insert a comma as 
>> > > suggested by the compiler, then the result would no longer type-check.
>> > > X x = { 41, "forty", "two", 43 };  // this is ill-formed because "two" 
>> > > is not a valid initializer for `int c`
>> > >
>> > > Dávid, can you use this in some way?
>> > > IMHO it would be appropriate to just turn the warning off if the entity 
>> > > being initialized is a struct — leave the warning enabled only for 
>> > > initializers of arrays.
>> > >
>> > > my $.02,
>> > > –Arthur
>> > >
>> > >
>> > > On Mon, Aug 10, 2020 at 5:38 PM Dávid Bolvanský 
>> > >  wrote:
>> > >>
>> > >> I moved it to -Wextra due to false positives.
>> > >>
>> > >> > Should there be some exception for line length
>> > >>
>> > >> Yeah, but sure how to define the threshold or so. :/
>> > >>
>> > >> po 10. 8. 2020 o 23:21 dmajor via Phabricator
>> > >>  napísal(a):
>> > >> >
>> > >> > dmajor added a comment.
>> > >> >
>> > >> > In the Firefox repo this warning is firing on a number of strings 
>> > >> > that were broken up by clang-format (or humans) for line length, for 
>> > >> > example 
>> > >> > https://searchfox.org/mozilla-central/rev/ab81b8552f4aa9696a2524f97fdfeb59d4dc31c1/security/certverifier/ExtendedValidation.cpp#176-178
>> > >> >  or 
>> > >> > https://searchfox.org/mozilla-central/rev/ab81b8552f4aa9696a2524f97fdfeb59d4dc31c1/xpcom/tests/gtest/TestEscape.cpp#103-104
>> > >> >  or 
>> > >> > https://searchfox.org/mozilla-central/rev/ab81b8552f4aa9696a2524f97fdfeb59d4dc31c1/js/src/jsapi-tests/testXDR.cpp#115.
>> > >> >
>> > >> > Do you consider these to be false positives in your view? Should 
>> > >> > there be some exception for line length, perhaps?
>> > >> >
>> > >> >
>> > >> > Repository:
>> > >> >   rG LLVM Github Monorepo
>> > >> >
>> > >> > CHANGES SINCE LAST ACTION
>> > >> >   https://reviews.llvm.org/D85545/new/
>> > >> >
>> > >> > https://reviews.llvm.org/D85545
>> > >> >
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 4f2ad15 - [Clang] implement -fno-eliminate-unused-debug-types

2020-08-10 Thread Nick Desaulniers via cfe-commits

Author: Nick Desaulniers
Date: 2020-08-10T15:08:48-07:00
New Revision: 4f2ad15db535873dda9bfe248a2771023b64a43c

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

LOG: [Clang] implement -fno-eliminate-unused-debug-types

Fixes pr/11710.
Signed-off-by: Nick Desaulniers 

Resubmit after breaking Windows and OSX builds.

Reviewed By: dblaikie

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

Added: 
clang/test/CodeGen/debug-info-unused-types.c
clang/test/CodeGen/debug-info-unused-types.cpp

Modified: 
clang/docs/ClangCommandLineReference.rst
clang/docs/CommandGuide/clang.rst
clang/docs/UsersManual.rst
clang/include/clang/Basic/CodeGenOptions.def
clang/include/clang/Basic/CodeGenOptions.h
clang/include/clang/Basic/DebugInfoOptions.h
clang/include/clang/Driver/Options.td
clang/lib/CodeGen/CGDebugInfo.cpp
clang/lib/CodeGen/CGDebugInfo.h
clang/lib/CodeGen/CGDecl.cpp
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/Driver/debug-options.c

Removed: 




diff  --git a/clang/docs/ClangCommandLineReference.rst 
b/clang/docs/ClangCommandLineReference.rst
index 4caa08a82a72..370f13d6c955 100644
--- a/clang/docs/ClangCommandLineReference.rst
+++ b/clang/docs/ClangCommandLineReference.rst
@@ -2154,6 +2154,10 @@ Emit section containing metadata on function stack sizes
 
 Emit full debug info for all types used by the program
 
+.. option:: -feliminate-unused-debug-types, -fno-eliminate-unused-debug-types
+
+Suppress (or emit) debug info for types that are unused but defined by the 
program.
+
 .. option:: -fstrict-aliasing, -fno-strict-aliasing
 
 .. option:: -fstrict-enums, -fno-strict-enums

diff  --git a/clang/docs/CommandGuide/clang.rst 
b/clang/docs/CommandGuide/clang.rst
index 2cca04fb31f1..394bd1be24e8 100644
--- a/clang/docs/CommandGuide/clang.rst
+++ b/clang/docs/CommandGuide/clang.rst
@@ -433,6 +433,12 @@ Code Generation Options
   never emit type information for types that are not referenced at all by the
   program.
 
+.. option:: -feliminate-unused-debug-types
+
+  By default, Clang does not emit type information for types that are defined
+  but not used in a program. To retain the debug info for these unused types,
+  the negation **-fno-eliminate-unused-debug-types** can be used.
+
 .. option:: -fexceptions
 
   Enable generation of unwind information. This allows exceptions to be thrown

diff  --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst
index 8615a77596b4..19009b43a9e8 100644
--- a/clang/docs/UsersManual.rst
+++ b/clang/docs/UsersManual.rst
@@ -2352,6 +2352,12 @@ below. If multiple flags are present, the last one is 
used.
 
   Generate complete debug info.
 
+.. option:: -feliminate-unused-debug-types
+
+  By default, Clang does not emit type information for types that are defined
+  but not used in a program. To retain the debug info for these unused types,
+  the negation **-fno-eliminate-unused-debug-types** can be used.
+
 Controlling Macro Debug Info Generation
 ^^^
 

diff  --git a/clang/include/clang/Basic/CodeGenOptions.def 
b/clang/include/clang/Basic/CodeGenOptions.def
index c7e01eb12851..cbd9df998e78 100644
--- a/clang/include/clang/Basic/CodeGenOptions.def
+++ b/clang/include/clang/Basic/CodeGenOptions.def
@@ -288,7 +288,6 @@ CODEGENOPT(DebugFwdTemplateParams, 1, 0) ///< Whether to 
emit complete
  ///< template parameter descriptions 
in
  ///< forward declarations (versus just
  ///< including them in the name).
-
 CODEGENOPT(EmitLLVMUseLists, 1, 0) ///< Control whether to serialize use-lists.
 
 CODEGENOPT(WholeProgramVTables, 1, 0) ///< Whether to apply whole-program
@@ -313,7 +312,7 @@ VALUE_CODEGENOPT(SmallDataLimit, 32, 0)
 VALUE_CODEGENOPT(SSPBufferSize, 32, 0)
 
 /// The kind of generated debug info.
-ENUM_CODEGENOPT(DebugInfo, codegenoptions::DebugInfoKind, 3, 
codegenoptions::NoDebugInfo)
+ENUM_CODEGENOPT(DebugInfo, codegenoptions::DebugInfoKind, 4, 
codegenoptions::NoDebugInfo)
 
 /// Whether to generate macro debug info.
 CODEGENOPT(MacroDebugInfo, 1, 0)

diff  --git a/clang/include/clang/Basic/CodeGenOptions.h 
b/clang/include/clang/Basic/CodeGenOptions.h
index 83c4463c3639..ca391bf8f186 100644
--- a/clang/include/clang/Basic/CodeGenOptions.h
+++ b/clang/include/clang/Basic/CodeGenOptions.h
@@ -388,6 +388,11 @@ class CodeGenOptions : public CodeGenOptionsBase {
   bool hasReducedDebugInfo() const {
 return getDebugInfo() >= codegenoptions::DebugInfoConstructor;
   }
+
+  /// Check if maybe unused type info should be emitted.
+  bool hasM

[PATCH] D80242: [Clang] implement -fno-eliminate-unused-debug-types

2020-08-10 Thread Nick Desaulniers via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
nickdesaulniers marked an inline comment as done.
Closed by commit rG4f2ad15db535: [Clang] implement 
-fno-eliminate-unused-debug-types (authored by nickdesaulniers).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80242

Files:
  clang/docs/ClangCommandLineReference.rst
  clang/docs/CommandGuide/clang.rst
  clang/docs/UsersManual.rst
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Basic/DebugInfoOptions.h
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/CodeGen/CGDebugInfo.h
  clang/lib/CodeGen/CGDecl.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/debug-info-unused-types.c
  clang/test/CodeGen/debug-info-unused-types.cpp
  clang/test/Driver/debug-options.c

Index: clang/test/Driver/debug-options.c
===
--- clang/test/Driver/debug-options.c
+++ clang/test/Driver/debug-options.c
@@ -361,3 +361,14 @@
 // GEMBED_2:  error: invalid argument '-gembed-source' only allowed with '-gdwarf-5'
 // NOGEMBED_5-NOT:  "-gembed-source"
 // NOGEMBED_2-NOT:  error: invalid argument '-gembed-source' only allowed with '-gdwarf-5'
+//
+// RUN: %clang -### -g -fno-eliminate-unused-debug-types -c %s 2>&1 \
+// RUN:| FileCheck -check-prefix=DEBUG_UNUSED_TYPES %s
+// DEBUG_UNUSED_TYPES: "-debug-info-kind=unused-types"
+// DEBUG_UNUSED_TYPES-NOT: "-debug-info-kind=limited"
+// RUN: %clang -### -g -feliminate-unused-debug-types -c %s 2>&1 \
+// RUN:| FileCheck -check-prefix=NO_DEBUG_UNUSED_TYPES %s
+// RUN: %clang -### -fno-eliminate-unused-debug-types -g1 -c %s 2>&1 \
+// RUN:| FileCheck -check-prefix=NO_DEBUG_UNUSED_TYPES %s
+// NO_DEBUG_UNUSED_TYPES: "-debug-info-kind={{limited|line-tables-only|standalone}}"
+// NO_DEBUG_UNUSED_TYPES-NOT: "-debug-info-kind=unused-types"
Index: clang/test/CodeGen/debug-info-unused-types.cpp
===
--- /dev/null
+++ clang/test/CodeGen/debug-info-unused-types.cpp
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -debug-info-kind=unused-types -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck --check-prefix=NODBG %s
+using foo = int;
+class bar {};
+enum class baz { BAZ };
+
+void quux() {
+  using x = int;
+  class y {};
+  enum class z { Z };
+}
+
+// CHECK: !DICompileUnit{{.+}}retainedTypes: [[RETTYPES:![0-9]+]]
+// CHECK: [[TYPE0:![0-9]+]] = !DICompositeType(tag: DW_TAG_enumeration_type, name: "baz"
+// CHECK: [[TYPE1:![0-9]+]] = !DIEnumerator(name: "BAZ"
+// CHECK: [[TYPE2:![0-9]+]] = !DICompositeType(tag: DW_TAG_enumeration_type, name: "z"
+// CHECK: [[TYPE3:![0-9]+]] = !DIEnumerator(name: "Z"
+// CHECK: [[RETTYPES]] = !{[[TYPE4:![0-9]+]], [[TYPE5:![0-9]+]], [[TYPE0]], {{![0-9]+}}, [[TYPE6:![0-9]+]], [[TYPE2]]}
+// CHECK: [[TYPE4]] = !DIDerivedType(tag: DW_TAG_typedef, name: "foo"
+// CHECK: [[TYPE5]] = distinct !DICompositeType(tag: DW_TAG_class_type, name: "bar"
+// CHECK: [[TYPE6]] = distinct !DICompositeType(tag: DW_TAG_class_type, name: "y"
+
+// NODBG-NOT: !DI{{CompositeType|Enumerator|DerivedType}}
+
+class unused_class;
+enum class unused_enum_class;
+
+// NODBG-NOT: name: "unused_
Index: clang/test/CodeGen/debug-info-unused-types.c
===
--- /dev/null
+++ clang/test/CodeGen/debug-info-unused-types.c
@@ -0,0 +1,47 @@
+// RUN: %clang_cc1 -debug-info-kind=unused-types -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck --check-prefix=NODBG %s
+typedef int my_int;
+struct foo {};
+enum bar { BAR };
+union baz {};
+
+void quux(void) {
+  typedef int x;
+  struct y {};
+  enum z { Z };
+  union w {};
+}
+
+// Check that debug info is emitted for the typedef, struct, enum, and union
+// when -fno-eliminate-unused-debug-types and -g are set.
+
+// CHECK: !DICompileUnit{{.+}}retainedTypes: [[RETTYPES:![0-9]+]]
+// CHECK: [[TYPE0:![0-9]+]] = !DICompositeType(tag: DW_TAG_enumeration_type, name: "bar"
+// CHECK: [[TYPE1:![0-9]+]] = !DIEnumerator(name: "BAR"
+// CHECK: [[TYPE2:![0-9]+]] = !DICompositeType(tag: DW_TAG_enumeration_type, name: "z"
+// CHECK: [[TYPE3:![0-9]+]] = !DIEnumerator(name: "Z"
+// CHECK: [[RETTYPES]] = !{[[TYPE4:![0-9]+]], [[TYPE5:![0-9]+]], [[TYPE0]], [[TYPE6:![0-9]+]], {{![0-9]+}}, [[TYPE7:![0-9]+]], [[TYPE2]], [[TYPE8:![0-9]+]]}
+// CHECK: [[TYPE4]] = !DIDerivedType(tag: DW_TAG_typedef, name: "my_int"
+// CHECK: [[TYPE5]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "foo"
+// CHECK: [[TYPE6]] = distinct !DICompositeType(tag: DW_TAG_union_type, name: "baz"
+// CHECK: [[TYPE7]] = distinct !DICom

Re: [PATCH] D85545: [Diagnostics] Diagnose missing comma in string array initialization

2020-08-10 Thread Arthur O'Dwyer via cfe-commits
To decrease the number of false-positives, you could emit the warning only
if *exactly one* comma was missing.

const char *likely_a_bug[] = { "a", "b", "c" "d", "e", "f", "g", "h",
"i" };
const char *likely_not_a_bug[] = { "a", "b" "c", "d" "e", "f" "g" };
const char *oops_still_a_bug[] = { "a", "b", "c" "d", "e", "f" "g",
"h", "i" };

However, as `oops_still_a_bug` shows, that tactic would also decrease the
number of true positives, and it would confuse the end-user, for whom
predictability is key.

I still think it would be appropriate to *stop issuing the warning for
structs*, though.
Here's my struct example from below in Godbolt: https://godbolt.org/z/6jjv6a
Speaking of predictability, I don't understand why `struct Y` avoids the
warning whereas `struct X` hits it.
After removing the warning for structs, neither `X` nor `Y` should hit it,
and that should fix pretty much all the Firefox hits as I understand them.

–Arthur


On Mon, Aug 10, 2020 at 5:51 PM Dávid Bolvanský 
wrote:

> Something like this:
>   const char *Sources[] = {
> "// \\tparam aaa Bbb\n",
> "// \\tparam\n"
> "// aaa Bbb\n",
> "// \\tparam \n"
> "// aaa Bbb\n",
> "// \\tparam aaa\n"
> "// Bbb\n"
>   };
>
> annoys me :/ Any idea/heuristic how to avoid warning here?
>
> po 10. 8. 2020 o 23:48 Dávid Bolvanský 
> napísal(a):
> >
> > For your cases, we currently do not warn. If possible, fetch the
> > latest Clang trunk and re-evaluate on Firefox.
> >
> > po 10. 8. 2020 o 23:46 Arthur O'Dwyer 
> napísal(a):
> > >
> > > It looks to me as if all of the false-positives so far have been not
> arrays but structs.
> > >
> > > struct X { int a; const char *b; int c; };
> > > X x = { 41, "forty" "two", 43 };  // false-positive here
> > >
> > > The distinguishing feature here is that if you did insert a comma as
> suggested by the compiler, then the result would no longer type-check.
> > > X x = { 41, "forty", "two", 43 };  // this is ill-formed because "two"
> is not a valid initializer for `int c`
> > >
> > > Dávid, can you use this in some way?
> > > IMHO it would be appropriate to just turn the warning off if the
> entity being initialized is a struct — leave the warning enabled only for
> initializers of arrays.
> > >
> > > my $.02,
> > > –Arthur
> > >
> > >
> > > On Mon, Aug 10, 2020 at 5:38 PM Dávid Bolvanský <
> david.bolvan...@gmail.com> wrote:
> > >>
> > >> I moved it to -Wextra due to false positives.
> > >>
> > >> > Should there be some exception for line length
> > >>
> > >> Yeah, but sure how to define the threshold or so. :/
> > >>
> > >> po 10. 8. 2020 o 23:21 dmajor via Phabricator
> > >>  napísal(a):
> > >> >
> > >> > dmajor added a comment.
> > >> >
> > >> > In the Firefox repo this warning is firing on a number of strings
> that were broken up by clang-format (or humans) for line length, for
> example
> https://searchfox.org/mozilla-central/rev/ab81b8552f4aa9696a2524f97fdfeb59d4dc31c1/security/certverifier/ExtendedValidation.cpp#176-178
> or
> https://searchfox.org/mozilla-central/rev/ab81b8552f4aa9696a2524f97fdfeb59d4dc31c1/xpcom/tests/gtest/TestEscape.cpp#103-104
> or
> https://searchfox.org/mozilla-central/rev/ab81b8552f4aa9696a2524f97fdfeb59d4dc31c1/js/src/jsapi-tests/testXDR.cpp#115
> .
> > >> >
> > >> > Do you consider these to be false positives in your view? Should
> there be some exception for line length, perhaps?
> > >> >
> > >> >
> > >> > Repository:
> > >> >   rG LLVM Github Monorepo
> > >> >
> > >> > CHANGES SINCE LAST ACTION
> > >> >   https://reviews.llvm.org/D85545/new/
> > >> >
> > >> > https://reviews.llvm.org/D85545
> > >> >
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [clang] 4dcbb9c - [clang] Add -fno-delayed-template-parsing to the added unit tests in DeclPrinterTest.cpp

2020-08-10 Thread David Blaikie via cfe-commits
Would be helpful to document in the commit message why a change is being made.

On Wed, Aug 5, 2020 at 6:13 AM Bruno Ricci via cfe-commits
 wrote:
>
>
> Author: Bruno Ricci
> Date: 2020-08-05T14:13:05+01:00
> New Revision: 4dcbb9cef71afa549afe8f6b4d335b1c996f8079
>
> URL: 
> https://github.com/llvm/llvm-project/commit/4dcbb9cef71afa549afe8f6b4d335b1c996f8079
> DIFF: 
> https://github.com/llvm/llvm-project/commit/4dcbb9cef71afa549afe8f6b4d335b1c996f8079.diff
>
> LOG: [clang] Add -fno-delayed-template-parsing to the added unit tests in 
> DeclPrinterTest.cpp
>
> Added:
>
>
> Modified:
> clang/unittests/AST/DeclPrinterTest.cpp
>
> Removed:
>
>
>
> 
> diff  --git a/clang/unittests/AST/DeclPrinterTest.cpp 
> b/clang/unittests/AST/DeclPrinterTest.cpp
> index 38e46a378b47..6b7ceac3cb02 100644
> --- a/clang/unittests/AST/DeclPrinterTest.cpp
> +++ b/clang/unittests/AST/DeclPrinterTest.cpp
> @@ -153,8 +153,7 @@ ::testing::AssertionResult PrintedDeclCXX11nonMSCMatches(
>StringRef Code,
>const DeclarationMatcher &NodeMatch,
>StringRef ExpectedPrinted) {
> -  std::vector Args(1, "-std=c++11");
> -  Args.push_back("-fno-delayed-template-parsing");
> +  std::vector Args{"-std=c++11", 
> "-fno-delayed-template-parsing"};
>return PrintedDeclMatches(Code,
>  Args,
>  NodeMatch,
> @@ -166,7 +165,7 @@ ::testing::AssertionResult
>  PrintedDeclCXX17Matches(StringRef Code, const DeclarationMatcher &NodeMatch,
>  StringRef ExpectedPrinted,
>  PrintingPolicyModifier PolicyModifier = nullptr) {
> -  std::vector Args(1, "-std=c++17");
> +  std::vector Args{"-std=c++17", 
> "-fno-delayed-template-parsing"};
>return PrintedDeclMatches(Code, Args, NodeMatch, ExpectedPrinted, 
> "input.cc",
>  PolicyModifier);
>  }
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D85545: [Diagnostics] Diagnose missing comma in string array initialization

2020-08-10 Thread Dávid Bolvanský via cfe-commits
Something like this:
  const char *Sources[] = {
"// \\tparam aaa Bbb\n",
"// \\tparam\n"
"// aaa Bbb\n",
"// \\tparam \n"
"// aaa Bbb\n",
"// \\tparam aaa\n"
"// Bbb\n"
  };

annoys me :/ Any idea/heuristic how to avoid warning here?

po 10. 8. 2020 o 23:48 Dávid Bolvanský  napísal(a):
>
> For your cases, we currently do not warn. If possible, fetch the
> latest Clang trunk and re-evaluate on Firefox.
>
> po 10. 8. 2020 o 23:46 Arthur O'Dwyer  napísal(a):
> >
> > It looks to me as if all of the false-positives so far have been not arrays 
> > but structs.
> >
> > struct X { int a; const char *b; int c; };
> > X x = { 41, "forty" "two", 43 };  // false-positive here
> >
> > The distinguishing feature here is that if you did insert a comma as 
> > suggested by the compiler, then the result would no longer type-check.
> > X x = { 41, "forty", "two", 43 };  // this is ill-formed because "two" is 
> > not a valid initializer for `int c`
> >
> > Dávid, can you use this in some way?
> > IMHO it would be appropriate to just turn the warning off if the entity 
> > being initialized is a struct — leave the warning enabled only for 
> > initializers of arrays.
> >
> > my $.02,
> > –Arthur
> >
> >
> > On Mon, Aug 10, 2020 at 5:38 PM Dávid Bolvanský  
> > wrote:
> >>
> >> I moved it to -Wextra due to false positives.
> >>
> >> > Should there be some exception for line length
> >>
> >> Yeah, but sure how to define the threshold or so. :/
> >>
> >> po 10. 8. 2020 o 23:21 dmajor via Phabricator
> >>  napísal(a):
> >> >
> >> > dmajor added a comment.
> >> >
> >> > In the Firefox repo this warning is firing on a number of strings that 
> >> > were broken up by clang-format (or humans) for line length, for example 
> >> > https://searchfox.org/mozilla-central/rev/ab81b8552f4aa9696a2524f97fdfeb59d4dc31c1/security/certverifier/ExtendedValidation.cpp#176-178
> >> >  or 
> >> > https://searchfox.org/mozilla-central/rev/ab81b8552f4aa9696a2524f97fdfeb59d4dc31c1/xpcom/tests/gtest/TestEscape.cpp#103-104
> >> >  or 
> >> > https://searchfox.org/mozilla-central/rev/ab81b8552f4aa9696a2524f97fdfeb59d4dc31c1/js/src/jsapi-tests/testXDR.cpp#115.
> >> >
> >> > Do you consider these to be false positives in your view? Should there 
> >> > be some exception for line length, perhaps?
> >> >
> >> >
> >> > Repository:
> >> >   rG LLVM Github Monorepo
> >> >
> >> > CHANGES SINCE LAST ACTION
> >> >   https://reviews.llvm.org/D85545/new/
> >> >
> >> > https://reviews.llvm.org/D85545
> >> >
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D85545: [Diagnostics] Diagnose missing comma in string array initialization

2020-08-10 Thread Dávid Bolvanský via cfe-commits
For your cases, we currently do not warn. If possible, fetch the
latest Clang trunk and re-evaluate on Firefox.

po 10. 8. 2020 o 23:46 Arthur O'Dwyer  napísal(a):
>
> It looks to me as if all of the false-positives so far have been not arrays 
> but structs.
>
> struct X { int a; const char *b; int c; };
> X x = { 41, "forty" "two", 43 };  // false-positive here
>
> The distinguishing feature here is that if you did insert a comma as 
> suggested by the compiler, then the result would no longer type-check.
> X x = { 41, "forty", "two", 43 };  // this is ill-formed because "two" is not 
> a valid initializer for `int c`
>
> Dávid, can you use this in some way?
> IMHO it would be appropriate to just turn the warning off if the entity being 
> initialized is a struct — leave the warning enabled only for initializers of 
> arrays.
>
> my $.02,
> –Arthur
>
>
> On Mon, Aug 10, 2020 at 5:38 PM Dávid Bolvanský  
> wrote:
>>
>> I moved it to -Wextra due to false positives.
>>
>> > Should there be some exception for line length
>>
>> Yeah, but sure how to define the threshold or so. :/
>>
>> po 10. 8. 2020 o 23:21 dmajor via Phabricator
>>  napísal(a):
>> >
>> > dmajor added a comment.
>> >
>> > In the Firefox repo this warning is firing on a number of strings that 
>> > were broken up by clang-format (or humans) for line length, for example 
>> > https://searchfox.org/mozilla-central/rev/ab81b8552f4aa9696a2524f97fdfeb59d4dc31c1/security/certverifier/ExtendedValidation.cpp#176-178
>> >  or 
>> > https://searchfox.org/mozilla-central/rev/ab81b8552f4aa9696a2524f97fdfeb59d4dc31c1/xpcom/tests/gtest/TestEscape.cpp#103-104
>> >  or 
>> > https://searchfox.org/mozilla-central/rev/ab81b8552f4aa9696a2524f97fdfeb59d4dc31c1/js/src/jsapi-tests/testXDR.cpp#115.
>> >
>> > Do you consider these to be false positives in your view? Should there be 
>> > some exception for line length, perhaps?
>> >
>> >
>> > Repository:
>> >   rG LLVM Github Monorepo
>> >
>> > CHANGES SINCE LAST ACTION
>> >   https://reviews.llvm.org/D85545/new/
>> >
>> > https://reviews.llvm.org/D85545
>> >
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80242: [Clang] implement -fno-eliminate-unused-debug-types

2020-08-10 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers marked 2 inline comments as done.
nickdesaulniers added inline comments.



Comment at: clang/test/Driver/debug-options.c:371-373
+// RUN: %clang -### -fno-eliminate-unused-debug-types -g1 -c %s 2>&1 \
+// RUN:| FileCheck -check-prefix=NO_DEBUG_UNUSED_TYPES %s
+// NO_DEBUG_UNUSED_TYPES: 
"-debug-info-kind={{limited|line-tables-only|standalone}}"

dblaikie wrote:
> nickdesaulniers wrote:
> > dblaikie wrote:
> > > Why does this test -g1 in particular? (that, I think, would always be 
> > > line-tables-only, on all Clang platforms?) Rather than -g like the 
> > > positive test?
> > From the previous diff 
> > (https://lists.llvm.org/pipermail/llvm-dev/2020-August/144082.html) we 
> > added a test to `clang/test/CodeGen/` tests for `-fno...` and `-g1` 
> > together. Since I moved those to `%clang_cc1`, I moved the `-fno...` + 
> > `-g1` tests here.
> Ah, right right (link might be incorrect though - so including the one where 
> it was discussed: https://reviews.llvm.org/D80242#inline-774452 ) - thanks!
LOL, yeah sorry, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80242

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


Re: [PATCH] D85545: [Diagnostics] Diagnose missing comma in string array initialization

2020-08-10 Thread Arthur O'Dwyer via cfe-commits
It looks to me as if all of the false-positives so far have been *not
arrays but structs*.

struct X { int a; const char *b; int c; };
X x = { 41, "forty" "two", 43 };  // false-positive here

The distinguishing feature here is that if you did insert a comma as
suggested by the compiler, then the result would no longer type-check.
X x = { 41, "forty", "two", 43 };  // this is ill-formed because "two" is
not a valid initializer for `int c`

Dávid, can you use this in some way?
IMHO it would be appropriate to just turn the warning off if the entity
being initialized is a struct — leave the warning enabled only for
initializers of arrays.

my $.02,
–Arthur


On Mon, Aug 10, 2020 at 5:38 PM Dávid Bolvanský 
wrote:

> I moved it to -Wextra due to false positives.
>
> > Should there be some exception for line length
>
> Yeah, but sure how to define the threshold or so. :/
>
> po 10. 8. 2020 o 23:21 dmajor via Phabricator
>  napísal(a):
> >
> > dmajor added a comment.
> >
> > In the Firefox repo this warning is firing on a number of strings that
> were broken up by clang-format (or humans) for line length, for example
> https://searchfox.org/mozilla-central/rev/ab81b8552f4aa9696a2524f97fdfeb59d4dc31c1/security/certverifier/ExtendedValidation.cpp#176-178
> or
> https://searchfox.org/mozilla-central/rev/ab81b8552f4aa9696a2524f97fdfeb59d4dc31c1/xpcom/tests/gtest/TestEscape.cpp#103-104
> or
> https://searchfox.org/mozilla-central/rev/ab81b8552f4aa9696a2524f97fdfeb59d4dc31c1/js/src/jsapi-tests/testXDR.cpp#115
> .
> >
> > Do you consider these to be false positives in your view? Should there
> be some exception for line length, perhaps?
> >
> >
> > Repository:
> >   rG LLVM Github Monorepo
> >
> > CHANGES SINCE LAST ACTION
> >   https://reviews.llvm.org/D85545/new/
> >
> > https://reviews.llvm.org/D85545
> >
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80242: [Clang] implement -fno-eliminate-unused-debug-types

2020-08-10 Thread David Blaikie via Phabricator via cfe-commits
dblaikie accepted this revision.
dblaikie added a comment.

Looks good, thanks!




Comment at: clang/test/Driver/debug-options.c:371-373
+// RUN: %clang -### -fno-eliminate-unused-debug-types -g1 -c %s 2>&1 \
+// RUN:| FileCheck -check-prefix=NO_DEBUG_UNUSED_TYPES %s
+// NO_DEBUG_UNUSED_TYPES: 
"-debug-info-kind={{limited|line-tables-only|standalone}}"

nickdesaulniers wrote:
> dblaikie wrote:
> > Why does this test -g1 in particular? (that, I think, would always be 
> > line-tables-only, on all Clang platforms?) Rather than -g like the positive 
> > test?
> From the previous diff 
> (https://lists.llvm.org/pipermail/llvm-dev/2020-August/144082.html) we added 
> a test to `clang/test/CodeGen/` tests for `-fno...` and `-g1` together. Since 
> I moved those to `%clang_cc1`, I moved the `-fno...` + `-g1` tests here.
Ah, right right (link might be incorrect though - so including the one where it 
was discussed: https://reviews.llvm.org/D80242#inline-774452 ) - thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80242

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


[PATCH] D85596: [Docs] Link to --print-supported-cpus option

2020-08-10 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added inline comments.



Comment at: clang/docs/CommandGuide/clang.rst:346
 
-  Aliases of --print-supported-cpus
+  Aliases of :option:`--print-supported-cpus`
 

Would you mind adding a `.` for punctuation while you're here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85596

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


Re: [PATCH] D85545: [Diagnostics] Diagnose missing comma in string array initialization

2020-08-10 Thread Dávid Bolvanský via cfe-commits
I moved it to -Wextra due to false positives.

> Should there be some exception for line length

Yeah, but sure how to define the threshold or so. :/

po 10. 8. 2020 o 23:21 dmajor via Phabricator
 napísal(a):
>
> dmajor added a comment.
>
> In the Firefox repo this warning is firing on a number of strings that were 
> broken up by clang-format (or humans) for line length, for example 
> https://searchfox.org/mozilla-central/rev/ab81b8552f4aa9696a2524f97fdfeb59d4dc31c1/security/certverifier/ExtendedValidation.cpp#176-178
>  or 
> https://searchfox.org/mozilla-central/rev/ab81b8552f4aa9696a2524f97fdfeb59d4dc31c1/xpcom/tests/gtest/TestEscape.cpp#103-104
>  or 
> https://searchfox.org/mozilla-central/rev/ab81b8552f4aa9696a2524f97fdfeb59d4dc31c1/js/src/jsapi-tests/testXDR.cpp#115.
>
> Do you consider these to be false positives in your view? Should there be 
> some exception for line length, perhaps?
>
>
> Repository:
>   rG LLVM Github Monorepo
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D85545/new/
>
> https://reviews.llvm.org/D85545
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] b2c9b63 - [Diagnostics] Move -Wstring-concatenation to -Wextra

2020-08-10 Thread Dávid Bolvanský via cfe-commits

Author: Dávid Bolvanský
Date: 2020-08-10T23:36:33+02:00
New Revision: b2c9b631bb48087c988d798adc5465499b155a9a

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

LOG: [Diagnostics] Move -Wstring-concatenation to -Wextra

Added: 


Modified: 
clang/include/clang/Basic/DiagnosticGroups.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaExpr.cpp
clang/test/Sema/string-concat.c

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticGroups.td 
b/clang/include/clang/Basic/DiagnosticGroups.td
index 5ddd37e9972a..2b13f9eca12d 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -547,6 +547,7 @@ def StaticLocalInInline : 
DiagGroup<"static-local-in-inline">;
 def GNUStaticFloatInit : DiagGroup<"gnu-static-float-init">;
 def StaticFloatInit : DiagGroup<"static-float-init", [GNUStaticFloatInit]>;
 def GNUStatementExpression : DiagGroup<"gnu-statement-expression">;
+def StringConcatation : DiagGroup<"string-concatenation">;
 def StringCompare : DiagGroup<"string-compare">;
 def StringPlusInt : DiagGroup<"string-plus-int">;
 def StringPlusChar : DiagGroup<"string-plus-char">;
@@ -880,7 +881,8 @@ def Extra : DiagGroup<"extra", [
 SignCompare,
 UnusedParameter,
 NullPointerArithmetic,
-EmptyInitStatement
+EmptyInitStatement,
+StringConcatation
   ]>;
 
 def Most : DiagGroup<"most", [

diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index d0bddd80b8fe..f2e939da3050 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -3005,7 +3005,7 @@ def warn_objc_string_literal_comparison : Warning<
 def warn_concatenated_literal_array_init : Warning<
   "suspicious concatenation of string literals in an array initialization; "
   "did you mean to separate the elements with a comma?">,
-  InGroup>;
+  InGroup, DefaultIgnore;
 def warn_concatenated_nsarray_literal : Warning<
   "concatenated NSString literal for an NSArray expression - "
   "possibly missing a comma">,

diff  --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 8f38238401fc..28ac1dfeb082 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -6914,7 +6914,6 @@ Sema::ActOnInitList(SourceLocation LBraceLoc, 
MultiExprArg InitArgList,
   // Do not warn when all the elements in the initializer are concatenated
   // together. Do not warn for macros too.
   if (NumConcat > 1 && E > 2 && !SL->getBeginLoc().isMacroID() &&
-  SL->getString().find(" ") == llvm::StringRef::npos &&
   isa(InitArgList[0]) && SLPrev &&
   NumConcat != SLPrev->getNumConcatenated()) {
 SmallVector Hints;

diff  --git a/clang/test/Sema/string-concat.c b/clang/test/Sema/string-concat.c
index 09de0a9bffbe..4e5ed4424e7c 100644
--- a/clang/test/Sema/string-concat.c
+++ b/clang/test/Sema/string-concat.c
@@ -1,6 +1,6 @@
 
-// RUN: %clang_cc1 -x c -fsyntax-only -verify %s
-// RUN: %clang_cc1 -x c++ -fsyntax-only -verify %s
+// RUN: %clang_cc1 -x c -Wstring-concatenation -fsyntax-only -verify %s
+// RUN: %clang_cc1 -x c++ -Wstring-concatenation -fsyntax-only -verify %s
 
 const char *missing_comma[] = {
 "basic_filebuf",
@@ -110,19 +110,6 @@ const char *not_warn2[] = {
 "// Aaa\\\r"   " Bbb\\ \r"   " Ccc?" "?/\r"
 };
 
-const char *not_warn3[] = {
-"// \\param [in,out] aaa Bbb\n",
-"// \\param[in,out] aaa Bbb\n",
-"// \\param [in, out] aaa Bbb\n",
-"// \\param [in,\n"
-"// out] aaa Bbb\n",
-"// \\param [in,out]\n"
-"// aaa Bbb\n",
-"// \\param [in,out] aaa\n"
-"// Bbb\n"
-};
-
-
 // Do not warn when all the elements in the initializer are concatenated 
together.
 const char *all_elems_in_init_concatenated[] = {"a" "b" "c"};
 



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


[PATCH] D80242: [Clang] implement -fno-eliminate-unused-debug-types

2020-08-10 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added inline comments.



Comment at: clang/test/Driver/debug-options.c:371-373
+// RUN: %clang -### -fno-eliminate-unused-debug-types -g1 -c %s 2>&1 \
+// RUN:| FileCheck -check-prefix=NO_DEBUG_UNUSED_TYPES %s
+// NO_DEBUG_UNUSED_TYPES: 
"-debug-info-kind={{limited|line-tables-only|standalone}}"

dblaikie wrote:
> Why does this test -g1 in particular? (that, I think, would always be 
> line-tables-only, on all Clang platforms?) Rather than -g like the positive 
> test?
From the previous diff 
(https://lists.llvm.org/pipermail/llvm-dev/2020-August/144082.html) we added a 
test to `clang/test/CodeGen/` tests for `-fno...` and `-g1` together. Since I 
moved those to `%clang_cc1`, I moved the `-fno...` + `-g1` tests here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80242

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


[PATCH] D80242: [Clang] implement -fno-eliminate-unused-debug-types

2020-08-10 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added inline comments.



Comment at: clang/test/Driver/debug-options.c:371-373
+// RUN: %clang -### -fno-eliminate-unused-debug-types -g1 -c %s 2>&1 \
+// RUN:| FileCheck -check-prefix=NO_DEBUG_UNUSED_TYPES %s
+// NO_DEBUG_UNUSED_TYPES: 
"-debug-info-kind={{limited|line-tables-only|standalone}}"

Why does this test -g1 in particular? (that, I think, would always be 
line-tables-only, on all Clang platforms?) Rather than -g like the positive 
test?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80242

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


[PATCH] D85575: [ARM] Speed up arm-cortex-cpus.c test

2020-08-10 Thread Artem Belevich via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9c8ae4086031: [ARM] Speed up arm-cortex-cpus.c test 
(authored by tra).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85575

Files:
  clang/test/Driver/arm-cortex-cpus.c

Index: clang/test/Driver/arm-cortex-cpus.c
===
--- clang/test/Driver/arm-cortex-cpus.c
+++ clang/test/Driver/arm-cortex-cpus.c
@@ -510,19 +510,19 @@
 // == Check default Architecture on each ARM11 CPU
 // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1136j-s -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6 %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1136jf-s -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6 %s
-// CHECK-CPUV6: "-cc1"{{.*}} "-triple" "armv6-{{.*}}
+// CHECK-CPUV6: "-cc1"{{.*}} "-triple" "armv6-
 
 // RUN: %clang -target arm-linux-gnueabi -mcpu=mpcore -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6K %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=mpcorenovfp -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6K %s
-// CHECK-CPUV6K: "-cc1"{{.*}} "-triple" "armv6k-{{.*}}
+// CHECK-CPUV6K: "-cc1"{{.*}} "-triple" "armv6k-
 
 // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1176jz-s -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6KZ %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1176jzf-s -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6KZ %s
-// CHECK-CPUV6KZ: "-cc1"{{.*}} "-triple" "armv6kz-{{.*}}
+// CHECK-CPUV6KZ: "-cc1"{{.*}} "-triple" "armv6kz-
 
 // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1156t2-s -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6T2 %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1156t2f-s -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6T2 %s
-// CHECK-CPUV6T2: "-cc1"{{.*}} "-triple" "armv6t2-{{.*}}
+// CHECK-CPUV6T2: "-cc1"{{.*}} "-triple" "armv6t2-
 
 // == Check default Architecture on each Cortex CPU
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a5 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7A %s
@@ -539,7 +539,7 @@
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a12 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7A %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a15 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7A %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a17 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7A %s
-// CHECK-CPUV7A: "-cc1"{{.*}} "-triple" "armv7-{{.*}}
+// CHECK-CPUV7A: "-cc1"{{.*}} "-triple" "armv7-
 
 // RUN: %clang -target armeb-linux-gnueabi -mcpu=cortex-a5 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7A %s
 // RUN: %clang -target armeb-linux-gnueabi -mcpu=cortex-a7 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7A %s
@@ -555,7 +555,7 @@
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a12 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7A %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a15 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7A %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a17 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7A %s
-// CHECK-BE-CPUV7A: "-cc1"{{.*}} "-triple" "armebv7-{{.*}}
+// CHECK-BE-CPUV7A: "-cc1"{{.*}} "-triple" "armebv7-
 
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a5 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7A-THUMB %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a7 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7A-THUMB %s
@@ -571,7 +571,7 @@
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a12 -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7A-THUMB %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a15 -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7A-THUMB %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a17 -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7A-THUMB %s
-// CHECK-CPUV7A-THUMB: "-cc1"{{.*}} "-triple" "thumbv7-{{.*}}
+// CHECK-CPUV7A-THUMB: "-cc1"{{.*}} "-triple" "thumbv7-
 
 // RUN: %clang -target armeb-linux-gnueabi -mcpu=cortex-a5 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7A-THUMB %s
 // RUN: %clang -target armeb-linux-gnueabi -mcpu=cortex-a7 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7A-THUMB %s
@@ -587,19 +587,19 @@
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a12 -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7A-THUMB %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a15 -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7A-THUMB %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a17 -mbig-endian -m

[clang] 9c8ae40 - [ARM] Speed up arm-cortex-cpus.c test

2020-08-10 Thread Artem Belevich via cfe-commits

Author: Artem Belevich
Date: 2020-08-10T14:27:19-07:00
New Revision: 9c8ae40860311e94de0a898101818f706228e958

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

LOG: [ARM] Speed up arm-cortex-cpus.c test

Trailing wildcard regex searches greedily continue searching through the whole
input and make the test unnecessarily slow.

Using equivalent plain text partial match speeds up the test execution time from
~35s to ~12s.

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

Added: 


Modified: 
clang/test/Driver/arm-cortex-cpus.c

Removed: 




diff  --git a/clang/test/Driver/arm-cortex-cpus.c 
b/clang/test/Driver/arm-cortex-cpus.c
index 6de1040e9420..4481ba58fa64 100644
--- a/clang/test/Driver/arm-cortex-cpus.c
+++ b/clang/test/Driver/arm-cortex-cpus.c
@@ -510,19 +510,19 @@
 // == Check default Architecture on each ARM11 CPU
 // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1136j-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6 %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1136jf-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6 %s
-// CHECK-CPUV6: "-cc1"{{.*}} "-triple" "armv6-{{.*}}
+// CHECK-CPUV6: "-cc1"{{.*}} "-triple" "armv6-
 
 // RUN: %clang -target arm-linux-gnueabi -mcpu=mpcore -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6K %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=mpcorenovfp -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6K %s
-// CHECK-CPUV6K: "-cc1"{{.*}} "-triple" "armv6k-{{.*}}
+// CHECK-CPUV6K: "-cc1"{{.*}} "-triple" "armv6k-
 
 // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1176jz-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6KZ %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1176jzf-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6KZ %s
-// CHECK-CPUV6KZ: "-cc1"{{.*}} "-triple" "armv6kz-{{.*}}
+// CHECK-CPUV6KZ: "-cc1"{{.*}} "-triple" "armv6kz-
 
 // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1156t2-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6T2 %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1156t2f-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6T2 %s
-// CHECK-CPUV6T2: "-cc1"{{.*}} "-triple" "armv6t2-{{.*}}
+// CHECK-CPUV6T2: "-cc1"{{.*}} "-triple" "armv6t2-
 
 // == Check default Architecture on each Cortex CPU
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a5 -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV7A %s
@@ -539,7 +539,7 @@
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a12 -mlittle-endian -### 
-c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7A %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a15 -mlittle-endian -### 
-c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7A %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a17 -mlittle-endian -### 
-c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7A %s
-// CHECK-CPUV7A: "-cc1"{{.*}} "-triple" "armv7-{{.*}}
+// CHECK-CPUV7A: "-cc1"{{.*}} "-triple" "armv7-
 
 // RUN: %clang -target armeb-linux-gnueabi -mcpu=cortex-a5 -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-BE-CPUV7A %s
 // RUN: %clang -target armeb-linux-gnueabi -mcpu=cortex-a7 -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-BE-CPUV7A %s
@@ -555,7 +555,7 @@
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a12 -mbig-endian -### -c 
%s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7A %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a15 -mbig-endian -### -c 
%s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7A %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a17 -mbig-endian -### -c 
%s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7A %s
-// CHECK-BE-CPUV7A: "-cc1"{{.*}} "-triple" "armebv7-{{.*}}
+// CHECK-BE-CPUV7A: "-cc1"{{.*}} "-triple" "armebv7-
 
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a5 -mthumb -### -c %s 
2>&1 | FileCheck -check-prefix=CHECK-CPUV7A-THUMB %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a7 -mthumb -### -c %s 
2>&1 | FileCheck -check-prefix=CHECK-CPUV7A-THUMB %s
@@ -571,7 +571,7 @@
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a12 -mlittle-endian 
-mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7A-THUMB %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a15 -mlittle-endian 
-mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7A-THUMB %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a17 -mlittle-endian 
-mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7A-THUMB %s
-// CHECK-CPUV7A-THUMB: "-cc1"{{.*}} "-triple" "thumbv7-{{.*}}
+// CHECK-CPUV7A-THUMB: "-cc1"{{.*}} "-triple" "thumbv7-
 
 // RUN: %clang -target armeb-linux-gnueabi -mcpu=cortex-a5 -mthumb -### -c %s 
2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7A-THUMB %s
 // RUN: %clang -target armeb-linux-gnueabi -

[PATCH] D80735: [OpenMP][NFC] Reuse OMPIRBuilder `struct ident_t` handling in Clang

2020-08-10 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev accepted this revision.
ABataev added a comment.
This revision is now accepted and ready to land.

LG


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80735

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


[PATCH] D80735: [OpenMP][NFC] Reuse OMPIRBuilder `struct ident_t` handling in Clang

2020-08-10 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added inline comments.



Comment at: clang/test/OpenMP/master_taskloop_reduction_codegen.cpp:164
 // CHECK:store i32 [[SUB12]], i32* [[DOTCAPTURE_EXPR_9]],
-// CHECK:[[TMP65:%.*]] = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* 
%{{.+}}, i32 [[TMP0]], i32 1, i64 888, i64 40, i32 (i32, i8*)* bitcast (i32 
(i32, %struct.kmp_task_t_with_privates*)* @[[TASK:.+]] to i32 (i32, i8*)*))
-// CHECK:call void @__kmpc_taskloop(%struct.ident_t* %{{.+}}, i32 
[[TMP0]], i8* [[TMP65]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 1, 
i32 0, i64 0, i8* null)
+// CHECK:[[TMP65:%.*]] = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* 
{{.+}}, i32 [[TMP0]], i32 1, i64 888, i64 40, i32 (i32, i8*)* bitcast (i32 
(i32, %struct.kmp_task_t_with_privates*)* @[[TASK:.+]] to i32 (i32, i8*)*))
+// CHECK:call void @__kmpc_taskloop(%struct.ident_t* {{.+}}, i32 [[TMP0]], 
i8* [[TMP65]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 1, i32 0, 
i64 0, i8* null)

ABataev wrote:
> jdoerfert wrote:
> > ABataev wrote:
> > > Looks like there is a difference in presence of the debug info
> > The actual content of the `%struct.ident_t*` is the same in both versions. 
> > No difference, as described in the commit message.
> So, now, instead of locals, you generate unique global with debug info? If 
> so, could you update at least one test with the debug info to show that the 
> debug strings are not lost.
Done in `clang/test/OpenMP/threadprivate_codegen.cpp`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80735

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


[PATCH] D85545: [Diagnostics] Diagnose missing comma in string array initialization

2020-08-10 Thread dmajor via Phabricator via cfe-commits
dmajor added a comment.

In the Firefox repo this warning is firing on a number of strings that were 
broken up by clang-format (or humans) for line length, for example 
https://searchfox.org/mozilla-central/rev/ab81b8552f4aa9696a2524f97fdfeb59d4dc31c1/security/certverifier/ExtendedValidation.cpp#176-178
 or 
https://searchfox.org/mozilla-central/rev/ab81b8552f4aa9696a2524f97fdfeb59d4dc31c1/xpcom/tests/gtest/TestEscape.cpp#103-104
 or 
https://searchfox.org/mozilla-central/rev/ab81b8552f4aa9696a2524f97fdfeb59d4dc31c1/js/src/jsapi-tests/testXDR.cpp#115.

Do you consider these to be false positives in your view? Should there be some 
exception for line length, perhaps?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85545

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


[PATCH] D84068: AMDGPU/clang: Search resource directory for device libraries

2020-08-10 Thread Artem Belevich via Phabricator via cfe-commits
tra added a subscriber: echristo.
tra added a comment.

In D84068#2204713 , @arsenm wrote:

>> If we ship them with clang, who/where/how builds them?
>> If they come from ROCm packages, how would those packages add stuff into 
>> *clang* install directory? Resource dir is a rather awkward location if 
>> contents may be expected to change routinely.
>
> Symlinks. I've been building the device libraries as part of 
> LLVM_EXTERNAL_PROJECTS, and think this should be the preferred way to build 
> and package the libraries. This is how compiler-rt is packaged on linux 
> distributions. The compiler-rt binaries are a separate package symlinked into 
> the resource directory locations. I'm not sure what you mean exactly by 
> change routinely, the libraries should be an implementation detail invisible 
> to users, not something they should be directly relying on. Only clang 
> actually knows how to use them correctly and every other user is buggy
>
>> What if I have multiple ROCm versions installed? Which one should provide 
>> the bitcode in the resource dir?
>
> These should be treated as an integral part of clang, and not something to 
> mix and match. Each rocm version should have its own copy of the device 
> libraries. It only happens to work most of the time if you mismatch these, 
> and this isn't a guaranteed property.

I'm still not sure how that's going to work. We have `M clang versions`:`N ROCm 
versions` relationship here. 
If I have one clang version, but want to do two different builds, one with 
ROCm-X and one with ROCm-Y, how would I do that? It sounds like I'll need to 
have multiple clang installation variants.

Similarly, if I have multiple clang versions installed, how would ROCm know 
which of those clang installations must be updated?

What if I install yet another clang version *after* ROCm has been installed, 
how will ROCm package know that it needs up update yet another clang 
installation.

This will get rather unmanageable as soon as you get beyond the "I only have 
one clang and one ROCm version" scenario.

I think it would make much more sense for clang to treat ROCm's bits as an 
external dependency, similar to CUDA. Be definition clang/llvm does not control 
anything outside of its own packages. While ROCm is AMD's package, I'm willing 
to bet that eventually various Linux distros will start shuffling its bits 
around the same way it happened to CUDA.

>> As long as explicitly specified `--hip-device-lib-path` can still point to 
>> the right path, it's probably OK, but it all adds some confusion about who 
>> controls which parts of the HIP compilation and how it all is supposed to 
>> work in cases that deviate from the default assumptions.
>
> Long term I would rather get rid of --hip-device-lib-path, and only use the 
> standard -resource_dir flags

Please, please, please keep explicit path option. There are real use cases 
where you can not expect ROCm to be installed anywhere 'standard'. Or at all. 
Imagine people embedding libclang into their GUI/tools. There's no resource 
directory. There may be no ROCm installation, or it may not be possible due to 
lack of privileges.

I short, I think that tightly coupling clang's expectations to a non-clang 
project is not a good idea.
Summoning @echristo for a second opinion.

>> It would help if the requirements would be documented somewhere.
>
> Documentation would be good, but the problem I always have is deciding where 
> "somewhere" is

clang/docs ?


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

https://reviews.llvm.org/D84068

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


[PATCH] D83325: [Sema] Iteratively strip sugar when removing address spaces.

2020-08-10 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall 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/D83325/new/

https://reviews.llvm.org/D83325

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


[PATCH] D85312: [ADT] Move FixedPoint.h from Clang to LLVM.

2020-08-10 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85312

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


[clang] 62223ff - [Diagnostics] Avoid false positives with -Wstring-concatenation

2020-08-10 Thread Dávid Bolvanský via cfe-commits

Author: Dávid Bolvanský
Date: 2020-08-10T23:05:01+02:00
New Revision: 62223ff1376b540dc9612239fdfb11b376d796d3

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

LOG: [Diagnostics] Avoid false positives with -Wstring-concatenation

Added: 


Modified: 
clang/lib/Sema/SemaExpr.cpp
clang/test/Sema/string-concat.c

Removed: 




diff  --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 23b2fbd5cbbf..8f38238401fc 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -6908,13 +6908,15 @@ Sema::ActOnInitList(SourceLocation LBraceLoc, 
MultiExprArg InitArgList,
 << InitArgList[I]->getSourceRange();
 } else if (const auto *SL = dyn_cast(InitArgList[I])) {
   unsigned NumConcat = SL->getNumConcatenated();
-  const auto *SLNext =
-  dyn_cast(InitArgList[I + 1 < E ? I + 1 : 0]);
+  const auto *SLPrev =
+  dyn_cast(InitArgList[I == 0 ? E - 1 : I - 1]);
   // Diagnose missing comma in string array initialization.
   // Do not warn when all the elements in the initializer are concatenated
   // together. Do not warn for macros too.
-  if (NumConcat > 1 && E > 2 && !SL->getBeginLoc().isMacroID() && SLNext &&
-  NumConcat != SLNext->getNumConcatenated()) {
+  if (NumConcat > 1 && E > 2 && !SL->getBeginLoc().isMacroID() &&
+  SL->getString().find(" ") == llvm::StringRef::npos &&
+  isa(InitArgList[0]) && SLPrev &&
+  NumConcat != SLPrev->getNumConcatenated()) {
 SmallVector Hints;
 for (unsigned i = 0; i < NumConcat - 1; ++i)
   Hints.push_back(FixItHint::CreateInsertion(

diff  --git a/clang/test/Sema/string-concat.c b/clang/test/Sema/string-concat.c
index 13e9656d2536..09de0a9bffbe 100644
--- a/clang/test/Sema/string-concat.c
+++ b/clang/test/Sema/string-concat.c
@@ -108,7 +108,20 @@ const char *not_warn2[] = {
 "// Aaa\\\n"   " Bbb\\ \n"   " Ccc?" "?/\n",
 "// Aaa\\\r\n" " Bbb\\ \r\n" " Ccc?" "?/\r\n",
 "// Aaa\\\r"   " Bbb\\ \r"   " Ccc?" "?/\r"
-  };
+};
+
+const char *not_warn3[] = {
+"// \\param [in,out] aaa Bbb\n",
+"// \\param[in,out] aaa Bbb\n",
+"// \\param [in, out] aaa Bbb\n",
+"// \\param [in,\n"
+"// out] aaa Bbb\n",
+"// \\param [in,out]\n"
+"// aaa Bbb\n",
+"// \\param [in,out] aaa\n"
+"// Bbb\n"
+};
+
 
 // Do not warn when all the elements in the initializer are concatenated 
together.
 const char *all_elems_in_init_concatenated[] = {"a" "b" "c"};



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


[PATCH] D80735: [OpenMP][NFC] Reuse OMPIRBuilder `struct ident_t` handling in Clang

2020-08-10 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: clang/test/OpenMP/master_taskloop_reduction_codegen.cpp:164
 // CHECK:store i32 [[SUB12]], i32* [[DOTCAPTURE_EXPR_9]],
-// CHECK:[[TMP65:%.*]] = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* 
%{{.+}}, i32 [[TMP0]], i32 1, i64 888, i64 40, i32 (i32, i8*)* bitcast (i32 
(i32, %struct.kmp_task_t_with_privates*)* @[[TASK:.+]] to i32 (i32, i8*)*))
-// CHECK:call void @__kmpc_taskloop(%struct.ident_t* %{{.+}}, i32 
[[TMP0]], i8* [[TMP65]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 1, 
i32 0, i64 0, i8* null)
+// CHECK:[[TMP65:%.*]] = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* 
{{.+}}, i32 [[TMP0]], i32 1, i64 888, i64 40, i32 (i32, i8*)* bitcast (i32 
(i32, %struct.kmp_task_t_with_privates*)* @[[TASK:.+]] to i32 (i32, i8*)*))
+// CHECK:call void @__kmpc_taskloop(%struct.ident_t* {{.+}}, i32 [[TMP0]], 
i8* [[TMP65]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 1, i32 0, 
i64 0, i8* null)

jdoerfert wrote:
> ABataev wrote:
> > Looks like there is a difference in presence of the debug info
> The actual content of the `%struct.ident_t*` is the same in both versions. No 
> difference, as described in the commit message.
So, now, instead of locals, you generate unique global with debug info? If so, 
could you update at least one test with the debug info to show that the debug 
strings are not lost.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80735

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


[PATCH] D80735: [OpenMP][NFC] Reuse OMPIRBuilder `struct ident_t` handling in Clang

2020-08-10 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert marked 2 inline comments as done.
jdoerfert added inline comments.



Comment at: clang/test/OpenMP/master_taskloop_reduction_codegen.cpp:164
 // CHECK:store i32 [[SUB12]], i32* [[DOTCAPTURE_EXPR_9]],
-// CHECK:[[TMP65:%.*]] = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* 
%{{.+}}, i32 [[TMP0]], i32 1, i64 888, i64 40, i32 (i32, i8*)* bitcast (i32 
(i32, %struct.kmp_task_t_with_privates*)* @[[TASK:.+]] to i32 (i32, i8*)*))
-// CHECK:call void @__kmpc_taskloop(%struct.ident_t* %{{.+}}, i32 
[[TMP0]], i8* [[TMP65]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 1, 
i32 0, i64 0, i8* null)
+// CHECK:[[TMP65:%.*]] = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* 
{{.+}}, i32 [[TMP0]], i32 1, i64 888, i64 40, i32 (i32, i8*)* bitcast (i32 
(i32, %struct.kmp_task_t_with_privates*)* @[[TASK:.+]] to i32 (i32, i8*)*))
+// CHECK:call void @__kmpc_taskloop(%struct.ident_t* {{.+}}, i32 [[TMP0]], 
i8* [[TMP65]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 1, i32 0, 
i64 0, i8* null)

ABataev wrote:
> Looks like there is a difference in presence of the debug info
The actual content of the `%struct.ident_t*` is the same in both versions. No 
difference, as described in the commit message.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80735

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


[PATCH] D80858: [CUDA][HIP] Support accessing static device variable in host code for -fno-gpu-rdc

2020-08-10 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment.

> The fix is here https://reviews.llvm.org/D85686

Thank you.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80858

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


[PATCH] D85686: [CUDA][HIP] Do not externalize implicit constant static variable

2020-08-10 Thread Artem Belevich via Phabricator via cfe-commits
tra accepted this revision.
tra added inline comments.
This revision is now accepted and ready to land.



Comment at: clang/lib/AST/ASTContext.cpp:11196
   return !getLangOpts().GPURelocatableDeviceCode &&
- (D->hasAttr() || D->hasAttr()) &&
+ (D->hasAttr() ||
+  (D->hasAttr() &&

I'd include `__device__` vars into the `!IsImplicit` check. While we may not 
implicitly add the attribute now, for consistency sake they should be treated 
the same. 


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

https://reviews.llvm.org/D85686

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


[PATCH] D84992: [clang codegen] Use IR "align" attribute for static array arguments.

2020-08-10 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

Okay.  LGTM, then.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84992

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


[PATCH] D80735: [OpenMP][NFC] Reuse OMPIRBuilder `struct ident_t` handling in Clang

2020-08-10 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: clang/test/OpenMP/master_taskloop_reduction_codegen.cpp:164
 // CHECK:store i32 [[SUB12]], i32* [[DOTCAPTURE_EXPR_9]],
-// CHECK:[[TMP65:%.*]] = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* 
%{{.+}}, i32 [[TMP0]], i32 1, i64 888, i64 40, i32 (i32, i8*)* bitcast (i32 
(i32, %struct.kmp_task_t_with_privates*)* @[[TASK:.+]] to i32 (i32, i8*)*))
-// CHECK:call void @__kmpc_taskloop(%struct.ident_t* %{{.+}}, i32 
[[TMP0]], i8* [[TMP65]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 1, 
i32 0, i64 0, i8* null)
+// CHECK:[[TMP65:%.*]] = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* 
{{.+}}, i32 [[TMP0]], i32 1, i64 888, i64 40, i32 (i32, i8*)* bitcast (i32 
(i32, %struct.kmp_task_t_with_privates*)* @[[TASK:.+]] to i32 (i32, i8*)*))
+// CHECK:call void @__kmpc_taskloop(%struct.ident_t* {{.+}}, i32 [[TMP0]], 
i8* [[TMP65]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 1, i32 0, 
i64 0, i8* null)

Looks like there is a difference in presence of the debug info



Comment at: clang/test/OpenMP/parallel_codegen.cpp:80
 // ALL-DEBUG:   [[VLA:%.+]] = alloca i32, i64 [[VLA_SIZE:%[^,]+]],
-// CHECK-DEBUG:   [[KMPC_LOC_PSOURCE_REF:%.+]] = getelementptr inbounds 
%struct.ident_t, %struct.ident_t* [[LOC_2_ADDR]], i32 0, i32 4
-// CHECK-DEBUG-NEXT:  store i8* getelementptr inbounds ([{{.+}} x i8], [{{.+}} 
x i8]* [[LOC1]], i32 0, i32 0), i8** [[KMPC_LOC_PSOURCE_REF]]

Same, difference in presence of the debug info.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80735

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


  1   2   3   >