[clang] [Driver][test] Make the FileCheck less strict for some tests. (PR #94349)

2024-06-04 Thread Jordan Rupprecht via cfe-commits

https://github.com/rupprecht approved this pull request.


https://github.com/llvm/llvm-project/pull/94349
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Driver][test] Make the FileCheck less strict for some tests. (PR #94349)

2024-06-04 Thread Jordan Rupprecht via cfe-commits

https://github.com/rupprecht edited 
https://github.com/llvm/llvm-project/pull/94349
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Driver] Make the FileCheck less strict for some tests. (PR #94349)

2024-06-04 Thread Jordan Rupprecht via cfe-commits


@@ -12,7 +12,7 @@
 // RUN: --sysroot=%S/Inputs/mips_mti_linux/sysroot \
 // RUN:   | FileCheck --check-prefix=CHECK-BE-HF-32R2 %s
 //
-// CHECK-BE-HF-32R2: "{{[^"]*}}clang{{[^"]*}}" {{.*}} "-triple" 
"mips-mti-linux"

rupprecht wrote:

Instead of changing the check, can you change the `RUN` lines to use `%clang 
-no-canonical-prefixes`? I would expect that to not realpath-ify the binary 
name.

https://github.com/llvm/llvm-project/pull/94349
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [lldb] [llvm] [lldb][test] Remove LLDB_TEST_USE_VENDOR_PACKAGES (PR #89260)

2024-04-18 Thread Jordan Rupprecht via cfe-commits

https://github.com/rupprecht closed 
https://github.com/llvm/llvm-project/pull/89260
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [lldb] [llvm] [lldb][test] Remove LLDB_TEST_USE_VENDOR_PACKAGES (PR #89260)

2024-04-18 Thread Jordan Rupprecht via cfe-commits

https://github.com/rupprecht created 
https://github.com/llvm/llvm-project/pull/89260

The `LLDB_TEST_USE_VENDOR_PACKAGES` has defaulted to `Off` for a while. Either 
installing `pexpect` or skipping those tests with 
`-DLLDB_TEST_USER_ARGS=--skip-category=pexpect` seems to be enough that we can 
fully remove this option.

This patch removes the `LLDB_TEST_USE_VENDOR_PACKAGES` cmake configuration as 
well as the associated code to add `third_party/Python/module` to the python 
path. I'll do the actual deletion of `third_party/Python/module` in a followup 
PR in the (unlikely, I hope) event this commit needs to be reverted.

>From cf75e576ea9a069f7429f68739362780a0171ea9 Mon Sep 17 00:00:00 2001
From: Jordan Rupprecht 
Date: Thu, 18 Apr 2024 16:02:37 +
Subject: [PATCH] [lldb][test] Remove LLDB_TEST_USE_VENDOR_PACKAGES

The `LLDB_TEST_USE_VENDOR_PACKAGES` has defaulted to `Off` for a while.
Either installing `pexpect` or skipping those tests with
`-DLLDB_TEST_USER_ARGS=--skip-category=pexpect` seems to be enough that
we can fully remove this option.

This patch removes the `LLDB_TEST_USE_VENDOR_PACKAGES` cmake
configuration as well as the associated code to add
`third_party/Python/module` to the python path. I'll do the actual
deletion of `third_party/Python/module` in a followup PR in the
(unlikely, I hope) event this commit needs to be reverted.
---
 clang/cmake/caches/Fuchsia.cmake   |  1 -
 lldb/cmake/modules/LLDBConfig.cmake|  2 --
 .../Python/lldbsuite/test/lldb_pylint_helper.py|  8 
 lldb/test/API/lit.cfg.py   |  3 ---
 lldb/test/API/lit.site.cfg.py.in   |  1 -
 lldb/test/CMakeLists.txt   |  3 +--
 lldb/use_lldb_suite_root.py| 14 --
 lldb/utils/lldb-dotest/CMakeLists.txt  |  1 -
 lldb/utils/lldb-dotest/lldb-dotest.in  |  4 
 llvm/utils/gn/secondary/lldb/test/BUILD.gn |  1 -
 10 files changed, 1 insertion(+), 37 deletions(-)

diff --git a/clang/cmake/caches/Fuchsia.cmake b/clang/cmake/caches/Fuchsia.cmake
index 393d97a4cf1a33..30a3b9116a461f 100644
--- a/clang/cmake/caches/Fuchsia.cmake
+++ b/clang/cmake/caches/Fuchsia.cmake
@@ -65,7 +65,6 @@ set(_FUCHSIA_BOOTSTRAP_PASSTHROUGH
   LLDB_EMBED_PYTHON_HOME
   LLDB_PYTHON_HOME
   LLDB_PYTHON_RELATIVE_PATH
-  LLDB_TEST_USE_VENDOR_PACKAGES
   LLDB_TEST_USER_ARGS
   Python3_EXECUTABLE
   Python3_LIBRARIES
diff --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index 5d62213c3f5838..a758261073ac57 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -67,8 +67,6 @@ option(LLDB_SKIP_STRIP "Whether to skip stripping of binaries 
when installing ll
 option(LLDB_SKIP_DSYM "Whether to skip generating a dSYM when installing 
lldb." OFF)
 option(LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS
   "Fail to configure if certain requirements are not met for testing." OFF)
-option(LLDB_TEST_USE_VENDOR_PACKAGES
-  "Use packages from lldb/third_party/Python/module instead of system deps." 
OFF)
 
 set(LLDB_GLOBAL_INIT_DIRECTORY "" CACHE STRING
   "Path to the global lldbinit directory. Relative paths are resolved relative 
to the
diff --git a/lldb/packages/Python/lldbsuite/test/lldb_pylint_helper.py 
b/lldb/packages/Python/lldbsuite/test/lldb_pylint_helper.py
index 3b746c3f9242df..2558be1364d9be 100644
--- a/lldb/packages/Python/lldbsuite/test/lldb_pylint_helper.py
+++ b/lldb/packages/Python/lldbsuite/test/lldb_pylint_helper.py
@@ -157,14 +157,6 @@ def child_dirs(parent_dir):
 0, os.path.join(packages_python_child_dir, "test_runner", 
"lib")
 )
 
-# Handle third_party module/package directory.
-third_party_module_dir = os.path.join(
-check_dir, "third_party", "Python", "module"
-)
-for child_dir in child_dirs(third_party_module_dir):
-# Yes, we embed the module in the module parent dir
-sys.path.insert(0, child_dir)
-
 # We're done.
 break
 
diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py
index 9ea389c639a013..9d6775917e1370 100644
--- a/lldb/test/API/lit.cfg.py
+++ b/lldb/test/API/lit.cfg.py
@@ -310,6 +310,3 @@ def delete_module_cache(path):
 # Propagate XDG_CACHE_HOME
 if "XDG_CACHE_HOME" in os.environ:
 config.environment["XDG_CACHE_HOME"] = os.environ["XDG_CACHE_HOME"]
-
-if is_configured("use_vendor_packages"):
-config.environment["LLDB_TEST_USE_VENDOR_PACKAGES"] = "1"
diff --git a/lldb/test/API/lit.site.cfg.py.in b/lldb/test/API/lit.site.cfg.py.in
index c2602acd2ef85a..053331dc4881f7 100644
--- a/lldb/test/API/lit.site.cfg.py.in
+++ b/lldb/test/API/lit.site.cfg.py.in
@@ -38,7 +38,6 @@ config.libcxx_include_target_dir = 
"@LIBCXX_GENERATED_INCLUDE_TARGET_DIR@"
 # The API tests use their own module caches.
 config.lldb_module_cache = 

[clang] [llvm] [clang] Migrate clang-rename to OptTable parsing (PR #89167)

2024-04-17 Thread Jordan Rupprecht via cfe-commits

https://github.com/rupprecht created 
https://github.com/llvm/llvm-project/pull/89167

Using OptTable to parse will allow including this tool in llvm-driver.

Because CommonOptionsParser is widely used and makes use of `cl::opt` flags, it 
needs to be refactored to handle both. The existing 
`CommonOptionsParser::create()` method should continue to work for downstream 
users. An additional overload allows a general function to be passed in, which 
can do arg parsing however it likes, as long as it returns the fields that 
CommonOptionsParser needs.

Many other simple `clang-*` tools can be similarly migrated after this.

>From cdea18b434d09f47343716adaa9af9deee895770 Mon Sep 17 00:00:00 2001
From: Jordan Rupprecht 
Date: Thu, 18 Apr 2024 02:49:01 +
Subject: [PATCH] [clang] Migrate clang-rename to OptTable parsing

Using OptTable to parse will allow including this tool in llvm-driver.

Because CommonOptionsParser is widely used and makes use of `cl::opt`
flags, it needs to be refactored to handle both. The existing
`CommonOptionsParser::create()` method should continue to work
for downstream users. An additional overload allows a general function
to be passed in, which can do arg parsing however it likes,
as long as it returns the fields that CommonOptionsParser needs.

Many other simple `clang-*` tools can be similarly migrated after this.
---
 .../clang/Tooling/CommonOptionsParser.h   |  25 ++-
 .../clang/Tooling/CommonOptionsParser.td  |  14 ++
 clang/lib/Tooling/CommonOptionsParser.cpp | 127 +++-
 clang/tools/clang-rename/CMakeLists.txt   |   7 +
 clang/tools/clang-rename/ClangRename.cpp  | 182 +-
 clang/tools/clang-rename/Opts.td  |  32 +++
 .../llvm-project-overlay/clang/BUILD.bazel|  21 +-
 7 files changed, 304 insertions(+), 104 deletions(-)
 create mode 100644 clang/include/clang/Tooling/CommonOptionsParser.td
 create mode 100644 clang/tools/clang-rename/Opts.td

diff --git a/clang/include/clang/Tooling/CommonOptionsParser.h 
b/clang/include/clang/Tooling/CommonOptionsParser.h
index 3c0480af377943..da1fd299a04836 100644
--- a/clang/include/clang/Tooling/CommonOptionsParser.h
+++ b/clang/include/clang/Tooling/CommonOptionsParser.h
@@ -86,6 +86,24 @@ class CommonOptionsParser {
  llvm::cl::NumOccurrencesFlag OccurrencesFlag = llvm::cl::OneOrMore,
  const char *Overview = nullptr);
 
+  struct Args {
+std::string BuildPath;
+std::vector SourcePaths;
+std::vector ArgsAfter;
+std::vector ArgsBefore;
+  };
+
+  using ArgParserCallback =
+  std::function(int , const char **argv)>;
+
+  /// A factory method that is similar to the above factory method, except
+  /// this does not force use of cl::opt argument parsing. The function passed
+  /// in is expected to handle argument parsing, and must return values needed
+  /// by CommonOptionsParser.
+  static llvm::Expected
+  create(int , const char **argv, ArgParserCallback ArgsCallback,
+ llvm::cl::NumOccurrencesFlag OccurrencesFlag = llvm::cl::OneOrMore);
+
   /// Returns a reference to the loaded compilations database.
   CompilationDatabase () {
 return *Compilations;
@@ -105,10 +123,9 @@ class CommonOptionsParser {
 private:
   CommonOptionsParser() = default;
 
-  llvm::Error init(int , const char **argv,
-   llvm::cl::OptionCategory ,
-   llvm::cl::NumOccurrencesFlag OccurrencesFlag,
-   const char *Overview);
+  llvm::Error
+  init(int , const char **argv, ArgParserCallback ArgsCallback,
+   llvm::cl::NumOccurrencesFlag OccurrencesFlag = llvm::cl::OneOrMore);
 
   std::unique_ptr Compilations;
   std::vector SourcePathList;
diff --git a/clang/include/clang/Tooling/CommonOptionsParser.td 
b/clang/include/clang/Tooling/CommonOptionsParser.td
new file mode 100644
index 00..0e79136a42bcb2
--- /dev/null
+++ b/clang/include/clang/Tooling/CommonOptionsParser.td
@@ -0,0 +1,14 @@
+include "llvm/Option/OptParser.td"
+
+multiclass Eq {
+  def NAME#_EQ : Joined<["--", "-"], name#"=">, HelpText;
+  def : Separate<["--", "-"], name>, Alias(NAME#_EQ)>;
+}
+
+defm build_path : Eq<"p", "Build path.">;
+defm extra_arg
+: Eq<"extra-arg",
+ "Additional argument to append to the compiler command line.">;
+defm extra_arg_before
+: Eq<"extra-arg-before",
+ "Additional argument to prepend to the compiler command line.">;
diff --git a/clang/lib/Tooling/CommonOptionsParser.cpp 
b/clang/lib/Tooling/CommonOptionsParser.cpp
index 59ef47cc0166ef..341a8ab46c50e7 100644
--- a/clang/lib/Tooling/CommonOptionsParser.cpp
+++ b/clang/lib/Tooling/CommonOptionsParser.cpp
@@ -57,13 +57,12 @@ void 
ArgumentsAdjustingCompilations::appendArgumentsAdjuster(
   Adjusters.push_back(std::move(Adjuster));
 }
 
-std::vector ArgumentsAdjustingCompilations::getCompileCommands(
-StringRef FilePath) const {
+std::vector
+ArgumentsAdjustingCompilations::getCompileCommands(StringRef FilePath) const {
  

[clang] Reapply "[Clang][Sema] Fix crash when 'this' is used in a dependent class scope function template specialization that instantiates to a static member function (#87541)" (PR #88311)

2024-04-12 Thread Jordan Rupprecht via cfe-commits

rupprecht wrote:

Still seeing a few more failures, although the original repro is now working.

```c++
struct Base {
int BaseFunc(int x) { return 0; }
int val;
};

template 
struct Foo : Base {
template 
int bar(X x) {
return BaseFunc(val);  // OK
}

template <>
int bar(double x) {
return BaseFunc(0);  // error: call to non-static member function 
without an object argument
}

template <>
int bar(int x) {
return BaseFunc(val);  // error: no matching function for call to 
'BaseFunc'
// note: candidate function not viable: no overload of 'val' matching 
'int' for 1st argument
}
};
```

https://godbolt.org/z/Yn1jbGqW3

We also see a `reference to overloaded function could not be resolved; did you 
mean to call it?`, but I haven't been able to reduce that yet.

https://github.com/llvm/llvm-project/pull/88311
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Flang] responds to Clang Tidy feedback (PR #87847)

2024-04-10 Thread Jordan Rupprecht via cfe-commits

https://github.com/rupprecht approved this pull request.


https://github.com/llvm/llvm-project/pull/87847
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Flang] responds to Clang Tidy feedback (PR #87847)

2024-04-10 Thread Jordan Rupprecht via cfe-commits

https://github.com/rupprecht edited 
https://github.com/llvm/llvm-project/pull/87847
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] responds to Clang Tidy feedback (PR #87847)

2024-04-10 Thread Jordan Rupprecht via cfe-commits

https://github.com/rupprecht edited 
https://github.com/llvm/llvm-project/pull/87847
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][test] Avoid writing to a potentially write-protected dir (PR #88258)

2024-04-10 Thread Jordan Rupprecht via cfe-commits

https://github.com/rupprecht closed 
https://github.com/llvm/llvm-project/pull/88258
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][test] Avoid writing to a potentially write-protected dir (PR #88258)

2024-04-10 Thread Jordan Rupprecht via cfe-commits

https://github.com/rupprecht created 
https://github.com/llvm/llvm-project/pull/88258

This test just checks for the stdout/stderr of clang, but it incidentally tries 
to write to `a.out` in the current directory, which may be write protected. 
Typically one would write `clang -o %t.o` for a writeable dir, but since we 
only care about stdout/stderr, throw away the object file and just write to 
/dev/null instead.

>From b23bfe788d2fba00f8303c54e53507a8fd0bc53b Mon Sep 17 00:00:00 2001
From: Jordan Rupprecht 
Date: Wed, 10 Apr 2024 11:50:04 +
Subject: [PATCH] [clang][test] Avoid writing to a potentially write-protected
 dir

This test just checks for the stdout/stderr of clang, but it incidentally tries 
to write to `a.out` in the current directory, which may be write protected. 
Typically one would write `clang -o %t.o` for a writeable dir, but since we 
only care about stdout/stderr, throw away the object file and just write to 
/dev/null instead.
---
 clang/test/Driver/lld-repro.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/clang/test/Driver/lld-repro.c b/clang/test/Driver/lld-repro.c
index 9457dd334b5b96..61904c0e6df306 100644
--- a/clang/test/Driver/lld-repro.c
+++ b/clang/test/Driver/lld-repro.c
@@ -4,12 +4,12 @@
 // RUN: echo "-nostartfiles -nostdlib -fuse-ld=lld -gen-reproducer=error 
-fcrash-diagnostics-dir=%t" \
 // RUN:   | sed -e 's/\\//g' > %t.rsp
 
-// RUN: not %clang %s @%t.rsp -fcrash-diagnostics=all 2>&1 \
+// RUN: not %clang %s @%t.rsp -fcrash-diagnostics=all -o /dev/null 2>&1 \
 // RUN:   | FileCheck %s
 
 // Test that the reproducer can still be created even when the input source 
cannot be preprocessed
 // again, like when reading from stdin.
-// RUN: not %clang -x c - @%t.rsp -fcrash-diagnostics=all 2>&1 < %s \
+// RUN: not %clang -x c - @%t.rsp -fcrash-diagnostics=all -o /dev/null 2>&1 < 
%s \
 // RUN:   | FileCheck %s
 
 // check that we still get lld's output
@@ -20,9 +20,9 @@
 // CHECK-NEXT: note: diagnostic msg:
 // CHECK: 
 
-// RUN: not %clang %s @%t.rsp -fcrash-diagnostics=compiler 2>&1 \
+// RUN: not %clang %s @%t.rsp -fcrash-diagnostics=compiler -o /dev/null 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=NO-LINKER
-// RUN: not %clang %s @%t.rsp 2>&1 \
+// RUN: not %clang %s @%t.rsp -o /dev/null 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=NO-LINKER
 
 // NO-LINKER-NOT: Preprocessed source(s) and associated run script(s) are 
located at:

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


[clang] [Clang][Sema] Fix crash when 'this' is used in a dependent class scope function template specialization that instantiates to a static member function (PR #87541)

2024-04-09 Thread Jordan Rupprecht via cfe-commits

rupprecht wrote:

This commit appears to regress an example like this:

```c++
template 
struct Foo {
  template 
  int bar(X x) {
return 0;
  }

  template <>
  int bar(int x) {
return bar(5.0);
  }
};

void call() {
  Foo f;
  f.bar(1);
}
```

Used to compile, now results in an error:
```
PR87541.cpp:10:12: error: call to non-static member function without an object 
argument
   10 | return bar(5.0);
  |^~~
PR87541.cpp:16:5: note: in instantiation of function template specialization 
'Foo::bar' requested here
   16 |   f.bar(1);
  | ^
```

Is that intended?

https://github.com/llvm/llvm-project/pull/87541
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [llvm] [bazel] Add clangd as a library support (PR #81556)

2024-03-14 Thread Jordan Rupprecht via cfe-commits

rupprecht wrote:

Thanks! Sorry about the delay, we should get the bzl tree setup for automatic 
assignment to reviewers.

https://github.com/llvm/llvm-project/pull/81556
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [llvm] [bazel] Add clangd as a library support (PR #81556)

2024-03-14 Thread Jordan Rupprecht via cfe-commits

https://github.com/rupprecht closed 
https://github.com/llvm/llvm-project/pull/81556
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [llvm] [bazel] Add clangd as a library support (PR #81556)

2024-03-14 Thread Jordan Rupprecht via cfe-commits

https://github.com/rupprecht approved this pull request.


https://github.com/llvm/llvm-project/pull/81556
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [llvm] Add bazel support for clangd as a library. (PR #81556)

2024-03-14 Thread Jordan Rupprecht via cfe-commits


@@ -0,0 +1,45 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"])
+
+cc_library(
+name = "clangd_library",
+srcs = [
+"JSONTransport.cpp",
+"Protocol.cpp",
+"URI.cpp",
+"index/SymbolID.cpp",
+"support/Logger.cpp",
+"support/Trace.cpp",
+"support/MemoryTree.cpp",
+"support/Context.cpp",
+"support/Cancellation.cpp",
+"support/ThreadCrashReporter.cpp",
+"support/Shutdown.cpp",
+],
+hdrs = [
+"Transport.h",
+"Protocol.h",
+"URI.h",
+"LSPBinder.h",
+"index/SymbolID.h",
+"support/Function.h",
+"support/Cancellation.h",
+"support/ThreadCrashReporter.h",
+"support/Logger.h",
+"support/Trace.h",
+"support/MemoryTree.h",
+"support/Context.h",
+"support/Shutdown.h",
+],

rupprecht wrote:

clangd/CMakeLists.txt lists many other files needed by the clangDaemon target.

I think this is totally fine to submit as-is, as maybe this is the minimal set 
of files that one needs for basic clangd functionality, but we should probably 
have a TODO to pick up other files (e.g. `glob(["*.cpp", "dir/**/*.cpp", 
...])`) for more complete functionality. (I'm not a clangd expert, so I'm not 
sure what the implication of leaving out all those other files is).

https://github.com/llvm/llvm-project/pull/81556
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [llvm] Add bazel support for clangd as a library. (PR #81556)

2024-03-14 Thread Jordan Rupprecht via cfe-commits


@@ -0,0 +1,45 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"])
+
+cc_library(
+name = "clangd_library",

rupprecht wrote:

Small nit: IIUC the convention in the llvm bzl tree is to use casing like 
`ClangDaemon`.

https://github.com/llvm/llvm-project/pull/81556
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang][Sema] Diagnose use of template keyword after declarative nested-name-specifiers (PR #78595)

2024-02-07 Thread Jordan Rupprecht via cfe-commits

rupprecht wrote:

Ok, thanks for the quick confirmation!

https://github.com/llvm/llvm-project/pull/78595
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang][Sema] Diagnose use of template keyword after declarative nested-name-specifiers (PR #78595)

2024-02-07 Thread Jordan Rupprecht via cfe-commits

rupprecht wrote:

It looks like this caused some new `-Wextra-qualification` warnings 
(playground: https://godbolt.org/z/3MbMjGYET)

```
namespace foo {
template 
struct Z {};

template <>
struct Z {}; // OK

template <>
struct foo::Z {}; // New warning: extra qualification on member 'Z' 
[-Wextra-qualification]

template <>
struct ::foo::Z {}; // New warning: extra qualification on member 'Z' 
[-Wextra-qualification]
}  // namespace foo
```

This doesn't use `template` in the way described in the commit or the release 
notes, so it doesn't seem like an intentional change. But GCC already errors on 
this (and downgrades to a warning with `-fpermissive`), so Clang isn't 
necessarily wrong to start warning about this now. Still, it's possible GCC and 
Clang are both wrong now, so I just want to make sure that's actually a desired 
side effect of this commit.

This behavior change is covered by the test diffs here in 
clang/test/CXX/drs/dr23xx.cpp and 
clang/test/SemaTemplate/class-template-spec.cpp.

https://github.com/llvm/llvm-project/pull/78595
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] 96ec447 - [NFC] Fix various unintentional `//namespace` formatting

2024-01-24 Thread Jordan Rupprecht via cfe-commits

Author: Jordan Rupprecht
Date: 2024-01-24T21:17:45-08:00
New Revision: 96ec447a6ae39edff92674e9849de2bf21bfd430

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

LOG: [NFC] Fix various unintentional `//namespace` formatting

Added: 


Modified: 

clang-tools-extra/test/clang-tidy/checkers/abseil/Inputs/absl/external-file.h

clang-tools-extra/test/clang-tidy/checkers/abseil/faster-strsplit-delimiter.cpp

clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp
clang/lib/StaticAnalyzer/Checkers/DebugContainerModeling.cpp
clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp
clang/lib/StaticAnalyzer/Checkers/InvalidatedIteratorChecker.cpp
clang/lib/StaticAnalyzer/Checkers/IteratorRangeChecker.cpp
clang/test/CXX/drs/dr23xx.cpp
clang/test/CXX/over/over.match/over.match.funcs/over.match.oper/p3-2a.cpp
compiler-rt/lib/sanitizer_common/sanitizer_hash.h
llvm/lib/ExecutionEngine/IntelJITEvents/IntelJITEventsWrapper.h

Removed: 




diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/abseil/Inputs/absl/external-file.h 
b/clang-tools-extra/test/clang-tidy/checkers/abseil/Inputs/absl/external-file.h
index 11e2e4aa96c5906..4a57c461f7fa478 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/abseil/Inputs/absl/external-file.h
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/abseil/Inputs/absl/external-file.h
@@ -2,5 +2,5 @@ namespace absl {
 namespace base_internal {
 void InternalFunction() {}
 } // namespace base_internal 
-} //namespace absl
+} // namespace absl
 void DirectAccess2() { absl::base_internal::InternalFunction(); }

diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/abseil/faster-strsplit-delimiter.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/abseil/faster-strsplit-delimiter.cpp
index b5035941c9cebb7..e6787f8083750cb 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/abseil/faster-strsplit-delimiter.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/abseil/faster-strsplit-delimiter.cpp
@@ -14,7 +14,7 @@ struct MaxSplitsImpl {
   MaxSplitsImpl();
   ~MaxSplitsImpl();
 };
-} //namespace strings_internal
+} // namespace strings_internal
 
 template 
 strings_internal::Splitter StrSplit(absl::string_view, Delim) {
@@ -36,7 +36,7 @@ strings_internal::MaxSplitsImpl MaxSplits(Delim, int) {
   return {};
 }
 
-} //namespace absl
+} // namespace absl
 
 void SplitDelimiters() {
   absl::StrSplit("ABC", "A");

diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp
index fbad0b9884b8a9d..9d8f199f6408790 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp
@@ -178,9 +178,9 @@ namespace n47 {
 void foo() {}
 } // namespace n47
 #pragma clang diagnostic pop
-} //namespace n46
+} // namespace n46
 #undef N45_INNER
-} //namespace n45
+} // namespace n45
 // CHECK-FIXES-NORMAL: #define N45_INNER
 // CHECK-FIXES-NORMAL: #pragma clang diagnostic push
 // CHECK-FIXES-NORMAL: namespace n45::n46::n47 {

diff  --git a/clang/lib/StaticAnalyzer/Checkers/DebugContainerModeling.cpp 
b/clang/lib/StaticAnalyzer/Checkers/DebugContainerModeling.cpp
index 97f769b1c451f6e..72186a99d943583 100644
--- a/clang/lib/StaticAnalyzer/Checkers/DebugContainerModeling.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/DebugContainerModeling.cpp
@@ -52,7 +52,7 @@ class DebugContainerModeling
   bool evalCall(const CallEvent , CheckerContext ) const;
 };
 
-} //namespace
+} // namespace
 
 bool DebugContainerModeling::evalCall(const CallEvent ,
   CheckerContext ) const {

diff  --git a/clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp 
b/clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp
index ff479c7b0ac89dc..79ab71d7829db7a 100644
--- a/clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp
@@ -55,7 +55,7 @@ class DebugIteratorModeling
   bool evalCall(const CallEvent , CheckerContext ) const;
 };
 
-} //namespace
+} // namespace
 
 bool DebugIteratorModeling::evalCall(const CallEvent ,
  CheckerContext ) const {

diff  --git a/clang/lib/StaticAnalyzer/Checkers/InvalidatedIteratorChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/InvalidatedIteratorChecker.cpp
index 3f5856a3efbe75e..2e21f619a133e71 100644
--- a/clang/lib/StaticAnalyzer/Checkers/InvalidatedIteratorChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/InvalidatedIteratorChecker.cpp
@@ -47,7 +47,7 @@ class InvalidatedIteratorChecker
 
 };
 
-} 

[clang] 96ec447 - [NFC] Fix various unintentional `//namespace` formatting

2024-01-24 Thread Jordan Rupprecht via cfe-commits

Author: Jordan Rupprecht
Date: 2024-01-24T21:17:45-08:00
New Revision: 96ec447a6ae39edff92674e9849de2bf21bfd430

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

LOG: [NFC] Fix various unintentional `//namespace` formatting

Added: 


Modified: 

clang-tools-extra/test/clang-tidy/checkers/abseil/Inputs/absl/external-file.h

clang-tools-extra/test/clang-tidy/checkers/abseil/faster-strsplit-delimiter.cpp

clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp
clang/lib/StaticAnalyzer/Checkers/DebugContainerModeling.cpp
clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp
clang/lib/StaticAnalyzer/Checkers/InvalidatedIteratorChecker.cpp
clang/lib/StaticAnalyzer/Checkers/IteratorRangeChecker.cpp
clang/test/CXX/drs/dr23xx.cpp
clang/test/CXX/over/over.match/over.match.funcs/over.match.oper/p3-2a.cpp
compiler-rt/lib/sanitizer_common/sanitizer_hash.h
llvm/lib/ExecutionEngine/IntelJITEvents/IntelJITEventsWrapper.h

Removed: 




diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/abseil/Inputs/absl/external-file.h 
b/clang-tools-extra/test/clang-tidy/checkers/abseil/Inputs/absl/external-file.h
index 11e2e4aa96c5906..4a57c461f7fa478 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/abseil/Inputs/absl/external-file.h
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/abseil/Inputs/absl/external-file.h
@@ -2,5 +2,5 @@ namespace absl {
 namespace base_internal {
 void InternalFunction() {}
 } // namespace base_internal 
-} //namespace absl
+} // namespace absl
 void DirectAccess2() { absl::base_internal::InternalFunction(); }

diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/abseil/faster-strsplit-delimiter.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/abseil/faster-strsplit-delimiter.cpp
index b5035941c9cebb7..e6787f8083750cb 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/abseil/faster-strsplit-delimiter.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/abseil/faster-strsplit-delimiter.cpp
@@ -14,7 +14,7 @@ struct MaxSplitsImpl {
   MaxSplitsImpl();
   ~MaxSplitsImpl();
 };
-} //namespace strings_internal
+} // namespace strings_internal
 
 template 
 strings_internal::Splitter StrSplit(absl::string_view, Delim) {
@@ -36,7 +36,7 @@ strings_internal::MaxSplitsImpl MaxSplits(Delim, int) {
   return {};
 }
 
-} //namespace absl
+} // namespace absl
 
 void SplitDelimiters() {
   absl::StrSplit("ABC", "A");

diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp
index fbad0b9884b8a9d..9d8f199f6408790 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp
@@ -178,9 +178,9 @@ namespace n47 {
 void foo() {}
 } // namespace n47
 #pragma clang diagnostic pop
-} //namespace n46
+} // namespace n46
 #undef N45_INNER
-} //namespace n45
+} // namespace n45
 // CHECK-FIXES-NORMAL: #define N45_INNER
 // CHECK-FIXES-NORMAL: #pragma clang diagnostic push
 // CHECK-FIXES-NORMAL: namespace n45::n46::n47 {

diff  --git a/clang/lib/StaticAnalyzer/Checkers/DebugContainerModeling.cpp 
b/clang/lib/StaticAnalyzer/Checkers/DebugContainerModeling.cpp
index 97f769b1c451f6e..72186a99d943583 100644
--- a/clang/lib/StaticAnalyzer/Checkers/DebugContainerModeling.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/DebugContainerModeling.cpp
@@ -52,7 +52,7 @@ class DebugContainerModeling
   bool evalCall(const CallEvent , CheckerContext ) const;
 };
 
-} //namespace
+} // namespace
 
 bool DebugContainerModeling::evalCall(const CallEvent ,
   CheckerContext ) const {

diff  --git a/clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp 
b/clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp
index ff479c7b0ac89dc..79ab71d7829db7a 100644
--- a/clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp
@@ -55,7 +55,7 @@ class DebugIteratorModeling
   bool evalCall(const CallEvent , CheckerContext ) const;
 };
 
-} //namespace
+} // namespace
 
 bool DebugIteratorModeling::evalCall(const CallEvent ,
  CheckerContext ) const {

diff  --git a/clang/lib/StaticAnalyzer/Checkers/InvalidatedIteratorChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/InvalidatedIteratorChecker.cpp
index 3f5856a3efbe75e..2e21f619a133e71 100644
--- a/clang/lib/StaticAnalyzer/Checkers/InvalidatedIteratorChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/InvalidatedIteratorChecker.cpp
@@ -47,7 +47,7 @@ class InvalidatedIteratorChecker
 
 };
 
-} 

[llvm] [clang-tools-extra] [clang] [libc] [mlir] [lldb] [lldb][test] Apply @expectedFailureAll/@skipIf early for debug_info tests (PR #73067)

2024-01-19 Thread Jordan Rupprecht via cfe-commits

https://github.com/rupprecht closed 
https://github.com/llvm/llvm-project/pull/73067
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [lldb] [llvm] [clang] [lldb][test] Apply @expectedFailureAll/@skipIf early for debug_info tests (PR #73067)

2024-01-19 Thread Jordan Rupprecht via cfe-commits

https://github.com/rupprecht updated 
https://github.com/llvm/llvm-project/pull/73067

>From 22bfc5878f1f96b3138a03eea4dc856948185c89 Mon Sep 17 00:00:00 2001
From: Jordan Rupprecht 
Date: Tue, 21 Nov 2023 17:28:30 -0800
Subject: [PATCH 1/2] [lldb][test] Apply @expectedFailureAll/@skipIf early for
 debug_info tests

The @expectedFailureAll and @skipIf decorators will mark the test case as 
xfail/skip if _all_ conditions passed in match, including debug_info.
* If debug_info is not one of the matching conditions, we can immediately 
evaluate the check and decide if it should be decorated.
* If debug_info *is* present as a match condition, we need to defer whether or 
not to decorate until when the `LLDBTestCaseFactory` metaclass expands the test 
case into its potential variants. This is still early enough that the standard 
`unittest` framework will recognize the test as xfail/skip by the time the test 
actually runs.

TestDecorators exhibits the edge cases more thoroughly. With the exception of 
`@expectedFailureIf` (added by this commit), all those test cases pass prior to 
this commit.

This is a followup to 212a60ec37322f853e91e171b305479b1abff2f2.
---
 .../Python/lldbsuite/test/decorators.py   |  53 -
 .../Python/lldbsuite/test/lldbtest.py |  20 
 lldb/test/API/test_utils/TestDecorators.py| 110 +-
 3 files changed, 177 insertions(+), 6 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py 
b/lldb/packages/Python/lldbsuite/test/decorators.py
index bb06a5ee20f2532..2398892b9e14814 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -117,6 +117,21 @@ def expectedFailure(func):
 return unittest2.expectedFailure(func)
 
 
+def expectedFailureIf(condition, bugnumber=None):
+def expectedFailure_impl(func):
+if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+raise Exception("Decorator can only be used to decorate a test 
method")
+
+if condition:
+return expectedFailure(func)
+return func
+
+if callable(bugnumber):
+return expectedFailure_impl(bugnumber)
+else:
+return expectedFailure_impl
+
+
 def expectedFailureIfFn(expected_fn, bugnumber=None):
 def expectedFailure_impl(func):
 if isinstance(func, type) and issubclass(func, unittest2.TestCase):
@@ -178,6 +193,34 @@ def wrapper(*args, **kwargs):
 return skipTestIfFn_impl
 
 
+def _xfailForDebugInfo(expected_fn, bugnumber=None):
+def expectedFailure_impl(func):
+if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+raise Exception("Decorator can only be used to decorate a test 
method")
+
+func.__xfail_for_debug_info_cat_fn__ = expected_fn
+return func
+
+if callable(bugnumber):
+return expectedFailure_impl(bugnumber)
+else:
+return expectedFailure_impl
+
+
+def _skipForDebugInfo(expected_fn, bugnumber=None):
+def skipImpl(func):
+if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+raise Exception("Decorator can only be used to decorate a test 
method")
+
+func.__skip_for_debug_info_cat_fn__ = expected_fn
+return func
+
+if callable(bugnumber):
+return skipImpl(bugnumber)
+else:
+return skipImpl
+
+
 def _decorateTest(
 mode,
 bugnumber=None,
@@ -195,7 +238,7 @@ def _decorateTest(
 dwarf_version=None,
 setting=None,
 ):
-def fn(self):
+def fn(actual_debug_info=None):
 skip_for_os = _match_decorator_property(
 lldbplatform.translate(oslist), lldbplatformutil.getPlatform()
 )
@@ -208,7 +251,7 @@ def fn(self):
 skip_for_arch = _match_decorator_property(
 archs, lldbplatformutil.getArchitecture()
 )
-skip_for_debug_info = _match_decorator_property(debug_info, 
self.getDebugInfo())
+skip_for_debug_info = _match_decorator_property(debug_info, 
actual_debug_info)
 skip_for_triple = _match_decorator_property(
 triple, lldb.selected_platform.GetTriple()
 )
@@ -283,9 +326,13 @@ def fn(self):
 return reason_str
 
 if mode == DecorateMode.Skip:
+if debug_info:
+return _skipForDebugInfo(fn, bugnumber)
 return skipTestIfFn(fn, bugnumber)
 elif mode == DecorateMode.Xfail:
-return expectedFailureIfFn(fn, bugnumber)
+if debug_info:
+return _xfailForDebugInfo(fn, bugnumber)
+return expectedFailureIf(fn(), bugnumber)
 else:
 return None
 
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py 
b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index dc4e322c675dc9d..872866655093d21 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1667,6 +1667,11 @@ def __new__(cls, name, bases, 

[clang] [clang] Substitute alias templates from correct context (PR #75069)

2023-12-14 Thread Jordan Rupprecht via cfe-commits

rupprecht wrote:

Thanks to @MaskRay for handling the revert.

A reduction for the second `typename` breakage looks similar, so may be the 
same underlying issue. But here it is anyway, in case it ends up being a second 
bug in the patch:

```c++
class Foo {};

template 
struct Ptr {};

template 
class Data;

template 
struct Data {
  using Type = int;
  void func();
};

template 
using Alias = Data;

template 
void Alias::func() {
  auto x = Ptr::Type>();
  (void)x;
}
```

Results in:

```c++
:20:16: error: template argument for template type parameter must be a 
type; did you forget 'typename'?
   20 |   auto x = Ptr::Type>();
  |^
  |typename 
```

Live link, until compiler explorer catches up to the revert: 
https://godbolt.org/z/zvT4jzqbv

I'd be happy to just add `typename` in this case if the language says it's 
supposed to be necessary here, but I'd be just as happy to not need to make any 
code changes :)

https://github.com/llvm/llvm-project/pull/75069
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Substitute alias templates from correct context (PR #75069)

2023-12-14 Thread Jordan Rupprecht via cfe-commits

rupprecht wrote:

After this commit, I'm seeing another "out-of-line definition" error for 
`operator=` on the following reduced snippet:

```c++
class Foo {};

template 
struct Stuff;

template 
struct Stuff {
  Stuff& operator=(Stuff&& that);
};

template 
using Alias = Stuff;

template 
Alias& Alias::operator=(Alias&& that) {
  return *this;
}
```

Results in:

```c++
:15:21: error: out-of-line definition of 'operator=' does not match any 
declaration in 'Stuff'
   15 | Alias& Alias::operator=(Alias&& that) {
  | ^~~~
```
Is that error expected?

Live conformance view: https://godbolt.org/z/eanhMEevn

I'm also seeing a separate `template argument for template type parameter must 
be a type; did you forget 'typename'?` error nearby. I could add `typename` to 
appease the compiler, although I'm not sure if it's supposed to be necessary.

https://github.com/llvm/llvm-project/pull/75069
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [lldb] [llvm] [clang] [lldb][test] Apply @expectedFailureAll/@skipIf early for debug_info tests (PR #73067)

2023-12-05 Thread Jordan Rupprecht via cfe-commits

rupprecht wrote:

> Is this a performance optimization or a function al change?

Neither. This should only affect tests, and the set of tests we skip/mark as 
xfail should not change, we just generally know about it earlier in the test 
setup.

https://github.com/llvm/llvm-project/pull/73067
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [llvm] [lldb] [lldb][test] Apply @expectedFailureAll/@skipIf early for debug_info tests (PR #73067)

2023-12-05 Thread Jordan Rupprecht via cfe-commits

rupprecht wrote:

ping :)

https://github.com/llvm/llvm-project/pull/73067
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[llvm] [clang-tools-extra] [clang] [lldb] [lldb][test] Apply @expectedFailureAll/@skipIf early for debug_info tests (PR #73067)

2023-11-28 Thread Jordan Rupprecht via cfe-commits

https://github.com/rupprecht updated 
https://github.com/llvm/llvm-project/pull/73067

>From 22bfc5878f1f96b3138a03eea4dc856948185c89 Mon Sep 17 00:00:00 2001
From: Jordan Rupprecht 
Date: Tue, 21 Nov 2023 17:28:30 -0800
Subject: [PATCH 1/2] [lldb][test] Apply @expectedFailureAll/@skipIf early for
 debug_info tests

The @expectedFailureAll and @skipIf decorators will mark the test case as 
xfail/skip if _all_ conditions passed in match, including debug_info.
* If debug_info is not one of the matching conditions, we can immediately 
evaluate the check and decide if it should be decorated.
* If debug_info *is* present as a match condition, we need to defer whether or 
not to decorate until when the `LLDBTestCaseFactory` metaclass expands the test 
case into its potential variants. This is still early enough that the standard 
`unittest` framework will recognize the test as xfail/skip by the time the test 
actually runs.

TestDecorators exhibits the edge cases more thoroughly. With the exception of 
`@expectedFailureIf` (added by this commit), all those test cases pass prior to 
this commit.

This is a followup to 212a60ec37322f853e91e171b305479b1abff2f2.
---
 .../Python/lldbsuite/test/decorators.py   |  53 -
 .../Python/lldbsuite/test/lldbtest.py |  20 
 lldb/test/API/test_utils/TestDecorators.py| 110 +-
 3 files changed, 177 insertions(+), 6 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py 
b/lldb/packages/Python/lldbsuite/test/decorators.py
index bb06a5ee20f2532..2398892b9e14814 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -117,6 +117,21 @@ def expectedFailure(func):
 return unittest2.expectedFailure(func)
 
 
+def expectedFailureIf(condition, bugnumber=None):
+def expectedFailure_impl(func):
+if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+raise Exception("Decorator can only be used to decorate a test 
method")
+
+if condition:
+return expectedFailure(func)
+return func
+
+if callable(bugnumber):
+return expectedFailure_impl(bugnumber)
+else:
+return expectedFailure_impl
+
+
 def expectedFailureIfFn(expected_fn, bugnumber=None):
 def expectedFailure_impl(func):
 if isinstance(func, type) and issubclass(func, unittest2.TestCase):
@@ -178,6 +193,34 @@ def wrapper(*args, **kwargs):
 return skipTestIfFn_impl
 
 
+def _xfailForDebugInfo(expected_fn, bugnumber=None):
+def expectedFailure_impl(func):
+if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+raise Exception("Decorator can only be used to decorate a test 
method")
+
+func.__xfail_for_debug_info_cat_fn__ = expected_fn
+return func
+
+if callable(bugnumber):
+return expectedFailure_impl(bugnumber)
+else:
+return expectedFailure_impl
+
+
+def _skipForDebugInfo(expected_fn, bugnumber=None):
+def skipImpl(func):
+if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+raise Exception("Decorator can only be used to decorate a test 
method")
+
+func.__skip_for_debug_info_cat_fn__ = expected_fn
+return func
+
+if callable(bugnumber):
+return skipImpl(bugnumber)
+else:
+return skipImpl
+
+
 def _decorateTest(
 mode,
 bugnumber=None,
@@ -195,7 +238,7 @@ def _decorateTest(
 dwarf_version=None,
 setting=None,
 ):
-def fn(self):
+def fn(actual_debug_info=None):
 skip_for_os = _match_decorator_property(
 lldbplatform.translate(oslist), lldbplatformutil.getPlatform()
 )
@@ -208,7 +251,7 @@ def fn(self):
 skip_for_arch = _match_decorator_property(
 archs, lldbplatformutil.getArchitecture()
 )
-skip_for_debug_info = _match_decorator_property(debug_info, 
self.getDebugInfo())
+skip_for_debug_info = _match_decorator_property(debug_info, 
actual_debug_info)
 skip_for_triple = _match_decorator_property(
 triple, lldb.selected_platform.GetTriple()
 )
@@ -283,9 +326,13 @@ def fn(self):
 return reason_str
 
 if mode == DecorateMode.Skip:
+if debug_info:
+return _skipForDebugInfo(fn, bugnumber)
 return skipTestIfFn(fn, bugnumber)
 elif mode == DecorateMode.Xfail:
-return expectedFailureIfFn(fn, bugnumber)
+if debug_info:
+return _xfailForDebugInfo(fn, bugnumber)
+return expectedFailureIf(fn(), bugnumber)
 else:
 return None
 
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py 
b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index dc4e322c675dc9d..872866655093d21 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1667,6 +1667,11 @@ def __new__(cls, name, bases, 

[clang] 8b39527 - [NFC] Wrap entire debug logging loop in LLVM_DEBUG

2023-04-26 Thread Jordan Rupprecht via cfe-commits

Author: Jordan Rupprecht
Date: 2023-04-26T05:28:15-07:00
New Revision: 8b39527535ff50837da08509392e3268fb6129f0

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

LOG: [NFC] Wrap entire debug logging loop in LLVM_DEBUG

Added: 


Modified: 
clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp

Removed: 




diff  --git a/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
index 8340fe4c8270b..4bf8ce13e0572 100644
--- a/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
@@ -173,10 +173,10 @@ const NoteTag *taintOriginTrackerTag(CheckerContext ,
 for (auto Sym : TaintedSymbols) {
   BR.markInteresting(Sym);
 }
-for (auto Arg : TaintedArgs) {
-  LLVM_DEBUG(llvm::dbgs()
- << "Taint Propagated from argument " << Arg + 1 << "\n");
-}
+LLVM_DEBUG(for (auto Arg
+: TaintedArgs) {
+  llvm::dbgs() << "Taint Propagated from argument " << Arg + 1 << "\n";
+});
 return "";
   });
 }



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


[clang] 74ce297 - Revert "[Clang] Implement Change scope of lambda trailing-return-type"

2023-02-03 Thread Jordan Rupprecht via cfe-commits

Author: Jordan Rupprecht
Date: 2023-02-03T08:49:34-08:00
New Revision: 74ce297045bac4bc475b8e762d2a1ea19bb16d3c

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

LOG: Revert "[Clang] Implement Change scope of lambda trailing-return-type"

This reverts commit d708a186b6a9b050d09558163dd353d9f738c82d (and typo fix 
e4bc9898ddbeb70bc49d713bbf863f050f21e03f). It causes a compilation error for 
this:

```
struct StringLiteral {
  template 
  StringLiteral(const char ()[N])
  __attribute__((enable_if(N > 0 && N == __builtin_strlen(array) + 1,
   "invalid string literal")));
};

struct Message {
  Message(StringLiteral);
};

void Func1() {
  auto x = Message("x");  // Note: this is fine

  // Note: "xx\0" to force a different type, StringLiteral<3>, otherwise this
  // successfully builds.
  auto y = [&](decltype(Message("xx"))) {};

  // ^ fails with: repro.cc:18:13: error: reference to local variable 'array'
  // declared in enclosing function 'StringLiteral::StringLiteral<3>'

  (void)x;
  (void)y;
}
```

More details posted to D124351.

Added: 


Modified: 
clang/docs/ReleaseNotes.rst
clang/include/clang/AST/DeclCXX.h
clang/include/clang/Sema/Scope.h
clang/include/clang/Sema/ScopeInfo.h
clang/include/clang/Sema/Sema.h
clang/lib/Parse/ParseExprCXX.cpp
clang/lib/Sema/Scope.cpp
clang/lib/Sema/Sema.cpp
clang/lib/Sema/SemaCXXScopeSpec.cpp
clang/lib/Sema/SemaConcept.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaExprCXX.cpp
clang/lib/Sema/SemaLambda.cpp
clang/lib/Sema/SemaTemplateInstantiate.cpp
clang/lib/Sema/TreeTransform.h
clang/test/CXX/expr/expr.prim/expr.prim.lambda/p11-1y.cpp
clang/test/CXX/expr/expr.prim/expr.prim.lambda/p4.cpp
clang/test/SemaCXX/warn-shadow-in-lambdas.cpp
clang/www/cxx_status.html

Removed: 
clang/test/SemaCXX/lambda-capture-type-deduction.cpp



diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index d2f1919f24a3..4463f0317454 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -130,11 +130,6 @@ C++20 Feature Support
 C++2b Feature Support
 ^
 
-- Implemented `P2036R3: Change scope of lambda trailing-return-type 
`_
-  and `P2579R0 Mitigation strategies for P2036 `_.
-  These proposals modify how variables captured in lambdas can appear in 
trailing return type
-  expressions and how their types are deduced therein, in all C++ language 
versions.
-
 CUDA/HIP Language Changes in Clang
 --
 

diff  --git a/clang/include/clang/AST/DeclCXX.h 
b/clang/include/clang/AST/DeclCXX.h
index ff8f8a1bb12d..11276c77490c 100644
--- a/clang/include/clang/AST/DeclCXX.h
+++ b/clang/include/clang/AST/DeclCXX.h
@@ -1092,11 +1092,6 @@ class CXXRecordDecl : public RecordDecl {
 
   unsigned capture_size() const { return getLambdaData().NumCaptures; }
 
-  const LambdaCapture *getCapture(unsigned I) const {
-assert(isLambda() && I < capture_size() && "invalid index for capture");
-return captures_begin() + I;
-  }
-
   using conversion_iterator = UnresolvedSetIterator;
 
   conversion_iterator conversion_begin() const {
@@ -1831,20 +1826,6 @@ class CXXRecordDecl : public RecordDecl {
 return getLambdaData().MethodTyInfo;
   }
 
-  void setLambdaTypeInfo(TypeSourceInfo *TS) {
-assert(DefinitionData && DefinitionData->IsLambda &&
-   "setting lambda property of non-lambda class");
-auto  = static_cast(*DefinitionData);
-DL.MethodTyInfo = TS;
-  }
-
-  void setLambdaIsGeneric(bool IsGeneric) {
-assert(DefinitionData && DefinitionData->IsLambda &&
-   "setting lambda property of non-lambda class");
-auto  = static_cast(*DefinitionData);
-DL.IsGenericLambda = IsGeneric;
-  }
-
   // Determine whether this type is an Interface Like type for
   // __interface inheritance purposes.
   bool isInterfaceLike() const;

diff  --git a/clang/include/clang/Sema/Scope.h 
b/clang/include/clang/Sema/Scope.h
index 9e81706cd2aa..be5cdb62045b 100644
--- a/clang/include/clang/Sema/Scope.h
+++ b/clang/include/clang/Sema/Scope.h
@@ -145,11 +145,6 @@ class Scope {
 /// This is a scope of some OpenMP directive with
 /// order clause which specifies concurrent
 OpenMPOrderClauseScope = 0x400,
-/// This is the scope for a lambda, after the lambda introducer.
-/// Lambdas need two FunctionPrototypeScope scopes (because there is a
-/// template scope in between), the outer scope does not increase the
-/// depth of recursion.
-LambdaScope = 0x800,
   };
 
 private:

diff  --git a/clang/include/clang/Sema/ScopeInfo.h 
b/clang/include/clang/Sema/ScopeInfo.h
index 

[clang] 3432f4b - [test] Split out Annotations from `TestingSupport`

2023-01-12 Thread Jordan Rupprecht via cfe-commits

Author: Jordan Rupprecht
Date: 2023-01-12T13:40:47-08:00
New Revision: 3432f4bf86e7c77666ae9dede1610ae843dde648

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

LOG: [test] Split out Annotations from `TestingSupport`

The Annotations helper class does not have a gtest or gmock dependency, but 
because it's bundled with the rest of TestingSupport, it gets one. By splitting 
it out, a target can use it without being forced to use LLVM's copy of gtest.

Reviewed By: GMNGeoffrey, sammccall, gribozavr2

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

Added: 
llvm/include/llvm/Testing/Annotations/Annotations.h
llvm/lib/Testing/Annotations/Annotations.cpp
llvm/lib/Testing/Annotations/CMakeLists.txt
llvm/unittests/Testing/Annotations/AnnotationsTest.cpp
llvm/unittests/Testing/Annotations/CMakeLists.txt

Modified: 
clang-tools-extra/clangd/unittests/Annotations.h
clang-tools-extra/clangd/unittests/CMakeLists.txt
clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
clang-tools-extra/clangd/unittests/FindTargetTests.cpp
clang-tools-extra/clangd/unittests/SourceCodeTests.cpp
clang-tools-extra/clangd/unittests/tweaks/TweakTesting.h
clang-tools-extra/include-cleaner/unittests/AnalysisTest.cpp
clang-tools-extra/include-cleaner/unittests/CMakeLists.txt
clang-tools-extra/include-cleaner/unittests/FindHeadersTest.cpp
clang-tools-extra/include-cleaner/unittests/LocateSymbolTest.cpp
clang-tools-extra/include-cleaner/unittests/RecordTest.cpp
clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp
clang-tools-extra/pseudo/unittests/BracketTest.cpp
clang-tools-extra/pseudo/unittests/CMakeLists.txt
clang-tools-extra/unittests/clang-tidy/CMakeLists.txt
clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
clang/docs/tools/clang-formatted-files.txt
clang/unittests/AST/CMakeLists.txt
clang/unittests/AST/DeclTest.cpp
clang/unittests/AST/SourceLocationTest.cpp
clang/unittests/Analysis/FlowSensitive/CMakeLists.txt
clang/unittests/Analysis/FlowSensitive/SignAnalysisTest.cpp
clang/unittests/Analysis/FlowSensitive/SingleVarConstantPropagationTest.cpp
clang/unittests/Analysis/FlowSensitive/TestingSupport.cpp
clang/unittests/Analysis/FlowSensitive/TestingSupport.h
clang/unittests/Analysis/FlowSensitive/TransferBranchTest.cpp
clang/unittests/Sema/CMakeLists.txt
clang/unittests/Sema/CodeCompleteTest.cpp
clang/unittests/Tooling/CMakeLists.txt
clang/unittests/Tooling/SourceCodeTest.cpp
clang/unittests/Tooling/Syntax/CMakeLists.txt
clang/unittests/Tooling/Syntax/TokensTest.cpp
clang/unittests/Tooling/Syntax/TreeTestBase.cpp
clang/unittests/Tooling/Syntax/TreeTestBase.h
llvm/lib/Testing/CMakeLists.txt
llvm/lib/Testing/Support/CMakeLists.txt
llvm/unittests/Support/CMakeLists.txt
llvm/unittests/Testing/CMakeLists.txt
utils/bazel/llvm-project-overlay/clang/unittests/BUILD.bazel
utils/bazel/llvm-project-overlay/llvm/BUILD.bazel

Removed: 
llvm/include/llvm/Testing/Support/Annotations.h
llvm/lib/Testing/Support/Annotations.cpp
llvm/unittests/Support/AnnotationsTest.cpp



diff  --git a/clang-tools-extra/clangd/unittests/Annotations.h 
b/clang-tools-extra/clangd/unittests/Annotations.h
index 60a2d62dda9c3..7cf9c30d8d4bb 100644
--- a/clang-tools-extra/clangd/unittests/Annotations.h
+++ b/clang-tools-extra/clangd/unittests/Annotations.h
@@ -5,7 +5,7 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 
//===--===//
-// A clangd-specific version of llvm/Testing/Support/Annotations.h, replaces
+// A clangd-specific version of llvm/Testing/Annotations/Annotations.h, 
replaces
 // offsets and offset-based ranges with types from the LSP protocol.
 //===-===//
 
@@ -13,7 +13,7 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_UNITTESTS_ANNOTATIONS_H
 
 #include "Protocol.h"
-#include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Annotations/Annotations.h"
 
 namespace clang {
 namespace clangd {

diff  --git a/clang-tools-extra/clangd/unittests/CMakeLists.txt 
b/clang-tools-extra/clangd/unittests/CMakeLists.txt
index af94cc5b270de..7d142529c5a0c 100644
--- a/clang-tools-extra/clangd/unittests/CMakeLists.txt
+++ b/clang-tools-extra/clangd/unittests/CMakeLists.txt
@@ -5,7 +5,12 @@ set(LLVM_LINK_COMPONENTS
   )
 
 if(CLANG_BUILT_STANDALONE)
-  # LLVMTestingSupport library is needed for clangd tests.
+  # LLVMTestingSupport and LLVMTestingAnnotations are needed for clangd tests.
+  if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Annotations
+  AND NOT TARGET 

[clang] 5a06334 - [Format] Capture `FormatStyle` by value to avoid use-after-free.

2022-12-15 Thread Jordan Rupprecht via cfe-commits

Author: Jordan Rupprecht
Date: 2022-12-15T20:38:32-08:00
New Revision: 5a06334c51aa75d7f044785a495cf2de5bf13a9c

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

LOG: [Format] Capture `FormatStyle` by value to avoid use-after-free.

Fixes the test failure in 240e29c5015d246de7fb5e4421aa93042fada59b, reported on 
the D140058 review thread.

Added: 


Modified: 
clang/lib/Format/Format.cpp

Removed: 




diff  --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index c553a5bf2a3e9..77f6892e5d09a 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -3404,7 +3404,7 @@ reformat(const FormatStyle , StringRef Code,
 if (Style.InsertBraces) {
   FormatStyle S = Expanded;
   S.InsertBraces = true;
-  Passes.emplace_back([&](const Environment ) {
+  Passes.emplace_back([&, S](const Environment ) {
 return BracesInserter(Env, S).process(/*SkipAnnotation=*/true);
   });
 }
@@ -3412,7 +3412,7 @@ reformat(const FormatStyle , StringRef Code,
 if (Style.RemoveBracesLLVM) {
   FormatStyle S = Expanded;
   S.RemoveBracesLLVM = true;
-  Passes.emplace_back([&](const Environment ) {
+  Passes.emplace_back([&, S](const Environment ) {
 return BracesRemover(Env, S).process(/*SkipAnnotation=*/true);
   });
 }
@@ -3420,7 +3420,7 @@ reformat(const FormatStyle , StringRef Code,
 if (Style.RemoveSemicolon) {
   FormatStyle S = Expanded;
   S.RemoveSemicolon = true;
-  Passes.emplace_back([&](const Environment ) {
+  Passes.emplace_back([&, S](const Environment ) {
 return SemiRemover(Env, S).process(/*SkipAnnotation=*/true);
   });
 }



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


[clang] fc7b8e7 - [test] Fix dr324.c again for non-writeable source directories

2022-12-12 Thread Jordan Rupprecht via cfe-commits

Author: Jordan Rupprecht
Date: 2022-12-12T10:11:19-08:00
New Revision: fc7b8e71312f89986be1a7cc67377a2decfcf337

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

LOG: [test] Fix dr324.c again for non-writeable source directories

In general, the source tree is not assumed to be writeable, so modifying `%s` 
does not work for all CI systems. Instead of touching `%s`, copy it to a 
writeable dir using `%t`, and touch it there.
Actually, `dr0xx.c` isn't really needed at all, so just create a new `dep.c` 
file in the build tree.

This was recently added in cb088e8c3abf30456e2891f90b5194d0070c387a, fixed in 
1481fcf780bde7b115aa395064d71749b1a40889, and fixed again in 
d16c59013056f1bf8844ded8faeb0cf01b1c3613.

Added: 


Modified: 
clang/test/C/drs/dr324.c

Removed: 




diff  --git a/clang/test/C/drs/dr324.c b/clang/test/C/drs/dr324.c
index 2d75853e5af7c..585041b0365f3 100644
--- a/clang/test/C/drs/dr324.c
+++ b/clang/test/C/drs/dr324.c
@@ -1,9 +1,18 @@
-/* RUN: touch %s
-   RUN: %clang_cc1 -std=c89 -fsyntax-only -fms-extensions -pedantic -verify %s
-   RUN: %clang_cc1 -std=c99 -fsyntax-only -fms-extensions -pedantic -verify %s
-   RUN: %clang_cc1 -std=c11 -fsyntax-only -fms-extensions -pedantic -verify %s
-   RUN: %clang_cc1 -std=c17 -fsyntax-only -fms-extensions -pedantic -verify %s
-   RUN: %clang_cc1 -std=c2x -fsyntax-only -fms-extensions -pedantic -verify %s
+/* RUN: rm -rf %t && mkdir %t
+   RUN: cp %s %t/dr324.c
+
+   Note: this file (dr324.c) must be newer than the file used for the
+ dependency pragma (dep.c), otherwise we get an unrelated "current file is
+ older than dependency" warning. Touch dep.c first to make sure it's
+ always older.
+   RUN: touch %t/dep.c
+   RUN: touch %t/dr324.c
+
+   RUN: %clang_cc1 -std=c89 -fsyntax-only -fms-extensions -pedantic -verify 
%t/dr324.c
+   RUN: %clang_cc1 -std=c99 -fsyntax-only -fms-extensions -pedantic -verify 
%t/dr324.c
+   RUN: %clang_cc1 -std=c11 -fsyntax-only -fms-extensions -pedantic -verify 
%t/dr324.c
+   RUN: %clang_cc1 -std=c17 -fsyntax-only -fms-extensions -pedantic -verify 
%t/dr324.c
+   RUN: %clang_cc1 -std=c2x -fsyntax-only -fms-extensions -pedantic -verify 
%t/dr324.c
  */
 
 /* WG14 DR324: yes
@@ -25,7 +34,7 @@ char lit_char = '\y';   /* expected-warning {{unknown 
escape sequence '\y'}}
 /* This test only makes sense on Windows targets, where the backslash is a 
valid
  * path separator.
  */
-#pragma GCC dependency "oops\..\dr0xx.c"
+#pragma GCC dependency "oops\..\dep.c"
 #endif
 #pragma message("this has a \t tab escape and an invalid \d escape") /* 
expected-warning {{this has a   tab escape and an invalid d escape}}
 
expected-warning {{unknown escape sequence '\d'}}



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


[clang] 493509a - [NFC] DeclCXX: Fix -Wreorder-ctor

2022-01-25 Thread Jordan Rupprecht via cfe-commits

Author: Jordan Rupprecht
Date: 2022-01-25T14:29:35-08:00
New Revision: 493509a40ad1653feb779861badd3ee59fc4a79c

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

LOG: [NFC] DeclCXX: Fix -Wreorder-ctor

>From 8ba9c794feb30cd969b9776c39873def10c51bff

Added: 


Modified: 
clang/lib/AST/DeclCXX.cpp

Removed: 




diff  --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp
index a15498c89d6a1..0cf6e60b2a6c3 100644
--- a/clang/lib/AST/DeclCXX.cpp
+++ b/clang/lib/AST/DeclCXX.cpp
@@ -79,10 +79,9 @@ CXXRecordDecl::DefinitionData::DefinitionData(CXXRecordDecl 
*D)
   HasBasesWithFields(false), HasBasesWithNonStaticDataMembers(false),
   HasPrivateFields(false), HasProtectedFields(false),
   HasPublicFields(false), HasMutableFields(false), 
HasVariantMembers(false),
-  HasOnlyCMembers(true), HasInClassInitializer(false),
+  HasOnlyCMembers(true), HasInitMethod(false), 
HasInClassInitializer(false),
   HasUninitializedReferenceMember(false), HasUninitializedFields(false),
-  HasInheritedConstructor(false),
-  HasInheritedDefaultConstructor(false),
+  HasInheritedConstructor(false), HasInheritedDefaultConstructor(false),
   HasInheritedAssignment(false),
   NeedOverloadResolutionForCopyConstructor(false),
   NeedOverloadResolutionForMoveConstructor(false),
@@ -111,7 +110,7 @@ CXXRecordDecl::DefinitionData::DefinitionData(CXXRecordDecl 
*D)
   HasDeclaredCopyAssignmentWithConstParam(false),
   IsAnyDestructorNoReturn(false), IsLambda(false),
   IsParsingBaseSpecifiers(false), ComputedVisibleConversions(false),
-  HasODRHash(false), Definition(D), HasInitMethod(false) {}
+  HasODRHash(false), Definition(D) {}
 
 CXXBaseSpecifier *CXXRecordDecl::DefinitionData::getBasesSlowCase() const {
   return Bases.get(Definition->getASTContext().getExternalSource());



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


[clang] 1a368ae - [CUDA] fix builtin constraints for PTX 7.2

2021-02-19 Thread Jordan Rupprecht via cfe-commits

Author: Artem Belevich
Date: 2021-02-19T09:57:21-08:00
New Revision: 1a368ae3b78dd7a364e8f17658fddaf86b1e98db

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

LOG: [CUDA] fix builtin constraints for PTX 7.2

This fixes build issues w/ CUDA-11 introduced by https://reviews.llvm.org/D95974

Reviewed By: yaxunl

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

Added: 


Modified: 
clang/include/clang/Basic/BuiltinsNVPTX.def
clang/test/CodeGen/builtins-nvptx-sm_70.cu

Removed: 




diff  --git a/clang/include/clang/Basic/BuiltinsNVPTX.def 
b/clang/include/clang/Basic/BuiltinsNVPTX.def
index 44a5e4ae01c1..b225ddcfa3fa 100644
--- a/clang/include/clang/Basic/BuiltinsNVPTX.def
+++ b/clang/include/clang/Basic/BuiltinsNVPTX.def
@@ -38,7 +38,9 @@
 #pragma push_macro("PTX65")
 #pragma push_macro("PTX70")
 #pragma push_macro("PTX71")
-#define PTX71 "ptx71"
+#pragma push_macro("PTX72")
+#define PTX72 "ptx72"
+#define PTX71 "ptx71|" PTX72
 #define PTX70 "ptx70|" PTX71
 #define PTX65 "ptx65|" PTX70
 #define PTX64 "ptx64|" PTX65
@@ -740,3 +742,4 @@ TARGET_BUILTIN(__imma_m8n8k32_st_c_i32, "vi*iC*UiIi", "", 
AND(SM_75,PTX63))
 #pragma pop_macro("PTX65")
 #pragma pop_macro("PTX70")
 #pragma pop_macro("PTX71")
+#pragma pop_macro("PTX72")

diff  --git a/clang/test/CodeGen/builtins-nvptx-sm_70.cu 
b/clang/test/CodeGen/builtins-nvptx-sm_70.cu
index bd6b2c2b1a49..9de9a70190e2 100644
--- a/clang/test/CodeGen/builtins-nvptx-sm_70.cu
+++ b/clang/test/CodeGen/builtins-nvptx-sm_70.cu
@@ -6,6 +6,11 @@
 // RUN:-fcuda-is-device -target-feature +ptx61 -DPTX61 \
 // RUN:-S -emit-llvm -o - -x cuda %s \
 // RUN:   | FileCheck -check-prefixes=CHECK_M16,CHECK_M32_M8 %s
+// Make sure builtins still work with the latest combination of GPU & PTX.
+// RUN: %clang_cc1 -triple nvptx64-unknown-unknown -target-cpu sm_86 \
+// RUN:-fcuda-is-device -target-feature +ptx72 -DPTX61 \
+// RUN:-S -emit-llvm -o - -x cuda %s \
+// RUN:   | FileCheck -check-prefixes=CHECK_M16,CHECK_M32_M8 %s
 // RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_60 \
 // RUN:   -DPTX61 -fcuda-is-device -S -o /dev/null -x cuda -verify=pre-sm_70 %s
 // RUN: %clang_cc1 -triple nvptx-unknown-unknown \



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


[clang] 60a8a50 - [llvm-objdump] Print file format in lowercase to match GNU output.

2020-02-12 Thread Jordan Rupprecht via cfe-commits

Author: Jordan Rupprecht
Date: 2020-02-12T08:17:01-08:00
New Revision: 60a8a504f16dbbc5f2a6887ecb668ef4cb834949

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

LOG: [llvm-objdump] Print file format in lowercase to match GNU output.

Summary:
GNU objdump prints the file format in lowercase, e.g. `elf64-x86-64`. 
llvm-objdump prints `ELF64-x86-64` right now, even though piping that into 
llvm-objcopy refuses that as a valid arch to use.

As an example of a problem this causes, see: 
https://github.com/ClangBuiltLinux/linux/issues/779

Reviewers: MaskRay, jhenderson, alexshap

Reviewed By: MaskRay

Subscribers: tpimh, sbc100, grimar, jvesely, nhaehnle, kerbowa, cfe-commits, 
llvm-commits

Tags: #clang, #llvm

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

Added: 


Modified: 
clang/test/Modules/pch_container.m
lld/test/COFF/savetemps.ll
llvm/test/CodeGen/AArch64/arm64-simplest-elf.ll
llvm/test/CodeGen/ARM/Windows/trivial-gnu-object.ll
llvm/test/CodeGen/BPF/reloc-btf-2.ll
llvm/test/CodeGen/BPF/reloc-btf.ll
llvm/test/CodeGen/BPF/reloc.ll
llvm/test/Object/AMDGPU/objdump.s
llvm/test/Object/X86/objdump-disassembly-inline-relocations.test
llvm/test/Object/X86/objdump-label.test
llvm/test/Object/X86/objdump-trivial-object.test
llvm/test/Object/dynamic-reloc.test
llvm/test/Object/objdump-symbol-table.test
llvm/test/tools/llvm-objdump/X86/disassemble-section-name.s
llvm/test/tools/llvm-objdump/X86/elf-disassemble-symbol-labels-exec.test
llvm/test/tools/llvm-objdump/X86/elf-dynamic-relocs.test
llvm/test/tools/llvm-objdump/X86/output-ordering.test
llvm/test/tools/llvm-objdump/X86/warn-missing-disasm-func.test
llvm/test/tools/llvm-objdump/all-headers.test
llvm/test/tools/llvm-objdump/archive-headers.test
llvm/test/tools/llvm-objdump/file-headers-coff.test
llvm/test/tools/llvm-objdump/file-headers-elf.test
llvm/test/tools/llvm-objdump/non-archive-object.test
llvm/test/tools/llvm-objdump/relocations-in-nonreloc.test
llvm/tools/llvm-objdump/llvm-objdump.cpp

Removed: 




diff  --git a/clang/test/Modules/pch_container.m 
b/clang/test/Modules/pch_container.m
index 77cd5f352bc9..ed13baf2d26c 100644
--- a/clang/test/Modules/pch_container.m
+++ b/clang/test/Modules/pch_container.m
@@ -8,11 +8,11 @@
 
 
 // RUN: llvm-objdump --section-headers %t-MachO/DependsOnModule.pcm 
%t-ELF/DependsOnModule.pcm %t-COFF/DependsOnModule.pcm | FileCheck %s
-// CHECK: file format Mach-O 64-bit x86-64
+// CHECK: file format mach-o 64-bit x86-64
 // CHECK: __clangast   {{[0-9a-f]+}} {{[0-9a-f]+}} DATA
-// CHECK: file format ELF64-x86-64
+// CHECK: file format elf64-x86-64
 // CHECK: __clangast   {{[0-9a-f]+}} {{[0-9a-f]+}} DATA
-// CHECK: file format COFF-x86-64
+// CHECK: file format coff-x86-64
 // CHECK: clangast   {{[0-9a-f]+}} {{[0-9a-f]+}}
 
 // RUN: not llvm-objdump --section-headers %t-raw/DependsOnModule.pcm

diff  --git a/lld/test/COFF/savetemps.ll b/lld/test/COFF/savetemps.ll
index e755ba9920d3..46a4958d2f78 100644
--- a/lld/test/COFF/savetemps.ll
+++ b/lld/test/COFF/savetemps.ll
@@ -19,7 +19,7 @@
 ; RUN: FileCheck --check-prefix=CHECK-OBJDUMP %s
 
 ; CHECK: define i32 @main()
-; CHECK-OBJDUMP: file format COFF
+; CHECK-OBJDUMP: file format coff
 
 target datalayout = 
"e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-pc-windows-msvc"

diff  --git a/llvm/test/CodeGen/AArch64/arm64-simplest-elf.ll 
b/llvm/test/CodeGen/AArch64/arm64-simplest-elf.ll
index 1254365b8205..58691f8ffcd2 100644
--- a/llvm/test/CodeGen/AArch64/arm64-simplest-elf.ll
+++ b/llvm/test/CodeGen/AArch64/arm64-simplest-elf.ll
@@ -11,7 +11,7 @@ define void @foo() nounwind {
 
   ; Similarly make sure ELF output works and is vaguely sane: aarch64 target
   ; machine with correct section & symbol names.
-; CHECK-ELF: file format ELF64-aarch64
+; CHECK-ELF: file format elf64-aarch64
 
 ; CHECK-ELF: Disassembly of section .text
 ; CHECK-ELF-LABEL: foo:

diff  --git a/llvm/test/CodeGen/ARM/Windows/trivial-gnu-object.ll 
b/llvm/test/CodeGen/ARM/Windows/trivial-gnu-object.ll
index a242f39601cb..2d55f218ddce 100644
--- a/llvm/test/CodeGen/ARM/Windows/trivial-gnu-object.ll
+++ b/llvm/test/CodeGen/ARM/Windows/trivial-gnu-object.ll
@@ -2,7 +2,7 @@
 ; RUN: llc -mtriple=thumbv7-windows-gnu -filetype=obj -o - %s | llvm-objdump 
-d - | FileCheck %s
 
 define void @foo() {
-; CHECK: file format COFF-ARM
+; CHECK: file format coff-arm
 
 ; CHECK-LABEL: foo:
 ; CHECK: bx lr

diff  --git a/llvm/test/CodeGen/BPF/reloc-btf-2.ll 
b/llvm/test/CodeGen/BPF/reloc-btf-2.ll
index 2afeb24bae48..68f00081d7d7 100644
--- a/llvm/test/CodeGen/BPF/reloc-btf-2.ll
+++ b/llvm/test/CodeGen/BPF/reloc-btf-2.ll
@@ -21,7 +21,7 

[clang] fafddbd - Revert "[Clang][Driver] Remove -M group options ..." and "[Clang] Avoid crashing when generating crash diagnostics when '#pragma clang __debug ..."

2020-02-06 Thread Jordan Rupprecht via cfe-commits

Author: Jordan Rupprecht
Date: 2020-02-06T17:59:15-08:00
New Revision: fafddbd956dbe439787f6d717c247e648bb07ff5

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

LOG: Revert "[Clang][Driver] Remove -M group options ..." and "[Clang] Avoid 
crashing when generating crash diagnostics when '#pragma clang __debug ..."

This reverts commits f41ec709d9d388dc43469e6ac7f51b6313f7e4af and 
5fedc2b410853a6aef05e8edf19ebfc4e071e28f. On some buildbots, Clang :: 
Driver/crash-report.c is broken with:

```
Command Output (stderr):
--
/home/buildslave/ps4-buildslave1/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/crash-report.c:48:11:
 error: CHECK: expected string not found in input
// CHECK: Preprocessed source(s) and associated run script(s) are located at:
  ^
:1:1: note: scanning from here
/home/buildslave/ps4-buildslave1/clang-with-thin-lto-ubuntu/llvm-project/clang/test/Driver/crash-report.c:50:1:
 error: unknown type name 'BAZ'
```

Example: 
http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/21321/steps/test-stage1-compiler/logs/stdio

Added: 


Modified: 
clang/include/clang/Driver/CC1Options.td
clang/include/clang/Lex/PreprocessorOptions.h
clang/lib/Driver/Compilation.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/lib/Lex/Pragma.cpp
clang/test/Driver/crash-report.c
clang/test/Driver/output-file-cleanup.c

Removed: 




diff  --git a/clang/include/clang/Driver/CC1Options.td 
b/clang/include/clang/Driver/CC1Options.td
index 733a1080be52..0d0b05f8961c 100644
--- a/clang/include/clang/Driver/CC1Options.td
+++ b/clang/include/clang/Driver/CC1Options.td
@@ -866,8 +866,6 @@ def detailed_preprocessing_record : Flag<["-"], 
"detailed-preprocessing-record">
   HelpText<"include a detailed record of preprocessing actions">;
 def setup_static_analyzer : Flag<["-"], "setup-static-analyzer">,
   HelpText<"Set up preprocessor for static analyzer (done automatically when 
static analyzer is run).">;
-def disable_pragma_debug_crash : Flag<["-"], "disable-pragma-debug-crash">,
-  HelpText<"Disable any #pragma clang __debug that can lead to crashing 
behavior. This is meant for testing.">;
 
 
//===--===//
 // OpenCL Options

diff  --git a/clang/include/clang/Lex/PreprocessorOptions.h 
b/clang/include/clang/Lex/PreprocessorOptions.h
index c551f87e0d7b..c281cd51e266 100644
--- a/clang/include/clang/Lex/PreprocessorOptions.h
+++ b/clang/include/clang/Lex/PreprocessorOptions.h
@@ -189,9 +189,6 @@ class PreprocessorOptions {
   /// Set up preprocessor for RunAnalysis action.
   bool SetUpStaticAnalyzer = false;
 
-  /// Prevents intended crashes when using #pragma clang __debug. For testing.
-  bool DisablePragmaDebugCrash = false;
-
 public:
   PreprocessorOptions() : PrecompiledPreambleBytes(0, false) {}
 

diff  --git a/clang/lib/Driver/Compilation.cpp 
b/clang/lib/Driver/Compilation.cpp
index 52477576b2eb..25aec3690f21 100644
--- a/clang/lib/Driver/Compilation.cpp
+++ b/clang/lib/Driver/Compilation.cpp
@@ -258,23 +258,14 @@ void Compilation::initCompilationForDiagnostics() {
 
   // Remove any user specified output.  Claim any unclaimed arguments, so as
   // to avoid emitting warnings about unused args.
-  OptSpecifier OutputOpts[] = {
-  options::OPT_o,  options::OPT_MD, options::OPT_MMD, options::OPT_M,
-  options::OPT_MM, options::OPT_MF, options::OPT_MG,  options::OPT_MJ,
-  options::OPT_MQ, options::OPT_MT, options::OPT_MV};
+  OptSpecifier OutputOpts[] = { options::OPT_o, options::OPT_MD,
+options::OPT_MMD };
   for (unsigned i = 0, e = llvm::array_lengthof(OutputOpts); i != e; ++i) {
 if (TranslatedArgs->hasArg(OutputOpts[i]))
   TranslatedArgs->eraseArg(OutputOpts[i]);
   }
   TranslatedArgs->ClaimAllArgs();
 
-  // Force re-creation of the toolchain Args, otherwise our modifications just
-  // above will have no effect.
-  for (auto Arg : TCArgs)
-if (Arg.second != TranslatedArgs)
-  delete Arg.second;
-  TCArgs.clear();
-
   // Redirect stdout/stderr to /dev/null.
   Redirects = {None, {""}, {""}};
 

diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 9e2279e90b7e..65039ac64b5a 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -4750,11 +4750,6 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
  : "-");
   }
 
-  // Give the gen diagnostics more chances to succeed, by avoiding intentional
-  // crashes.
-  if (D.CCGenDiagnostics)
-CmdArgs.push_back("-disable-pragma-debug-crash");
-
   bool 

[clang] 553a727 - [clang] Remove -Wexperimental-float-control.

2019-12-18 Thread Jordan Rupprecht via cfe-commits

Author: Jordan Rupprecht
Date: 2019-12-18T16:51:55-08:00
New Revision: 553a727f5f6407fb6db7ac2dae5f5b2a536d38fc

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

LOG: [clang] Remove -Wexperimental-float-control.

Summary: Per D62731, the behavior of clang with `-frounding-math` is no worse 
than when the rounding flag was completely ignored, so remove this unnecessary 
warning.

Reviewers: mibintc, chandlerc, echristo, rjmccall, kpn, erichkeane, rsmith, 
andrew.w.kaylor

Reviewed By: mibintc

Subscribers: merge_guards_bot, cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/include/clang/Basic/DiagnosticGroups.td
clang/lib/Driver/ToolChains/Clang.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td 
b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index 67faa872e57c..39242c972ea2 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -441,10 +441,6 @@ def warn_drv_experimental_isel_incomplete_opt : Warning<
   "-fexperimental-isel support is incomplete for this architecture at the 
current optimization level">,
   InGroup;
 
-def warn_drv_experimental_fp_control_incomplete_opt : Warning<
-  "Support for floating point control option %0 is incomplete and 
experimental">,
-  InGroup;
-
 def warn_drv_moutline_unsupported_opt : Warning<
   "The '%0' architecture does not support -moutline; flag ignored">,
   InGroup;

diff  --git a/clang/include/clang/Basic/DiagnosticGroups.td 
b/clang/include/clang/Basic/DiagnosticGroups.td
index 8aa93d4138a2..5b2183531a44 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -1137,9 +1137,6 @@ def SpirCompat : DiagGroup<"spir-compat">;
 // Warning for the experimental-isel options.
 def ExperimentalISel : DiagGroup<"experimental-isel">;
 
-// Warning for the experimental float control options.
-def ExperimentalFloatControl : DiagGroup<"experimental-float-control">;
-
 // A warning group specifically for warnings related to function
 // multiversioning.
 def FunctionMultiVersioning : DiagGroup<"function-multiversion">;

diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 5c7572fb12be..3dbe78c5b10f 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -2440,15 +2440,7 @@ static void RenderFloatingPointOptions(const ToolChain 
, const Driver ,
 switch (optID) {
 default:
   break;
-case options::OPT_frounding_math:
-case options::OPT_ftrapping_math:
-case options::OPT_ffp_exception_behavior_EQ:
-  D.Diag(clang::diag::warn_drv_experimental_fp_control_incomplete_opt)
-  << A->getOption().getName();
-  break;
 case options::OPT_ffp_model_EQ: {
-  D.Diag(clang::diag::warn_drv_experimental_fp_control_incomplete_opt)
-  << A->getOption().getName();
   // If -ffp-model= is seen, reset to fno-fast-math
   HonorINFs = true;
   HonorNaNs = true;



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


Re: r374288 - Recommit "[Clang] Pragma vectorize_width() implies vectorize(enable)"

2019-10-24 Thread Jordan Rupprecht via cfe-commits
Reverted in 6d424a161bf3e52730371da0b9439ed93a8ce406 due to the issue
described here. Should hopefully be a trivial fix forward.

On Tue, Oct 22, 2019 at 2:46 PM Michael Kruse 
wrote:

> Am Mo., 21. Okt. 2019 um 23:44 Uhr schrieb Jordan Rupprecht
> :
> > At any rate, it sounds like this is not a codegen bug at all, but just
> an over-eager warning?
>
> That interpretation is different from mine. Codgen emits the following
> from vectorize(disable)
>
> !4 = !{!"llvm.loop.vectorize.enable", i1 true}
>
> which is is not what I'd expect.
>
> Michael
>


smime.p7s
Description: S/MIME Cryptographic Signature
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 6d424a1 - Revert "Recommit "[Clang] Pragma vectorize_width() implies vectorize(enable)""

2019-10-24 Thread Jordan Rupprecht via cfe-commits

Author: Jordan Rupprecht
Date: 2019-10-24T16:35:45-07:00
New Revision: 6d424a161bf3e52730371da0b9439ed93a8ce406

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

LOG: Revert "Recommit "[Clang] Pragma vectorize_width() implies 
vectorize(enable)""

This reverts commit 80371c74ae63d2f260bcc75408be9c6f81e38465.

Given the following source:
```
void a() {
  for (;;)
;
}
```

It incorrectly enables vectorization (with vector width 1), as well as 
generating a warning that vectorization could not be performed.

Added: 


Modified: 
clang/lib/CodeGen/CGLoopInfo.cpp
clang/test/CodeGenCXX/pragma-loop-predicate.cpp
clang/test/CodeGenCXX/pragma-loop.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGLoopInfo.cpp 
b/clang/lib/CodeGen/CGLoopInfo.cpp
index c21d4feee7a8..6822c6286fef 100644
--- a/clang/lib/CodeGen/CGLoopInfo.cpp
+++ b/clang/lib/CodeGen/CGLoopInfo.cpp
@@ -270,14 +270,6 @@ LoopInfo::createLoopVectorizeMetadata(const LoopAttributes 
,
 
   // Setting vectorize.width
   if (Attrs.VectorizeWidth > 0) {
-// This implies vectorize.enable = true, but only add it when it is not
-// already enabled.
-if (Attrs.VectorizeEnable != LoopAttributes::Enable)
-  Args.push_back(
-  MDNode::get(Ctx, {MDString::get(Ctx, "llvm.loop.vectorize.enable"),
-ConstantAsMetadata::get(ConstantInt::get(
-llvm::Type::getInt1Ty(Ctx), 1))}));
-
 Metadata *Vals[] = {
 MDString::get(Ctx, "llvm.loop.vectorize.width"),
 ConstantAsMetadata::get(ConstantInt::get(llvm::Type::getInt32Ty(Ctx),

diff  --git a/clang/test/CodeGenCXX/pragma-loop-predicate.cpp 
b/clang/test/CodeGenCXX/pragma-loop-predicate.cpp
index 33e4cf5df4f4..ec2161d1772e 100644
--- a/clang/test/CodeGenCXX/pragma-loop-predicate.cpp
+++ b/clang/test/CodeGenCXX/pragma-loop-predicate.cpp
@@ -58,6 +58,7 @@ void test5(int *List, int Length) {
 List[i] = i * 2;
 }
 
+
 // CHECK:  ![[LOOP0]] = distinct !{![[LOOP0]], !3}
 // CHECK-NEXT: !3 = !{!"llvm.loop.vectorize.enable", i1 true}
 
@@ -69,7 +70,7 @@ void test5(int *List, int Length) {
 
 // CHECK-NEXT: ![[LOOP3]] = distinct !{![[LOOP3]], !5, !3}
 
-// CHECK-NEXT: ![[LOOP4]] = distinct !{![[LOOP4]], !3, !10}
+// CHECK-NEXT: ![[LOOP4]] = distinct !{![[LOOP4]], !10}
 // CHECK-NEXT: !10 = !{!"llvm.loop.vectorize.width", i32 1}
 
-// CHECK-NEXT: ![[LOOP5]] = distinct !{![[LOOP5]], !3, !10}
+// CHECK-NEXT: ![[LOOP5]] = distinct !{![[LOOP5]], !10}

diff  --git a/clang/test/CodeGenCXX/pragma-loop.cpp 
b/clang/test/CodeGenCXX/pragma-loop.cpp
index 6b44dff4030e..32075f965cd7 100644
--- a/clang/test/CodeGenCXX/pragma-loop.cpp
+++ b/clang/test/CodeGenCXX/pragma-loop.cpp
@@ -158,41 +158,23 @@ void template_test(double *List, int Length) {
   for_template_constant_expression_test(List, Length);
 }
 
-void vec_width_1(int *List, int Length) {
-// CHECK-LABEL: @{{.*}}vec_width_1{{.*}}(
-// CHECK: br label {{.*}}, !llvm.loop ![[LOOP_15:.*]]
-
-  #pragma clang loop vectorize(enable) vectorize_width(1)
-  for (int i = 0; i < Length; i++)
-List[i] = i * 2;
-}
-
-void width_1(int *List, int Length) {
-// CHECK-LABEL: @{{.*}}width_1{{.*}}(
-// CHECK: br label {{.*}}, !llvm.loop ![[LOOP_16:.*]]
-
-  #pragma clang loop vectorize_width(1)
-  for (int i = 0; i < Length; i++)
-List[i] = i * 2;
-}
-
 // CHECK: ![[LOOP_1]] = distinct !{![[LOOP_1]], ![[UNROLL_FULL:.*]]}
 // CHECK: ![[UNROLL_FULL]] = !{!"llvm.loop.unroll.full"}
 
-// CHECK: ![[LOOP_2]] = distinct !{![[LOOP_2]], ![[UNROLL_DISABLE:.*]], 
![[DISTRIBUTE_DISABLE:.*]], ![[VECTORIZE_ENABLE:.*]], ![[WIDTH_8:.*]], 
![[INTERLEAVE_4:.*]]}
+// CHECK: ![[LOOP_2]] = distinct !{![[LOOP_2]], ![[UNROLL_DISABLE:.*]], 
![[DISTRIBUTE_DISABLE:.*]], ![[WIDTH_8:.*]], ![[INTERLEAVE_4:.*]]}
 // CHECK: ![[UNROLL_DISABLE]] = !{!"llvm.loop.unroll.disable"}
 // CHECK: ![[DISTRIBUTE_DISABLE]] = !{!"llvm.loop.distribute.enable", i1 false}
-// CHECK: ![[VECTORIZE_ENABLE]] = !{!"llvm.loop.vectorize.enable", i1 true}
 // CHECK: ![[WIDTH_8]] = !{!"llvm.loop.vectorize.width", i32 8}
 // CHECK: ![[INTERLEAVE_4]] = !{!"llvm.loop.interleave.count", i32 4}
 
-// CHECK: ![[LOOP_3]] = distinct !{![[LOOP_3]], ![[INTERLEAVE_4:.*]], 
![[VECTORIZE_ENABLE]], ![[FOLLOWUP_VECTOR_3:.*]]}
+// CHECK: ![[LOOP_3]] = distinct !{![[LOOP_3]], ![[INTERLEAVE_4:.*]], 
![[INTENABLE_1:.*]], ![[FOLLOWUP_VECTOR_3:.*]]}
+// CHECK: ![[INTENABLE_1]] = !{!"llvm.loop.vectorize.enable", i1 true}
 // CHECK: ![[FOLLOWUP_VECTOR_3]] = !{!"llvm.loop.vectorize.followup_all", 
![[AFTER_VECTOR_3:.*]]}
 // CHECK: ![[AFTER_VECTOR_3]] = distinct !{![[AFTER_VECTOR_3]], 
![[ISVECTORIZED:.*]], ![[UNROLL_8:.*]]}
 // CHECK: ![[ISVECTORIZED]] = !{!"llvm.loop.isvectorized"}
 // CHECK: ![[UNROLL_8]] = 

Re: r374288 - Recommit "[Clang] Pragma vectorize_width() implies vectorize(enable)"

2019-10-21 Thread Jordan Rupprecht via cfe-commits
On Mon, Oct 21, 2019 at 5:12 PM Michael Kruse 
wrote:

> Am Mo., 21. Okt. 2019 um 16:01 Uhr schrieb Jordan Rupprecht via
> cfe-commits :
> > There's also a curious failure caused by this patch (confirmed passing
> @r374287, failing @r374288):
>
> It's a warning, not a failure.
>
True. We build with -Werror.

At any rate, it sounds like this is not a codegen bug at all, but just an
over-eager warning? If so, I'll double check the IR of the internal repro
isn't affected by this patch when -Wno-pass-failed, and use that as a
temporary measure until the eager warning can be removed.


>
> > $ cat /tmp/vectorize.cc
> > void a() {
> > #pragma clang loop vectorize(disable)
> >   for (;;)
> > ;
> > }
> >
> > $ clang++ -Werror -O3 -c /tmp/vectorize.cc
> > /tmp/vectorize.cc:1:6: error: loop not interleaved: the optimizer was
> unable to perform the requested transformation; the transformation might be
> disabled or specified as part of an unsupported transformation ordering
> [-Werror,-Wpass-failed=transform-warning]
> > void a() {
> >
> > I don't understand this warning -- there is no requested transformation;
> in fact, we've explicitly specified that vectorization *should* be disabled.
>
> https://reviews.llvm.org/D66290
>
> generates the following metadata for #pragma clang loop vectorize(disable):
>
> !3 = distinct !{!3, !4, !5}
> !4 = !{!"llvm.loop.vectorize.enable", i1 true}
> !5 = !{!"llvm.loop.vectorize.width", i32 1}
>
> which is interpreted as "enable LoopVectorize, but only the interleave
> part" by LoopVectorize and WarnMissedTransformations.
>
> The tests in D66290 missed that because the regex may matche multiple
> MDNodes:
>
> // CHECK: ![[LOOP_5]] = distinct !{![[LOOP_5]],
> ![[UNROLL_DISABLE:.*]], ![[DISTRIBUTE_DISABLE:.*]], ![[WIDTH_1:.*]]}
>
> The additional "llvm.loop.vectorize.enable" is generated by:
>
>   if (Attrs.VectorizeWidth > 0) {
> // This implies vectorize.enable = true, but only add it when it is not
> // already enabled.
> if (Attrs.VectorizeEnable != LoopAttributes::Enable)
>
> Attr.VectorizeWidth is set by the vectorize(disable) LoopHint:
>
> case LoopHintAttr::Disable:
>   switch (Option) {
>   case LoopHintAttr::Vectorize:
> // Disable vectorization by specifying a width of 1.
> setVectorizeWidth(1);
>
Might setVectorizeWidth(0) (or -1, or llvm::Optional) be a better
signal of "vectorization is disabled" than 1 (which could later be
interpreted as "we failed to vectorize when requested")?

(No familiarity with this code, not sure if this suggestion makes sense)


>
>
>
> Michael
>


smime.p7s
Description: S/MIME Cryptographic Signature
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r374288 - Recommit "[Clang] Pragma vectorize_width() implies vectorize(enable)"

2019-10-21 Thread Jordan Rupprecht via cfe-commits
There's also a curious failure caused by this patch (confirmed
passing @r374287, failing @r374288):

$ cat /tmp/vectorize.cc
void a() {
#pragma clang loop vectorize(disable)
  for (;;)
;
}

$ clang++ -Werror -O3 -c /tmp/vectorize.cc
/tmp/vectorize.cc:1:6: error: loop not interleaved: the optimizer was
unable to perform the requested transformation; the transformation might be
disabled or specified as part of an unsupported transformation ordering
[-Werror,-Wpass-failed=transform-warning]
void a() {

I don't understand this warning -- there is no requested transformation; in
fact, we've explicitly specified that vectorization *should* be disabled.

On Mon, Oct 21, 2019 at 9:18 AM Hans Wennborg via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> As expected, this broke the Chromium build again (but it seems only at
> -Oz this time).
>
> I'm still not a big fan of the warning: the #pragma tells the compiler
> to vectorize, and then vectorization doesn't happen -- that sounds
> like a compiler bug to me, and instead of pushing the problem on the
> developer, I wish that could have been fixed before this landed.
>
> We'll probably fix our build by removing the use of the pragma, but
> for others who will be broken by this, I think it would be good to
> have a release note about the change in behaviour (even though it was
> always the intended behaviour), and especially how developers are
> supposed to deal with it.
>
> Thanks,
> hans
>
> On Thu, Oct 10, 2019 at 1:24 AM Sjoerd Meijer via cfe-commits
>  wrote:
> >
> > Author: sjoerdmeijer
> > Date: Thu Oct 10 01:27:14 2019
> > New Revision: 374288
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=374288=rev
> > Log:
> > Recommit "[Clang] Pragma vectorize_width() implies vectorize(enable)"
> >
> > This was further discussed at the llvm dev list:
> >
> > http://lists.llvm.org/pipermail/llvm-dev/2019-October/135602.html
> >
> > I think the brief summary of that is that this change is an improvement,
> > this is the behaviour that we expect and promise in ours docs, and also
> > as a result there are cases where we now emit diagnostics whereas before
> > pragmas were silently ignored. Two areas where we can improve: 1) the
> > diagnostic message itself, and 2) and in some cases (e.g. -Os and -Oz)
> > the vectoriser is (quite understandably) not triggering.
> >
> > Original commit message:
> >
> > Specifying the vectorization width was supposed to implicitly enable
> > vectorization, except that it wasn't really doing this. It was only
> > setting the vectorize.width metadata, but not vectorize.enable.
> >
> > This should fix PR27643.
> >
> > Modified:
> > cfe/trunk/lib/CodeGen/CGLoopInfo.cpp
> > cfe/trunk/test/CodeGenCXX/pragma-loop-predicate.cpp
> > cfe/trunk/test/CodeGenCXX/pragma-loop.cpp
> >
> > Modified: cfe/trunk/lib/CodeGen/CGLoopInfo.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGLoopInfo.cpp?rev=374288=374287=374288=diff
> >
> ==
> > --- cfe/trunk/lib/CodeGen/CGLoopInfo.cpp (original)
> > +++ cfe/trunk/lib/CodeGen/CGLoopInfo.cpp Thu Oct 10 01:27:14 2019
> > @@ -270,6 +270,14 @@ LoopInfo::createLoopVectorizeMetadata(co
> >
> >// Setting vectorize.width
> >if (Attrs.VectorizeWidth > 0) {
> > +// This implies vectorize.enable = true, but only add it when it is
> not
> > +// already enabled.
> > +if (Attrs.VectorizeEnable != LoopAttributes::Enable)
> > +  Args.push_back(
> > +  MDNode::get(Ctx, {MDString::get(Ctx,
> "llvm.loop.vectorize.enable"),
> > +ConstantAsMetadata::get(ConstantInt::get(
> > +llvm::Type::getInt1Ty(Ctx), 1))}));
> > +
> >  Metadata *Vals[] = {
> >  MDString::get(Ctx, "llvm.loop.vectorize.width"),
> >
> ConstantAsMetadata::get(ConstantInt::get(llvm::Type::getInt32Ty(Ctx),
> >
> > Modified: cfe/trunk/test/CodeGenCXX/pragma-loop-predicate.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/pragma-loop-predicate.cpp?rev=374288=374287=374288=diff
> >
> ==
> > --- cfe/trunk/test/CodeGenCXX/pragma-loop-predicate.cpp (original)
> > +++ cfe/trunk/test/CodeGenCXX/pragma-loop-predicate.cpp Thu Oct 10
> 01:27:14 2019
> > @@ -58,7 +58,6 @@ void test5(int *List, int Length) {
> >  List[i] = i * 2;
> >  }
> >
> > -
> >  // CHECK:  ![[LOOP0]] = distinct !{![[LOOP0]], !3}
> >  // CHECK-NEXT: !3 = !{!"llvm.loop.vectorize.enable", i1 true}
> >
> > @@ -70,7 +69,7 @@ void test5(int *List, int Length) {
> >
> >  // CHECK-NEXT: ![[LOOP3]] = distinct !{![[LOOP3]], !5, !3}
> >
> > -// CHECK-NEXT: ![[LOOP4]] = distinct !{![[LOOP4]], !10}
> > +// CHECK-NEXT: ![[LOOP4]] = distinct !{![[LOOP4]], !3, !10}
> >  // CHECK-NEXT: !10 = !{!"llvm.loop.vectorize.width", i32 1}
> >
> > -// CHECK-NEXT: ![[LOOP5]] = distinct !{![[LOOP5]], !10}
> > 

r373400 - [clang][OpenMP][NFC] #include GlobalDecl.h to avoid incomplete class type

2019-10-01 Thread Jordan Rupprecht via cfe-commits
Author: rupprecht
Date: Tue Oct  1 15:30:10 2019
New Revision: 373400

URL: http://llvm.org/viewvc/llvm-project?rev=373400=rev
Log:
[clang][OpenMP][NFC] #include GlobalDecl.h to avoid incomplete class type

Modified:
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h?rev=373400=373399=373400=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h Tue Oct  1 15:30:10 2019
@@ -15,6 +15,7 @@
 
 #include "CGValue.h"
 #include "clang/AST/DeclOpenMP.h"
+#include "clang/AST/GlobalDecl.h"
 #include "clang/AST/Type.h"
 #include "clang/Basic/OpenMPKinds.h"
 #include "clang/Basic/SourceLocation.h"
@@ -36,7 +37,6 @@ class Value;
 
 namespace clang {
 class Expr;
-class GlobalDecl;
 class OMPDependClause;
 class OMPExecutableDirective;
 class OMPLoopDirective;


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


r367256 - [driver][test] Use /dev/null in as-options.s instead

2019-07-29 Thread Jordan Rupprecht via cfe-commits
Author: rupprecht
Date: Mon Jul 29 13:09:20 2019
New Revision: 367256

URL: http://llvm.org/viewvc/llvm-project?rev=367256=rev
Log:
[driver][test] Use /dev/null in as-options.s instead

Modified:
cfe/trunk/test/Driver/as-options.s

Modified: cfe/trunk/test/Driver/as-options.s
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/as-options.s?rev=367256=367255=367256=diff
==
--- cfe/trunk/test/Driver/as-options.s (original)
+++ cfe/trunk/test/Driver/as-options.s Mon Jul 29 13:09:20 2019
@@ -74,13 +74,13 @@
 // -Wa flags shouldn't cause warnings without an assembler stage with
 // -fno-integrated-as either.
 // RUN: %clang -Wa,-mno-warn-deprecated -fno-integrated-as -x c++ %s -S 2>&1 \
-// RUN:   -o %t.o \
+// RUN:   -o /dev/null \
 // RUN:   | FileCheck --check-prefix=NOWARN --allow-empty %s
 
 // But -m flags for the integrated assembler _should_ warn if the integrated
 // assembler is not in use.
-// RUN: %clang -mrelax-all -fintegrated-as -x c++ %s -S -o %t.o 2>&1 \
+// RUN: %clang -mrelax-all -fintegrated-as -x c++ %s -S -o /dev/null 2>&1 \
 // RUN:   | FileCheck --check-prefix=NOWARN --allow-empty %s
-// RUN: %clang -mrelax-all -fno-integrated-as -x c++ %s -S -o %t.o 2>&1 \
+// RUN: %clang -mrelax-all -fno-integrated-as -x c++ %s -S -o /dev/null 2>&1 \
 // RUN:   | FileCheck --check-prefix=WARN --allow-empty %s
 // WARN: unused


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


r367253 - [driver][test] Update as-options.s to not write to a readonly tree

2019-07-29 Thread Jordan Rupprecht via cfe-commits
Author: rupprecht
Date: Mon Jul 29 12:57:31 2019
New Revision: 367253

URL: http://llvm.org/viewvc/llvm-project?rev=367253=rev
Log:
[driver][test] Update as-options.s to not write to a readonly tree

The as-options.s test writes to the build tree as of r367165. Some build 
systems configure this to be readonly, so this fails. Explicitly write to the 
output tree using `%t` to avoid this.

Modified:
cfe/trunk/test/Driver/as-options.s

Modified: cfe/trunk/test/Driver/as-options.s
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/as-options.s?rev=367253=367252=367253=diff
==
--- cfe/trunk/test/Driver/as-options.s (original)
+++ cfe/trunk/test/Driver/as-options.s Mon Jul 29 12:57:31 2019
@@ -74,12 +74,13 @@
 // -Wa flags shouldn't cause warnings without an assembler stage with
 // -fno-integrated-as either.
 // RUN: %clang -Wa,-mno-warn-deprecated -fno-integrated-as -x c++ %s -S 2>&1 \
+// RUN:   -o %t.o \
 // RUN:   | FileCheck --check-prefix=NOWARN --allow-empty %s
 
 // But -m flags for the integrated assembler _should_ warn if the integrated
 // assembler is not in use.
-// RUN: %clang -mrelax-all -fintegrated-as -x c++ %s -S 2>&1 \
+// RUN: %clang -mrelax-all -fintegrated-as -x c++ %s -S -o %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=NOWARN --allow-empty %s
-// RUN: %clang -mrelax-all -fno-integrated-as -x c++ %s -S 2>&1 \
+// RUN: %clang -mrelax-all -fno-integrated-as -x c++ %s -S -o %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=WARN --allow-empty %s
 // WARN: unused


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


r365850 - Re-Revert Devirtualize destructor of final class.

2019-07-11 Thread Jordan Rupprecht via cfe-commits
Author: rupprecht
Date: Thu Jul 11 17:32:08 2019
New Revision: 365850

URL: http://llvm.org/viewvc/llvm-project?rev=365850=rev
Log:
Re-Revert Devirtualize destructor of final class.

This reverts r365509 (git commit d088720edad9c29ee0d622b5d69092e18a9ac0bd)

This is a second revert[1] due to failures in internal test cases (shared 
offline) found during more thorough testing.

[1] Original patch commited as r364100, reverted as r364359, recommitted as 
r365509

Removed:
cfe/trunk/test/CodeGenCXX/devirtualize-dtor-final.cpp
Modified:
cfe/trunk/lib/CodeGen/CGExprCXX.cpp

Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=365850=365849=365850=diff
==
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Thu Jul 11 17:32:08 2019
@@ -1865,33 +1865,9 @@ static void EmitObjectDelete(CodeGenFunc
   Dtor = RD->getDestructor();
 
   if (Dtor->isVirtual()) {
-bool UseVirtualCall = true;
-const Expr *Base = DE->getArgument();
-if (auto *DevirtualizedDtor =
-dyn_cast_or_null(
-Dtor->getDevirtualizedMethod(
-Base, CGF.CGM.getLangOpts().AppleKext))) {
-  UseVirtualCall = false;
-  const CXXRecordDecl *DevirtualizedClass =
-  DevirtualizedDtor->getParent();
-  if (declaresSameEntity(getCXXRecord(Base), DevirtualizedClass)) {
-// Devirtualized to the class of the base type (the type of the
-// whole expression).
-Dtor = DevirtualizedDtor;
-  } else {
-// Devirtualized to some other type. Would need to cast the this
-// pointer to that type but we don't have support for that yet, so
-// do a virtual call. FIXME: handle the case where it is
-// devirtualized to the derived type (the type of the inner
-// expression) as in EmitCXXMemberOrOperatorMemberCallExpr.
-UseVirtualCall = true;
-  }
-}
-if (UseVirtualCall) {
-  CGF.CGM.getCXXABI().emitVirtualObjectDelete(CGF, DE, Ptr, 
ElementType,
-  Dtor);
-  return;
-}
+CGF.CGM.getCXXABI().emitVirtualObjectDelete(CGF, DE, Ptr, ElementType,
+Dtor);
+return;
   }
 }
   }

Removed: cfe/trunk/test/CodeGenCXX/devirtualize-dtor-final.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/devirtualize-dtor-final.cpp?rev=365849=auto
==
--- cfe/trunk/test/CodeGenCXX/devirtualize-dtor-final.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/devirtualize-dtor-final.cpp (removed)
@@ -1,23 +0,0 @@
-// RUN: %clang_cc1 -triple i386-unknown-unknown -std=c++11 %s -emit-llvm -o - 
| FileCheck %s
-
-namespace Test1 {
-  struct A { virtual ~A() {} };
-  struct B final : A {};
-  struct C : A { virtual ~C() final {} };
-  struct D { virtual ~D() final = 0; };
-  // CHECK-LABEL: define void @_ZN5Test13fooEPNS_1BE
-  void foo(B *b) {
-// CHECK: call void @_ZN5Test11BD1Ev
-delete b;
-  }
-  // CHECK-LABEL: define void @_ZN5Test14foo2EPNS_1CE
-  void foo2(C *c) {
-// CHECK: call void @_ZN5Test11CD1Ev
-delete c;
-  }
-  // CHECK-LABEL: define void @_ZN5Test14evilEPNS_1DE
-  void evil(D *p) {
-// CHECK-NOT: call void @_ZN5Test11DD1Ev
-delete p;
-  }
-}


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


r363996 - [CodeGen][test] Use FileCheck variable matchers for better test support

2019-06-20 Thread Jordan Rupprecht via cfe-commits
Author: rupprecht
Date: Thu Jun 20 15:35:52 2019
New Revision: 363996

URL: http://llvm.org/viewvc/llvm-project?rev=363996=rev
Log:
[CodeGen][test] Use FileCheck variable matchers for better test support

Summary: Depending on how clang is built, it may discard the IR names and use 
names like `%2` instead of `%result.ptr`, causing tests that rely on the IR 
name to fail. Using FileCheck matchers makes the test work regardless of how 
clang is built.

This test passes with both `-fno-discard-value-names` and 
`-fdiscard-value-names` to make sure it passes regardless of the build mode.

Reviewers: rnk, akhuang, aprantl, lebedev.ri

Subscribers: cfe-commits

Tags: #clang

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

Modified:
cfe/trunk/test/CodeGenCXX/debug-info-nrvo.cpp

Modified: cfe/trunk/test/CodeGenCXX/debug-info-nrvo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-nrvo.cpp?rev=363996=363995=363996=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-nrvo.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-nrvo.cpp Thu Jun 20 15:35:52 2019
@@ -1,5 +1,10 @@
-// RUN: %clangxx -target x86_64-unknown-unknown -g %s -emit-llvm -S -o - | 
FileCheck %s
-// RUN: %clangxx -target x86_64-unknown-unknown -g -fno-elide-constructors %s 
-emit-llvm -S -o - | FileCheck %s -check-prefix=NOELIDE
+// RUN: %clangxx -target x86_64-unknown-unknown -g \
+// RUN:   %s -emit-llvm -S -o - | FileCheck %s
+
+// RUN: %clangxx -target x86_64-unknown-unknown -g \
+// RUN:   -fno-elide-constructors %s -emit-llvm -S -o - | \
+// RUN:   FileCheck %s -check-prefix=NOELIDE
+
 struct Foo {
   Foo() = default;
   Foo(Foo &) { x = other.x; }
@@ -21,8 +26,10 @@ int main() {
 // Check that NRVO variables are stored as a pointer with deref if they are
 // stored in the return register.
 
-// CHECK: %result.ptr = alloca i8*, align 8
-// CHECK: call void @llvm.dbg.declare(metadata i8** %result.ptr,
+// CHECK: %[[RESULT:.*]] = alloca i8*, align 8
+// CHECK: call void @llvm.dbg.declare(metadata i8** %[[RESULT]],
 // CHECK-SAME: metadata !DIExpression(DW_OP_deref)
-// NOELIDE: call void @llvm.dbg.declare(metadata %struct.Foo* %foo,
+
+// NOELIDE: %[[FOO:.*]] = alloca %struct.Foo, align 4
+// NOELIDE: call void @llvm.dbg.declare(metadata %struct.Foo* %[[FOO]],
 // NOELIDE-SAME:metadata !DIExpression()


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


r363848 - [clang][test] Add missing LambdaTemplateParams test and migrate from getLocStart

2019-06-19 Thread Jordan Rupprecht via cfe-commits
Author: rupprecht
Date: Wed Jun 19 10:43:58 2019
New Revision: 363848

URL: http://llvm.org/viewvc/llvm-project?rev=363848=rev
Log:
[clang][test] Add missing LambdaTemplateParams test and migrate from getLocStart

These were removed a long time ago in r341573, but this test was missed because 
it was not in cmake

Modified:
cfe/trunk/unittests/Tooling/CMakeLists.txt

cfe/trunk/unittests/Tooling/RecursiveASTVisitorTests/LambdaTemplateParams.cpp

Modified: cfe/trunk/unittests/Tooling/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/CMakeLists.txt?rev=363848=363847=363848=diff
==
--- cfe/trunk/unittests/Tooling/CMakeLists.txt (original)
+++ cfe/trunk/unittests/Tooling/CMakeLists.txt Wed Jun 19 10:43:58 2019
@@ -38,6 +38,7 @@ add_clang_unittest(ToolingTests
   RecursiveASTVisitorTests/IntegerLiteral.cpp
   RecursiveASTVisitorTests/LambdaDefaultCapture.cpp
   RecursiveASTVisitorTests/LambdaExpr.cpp
+  RecursiveASTVisitorTests/LambdaTemplateParams.cpp
   RecursiveASTVisitorTests/NestedNameSpecifiers.cpp
   RecursiveASTVisitorTests/ParenExpr.cpp
   RecursiveASTVisitorTests/TemplateArgumentLocTraverser.cpp

Modified: 
cfe/trunk/unittests/Tooling/RecursiveASTVisitorTests/LambdaTemplateParams.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/RecursiveASTVisitorTests/LambdaTemplateParams.cpp?rev=363848=363847=363848=diff
==
--- 
cfe/trunk/unittests/Tooling/RecursiveASTVisitorTests/LambdaTemplateParams.cpp 
(original)
+++ 
cfe/trunk/unittests/Tooling/RecursiveASTVisitorTests/LambdaTemplateParams.cpp 
Wed Jun 19 10:43:58 2019
@@ -21,19 +21,19 @@ public:
 
   bool VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {
 EXPECT_FALSE(D->isImplicit());
-Match(D->getName(), D->getLocStart());
+Match(D->getName(), D->getBeginLoc());
 return true;
   }
 
   bool VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D) {
 EXPECT_FALSE(D->isImplicit());
-Match(D->getName(), D->getLocStart());
+Match(D->getName(), D->getBeginLoc());
 return true;
   }
 
   bool VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D) {
 EXPECT_FALSE(D->isImplicit());
-Match(D->getName(), D->getLocStart());
+Match(D->getName(), D->getBeginLoc());
 return true;
   }
 };


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


r360086 - Revert "Re-commit r357452: SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function calls without used results (PR41259)"

2019-05-06 Thread Jordan Rupprecht via cfe-commits
Author: rupprecht
Date: Mon May  6 14:55:05 2019
New Revision: 360086

URL: http://llvm.org/viewvc/llvm-project?rev=360086=rev
Log:
Revert "Re-commit r357452: SimplifyCFG SinkCommonCodeFromPredecessors: Also 
sink function calls without used results (PR41259)"

This reverts r357452 (git commit 21eb771dcb5c11d7500fa6ad551c97a921997f05).

This was causing strange optimization-related test failures on an internal 
test. Will followup with more details offline.

Modified:
cfe/trunk/test/CodeGenCXX/nrvo.cpp
cfe/trunk/test/CodeGenCXX/stack-reuse-exceptions.cpp
cfe/trunk/test/CodeGenObjC/exceptions.m

Modified: cfe/trunk/test/CodeGenCXX/nrvo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/nrvo.cpp?rev=360086=360085=360086=diff
==
--- cfe/trunk/test/CodeGenCXX/nrvo.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/nrvo.cpp Mon May  6 14:55:05 2019
@@ -60,6 +60,7 @@ X test2(bool B) {
   // CHECK-NEXT: call void @llvm.lifetime.start
   // CHECK-NEXT: call {{.*}} @_ZN1XC1Ev
   // CHECK: call {{.*}} @_ZN1XC1ERKS_
+  // CHECK: call {{.*}} @_ZN1XC1ERKS_
   // CHECK: call {{.*}} @_ZN1XD1Ev
   // CHECK-NEXT: call void @llvm.lifetime.end
   // CHECK: call {{.*}} @_ZN1XD1Ev

Modified: cfe/trunk/test/CodeGenCXX/stack-reuse-exceptions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/stack-reuse-exceptions.cpp?rev=360086=360085=360086=diff
==
--- cfe/trunk/test/CodeGenCXX/stack-reuse-exceptions.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/stack-reuse-exceptions.cpp Mon May  6 14:55:05 
2019
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu %s -o - -emit-llvm -O1 \
-// RUN: -fexceptions -fcxx-exceptions -mllvm 
-simplifycfg-sink-common=false | FileCheck %s
+// RUN: -fexceptions -fcxx-exceptions | FileCheck %s
 //
 // We should emit lifetime.ends for these temporaries in both the 'exception'
 // and 'normal' paths in functions.

Modified: cfe/trunk/test/CodeGenObjC/exceptions.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/exceptions.m?rev=360086=360085=360086=diff
==
--- cfe/trunk/test/CodeGenObjC/exceptions.m (original)
+++ cfe/trunk/test/CodeGenObjC/exceptions.m Mon May  6 14:55:05 2019
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 
-fobjc-runtime=macosx-fragile-10.5 -emit-llvm -fobjc-exceptions -mllvm 
-simplifycfg-sink-common=false -O2 -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 
-fobjc-runtime=macosx-fragile-10.5 -emit-llvm -fobjc-exceptions -O2 -o - %s | 
FileCheck %s
 //
 //  [irgen] [eh] Exception code built with clang 
(x86_64) crashes
 


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


r356700 - [clang][OpenMP] Fix another test when using libgomp.

2019-03-21 Thread Jordan Rupprecht via cfe-commits
Author: rupprecht
Date: Thu Mar 21 12:13:22 2019
New Revision: 356700

URL: http://llvm.org/viewvc/llvm-project?rev=356700=rev
Log:
[clang][OpenMP] Fix another test when using libgomp.

Similarly to r356614, -fopenmp=libomp needs to be used for some omp-related AST 
matching.

Modified:
cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h

Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h?rev=356700=356699=356700=diff
==
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h Thu Mar 21 12:13:22 2019
@@ -237,13 +237,13 @@ testing::AssertionResult notMatchesWithC
 template 
 testing::AssertionResult matchesWithOpenMP(const std::string ,
const T ) {
-  return matchesConditionally(Code, AMatcher, true, "-fopenmp");
+  return matchesConditionally(Code, AMatcher, true, "-fopenmp=libomp");
 }
 
 template 
 testing::AssertionResult notMatchesWithOpenMP(const std::string ,
   const T ) {
-  return matchesConditionally(Code, AMatcher, false, "-fopenmp");
+  return matchesConditionally(Code, AMatcher, false, "-fopenmp=libomp");
 }
 
 template 


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


[clang-tools-extra] r356623 - Revert "[clangd] Print arguments in template specializations"

2019-03-20 Thread Jordan Rupprecht via cfe-commits
Author: rupprecht
Date: Wed Mar 20 15:51:56 2019
New Revision: 356623

URL: http://llvm.org/viewvc/llvm-project?rev=356623=rev
Log:
Revert "[clangd] Print arguments in template specializations"

This reverts commit 44a63f6a150dec72dea43730d2a89d292e58bd6f. It segfaults on 
an internal test case (will follow up off thread).

Modified:
clang-tools-extra/trunk/clangd/AST.cpp
clang-tools-extra/trunk/clangd/index/MemIndex.cpp
clang-tools-extra/trunk/clangd/index/dex/Dex.cpp
clang-tools-extra/trunk/unittests/clangd/DexTests.cpp
clang-tools-extra/trunk/unittests/clangd/IndexTests.cpp
clang-tools-extra/trunk/unittests/clangd/SymbolCollectorTests.cpp

Modified: clang-tools-extra/trunk/clangd/AST.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/AST.cpp?rev=356623=356622=356623=diff
==
--- clang-tools-extra/trunk/clangd/AST.cpp (original)
+++ clang-tools-extra/trunk/clangd/AST.cpp Wed Mar 20 15:51:56 2019
@@ -11,12 +11,9 @@
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclTemplate.h"
-#include "clang/AST/TemplateBase.h"
-#include "clang/AST/TypeLoc.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Index/USRGeneration.h"
-#include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/ScopedPrinter.h"
 
@@ -53,22 +50,6 @@ SourceLocation findNameLoc(const clang::
   return SM.getSpellingLoc(D->getLocation());
 }
 
-static llvm::Optional>
-getTemplateSpecializationArgLocs(const NamedDecl ) {
-  if (auto *Func = llvm::dyn_cast()) {
-if (auto *Args = Func->getTemplateSpecializationArgsAsWritten())
-  return Args->arguments();
-  } else if (auto *Cls =
- llvm::dyn_cast()) {
-if (auto *Args = Cls->getTemplateArgsAsWritten())
-  return Args->arguments();
-  } else if (auto *Var = llvm::dyn_cast())
-return Var->getTemplateArgsInfo().arguments();
-  // We return None for ClassTemplateSpecializationDecls because it does not
-  // contain TemplateArgumentLoc information.
-  return llvm::None;
-}
-
 std::string printQualifiedName(const NamedDecl ) {
   std::string QName;
   llvm::raw_string_ostream OS(QName);
@@ -79,19 +60,6 @@ std::string printQualifiedName(const Nam
   // namespaces to query: the preamble doesn't have a dedicated list.
   Policy.SuppressUnwrittenScope = true;
   ND.printQualifiedName(OS, Policy);
-  if (auto Args = getTemplateSpecializationArgLocs(ND))
-printTemplateArgumentList(OS, *Args, Policy);
-  else if (auto *Cls = llvm::dyn_cast()) {
-if (auto STL = Cls->getTypeAsWritten()
-   ->getTypeLoc()
-   .getAs()) {
-  llvm::SmallVector ArgLocs;
-  ArgLocs.reserve(STL.getNumArgs());
-  for (unsigned I = 0; I < STL.getNumArgs(); ++I)
-ArgLocs.push_back(STL.getArgLoc(I));
-  printTemplateArgumentList(OS, ArgLocs, Policy);
-}
-  }
   OS.flush();
   assert(!StringRef(QName).startswith("::"));
   return QName;

Modified: clang-tools-extra/trunk/clangd/index/MemIndex.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/MemIndex.cpp?rev=356623=356622=356623=diff
==
--- clang-tools-extra/trunk/clangd/index/MemIndex.cpp (original)
+++ clang-tools-extra/trunk/clangd/index/MemIndex.cpp Wed Mar 20 15:51:56 2019
@@ -38,6 +38,15 @@ bool MemIndex::fuzzyFind(
   for (const auto Pair : Index) {
 const Symbol *Sym = Pair.second;
 
+// FIXME: Enable fuzzy find on template specializations once we start
+// storing template arguments in the name. Currently we only store name for
+// class template, which would cause duplication in the results.
+if (Sym->SymInfo.Properties &
+(static_cast(
+ index::SymbolProperty::TemplateSpecialization) |
+ static_cast(
+ index::SymbolProperty::TemplatePartialSpecialization)))
+  continue;
 // Exact match against all possible scopes.
 if (!Req.AnyScope && !llvm::is_contained(Req.Scopes, Sym->Scope))
   continue;

Modified: clang-tools-extra/trunk/clangd/index/dex/Dex.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/dex/Dex.cpp?rev=356623=356622=356623=diff
==
--- clang-tools-extra/trunk/clangd/index/dex/Dex.cpp (original)
+++ clang-tools-extra/trunk/clangd/index/dex/Dex.cpp Wed Mar 20 15:51:56 2019
@@ -86,6 +86,15 @@ void Dex::buildIndex() {
   llvm::DenseMap> TempInvertedIndex;
   for (DocID SymbolRank = 0; SymbolRank < Symbols.size(); ++SymbolRank) {
 const auto *Sym = Symbols[SymbolRank];
+// FIXME: Enable fuzzy find on template specializations once we start
+// storing template arguments in the name. Currently we only store name for
+// 

r356623 - Revert "[clangd] Print arguments in template specializations"

2019-03-20 Thread Jordan Rupprecht via cfe-commits
Author: rupprecht
Date: Wed Mar 20 15:51:56 2019
New Revision: 356623

URL: http://llvm.org/viewvc/llvm-project?rev=356623=rev
Log:
Revert "[clangd] Print arguments in template specializations"

This reverts commit 44a63f6a150dec72dea43730d2a89d292e58bd6f. It segfaults on 
an internal test case (will follow up off thread).

Modified:
cfe/trunk/lib/AST/TypePrinter.cpp

Modified: cfe/trunk/lib/AST/TypePrinter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TypePrinter.cpp?rev=356623=356622=356623=diff
==
--- cfe/trunk/lib/AST/TypePrinter.cpp (original)
+++ cfe/trunk/lib/AST/TypePrinter.cpp Wed Mar 20 15:51:56 2019
@@ -1632,21 +1632,6 @@ static const TemplateArgument 
   return A.getArgument();
 }
 
-static void printArgument(const TemplateArgument , const PrintingPolicy ,
-  llvm::raw_ostream ) {
-  A.print(PP, OS);
-}
-
-static void printArgument(const TemplateArgumentLoc ,
-  const PrintingPolicy , llvm::raw_ostream ) {
-  const auto  = A.getArgument().getKind();
-  assert(Kind != TemplateArgument::Null &&
- "TemplateArgumentKind can not be null!");
-  if (Kind == TemplateArgument::ArgKind::Type)
-return A.getTypeSourceInfo()->getType().print(OS, PP);
-  return A.getArgument().print(PP, OS);
-}
-
 template
 static void printTo(raw_ostream , ArrayRef Args,
 const PrintingPolicy , bool SkipBrackets) {
@@ -1668,7 +1653,7 @@ static void printTo(raw_ostream , Arr
 } else {
   if (!FirstArg)
 OS << Comma;
-  printArgument(Arg, Policy, ArgOS);
+  Argument.print(Policy, ArgOS);
 }
 StringRef ArgString = ArgOS.str();
 


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


r356614 - [clang][OpenMP] Fix build when using libgomp

2019-03-20 Thread Jordan Rupprecht via cfe-commits
Author: rupprecht
Date: Wed Mar 20 14:01:56 2019
New Revision: 356614

URL: http://llvm.org/viewvc/llvm-project?rev=356614=rev
Log:
[clang][OpenMP] Fix build when using libgomp

Summary: rL356570 introduced a test which only passes with the default openmp 
library, libomp, and fails with other openmp libraries, such as libgomp. 
Explicitly choose libomp.

Reviewers: lebedev.ri

Subscribers: guansong, jdoerfert, cfe-commits

Tags: #clang

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

Modified:
cfe/trunk/unittests/AST/OMPStructuredBlockTest.cpp

Modified: cfe/trunk/unittests/AST/OMPStructuredBlockTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/OMPStructuredBlockTest.cpp?rev=356614=356613=356614=diff
==
--- cfe/trunk/unittests/AST/OMPStructuredBlockTest.cpp (original)
+++ cfe/trunk/unittests/AST/OMPStructuredBlockTest.cpp Wed Mar 20 14:01:56 2019
@@ -55,7 +55,7 @@ PrintedOMPStmtMatches(StringRef Code, co
   StringRef ExpectedPrinted,
   PolicyAdjusterType PolicyAdjuster = None) {
   std::vector Args = {
-  "-fopenmp",
+  "-fopenmp=libomp",
   };
   return PrintedStmtMatches(Code, Args, NodeMatch, ExpectedPrinted,
 PolicyAdjuster);


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


r356517 - Fix CodeGen/arm64-microsoft-status-reg.cpp test

2019-03-19 Thread Jordan Rupprecht via cfe-commits
Author: rupprecht
Date: Tue Mar 19 13:55:14 2019
New Revision: 356517

URL: http://llvm.org/viewvc/llvm-project?rev=356517=rev
Log:
Fix CodeGen/arm64-microsoft-status-reg.cpp test

Summary: This test is failing after r356499 (verified with `ninja 
check-clang-codegen`). Update the register selection used in the test from x0 
to x8.

Reviewers: arsenm, MatzeB, efriedma

Reviewed By: efriedma

Subscribers: efriedma, wdng, javed.absar, kristof.beyls, cfe-commits

Tags: #clang

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

Modified:
cfe/trunk/test/CodeGen/arm64-microsoft-status-reg.cpp

Modified: cfe/trunk/test/CodeGen/arm64-microsoft-status-reg.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm64-microsoft-status-reg.cpp?rev=356517=356516=356517=diff
==
--- cfe/trunk/test/CodeGen/arm64-microsoft-status-reg.cpp (original)
+++ cfe/trunk/test/CodeGen/arm64-microsoft-status-reg.cpp Tue Mar 19 13:55:14 
2019
@@ -30,103 +30,103 @@ void _WriteStatusReg(int, __int64);
 void check_ReadWriteStatusReg(__int64 v) {
   __int64 ret;
   ret = _ReadStatusReg(ARM64_CNTVCT);
-// CHECK-ASM: mrs x0, CNTVCT_EL0
+// CHECK-ASM: mrs x8, CNTVCT_EL0
 // CHECK-IR: %[[VAR:.*]] = call i64 @llvm.read_register.i64(metadata 
![[MD2:.*]])
 // CHECK-IR-NEXT: store i64 %[[VAR]]
 
   ret = _ReadStatusReg(ARM64_PMCCNTR_EL0);
-// CHECK-ASM: mrs x0, PMCCNTR_EL0
+// CHECK-ASM: mrs x8, PMCCNTR_EL0
 // CHECK-IR: %[[VAR:.*]] = call i64 @llvm.read_register.i64(metadata 
![[MD3:.*]])
 // CHECK-IR-NEXT: store i64 %[[VAR]]
 
   ret = _ReadStatusReg(ARM64_PMSELR_EL0);
-// CHECK-ASM: mrs x0, PMSELR_EL0
+// CHECK-ASM: mrs x8, PMSELR_EL0
 // CHECK-IR: %[[VAR:.*]] = call i64 @llvm.read_register.i64(metadata 
![[MD4:.*]])
 // CHECK-IR-NEXT: store i64 %[[VAR]]
 
   ret = _ReadStatusReg(ARM64_PMXEVCNTR_EL0);
-// CHECK-ASM: mrs x0, PMXEVCNTR_EL0
+// CHECK-ASM: mrs x8, PMXEVCNTR_EL0
 // CHECK-IR: %[[VAR:.*]] = call i64 @llvm.read_register.i64(metadata 
![[MD5:.*]])
 // CHECK-IR-NEXT: store i64 %[[VAR]]
 
   ret = _ReadStatusReg(ARM64_PMXEVCNTRn_EL0(0));
-// CHECK-ASM: mrs x0, PMEVCNTR0_EL0
+// CHECK-ASM: mrs x8, PMEVCNTR0_EL0
 // CHECK-IR: %[[VAR:.*]] = call i64 @llvm.read_register.i64(metadata 
![[MD6:.*]])
 // CHECK-IR-NEXT: store i64 %[[VAR]]
 
   ret = _ReadStatusReg(ARM64_PMXEVCNTRn_EL0(1));
-// CHECK-ASM: mrs x0, PMEVCNTR1_EL0
+// CHECK-ASM: mrs x8, PMEVCNTR1_EL0
 // CHECK-IR: %[[VAR:.*]] = call i64 @llvm.read_register.i64(metadata 
![[MD7:.*]])
 // CHECK-IR-NEXT: store i64 %[[VAR]]
 
   ret = _ReadStatusReg(ARM64_PMXEVCNTRn_EL0(30));
-// CHECK-ASM: mrs x0, PMEVCNTR30_EL0
+// CHECK-ASM: mrs x8, PMEVCNTR30_EL0
 // CHECK-IR: %[[VAR:.*]] = call i64 @llvm.read_register.i64(metadata 
![[MD8:.*]])
 // CHECK-IR-NEXT: store i64 %[[VAR]]
 
   ret = _ReadStatusReg(ARM64_TPIDR_EL0);
-// CHECK-ASM: mrs x0, TPIDR_EL0
+// CHECK-ASM: mrs x8, TPIDR_EL0
 // CHECK-IR: %[[VAR:.*]] = call i64 @llvm.read_register.i64(metadata 
![[MD9:.*]])
 // CHECK-IR-NEXT: store i64 %[[VAR]]
 
   ret = _ReadStatusReg(ARM64_TPIDRRO_EL0);
-// CHECK-ASM: mrs x0, TPIDRRO_EL0
+// CHECK-ASM: mrs x8, TPIDRRO_EL0
 // CHECK-IR: %[[VAR:.*]] = call i64 @llvm.read_register.i64(metadata 
![[MD10:.*]])
 // CHECK-IR-NEXT: store i64 %[[VAR]]
 
   ret = _ReadStatusReg(ARM64_TPIDR_EL1);
-// CHECK-ASM: mrs x0, TPIDR_EL1
+// CHECK-ASM: mrs x8, TPIDR_EL1
 // CHECK-IR: %[[VAR:.*]] = call i64 @llvm.read_register.i64(metadata 
![[MD11:.*]])
 // CHECK-IR-NEXT: store i64 %[[VAR]]
 
 
   _WriteStatusReg(ARM64_CNTVCT, v);
-// CHECK-ASM: msr S3_3_C14_C0_2, x0
+// CHECK-ASM: msr S3_3_C14_C0_2, x8
 // CHECK-IR: %[[VAR:.*]] = load i64,
 // CHECK-IR-NEXT: call void @llvm.write_register.i64(metadata ![[MD2:.*]], i64 
%[[VAR]])
 
   _WriteStatusReg(ARM64_PMCCNTR_EL0, v);
-// CHECK-ASM: msr PMCCNTR_EL0, x0
+// CHECK-ASM: msr PMCCNTR_EL0, x8
 // CHECK-IR: %[[VAR:.*]] = load i64,
 // CHECK-IR-NEXT: call void @llvm.write_register.i64(metadata ![[MD3:.*]], i64 
%[[VAR]])
 
   _WriteStatusReg(ARM64_PMSELR_EL0, v);
-// CHECK-ASM: msr PMSELR_EL0, x0
+// CHECK-ASM: msr PMSELR_EL0, x8
 // CHECK-IR: %[[VAR:.*]] = load i64,
 // CHECK-IR-NEXT: call void @llvm.write_register.i64(metadata ![[MD4:.*]], i64 
%[[VAR]])
 
   _WriteStatusReg(ARM64_PMXEVCNTR_EL0, v);
-// CHECK-ASM: msr PMXEVCNTR_EL0, x0
+// CHECK-ASM: msr PMXEVCNTR_EL0, x8
 // CHECK-IR: %[[VAR:.*]] = load i64,
 // CHECK-IR-NEXT: call void @llvm.write_register.i64(metadata ![[MD5:.*]], i64 
%[[VAR]])
 
   _WriteStatusReg(ARM64_PMXEVCNTRn_EL0(0), v);
-// CHECK-ASM: msr PMEVCNTR0_EL0, x0
+// CHECK-ASM: msr PMEVCNTR0_EL0, x8
 // CHECK-IR: %[[VAR:.*]] = load i64,
 // CHECK-IR-NEXT: call void @llvm.write_register.i64(metadata ![[MD6:.*]], i64 
%[[VAR]])
 
   _WriteStatusReg(ARM64_PMXEVCNTRn_EL0(1), v);
-// CHECK-ASM: msr PMEVCNTR1_EL0, x0
+// CHECK-ASM: 

r356099 - [clang-format] Propagate inferred language to getLLVMStyle() in getPredefinedStyle()

2019-03-13 Thread Jordan Rupprecht via cfe-commits
Author: rupprecht
Date: Wed Mar 13 14:13:01 2019
New Revision: 356099

URL: http://llvm.org/viewvc/llvm-project?rev=356099=rev
Log:
[clang-format] Propagate inferred language to getLLVMStyle() in 
getPredefinedStyle()

rC355158 added an optional language parameter to getLLVMStyle(), but this 
parameter was not used in getPredefinedStyle(). Because unit tests directly 
specify the style, this codepath wasn't tested. Add an additional unit test for 
getStyle().

Modified:
cfe/trunk/lib/Format/Format.cpp
cfe/trunk/unittests/Format/FormatTest.cpp

Modified: cfe/trunk/lib/Format/Format.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=356099=356098=356099=diff
==
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Wed Mar 13 14:13:01 2019
@@ -961,7 +961,7 @@ FormatStyle getNoStyle() {
 bool getPredefinedStyle(StringRef Name, FormatStyle::LanguageKind Language,
 FormatStyle *Style) {
   if (Name.equals_lower("llvm")) {
-*Style = getLLVMStyle();
+*Style = getLLVMStyle(Language);
   } else if (Name.equals_lower("chromium")) {
 *Style = getChromiumStyle(Language);
   } else if (Name.equals_lower("mozilla")) {

Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=356099=356098=356099=diff
==
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Wed Mar 13 14:13:01 2019
@@ -12714,6 +12714,11 @@ TEST(FormatStyle, GetStyleOfFile) {
   auto Style7 = getStyle("file", "/d/.clang-format", "LLVM", "", );
   ASSERT_FALSE((bool)Style7);
   llvm::consumeError(Style7.takeError());
+
+  // Test 8: inferred per-language defaults apply.
+  auto StyleTd = getStyle("file", "x.td", "llvm", "", );
+  ASSERT_TRUE((bool)StyleTd);
+  ASSERT_EQ(*StyleTd, getLLVMStyle(FormatStyle::LK_TableGen));
 }
 
 TEST_F(ReplacementTest, FormatCodeAfterReplacements) {


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


r356097 - [clang-format][NFC] Include TableGen in enum->string mapping used for debugging

2019-03-13 Thread Jordan Rupprecht via cfe-commits
Author: rupprecht
Date: Wed Mar 13 13:34:34 2019
New Revision: 356097

URL: http://llvm.org/viewvc/llvm-project?rev=356097=rev
Log:
[clang-format][NFC] Include TableGen in enum->string mapping used for debugging

Running `clang-format -debug` prints "Unknown" for tablegen files because of 
this missing mapping, even though it is recognized as a tablegen file.

Modified:
cfe/trunk/include/clang/Format/Format.h

Modified: cfe/trunk/include/clang/Format/Format.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Format/Format.h?rev=356097=356096=356097=diff
==
--- cfe/trunk/include/clang/Format/Format.h (original)
+++ cfe/trunk/include/clang/Format/Format.h Wed Mar 13 13:34:34 2019
@@ -2089,6 +2089,8 @@ inline StringRef getLanguageName(FormatS
 return "JavaScript";
   case FormatStyle::LK_Proto:
 return "Proto";
+  case FormatStyle::LK_TableGen:
+return "TableGen";
   case FormatStyle::LK_TextProto:
 return "TextProto";
   default:


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


r355158 - [clang-format][TableGen] Don't add spaces around items in square braces.

2019-02-28 Thread Jordan Rupprecht via cfe-commits
Author: rupprecht
Date: Thu Feb 28 16:12:18 2019
New Revision: 355158

URL: http://llvm.org/viewvc/llvm-project?rev=355158=rev
Log:
[clang-format][TableGen] Don't add spaces around items in square braces.

Summary:
clang-formatting wants to add spaces around items in square braces, e.g. [1, 2] 
-> [ 1, 2 ]. Based on a quick check [1], it seems like most cases are using the 
[1, 2] format, so make that the consistent one.

[1] in llvm `.td` files, the regex `\[[^ ]` (bracket followed by not-a-space) 
shows up ~400 times, but `\[\s[^ ]` (bracket followed by one space and one 
not-a-space) shows up ~40 times => ~90% uses this format.

Reviewers: djasper, krasimir, MyDeveloperDay

Reviewed By: MyDeveloperDay

Subscribers: MyDeveloperDay, arphaman, cfe-commits

Tags: #clang

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

Modified:
cfe/trunk/lib/Format/Format.cpp
cfe/trunk/unittests/Format/FormatTestTableGen.cpp

Modified: cfe/trunk/lib/Format/Format.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=355158=355157=355158=diff
==
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Thu Feb 28 16:12:18 2019
@@ -718,6 +718,11 @@ FormatStyle getLLVMStyle(FormatStyle::La
   LLVMStyle.StatementMacros.push_back("Q_UNUSED");
   LLVMStyle.StatementMacros.push_back("QT_REQUIRE_VERSION");
 
+  // Defaults that differ when not C++.
+  if (Language == FormatStyle::LK_TableGen) {
+LLVMStyle.SpacesInContainerLiterals = false;
+  }
+
   return LLVMStyle;
 }
 

Modified: cfe/trunk/unittests/Format/FormatTestTableGen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestTableGen.cpp?rev=355158=355157=355158=diff
==
--- cfe/trunk/unittests/Format/FormatTestTableGen.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestTableGen.cpp Thu Feb 28 16:12:18 2019
@@ -51,5 +51,9 @@ TEST_F(FormatTestTableGen, FormatStringB
"   \"very long help string\">;\n");
 }
 
+TEST_F(FormatTestTableGen, NoSpacesInSquareBracketLists) {
+  verifyFormat("def flag : Flag<[\"-\", \"--\"], \"foo\">;\n");
+}
+
 } // namespace format
 } // end namespace clang


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


r355123 - [clang-format][NFC] Allow getLLVMStyle() to take a language

2019-02-28 Thread Jordan Rupprecht via cfe-commits
Author: rupprecht
Date: Thu Feb 28 11:16:45 2019
New Revision: 355123

URL: http://llvm.org/viewvc/llvm-project?rev=355123=rev
Log:
[clang-format][NFC] Allow getLLVMStyle() to take a language

Summary:
getLLVMStyle() sets the default style, but doesn't take the language as a 
parameter, so can't set default parameters when they differ from C++. This 
change adds LanguageKind as an input to getLLVMStyle so that we can start doing 
that.

See D55964 as a motivation for this, where we want Tablegen to be formatted 
differently than C++.

Reviewers: djasper, krasimir, MyDeveloperDay

Reviewed By: MyDeveloperDay

Subscribers: jdoerfert, MyDeveloperDay, kristina, cfe-commits, arphaman

Tags: #clang

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

Modified:
cfe/trunk/include/clang/Format/Format.h
cfe/trunk/lib/Format/Format.cpp
cfe/trunk/unittests/Format/FormatTest.cpp

Modified: cfe/trunk/include/clang/Format/Format.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Format/Format.h?rev=355123=355122=355123=diff
==
--- cfe/trunk/include/clang/Format/Format.h (original)
+++ cfe/trunk/include/clang/Format/Format.h Thu Feb 28 11:16:45 2019
@@ -1849,7 +1849,8 @@ private:
 
 /// Returns a format style complying with the LLVM coding standards:
 /// http://llvm.org/docs/CodingStandards.html.
-FormatStyle getLLVMStyle();
+FormatStyle getLLVMStyle(
+FormatStyle::LanguageKind Language = FormatStyle::LanguageKind::LK_Cpp);
 
 /// Returns a format style complying with one of Google's style guides:
 /// http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml.

Modified: cfe/trunk/lib/Format/Format.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=355123=355122=355123=diff
==
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Thu Feb 28 11:16:45 2019
@@ -618,9 +618,9 @@ static FormatStyle expandPresets(const F
   return Expanded;
 }
 
-FormatStyle getLLVMStyle() {
+FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) {
   FormatStyle LLVMStyle;
-  LLVMStyle.Language = FormatStyle::LK_Cpp;
+  LLVMStyle.Language = Language;
   LLVMStyle.AccessModifierOffset = -2;
   LLVMStyle.AlignEscapedNewlines = FormatStyle::ENAS_Right;
   LLVMStyle.AlignAfterOpenBracket = FormatStyle::BAS_Align;
@@ -729,8 +729,7 @@ FormatStyle getGoogleStyle(FormatStyle::
 return GoogleStyle;
   }
 
-  FormatStyle GoogleStyle = getLLVMStyle();
-  GoogleStyle.Language = Language;
+  FormatStyle GoogleStyle = getLLVMStyle(Language);
 
   GoogleStyle.AccessModifierOffset = -1;
   GoogleStyle.AlignEscapedNewlines = FormatStyle::ENAS_Left;
@@ -2344,8 +2343,7 @@ llvm::Expected getStyle(Str
   if (!FS) {
 FS = llvm::vfs::getRealFileSystem().get();
   }
-  FormatStyle Style = getLLVMStyle();
-  Style.Language = guessLanguage(FileName, Code);
+  FormatStyle Style = getLLVMStyle(guessLanguage(FileName, Code));
 
   FormatStyle FallbackStyle = getNoStyle();
   if (!getPredefinedStyle(FallbackStyleName, Style.Language, ))

Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=355123=355122=355123=diff
==
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Thu Feb 28 11:16:45 2019
@@ -120,6 +120,15 @@ TEST_F(FormatTest, MessUp) {
   EXPECT_EQ("a\n#b c d\ne", test::messUp("a\n#b\\\nc\\\nd\ne"));
 }
 
+TEST_F(FormatTest, DefaultLLVMStyleIsCpp) {
+  EXPECT_EQ(FormatStyle::LK_Cpp, getLLVMStyle().Language);
+}
+
+TEST_F(FormatTest, LLVMStyleOverride) {
+  EXPECT_EQ(FormatStyle::LK_Proto,
+getLLVMStyle(FormatStyle::LK_Proto).Language);
+}
+
 
//===--===//
 // Basic function tests.
 
//===--===//


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


Re: r351391 - Recommit r351160 "[X86] Make _xgetbv/_xsetbv on non-windows platforms"

2019-01-18 Thread Jordan Rupprecht via cfe-commits
Confirmed that opencv builds now, thanks :)

On Fri, Jan 18, 2019 at 10:05 AM Jordan Rupprecht 
wrote:

> Thanks! I'll rebuild clang from trunk and give it another try.
> Yes, for the second two, I think it should be a more straightforward fix a
> la https://chromium-review.googlesource.com/c/v8/v8/+/1414858
>
> On Fri, Jan 18, 2019 at 9:58 AM Topper, Craig 
> wrote:
>
>> I just committed a change to go back to only definining 
>> _XCR_XFEATURE_ENABLED_MASK
>> when clang is in MSVC compatibility mode. I don’t think I meant to define
>> it outside of that since it doesn’t appear gcc does.
>>
>>
>>
>> For the other two files, I assume you’re getting a collision of names
>> similar to what Benjamin Kramer reported on V8?
>>
>>
>>
>> *From:* Jordan Rupprecht [mailto:ruppre...@google.com]
>> *Sent:* Friday, January 18, 2019 9:30 AM
>> *To:* Topper, Craig 
>> *Cc:* cfe-commits@lists.llvm.org
>> *Subject:* Re: r351391 - Recommit r351160 "[X86] Make _xgetbv/_xsetbv on
>> non-windows platforms"
>>
>>
>>
>> Hi Craig,
>>
>> We're seeing issues building a few other things now; notably this part in
>> opencv:
>> https://github.com/opencv/opencv/blob/master/modules/core/src/system.cpp#L422
>>
>> #ifdef _XCR_XFEATURE_ENABLED_MASK // requires immintrin.h
>>
>> xcr0 = (int)_xgetbv(_XCR_XFEATURE_ENABLED_MASK);
>>
>> => error: '__builtin_ia32_xgetbv' needs target feature xsave
>>
>> We can workaround by building with -mavx... but we also have code running
>> on non-avx machines that pull in this dependency. (It likely doesn't
>> actually *use* the code, but still depends on it compiling as a transitive
>> dep).
>>
>> Is there a more accurate preprocessor macro (e.g. one that says if xsave
>> is available) we could use to selectively disable this?
>>
>>
>>
>> There are similar breakages here:
>>
>>
>> https://chromium.googlesource.com/aosp/platform/external/libchrome/+/master/base/cpu.cc#82
>>
>> https://github.com/google/sling/blob/master/third_party/jit/cpu.cc#L58
>>
>> Advice there too would be appreciated, if possible :)
>>
>>
>>
>> On Wed, Jan 16, 2019 at 3:00 PM Craig Topper via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>> Author: ctopper
>> Date: Wed Jan 16 14:56:25 2019
>> New Revision: 351391
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=351391=rev
>> Log:
>> Recommit r351160 "[X86] Make _xgetbv/_xsetbv on non-windows platforms"
>>
>> V8 has been fixed now.
>>
>> Modified:
>> cfe/trunk/include/clang/Basic/BuiltinsX86.def
>> cfe/trunk/lib/CodeGen/CGBuiltin.cpp
>> cfe/trunk/lib/Headers/immintrin.h
>> cfe/trunk/lib/Headers/intrin.h
>> cfe/trunk/lib/Headers/xsaveintrin.h
>> cfe/trunk/test/CodeGen/builtins-x86.c
>> cfe/trunk/test/CodeGen/x86_32-xsave.c
>> cfe/trunk/test/CodeGen/x86_64-xsave.c
>> cfe/trunk/test/Headers/ms-intrin.cpp
>>
>> Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=351391=351390=351391=diff
>>
>> ==
>> --- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
>> +++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Wed Jan 16 14:56:25 2019
>> @@ -693,6 +693,10 @@ TARGET_BUILTIN(__builtin_ia32_fxsave, "v
>>  // XSAVE
>>  TARGET_BUILTIN(__builtin_ia32_xsave, "vv*ULLi", "n", "xsave")
>>  TARGET_BUILTIN(__builtin_ia32_xrstor, "vv*ULLi", "n", "xsave")
>> +TARGET_BUILTIN(__builtin_ia32_xgetbv, "ULLiUi", "n", "xsave")
>> +TARGET_HEADER_BUILTIN(_xgetbv, "UWiUi", "nh", "immintrin.h",
>> ALL_MS_LANGUAGES, "")
>> +TARGET_BUILTIN(__builtin_ia32_xsetbv, "vUiULLi", "n", "xsave")
>> +TARGET_HEADER_BUILTIN(_xsetbv, "vUiUWi", "nh", "immintrin.h",
>> ALL_MS_LANGUAGES, "")
>>  TARGET_BUILTIN(__builtin_ia32_xsaveopt, "vv*ULLi", "n", "xsaveopt")
>>  TARGET_BUILTIN(__builtin_ia32_xrstors, "vv*ULLi", "n", "xsaves")
>>  TARGET_BUILTIN(__builtin_ia32_xsavec, "vv*ULLi", "n", "xsavec")
>>
>> Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=351391=351390=351391=diff
>>
>> ==
>> --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Wed Jan 16 14:56:25 2019
>> @@ -9833,7 +9833,9 @@ Value *CodeGenFunction::EmitX86BuiltinEx
>>case X86::BI__builtin_ia32_xsavec:
>>case X86::BI__builtin_ia32_xsavec64:
>>case X86::BI__builtin_ia32_xsaves:
>> -  case X86::BI__builtin_ia32_xsaves64: {
>> +  case X86::BI__builtin_ia32_xsaves64:
>> +  case X86::BI__builtin_ia32_xsetbv:
>> +  case X86::BI_xsetbv: {
>>  Intrinsic::ID ID;
>>  #define INTRINSIC_X86_XSAVE_ID(NAME) \
>>  case X86::BI__builtin_ia32_##NAME: \
>> @@ -9853,6 +9855,10 @@ Value *CodeGenFunction::EmitX86BuiltinEx
>>  INTRINSIC_X86_XSAVE_ID(xsavec64);
>>  INTRINSIC_X86_XSAVE_ID(xsaves);
>>  

Re: r351391 - Recommit r351160 "[X86] Make _xgetbv/_xsetbv on non-windows platforms"

2019-01-18 Thread Jordan Rupprecht via cfe-commits
Thanks! I'll rebuild clang from trunk and give it another try.
Yes, for the second two, I think it should be a more straightforward fix a
la https://chromium-review.googlesource.com/c/v8/v8/+/1414858

On Fri, Jan 18, 2019 at 9:58 AM Topper, Craig 
wrote:

> I just committed a change to go back to only definining 
> _XCR_XFEATURE_ENABLED_MASK
> when clang is in MSVC compatibility mode. I don’t think I meant to define
> it outside of that since it doesn’t appear gcc does.
>
>
>
> For the other two files, I assume you’re getting a collision of names
> similar to what Benjamin Kramer reported on V8?
>
>
>
> *From:* Jordan Rupprecht [mailto:ruppre...@google.com]
> *Sent:* Friday, January 18, 2019 9:30 AM
> *To:* Topper, Craig 
> *Cc:* cfe-commits@lists.llvm.org
> *Subject:* Re: r351391 - Recommit r351160 "[X86] Make _xgetbv/_xsetbv on
> non-windows platforms"
>
>
>
> Hi Craig,
>
> We're seeing issues building a few other things now; notably this part in
> opencv:
> https://github.com/opencv/opencv/blob/master/modules/core/src/system.cpp#L422
>
> #ifdef _XCR_XFEATURE_ENABLED_MASK // requires immintrin.h
>
> xcr0 = (int)_xgetbv(_XCR_XFEATURE_ENABLED_MASK);
>
> => error: '__builtin_ia32_xgetbv' needs target feature xsave
>
> We can workaround by building with -mavx... but we also have code running
> on non-avx machines that pull in this dependency. (It likely doesn't
> actually *use* the code, but still depends on it compiling as a transitive
> dep).
>
> Is there a more accurate preprocessor macro (e.g. one that says if xsave
> is available) we could use to selectively disable this?
>
>
>
> There are similar breakages here:
>
>
> https://chromium.googlesource.com/aosp/platform/external/libchrome/+/master/base/cpu.cc#82
>
> https://github.com/google/sling/blob/master/third_party/jit/cpu.cc#L58
>
> Advice there too would be appreciated, if possible :)
>
>
>
> On Wed, Jan 16, 2019 at 3:00 PM Craig Topper via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
> Author: ctopper
> Date: Wed Jan 16 14:56:25 2019
> New Revision: 351391
>
> URL: http://llvm.org/viewvc/llvm-project?rev=351391=rev
> Log:
> Recommit r351160 "[X86] Make _xgetbv/_xsetbv on non-windows platforms"
>
> V8 has been fixed now.
>
> Modified:
> cfe/trunk/include/clang/Basic/BuiltinsX86.def
> cfe/trunk/lib/CodeGen/CGBuiltin.cpp
> cfe/trunk/lib/Headers/immintrin.h
> cfe/trunk/lib/Headers/intrin.h
> cfe/trunk/lib/Headers/xsaveintrin.h
> cfe/trunk/test/CodeGen/builtins-x86.c
> cfe/trunk/test/CodeGen/x86_32-xsave.c
> cfe/trunk/test/CodeGen/x86_64-xsave.c
> cfe/trunk/test/Headers/ms-intrin.cpp
>
> Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=351391=351390=351391=diff
>
> ==
> --- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
> +++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Wed Jan 16 14:56:25 2019
> @@ -693,6 +693,10 @@ TARGET_BUILTIN(__builtin_ia32_fxsave, "v
>  // XSAVE
>  TARGET_BUILTIN(__builtin_ia32_xsave, "vv*ULLi", "n", "xsave")
>  TARGET_BUILTIN(__builtin_ia32_xrstor, "vv*ULLi", "n", "xsave")
> +TARGET_BUILTIN(__builtin_ia32_xgetbv, "ULLiUi", "n", "xsave")
> +TARGET_HEADER_BUILTIN(_xgetbv, "UWiUi", "nh", "immintrin.h",
> ALL_MS_LANGUAGES, "")
> +TARGET_BUILTIN(__builtin_ia32_xsetbv, "vUiULLi", "n", "xsave")
> +TARGET_HEADER_BUILTIN(_xsetbv, "vUiUWi", "nh", "immintrin.h",
> ALL_MS_LANGUAGES, "")
>  TARGET_BUILTIN(__builtin_ia32_xsaveopt, "vv*ULLi", "n", "xsaveopt")
>  TARGET_BUILTIN(__builtin_ia32_xrstors, "vv*ULLi", "n", "xsaves")
>  TARGET_BUILTIN(__builtin_ia32_xsavec, "vv*ULLi", "n", "xsavec")
>
> Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=351391=351390=351391=diff
>
> ==
> --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Wed Jan 16 14:56:25 2019
> @@ -9833,7 +9833,9 @@ Value *CodeGenFunction::EmitX86BuiltinEx
>case X86::BI__builtin_ia32_xsavec:
>case X86::BI__builtin_ia32_xsavec64:
>case X86::BI__builtin_ia32_xsaves:
> -  case X86::BI__builtin_ia32_xsaves64: {
> +  case X86::BI__builtin_ia32_xsaves64:
> +  case X86::BI__builtin_ia32_xsetbv:
> +  case X86::BI_xsetbv: {
>  Intrinsic::ID ID;
>  #define INTRINSIC_X86_XSAVE_ID(NAME) \
>  case X86::BI__builtin_ia32_##NAME: \
> @@ -9853,6 +9855,10 @@ Value *CodeGenFunction::EmitX86BuiltinEx
>  INTRINSIC_X86_XSAVE_ID(xsavec64);
>  INTRINSIC_X86_XSAVE_ID(xsaves);
>  INTRINSIC_X86_XSAVE_ID(xsaves64);
> +INTRINSIC_X86_XSAVE_ID(xsetbv);
> +case X86::BI_xsetbv:
> +  ID = Intrinsic::x86_xsetbv;
> +  break;
>  }
>  #undef INTRINSIC_X86_XSAVE_ID
>  Value *Mhi = Builder.CreateTrunc(
> @@ -9862,6 

Re: r351391 - Recommit r351160 "[X86] Make _xgetbv/_xsetbv on non-windows platforms"

2019-01-18 Thread Jordan Rupprecht via cfe-commits
Hi Craig,
We're seeing issues building a few other things now; notably this part in
opencv:
https://github.com/opencv/opencv/blob/master/modules/core/src/system.cpp#L422
#ifdef _XCR_XFEATURE_ENABLED_MASK // requires immintrin.h
xcr0 = (int)_xgetbv(_XCR_XFEATURE_ENABLED_MASK);
=> error: '__builtin_ia32_xgetbv' needs target feature xsave
We can workaround by building with -mavx... but we also have code running
on non-avx machines that pull in this dependency. (It likely doesn't
actually *use* the code, but still depends on it compiling as a transitive
dep).
Is there a more accurate preprocessor macro (e.g. one that says if xsave is
available) we could use to selectively disable this?

There are similar breakages here:
https://chromium.googlesource.com/aosp/platform/external/libchrome/+/master/base/cpu.cc#82
https://github.com/google/sling/blob/master/third_party/jit/cpu.cc#L58
Advice there too would be appreciated, if possible :)

On Wed, Jan 16, 2019 at 3:00 PM Craig Topper via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: ctopper
> Date: Wed Jan 16 14:56:25 2019
> New Revision: 351391
>
> URL: http://llvm.org/viewvc/llvm-project?rev=351391=rev
> Log:
> Recommit r351160 "[X86] Make _xgetbv/_xsetbv on non-windows platforms"
>
> V8 has been fixed now.
>
> Modified:
> cfe/trunk/include/clang/Basic/BuiltinsX86.def
> cfe/trunk/lib/CodeGen/CGBuiltin.cpp
> cfe/trunk/lib/Headers/immintrin.h
> cfe/trunk/lib/Headers/intrin.h
> cfe/trunk/lib/Headers/xsaveintrin.h
> cfe/trunk/test/CodeGen/builtins-x86.c
> cfe/trunk/test/CodeGen/x86_32-xsave.c
> cfe/trunk/test/CodeGen/x86_64-xsave.c
> cfe/trunk/test/Headers/ms-intrin.cpp
>
> Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=351391=351390=351391=diff
>
> ==
> --- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
> +++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Wed Jan 16 14:56:25 2019
> @@ -693,6 +693,10 @@ TARGET_BUILTIN(__builtin_ia32_fxsave, "v
>  // XSAVE
>  TARGET_BUILTIN(__builtin_ia32_xsave, "vv*ULLi", "n", "xsave")
>  TARGET_BUILTIN(__builtin_ia32_xrstor, "vv*ULLi", "n", "xsave")
> +TARGET_BUILTIN(__builtin_ia32_xgetbv, "ULLiUi", "n", "xsave")
> +TARGET_HEADER_BUILTIN(_xgetbv, "UWiUi", "nh", "immintrin.h",
> ALL_MS_LANGUAGES, "")
> +TARGET_BUILTIN(__builtin_ia32_xsetbv, "vUiULLi", "n", "xsave")
> +TARGET_HEADER_BUILTIN(_xsetbv, "vUiUWi", "nh", "immintrin.h",
> ALL_MS_LANGUAGES, "")
>  TARGET_BUILTIN(__builtin_ia32_xsaveopt, "vv*ULLi", "n", "xsaveopt")
>  TARGET_BUILTIN(__builtin_ia32_xrstors, "vv*ULLi", "n", "xsaves")
>  TARGET_BUILTIN(__builtin_ia32_xsavec, "vv*ULLi", "n", "xsavec")
>
> Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=351391=351390=351391=diff
>
> ==
> --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Wed Jan 16 14:56:25 2019
> @@ -9833,7 +9833,9 @@ Value *CodeGenFunction::EmitX86BuiltinEx
>case X86::BI__builtin_ia32_xsavec:
>case X86::BI__builtin_ia32_xsavec64:
>case X86::BI__builtin_ia32_xsaves:
> -  case X86::BI__builtin_ia32_xsaves64: {
> +  case X86::BI__builtin_ia32_xsaves64:
> +  case X86::BI__builtin_ia32_xsetbv:
> +  case X86::BI_xsetbv: {
>  Intrinsic::ID ID;
>  #define INTRINSIC_X86_XSAVE_ID(NAME) \
>  case X86::BI__builtin_ia32_##NAME: \
> @@ -9853,6 +9855,10 @@ Value *CodeGenFunction::EmitX86BuiltinEx
>  INTRINSIC_X86_XSAVE_ID(xsavec64);
>  INTRINSIC_X86_XSAVE_ID(xsaves);
>  INTRINSIC_X86_XSAVE_ID(xsaves64);
> +INTRINSIC_X86_XSAVE_ID(xsetbv);
> +case X86::BI_xsetbv:
> +  ID = Intrinsic::x86_xsetbv;
> +  break;
>  }
>  #undef INTRINSIC_X86_XSAVE_ID
>  Value *Mhi = Builder.CreateTrunc(
> @@ -9862,6 +9868,9 @@ Value *CodeGenFunction::EmitX86BuiltinEx
>  Ops.push_back(Mlo);
>  return Builder.CreateCall(CGM.getIntrinsic(ID), Ops);
>}
> +  case X86::BI__builtin_ia32_xgetbv:
> +  case X86::BI_xgetbv:
> +return Builder.CreateCall(CGM.getIntrinsic(Intrinsic::x86_xgetbv),
> Ops);
>case X86::BI__builtin_ia32_storedqudi128_mask:
>case X86::BI__builtin_ia32_storedqusi128_mask:
>case X86::BI__builtin_ia32_storedquhi128_mask:
>
> Modified: cfe/trunk/lib/Headers/immintrin.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/immintrin.h?rev=351391=351390=351391=diff
>
> ==
> --- cfe/trunk/lib/Headers/immintrin.h (original)
> +++ cfe/trunk/lib/Headers/immintrin.h Wed Jan 16 14:56:25 2019
> @@ -378,9 +378,8 @@ _storebe_i64(void * __P, long long __D)
>  #include 
>  #endif
>
> -#if !defined(_MSC_VER) || 

r346687 - [clang-format] Support breaking consecutive string literals for TableGen

2018-11-12 Thread Jordan Rupprecht via cfe-commits
Author: rupprecht
Date: Mon Nov 12 10:15:04 2018
New Revision: 346687

URL: http://llvm.org/viewvc/llvm-project?rev=346687=rev
Log:
[clang-format] Support breaking consecutive string literals for TableGen

Summary:
clang-format can get confused by string literals in TableGen: it knows that 
strings can be broken up, but doesn't seem to understand how that can be 
indented across line breaks, and arranges them in a weird triangular pattern. 
Take this output example from `clang-format tools/llvm-objcopy/ObjcopyOpts.td` 
(which has now been formatted in rL345896 with this patch applied):

```
defm keep_global_symbols
: Eq<
  "keep-global-symbols", "Reads a list of symbols from  and "
 "runs as if " "--keep-global-symbol= "
   "is set for each one. "
   " " "contains one "
 "symbol per line "
 "and may contain "
 "comments "
 "beginning " "with"
  " '#'"
  ". "
  "Lead"
  "ing "
```

Reviewers: alexshap, MaskRay, djasper

Reviewed By: MaskRay

Subscribers: krasimir, mgorny, cfe-commits

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

Added:
cfe/trunk/unittests/Format/FormatTestTableGen.cpp
Modified:
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/unittests/Format/CMakeLists.txt

Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=346687=346686=346687=diff
==
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Mon Nov 12 10:15:04 2018
@@ -2875,6 +2875,7 @@ bool TokenAnnotator::mustBreakBefore(con
   } else if (Style.Language == FormatStyle::LK_Cpp ||
  Style.Language == FormatStyle::LK_ObjC ||
  Style.Language == FormatStyle::LK_Proto ||
+ Style.Language == FormatStyle::LK_TableGen ||
  Style.Language == FormatStyle::LK_TextProto) {
 if (Left.isStringLiteral() && Right.isStringLiteral())
   return true;

Modified: cfe/trunk/unittests/Format/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/CMakeLists.txt?rev=346687=346686=346687=diff
==
--- cfe/trunk/unittests/Format/CMakeLists.txt (original)
+++ cfe/trunk/unittests/Format/CMakeLists.txt Mon Nov 12 10:15:04 2018
@@ -12,6 +12,7 @@ add_clang_unittest(FormatTests
   FormatTestProto.cpp
   FormatTestRawStrings.cpp
   FormatTestSelective.cpp
+  FormatTestTableGen.cpp
   FormatTestTextProto.cpp
   NamespaceEndCommentsFixerTest.cpp
   SortImportsTestJS.cpp

Added: cfe/trunk/unittests/Format/FormatTestTableGen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestTableGen.cpp?rev=346687=auto
==
--- cfe/trunk/unittests/Format/FormatTestTableGen.cpp (added)
+++ cfe/trunk/unittests/Format/FormatTestTableGen.cpp Mon Nov 12 10:15:04 2018
@@ -0,0 +1,56 @@
+//===- unittest/Format/FormatTestTableGen.cpp 
-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "FormatTestUtils.h"
+#include "clang/Format/Format.h"
+#include "llvm/Support/Debug.h"
+#include "gtest/gtest.h"
+
+#define DEBUG_TYPE "format-test"
+
+namespace clang {
+namespace format {
+
+class FormatTestTableGen : public ::testing::Test {
+protected:
+  static std::string format(llvm::StringRef Code, unsigned Offset,
+unsigned Length, const FormatStyle ) {
+LLVM_DEBUG(llvm::errs() << "---\n");
+LLVM_DEBUG(llvm::errs() << Code << "\n\n");
+std::vector Ranges(1, tooling::Range(Offset, Length));
+tooling::Replacements Replaces = reformat(Style, Code, Ranges);
+auto Result = applyAllReplacements(Code, Replaces);
+EXPECT_TRUE(static_cast(Result));
+LLVM_DEBUG(llvm::errs() << "\n" << *Result << "\n\n");
+return *Result;
+  }
+
+  static std::string format(llvm::StringRef Code) {
+FormatStyle Style = getGoogleStyle(FormatStyle::LK_TableGen);
+Style.ColumnLimit = 60; // To make writing tests easier.
+return 

r343744 - [llvm-nm] Update clang tests based on changed llvm-nm output

2018-10-03 Thread Jordan Rupprecht via cfe-commits
Author: rupprecht
Date: Wed Oct  3 16:40:04 2018
New Revision: 343744

URL: http://llvm.org/viewvc/llvm-project?rev=343744=rev
Log:
[llvm-nm] Update clang tests based on changed llvm-nm output

Modified:
cfe/trunk/test/CodeGen/thinlto_backend.ll

Modified: cfe/trunk/test/CodeGen/thinlto_backend.ll
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/thinlto_backend.ll?rev=343744=343743=343744=diff
==
--- cfe/trunk/test/CodeGen/thinlto_backend.ll (original)
+++ cfe/trunk/test/CodeGen/thinlto_backend.ll Wed Oct  3 16:40:04 2018
@@ -25,7 +25,8 @@
 ; be empty file.
 ; RUN: opt -o %t5.o %s
 ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t4.o -x ir %t5.o -c 
-fthinlto-index=%t.thinlto.bc
-; RUN: llvm-nm %t4.o | count 0
+; RUN: llvm-nm %t4.o | FileCheck %s -check-prefix=NO-SYMBOLS
+; NO-SYMBOLS: no symbols
 
 ; Ensure f2 was imported. Check for all 3 flavors of -save-temps[=cwd|obj].
 ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t3.o -x ir %t1.o -c 
-fthinlto-index=%t.thinlto.bc -save-temps=obj


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


Re: r342053 - [CodeGen] Align rtti and vtable data

2018-09-17 Thread Jordan Rupprecht via cfe-commits
> Interesting, what kind of failures?
>
> If they are causing you problems, of course feel free to revert.
>
> Dave

Turns out they are all real issues which running the test under asan
mode flags as global-buffer-overflow. I'm guessing the over-alignment
was hiding the bug as reads there would be zero initialized, but now
they are reading other non-zero data and crashing on that.

So, this patch just exposes some buggy code. Let's not revert it.
Sorry for the false alarm!

-- Jordan


smime.p7s
Description: S/MIME Cryptographic Signature
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r341002 - [AttrDocs] Fix build bots: add missing GNUInline pragma to test.

2018-08-29 Thread Jordan Rupprecht via cfe-commits
Author: rupprecht
Date: Wed Aug 29 17:04:34 2018
New Revision: 341002

URL: http://llvm.org/viewvc/llvm-project?rev=341002=rev
Log:
[AttrDocs] Fix build bots: add missing GNUInline pragma to test.

Modified:
cfe/trunk/test/Misc/pragma-attribute-supported-attributes-list.test

Modified: cfe/trunk/test/Misc/pragma-attribute-supported-attributes-list.test
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/pragma-attribute-supported-attributes-list.test?rev=341002=341001=341002=diff
==
--- cfe/trunk/test/Misc/pragma-attribute-supported-attributes-list.test 
(original)
+++ cfe/trunk/test/Misc/pragma-attribute-supported-attributes-list.test Wed Aug 
29 17:04:34 2018
@@ -2,7 +2,7 @@
 
 // The number of supported attributes should never go down!
 
-// CHECK: #pragma clang attribute supports 74 attributes:
+// CHECK: #pragma clang attribute supports 75 attributes:
 // CHECK-NEXT: AMDGPUFlatWorkGroupSize (SubjectMatchRule_function)
 // CHECK-NEXT: AMDGPUNumSGPR (SubjectMatchRule_function)
 // CHECK-NEXT: AMDGPUNumVGPR (SubjectMatchRule_function)
@@ -31,6 +31,7 @@
 // CHECK-NEXT: ExternalSourceSymbol ((SubjectMatchRule_record, 
SubjectMatchRule_enum, SubjectMatchRule_enum_constant, SubjectMatchRule_field, 
SubjectMatchRule_function, SubjectMatchRule_namespace, 
SubjectMatchRule_objc_category, SubjectMatchRule_objc_interface, 
SubjectMatchRule_objc_method, SubjectMatchRule_objc_property, 
SubjectMatchRule_objc_protocol, SubjectMatchRule_record, 
SubjectMatchRule_type_alias, SubjectMatchRule_variable))
 // CHECK-NEXT: FlagEnum (SubjectMatchRule_enum)
 // CHECK-NEXT: Flatten (SubjectMatchRule_function)
+// CHECK-NEXT: GNUInline (SubjectMatchRule_function)
 // CHECK-NEXT: IFunc (SubjectMatchRule_function)
 // CHECK-NEXT: InternalLinkage (SubjectMatchRule_variable, 
SubjectMatchRule_function, SubjectMatchRule_record)
 // CHECK-NEXT: LTOVisibilityPublic (SubjectMatchRule_record)


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


[libunwind] r339899 - NFC: Test commit access

2018-08-16 Thread Jordan Rupprecht via cfe-commits
Author: rupprecht
Date: Thu Aug 16 09:55:07 2018
New Revision: 339899

URL: http://llvm.org/viewvc/llvm-project?rev=339899=rev
Log:
NFC: Test commit access

Testing commit access from a new machine, so using this as an opportunity to 
revert my old test access commit (r336006) that I never cleaned up.

Modified:
libunwind/trunk/docs/README.txt

Modified: libunwind/trunk/docs/README.txt
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/docs/README.txt?rev=339899=339898=339899=diff
==
--- libunwind/trunk/docs/README.txt (original)
+++ libunwind/trunk/docs/README.txt Thu Aug 16 09:55:07 2018
@@ -11,4 +11,3 @@ To build the documents into html configu
 
 After configuring libunwind with these options the make rule 
`docs-libunwind-html`
 should be available.
-


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


[libcxx] r338157 - [libc++] Exclude posix_l/strtonum fallback inclusion for newlib > 2.4

2018-07-27 Thread Jordan Rupprecht via cfe-commits
Author: rupprecht
Date: Fri Jul 27 13:02:58 2018
New Revision: 338157

URL: http://llvm.org/viewvc/llvm-project?rev=338157=rev
Log:
[libc++] Exclude posix_l/strtonum fallback inclusion for newlib > 2.4

Summary:
[libc++] Exclude posix_l/strtonum fallback inclusion for newlib > 2.4

r338122 changed the linkage of some methods which revealed an existing ODR 
violation, e.g.:
projects/libcxx/include/support/xlocale/__posix_l_fallback.h:83:38: error: 
'internal_linkage' attribute does not appear on the first declaration of 
'iswcntrl_l'
inline _LIBCPP_INLINE_VISIBILITY int iswcntrl_l(wint_t c, locale_t) {
 ^
lib/include/wctype.h:55:12: note: previous definition is here
extern int  iswcntrl_l (wint_t, locale_t);

These were added to newlib in 2.4 [1] [2], so move them to the already existing 
include guard.

[1] 
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;a=commit;h=238455adfab4f8070ac65400aac22bb8a9e502fc
[2] 
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;a=commit;h=8493c1631643fada62384768408852bc0fa6ff44

Reviewers: ldionne, rsmith, EricWF

Subscribers: christof, cfe-commits

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

Modified:
libcxx/trunk/include/support/newlib/xlocale.h

Modified: libcxx/trunk/include/support/newlib/xlocale.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/support/newlib/xlocale.h?rev=338157=338156=338157=diff
==
--- libcxx/trunk/include/support/newlib/xlocale.h (original)
+++ libcxx/trunk/include/support/newlib/xlocale.h Fri Jul 27 13:02:58 2018
@@ -19,9 +19,9 @@
 #if !defined(__NEWLIB__) || __NEWLIB__ < 2 || \
 __NEWLIB__ == 2 && __NEWLIB_MINOR__ < 5
 #include 
-#endif
 #include 
 #include 
+#endif
 
 #endif // _NEWLIB_VERSION
 


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


Re: r337850 - Revert "[VFS] Cleanups to VFS interfaces."

2018-07-25 Thread Jordan Rupprecht via cfe-commits
On Wed, Jul 25, 2018 at 1:40 AM Eric Liu  wrote:

> Please also include a link to the test failure in the commit message or
> this email thread.
>
Sorry, I left the failure on the review thread (
https://reviews.llvm.org/D49724) but forgot to include it in the commit
message. I'll make sure to do that next time!

Build bot logs:
http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/14441/steps/ninja%20check%201
Sample snippet:

[ RUN  ] GoToInclude.All
/home/buildslave/buildslave/clang-cmake-aarch64-quick/llvm/tools/clang/tools/extra/unittests/clangd/XRefsTests.cpp:953:
Failure
Value of: *Locations
Expected: has 1 element that is equal to 0:0-0:0@file:///clangd-test/foo.h
  Actual: {}



>
> On Tue, Jul 24, 2018 at 10:28 PM Jordan Rupprecht via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: rupprecht
>> Date: Tue Jul 24 13:28:07 2018
>> New Revision: 337850
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=337850=rev
>> Log:
>> Revert "[VFS] Cleanups to VFS interfaces."
>>
>> This reverts commit r337834 due to test failures.
>>
>> Modified:
>> cfe/trunk/include/clang/Basic/VirtualFileSystem.h
>> cfe/trunk/lib/Basic/FileManager.cpp
>> cfe/trunk/lib/Basic/VirtualFileSystem.cpp
>>
>> Modified: cfe/trunk/include/clang/Basic/VirtualFileSystem.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/VirtualFileSystem.h?rev=337850=337849=337850=diff
>>
>> ==
>> --- cfe/trunk/include/clang/Basic/VirtualFileSystem.h (original)
>> +++ cfe/trunk/include/clang/Basic/VirtualFileSystem.h Tue Jul 24 13:28:07
>> 2018
>> @@ -45,8 +45,7 @@ class MemoryBuffer;
>>  namespace clang {
>>  namespace vfs {
>>
>> -/// File information from a \p File::status() operation.
>> -/// This is roughly equivalent to a `struct stat` plus a file path.
>> +/// The result of a \p status operation.
>>  class Status {
>>std::string Name;
>>llvm::sys::fs::UniqueID UID;
>> @@ -67,14 +66,13 @@ public:
>>   llvm::sys::TimePoint<> MTime, uint32_t User, uint32_t Group,
>>   uint64_t Size, llvm::sys::fs::file_type Type,
>>   llvm::sys::fs::perms Perms);
>> -  Status(const llvm::sys::fs::file_status , StringRef Name);
>>
>> -  /// Get a copy of a this Status with a different name.
>> -  Status copyWithNewName(StringRef NewName);
>> +  /// Get a copy of a Status with a different name.
>> +  static Status copyWithNewName(const Status , StringRef NewName);
>> +  static Status copyWithNewName(const llvm::sys::fs::file_status ,
>> +StringRef NewName);
>>
>>/// Returns the name that should be used for this file or directory.
>> -  /// This is usually the path that the file was opened as, without
>> resolving
>> -  /// relative paths or symlinks.
>>StringRef getName() const { return Name; }
>>
>>/// @name Status interface from llvm::sys::fs
>> @@ -109,16 +107,15 @@ public:
>>virtual ~File();
>>
>>/// Get the status of the file.
>> -  /// This may access the filesystem (e.g. `stat()`), or return a cached
>> value.
>>virtual llvm::ErrorOr status() = 0;
>>
>> -  /// Get the "real name" of the file, if available.
>> -  /// This should be absolute, and typically has symlinks resolved.
>> -  ///
>> -  /// Only some VFS implementations provide this, and only sometimes.
>> -  /// FIXME: these maybe-available semantics are not very useful. It
>> would be
>> -  /// nice if this was more consistent with FileSystem::getRealPath().
>> -  virtual llvm::Optional getRealPath() { return llvm::None;
>> }
>> +  /// Get the name of the file
>> +  virtual llvm::ErrorOr getName() {
>> +if (auto Status = status())
>> +  return Status->getName().str();
>> +else
>> +  return Status.getError();
>> +  }
>>
>>/// Get the contents of the file as a \p MemoryBuffer.
>>virtual llvm::ErrorOr>
>>
>> Modified: cfe/trunk/lib/Basic/FileManager.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/FileManager.cpp?rev=337850=337849=337850=diff
>>
>> ==
>> --- cfe/trunk/lib/Basic/FileManager.cpp (original)
>> +++ cfe/trunk/lib/Basic/FileManager.cpp Tue Jul 24 13:28:07 2018
>> @@ -316,7 +316,7 @@ const FileEntry *FileManager::getFile(St
>>UFE.File = std::move(F);

r337850 - Revert "[VFS] Cleanups to VFS interfaces."

2018-07-24 Thread Jordan Rupprecht via cfe-commits
Author: rupprecht
Date: Tue Jul 24 13:28:07 2018
New Revision: 337850

URL: http://llvm.org/viewvc/llvm-project?rev=337850=rev
Log:
Revert "[VFS] Cleanups to VFS interfaces."

This reverts commit r337834 due to test failures.

Modified:
cfe/trunk/include/clang/Basic/VirtualFileSystem.h
cfe/trunk/lib/Basic/FileManager.cpp
cfe/trunk/lib/Basic/VirtualFileSystem.cpp

Modified: cfe/trunk/include/clang/Basic/VirtualFileSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/VirtualFileSystem.h?rev=337850=337849=337850=diff
==
--- cfe/trunk/include/clang/Basic/VirtualFileSystem.h (original)
+++ cfe/trunk/include/clang/Basic/VirtualFileSystem.h Tue Jul 24 13:28:07 2018
@@ -45,8 +45,7 @@ class MemoryBuffer;
 namespace clang {
 namespace vfs {
 
-/// File information from a \p File::status() operation.
-/// This is roughly equivalent to a `struct stat` plus a file path.
+/// The result of a \p status operation.
 class Status {
   std::string Name;
   llvm::sys::fs::UniqueID UID;
@@ -67,14 +66,13 @@ public:
  llvm::sys::TimePoint<> MTime, uint32_t User, uint32_t Group,
  uint64_t Size, llvm::sys::fs::file_type Type,
  llvm::sys::fs::perms Perms);
-  Status(const llvm::sys::fs::file_status , StringRef Name);
 
-  /// Get a copy of a this Status with a different name.
-  Status copyWithNewName(StringRef NewName);
+  /// Get a copy of a Status with a different name.
+  static Status copyWithNewName(const Status , StringRef NewName);
+  static Status copyWithNewName(const llvm::sys::fs::file_status ,
+StringRef NewName);
 
   /// Returns the name that should be used for this file or directory.
-  /// This is usually the path that the file was opened as, without resolving
-  /// relative paths or symlinks.
   StringRef getName() const { return Name; }
 
   /// @name Status interface from llvm::sys::fs
@@ -109,16 +107,15 @@ public:
   virtual ~File();
 
   /// Get the status of the file.
-  /// This may access the filesystem (e.g. `stat()`), or return a cached value.
   virtual llvm::ErrorOr status() = 0;
 
-  /// Get the "real name" of the file, if available.
-  /// This should be absolute, and typically has symlinks resolved.
-  ///
-  /// Only some VFS implementations provide this, and only sometimes.
-  /// FIXME: these maybe-available semantics are not very useful. It would be
-  /// nice if this was more consistent with FileSystem::getRealPath().
-  virtual llvm::Optional getRealPath() { return llvm::None; }
+  /// Get the name of the file
+  virtual llvm::ErrorOr getName() {
+if (auto Status = status())
+  return Status->getName().str();
+else
+  return Status.getError();
+  }
 
   /// Get the contents of the file as a \p MemoryBuffer.
   virtual llvm::ErrorOr>

Modified: cfe/trunk/lib/Basic/FileManager.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/FileManager.cpp?rev=337850=337849=337850=diff
==
--- cfe/trunk/lib/Basic/FileManager.cpp (original)
+++ cfe/trunk/lib/Basic/FileManager.cpp Tue Jul 24 13:28:07 2018
@@ -316,7 +316,7 @@ const FileEntry *FileManager::getFile(St
   UFE.File = std::move(F);
   UFE.IsValid = true;
   if (UFE.File)
-if (auto RealPathName = UFE.File->getRealPath())
+if (auto RealPathName = UFE.File->getName())
   UFE.RealPathName = *RealPathName;
   return 
 }

Modified: cfe/trunk/lib/Basic/VirtualFileSystem.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/VirtualFileSystem.cpp?rev=337850=337849=337850=diff
==
--- cfe/trunk/lib/Basic/VirtualFileSystem.cpp (original)
+++ cfe/trunk/lib/Basic/VirtualFileSystem.cpp Tue Jul 24 13:28:07 2018
@@ -73,14 +73,16 @@ Status::Status(StringRef Name, UniqueID
 : Name(Name), UID(UID), MTime(MTime), User(User), Group(Group), Size(Size),
   Type(Type), Perms(Perms) {}
 
-Status::Status(const file_status , StringRef NewName)
-: Status(NewName, In.getUniqueID(), In.getLastModificationTime(),
- In.getUser(), In.getGroup(), In.getSize(), In.type(),
- In.permissions()) {}
-
-Status Status::copyWithNewName(StringRef NewName) {
-  return Status(NewName, getUniqueID(), getLastModificationTime(), getUser(),
-getGroup(), getSize(), getType(), getPermissions());
+Status Status::copyWithNewName(const Status , StringRef NewName) {
+  return Status(NewName, In.getUniqueID(), In.getLastModificationTime(),
+In.getUser(), In.getGroup(), In.getSize(), In.getType(),
+In.getPermissions());
+}
+
+Status Status::copyWithNewName(const file_status , StringRef NewName) {
+  return Status(NewName, In.getUniqueID(), In.getLastModificationTime(),
+In.getUser(), In.getGroup(), In.getSize(), In.type(),
+

[libunwind] r336014 - Introduce a separate preprocessor macro, _LIBUNWIND_USE_DLADDR, for directly controlling a dependency on dladdr(). This will allow us to use libunwind without adding a libdl depe

2018-06-29 Thread Jordan Rupprecht via cfe-commits
Author: rupprecht
Date: Fri Jun 29 13:41:50 2018
New Revision: 336014

URL: http://llvm.org/viewvc/llvm-project?rev=336014=rev
Log:
Introduce a separate preprocessor macro, _LIBUNWIND_USE_DLADDR, for directly 
controlling a dependency on dladdr(). This will allow us to use libunwind 
without adding a libdl dependency.

Reviewers: saugustine

Subscribers: christof, chrib, cfe-commits, echristo

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

Modified:
libunwind/trunk/src/AddressSpace.hpp

Modified: libunwind/trunk/src/AddressSpace.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/AddressSpace.hpp?rev=336014=336013=336014=diff
==
--- libunwind/trunk/src/AddressSpace.hpp (original)
+++ libunwind/trunk/src/AddressSpace.hpp Fri Jun 29 13:41:50 2018
@@ -18,7 +18,15 @@
 #include 
 #include 
 
-#if !defined(_LIBUNWIND_IS_BAREMETAL) && !defined(_WIN32)
+#ifndef _LIBUNWIND_USE_DLADDR
+  #if !defined(_LIBUNWIND_IS_BAREMETAL) && !defined(_WIN32)
+#define _LIBUNWIND_USE_DLADDR 1
+  #else
+#define _LIBUNWIND_USE_DLADDR 0
+  #endif
+#endif
+
+#if _LIBUNWIND_USE_DLADDR
 #include 
 #endif
 
@@ -576,7 +584,7 @@ inline bool LocalAddressSpace::findOther
 inline bool LocalAddressSpace::findFunctionName(pint_t addr, char *buf,
 size_t bufLen,
 unw_word_t *offset) {
-#if !defined(_LIBUNWIND_IS_BAREMETAL) && !defined(_WIN32)
+#if _LIBUNWIND_USE_DLADDR
   Dl_info dyldInfo;
   if (dladdr((void *)addr, )) {
 if (dyldInfo.dli_sname != NULL) {


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


[libunwind] r336006 - Add a blank line to docs/README.txt test commit access

2018-06-29 Thread Jordan Rupprecht via cfe-commits
Author: rupprecht
Date: Fri Jun 29 12:05:21 2018
New Revision: 336006

URL: http://llvm.org/viewvc/llvm-project?rev=336006=rev
Log:
Add a blank line to docs/README.txt test commit access

Subscribers: christof, cfe-commits

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

Modified:
libunwind/trunk/docs/README.txt

Modified: libunwind/trunk/docs/README.txt
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/docs/README.txt?rev=336006=336005=336006=diff
==
--- libunwind/trunk/docs/README.txt (original)
+++ libunwind/trunk/docs/README.txt Fri Jun 29 12:05:21 2018
@@ -11,3 +11,4 @@ To build the documents into html configu
 
 After configuring libunwind with these options the make rule 
`docs-libunwind-html`
 should be available.
+


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


[libunwind] r336005 - Revert "Support for multiarch runtimes layout"

2018-06-29 Thread Jordan Rupprecht via cfe-commits
Author: rupprecht
Date: Fri Jun 29 12:05:20 2018
New Revision: 336005

URL: http://llvm.org/viewvc/llvm-project?rev=336005=rev
Log:
Revert "Support for multiarch runtimes layout"

This reverts commit 0c7cea3c0c6338b99e30c13201365a3dd4edc6f4.

Modified:
libunwind/trunk/CMakeLists.txt

Modified: libunwind/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=336005=336004=336005=diff
==
--- libunwind/trunk/CMakeLists.txt (original)
+++ libunwind/trunk/CMakeLists.txt Fri Jun 29 12:05:20 2018
@@ -170,14 +170,7 @@ set(CMAKE_MODULE_PATH
 set(LIBUNWIND_COMPILER${CMAKE_CXX_COMPILER})
 set(LIBUNWIND_SOURCE_DIR  ${CMAKE_CURRENT_SOURCE_DIR})
 set(LIBUNWIND_BINARY_DIR  ${CMAKE_CURRENT_BINARY_DIR})
-
-string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
-   ${PACKAGE_VERSION})
-
-if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
-  set(DEFAULT_INSTALL_PREFIX 
lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/${LLVM_DEFAULT_TARGET_TRIPLE}/)
-  set(LIBUNWIND_LIBRARY_DIR 
${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/${LLVM_DEFAULT_TARGET_TRIPLE}/lib${LLVM_RUNTIMES_LIBDIR_SUFFIX})
-elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
+if (LLVM_LIBRARY_OUTPUT_INTDIR)
   set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
 else()
   set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX})
@@ -187,9 +180,13 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIB
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR})
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR})
 
-set(LIBUNWIND_INSTALL_PREFIX ${DEFAULT_INSTALL_PREFIX} CACHE STRING
+set(LIBUNWIND_INSTALL_PREFIX "" CACHE STRING
 "Define libunwind destination prefix.")
 
+if (NOT LIBUNWIND_INSTALL_PREFIX MATCHES "^$|.*/")
+  message(FATAL_ERROR "LIBUNWIND_INSTALL_PREFIX has to end with \"/\".")
+endif()
+
 set(LIBUNWIND_C_FLAGS "")
 set(LIBUNWIND_CXX_FLAGS "")
 set(LIBUNWIND_COMPILE_FLAGS "")


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