[PATCH] D72463: [Driver][X86] Add -malign-branch* and -mbranches-within-32B-boundaries

2020-01-17 Thread annita.zhang via Phabricator via cfe-commits
annita.zhang added a comment.

In D72463#1826821 , @MaskRay wrote:

> In D72463#1826499 , @annita.zhang 
> wrote:
>
> > @MaskRay Did you merge it to LLVM 10 branch?
>
>
> It is included in the release branch.
>
> `git branch origin/release/10.x --contains 
> 5ca24d09aefaedf8e4148c7fce4b4ab0c4ecc72a  # suceeded`


Thank you!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72463



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


[PATCH] D72972: [WebAssembly] Add experimental multivalue calling ABI

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

{icon times-circle color=red} Unit tests: fail. 61974 tests passed, 2 failed 
and 783 were skipped.

  failed: LLVM.Bindings/Go/go.test
  failed: 
libc++.std/thread/thread_mutex/thread_mutex_requirements/thread_sharedtimedmutex_requirements/thread_sharedtimedmutex_class/try_lock.pass.cpp

{icon question-circle color=gray} clang-tidy: unknown.

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

Build artifacts 
: 
diff.json 
,
 clang-format.patch 
,
 CMakeCache.txt 
,
 console-log.txt 
,
 test-results.xml 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72972



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


[PATCH] D72972: [WebAssembly] Add experimental multivalue calling ABI

2020-01-17 Thread Thomas Lively via Phabricator via cfe-commits
tlively created this revision.
tlively added reviewers: aheejin, dschuff.
Herald added subscribers: cfe-commits, sunfish, jgravelle-google, sbc100.
Herald added a project: clang.

For now, this ABI simply expands all possible aggregate arguments and
returns all possible aggregates directly. This ABI will change rapidly
as we prototype and benchmark a new ABI that takes advantage of
multivalue return and possibly other changes from the MVP ABI.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72972

Files:
  clang/lib/Basic/Targets/WebAssembly.cpp
  clang/lib/Basic/Targets/WebAssembly.h
  clang/lib/CodeGen/TargetInfo.cpp
  clang/test/CodeGen/wasm-arguments.c

Index: clang/test/CodeGen/wasm-arguments.c
===
--- clang/test/CodeGen/wasm-arguments.c
+++ clang/test/CodeGen/wasm-arguments.c
@@ -2,91 +2,130 @@
 // RUN:   | FileCheck %s -check-prefix=WEBASSEMBLY32
 // RUN: %clang_cc1 -triple wasm64-unknown-unknown %s -emit-llvm -o - \
 // RUN:   | FileCheck %s -check-prefix=WEBASSEMBLY64
+// RUN: %clang_cc1 -triple wasm32-unknown-unknown %s -target-abi experimental-mv -emit-llvm -o - \
+// RUN:   | FileCheck %s -check-prefix=EXPERIMENTAL-MV
 
-// Basic argument/attribute tests for WebAssembly
+// Basic argument/attribute and return tests for WebAssembly
 
-// WEBASSEMBLY32: define void @f0(i32 %i, i32 %j, i64 %k, double %l, fp128 %m)
-// WEBASSEMBLY64: define void @f0(i32 %i, i64 %j, i64 %k, double %l, fp128 %m)
-void f0(int i, long j, long long k, double l, long double m) {}
+// WEBASSEMBLY32: define void @misc_args(i32 %i, i32 %j, i64 %k, double %l, fp128 %m)
+// WEBASSEMBLY64: define void @misc_args(i32 %i, i64 %j, i64 %k, double %l, fp128 %m)
+void misc_args(int i, long j, long long k, double l, long double m) {}
 
 typedef struct {
   int aa;
   int bb;
 } s1;
+
 // Structs should be passed byval and not split up.
-// WEBASSEMBLY32: define void @f1(%struct.s1* byval(%struct.s1) align 4 %i)
-// WEBASSEMBLY64: define void @f1(%struct.s1* byval(%struct.s1) align 4 %i)
-void f1(s1 i) {}
+// WEBASSEMBLY32: define void @struct_arg(%struct.s1* byval(%struct.s1) align 4 %i)
+// WEBASSEMBLY64: define void @struct_arg(%struct.s1* byval(%struct.s1) align 4 %i)
+// EXPERIMENTAL-MV: define void @struct_arg(i32 %i.0, i32 %i.1)
+void struct_arg(s1 i) {}
 
-typedef struct {
-  int cc;
-} s2;
-// Single-element structs should be returned as the one element.
-// WEBASSEMBLY32: define i32 @f2()
-// WEBASSEMBLY64: define i32 @f2()
-s2 f2(void) {
-  s2 foo;
+// Structs should be returned sret and not simplified by the frontend.
+// WEBASSEMBLY32: define void @struct_ret(%struct.s1* noalias sret %agg.result)
+// WEBASSEMBLY32: ret void
+// WEBASSEMBLY64: define void @struct_ret(%struct.s1* noalias sret %agg.result)
+// WEBASSEMBLY64: ret void
+// EXPERIMENTAL-MV: define %struct.s1 @struct_ret()
+// EXPERIMENTAL-MV: ret %struct.s1 %0
+s1 struct_ret() {
+  s1 foo;
   return foo;
 }
 
 typedef struct {
   int cc;
-  int dd;
-} s3;
-// Structs should be returned sret and not simplified by the frontend.
-// WEBASSEMBLY32: define void @f3(%struct.s3* noalias sret %agg.result)
-// WEBASSEMBLY64: define void @f3(%struct.s3* noalias sret %agg.result)
-s3 f3(void) {
-  s3 foo;
+} s2;
+
+// Single-element structs should be passed as the one element.
+// WEBASSEMBLY32: define void @single_elem_arg(i32 %i.coerce)
+// WEBASSEMBLY64: define void @single_elem_arg(i32 %i.coerce)
+// EXPERIMENTAL-MV: define void @single_elem_arg(i32 %i.coerce)
+void single_elem_arg(s2 i) {}
+
+// Single-element structs should be passed as the one element.
+// WEBASSEMBLY32: define i32 @single_elem_ret()
+// WEBASSEMBLY32: ret i32
+// WEBASSEMBLY64: define i32 @single_elem_ret()
+// EXPERIMENTAL-MV: define i32 @single_elem_ret()
+s2 single_elem_ret() {
+  s2 foo;
   return foo;
 }
 
-// WEBASSEMBLY32: define void @f4(i64 %i)
-// WEBASSEMBLY64: define void @f4(i64 %i)
-void f4(long long i) {}
+// WEBASSEMBLY32: define void @long_long_arg(i64 %i)
+// WEBASSEMBLY64: define void @long_long_arg(i64 %i)
+void long_long_arg(long long i) {}
 
 // i8/i16 should be signext, i32 and higher should not.
-// WEBASSEMBLY32: define void @f5(i8 signext %a, i16 signext %b)
-// WEBASSEMBLY64: define void @f5(i8 signext %a, i16 signext %b)
-void f5(char a, short b) {}
+// WEBASSEMBLY32: define void @char_short_arg(i8 signext %a, i16 signext %b)
+// WEBASSEMBLY64: define void @char_short_arg(i8 signext %a, i16 signext %b)
+void char_short_arg(char a, short b) {}
 
-// WEBASSEMBLY32: define void @f6(i8 zeroext %a, i16 zeroext %b)
-// WEBASSEMBLY64: define void @f6(i8 zeroext %a, i16 zeroext %b)
-void f6(unsigned char a, unsigned short b) {}
+// WEBASSEMBLY32: define void @uchar_ushort_arg(i8 zeroext %a, i16 zeroext %b)
+// WEBASSEMBLY64: define void @uchar_ushort_arg(i8 zeroext %a, i16 zeroext %b)
+void uchar_ushort_arg(unsigned char a, unsigned short b) {}
 
 enum my_enum {
   ENUM1,
   ENUM2,
   ENUM3,
 };

[PATCH] D72940: Add a support for clang tidy to import another configurations files from .clang-tidy

2020-01-17 Thread Jonas Devlieghere via Phabricator via cfe-commits
JDevlieghere added a comment.

Please upload the diff with full context 
. This would also need a test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72940



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


Buildbot numbers for the week of 01/05/2020 - 01/11/2020

2020-01-17 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the last week of 01/05/2020 -
01/11/2020.

Please see the same data in attached csv files:

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

Thanks

Galina


The longest time each builder was red during the week:
   buildername|  was_red
--+--
 clang-cmake-armv8-lld| 123:28:47
 clang-cmake-armv7-global-isel| 122:07:40
 clang-cmake-armv7-quick  | 121:15:19
 lld-perf-testsuite   | 112:15:10
 clang-cmake-armv7-selfhost   | 77:07:10
 clang-cmake-armv7-selfhost-neon  | 73:23:55
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast   | 61:34:14
 lldb-x64-windows-ninja   | 19:44:53
 clang-hexagon-elf| 15:35:22
 ppc64le-lld-multistage-test  | 08:05:42
 sanitizer-windows| 07:07:40
 clang-native-arm-lnt-perf| 06:06:59
 clang-ppc64le-linux-multistage   | 05:12:02
 sanitizer-ppc64be-linux  | 05:07:04
 clang-with-lto-ubuntu| 04:51:19
 sanitizer-x86_64-linux   | 04:40:22
 clang-s390x-linux-multistage | 04:17:17
 sanitizer-ppc64le-linux  | 04:05:55
 clang-x64-windows-msvc   | 03:56:49
 llvm-clang-x86_64-expensive-checks-debian| 03:33:43
 llvm-clang-win-x-armv7l  | 03:32:26
 llvm-clang-x86_64-expensive-checks-win   | 03:29:52
 lldb-aarch64-ubuntu  | 03:23:52
 llvm-clang-x86_64-expensive-checks-ubuntu| 03:16:04
 clang-with-thin-lto-ubuntu   | 03:11:48
 clang-ppc64be-linux-lnt  | 03:11:29
 clang-ppc64le-linux  | 02:51:19
 lldb-x86_64-debian   | 02:50:27
 lld-x86_64-darwin13  | 02:43:00
 clang-ppc64le-rhel   | 02:25:10
 lld-x86_64-win7  | 02:22:54
 llvm-clang-win-x-aarch64 | 02:11:14
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast | 02:02:52
 sanitizer-x86_64-linux-bootstrap | 01:52:06
 sanitizer-x86_64-linux-fast  | 01:44:05
 clang-cmake-x86_64-avx2-linux| 01:40:43
 clang-ppc64be-linux-multistage   | 01:29:30
 sanitizer-x86_64-linux-bootstrap-msan| 01:24:18
 lld-x86_64-ubuntu-fast   | 01:24:05
 clang-cmake-x86_64-sde-avx512-linux  | 01:20:18
 clang-ppc64be-linux  | 01:18:57
 sanitizer-x86_64-linux-fuzzer| 01:16:38
 clang-x86_64-debian-fast | 01:16:05
 clang-x86_64-debian-new-pass-manager-fast| 01:15:51
 openmp-gcc-x86_64-linux-debian   | 01:13:37
 sanitizer-x86_64-linux-bootstrap-ubsan   | 01:13:10
 clang-ppc64le-linux-lnt  | 01:09:13
 openmp-clang-x86_64-linux-debian | 01:05:19
 llvm-sphinx-docs | 00:55:57
 sanitizer-x86_64-linux-android   | 00:54:24
 clang-s390x-linux-lnt| 00:41:37
 clang-atom-d525-fedora-rel   | 00:34:07
 clang-s390x-linux| 00:23:59
 clang-tools-sphinx-docs  | 00:20:12
(54 rows)


"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green):
   buildername   | builds | changes
| status_change_ratio
-++-+
 sanitizer-x86_64-linux  | 86 |  25
|29.1
 libcxx-libcxxabi-libunwind-armv7-linux-noexceptions |  4 |   1
|25.0
 libcxx-libcxxabi-libunwind-armv7-linux  |  4 |   1
|25.0
 clang-hexagon-elf   | 10 |   2
|20.0
 libcxx-libcxxabi-x86_64-linux-ubuntu-gcc-tot-latest-std |  8 |   1
|12.5
 libcxx-libcxxabi-x86_64-linux-ubuntu-gcc5-cxx11 |  8 |   1
|12.5
 

[PATCH] D72970: clang: Only define OBJC_NEW_PROPERTIES when -x objective-c

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

LGTM


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

https://reviews.llvm.org/D72970



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


[PATCH] D72970: clang: Only define OBJC_NEW_PROPERTIES when -x objective-c

2020-01-17 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith created this revision.
dexonsmith added reviewers: rjmccall, arphaman.
Herald added a subscriber: ributzka.

Since 2009 (in r63846) we've been `#define`-ing OBJC_NEW_PROPERTIES all
the time on Darwin, but this macro only makes sense for `-x objective-c`
and `-x objective-c++`.  Restrict it to those cases (for which there is
already separate logic).

rdar://problem/10050342


https://reviews.llvm.org/D72970

Files:
  clang/lib/Basic/Targets/OSTargets.cpp
  clang/test/Preprocessor/init.c


Index: clang/test/Preprocessor/init.c
===
--- clang/test/Preprocessor/init.c
+++ clang/test/Preprocessor/init.c
@@ -187,6 +187,7 @@
 //
 //
 // RUN: %clang_cc1 -x objective-c -E -dM < /dev/null | FileCheck 
-match-full-lines -check-prefix OBJC %s
+// RUN: %clang_cc1 -x objective-c++ -E -dM < /dev/null | FileCheck 
-match-full-lines -check-prefix OBJC %s
 //
 // OBJC:#define OBJC_NEW_PROPERTIES 1
 // OBJC:#define __NEXT_RUNTIME__ 1
@@ -9272,6 +9273,7 @@
 // RUN:   -fgnuc-version=4.2.1 -triple=aarch64-apple-macosx10.12 < /dev/null \
 // RUN: | FileCheck -check-prefix=DARWIN %s
 
+// DARWIN-NOT: OBJC_NEW_PROPERTIES
 // DARWIN:#define __STDC_NO_THREADS__ 1
 
 // RUN: %clang_cc1 -triple i386-apple-macosx -ffreestanding -dM -E /dev/null 
-o - | FileCheck -match-full-lines -check-prefix MACOS-32 %s
Index: clang/lib/Basic/Targets/OSTargets.cpp
===
--- clang/lib/Basic/Targets/OSTargets.cpp
+++ clang/lib/Basic/Targets/OSTargets.cpp
@@ -25,7 +25,7 @@
   Builder.defineMacro("__APPLE_CC__", "6000");
   Builder.defineMacro("__APPLE__");
   Builder.defineMacro("__STDC_NO_THREADS__");
-  Builder.defineMacro("OBJC_NEW_PROPERTIES");
+
   // AddressSanitizer doesn't play well with source fortification, which is on
   // by default on Darwin.
   if (Opts.Sanitize.has(SanitizerKind::Address))


Index: clang/test/Preprocessor/init.c
===
--- clang/test/Preprocessor/init.c
+++ clang/test/Preprocessor/init.c
@@ -187,6 +187,7 @@
 //
 //
 // RUN: %clang_cc1 -x objective-c -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix OBJC %s
+// RUN: %clang_cc1 -x objective-c++ -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix OBJC %s
 //
 // OBJC:#define OBJC_NEW_PROPERTIES 1
 // OBJC:#define __NEXT_RUNTIME__ 1
@@ -9272,6 +9273,7 @@
 // RUN:   -fgnuc-version=4.2.1 -triple=aarch64-apple-macosx10.12 < /dev/null \
 // RUN: | FileCheck -check-prefix=DARWIN %s
 
+// DARWIN-NOT: OBJC_NEW_PROPERTIES
 // DARWIN:#define __STDC_NO_THREADS__ 1
 
 // RUN: %clang_cc1 -triple i386-apple-macosx -ffreestanding -dM -E /dev/null -o - | FileCheck -match-full-lines -check-prefix MACOS-32 %s
Index: clang/lib/Basic/Targets/OSTargets.cpp
===
--- clang/lib/Basic/Targets/OSTargets.cpp
+++ clang/lib/Basic/Targets/OSTargets.cpp
@@ -25,7 +25,7 @@
   Builder.defineMacro("__APPLE_CC__", "6000");
   Builder.defineMacro("__APPLE__");
   Builder.defineMacro("__STDC_NO_THREADS__");
-  Builder.defineMacro("OBJC_NEW_PROPERTIES");
+
   // AddressSanitizer doesn't play well with source fortification, which is on
   // by default on Darwin.
   if (Opts.Sanitize.has(SanitizerKind::Address))
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D72903: [HIP] use GetProgramPath for executable discovery

2020-01-17 Thread Holger Wünsche via Phabricator via cfe-commits
DieGoldeneEnte added a comment.

If @yaxunl has no objections, could someone merge this as I don't have commit 
access?
Also do we want to also apply this to older versions, since the change is 
trivial? I confirmed the same problem is in clang 8, 9 and 10 and am certain it 
is in clang 7, although I didn't test it, because I don't have appropriate 
device-libs at hand.


Repository:
  rC Clang

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

https://reviews.llvm.org/D72903



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


[PATCH] D72675: [Clang][Driver] Fix -ffast-math/-ffp-contract interaction

2020-01-17 Thread Warren Ristow via Phabricator via cfe-commits
wristow updated this revision to Diff 238933.
wristow added a comment.

Updated patch to correct a comment and fix a typo.

Regarding the point from @spatel :

> This follows the reasoning from the earlier discussion, but after re-reading 
> the gcc comment in particular, I'm wondering whether this is what we really 
> want to do...
>  If `__FAST_MATH__` is purely here for compatibility with gcc, then should we 
> mimic gcc behavior in setting that macro even if we think it's buggy?

Thinking about it, yes, I think we should mimic GCC.  FTR, I've tried some 
older GCCs via Compiler Explorer, and found them to be consistent in that 
removing //some// aspects of `-ffast-math` disables the generation of 
`__FAST_MATH__` and removing other aspects of it does not.  So my previous 
recollection ("I could have sworn that in the past that for GCC I had seen this 
sort of disabling of part of the "fast-math set" result in the disabling of the 
def of `__FAST_MATH__`.") is wrong.  Bottom line, maybe it's not a bug in GCC, 
and instead it's the desired GCC behavior (just that I cannot find specific 
documentation of precisely which settings disable the generation of it).

However, I'd call that a bigger question than this `-ffp-contract` aspect of 
`__FAST_MATH__`, and a separate bug, that can be fixed separately.

> Ie, when we translate these settings to LLVM's FMF, we can still override the 
> -ffast-math flag by checking the -ffp-contract flag (if I'm seeing it 
> correctly, the existing code will pass that alongside -ffast-math when 
> contract is set to on/off).

How to handle this seems like an implementation question.  The code here is 
just deciding whether or not we intend to pass "-ffast-math" to cc1 (it isn't 
directly defining `__FAST_MATH__`).  If we do pass it to cc1, then 
"clang/lib/Frontend/InitPreprocessor.cpp" will pre-define `__FAST_MATH__`:

  if (LangOpts.FastMath)
Builder.defineMacro("__FAST_MATH__");

It seems to me that a straightforward way to deal with this question is to make 
the above test more elaborate (that is, if `LangOpts.FastMath` is set, OR 
whatever the appropriate subset of fast-math switches are set).  If we do that, 
we don't need to deal with the "umbrella" aspect if "-fast-math", which gets 
messy.

Which is to say the approach here can stay the same as it currently is 
(`-ffp-contract=off/on` suppressing the passing of "-ffast-math" to cc1).  
Although the comment about `__FAST_MATH__` here in "Clang.cpp" should be 
changed, if we take this approach.


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

https://reviews.llvm.org/D72675

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/fast-math.c


Index: clang/test/Driver/fast-math.c
===
--- clang/test/Driver/fast-math.c
+++ clang/test/Driver/fast-math.c
@@ -180,6 +180,21 @@
 // CHECK-FAST-MATH: "-ffast-math"
 // CHECK-FAST-MATH: "-ffinite-math-only"
 //
+// -ffp-contract=off and -ffp-contract=on must disable the fast-math umbrella,
+// and the unsafe-fp-math umbrella (-ffp-contract=fast leaves them enabled).
+// RUN: %clang -### -ffast-math -ffp-contract=off -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-FAST-MATH %s
+// RUN: %clang -### -ffast-math -ffp-contract=off -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
+// RUN: %clang -### -ffast-math -ffp-contract=on -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-FAST-MATH %s
+// RUN: %clang -### -ffast-math -ffp-contract=on -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
+// RUN: %clang -### -ffast-math -ffp-contract=fast -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-FAST-MATH %s
+// RUN: %clang -### -ffast-math -ffp-contract=fast -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-UNSAFE-MATH %s
+//
 // RUN: %clang -### -ffast-math -fno-fast-math -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-FAST-MATH %s
 // RUN: %clang -### -ffast-math -fno-finite-math-only -c %s 2>&1 \
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -2760,8 +2760,11 @@
   if (MathErrno)
 CmdArgs.push_back("-fmath-errno");
 
+  // If -ffp-contract=off/on has been specified on the command line, then we
+  // must suppress the emission of -ffast-math and -menable-unsafe-fp-math to
+  // cc1.
   if (!MathErrno && AssociativeMath && ReciprocalMath && !SignedZeros &&
-  !TrappingMath)
+  !TrappingMath && !(FPContract.equals("off") || FPContract.equals("on")))
 CmdArgs.push_back("-menable-unsafe-fp-math");
 
   if (!SignedZeros)
@@ -2804,7 +2807,8 @@
   // that's consistent with gcc's behaviour.
   if (!HonorINFs && !HonorNaNs && !MathErrno && AssociativeMath &&
   ReciprocalMath && !SignedZeros && !TrappingMath && !RoundingFPMath) {
-  

[PATCH] D72806: [HIP] fix paths for executables not in clang bin directory

2020-01-17 Thread Holger Wünsche via Phabricator via cfe-commits
DieGoldeneEnte abandoned this revision.
DieGoldeneEnte added a comment.

Adding the paths for llvm/lld is not needed, because GetProgramPath is actually 
also searching in $PATH. This means D72903  
already is enough to fix my problem.


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

https://reviews.llvm.org/D72806



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


[PATCH] D69878: Consoldiate internal denormal flushing controls

2020-01-17 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm closed this revision.
arsenm added a comment.

a4451d88ee456304c26d552749aea6a7f5154bde 



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

https://reviews.llvm.org/D69878



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


[PATCH] D67161: [clang,ARM] Initial ACLE intrinsics for MVE.

2020-01-17 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

`ArmMveAliasValid` is the second slowest function to compile in all of clang, 
according to ClangBuildAnalyzer: https://reviews.llvm.org/P8185

We shouldn't spend 28 CPU seconds per rebuild on a switch. Please do something 
to speed it up. Generally, it is best to emit tables instead of code whenever 
possible.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67161



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


[PATCH] D69825: [Clang][Driver] Re-use the calling process instead of creating a new process for the cc1 invocation

2020-01-17 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added subscribers: phosek, NoQ, haowei, xazax.hun.
xazax.hun added a comment.

Hi!

This patch breaks scan-build-py which parses the output of "-###" to get -cc1 
command. There might be other tools with the same problems. Could we either 
remove `(in-process)` from `CC1Command::Print` or add a line break?

Having the last line as a valid invocation is valuable and there might be tools 
relying on that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69825



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


[PATCH] D65042: [Concept] Placeholder constraints and abbreviated templates

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

I've left some comments suggesting how to rebase this on 
rGa42fd84cff265b7e9faa3fe42885ee171393e4db 
; 
otherwise, some minor changes then this looks good to me. Thanks!




Comment at: clang/include/clang/AST/Type.h:4883-4889
+  const TemplateArgument *getArgBuffer() const {
+return reinterpret_cast(this+1);
+  }
+
+  TemplateArgument *getArgBuffer() {
+return reinterpret_cast(this+1);
   }

Can you use `llvm::TrailingArguments` here?



Comment at: clang/include/clang/Basic/DiagnosticParseKinds.td:1343
+def err_placeholder_missing_auto_after_type_constraint : Error<
+  "ISO C++2a requires 'auto' after a concept name for placeholders">;
+def err_placeholder_decltype_non_auto : Error<

rsmith wrote:
> We usually only use this "ISO C++xy requires [...]" formulation in 
> diagnostics for something we support as a language extension (effectively, 
> when distinguishing between "ISO C++ requires this" and "Clang requires 
> this").
This is still using an improper formulation; we don't permit this as an 
extension, so we shouldn't be saying "ISO C++2a requires". Also, this is not 
quite accurate: we expect 'auto' or 'decltype(auto)' here.

Let's just use the same diagnostic for this case and the one below. I'd also 
put 'auto' first because it's going to be the more common choice. I don't think 
it's problematic that we'll say "expected 'auto' or 'decltype(auto)' [...]" for 
`ConceptName decltype(x)`; that still seems clear enough to me.



Comment at: clang/lib/AST/ASTContext.cpp:852-853
   }
+  if (AutoType *AT = T->getContainedAutoType())
+if (AT->isConstrained())
+  Param->setPlaceholderTypeConstraint(

Add braces here please.



Comment at: clang/lib/Basic/CMakeLists.txt:24
 add_custom_command(OUTPUT "${version_inc}"
-  DEPENDS "${llvm_vc}" "${clang_vc}" "${generate_vcs_version_script}"
   COMMAND ${CMAKE_COMMAND} "-DNAMES=\"LLVM;CLANG\""

This change doesn't look like it should be part of this commit; please revert.



Comment at: clang/lib/Parse/ParseDecl.cpp:3251
   if (!TypeRep) {
+if (TryAnnotateTypeConstraint(SS))
+  goto DoneWithDeclSpec;

You no longer need to pass in `SS` here; `TryAnnotateTypeConstraint` will read 
it from the token stream itself.



Comment at: clang/lib/Parse/ParseTemplate.cpp:680-751
 bool Parser::TryAnnotateTypeConstraint(CXXScopeSpec ) {
-  if (!getLangOpts().ConceptsTS || Tok.isNot(tok::identifier))
+  if (!getLangOpts().ConceptsTS)
 return false;
+  if (ParseOptionalCXXScopeSpecifier(SS, ParsedType(),
+ /*EnteringContext=*/false,
+ /*MayBePseudoDestructor=*/nullptr,
+ // If this is not a type-constraint, then

I've pushed a change rearranging this function; the changes here shouldn't be 
necessary any more.



Comment at: clang/lib/Parse/ParseTentative.cpp:1542-1544
+  if (Tok.is(tok::annot_template_id))
+// Probably a type-constraint
+return isCXXDeclarationSpecifier(BracedCastResult, InvalidAsDeclSpec);

This should now be unreachable. You should instead handle the case of an 
`annot_cxxscope` followed by an `annot_template_id`.



Comment at: clang/lib/Parse/Parser.cpp:1746-1748
+if (Next.is(tok::less))
+  // We have a concept name followed by '<'.
+  ConsumeToken();

This doesn't look right: `AnnotateTemplateIdToken` will consume the `<` for 
itself, and uses that to determine whether it has a template argument list or 
not. It looks like this will mishandle `Concept` and require instead 
`Concept< ` in the contexts where we call `TryAnnotateName`. Please 
check you have test coverage for those cases.



Comment at: clang/lib/Parse/Parser.cpp:2011-2013
+} else if (TemplateId->Kind == TNK_Concept_template) {
+  // Leave the template-id annotation as-is for type-constraints etc.
+  return false;

Remove this; we should put back the scope token in this case too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65042



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


[PATCH] D72875: [clang][cmake] Include generated rst files in html built by docs-clang-html target

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

{icon check-circle color=green} Unit tests: pass. 61925 tests passed, 0 failed 
and 783 were skipped.

{icon question-circle color=gray} clang-tidy: unknown.

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

Build artifacts 
: 
diff.json 
,
 clang-format.patch 
,
 CMakeCache.txt 
,
 console-log.txt 
,
 test-results.xml 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72875



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


[PATCH] D72875: [clang][cmake] Include generated rst files in html built by docs-clang-html target

2020-01-17 Thread Tom Stellard via Phabricator via cfe-commits
tstellar updated this revision to Diff 238914.
tstellar marked 2 inline comments as done.
tstellar added a comment.

- Add quotes around ${CMAKE_CURRENT_SOURCE_DIR}


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72875

Files:
  clang/docs/AttributeReference.rst
  clang/docs/CMakeLists.txt
  llvm/cmake/modules/AddSphinxTarget.cmake


Index: llvm/cmake/modules/AddSphinxTarget.cmake
===
--- llvm/cmake/modules/AddSphinxTarget.cmake
+++ llvm/cmake/modules/AddSphinxTarget.cmake
@@ -18,6 +18,7 @@
 #
 # ``project`` should be the project name
 function (add_sphinx_target builder project)
+  cmake_parse_arguments(ARG "" "SOURCE_DIR" "" ${ARGN})
   set(SPHINX_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/${builder}")
   set(SPHINX_DOC_TREE_DIR 
"${CMAKE_CURRENT_BINARY_DIR}/_doctrees-${project}-${builder}")
   set(SPHINX_TARGET_NAME docs-${project}-${builder})
@@ -28,13 +29,17 @@
 set(SPHINX_WARNINGS_AS_ERRORS_FLAG "")
   endif()
 
+  if (NOT ARG_SOURCE_DIR)
+set(ARG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+  endif()
+
   add_custom_target(${SPHINX_TARGET_NAME}
 COMMAND ${SPHINX_EXECUTABLE}
 -b ${builder}
 -d "${SPHINX_DOC_TREE_DIR}"
 -q # Quiet: no output other than errors and 
warnings.
 ${SPHINX_WARNINGS_AS_ERRORS_FLAG} # Treat warnings 
as errors if requested
-"${CMAKE_CURRENT_SOURCE_DIR}" # Source
+"${ARG_SOURCE_DIR}" # Source
 "${SPHINX_BUILD_DIR}" # Output
 COMMENT
 "Generating ${builder} Sphinx documentation for ${project} 
into \"${SPHINX_BUILD_DIR}\"")
Index: clang/docs/CMakeLists.txt
===
--- clang/docs/CMakeLists.txt
+++ clang/docs/CMakeLists.txt
@@ -90,15 +90,40 @@
 endif()
 endif()
 
+function (gen_rst_file output_file td_option source)
+  get_filename_component(TABLEGEN_INCLUDE_DIR 
"${CMAKE_CURRENT_SOURCE_DIR}/${source}" DIRECTORY)
+  list(APPEND LLVM_TABLEGEN_FLAGS "-I${TABLEGEN_INCLUDE_DIR}")
+  clang_tablegen(${output_file} ${td_option} SOURCE ${source} TARGET 
"gen-${output_file}")
+  add_dependencies(docs-clang-html "gen-${output_file}")
+endfunction()
+
 if (LLVM_ENABLE_SPHINX)
   include(AddSphinxTarget)
   if (SPHINX_FOUND)
 if (${SPHINX_OUTPUT_HTML})
-  add_sphinx_target(html clang)
+  add_sphinx_target(html clang SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR})
+
+  # Copy rst files to build directory before generating the html
+  # documentation.  Some of the rst files are generated, so they
+  # only exist in the build directory.  Sphinx needs all files in
+  # the same directory in order to genrate the html, so we need to
+  # copy all the non-gnerated rst files from the source to the build
+  # directory before we run sphinx.
+  add_custom_target(copy-clang-rst-docs
+COMMAND ${CMAKE_COMMAND} -E copy_directory
+${CMAKE_CURRENT_SOURCE_DIR}
+${CMAKE_CURRENT_BINARY_DIR})
+  add_dependencies(docs-clang-html copy-clang-rst-docs)
+
   add_custom_command(TARGET docs-clang-html POST_BUILD
 COMMAND ${CMAKE_COMMAND} -E copy
 "${CMAKE_CURRENT_SOURCE_DIR}/LibASTMatchersReference.html"
 "${CMAKE_CURRENT_BINARY_DIR}/html/LibASTMatchersReference.html")
+
+  # Generated files
+  gen_rst_file(AttributeReference.rst -gen-attr-docs 
../include/clang/Basic/Attr.td)
+  gen_rst_file(DiagnosticsReference.rst -gen-diag-docs 
../include/clang/Basic/Diagnostic.td)
+  gen_rst_file(ClangCommandLineReference.rst -gen-opt-docs 
../include/clang/Driver/ClangOptionDocs.td)
 endif()
 if (${SPHINX_OUTPUT_MAN})
   add_sphinx_target(man clang)
Index: clang/docs/AttributeReference.rst
===
--- clang/docs/AttributeReference.rst
+++ /dev/null
@@ -1,13 +0,0 @@
-..
-  ---
-  NOTE: This file is automatically generated by running clang-tblgen
-  -gen-attr-docs. Do not edit this file by hand!! The contents for
-  this file are automatically generated by a server-side process.
-  
-  Please do not commit this file. The file exists for local testing
-  purposes only.
-  ---
-
-===
-Attributes in Clang
-===
\ No newline at end of file


Index: llvm/cmake/modules/AddSphinxTarget.cmake
===
--- llvm/cmake/modules/AddSphinxTarget.cmake
+++ llvm/cmake/modules/AddSphinxTarget.cmake
@@ -18,6 +18,7 @@
 #
 # ``project`` should be the project name
 function (add_sphinx_target builder 

[clang] a42fd84 - Remove redundant CXXScopeSpec from TemplateIdAnnotation.

2020-01-17 Thread Richard Smith via cfe-commits

Author: Richard Smith
Date: 2020-01-17T15:47:21-08:00
New Revision: a42fd84cff265b7e9faa3fe42885ee171393e4db

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

LOG: Remove redundant CXXScopeSpec from TemplateIdAnnotation.

A TemplateIdAnnotation represents only a template-id, not a
nested-name-specifier plus a template-id. Don't make a redundant copy of
the CXXScopeSpec and store it on the template-id annotation.

This slightly improves error recovery by more properly handling the case
where we would form an invalid CXXScopeSpec while parsing a typename
specifier, instead of accidentally putting the token stream into a
broken "annot_template_id with a scope specifier, but with no preceding
annot_cxxscope token" state.

Added: 


Modified: 
clang/include/clang/Parse/Parser.h
clang/include/clang/Sema/ParsedTemplate.h
clang/include/clang/Sema/Sema.h
clang/lib/Parse/ParseDecl.cpp
clang/lib/Parse/ParseDeclCXX.cpp
clang/lib/Parse/ParseExpr.cpp
clang/lib/Parse/ParseExprCXX.cpp
clang/lib/Parse/ParseTemplate.cpp
clang/lib/Parse/ParseTentative.cpp
clang/lib/Parse/Parser.cpp
clang/lib/Sema/SemaExprCXX.cpp
clang/lib/Sema/SemaTemplate.cpp
clang/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr/p2.cpp
clang/test/Parser/cxx-decl.cpp
clang/test/SemaTemplate/ms-delayed-default-template-args.cpp
clang/test/SemaTemplate/rdar9173693.cpp

Removed: 




diff  --git a/clang/include/clang/Parse/Parser.h 
b/clang/include/clang/Parse/Parser.h
index b7bed4713992..182024ea5108 100644
--- a/clang/include/clang/Parse/Parser.h
+++ b/clang/include/clang/Parse/Parser.h
@@ -3079,13 +3079,13 @@ class Parser : public CodeCompletionHandler {
SourceLocation );
   bool ParseTemplateParameterList(unsigned Depth,
   SmallVectorImpl );
-  bool isStartOfTemplateTypeParameter(bool );
+  TPResult isStartOfTemplateTypeParameter();
   NamedDecl *ParseTemplateParameter(unsigned Depth, unsigned Position);
   NamedDecl *ParseTypeParameter(unsigned Depth, unsigned Position);
   NamedDecl *ParseTemplateTemplateParameter(unsigned Depth, unsigned Position);
   NamedDecl *ParseNonTypeTemplateParameter(unsigned Depth, unsigned Position);
   bool isTypeConstraintAnnotation();
-  bool TryAnnotateTypeConstraint(CXXScopeSpec );
+  bool TryAnnotateTypeConstraint();
   NamedDecl *
   ParseConstrainedTemplateTypeParameter(unsigned Depth, unsigned Position);
   void DiagnoseMisplacedEllipsis(SourceLocation EllipsisLoc,
@@ -3111,7 +3111,8 @@ class Parser : public CodeCompletionHandler {
UnqualifiedId ,
bool AllowTypeAnnotation = true,
bool TypeConstraint = false);
-  void AnnotateTemplateIdTokenAsType(bool IsClassName = false);
+  void AnnotateTemplateIdTokenAsType(CXXScopeSpec ,
+ bool IsClassName = false);
   bool ParseTemplateArgumentList(TemplateArgList );
   ParsedTemplateArgument ParseTemplateTemplateArgument();
   ParsedTemplateArgument ParseTemplateArgument();

diff  --git a/clang/include/clang/Sema/ParsedTemplate.h 
b/clang/include/clang/Sema/ParsedTemplate.h
index 0874905b38a5..82d00494b0d6 100644
--- a/clang/include/clang/Sema/ParsedTemplate.h
+++ b/clang/include/clang/Sema/ParsedTemplate.h
@@ -139,9 +139,8 @@ namespace clang {
   /// Information about a template-id annotation
   /// token.
   ///
-  /// A template-id annotation token contains the template declaration,
-  /// template arguments, whether those template arguments were types,
-  /// expressions, or template names, and the source locations for important
+  /// A template-id annotation token contains the template name,
+  /// template arguments, and the source locations for important
   /// tokens. All of the information about template arguments is allocated
   /// directly after this structure.
   /// A template-id annotation token can also be generated by a type-constraint
@@ -152,9 +151,6 @@ namespace clang {
   : private llvm::TrailingObjects {
 friend TrailingObjects;
-/// The nested-name-specifier that precedes the template name.
-CXXScopeSpec SS;
-
 /// TemplateKWLoc - The location of the template keyword.
 /// For e.g. typename T::template Y
 SourceLocation TemplateKWLoc;
@@ -195,16 +191,15 @@ namespace clang {
 /// Creates a new TemplateIdAnnotation with NumArgs arguments and
 /// appends it to List.
 static TemplateIdAnnotation *
-Create(CXXScopeSpec SS, SourceLocation TemplateKWLoc,
-   SourceLocation TemplateNameLoc, IdentifierInfo *Name,
-   OverloadedOperatorKind OperatorKind,
+Create(SourceLocation TemplateKWLoc, SourceLocation 

[PATCH] D72746: [clangd] Add a flag for implicit references in the Index

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

{icon times-circle color=red} Unit tests: fail. 61674 tests passed, 181 failed 
and 781 were skipped.

  failed: Clangd.Clangd/background-index.test
  failed: Clangd.Clangd/code-action-request.test
  failed: Clangd.Clangd/compile-commands-path-in-initialize.test
  failed: Clangd.Clangd/completion-auto-trigger.test
  failed: Clangd.Clangd/completion-snippets.test
  failed: Clangd.Clangd/completion.test
  failed: Clangd.Clangd/diagnostic-category.test
  failed: Clangd.Clangd/diagnostics-no-tidy.test
  failed: Clangd.Clangd/diagnostics-notes.test
  failed: Clangd.Clangd/diagnostics.test
  failed: Clangd.Clangd/did-change-configuration-params.test
  failed: Clangd.Clangd/document-link.test
  failed: Clangd.Clangd/execute-command.test
  failed: Clangd.Clangd/filestatus.test
  failed: Clangd.Clangd/fixits-codeaction.test
  failed: Clangd.Clangd/fixits-command.test
  failed: Clangd.Clangd/fixits-embed-in-diagnostic.test
  failed: Clangd.Clangd/formatting.test
  failed: Clangd.Clangd/hover.test
  failed: Clangd.Clangd/index-tools.test
  failed: Clangd.Clangd/path-mappings.test
  failed: Clangd.Clangd/protocol.test
  failed: Clangd.Clangd/references.test
  failed: Clangd.Clangd/rename.test
  failed: Clangd.Clangd/request-reply.test
  failed: Clangd.Clangd/selection-range.test
  failed: Clangd.Clangd/semantic-highlighting.test
  failed: Clangd.Clangd/signature-help-with-offsets.test
  failed: Clangd.Clangd/signature-help.test
  failed: Clangd.Clangd/symbol-info.test
  failed: Clangd.Clangd/symbols.test
  failed: Clangd.Clangd/system-include-extractor.test
  failed: Clangd.Clangd/test-uri-posix.test
  failed: Clangd.Clangd/textdocument-didchange-fail.test
  failed: Clangd.Clangd/trace.test
  failed: Clangd.Clangd/tweaks-format.test
  failed: Clangd.Clangd/type-hierarchy.test
  failed: Clangd.Clangd/unsupported-method.test
  failed: Clangd.Clangd/utf8.test
  failed: Clangd.Clangd/xrefs.test
  failed: Clangd Unit Tests._/ClangdTests/BackgroundIndexTest.CmdLineHash
  failed: Clangd Unit Tests._/ClangdTests/BackgroundIndexTest.DirectIncludesTest
  failed: Clangd Unit Tests._/ClangdTests/BackgroundIndexTest.IndexTwoFiles
  failed: Clangd Unit Tests._/ClangdTests/BackgroundIndexTest.NoCrashOnErrorFile
  failed: Clangd Unit Tests._/ClangdTests/BackgroundIndexTest.NoDotsInAbsPath
  failed: Clangd Unit 
Tests._/ClangdTests/BackgroundIndexTest.ShardStorageEmptyFile
  failed: Clangd Unit Tests._/ClangdTests/BackgroundIndexTest.ShardStorageLoad
  failed: Clangd Unit Tests._/ClangdTests/BackgroundIndexTest.ShardStorageTest
  failed: Clangd Unit Tests._/ClangdTests/BackgroundIndexTest.UncompilableFiles
  failed: Clangd Unit 
Tests._/ClangdTests/CompletionTest.CommentsFromSystemHeaders
  failed: Clangd Unit 
Tests._/ClangdTests/CompletionTest.DynamicIndexIncludeInsertion
  failed: Clangd Unit Tests._/ClangdTests/CompletionTest.DynamicIndexMultiFile
  failed: Clangd Unit Tests._/ClangdTests/CompletionTest.UsingDecl
  failed: Clangd Unit Tests._/ClangdTests/CrossFileRenameTests.DirtyBuffer
  failed: Clangd Unit Tests._/ClangdTests/CrossFileRenameTests.WithUpToDateIndex
  failed: Clangd Unit Tests._/ClangdTests/DocumentSymbolsTest.BasicSymbols
  failed: Clangd Unit 
Tests._/ClangdTests/DocumentSymbolsTest.DeclarationDefinition
  failed: Clangd Unit Tests._/ClangdTests/DocumentSymbolsTest.Enums
  failed: Clangd Unit Tests._/ClangdTests/DocumentSymbolsTest.ExternSymbol
  failed: Clangd Unit Tests._/ClangdTests/DocumentSymbolsTest.FromMacro
  failed: Clangd Unit Tests._/ClangdTests/DocumentSymbolsTest.FuncTemplates
  failed: Clangd Unit Tests._/ClangdTests/DocumentSymbolsTest.InHeaderFile
  failed: Clangd Unit Tests._/ClangdTests/DocumentSymbolsTest.Namespaces
  failed: Clangd Unit Tests._/ClangdTests/DocumentSymbolsTest.NoLocals
  failed: Clangd Unit Tests._/ClangdTests/DocumentSymbolsTest.Qualifiers
  failed: Clangd Unit 
Tests._/ClangdTests/DocumentSymbolsTest.QualifiersWithTemplateArgs
  failed: Clangd Unit Tests._/ClangdTests/DocumentSymbolsTest.TempSpecs
  failed: Clangd Unit Tests._/ClangdTests/DocumentSymbolsTest.Template
  failed: Clangd Unit Tests._/ClangdTests/DocumentSymbolsTest.Unnamed
  failed: Clangd Unit Tests._/ClangdTests/DocumentSymbolsTest.UsingDirectives
  failed: Clangd Unit Tests._/ClangdTests/FileIndexTest.ClassMembers
  failed: Clangd Unit Tests._/ClangdTests/FileIndexTest.CollectMacros
  failed: Clangd Unit Tests._/ClangdTests/FileIndexTest.CustomizedURIScheme
  failed: Clangd Unit 
Tests._/ClangdTests/FileIndexTest.HasSystemHeaderMappingsInPreamble
  failed: Clangd Unit Tests._/ClangdTests/FileIndexTest.IncludeCollected
  failed: Clangd Unit Tests._/ClangdTests/FileIndexTest.IndexAST
  failed: Clangd Unit 
Tests._/ClangdTests/FileIndexTest.IndexMultiASTAndDeduplicate
  failed: Clangd Unit Tests._/ClangdTests/FileIndexTest.MacroRefs
  failed: Clangd Unit Tests._/ClangdTests/FileIndexTest.MergeMainFileSymbols
  failed: Clangd Unit Tests._/ClangdTests/FileIndexTest.NoLocal
  

[PATCH] D72820: [FPEnv] Add pragma FP_CONTRACT support under strict FP.

2020-01-17 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

Remember that the design is that constrained intrinsics must be used whenever 
*any* code in the function is constrained.  It is not unreasonable that part of 
the function might be constrained and the rest subject to fast-math; it'd be a 
shame if the intrinsics couldn't even express that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72820



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


[PATCH] D72820: [FPEnv] Add pragma FP_CONTRACT support under strict FP.

2020-01-17 Thread Andy Kaylor via Phabricator via cfe-commits
andrew.w.kaylor added inline comments.



Comment at: clang/lib/CodeGen/CGExprScalar.cpp:3436
+}
+  }
+

cameron.mcinally wrote:
> andrew.w.kaylor wrote:
> > cameron.mcinally wrote:
> > > cameron.mcinally wrote:
> > > > cameron.mcinally wrote:
> > > > > I don't think it's safe to fuse a FMUL and FADD if the intermediate 
> > > > > rounding isn't exactly the same as those individual operations. 
> > > > > FMULADD doesn't guarantee that, does it?
> > > > To be clear, we could miss very-edge-case overflow/underflow exceptions.
> > > Ah, but I see C/C++ FP_CONTRACT allows the exceptions to be optimized 
> > > away. Sorry for the noise.
> > We've talked about this before but I don't think we ever documented a 
> > decision as to whether we want to allow constrained intrinsics and fast 
> > math flags to be combined. This patch moves that decision into clang's 
> > decision to generate this intrinsic or not.
> > 
> > I think it definitely makes sense in the case of fp contraction, because 
> > even if a user cares about value safety they might want FMA, which is 
> > theorectically more accurate than the separate values even though it 
> > produces a different value. This is consistent with gcc (which produces FMA 
> > under "-ffp-contract=fast -fno-fast-math") and icc (which produced FMA 
> > under "-fp-model strict -fma").
> > 
> > For the record, I also think it makes sense to use nnan, ninf, and nsz with 
> > constrained intrinsics.
> You had me until:
> 
> >For the record, I also think it makes sense to use nnan, ninf, and nsz with 
> >constrained intrinsics.
> 
> To be clear, we'd need them for the `fast` case, but I don't see a lot of 
> value for the `strict` case.
> 
> We definitely want reassoc/recip/etc for the `optimized but trap-safe` case, 
> so that's enough to require FMF flags on constrained intrinsics alone.
> 
> We should probably break this conversation out into an llvm-dev thread...
I agree about starting an llvm-dev thread. I'll send something out unless 
you've already done so by the time I finish typing it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72820



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


[PATCH] D72746: [clangd] Add a flag for implicit references in the Index

2020-01-17 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev updated this revision to Diff 238902.
kbobyrev added a comment.

I started using TokenBuffer, but I ran into the following issue: when I'm
creating `TokenBuffer` and `TokenCollector`, they do not contain any tokens.
`Preprocessor` does not seem to have a non-null Lexer instance, `TokenWatcher`
(set in `TokenCollector`) is not triggered anywhere and neither is
`Lexer::Lex`. I don't have much familiarity with the code and I looked at the
other usages of `TokenBuffer` but didn't figure out what's wrong with the code
in this patch. I suspect the lexer in Preprocessor should be re-initialized
somehow? I'm certainly missing something here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72746

Files:
  clang-tools-extra/clangd/index/Ref.h
  clang-tools-extra/clangd/index/SymbolCollector.cpp
  clang-tools-extra/clangd/refactor/Rename.cpp
  clang-tools-extra/clangd/unittests/RenameTests.cpp

Index: clang-tools-extra/clangd/unittests/RenameTests.cpp
===
--- clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -33,7 +33,7 @@
 // Convert a Range to a Ref.
 Ref refWithRange(const clangd::Range , const std::string ) {
   Ref Result;
-  Result.Kind = RefKind::Reference;
+  Result.Kind = RefKind::Reference | RefKind::Spelled;
   Result.Location.Start.setLine(Range.start.line);
   Result.Location.Start.setColumn(Range.start.character);
   Result.Location.End.setLine(Range.end.line);
@@ -837,7 +837,7 @@
   {
   // variables.
   R"cpp(
-  static const int [[VA^R]] = 123;
+static const int [[VA^R]] = 123;
   )cpp",
   R"cpp(
 #include "foo.h"
@@ -868,6 +868,22 @@
 }
   )cpp",
   },
+  {
+  // Implicit references in macro expansions.
+  R"cpp(
+class [[Fo^o]] {};
+#define FooFoo Foo
+#define FOO Foo
+  )cpp",
+  R"cpp(
+#include "foo.h"
+void bar() {
+  [[Foo]] x;
+  FOO y;
+  FooFoo z;
+}
+  )cpp",
+  },
   };
 
   for (const auto& T : Cases) {
Index: clang-tools-extra/clangd/refactor/Rename.cpp
===
--- clang-tools-extra/clangd/refactor/Rename.cpp
+++ clang-tools-extra/clangd/refactor/Rename.cpp
@@ -296,6 +296,8 @@
   bool HasMore = Index.refs(RQuest, [&](const Ref ) {
 if (AffectedFiles.size() > MaxLimitFiles)
   return;
+if (!static_cast(R.Kind & RefKind::Spelled))
+  return;
 if (auto RefFilePath = filePath(R.Location, /*HintFilePath=*/MainFile)) {
   if (*RefFilePath != MainFile)
 AffectedFiles[*RefFilePath].push_back(toRange(R.Location));
Index: clang-tools-extra/clangd/index/SymbolCollector.cpp
===
--- clang-tools-extra/clangd/index/SymbolCollector.cpp
+++ clang-tools-extra/clangd/index/SymbolCollector.cpp
@@ -28,6 +28,7 @@
 #include "clang/Index/IndexingAction.h"
 #include "clang/Index/USRGeneration.h"
 #include "clang/Lex/Preprocessor.h"
+#include "clang/Tooling/Syntax/Tokens.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/MemoryBuffer.h"
@@ -180,7 +181,16 @@
 }
 
 RefKind toRefKind(index::SymbolRoleSet Roles) {
-  return static_cast(static_cast(RefKind::All) & Roles);
+  RefKind Result = RefKind::Unknown;
+  if (Roles & static_cast(index::SymbolRole::Declaration))
+Result |= RefKind::Declaration;
+  if (Roles & static_cast(index::SymbolRole::Definition))
+Result |= RefKind::Definition;
+  if (Roles & static_cast(index::SymbolRole::Reference))
+Result |= RefKind::Reference;
+  if (!(Roles & static_cast(index::SymbolRole::Implicit)))
+Result |= RefKind::Spelled;
+  return Result;
 }
 
 bool shouldIndexRelation(const index::SymbolRelation ) {
@@ -291,7 +301,7 @@
   // occurrence inside the base-specifier.
   processRelations(*ND, *ID, Relations);
 
-  bool CollectRef = static_cast(Opts.RefFilter) & Roles;
+  bool CollectRef = static_cast(Opts.RefFilter & toRefKind(Roles));
   bool IsOnlyRef =
   !(Roles & (static_cast(index::SymbolRole::Declaration) |
  static_cast(index::SymbolRole::Definition)));
@@ -578,10 +588,25 @@
   }
   // Populate Refs slab from DeclRefs.
   if (auto MainFileURI = GetURI(SM.getMainFileID())) {
-for (const auto  : DeclRefs) {
-  if (auto ID = getSymbolID(It.first)) {
-for (const auto  : It.second)
+assert(ASTCtx && PP.get() && "ASTContext and Preprocessor must be set.");
+syntax::TokenCollector CollectTokens(*PP);
+syntax::TokenBuffer Tokens = std::move(CollectTokens).consume();
+for (auto  : DeclRefs) {
+  if (auto ID = getSymbolID(DeclAndRef.first)) {
+for (auto  : DeclAndRef.second) {
+  // Check if the 

[PATCH] D72897: List implicit operator== after implicit destructors in a vtable.

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

It wouldn't be a bad idea to track that correspondence in the AST just on the 
general principle that it's useful information (for diagnostics, tooling, etc.) 
that's otherwise hard to recreate.  But I agree that it's also not problematic 
to expect Sema to add them in the proper order, and if we don't have an ABI 
that needs the correspondence directly (e.g. because it wants to emit the 
operators in pairs), it's fine to rely on it.

Putting the operators at the end makes sense to me.  It seems likely that an 
arbitrary implementation is always more likely to need to process the implicit 
members first.

I'm much happier with this implementation; LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72897



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


[PATCH] D69740: [profile] Support counter relocation at runtime

2020-01-17 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd3db13af7e5c: [profile] Support counter relocation at 
runtime (authored by phosek).

Changed prior to commit:
  https://reviews.llvm.org/D69740?vs=238689=238901#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69740

Files:
  clang/docs/SourceBasedCodeCoverage.rst
  clang/lib/Driver/ToolChains/Darwin.cpp
  compiler-rt/lib/profile/CMakeLists.txt
  compiler-rt/lib/profile/InstrProfiling.h
  compiler-rt/lib/profile/InstrProfilingBiasVar.c
  compiler-rt/lib/profile/InstrProfilingBuffer.c
  compiler-rt/lib/profile/InstrProfilingFile.c
  compiler-rt/lib/profile/InstrProfilingInternal.h
  compiler-rt/lib/profile/InstrProfilingPlatformFuchsia.c
  compiler-rt/test/profile/ContinuousSyncMode/basic.c
  compiler-rt/test/profile/ContinuousSyncMode/lit.local.cfg.py
  compiler-rt/test/profile/ContinuousSyncMode/multiple-DSOs.c
  compiler-rt/test/profile/ContinuousSyncMode/online-merging.c
  compiler-rt/test/profile/ContinuousSyncMode/pid-substitution.c
  compiler-rt/test/profile/ContinuousSyncMode/runtime-counter-relocation.c
  compiler-rt/test/profile/ContinuousSyncMode/set-file-object.c
  compiler-rt/test/profile/ContinuousSyncMode/set-filename.c
  llvm/include/llvm/ProfileData/InstrProf.h
  llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h
  llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
  llvm/test/Instrumentation/InstrProfiling/runtime-counter-relocation.ll

Index: llvm/test/Instrumentation/InstrProfiling/runtime-counter-relocation.ll
===
--- /dev/null
+++ llvm/test/Instrumentation/InstrProfiling/runtime-counter-relocation.ll
@@ -0,0 +1,25 @@
+; RUN: opt < %s -S -instrprof | FileCheck %s
+; RUN: opt < %s -S -instrprof -runtime-counter-relocation | FileCheck -check-prefixes=RELOC %s
+
+target triple = "x86_64-unknown-linux-gnu"
+
+@__profn_foo = hidden constant [3 x i8] c"foo"
+; RELOC: @__llvm_profile_counter_bias = linkonce_odr global i64 0
+
+; CHECK-LABEL: define void @foo
+; CHECK-NEXT: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_foo, i64 0, i64 0)
+; CHECK-NEXT: %1 = add i64 %pgocount, 1
+; CHECK-NEXT: store i64 %1, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_foo, i64 0, i64 0)
+; RELOC-LABEL: define void @foo
+; RELOC-NEXT: %1 = load i64, i64* @__llvm_profile_counter_bias
+; RELOC-NEXT: %2 = add i64 ptrtoint ([1 x i64]* @__profc_foo to i64), %1
+; RELOC-NEXT: %3 = inttoptr i64 %2 to i64*
+; RELOC-NEXT: %pgocount = load i64, i64* %3
+; RELOC-NEXT: %4 = add i64 %pgocount, 1
+; RELOC-NEXT: store i64 %4, i64* %3
+define void @foo() {
+  call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 0, i32 1, i32 0)
+  ret void
+}
+
+declare void @llvm.instrprof.increment(i8*, i64, i32, i32)
Index: llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
===
--- llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
+++ llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
@@ -83,6 +83,11 @@
 cl::desc("Rename counter variable of a comdat function based on cfg hash"),
 cl::init(true));
 
+cl::opt RuntimeCounterRelocation(
+"runtime-counter-relocation",
+cl::desc("Enable relocating counters at runtime."),
+cl::init(false));
+
 cl::opt ValueProfileStaticAlloc(
 "vp-static-alloc",
 cl::desc("Do static counter allocation for value profiler"),
@@ -431,6 +436,13 @@
   return true;
 }
 
+bool InstrProfiling::isRuntimeCounterRelocationEnabled() const {
+  if (RuntimeCounterRelocation.getNumOccurrences() > 0)
+return RuntimeCounterRelocation;
+
+  return TT.isOSFuchsia();
+}
+
 bool InstrProfiling::isCounterPromotionEnabled() const {
   if (DoCounterPromotion.getNumOccurrences() > 0)
 return DoCounterPromotion;
@@ -641,6 +653,26 @@
   Value *Addr = Builder.CreateConstInBoundsGEP2_64(Counters->getValueType(),
Counters, 0, Index);
 
+  if (isRuntimeCounterRelocationEnabled()) {
+Type *Int64Ty = Type::getInt64Ty(M->getContext());
+Type *Int64PtrTy = Type::getInt64PtrTy(M->getContext());
+Function *Fn = Inc->getParent()->getParent();
+Instruction  = Fn->getEntryBlock().front();
+LoadInst *LI = dyn_cast();
+if (!LI) {
+  IRBuilder<> Builder();
+  Type *Int64Ty = Type::getInt64Ty(M->getContext());
+  GlobalVariable *Bias = M->getGlobalVariable(getInstrProfCounterBiasVarName());
+  if (!Bias)
+Bias = new GlobalVariable(*M, Int64Ty, false, GlobalValue::LinkOnceODRLinkage,
+  Constant::getNullValue(Int64Ty),
+  getInstrProfCounterBiasVarName());
+  LI = Builder.CreateLoad(Int64Ty, Bias);
+}
+auto 

[clang] d3db13a - [profile] Support counter relocation at runtime

2020-01-17 Thread Petr Hosek via cfe-commits

Author: Petr Hosek
Date: 2020-01-17T15:02:23-08:00
New Revision: d3db13af7e5c01632fbf28149a2d4f9c4841aeba

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

LOG: [profile] Support counter relocation at runtime

This is an alternative to the continous mode that was implemented in
D68351. This mode relies on padding and the ability to mmap a file over
the existing mapping which is generally only available on POSIX systems
and isn't suitable for other platforms.

This change instead introduces the ability to relocate counters at
runtime using a level of indirection. On every counter access, we add a
bias to the counter address. This bias is stored in a symbol that's
provided by the profile runtime and is initially set to zero, meaning no
relocation. The runtime can mmap the profile into memory at abitrary
location, and set bias to the offset between the original and the new
counter location, at which point every subsequent counter access will be
to the new location, which allows updating profile directly akin to the
continous mode.

The advantage of this implementation is that doesn't require any special
OS support. The disadvantage is the extra overhead due to additional
instructions required for each counter access (overhead both in terms of
binary size and performance) plus duplication of counters (i.e. one copy
in the binary itself and another copy that's mmapped).

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

Added: 
compiler-rt/lib/profile/InstrProfilingBiasVar.c
compiler-rt/test/profile/ContinuousSyncMode/runtime-counter-relocation.c
llvm/test/Instrumentation/InstrProfiling/runtime-counter-relocation.ll

Modified: 
clang/docs/SourceBasedCodeCoverage.rst
clang/lib/Driver/ToolChains/Darwin.cpp
compiler-rt/lib/profile/CMakeLists.txt
compiler-rt/lib/profile/InstrProfiling.h
compiler-rt/lib/profile/InstrProfilingBuffer.c
compiler-rt/lib/profile/InstrProfilingFile.c
compiler-rt/lib/profile/InstrProfilingInternal.h
compiler-rt/lib/profile/InstrProfilingPlatformFuchsia.c
compiler-rt/test/profile/ContinuousSyncMode/basic.c
compiler-rt/test/profile/ContinuousSyncMode/multiple-DSOs.c
compiler-rt/test/profile/ContinuousSyncMode/online-merging.c
compiler-rt/test/profile/ContinuousSyncMode/pid-substitution.c
compiler-rt/test/profile/ContinuousSyncMode/set-file-object.c
compiler-rt/test/profile/ContinuousSyncMode/set-filename.c
llvm/include/llvm/ProfileData/InstrProf.h
llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h
llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp

Removed: 
compiler-rt/test/profile/ContinuousSyncMode/lit.local.cfg.py



diff  --git a/clang/docs/SourceBasedCodeCoverage.rst 
b/clang/docs/SourceBasedCodeCoverage.rst
index 7e711819be34..1575e4faaa01 100644
--- a/clang/docs/SourceBasedCodeCoverage.rst
+++ b/clang/docs/SourceBasedCodeCoverage.rst
@@ -92,15 +92,42 @@ directory structure will be created.  Additionally, the 
following special
   instrumented program crashes, or is killed by a signal, perfect coverage
   information can still be recovered. Continuous mode does not support value
   profiling for PGO, and is only supported on Darwin at the moment. Support for
-  Linux may be mostly complete but requires testing, and support for
-  Fuchsia/Windows may require more extensive changes: please get involved if
-  you are interested in porting this feature.
+  Linux may be mostly complete but requires testing, and support for Windows
+  may require more extensive changes: please get involved if you are interested
+  in porting this feature.
 
 .. code-block:: console
 
 # Step 2: Run the program.
 % LLVM_PROFILE_FILE="foo.profraw" ./foo
 
+Note that continuous mode is also used on Fuchsia where it's the only supported
+mode, but the implementation is 
diff erent. The Darwin and Linux implementation
+relies on padding and the ability to map a file over the existing memory
+mapping which is generally only available on POSIX systems and isn't suitable
+for other platforms.
+
+On Fuchsia, we rely on the the ability to relocate counters at runtime using a
+level of indirection. On every counter access, we add a bias to the counter
+address. This bias is stored in ``__llvm_profile_counter_bias`` symbol that's
+provided by the profile runtime and is initially set to zero, meaning no
+relocation. The runtime can map the profile into memory at abitrary location,
+and set bias to the offset between the original and the new counter location,
+at which point every subsequent counter access will be to the new location,
+which allows updating profile directly akin to the continous mode.
+
+The advantage of this approach is that doesn't require any special OS support.
+The 

[PATCH] D72875: [clang][cmake] Include generated rst files in html built by docs-clang-html target

2020-01-17 Thread Dan Liew via Phabricator via cfe-commits
delcypher added inline comments.



Comment at: llvm/cmake/modules/AddSphinxTarget.cmake:33
+  if (NOT ARG_SOURCE_DIR)
+set(ARG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+  endif()

@tstellar I'm not 100% sure about this but I think you probably want 
`${CMAKE_CURRENT_SOURCE_DIR}` quoted. If it's not then if it contains spaces I 
think you might make `ARG_SOURCE_DIR` a list. Then we you go to print it you'll 
probably end up with list separators (i.e. `;`) in the command you pass the the 
sphinx binary.

I've not tested this though so I could be wrong.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72875



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


[PATCH] D69878: Consoldiate internal denormal flushing controls

2020-01-17 Thread Cameron McInally via Phabricator via cfe-commits
cameron.mcinally accepted this revision.
cameron.mcinally added a comment.

LGTM too. Would be good if an expert reviewed the target-specific changes, but 
they seem safe enough either way.


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

https://reviews.llvm.org/D69878



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


[PATCH] D72875: [clang][cmake] Include generated rst files in html built by docs-clang-html target

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

{icon check-circle color=green} Unit tests: pass. 61925 tests passed, 0 failed 
and 783 were skipped.

{icon question-circle color=gray} clang-tidy: unknown.

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

Build artifacts 
: 
diff.json 
,
 clang-format.patch 
,
 CMakeCache.txt 
,
 console-log.txt 
,
 test-results.xml 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72875



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


[PATCH] D72820: [FPEnv] Add pragma FP_CONTRACT support under strict FP.

2020-01-17 Thread Cameron McInally via Phabricator via cfe-commits
cameron.mcinally added inline comments.



Comment at: clang/lib/CodeGen/CGExprScalar.cpp:3436
+}
+  }
+

andrew.w.kaylor wrote:
> cameron.mcinally wrote:
> > cameron.mcinally wrote:
> > > cameron.mcinally wrote:
> > > > I don't think it's safe to fuse a FMUL and FADD if the intermediate 
> > > > rounding isn't exactly the same as those individual operations. FMULADD 
> > > > doesn't guarantee that, does it?
> > > To be clear, we could miss very-edge-case overflow/underflow exceptions.
> > Ah, but I see C/C++ FP_CONTRACT allows the exceptions to be optimized away. 
> > Sorry for the noise.
> We've talked about this before but I don't think we ever documented a 
> decision as to whether we want to allow constrained intrinsics and fast math 
> flags to be combined. This patch moves that decision into clang's decision to 
> generate this intrinsic or not.
> 
> I think it definitely makes sense in the case of fp contraction, because even 
> if a user cares about value safety they might want FMA, which is 
> theorectically more accurate than the separate values even though it produces 
> a different value. This is consistent with gcc (which produces FMA under 
> "-ffp-contract=fast -fno-fast-math") and icc (which produced FMA under 
> "-fp-model strict -fma").
> 
> For the record, I also think it makes sense to use nnan, ninf, and nsz with 
> constrained intrinsics.
You had me until:

>For the record, I also think it makes sense to use nnan, ninf, and nsz with 
>constrained intrinsics.

To be clear, we'd need them for the `fast` case, but I don't see a lot of value 
for the `strict` case.

We definitely want reassoc/recip/etc for the `optimized but trap-safe` case, so 
that's enough to require FMF flags on constrained intrinsics alone.

We should probably break this conversation out into an llvm-dev thread...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72820



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


[PATCH] D72850: [CMake] Use LinuxRemoteTI instead of LinuxLocalTI in CrossWinToARMLinux cmake cache

2020-01-17 Thread Sergej Jaskiewicz via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG383ff4eac1db: [CMake] Use LinuxRemoteTI instead of 
LinuxLocalTI in CrossWinToARMLinux cmake… (authored by broadwaylamb).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72850

Files:
  clang/cmake/caches/CrossWinToARMLinux.cmake


Index: clang/cmake/caches/CrossWinToARMLinux.cmake
===
--- clang/cmake/caches/CrossWinToARMLinux.cmake
+++ clang/cmake/caches/CrossWinToARMLinux.cmake
@@ -90,7 +90,7 @@
 # Remote test configuration.
 if(DEFINED REMOTE_TEST_HOST)
   set(DEFAULT_TEST_EXECUTOR 
"SSHExecutor('${REMOTE_TEST_HOST}', '${REMOTE_TEST_USER}')")
-  set(DEFAULT_TEST_TARGET_INFO  
"libcxx.test.target_info.LinuxLocalTI")
+  set(DEFAULT_TEST_TARGET_INFO  
"libcxx.test.target_info.LinuxRemoteTI")
 
   # Allow override with the custom values.
   if(NOT DEFINED LIBUNWIND_TARGET_INFO)


Index: clang/cmake/caches/CrossWinToARMLinux.cmake
===
--- clang/cmake/caches/CrossWinToARMLinux.cmake
+++ clang/cmake/caches/CrossWinToARMLinux.cmake
@@ -90,7 +90,7 @@
 # Remote test configuration.
 if(DEFINED REMOTE_TEST_HOST)
   set(DEFAULT_TEST_EXECUTOR "SSHExecutor('${REMOTE_TEST_HOST}', '${REMOTE_TEST_USER}')")
-  set(DEFAULT_TEST_TARGET_INFO  "libcxx.test.target_info.LinuxLocalTI")
+  set(DEFAULT_TEST_TARGET_INFO  "libcxx.test.target_info.LinuxRemoteTI")
 
   # Allow override with the custom values.
   if(NOT DEFINED LIBUNWIND_TARGET_INFO)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 383ff4e - [CMake] Use LinuxRemoteTI instead of LinuxLocalTI in CrossWinToARMLinux cmake cache

2020-01-17 Thread Sergej Jaskiewicz via cfe-commits

Author: Sergej Jaskiewicz
Date: 2020-01-18T01:29:09+03:00
New Revision: 383ff4eac1db8313ec522ba3ac0903aaeda7ff63

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

LOG: [CMake] Use LinuxRemoteTI instead of LinuxLocalTI in CrossWinToARMLinux 
cmake cache

Summary: Depends on D72847

Reviewers: vvereschaka, aorlov, andreil99

Reviewed By: vvereschaka

Subscribers: mgorny, kristof.beyls, cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang/cmake/caches/CrossWinToARMLinux.cmake

Removed: 




diff  --git a/clang/cmake/caches/CrossWinToARMLinux.cmake 
b/clang/cmake/caches/CrossWinToARMLinux.cmake
index d08e09a291f7..50957b153328 100644
--- a/clang/cmake/caches/CrossWinToARMLinux.cmake
+++ b/clang/cmake/caches/CrossWinToARMLinux.cmake
@@ -90,7 +90,7 @@ set(RUNTIMES_CMAKE_ARGS 
"-DCMAKE_SYSTEM_NAME=Linux;-DCMAKE_A
 # Remote test configuration.
 if(DEFINED REMOTE_TEST_HOST)
   set(DEFAULT_TEST_EXECUTOR 
"SSHExecutor('${REMOTE_TEST_HOST}', '${REMOTE_TEST_USER}')")
-  set(DEFAULT_TEST_TARGET_INFO  
"libcxx.test.target_info.LinuxLocalTI")
+  set(DEFAULT_TEST_TARGET_INFO  
"libcxx.test.target_info.LinuxRemoteTI")
 
   # Allow override with the custom values.
   if(NOT DEFINED LIBUNWIND_TARGET_INFO)



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


[PATCH] D72875: [clang][cmake] Include generated rst files in html built by docs-clang-html target

2020-01-17 Thread Tom Stellard via Phabricator via cfe-commits
tstellar updated this revision to Diff 238893.
tstellar added a comment.

- Fix indentation.
- Remove placeholder AttributeReference.rst.  The install target was replacing 
the generated AttributeReference.rst with this which caused the html page to be 
empty.
- Tested with stand-alone clang builds: cmake ../clang -G Ninja  
-DCLANG_INCLUDE_DOCS=ON -DLLVM_BUILD_DOCS=ON -DLLVM_ENABLE_SPHINX=ON 
-DSPHINX_WARNINGS_AS_ERRORS=OFF


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72875

Files:
  clang/docs/AttributeReference.rst
  clang/docs/CMakeLists.txt
  llvm/cmake/modules/AddSphinxTarget.cmake


Index: llvm/cmake/modules/AddSphinxTarget.cmake
===
--- llvm/cmake/modules/AddSphinxTarget.cmake
+++ llvm/cmake/modules/AddSphinxTarget.cmake
@@ -18,6 +18,7 @@
 #
 # ``project`` should be the project name
 function (add_sphinx_target builder project)
+  cmake_parse_arguments(ARG "" "SOURCE_DIR" "" ${ARGN})
   set(SPHINX_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/${builder}")
   set(SPHINX_DOC_TREE_DIR 
"${CMAKE_CURRENT_BINARY_DIR}/_doctrees-${project}-${builder}")
   set(SPHINX_TARGET_NAME docs-${project}-${builder})
@@ -28,13 +29,17 @@
 set(SPHINX_WARNINGS_AS_ERRORS_FLAG "")
   endif()
 
+  if (NOT ARG_SOURCE_DIR)
+set(ARG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+  endif()
+
   add_custom_target(${SPHINX_TARGET_NAME}
 COMMAND ${SPHINX_EXECUTABLE}
 -b ${builder}
 -d "${SPHINX_DOC_TREE_DIR}"
 -q # Quiet: no output other than errors and 
warnings.
 ${SPHINX_WARNINGS_AS_ERRORS_FLAG} # Treat warnings 
as errors if requested
-"${CMAKE_CURRENT_SOURCE_DIR}" # Source
+"${ARG_SOURCE_DIR}" # Source
 "${SPHINX_BUILD_DIR}" # Output
 COMMENT
 "Generating ${builder} Sphinx documentation for ${project} 
into \"${SPHINX_BUILD_DIR}\"")
Index: clang/docs/CMakeLists.txt
===
--- clang/docs/CMakeLists.txt
+++ clang/docs/CMakeLists.txt
@@ -90,15 +90,40 @@
 endif()
 endif()
 
+function (gen_rst_file output_file td_option source)
+  get_filename_component(TABLEGEN_INCLUDE_DIR 
"${CMAKE_CURRENT_SOURCE_DIR}/${source}" DIRECTORY)
+  list(APPEND LLVM_TABLEGEN_FLAGS "-I${TABLEGEN_INCLUDE_DIR}")
+  clang_tablegen(${output_file} ${td_option} SOURCE ${source} TARGET 
"gen-${output_file}")
+  add_dependencies(docs-clang-html "gen-${output_file}")
+endfunction()
+
 if (LLVM_ENABLE_SPHINX)
   include(AddSphinxTarget)
   if (SPHINX_FOUND)
 if (${SPHINX_OUTPUT_HTML})
-  add_sphinx_target(html clang)
+  add_sphinx_target(html clang SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR})
+
+  # Copy rst files to build directory before generating the html
+  # documentation.  Some of the rst files are generated, so they
+  # only exist in the build directory.  Sphinx needs all files in
+  # the same directory in order to genrate the html, so we need to
+  # copy all the non-gnerated rst files from the source to the build
+  # directory before we run sphinx.
+  add_custom_target(copy-clang-rst-docs
+COMMAND ${CMAKE_COMMAND} -E copy_directory
+${CMAKE_CURRENT_SOURCE_DIR}
+${CMAKE_CURRENT_BINARY_DIR})
+  add_dependencies(docs-clang-html copy-clang-rst-docs)
+
   add_custom_command(TARGET docs-clang-html POST_BUILD
 COMMAND ${CMAKE_COMMAND} -E copy
 "${CMAKE_CURRENT_SOURCE_DIR}/LibASTMatchersReference.html"
 "${CMAKE_CURRENT_BINARY_DIR}/html/LibASTMatchersReference.html")
+
+  # Generated files
+  gen_rst_file(AttributeReference.rst -gen-attr-docs 
../include/clang/Basic/Attr.td)
+  gen_rst_file(DiagnosticsReference.rst -gen-diag-docs 
../include/clang/Basic/Diagnostic.td)
+  gen_rst_file(ClangCommandLineReference.rst -gen-opt-docs 
../include/clang/Driver/ClangOptionDocs.td)
 endif()
 if (${SPHINX_OUTPUT_MAN})
   add_sphinx_target(man clang)
Index: clang/docs/AttributeReference.rst
===
--- clang/docs/AttributeReference.rst
+++ /dev/null
@@ -1,13 +0,0 @@
-..
-  ---
-  NOTE: This file is automatically generated by running clang-tblgen
-  -gen-attr-docs. Do not edit this file by hand!! The contents for
-  this file are automatically generated by a server-side process.
-  
-  Please do not commit this file. The file exists for local testing
-  purposes only.
-  ---
-
-===
-Attributes in Clang
-===
\ No newline at end of file


Index: llvm/cmake/modules/AddSphinxTarget.cmake

[PATCH] D72901: [OpenMP] [DOCS] Update OMP5.0 feature status table [NFC]

2020-01-17 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: clang/docs/OpenMPSupport.rst:242
 
+--+--+--+---+
-| misc extensions  | prevent new type definitions in clauses   
   | :none:`unclaimed`| 
  |
+| memory model extension   | memory model update   
   | :none:`unclaimed`| 
  |
 
+--+--+--+---+

kkwli0 wrote:
> ABataev wrote:
> > What kind of memory model update?
> We add five _memory-order-clause_s in the atomic directive - `seq_cst`, 
> `acq_rel`, `release`, `acquire` and `relaxed` to support the memory model.
I would add as much as possible info about expected features to the doc, if 
possible


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

https://reviews.llvm.org/D72901



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


[PATCH] D72897: List implicit operator== after implicit destructors in a vtable.

2020-01-17 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith updated this revision to Diff 238881.
rsmith added a comment.

- Explicitly put implicit virtual functions in the right order, rather


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72897

Files:
  clang/lib/AST/VTableBuilder.cpp
  clang/test/CodeGenCXX/virtual-compare.cpp

Index: clang/test/CodeGenCXX/virtual-compare.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/virtual-compare.cpp
@@ -0,0 +1,53 @@
+// RUN: %clang_cc1 -std=c++2a -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s
+
+#include "Inputs/std-compare.h"
+
+// CHECK: @_ZTV1A =
+struct A;
+struct X {
+  // CHECK-SAME: @_ZN1X1xEv
+  virtual void x();
+  friend auto operator<=>(X, X) = default;
+};
+struct Y {
+  virtual ~Y();
+  virtual A =(const A &);
+  friend auto operator<=>(Y, Y) = default;
+};
+struct A : X, Y {
+  // CHECK-SAME: @_ZN1A1fEv
+  virtual void f();
+  // CHECK-SAME: @_ZNKR1AssERKS_
+  virtual std::strong_ordering operator<=>(const A &) const & = default;
+  // CHECK-SAME: @_ZN1A1gEv
+  virtual void g();
+  // CHECK-SAME: @_ZNKO1AssERKS_
+  virtual std::strong_ordering operator<=>(const A &) const && = default;
+  // CHECK-SAME: @_ZN1A1hEv
+  virtual void h();
+
+  // CHECK-SAME: @_ZN1AaSERKS_
+  // implicit virtual A =(const A&) = default;
+
+  // CHECK-SAME: @_ZN1AD1Ev
+  // CHECK-SAME: @_ZN1AD0Ev
+  // implicit virtual ~A();
+
+  // CHECK-SAME: @_ZNKR1AeqERKS_
+  // implicit virtual A ==(const A&) const & = default;
+
+  // CHECK-SAME: @_ZNKO1AeqERKS_
+  // implicit virtual A ==(const A&) const && = default;
+};
+
+// For Y:
+// CHECK-SAME: @_ZTI1A
+
+// CHECK-SAME: @_ZThn8_N1AD1Ev
+// CHECK-SAME: @_ZThn8_N1AD0Ev
+// virtual ~Y();
+
+// CHECK-SAME: @_ZThn8_N1AaSERKS_
+// virtual A =(const A &);
+
+void A::f() {}
Index: clang/lib/AST/VTableBuilder.cpp
===
--- clang/lib/AST/VTableBuilder.cpp
+++ clang/lib/AST/VTableBuilder.cpp
@@ -1474,11 +1474,11 @@
   llvm_unreachable("Found a duplicate primary base!");
   }
 
-  const CXXDestructorDecl *ImplicitVirtualDtor = nullptr;
-
   typedef llvm::SmallVector NewVirtualFunctionsTy;
   NewVirtualFunctionsTy NewVirtualFunctions;
 
+  llvm::SmallVector NewImplicitVirtualFunctions;
+
   // Now go through all virtual member functions and add them.
   for (const auto *MD : RD->methods()) {
 if (!MD->isVirtual())
@@ -1542,24 +1542,30 @@
   }
 }
 
-if (const CXXDestructorDecl *DD = dyn_cast(MD)) {
-  if (MD->isImplicit()) {
-// Itanium C++ ABI 2.5.2:
-//   If a class has an implicitly-defined virtual destructor,
-//   its entries come after the declared virtual function pointers.
-
-assert(!ImplicitVirtualDtor &&
-   "Did already see an implicit virtual dtor!");
-ImplicitVirtualDtor = DD;
-continue;
-  }
-}
-
-NewVirtualFunctions.push_back(MD);
+if (MD->isImplicit())
+  NewImplicitVirtualFunctions.push_back(MD);
+else
+  NewVirtualFunctions.push_back(MD);
   }
 
-  if (ImplicitVirtualDtor)
-NewVirtualFunctions.push_back(ImplicitVirtualDtor);
+  std::stable_sort(
+  NewImplicitVirtualFunctions.begin(), NewImplicitVirtualFunctions.end(),
+  [](const CXXMethodDecl *A, const CXXMethodDecl *B) {
+if (A->isCopyAssignmentOperator() != B->isCopyAssignmentOperator())
+  return A->isCopyAssignmentOperator();
+if (A->isMoveAssignmentOperator() != B->isMoveAssignmentOperator())
+  return A->isMoveAssignmentOperator();
+if (isa(A) != isa(B))
+  return isa(A);
+assert(A->getOverloadedOperator() == OO_EqualEqual &&
+   B->getOverloadedOperator() == OO_EqualEqual &&
+   "unexpected or duplicate implicit virtual function");
+// We rely on Sema to have declared the operator== members in the
+// same order as the corresponding operator<=> members.
+return false;
+  });
+  NewVirtualFunctions.append(NewImplicitVirtualFunctions.begin(),
+ NewImplicitVirtualFunctions.end());
 
   for (const CXXMethodDecl *MD : NewVirtualFunctions) {
 // Get the final overrider.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D72897: List implicit operator== after implicit destructors in a vtable.

2020-01-17 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment.

In D72897#1825791 , @rjmccall wrote:

> I know that Sema used to have a lot of issues with implicitly declaring 
> special members, but I also know that that was bound up with how we tracked 
> special state for the class, and that code has changed a lot.   If you feel 
> that that's an unlikely problem now, and you're comfortable with potentially 
> having to generate implicit declarations of special members in different 
> orders to satisfy different ABIs, I can accept this approach.


I'm not particularly overjoyed by having an ABI decision determined by the 
order in which Sema chooses to implicitly declare these members. I think it's 
unlikely to have stability problems (we explicitly force declaration of virtual 
implicit members at the end of the class before they can have been lazily 
declared), but avoiding a reliance on Sema's behavior would be nice. It'd be 
hard to avoid relying on `Sema` getting the order of implicit `operator==` 
functions right, though, as I don't think we want vtable layout to be 
responsible for figuring out the correspondence between implicit `operator==` 
functions and defaulted `operator<=>` functions. Please take a look at this 
alternative approach and see what you think.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72897



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


[PATCH] D72890: [xray] Allow instrumenting only function entry and/or only function exit

2020-01-17 Thread Shoaib Meenai via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG97ba483026cd: [xray] Allow instrumenting only function entry 
and/or only function exit (authored by ianlevesque, committed by smeenai).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72890

Files:
  clang/include/clang/Basic/XRayInstr.h
  clang/include/clang/Driver/Options.td
  clang/lib/Basic/XRayInstr.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/Driver/XRayArgs.cpp
  clang/test/CodeGen/xray-instrumentation-bundles.cpp
  llvm/lib/CodeGen/XRayInstrumentation.cpp
  llvm/test/CodeGen/AArch64/xray-partial-instrumentation-skip-entry.ll
  llvm/test/CodeGen/AArch64/xray-partial-instrumentation-skip-exit.ll
  llvm/test/CodeGen/X86/xray-partial-instrumentation-skip-entry.ll
  llvm/test/CodeGen/X86/xray-partial-instrumentation-skip-exit.ll

Index: llvm/test/CodeGen/X86/xray-partial-instrumentation-skip-exit.ll
===
--- /dev/null
+++ llvm/test/CodeGen/X86/xray-partial-instrumentation-skip-exit.ll
@@ -0,0 +1,49 @@
+; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -filetype=asm -o - \
+; RUN: -mtriple=x86_64-unknown-linux-gnu -relocation-model=pic < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-darwin-unknown< %s | FileCheck %s
+
+define i32 @foo() nounwind noinline uwtable "function-instrument"="xray-always" "xray-skip-exit" {
+; CHECK:   .p2align 1, 0x90
+; CHECK-LABEL: Lxray_sled_0:
+; CHECK:   .ascii "\353\t"
+; CHECK-NEXT:  nopw 512(%rax,%rax)
+  ret i32 0
+; CHECK-NOT: Lxray_sled_1:
+; CHECK:   retq
+}
+; CHECK-LABEL: xray_instr_map
+; CHECK-LABEL: Lxray_sleds_start0:
+; CHECK:   .quad {{.*}}xray_sled_0
+; CHECK-LABEL: Lxray_sleds_end0:
+; CHECK-LABEL: xray_fn_idx
+; CHECK:   .quad {{.*}}xray_sleds_start0
+; CHECK-NEXT:  .quad {{.*}}xray_sleds_end0
+
+
+; We test multiple returns in a single function to make sure we're skipping all
+; of them with XRay instrumentation.
+define i32 @bar(i32 %i) nounwind noinline uwtable "function-instrument"="xray-always" "xray-skip-exit" {
+; CHECK:   .p2align 1, 0x90
+; CHECK-LABEL: Lxray_sled_1:
+; CHECK:   .ascii "\353\t"
+; CHECK-NEXT:  nopw 512(%rax,%rax)
+Test:
+  %cond = icmp eq i32 %i, 0
+  br i1 %cond, label %IsEqual, label %NotEqual
+IsEqual:
+  ret i32 0
+; CHECK-NOT: Lxray_sled_{{.*}}:
+; CHECK:   retq
+NotEqual:
+  ret i32 1
+; CHECK-NOT: Lxray_sled_{{.*}}:
+; CHECK:   retq
+}
+; CHECK-LABEL: xray_instr_map
+; CHECK-LABEL: Lxray_sleds_start1:
+; CHECK:   .quad {{.*}}xray_sled_1
+; CHECK-LABEL: Lxray_sleds_end1:
+; CHECK-LABEL: xray_fn_idx
+; CHECK:   .quad {{.*}}xray_sleds_start1
+; CHECK-NEXT:  .quad {{.*}}xray_sleds_end1
Index: llvm/test/CodeGen/X86/xray-partial-instrumentation-skip-entry.ll
===
--- /dev/null
+++ llvm/test/CodeGen/X86/xray-partial-instrumentation-skip-entry.ll
@@ -0,0 +1,50 @@
+; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -filetype=asm -o - \
+; RUN: -mtriple=x86_64-unknown-linux-gnu -relocation-model=pic < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-darwin-unknown< %s | FileCheck %s
+
+define i32 @foo() nounwind noinline uwtable "function-instrument"="xray-always" "xray-skip-entry" {
+; CHECK-NOT: Lxray_sled_0:
+  ret i32 0
+; CHECK:   .p2align 1, 0x90
+; CHECK-LABEL: Lxray_sled_0:
+; CHECK:   retq
+; CHECK-NEXT:  nopw %cs:512(%rax,%rax)
+}
+; CHECK-LABEL: xray_instr_map
+; CHECK-LABEL: Lxray_sleds_start0:
+; CHECK:   .quad {{.*}}xray_sled_0
+; CHECK-LABEL: Lxray_sleds_end0:
+; CHECK-LABEL: xray_fn_idx
+; CHECK:   .quad {{.*}}xray_sleds_start0
+; CHECK-NEXT:  .quad {{.*}}xray_sleds_end0
+
+
+; We test multiple returns in a single function to make sure we're getting all
+; of them with XRay instrumentation.
+define i32 @bar(i32 %i) nounwind noinline uwtable "function-instrument"="xray-always" "xray-skip-entry" {
+; CHECK-NOT: Lxray_sled_1:
+Test:
+  %cond = icmp eq i32 %i, 0
+  br i1 %cond, label %IsEqual, label %NotEqual
+IsEqual:
+  ret i32 0
+; CHECK:   .p2align 1, 0x90
+; CHECK-LABEL: Lxray_sled_1:
+; CHECK:   retq
+; CHECK-NEXT:  nopw %cs:512(%rax,%rax)
+NotEqual:
+  ret i32 1
+; CHECK:   .p2align 1, 0x90
+; CHECK-LABEL: Lxray_sled_2:
+; CHECK:   retq
+; CHECK-NEXT:  nopw %cs:512(%rax,%rax)
+}
+; CHECK-LABEL: xray_instr_map
+; CHECK-LABEL: Lxray_sleds_start1:
+; CHECK:   .quad {{.*}}xray_sled_1
+; CHECK:   .quad {{.*}}xray_sled_2
+; CHECK-LABEL: Lxray_sleds_end1:
+; CHECK-LABEL: xray_fn_idx
+; CHECK:   .quad {{.*}}xray_sleds_start1
+; CHECK-NEXT:  .quad 

[PATCH] D72873: [clang][xray] Add -fxray-ignore-loops option

2020-01-17 Thread Shoaib Meenai via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1d62be244108: [clang][xray] Add -fxray-ignore-loops option 
(authored by ianlevesque, committed by smeenai).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72873

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/xray-ignore-loops.cpp


Index: clang/test/CodeGen/xray-ignore-loops.cpp
===
--- /dev/null
+++ clang/test/CodeGen/xray-ignore-loops.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fxray-instrument -fxray-ignore-loops -x c++ -std=c++11 
-emit-llvm -o - %s -triple x86_64-unknown-linux-gnu | FileCheck %s
+
+int foo() {
+  return 1;
+}
+
+// CHECK: define i32 @_Z3foov() #[[ATTRS:[0-9]+]] {
+// CHECK-DAG: attributes #[[ATTRS]] = {{.*}} "xray-ignore-loops" {{.*}}
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -1091,6 +1091,8 @@
   Args.hasArg(OPT_fxray_always_emit_typedevents);
   Opts.XRayInstructionThreshold =
   getLastArgIntValue(Args, OPT_fxray_instruction_threshold_EQ, 200, Diags);
+  Opts.XRayIgnoreLoops =
+  Args.hasArg(OPT_fxray_ignore_loops, OPT_fno_xray_ignore_loops, false);
 
   auto XRayInstrBundles =
   Args.getAllArgValues(OPT_fxray_instrumentation_bundle);
Index: clang/lib/CodeGen/CodeGenFunction.cpp
===
--- clang/lib/CodeGen/CodeGenFunction.cpp
+++ clang/lib/CodeGen/CodeGenFunction.cpp
@@ -818,6 +818,9 @@
 Fn->addFnAttr(
 "xray-instruction-threshold",
 llvm::itostr(CGM.getCodeGenOpts().XRayInstructionThreshold));
+  if (CGM.getCodeGenOpts().XRayIgnoreLoops) {
+Fn->addFnAttr("xray-ignore-loops");
+  }
 }
 
 if (const auto *Attr = D->getAttr()) {
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -1292,6 +1292,13 @@
 def fnoxray_always_emit_typedevents : Flag<["-"], 
"fno-xray-always-emit-typedevents">, Group,
   Flags<[CC1Option]>;
 
+def fxray_ignore_loops : Flag<["-"], "fxray-ignore-loops">, Group,
+  Flags<[CC1Option]>,
+  HelpText<"Don't instrument functions with loops unless they also meet the 
minimum function size">;
+def fno_xray_ignore_loops : Flag<["-"], "fno-xray-ignore-loops">, 
Group,
+  Flags<[CC1Option]>;
+
+
 def fxray_link_deps : Flag<["-"], "fxray-link-deps">, Group,
   Flags<[CC1Option]>,
   HelpText<"Tells clang to add the link dependencies for XRay.">;
Index: clang/include/clang/Basic/CodeGenOptions.def
===
--- clang/include/clang/Basic/CodeGenOptions.def
+++ clang/include/clang/Basic/CodeGenOptions.def
@@ -106,6 +106,10 @@
 ///< Set when -fxray-always-emit-typedevents is enabled.
 CODEGENOPT(XRayAlwaysEmitTypedEvents , 1, 0)
 
+///< Set when -fxray-ignore-loops is enabled.
+CODEGENOPT(XRayIgnoreLoops , 1, 0)
+
+
 ///< Set the minimum number of instructions in a function to determine 
selective
 ///< XRay instrumentation.
 VALUE_CODEGENOPT(XRayInstructionThreshold , 32, 200)


Index: clang/test/CodeGen/xray-ignore-loops.cpp
===
--- /dev/null
+++ clang/test/CodeGen/xray-ignore-loops.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fxray-instrument -fxray-ignore-loops -x c++ -std=c++11 -emit-llvm -o - %s -triple x86_64-unknown-linux-gnu | FileCheck %s
+
+int foo() {
+  return 1;
+}
+
+// CHECK: define i32 @_Z3foov() #[[ATTRS:[0-9]+]] {
+// CHECK-DAG: attributes #[[ATTRS]] = {{.*}} "xray-ignore-loops" {{.*}}
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -1091,6 +1091,8 @@
   Args.hasArg(OPT_fxray_always_emit_typedevents);
   Opts.XRayInstructionThreshold =
   getLastArgIntValue(Args, OPT_fxray_instruction_threshold_EQ, 200, Diags);
+  Opts.XRayIgnoreLoops =
+  Args.hasArg(OPT_fxray_ignore_loops, OPT_fno_xray_ignore_loops, false);
 
   auto XRayInstrBundles =
   Args.getAllArgValues(OPT_fxray_instrumentation_bundle);
Index: clang/lib/CodeGen/CodeGenFunction.cpp
===
--- clang/lib/CodeGen/CodeGenFunction.cpp
+++ clang/lib/CodeGen/CodeGenFunction.cpp
@@ -818,6 +818,9 @@
 Fn->addFnAttr(
 "xray-instruction-threshold",
 

[PATCH] D72901: [OpenMP] [DOCS] Update OMP5.0 feature status table [NFC]

2020-01-17 Thread Kelvin Li via Phabricator via cfe-commits
kkwli0 marked 2 inline comments as done.
kkwli0 added inline comments.



Comment at: clang/docs/OpenMPSupport.rst:242
 
+--+--+--+---+
-| misc extensions  | prevent new type definitions in clauses   
   | :none:`unclaimed`| 
  |
+| memory model extension   | memory model update   
   | :none:`unclaimed`| 
  |
 
+--+--+--+---+

ABataev wrote:
> What kind of memory model update?
We add five _memory-order-clause_s in the atomic directive - `seq_cst`, 
`acq_rel`, `release`, `acquire` and `relaxed` to support the memory model.


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

https://reviews.llvm.org/D72901



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


[clang] 1d62be2 - [clang][xray] Add -fxray-ignore-loops option

2020-01-17 Thread Shoaib Meenai via cfe-commits

Author: Ian Levesque
Date: 2020-01-17T13:32:24-08:00
New Revision: 1d62be244108547558c6d42ddcf2e4a7f3c6dd03

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

LOG: [clang][xray] Add -fxray-ignore-loops option

XRay allows tuning by minimum function size, but also always instruments
functions with loops in them. If the minimum function size is set to a
large value the loop instrumention ends up causing most functions to be
instrumented anyway. This adds a new flag, -fxray-ignore-loops, to disable
the loop detection logic.

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

Added: 
clang/test/CodeGen/xray-ignore-loops.cpp

Modified: 
clang/include/clang/Basic/CodeGenOptions.def
clang/include/clang/Driver/Options.td
clang/lib/CodeGen/CodeGenFunction.cpp
clang/lib/Frontend/CompilerInvocation.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/CodeGenOptions.def 
b/clang/include/clang/Basic/CodeGenOptions.def
index 50fc1836282f..9f4f83635673 100644
--- a/clang/include/clang/Basic/CodeGenOptions.def
+++ b/clang/include/clang/Basic/CodeGenOptions.def
@@ -106,6 +106,10 @@ CODEGENOPT(XRayAlwaysEmitCustomEvents , 1, 0)
 ///< Set when -fxray-always-emit-typedevents is enabled.
 CODEGENOPT(XRayAlwaysEmitTypedEvents , 1, 0)
 
+///< Set when -fxray-ignore-loops is enabled.
+CODEGENOPT(XRayIgnoreLoops , 1, 0)
+
+
 ///< Set the minimum number of instructions in a function to determine 
selective
 ///< XRay instrumentation.
 VALUE_CODEGENOPT(XRayInstructionThreshold , 32, 200)

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index abfa767afea8..ad829efe43da 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1292,6 +1292,13 @@ def fxray_always_emit_typedevents : Flag<["-"], 
"fxray-always-emit-typedevents">
 def fnoxray_always_emit_typedevents : Flag<["-"], 
"fno-xray-always-emit-typedevents">, Group,
   Flags<[CC1Option]>;
 
+def fxray_ignore_loops : Flag<["-"], "fxray-ignore-loops">, Group,
+  Flags<[CC1Option]>,
+  HelpText<"Don't instrument functions with loops unless they also meet the 
minimum function size">;
+def fno_xray_ignore_loops : Flag<["-"], "fno-xray-ignore-loops">, 
Group,
+  Flags<[CC1Option]>;
+
+
 def fxray_link_deps : Flag<["-"], "fxray-link-deps">, Group,
   Flags<[CC1Option]>,
   HelpText<"Tells clang to add the link dependencies for XRay.">;

diff  --git a/clang/lib/CodeGen/CodeGenFunction.cpp 
b/clang/lib/CodeGen/CodeGenFunction.cpp
index 2bf94f697e01..75f5c0e545d1 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -818,6 +818,9 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType 
RetTy,
 Fn->addFnAttr(
 "xray-instruction-threshold",
 llvm::itostr(CGM.getCodeGenOpts().XRayInstructionThreshold));
+  if (CGM.getCodeGenOpts().XRayIgnoreLoops) {
+Fn->addFnAttr("xray-ignore-loops");
+  }
 }
 
 if (const auto *Attr = D->getAttr()) {

diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index e1e59565083b..3671e084b1ca 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1091,6 +1091,8 @@ static bool ParseCodeGenArgs(CodeGenOptions , 
ArgList , InputKind IK,
   Args.hasArg(OPT_fxray_always_emit_typedevents);
   Opts.XRayInstructionThreshold =
   getLastArgIntValue(Args, OPT_fxray_instruction_threshold_EQ, 200, Diags);
+  Opts.XRayIgnoreLoops =
+  Args.hasArg(OPT_fxray_ignore_loops, OPT_fno_xray_ignore_loops, false);
 
   auto XRayInstrBundles =
   Args.getAllArgValues(OPT_fxray_instrumentation_bundle);

diff  --git a/clang/test/CodeGen/xray-ignore-loops.cpp 
b/clang/test/CodeGen/xray-ignore-loops.cpp
new file mode 100644
index ..17ea2afbeece
--- /dev/null
+++ b/clang/test/CodeGen/xray-ignore-loops.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fxray-instrument -fxray-ignore-loops -x c++ -std=c++11 
-emit-llvm -o - %s -triple x86_64-unknown-linux-gnu | FileCheck %s
+
+int foo() {
+  return 1;
+}
+
+// CHECK: define i32 @_Z3foov() #[[ATTRS:[0-9]+]] {
+// CHECK-DAG: attributes #[[ATTRS]] = {{.*}} "xray-ignore-loops" {{.*}}



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


[PATCH] D72901: [OpenMP] [DOCS] Update OMP5.0 feature status table [NFC]

2020-01-17 Thread Kelvin Li via Phabricator via cfe-commits
kkwli0 marked an inline comment as done.
kkwli0 added inline comments.



Comment at: clang/docs/OpenMPSupport.rst:194
 
+--+--+--+---+
-| device extension | requires directive (unified shared memory)
   | :good:`done` | 
  |
+| device extension | requires directive
   | :good:`done` | 
  |
 
+--+--+--+---+

jdoerfert wrote:
> ABataev wrote:
> > We have support only for unified memory, so must be `partial`
> Let's keep the explicit ` (unified shared memory) -> done ` line and add one 
> for the others as not done.
@abataev It makes sense to make it `partial`.

@jdoerfert  Keeping that line can be confusing.  Line 196 is clear to indicate 
that the unified_address and unified_shared_memory parts of the requires 
directive is done.


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

https://reviews.llvm.org/D72901



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


[PATCH] D72901: [OpenMP] [DOCS] Update OMP5.0 feature status table [NFC]

2020-01-17 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: clang/docs/OpenMPSupport.rst:240
++--+--+--+---+
+| misc extension   | prevent new type definitions in clauses   
   | :none:`unclaimed`| 
  |
 
+--+--+--+---+

kkwli0 wrote:
> ABataev wrote:
> > What is this?
> This is a clarification. The spec add restrictions to declare new type on 
> iterators, declare reduction and declare mapper [49:11; 308:17; 327:26]
Would be good to put these links to the doc to make it clear


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

https://reviews.llvm.org/D72901



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


[PATCH] D71566: New checks for fortified sprintf

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

{icon times-circle color=red} Unit tests: fail. 61975 tests passed, 1 failed 
and 783 were skipped.

  failed: LLVM.Bindings/Go/go.test

{icon question-circle color=gray} clang-tidy: unknown.

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

Build artifacts 
: 
diff.json 
,
 clang-format.patch 
,
 CMakeCache.txt 
,
 console-log.txt 
,
 test-results.xml 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71566



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


[PATCH] D71566: New checks for fortified sprintf

2020-01-17 Thread serge via Phabricator via cfe-commits
serge-sans-paille updated this revision to Diff 238868.
serge-sans-paille added a comment.

Update size computation + test case involving null byte inside the format 
string.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71566

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaChecking.cpp
  clang/test/Sema/warn-fortify-source.c

Index: clang/test/Sema/warn-fortify-source.c
===
--- clang/test/Sema/warn-fortify-source.c
+++ clang/test/Sema/warn-fortify-source.c
@@ -11,6 +11,8 @@
 extern "C" {
 #endif
 
+extern int sprintf(char *str, const char *format, ...);
+
 #if defined(USE_PASS_OBJECT_SIZE)
 void *memcpy(void *dst, const void *src, size_t c);
 static void *memcpy(void *dst __attribute__((pass_object_size(1))), const void *src, size_t c) __attribute__((overloadable)) __asm__("merp");
@@ -96,6 +98,55 @@
   __builtin_vsnprintf(buf, 11, "merp", list); // expected-warning {{'vsnprintf' size argument is too large; destination buffer has size 10, but size argument is 11}}
 }
 
+void call_sprintf_chk(char *buf) {
+  __builtin___sprintf_chk(buf, 1, 6, "hell\0 boy"); // expected-warning {{format string contains '\0' within the string body}}
+  __builtin___sprintf_chk(buf, 1, 2, "hell\0 boy"); // expected-warning {{format string contains '\0' within the string body}}
+  // expected-warning@-1 {{'sprintf' will always overflow; destination buffer has size 2, but format string expands to at least 5}}
+  __builtin___sprintf_chk(buf, 1, 6, "hello");
+  __builtin___sprintf_chk(buf, 1, 5, "hello"); // expected-warning {{'sprintf' will always overflow; destination buffer has size 5, but format string expands to at least 6}}
+  __builtin___sprintf_chk(buf, 1, 2, "%c", '9');
+  __builtin___sprintf_chk(buf, 1, 1, "%c", '9'); // expected-warning {{'sprintf' will always overflow; destination buffer has size 1, but format string expands to at least 2}}
+  __builtin___sprintf_chk(buf, 1, 2, "%d", 9);
+  __builtin___sprintf_chk(buf, 1, 1, "%d", 9); // expected-warning {{'sprintf' will always overflow; destination buffer has size 1, but format string expands to at least 2}}
+  __builtin___sprintf_chk(buf, 1, 2, "%%");
+  __builtin___sprintf_chk(buf, 1, 1, "%%"); // expected-warning {{'sprintf' will always overflow; destination buffer has size 1, but format string expands to at least 2}}
+  __builtin___sprintf_chk(buf, 1, 4, "%#x", 9);
+  __builtin___sprintf_chk(buf, 1, 3, "%#x", 9); // expected-warning {{'sprintf' will always overflow; destination buffer has size 3, but format string expands to at least 4}}
+  __builtin___sprintf_chk(buf, 1, 4, "%p", (void *)9);
+  __builtin___sprintf_chk(buf, 1, 3, "%p", (void *)9); // expected-warning {{'sprintf' will always overflow; destination buffer has size 3, but format string expands to at least 4}}
+  __builtin___sprintf_chk(buf, 1, 3, "%+d", 9);
+  __builtin___sprintf_chk(buf, 1, 2, "%+d", 9); // expected-warning {{'sprintf' will always overflow; destination buffer has size 2, but format string expands to at least 3}}
+  __builtin___sprintf_chk(buf, 1, 6, "%5d", 9);
+  __builtin___sprintf_chk(buf, 1, 5, "%5d", 9); // expected-warning {{'sprintf' will always overflow; destination buffer has size 5, but format string expands to at least 6}}
+  __builtin___sprintf_chk(buf, 1, 2, "%f", 9.f);
+  __builtin___sprintf_chk(buf, 1, 1, "%f", 9.f); // expected-warning {{'sprintf' will always overflow; destination buffer has size 1, but format string expands to at least 2}}
+}
+
+void call_sprintf() {
+  char buf[6];
+  sprintf(buf, "hell\0 boy"); // expected-warning {{format string contains '\0' within the string body}}
+  sprintf(buf, "hello b\0y"); // expected-warning {{format string contains '\0' within the string body}}
+  // expected-warning@-1 {{'sprintf' will always overflow; destination buffer has size 6, but format string expands to at least 8}}
+  sprintf(buf, "hello");
+  sprintf(buf, "hello!"); // expected-warning {{'sprintf' will always overflow; destination buffer has size 6, but format string expands to at least 7}}
+  sprintf(buf, "1234%%");
+  sprintf(buf, "12345%%"); // expected-warning {{'sprintf' will always overflow; destination buffer has size 6, but format string expands to at least 7}}
+  sprintf(buf, "1234%c", '9');
+  sprintf(buf, "12345%c", '9'); // expected-warning {{'sprintf' will always overflow; destination buffer has size 6, but format string expands to at least 7}}
+  sprintf(buf, "1234%d", 9);
+  sprintf(buf, "12345%d", 9); // expected-warning {{'sprintf' will always overflow; destination buffer has size 6, but format string expands to at least 7}}
+  sprintf(buf, "12%#x", 9);
+  sprintf(buf, "123%#x", 9); // expected-warning {{'sprintf' will always overflow; destination buffer has size 6, but format string expands to at least 7}}
+  sprintf(buf, "12%p", (void *)9);
+  sprintf(buf, 

[PATCH] D72901: [OpenMP] [DOCS] Update OMP5.0 feature status table [NFC]

2020-01-17 Thread Kelvin Li via Phabricator via cfe-commits
kkwli0 marked 2 inline comments as done.
kkwli0 added inline comments.



Comment at: clang/docs/OpenMPSupport.rst:240
++--+--+--+---+
+| misc extension   | prevent new type definitions in clauses   
   | :none:`unclaimed`| 
  |
 
+--+--+--+---+

ABataev wrote:
> What is this?
This is a clarification. The spec add restrictions to declare new type on 
iterators, declare reduction and declare mapper [49:11; 308:17; 327:26]


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

https://reviews.llvm.org/D72901



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


[PATCH] D72890: [xray] Allow instrumenting only function entry and/or only function exit

2020-01-17 Thread Ian Levesque via Phabricator via cfe-commits
ianlevesque updated this revision to Diff 238866.
ianlevesque added a comment.

Add x86 tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72890

Files:
  clang/include/clang/Basic/XRayInstr.h
  clang/include/clang/Driver/Options.td
  clang/lib/Basic/XRayInstr.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/Driver/XRayArgs.cpp
  clang/test/CodeGen/xray-instrumentation-bundles.cpp
  llvm/lib/CodeGen/XRayInstrumentation.cpp
  llvm/test/CodeGen/AArch64/xray-partial-instrumentation-skip-entry.ll
  llvm/test/CodeGen/AArch64/xray-partial-instrumentation-skip-exit.ll
  llvm/test/CodeGen/X86/xray-partial-instrumentation-skip-entry.ll
  llvm/test/CodeGen/X86/xray-partial-instrumentation-skip-exit.ll

Index: llvm/test/CodeGen/X86/xray-partial-instrumentation-skip-exit.ll
===
--- /dev/null
+++ llvm/test/CodeGen/X86/xray-partial-instrumentation-skip-exit.ll
@@ -0,0 +1,49 @@
+; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -filetype=asm -o - \
+; RUN: -mtriple=x86_64-unknown-linux-gnu -relocation-model=pic < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-darwin-unknown< %s | FileCheck %s
+
+define i32 @foo() nounwind noinline uwtable "function-instrument"="xray-always" "xray-skip-exit" {
+; CHECK:   .p2align 1, 0x90
+; CHECK-LABEL: Lxray_sled_0:
+; CHECK:   .ascii "\353\t"
+; CHECK-NEXT:  nopw 512(%rax,%rax)
+  ret i32 0
+; CHECK-NOT: Lxray_sled_1:
+; CHECK:   retq
+}
+; CHECK-LABEL: xray_instr_map
+; CHECK-LABEL: Lxray_sleds_start0:
+; CHECK:   .quad {{.*}}xray_sled_0
+; CHECK-LABEL: Lxray_sleds_end0:
+; CHECK-LABEL: xray_fn_idx
+; CHECK:   .quad {{.*}}xray_sleds_start0
+; CHECK-NEXT:  .quad {{.*}}xray_sleds_end0
+
+
+; We test multiple returns in a single function to make sure we're skipping all
+; of them with XRay instrumentation.
+define i32 @bar(i32 %i) nounwind noinline uwtable "function-instrument"="xray-always" "xray-skip-exit" {
+; CHECK:   .p2align 1, 0x90
+; CHECK-LABEL: Lxray_sled_1:
+; CHECK:   .ascii "\353\t"
+; CHECK-NEXT:  nopw 512(%rax,%rax)
+Test:
+  %cond = icmp eq i32 %i, 0
+  br i1 %cond, label %IsEqual, label %NotEqual
+IsEqual:
+  ret i32 0
+; CHECK-NOT: Lxray_sled_{{.*}}:
+; CHECK:   retq
+NotEqual:
+  ret i32 1
+; CHECK-NOT: Lxray_sled_{{.*}}:
+; CHECK:   retq
+}
+; CHECK-LABEL: xray_instr_map
+; CHECK-LABEL: Lxray_sleds_start1:
+; CHECK:   .quad {{.*}}xray_sled_1
+; CHECK-LABEL: Lxray_sleds_end1:
+; CHECK-LABEL: xray_fn_idx
+; CHECK:   .quad {{.*}}xray_sleds_start1
+; CHECK-NEXT:  .quad {{.*}}xray_sleds_end1
Index: llvm/test/CodeGen/X86/xray-partial-instrumentation-skip-entry.ll
===
--- /dev/null
+++ llvm/test/CodeGen/X86/xray-partial-instrumentation-skip-entry.ll
@@ -0,0 +1,50 @@
+; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -filetype=asm -o - \
+; RUN: -mtriple=x86_64-unknown-linux-gnu -relocation-model=pic < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-darwin-unknown< %s | FileCheck %s
+
+define i32 @foo() nounwind noinline uwtable "function-instrument"="xray-always" "xray-skip-entry" {
+; CHECK-NOT: Lxray_sled_0:
+  ret i32 0
+; CHECK:   .p2align 1, 0x90
+; CHECK-LABEL: Lxray_sled_0:
+; CHECK:   retq
+; CHECK-NEXT:  nopw %cs:512(%rax,%rax)
+}
+; CHECK-LABEL: xray_instr_map
+; CHECK-LABEL: Lxray_sleds_start0:
+; CHECK:   .quad {{.*}}xray_sled_0
+; CHECK-LABEL: Lxray_sleds_end0:
+; CHECK-LABEL: xray_fn_idx
+; CHECK:   .quad {{.*}}xray_sleds_start0
+; CHECK-NEXT:  .quad {{.*}}xray_sleds_end0
+
+
+; We test multiple returns in a single function to make sure we're getting all
+; of them with XRay instrumentation.
+define i32 @bar(i32 %i) nounwind noinline uwtable "function-instrument"="xray-always" "xray-skip-entry" {
+; CHECK-NOT: Lxray_sled_1:
+Test:
+  %cond = icmp eq i32 %i, 0
+  br i1 %cond, label %IsEqual, label %NotEqual
+IsEqual:
+  ret i32 0
+; CHECK:   .p2align 1, 0x90
+; CHECK-LABEL: Lxray_sled_1:
+; CHECK:   retq
+; CHECK-NEXT:  nopw %cs:512(%rax,%rax)
+NotEqual:
+  ret i32 1
+; CHECK:   .p2align 1, 0x90
+; CHECK-LABEL: Lxray_sled_2:
+; CHECK:   retq
+; CHECK-NEXT:  nopw %cs:512(%rax,%rax)
+}
+; CHECK-LABEL: xray_instr_map
+; CHECK-LABEL: Lxray_sleds_start1:
+; CHECK:   .quad {{.*}}xray_sled_1
+; CHECK:   .quad {{.*}}xray_sled_2
+; CHECK-LABEL: Lxray_sleds_end1:
+; CHECK-LABEL: xray_fn_idx
+; CHECK:   .quad {{.*}}xray_sleds_start1
+; CHECK-NEXT:  .quad {{.*}}xray_sleds_end1
Index: llvm/test/CodeGen/AArch64/xray-partial-instrumentation-skip-exit.ll

[PATCH] D71732: Move the sysroot attribute from DIModule to DICompileUnit

2020-01-17 Thread Adrian Prantl via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7b30370e5bcf: Move the sysroot attribute from DIModule to 
DICompileUnit (authored by aprantl).
Herald added projects: clang, LLDB.
Herald added subscribers: lldb-commits, cfe-commits.

Changed prior to commit:
  https://reviews.llvm.org/D71732?vs=238113=238867#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71732

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGen/debug-info-sysroot.c
  clang/test/CodeGen/debug-nvptx.c
  clang/test/Modules/debug-info-moduleimport.m
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  llvm/bindings/go/llvm/dibuilder.go
  llvm/include/llvm-c/DebugInfo.h
  llvm/include/llvm/IR/DIBuilder.h
  llvm/include/llvm/IR/DebugInfoMetadata.h
  llvm/lib/AsmParser/LLParser.cpp
  llvm/lib/Bitcode/Reader/MetadataLoader.cpp
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
  llvm/lib/IR/AsmWriter.cpp
  llvm/lib/IR/DIBuilder.cpp
  llvm/lib/IR/DebugInfo.cpp
  llvm/lib/IR/DebugInfoMetadata.cpp
  llvm/lib/IR/LLVMContextImpl.h
  llvm/test/Assembler/dicompileunit.ll
  llvm/test/Assembler/dimodule.ll
  llvm/test/Bindings/llvm-c/debug_info.ll
  llvm/test/CodeGen/X86/load-combine-dbg.ll
  llvm/test/DebugInfo/X86/DIModule.ll
  llvm/test/DebugInfo/X86/DIModuleContext.ll
  llvm/test/DebugInfo/X86/clang-module.ll
  llvm/test/DebugInfo/X86/split-dwarf-sysroot.ll
  llvm/tools/llvm-c-test/debuginfo.c
  llvm/unittests/IR/MetadataTest.cpp

Index: llvm/unittests/IR/MetadataTest.cpp
===
--- llvm/unittests/IR/MetadataTest.cpp
+++ llvm/unittests/IR/MetadataTest.cpp
@@ -96,7 +96,7 @@
 Context, 1, getFile(), "clang", false, "-g", 2, "",
 DICompileUnit::FullDebug, getTuple(), getTuple(), getTuple(),
 getTuple(), getTuple(), 0, true, false,
-DICompileUnit::DebugNameTableKind::Default, false);
+DICompileUnit::DebugNameTableKind::Default, false, "/");
   }
   DIType *getBasicType(StringRef Name) {
 return DIBasicType::get(Context, dwarf::DW_TAG_unspecified_type, Name);
@@ -1709,11 +1709,12 @@
   MDTuple *ImportedEntities = getTuple();
   uint64_t DWOId = 0x1000c0ffee;
   MDTuple *Macros = getTuple();
+  StringRef SysRoot = "/";
   auto *N = DICompileUnit::getDistinct(
   Context, SourceLanguage, File, Producer, IsOptimized, Flags,
   RuntimeVersion, SplitDebugFilename, EmissionKind, EnumTypes,
   RetainedTypes, GlobalVariables, ImportedEntities, Macros, DWOId, true,
-  false, DICompileUnit::DebugNameTableKind::Default, false);
+  false, DICompileUnit::DebugNameTableKind::Default, false, SysRoot);
 
   EXPECT_EQ(dwarf::DW_TAG_compile_unit, N->getTag());
   EXPECT_EQ(SourceLanguage, N->getSourceLanguage());
@@ -1730,6 +1731,7 @@
   EXPECT_EQ(ImportedEntities, N->getImportedEntities().get());
   EXPECT_EQ(Macros, N->getMacros().get());
   EXPECT_EQ(DWOId, N->getDWOId());
+  EXPECT_EQ(SysRoot, N->getSysRoot());
 
   TempDICompileUnit Temp = N->clone();
   EXPECT_EQ(dwarf::DW_TAG_compile_unit, Temp->getTag());
@@ -1746,7 +1748,7 @@
   EXPECT_EQ(GlobalVariables, Temp->getGlobalVariables().get());
   EXPECT_EQ(ImportedEntities, Temp->getImportedEntities().get());
   EXPECT_EQ(Macros, Temp->getMacros().get());
-  EXPECT_EQ(DWOId, Temp->getDWOId());
+  EXPECT_EQ(SysRoot, Temp->getSysRoot());
 
   auto *TempAddress = Temp.get();
   auto *Clone = MDNode::replaceWithPermanent(std::move(Temp));
@@ -1767,11 +1769,12 @@
   MDTuple *RetainedTypes = MDTuple::getDistinct(Context, None);
   MDTuple *ImportedEntities = MDTuple::getDistinct(Context, None);
   uint64_t DWOId = 0xc0ffee;
+  StringRef SysRoot = "/";
   auto *N = DICompileUnit::getDistinct(
   Context, SourceLanguage, File, Producer, IsOptimized, Flags,
   RuntimeVersion, SplitDebugFilename, EmissionKind, EnumTypes,
   RetainedTypes, nullptr, ImportedEntities, nullptr, DWOId, true, false,
-  DICompileUnit::DebugNameTableKind::Default, false);
+  DICompileUnit::DebugNameTableKind::Default, false, SysRoot);
 
   auto *GlobalVariables = MDTuple::getDistinct(Context, None);
   EXPECT_EQ(nullptr, N->getGlobalVariables().get());
@@ -2050,28 +2053,19 @@
   StringRef Name = "module";
   StringRef ConfigMacro = "-DNDEBUG";
   StringRef Includes = "-I.";
-  StringRef Sysroot = "/";
 
-  auto *N = DIModule::get(Context, Scope, Name, ConfigMacro, Includes, Sysroot);
+  auto *N = DIModule::get(Context, Scope, Name, ConfigMacro, Includes);
 
   EXPECT_EQ(dwarf::DW_TAG_module, N->getTag());
   EXPECT_EQ(Scope, N->getScope());
   EXPECT_EQ(Name, N->getName());
   EXPECT_EQ(ConfigMacro, N->getConfigurationMacros());
   EXPECT_EQ(Includes, N->getIncludePath());
-  EXPECT_EQ(Sysroot, N->getSysRoot());
-  EXPECT_EQ(N, DIModule::get(Context, Scope, Name,
-

[PATCH] D72304: [OpenMP][OMPIRBuilder] Add Directives (master and critical) to OMPBuilder.

2020-01-17 Thread Fady Ghanim via Phabricator via cfe-commits
fghanim added a comment.

No, I don't have commit privileges. I'd appreciate if you'd commit this for me. 
Thanks :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72304



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


[PATCH] D72910: Fix a bug with clang with object destructor, while skipping object initialization - make clang crash

2020-01-17 Thread ido via Phabricator via cfe-commits
ykfre added a comment.

In D72910#1826293 , @dim wrote:

> Aha, which version of clang-cl are you using?  With the released version of 
> clang-cl 9.0.1, I get a warning instead of an error:
>
>   cleanup.cpp(15,5): warning: jump from this goto statement to its label is a 
> Microsoft extension [-Wmicrosoft-goto]
>   goto clean_up;
>   ^
>   cleanup.cpp(20,7): note: jump bypasses variable initialization
> int i = 0;
> ^
>   cleanup.cpp(18,4): note: jump bypasses variable initialization
>   A a;
> ^
>   1 warning generated.
>
>
> So apparently another code path is activated when the target is Microsoft.


I succeeded to narrow it to the use of the flag -WCL4


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72910



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


[PATCH] D72304: [OpenMP][OMPIRBuilder] Add Directives (master and critical) to OMPBuilder.

2020-01-17 Thread Fady Ghanim via Phabricator via cfe-commits
fghanim updated this revision to Diff 238858.
fghanim added a comment.

Addressing reviewer's comments regarding styling.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72304

Files:
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/test/OpenMP/critical_codegen.cpp
  clang/test/OpenMP/master_codegen.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
  llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/lib/Frontend/OpenMP/OMPConstants.cpp
  llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
  llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp

Index: llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
===
--- llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
+++ llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
@@ -613,4 +613,161 @@
   }
 }
 
+TEST_F(OpenMPIRBuilderTest, MasterDirective) {
+  using InsertPointTy = OpenMPIRBuilder::InsertPointTy;
+  OpenMPIRBuilder OMPBuilder(*M);
+  OMPBuilder.initialize();
+  F->setName("func");
+  IRBuilder<> Builder(BB);
+
+  OpenMPIRBuilder::LocationDescription Loc({Builder.saveIP(), DL});
+
+  AllocaInst *PrivAI = nullptr;
+
+  BasicBlock *EntryBB = nullptr;
+  BasicBlock *ExitBB = nullptr;
+  BasicBlock *ThenBB = nullptr;
+
+  auto BodyGenCB = [&](InsertPointTy AllocaIP, InsertPointTy CodeGenIP,
+   BasicBlock ) {
+if (AllocaIP.isSet())
+  Builder.restoreIP(AllocaIP);
+else
+  Builder.SetInsertPoint(&*(F->getEntryBlock().getFirstInsertionPt()));
+PrivAI = Builder.CreateAlloca(F->arg_begin()->getType());
+Builder.CreateStore(F->arg_begin(), PrivAI);
+
+llvm::BasicBlock *CodeGenIPBB = CodeGenIP.getBlock();
+llvm::Instruction *CodeGenIPInst = &*CodeGenIP.getPoint();
+EXPECT_EQ(CodeGenIPBB->getTerminator(), CodeGenIPInst);
+
+Builder.restoreIP(CodeGenIP);
+
+// collect some info for checks later
+ExitBB = FiniBB.getUniqueSuccessor();
+ThenBB = Builder.GetInsertBlock();
+EntryBB = ThenBB->getUniquePredecessor();
+
+// simple instructions for body
+Value *PrivLoad = Builder.CreateLoad(PrivAI, "local.use");
+Builder.CreateICmpNE(F->arg_begin(), PrivLoad);
+  };
+
+  auto FiniCB = [&](InsertPointTy IP) {
+BasicBlock *IPBB = IP.getBlock();
+EXPECT_NE(IPBB->end(), IP.getPoint());
+  };
+
+  Builder.restoreIP(OMPBuilder.CreateMaster(Builder, BodyGenCB, FiniCB));
+  Value *EntryBBTI = EntryBB->getTerminator();
+  EXPECT_NE(EntryBBTI, nullptr);
+  EXPECT_TRUE(isa(EntryBBTI));
+  BranchInst *EntryBr = cast(EntryBB->getTerminator());
+  EXPECT_TRUE(EntryBr->isConditional());
+  EXPECT_EQ(EntryBr->getSuccessor(0), ThenBB);
+  EXPECT_EQ(ThenBB->getUniqueSuccessor(), ExitBB);
+  EXPECT_EQ(EntryBr->getSuccessor(1), ExitBB);
+
+  CmpInst *CondInst = cast(EntryBr->getCondition());
+  EXPECT_TRUE(isa(CondInst->getOperand(0)));
+
+  CallInst *MasterEntryCI = cast(CondInst->getOperand(0));
+  EXPECT_EQ(MasterEntryCI->getNumArgOperands(), 2U);
+  EXPECT_EQ(MasterEntryCI->getCalledFunction()->getName(), "__kmpc_master");
+  EXPECT_TRUE(isa(MasterEntryCI->getArgOperand(0)));
+
+  CallInst *MasterEndCI = nullptr;
+  for (auto  : *ThenBB) {
+Instruction *cur = 
+if (isa(cur)) {
+  MasterEndCI = cast(cur);
+  if (MasterEndCI->getCalledFunction()->getName() == "__kmpc_end_master")
+break;
+  MasterEndCI = nullptr;
+}
+  }
+  EXPECT_NE(MasterEndCI, nullptr);
+  EXPECT_EQ(MasterEndCI->getNumArgOperands(), 2U);
+  EXPECT_TRUE(isa(MasterEndCI->getArgOperand(0)));
+  EXPECT_EQ(MasterEndCI->getArgOperand(1), MasterEntryCI->getArgOperand(1));
+}
+
+TEST_F(OpenMPIRBuilderTest, CriticalDirective) {
+  using InsertPointTy = OpenMPIRBuilder::InsertPointTy;
+  OpenMPIRBuilder OMPBuilder(*M);
+  OMPBuilder.initialize();
+  F->setName("func");
+  IRBuilder<> Builder(BB);
+
+  OpenMPIRBuilder::LocationDescription Loc({Builder.saveIP(), DL});
+
+  AllocaInst *PrivAI = Builder.CreateAlloca(F->arg_begin()->getType());
+
+  BasicBlock *EntryBB = nullptr;
+
+  auto BodyGenCB = [&](InsertPointTy AllocaIP, InsertPointTy CodeGenIP,
+   BasicBlock ) {
+// collect some info for checks later
+EntryBB = FiniBB.getUniquePredecessor();
+
+// actual start for bodyCB
+llvm::BasicBlock *CodeGenIPBB = CodeGenIP.getBlock();
+llvm::Instruction *CodeGenIPInst = &*CodeGenIP.getPoint();
+EXPECT_EQ(CodeGenIPBB->getTerminator(), CodeGenIPInst);
+EXPECT_EQ(EntryBB, CodeGenIPBB);
+
+// body begin
+Builder.restoreIP(CodeGenIP);
+Builder.CreateStore(F->arg_begin(), PrivAI);
+Value *PrivLoad = Builder.CreateLoad(PrivAI, "local.use");
+Builder.CreateICmpNE(F->arg_begin(), PrivLoad);
+  };
+
+  auto FiniCB = [&](InsertPointTy IP) {
+BasicBlock *IPBB = IP.getBlock();
+EXPECT_NE(IPBB->end(), IP.getPoint());
+  };
+
+  

[PATCH] D72806: [HIP] fix paths for executables not in clang bin directory

2020-01-17 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment.

Tank you for splitting the patch. For CMake parts @beanz would be the person to 
make the call.


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

https://reviews.llvm.org/D72806



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


[PATCH] D68912: Adds -Wrange-loop-analysis to -Wall

2020-01-17 Thread Denis Nikitin via Phabricator via cfe-commits
denik added a comment.

We are hitting the  warning in template code with bool and loop like this: "for 
(const auto& element : value)" where element is bool from template. But not 
always.
When it is bool the warning triggers:
error: loop variable 'element' is always a copy because the range of type 
'const std::vector >' does not return a reference 
[-Werror,-Wrange-loop-analysis]

However, the template type can also use non-bools and if I remove the reference 
I hit alternative case where the warning complains about copy operation of 
reference types:
error: loop variable 'element' of type 'const std::__1::basic_string' 
creates a copy from type 'const std::__1::basic_string' 
[-Werror,-Wrange-loop-analysis]
for (const auto element : value):
use reference type 'const std::__1::tuple > > &' to 
prevent copying

So there is no way to satisfy the warning other than disabling it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68912



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


[PATCH] D71301: [clang][IFS] Prevent Clang-IFS from Leaking symbols from inside a block.

2020-01-17 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi added a comment.

This appears to only happen with -fintegrated-cc1, with fno-integrated-cc1 it 
does not repro. Still looking into this.

In D71301#1826928 , @thegameg wrote:

> Hi @plotfi, this seems to cause failures with ASAN and UBSAN on green dragon: 
> http://green.lab.llvm.org/green/job/clang-stage2-cmake-RgSan/6886/consoleFull
>
> The following tests are failing:
>
>   Clang :: InterfaceStubs/driver-test.c
>   Clang :: InterfaceStubs/driver-test2.c
>   





Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71301



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


[PATCH] D69878: Consoldiate internal denormal flushing controls

2020-01-17 Thread Andy Kaylor via Phabricator via cfe-commits
andrew.w.kaylor accepted this revision.
andrew.w.kaylor added a comment.
This revision is now accepted and ready to land.

I don't know if there were other reviewers who haven't commented on how you 
addressed their concerns, but this looks good to me.

Thanks for taking the time to improve our handling of this!


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

https://reviews.llvm.org/D69878



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


[clang] c33ba8c - [OPENMP]Improve debug locations in OpenMP regions.

2020-01-17 Thread Alexey Bataev via cfe-commits

Author: Alexey Bataev
Date: 2020-01-17T14:24:32-05:00
New Revision: c33ba8c15858c0316378caf2667c8feee32dad36

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

LOG: [OPENMP]Improve debug locations in OpenMP regions.

Emit more precise debug locations for the OpenMP outlined regions.

Added: 


Modified: 
clang/lib/CodeGen/CGOpenMPRuntime.cpp
clang/lib/CodeGen/CGStmtOpenMP.cpp
clang/lib/CodeGen/CodeGenFunction.h
clang/test/OpenMP/parallel_for_codegen.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp 
b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index e1ba4c63a70f..896cf378c16b 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -1517,7 +1517,7 @@ static llvm::Function 
*emitParallelOrTeamsOutlinedFunction(
   CGOpenMPOutlinedRegionInfo CGInfo(*CS, ThreadIDVar, CodeGen, InnermostKind,
 HasCancel, OutlinedHelperName);
   CodeGenFunction::CGCapturedStmtRAII CapInfoRAII(CGF, );
-  return CGF.GenerateOpenMPCapturedStmtFunction(*CS);
+  return CGF.GenerateOpenMPCapturedStmtFunction(*CS, D.getBeginLoc());
 }
 
 llvm::Function *CGOpenMPRuntime::emitParallelOutlinedFunction(
@@ -3772,6 +3772,7 @@ void CGOpenMPRuntime::emitForStaticInit(CodeGenFunction 
,
   llvm::Value *ThreadId = getThreadID(CGF, Loc);
   llvm::FunctionCallee StaticInitFunction =
   createForStaticInitFunction(Values.IVSize, Values.IVSigned);
+  auto DL = ApplyDebugLocation::CreateDefaultArtificial(CGF, Loc);
   emitForStaticInitCall(CGF, UpdatedLocation, ThreadId, StaticInitFunction,
 ScheduleNum, ScheduleKind.M1, ScheduleKind.M2, Values);
 }
@@ -3806,6 +3807,7 @@ void CGOpenMPRuntime::emitForStaticFinish(CodeGenFunction 
,
? OMP_IDENT_WORK_LOOP
: OMP_IDENT_WORK_SECTIONS),
   getThreadID(CGF, Loc)};
+  auto DL = ApplyDebugLocation::CreateDefaultArtificial(CGF, Loc);
   CGF.EmitRuntimeCall(createRuntimeFunction(OMPRTL__kmpc_for_static_fini),
   Args);
 }
@@ -6484,7 +6486,7 @@ void CGOpenMPRuntime::emitTargetOutlinedFunctionHelper(
   CGOpenMPTargetRegionInfo CGInfo(CS, CodeGen, EntryFnName);
   CodeGenFunction::CGCapturedStmtRAII CapInfoRAII(CGF, );
 
-  OutlinedFn = CGF.GenerateOpenMPCapturedStmtFunction(CS);
+  OutlinedFn = CGF.GenerateOpenMPCapturedStmtFunction(CS, D.getBeginLoc());
 
   // If this target outline function is not an offload entry, we don't need to
   // register it.

diff  --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp 
b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index dc3899f0e4ea..f44405a03622 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -365,26 +365,28 @@ static QualType getCanonicalParamType(ASTContext , 
QualType T) {
 }
 
 namespace {
-  /// Contains required data for proper outlined function codegen.
-  struct FunctionOptions {
-/// Captured statement for which the function is generated.
-const CapturedStmt *S = nullptr;
-/// true if cast to/from  UIntPtr is required for variables captured by
-/// value.
-const bool UIntPtrCastRequired = true;
-/// true if only casted arguments must be registered as local args or VLA
-/// sizes.
-const bool RegisterCastedArgsOnly = false;
-/// Name of the generated function.
-const StringRef FunctionName;
-explicit FunctionOptions(const CapturedStmt *S, bool UIntPtrCastRequired,
- bool RegisterCastedArgsOnly,
- StringRef FunctionName)
-: S(S), UIntPtrCastRequired(UIntPtrCastRequired),
-  RegisterCastedArgsOnly(UIntPtrCastRequired && 
RegisterCastedArgsOnly),
-  FunctionName(FunctionName) {}
-  };
-}
+/// Contains required data for proper outlined function codegen.
+struct FunctionOptions {
+  /// Captured statement for which the function is generated.
+  const CapturedStmt *S = nullptr;
+  /// true if cast to/from  UIntPtr is required for variables captured by
+  /// value.
+  const bool UIntPtrCastRequired = true;
+  /// true if only casted arguments must be registered as local args or VLA
+  /// sizes.
+  const bool RegisterCastedArgsOnly = false;
+  /// Name of the generated function.
+  const StringRef FunctionName;
+  /// Location of the non-debug version of the outlined function.
+  SourceLocation Loc;
+  explicit FunctionOptions(const CapturedStmt *S, bool UIntPtrCastRequired,
+   bool RegisterCastedArgsOnly, StringRef FunctionName,
+   SourceLocation Loc)
+  : S(S), UIntPtrCastRequired(UIntPtrCastRequired),
+RegisterCastedArgsOnly(UIntPtrCastRequired && RegisterCastedArgsOnly),
+

[clang] 90bdb03 - Update clang test.

2020-01-17 Thread Alina Sbirlea via cfe-commits

Author: Alina Sbirlea
Date: 2020-01-17T11:08:59-08:00
New Revision: 90bdb037276be43df260af004f620b21645d2617

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

LOG: Update clang test.

Added: 


Modified: 
clang/test/CodeGen/thinlto-distributed-newpm.ll

Removed: 




diff  --git a/clang/test/CodeGen/thinlto-distributed-newpm.ll 
b/clang/test/CodeGen/thinlto-distributed-newpm.ll
index 66bcd1cb250b..bac9c4322045 100644
--- a/clang/test/CodeGen/thinlto-distributed-newpm.ll
+++ b/clang/test/CodeGen/thinlto-distributed-newpm.ll
@@ -170,7 +170,6 @@
 ; CHECK-O: Invalidating analysis: DemandedBitsAnalysis on main
 ; CHECK-O: Invalidating analysis: PostDominatorTreeAnalysis on main
 ; CHECK-O: Invalidating analysis: CallGraphAnalysis
-; CHECK-O: Invalidating analysis: GlobalsAA
 ; CHECK-O: Finished {{.*}}Module pass manager run.
 ; CHECK-O: Running pass: PassManager<{{.*}}Module>
 ; CHECK-O: Starting {{.*}}Module pass manager run.
@@ -180,7 +179,6 @@
 ; CHECK-O: Running pass: ReversePostOrderFunctionAttrsPass
 ; CHECK-O: Running analysis: CallGraphAnalysis
 ; CHECK-O: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA
-; CHECK-O: Running analysis: GlobalsAA
 ; CHECK-O: Running pass: 
ModuleToFunctionPassAdaptor<{{.*}}PassManager<{{.*}}Function> >
 ; CHECK-O: Starting {{.*}}Function pass manager run.
 ; CHECK-O: Running pass: Float2IntPass on main



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


[PATCH] D72940: Add a support for clang tidy to import another configurations files from .clang-tidy

2020-01-17 Thread ido via Phabricator via cfe-commits
ykfre created this revision.
ykfre added a reviewer: clang-tools-extra.
ykfre added a project: clang-tools-extra.
Herald added subscribers: cfe-commits, arphaman.
Herald added a project: clang.

add  ConfigurationsFilesToImport option - to make it possible to import another 
configurations files from .clang-tidy, So there will be no need
to duplicate anymore the configuration file among projects, and it will be 
possible to just point the configuration file to some config in a share.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72940

Files:
  clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
  clang-tools-extra/clang-tidy/ClangTidyOptions.h
  clang-tools-extra/docs/clang-tidy/index.rst


Index: clang-tools-extra/docs/clang-tidy/index.rst
===
--- clang-tools-extra/docs/clang-tidy/index.rst
+++ clang-tools-extra/docs/clang-tidy/index.rst
@@ -242,7 +242,9 @@
   Configuration files:
 clang-tidy attempts to read configuration for each source file from a
 .clang-tidy file located in the closest parent directory of the source
-file. If any configuration options have a corresponding command-line
+file. This file can also imports configuration from another configuration 
file,
+using ConfigurationsFilesToImport option.
+If any configuration options have a corresponding command-line
 option, command-line option takes precedence. The effective
 configuration can be inspected using -dump-config:
 
@@ -251,6 +253,7 @@
   Checks:  '-*,some-check'
   WarningsAsErrors: ''
   HeaderFilterRegex: ''
+  ConfigurationsFilesToImport: ['yaml1FilePath', 'yaml2FilePath']
   FormatStyle: none
   User:user
   CheckOptions:
Index: clang-tools-extra/clang-tidy/ClangTidyOptions.h
===
--- clang-tools-extra/clang-tidy/ClangTidyOptions.h
+++ clang-tools-extra/clang-tidy/ClangTidyOptions.h
@@ -73,6 +73,9 @@
   /// Output warnings from system headers matching \c HeaderFilterRegex.
   llvm::Optional SystemHeaders;
 
+  /// Clang tidy configurations files to import.
+  llvm::Optional> ConfigurationsFilesToImport;
+
   /// Format code around applied fixes with clang-format using this
   /// style.
   ///
Index: clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
===
--- clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
+++ clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
@@ -92,6 +92,7 @@
 IO.mapOptional("CheckOptions", NOpts->Options);
 IO.mapOptional("ExtraArgs", Options.ExtraArgs);
 IO.mapOptional("ExtraArgsBefore", Options.ExtraArgsBefore);
+IO.mapOptional("ConfigurationsFilesToImport", 
Options.ConfigurationsFilesToImport);
   }
 };
 
@@ -325,12 +326,34 @@
 }
 
 llvm::ErrorOr parseConfiguration(StringRef Config) {
-  llvm::yaml::Input Input(Config);
-  ClangTidyOptions Options;
-  Input >> Options;
-  if (Input.error())
-return Input.error();
-  return Options;
+   ClangTidyOptions Options;
+   llvm::yaml::Input Input(Config);
+
+   Input >> Options;
+   if (Input.error())
+   return Input.error();
+   if (!Options.ConfigurationsFilesToImport.hasValue()) {
+   return Options;
+   }
+   for (const auto& file : *Options.ConfigurationsFilesToImport)
+   {
+   llvm::ErrorOr> Text = 
llvm::MemoryBuffer::getFile(file);
+if (std::error_code EC = Text.getError()) {
+llvm::errs() << "Can't read " << file << ": " << EC.message()
+<< "\n";
+return EC;
+}
+   Config = Text->get()->getBuffer();
+   auto ReturnedOptions = parseConfiguration(Config);
+   if (ReturnedOptions)
+   {
+   Options = ReturnedOptions->mergeWith(Options);
+   }
+   else {
+   return ReturnedOptions;
+   }
+   }
+   return Options;
 }
 
 std::string configurationAsText(const ClangTidyOptions ) {


Index: clang-tools-extra/docs/clang-tidy/index.rst
===
--- clang-tools-extra/docs/clang-tidy/index.rst
+++ clang-tools-extra/docs/clang-tidy/index.rst
@@ -242,7 +242,9 @@
   Configuration files:
 clang-tidy attempts to read configuration for each source file from a
 .clang-tidy file located in the closest parent directory of the source
-file. If any configuration options have a corresponding command-line
+file. This file can also imports configuration from another configuration file,
+using ConfigurationsFilesToImport option.
+If any configuration options have a corresponding command-line
 option, command-line option takes precedence. The effective
 configuration can be inspected using -dump-config:
 
@@ -251,6 +253,7 @@
   

[PATCH] D71913: [LTO/WPD] Enable aggressive WPD under LTO option

2020-01-17 Thread Eugene Leviant via Phabricator via cfe-commits
evgeny777 added inline comments.



Comment at: llvm/test/Transforms/WholeProgramDevirt/import-indir.ll:2
 ; Test that we correctly import an indir resolution for type identifier 
"typeid1".
-; RUN: opt -S -wholeprogramdevirt -wholeprogramdevirt-summary-action=import 
-wholeprogramdevirt-read-summary=%S/Inputs/import-indir.yaml 
-wholeprogramdevirt-write-summary=%t < %s | FileCheck %s
+; RUN: opt -S -wholeprogramdevirt -whole-program-visibility 
-wholeprogramdevirt-summary-action=import 
-wholeprogramdevirt-read-summary=%S/Inputs/import-indir.yaml 
-wholeprogramdevirt-write-summary=%t < %s | FileCheck %s
 ; RUN: FileCheck --check-prefix=SUMMARY %s < %t

tejohnson wrote:
> evgeny777 wrote:
> > Why do you need `-whole-program-visibility` here? Correct me if I'm wrong, 
> > but AFAIK module scanning doesn't happen during import and GV visibility 
> > should be taken from imported summary.
> Before my patch, type tests were only inserted for vtables with hidden LTO 
> visibility. Therefore, the very presence of type tests communicated the 
> hidden visibility and enabled the WPD.
> 
> With this patch, to support enabling WPD aggressively at LTO time, we now 
> insert type tests unconditionally under -fwhole-program-vtables. The 
> vcall_visibility metadata tells LTO how to interpret them. And the new 
> options allow changing those to hidden visibility to get the more aggressive 
> WPD.
> 
> Because these legacy tests have type tests but no vcall_visibility metadata, 
> we now will conservatively treat them as having public LTO visibility. This 
> option is therefore required to convert the summarized (default public) vcall 
> visibility into hidden to get the prior more aggressive behavior they are 
> trying to test.
> 
> Note I could have instead changed the assembly here to add hidden 
> vcall_visibility metadata everywhere. That seemed a little onerous so that's 
> why I just added the option. I could add a comment to that effect if it would 
> help?
I think you can remove this option from this test (and probably others using 
-wholeprogramdevirt-summary-action=import option), because visibility seems to 
be not analyzed on import phase. I just did this btw and test still passes 
flawlessly.



Comment at: llvm/tools/opt/opt.cpp:634
+  // not performed via opt.
+  updateVCallVisibilityInModule(*M,
+/* WholeProgramVisibilityEnabledInLTO */ 
false);

tejohnson wrote:
> evgeny777 wrote:
> > Hm, looks like I don't fully understand this. I have following concerns:
> > 
> > 1) According to your changes every time I use `opt -wholeprogramdevirt` I 
> > also have to pass `-whole-program-visibility`. Has `-wholeprogramdevirt` 
> > flag become no-op without this additional flag? If so this looks counter 
> > intuitive to me.
> > 
> > 2) When I use `opt -wholeprogramdevirt` default constructor of 
> > `WholeProgramDevirt` class is called and `UseCommandLine` flag is set to 
> > true. Can't I use this flag to effectively lower visibility in module 
> > instead of playing with metadata?
> > 
> > ```
> > if (VS->vCallVisibility() == GlobalObject::VCallVisibilityPublic && 
> > !UseCommandLine)
> >  return false;
> > ```
> > 
> > According to your changes every time I use opt -wholeprogramdevirt I also 
> > have to pass -whole-program-visibility. Has -wholeprogramdevirt flag become 
> > no-op without this additional flag? If so this looks counter intuitive to 
> > me.
> 
> No, it wouldn't be needed if the tests contained !vcall_visibility metadata 
> indicating hidden LTO visibility (see my earlier comment response).
> 
> > When I use opt -wholeprogramdevirt default constructor of 
> > WholeProgramDevirt class is called and UseCommandLine flag is set to true. 
> > Can't I use this flag to effectively lower visibility in module instead of 
> > playing with metadata?
> 
> I could do that. What it would mean though is that we would be unable to use 
> opt for any future testing of vtables intended to have public vcall 
> visibility (either through a lack of that metadata, or explicit 
> vcall_vsibility metadata indicating public). Which might be ok - in fact all 
> my new testing of this behavior is via llvm-lto2 or the linkers. I suppose 
> that would obviate this change as well as all the opt based test changes to 
> pass the flag. Do you think that is better?
> I could do that. What it would mean though is that we would be unable to use 
> opt for any future testing of vtables intended to have public vcall 
> visibility (either through a lack of that metadata, or explicit 
> vcall_vsibility metadata indicating public). Which might be ok - in fact all 
> my new testing of this behavior is via llvm-lto2 or the linkers. I suppose 
> that would obviate this change as well as all the opt based test changes to 
> pass the flag. Do you think that is better?

Thanks for explanation. I think it's okay to have this extra option for 

[PATCH] D72901: [OpenMP] [DOCS] Update OMP5.0 feature status table [NFC]

2020-01-17 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added inline comments.



Comment at: clang/docs/OpenMPSupport.rst:194
 
+--+--+--+---+
-| device extension | requires directive (unified shared memory)
   | :good:`done` | 
  |
+| device extension | requires directive
   | :good:`done` | 
  |
 
+--+--+--+---+

ABataev wrote:
> We have support only for unified memory, so must be `partial`
Let's keep the explicit ` (unified shared memory) -> done ` line and add one 
for the others as not done.


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

https://reviews.llvm.org/D72901



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


[PATCH] D63978: Clang Interface Stubs merger plumbing for Driver

2020-01-17 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.
Herald added a subscriber: dexonsmith.

I think we should not rely too much on the driver emitting object files. There 
can be many subtle differences (D68897 ).

When the -emit-obj output is  feed to llvm-nm, the clang cc1 command line 
should have an explicit target triple.

`clang -cc1 -triple x86_64-pc-windows /dev/null -emit-obj -o a.o`

   b .bss
   d .data
   a @feat.00
   t .text

`clang -cc1 -triple x86_64 /dev/null -emit-obj -o a.o`
nm has no output.

`clang -cc1 -triple x86_64-macos /dev/null -emit-obj -o a.o`
GNU nm's macho port prints "no symbols"


Repository:
  rL LLVM

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

https://reviews.llvm.org/D63978



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


[PATCH] D70183: Detect source location overflow due includes

2020-01-17 Thread Mikhail Maltsev via Phabricator via cfe-commits
miyuki accepted this revision.
miyuki added a comment.
This revision is now accepted and ready to land.

LGTM, but since we both work at Arm, let's wait a week for other folks to chime 
in if they have any objections.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70183



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


[PATCH] D71301: [clang][IFS] Prevent Clang-IFS from Leaking symbols from inside a block.

2020-01-17 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi added a comment.

Thanks for pinging on this @thegameg. I had been looking at this a day or two 
ago but got side-tracked. Will take another look.

In D71301#1826928 , @thegameg wrote:

> Hi @plotfi, this seems to cause failures with ASAN and UBSAN on green dragon: 
> http://green.lab.llvm.org/green/job/clang-stage2-cmake-RgSan/6886/consoleFull
>
> The following tests are failing:
>
>   Clang :: InterfaceStubs/driver-test.c
>   Clang :: InterfaceStubs/driver-test2.c
>   





Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71301



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


[PATCH] D72484: [clang-tidy] Fix check for Abseil internal namespace access

2020-01-17 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.

LGTM




Comment at: 
clang-tools-extra/clang-tidy/abseil/NoInternalDependenciesCheck.cpp:43-44
+
+  if (!LocAtFault.isValid())
+return;
+

EricWF wrote:
> rogeeff wrote:
> > aaron.ballman wrote:
> > > rogeeff wrote:
> > > > lebedev.ri wrote:
> > > > > Is there test coverage for this? When does/can this happen?
> > > > At the time when I wrote this internally the test cases in 
> > > > abseil-no-internal-dependencies.cpp were reproducing this failure. I'm 
> > > > not sure this is still the case. It is possible compiler was fixed 
> > > > since then.
> > > I am not certain I'm following along (sorry if I'm just being dense). Are 
> > > you saying that the existing test coverage in 
> > > abseil-no-internal-dependencies.cpp was failing for you internally, and 
> > > that's the reason for this fix? Or are you saying that the newly-added 
> > > test cases in this patch were triggering this failure?
> > Newly added test cases were triggering the failure.
> @lebedev.ri This also happened when the source location was inside a macro 
> expansion. Which is solved by getting the spelling loc, and there is a test 
> case that covers it.
> Newly added test cases were triggering the failure.

Thanks for the clarification!


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

https://reviews.llvm.org/D72484



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


[PATCH] D72484: [clang-tidy] Fix check for Abseil internal namespace access

2020-01-17 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

LGTM.

The weird template test case might is derived from an old failure that I 
believe was addressed in Clang, but regression tests are fine by me.
The macro expansion fix is correct and correctly tested.




Comment at: 
clang-tools-extra/clang-tidy/abseil/NoInternalDependenciesCheck.cpp:43-44
+
+  if (!LocAtFault.isValid())
+return;
+

rogeeff wrote:
> aaron.ballman wrote:
> > rogeeff wrote:
> > > lebedev.ri wrote:
> > > > Is there test coverage for this? When does/can this happen?
> > > At the time when I wrote this internally the test cases in 
> > > abseil-no-internal-dependencies.cpp were reproducing this failure. I'm 
> > > not sure this is still the case. It is possible compiler was fixed since 
> > > then.
> > I am not certain I'm following along (sorry if I'm just being dense). Are 
> > you saying that the existing test coverage in 
> > abseil-no-internal-dependencies.cpp was failing for you internally, and 
> > that's the reason for this fix? Or are you saying that the newly-added test 
> > cases in this patch were triggering this failure?
> Newly added test cases were triggering the failure.
@lebedev.ri This also happened when the source location was inside a macro 
expansion. Which is solved by getting the spelling loc, and there is a test 
case that covers it.


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

https://reviews.llvm.org/D72484



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


[PATCH] D71301: [clang][IFS] Prevent Clang-IFS from Leaking symbols from inside a block.

2020-01-17 Thread Francis Visoiu Mistrih via Phabricator via cfe-commits
thegameg added a comment.

Hi @plotfi, this seems to cause failures with ASAN and UBSAN on green dragon: 
http://green.lab.llvm.org/green/job/clang-stage2-cmake-RgSan/6886/consoleFull

The following tests are failing:

  Clang :: InterfaceStubs/driver-test.c
  Clang :: InterfaceStubs/driver-test2.c


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71301



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


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

2020-01-17 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:31080
+
+  BuildMI(blockMBB, DL, TII->get(IsLP64 ? X86::SUB64ri32 : X86::SUB32ri),
+  physSPReg)

serge-sans-paille wrote:
> craig.topper wrote:
> > This uses physSPReg, but doesn't match the condition for when physSPReg is 
> > a 64-bit register. Same at several places below.
> Sorry, I don't understand your remark. Can you elaborate?
If physSPReg is RSP then you need to use SUB64ri32 and if its ESP you need to 
use SUB32ri. The condition you're using here is "IsLP64", but the condition for 
phySPReg to be RSP is "IsLP64 || Subtarget.isTargetNaCl64()". So there's a 
mismatch when IsLP64 is false and Subtarget.isTargetNaCl64() is true.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68720



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


[clang] d003801 - [InterfaceStubs][test] Add -triple to clang/test/InterfaceStubs/externstatic.c to make it robust

2020-01-17 Thread Fangrui Song via cfe-commits

Author: Fangrui Song
Date: 2020-01-17T10:32:20-08:00
New Revision: d0038012fd7f91dc81e5a13ffb24f3b43b499fba

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

LOG: [InterfaceStubs][test] Add -triple to 
clang/test/InterfaceStubs/externstatic.c to make it robust

llvm-nm on Linux prints 0 line while llvm-nm on macOS prints 1 line.

Added: 


Modified: 
clang/test/InterfaceStubs/externstatic.c

Removed: 




diff  --git a/clang/test/InterfaceStubs/externstatic.c 
b/clang/test/InterfaceStubs/externstatic.c
index 5715af74d2ad..503f04e28f0e 100644
--- a/clang/test/InterfaceStubs/externstatic.c
+++ b/clang/test/InterfaceStubs/externstatic.c
@@ -1,19 +1,20 @@
 // RUN: %clang -cc1 -fvisibility default -DSTORAGE="extern" -o - 
-emit-interface-stubs -std=c99 -xc %s | \
 // RUN: FileCheck -check-prefix=CHECK-EXTERN %s
 
-// RUN: %clang -fvisibility=default -DSTORAGE="extern" -O0 -o - -c -std=c99 \
-// RUN: -xc %s | llvm-nm - 2>&1 | FileCheck -check-prefix=CHECK-EXTERN %s
+// RUN: %clang -cc1 -triple x86_64 -fvisibility default -DSTORAGE=extern -O0 
-o - -emit-obj -std=c99 \
+// RUN:   %s | llvm-nm - 2>&1 | FileCheck -check-prefix=CHECK-EXTERN %s
 
 // RUN: %clang -cc1 -fvisibility default -DSTORAGE="extern" -o - 
-emit-interface-stubs -std=c99 -xc %s | \
 // RUN: FileCheck -check-prefix=CHECK-EXTERN2 %s
 
-// RUN: %clang -fvisibility=default -DSTORAGE="extern" -O0 -o - -c -std=c99 
-xc %s | llvm-nm - 2>&1 | \
-// RUN: FileCheck -check-prefix=CHECK-EXTERN2 %s
+// RUN: %clang -cc1 -triple x86_64 -fvisibility default -DSTORAGE=extern -O0 
-o - -emit-obj -std=c99 \
+// RUN:   %s | llvm-nm - 2>&1 | FileCheck -check-prefix=CHECK-EXTERN2 %s
 
 // RUN: %clang -cc1 -fvisibility default -DSTORAGE="static" -o - 
-emit-interface-stubs -std=c99 -xc %s | \
 // RUN: FileCheck -check-prefix=CHECK-STATIC %s
 
-// RUN: %clang -fvisibility=default -DSTORAGE="static" -O0 -o - -c -std=c99 
-xc %s | llvm-nm - 2>&1 | count 0
+// RUN: %clang -cc1 -triple x86_64 -fvisibility default -DSTORAGE=static -O0 
-o - -emit-obj -std=c99 \
+// RUN:   %s | llvm-nm - 2>&1 | count 0
 
 // CHECK-EXTERN-NOT: foo
 // CHECK-STATIC-NOT: foo



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


[PATCH] D72873: [clang][xray] Add -fxray-ignore-loops option

2020-01-17 Thread Aditya Kumar via Phabricator via cfe-commits
hiraditya accepted this revision.
hiraditya added a comment.
This revision is now accepted and ready to land.

The test case is in another patch so LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72873



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


[PATCH] D72873: [clang][xray] Add -fxray-ignore-loops option

2020-01-17 Thread Ian Levesque via Phabricator via cfe-commits
ianlevesque marked an inline comment as done.
ianlevesque added inline comments.



Comment at: clang/test/CodeGen/xray-ignore-loops.cpp:5
+  return 1;
+}
+

hiraditya wrote:
> I think we need one more test case of a function having a loop.
I'm not opposed but the logic to actually ignore loops has a test on D72659


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72873



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


[PATCH] D72873: [clang][xray] Add -fxray-ignore-loops option

2020-01-17 Thread Aditya Kumar via Phabricator via cfe-commits
hiraditya added inline comments.



Comment at: clang/lib/CodeGen/CodeGenFunction.cpp:821
 llvm::itostr(CGM.getCodeGenOpts().XRayInstructionThreshold));
+  if (CGM.getCodeGenOpts().XRayIgnoreLoops) {
+Fn->addFnAttr("xray-ignore-loops");

we can remove braces here.



Comment at: clang/test/CodeGen/xray-ignore-loops.cpp:5
+  return 1;
+}
+

I think we need one more test case of a function having a loop.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72873



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


[PATCH] D72786: [clang] Set function attributes on SEH filter functions correctly.

2020-01-17 Thread Sanne Wouda via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGecfd6d3e8418: [clang] Set function attributes on SEH filter 
functions correctly. (authored by sanwou01).

Changed prior to commit:
  https://reviews.llvm.org/D72786?vs=238431=238817#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72786

Files:
  clang/lib/CodeGen/CGException.cpp
  clang/test/CodeGen/exceptions-seh-finally.c
  clang/test/CodeGenCXX/exceptions-seh-filter-uwtable.cpp


Index: clang/test/CodeGenCXX/exceptions-seh-filter-uwtable.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/exceptions-seh-filter-uwtable.cpp
@@ -0,0 +1,48 @@
+// RUN: %clang_cc1 "-triple" "arm64-windows" "-munwind-tables" 
"-fms-compatibility" -emit-llvm -O1 -disable-llvm-passes %s -o - | FileCheck %s
+// NOTE: we're passing "-O1 -disable-llvm-passes" to avoid adding optnone and 
noinline everywhere.
+
+# 0 "" 3
+#define a(b, c) d() & b
+#define f(c) a(e(0, 0, #c).b(), )
+
+struct e {
+  e(int, int, char *);
+  int b();
+};
+
+struct d {
+  void operator&(int);
+};
+
+struct h;
+
+struct i {
+  h *operator->();
+  h *() { f(); }
+};
+
+typedef int g;
+
+struct h {
+  void ad();
+};
+
+g aq(h j, g k, int, int) {
+  if (k)
+return;
+  j.ad();
+}
+
+// Check for the uwtable attribute on the filter funclet.
+// CHECK: define internal i32 @"?filt$0@0@at@@"(i8* %exception_pointers, i8* 
%frame_pointer) #[[MD:[0-9]+]]
+// CHECK: attributes #[[MD]] = { nounwind uwtable
+
+void at() {
+  i ar;
+
+  __try {
+ar->ad();
+  } __except (aq(*ar, _exception_code(), 0, 0)) {
+  }
+
+}
Index: clang/test/CodeGen/exceptions-seh-finally.c
===
--- clang/test/CodeGen/exceptions-seh-finally.c
+++ clang/test/CodeGen/exceptions-seh-finally.c
@@ -1,6 +1,7 @@
-// RUN: %clang_cc1 %s -triple x86_64-pc-win32 -fms-extensions -emit-llvm -o - 
| FileCheck %s
-// RUN: %clang_cc1 %s -triple i686-pc-win32 -fms-extensions -emit-llvm -o - | 
FileCheck %s
-// RUN: %clang_cc1 %s -triple aarch64-windows -fms-extensions -emit-llvm -o - 
| FileCheck %s
+// RUN: %clang_cc1 %s -triple x86_64-pc-win32 -fms-extensions -emit-llvm -O1 
-disable-llvm-passes -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple i686-pc-win32 -fms-extensions -emit-llvm -O1 
-disable-llvm-passes -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple aarch64-windows -fms-extensions -emit-llvm -O1 
-disable-llvm-passes -o - | FileCheck %s
+// NOTE: we're passing "-O1 -disable-llvm-passes" to avoid adding optnone and 
noinline everywhere.
 
 void abort(void) __attribute__((noreturn));
 void might_crash(void);
@@ -281,7 +282,6 @@
 // CHECK-LABEL: define internal void @"?fin$0@0@finally_with_func@@"({{[^)]*}})
 // CHECK: call void @cleanup_with_func(i8* getelementptr inbounds ([18 x i8], 
[18 x i8]* @"??_C@_0BC@COAGBPGM@finally_with_func?$AA@", i{{32|64}} 0, 
i{{32|64}} 0))
 
-// Look for the absence of noinline. Enum attributes come first, so check that
-// a string attribute is the first to verify that no enum attributes are
-// present.
-// CHECK: attributes [[finally_attrs]] = { "{{.*}}" }
+// Look for the absence of noinline.  nounwind is expected; any further
+// attributes should be string attributes.
+// CHECK: attributes [[finally_attrs]] = { nounwind "{{.*}}" }
Index: clang/lib/CodeGen/CGException.cpp
===
--- clang/lib/CodeGen/CGException.cpp
+++ clang/lib/CodeGen/CGException.cpp
@@ -1885,7 +1885,7 @@
 OutlinedStmt->getBeginLoc(), OutlinedStmt->getBeginLoc());
   CurSEHParent = ParentCGF.CurSEHParent;
 
-  CGM.SetLLVMFunctionAttributes(GlobalDecl(), FnInfo, CurFn);
+  CGM.SetInternalFunctionAttributes(GlobalDecl(), CurFn, FnInfo);
   EmitCapturedLocals(ParentCGF, OutlinedStmt, IsFilter);
 }
 


Index: clang/test/CodeGenCXX/exceptions-seh-filter-uwtable.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/exceptions-seh-filter-uwtable.cpp
@@ -0,0 +1,48 @@
+// RUN: %clang_cc1 "-triple" "arm64-windows" "-munwind-tables" "-fms-compatibility" -emit-llvm -O1 -disable-llvm-passes %s -o - | FileCheck %s
+// NOTE: we're passing "-O1 -disable-llvm-passes" to avoid adding optnone and noinline everywhere.
+
+# 0 "" 3
+#define a(b, c) d() & b
+#define f(c) a(e(0, 0, #c).b(), )
+
+struct e {
+  e(int, int, char *);
+  int b();
+};
+
+struct d {
+  void operator&(int);
+};
+
+struct h;
+
+struct i {
+  h *operator->();
+  h *() { f(); }
+};
+
+typedef int g;
+
+struct h {
+  void ad();
+};
+
+g aq(h j, g k, int, int) {
+  if (k)
+return;
+  j.ad();
+}
+
+// Check for the uwtable attribute on the filter funclet.
+// CHECK: define internal i32 @"?filt$0@0@at@@"(i8* %exception_pointers, i8* %frame_pointer) #[[MD:[0-9]+]]
+// CHECK: attributes #[[MD]] = { nounwind 

[PATCH] D72848: Remove some SVN-specific code.

2020-01-17 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added inline comments.



Comment at: clang/lib/Basic/Version.cpp:33
 #else
-  StringRef URL("");
+  return "";
 #endif

hans wrote:
> Eugene.Zelenko wrote:
> > return {} should be better.
> Why? I think "" is clearer for a string.
It's default non-trivial object initialization. Also not need for implicit cast.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72848



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


[clang] ecfd6d3 - [clang] Set function attributes on SEH filter functions correctly.

2020-01-17 Thread Sanne Wouda via cfe-commits

Author: Sanne Wouda
Date: 2020-01-17T18:09:42Z
New Revision: ecfd6d3e84185127fb836d6fe62564456be3a9cd

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

LOG: [clang] Set function attributes on SEH filter functions correctly.

Summary:
When compiling with -munwind-tables, the SEH filter funclet needs the uwtable
function attribute, which gets automatically added if we use
SetInternalFunctionAttributes.  The filter funclet is internal so this seems
appropriate.

Reviewers: rnk

Subscribers: cfe-commits

Tags: #clang

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

Added: 
clang/test/CodeGenCXX/exceptions-seh-filter-uwtable.cpp

Modified: 
clang/lib/CodeGen/CGException.cpp
clang/test/CodeGen/exceptions-seh-finally.c

Removed: 




diff  --git a/clang/lib/CodeGen/CGException.cpp 
b/clang/lib/CodeGen/CGException.cpp
index 53fafab3e0e6..fffd9897270e 100644
--- a/clang/lib/CodeGen/CGException.cpp
+++ b/clang/lib/CodeGen/CGException.cpp
@@ -1885,7 +1885,7 @@ void 
CodeGenFunction::startOutlinedSEHHelper(CodeGenFunction ,
 OutlinedStmt->getBeginLoc(), OutlinedStmt->getBeginLoc());
   CurSEHParent = ParentCGF.CurSEHParent;
 
-  CGM.SetLLVMFunctionAttributes(GlobalDecl(), FnInfo, CurFn);
+  CGM.SetInternalFunctionAttributes(GlobalDecl(), CurFn, FnInfo);
   EmitCapturedLocals(ParentCGF, OutlinedStmt, IsFilter);
 }
 

diff  --git a/clang/test/CodeGen/exceptions-seh-finally.c 
b/clang/test/CodeGen/exceptions-seh-finally.c
index 3e10d15debcc..8aafeb23090d 100644
--- a/clang/test/CodeGen/exceptions-seh-finally.c
+++ b/clang/test/CodeGen/exceptions-seh-finally.c
@@ -1,6 +1,7 @@
-// RUN: %clang_cc1 %s -triple x86_64-pc-win32 -fms-extensions -emit-llvm -o - 
| FileCheck %s
-// RUN: %clang_cc1 %s -triple i686-pc-win32 -fms-extensions -emit-llvm -o - | 
FileCheck %s
-// RUN: %clang_cc1 %s -triple aarch64-windows -fms-extensions -emit-llvm -o - 
| FileCheck %s
+// RUN: %clang_cc1 %s -triple x86_64-pc-win32 -fms-extensions -emit-llvm -O1 
-disable-llvm-passes -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple i686-pc-win32 -fms-extensions -emit-llvm -O1 
-disable-llvm-passes -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple aarch64-windows -fms-extensions -emit-llvm -O1 
-disable-llvm-passes -o - | FileCheck %s
+// NOTE: we're passing "-O1 -disable-llvm-passes" to avoid adding optnone and 
noinline everywhere.
 
 void abort(void) __attribute__((noreturn));
 void might_crash(void);
@@ -281,7 +282,6 @@ void finally_with_func() {
 // CHECK-LABEL: define internal void @"?fin$0@0@finally_with_func@@"({{[^)]*}})
 // CHECK: call void @cleanup_with_func(i8* getelementptr inbounds ([18 x i8], 
[18 x i8]* @"??_C@_0BC@COAGBPGM@finally_with_func?$AA@", i{{32|64}} 0, 
i{{32|64}} 0))
 
-// Look for the absence of noinline. Enum attributes come first, so check that
-// a string attribute is the first to verify that no enum attributes are
-// present.
-// CHECK: attributes [[finally_attrs]] = { "{{.*}}" }
+// Look for the absence of noinline.  nounwind is expected; any further
+// attributes should be string attributes.
+// CHECK: attributes [[finally_attrs]] = { nounwind "{{.*}}" }

diff  --git a/clang/test/CodeGenCXX/exceptions-seh-filter-uwtable.cpp 
b/clang/test/CodeGenCXX/exceptions-seh-filter-uwtable.cpp
new file mode 100644
index ..f09c6a39c7f5
--- /dev/null
+++ b/clang/test/CodeGenCXX/exceptions-seh-filter-uwtable.cpp
@@ -0,0 +1,48 @@
+// RUN: %clang_cc1 "-triple" "arm64-windows" "-munwind-tables" 
"-fms-compatibility" -emit-llvm -O1 -disable-llvm-passes %s -o - | FileCheck %s
+// NOTE: we're passing "-O1 -disable-llvm-passes" to avoid adding optnone and 
noinline everywhere.
+
+# 0 "" 3
+#define a(b, c) d() & b
+#define f(c) a(e(0, 0, #c).b(), )
+
+struct e {
+  e(int, int, char *);
+  int b();
+};
+
+struct d {
+  void operator&(int);
+};
+
+struct h;
+
+struct i {
+  h *operator->();
+  h *() { f(); }
+};
+
+typedef int g;
+
+struct h {
+  void ad();
+};
+
+g aq(h j, g k, int, int) {
+  if (k)
+return;
+  j.ad();
+}
+
+// Check for the uwtable attribute on the filter funclet.
+// CHECK: define internal i32 @"?filt$0@0@at@@"(i8* %exception_pointers, i8* 
%frame_pointer) #[[MD:[0-9]+]]
+// CHECK: attributes #[[MD]] = { nounwind uwtable
+
+void at() {
+  i ar;
+
+  __try {
+ar->ad();
+  } __except (aq(*ar, _exception_code(), 0, 0)) {
+  }
+
+}



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


[clang] a9f0025 - Reland "[llvm-nm] Don't report "no symbols" error for files that contain symbols"

2020-01-17 Thread Fangrui Song via cfe-commits

Author: Fangrui Song
Date: 2020-01-17T10:08:42-08:00
New Revision: a9f0025acd2235dccec51cf42d1e604675639343

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

LOG: Reland "[llvm-nm] Don't report "no symbols" error for files that contain 
symbols"

Added: 
llvm/test/tools/llvm-nm/X86/nm-no-symbols-local-only.yaml

Modified: 
clang/test/InterfaceStubs/function-template-specialization.cpp
llvm/test/ThinLTO/X86/empty-module.ll
llvm/test/ThinLTO/X86/strong_non_prevailing.ll
llvm/test/tools/llvm-nm/X86/nm-no-symbols.test
llvm/tools/llvm-nm/llvm-nm.cpp

Removed: 




diff  --git a/clang/test/InterfaceStubs/function-template-specialization.cpp 
b/clang/test/InterfaceStubs/function-template-specialization.cpp
index 5198bafa2e5c..358f9457024e 100644
--- a/clang/test/InterfaceStubs/function-template-specialization.cpp
+++ b/clang/test/InterfaceStubs/function-template-specialization.cpp
@@ -10,8 +10,7 @@
 // RUN: -DSPECIALIZE_TEMPLATE_FUNCTION=1 %s | \
 // RUN: FileCheck -check-prefix=CHECK-SPECIALIZES-TEMPLATE-FUNCTION %s
 
-// RUN: %clang -target x86_64-unknown-linux-gnu -o - -c \
-// RUN: %s | llvm-nm - 2>&1 | FileCheck %s
+// RUN: %clang -target x86_64-unknown-linux-gnu -o - -c %s | llvm-nm - 2>&1 | 
count 0
 
 // RUN: %clang -target x86_64-unknown-linux-gnu -o - -c \
 // RUN: -DUSE_TEMPLATE_FUNCTION=1 %s | llvm-nm - 2>&1 | \

diff  --git a/llvm/test/ThinLTO/X86/empty-module.ll 
b/llvm/test/ThinLTO/X86/empty-module.ll
index 01e7089415f3..0f4543446d35 100644
--- a/llvm/test/ThinLTO/X86/empty-module.ll
+++ b/llvm/test/ThinLTO/X86/empty-module.ll
@@ -3,8 +3,7 @@
 ; RUN: rm -f %t2.0
 ; RUN: llvm-lto2 run  %t.bc -r %t.bc,foo,pl -o %t2 -thinlto-distributed-indexes
 ; RUN: llvm-readobj -h %t2.0 | FileCheck %s
-; RUN: llvm-nm %t2.0 2>&1 | FileCheck %s -check-prefix=NO-SYMBOLS
-; NO-SYMBOLS: no symbols
+; RUN: llvm-nm %t2.0 2>&1 | count 0
 
 ; CHECK: Format: ELF64-x86-64
 

diff  --git a/llvm/test/ThinLTO/X86/strong_non_prevailing.ll 
b/llvm/test/ThinLTO/X86/strong_non_prevailing.ll
index 4fd72cf3f05c..d70a674aff40 100644
--- a/llvm/test/ThinLTO/X86/strong_non_prevailing.ll
+++ b/llvm/test/ThinLTO/X86/strong_non_prevailing.ll
@@ -3,7 +3,7 @@
 
 ; RUN: llvm-lto -thinlto-action=run %t.bc %t2.bc 
-exported-symbol=__llvm_profile_filename
 ; RUN: llvm-nm -o - < %t.bc.thinlto.o | FileCheck %s --check-prefix=EXPORTED
-; RUN: llvm-nm -o - < %t2.bc.thinlto.o 2>&1 | FileCheck %s 
--check-prefix=NOT_EXPORTED
+; RUN: llvm-nm -o - < %t2.bc.thinlto.o 2>&1 | count 0
 
 target datalayout = 
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
@@ -13,4 +13,3 @@ $__llvm_profile_filename = comdat any
 @__llvm_profile_filename = constant [19 x i8] c"default_%m.profraw\00", comdat
 
 ; EXPORTED: R __llvm_profile_filename
-; NOT_EXPORTED-NOT: R __llvm_profile_filename

diff  --git a/llvm/test/tools/llvm-nm/X86/nm-no-symbols-local-only.yaml 
b/llvm/test/tools/llvm-nm/X86/nm-no-symbols-local-only.yaml
new file mode 100644
index ..10441661cd25
--- /dev/null
+++ b/llvm/test/tools/llvm-nm/X86/nm-no-symbols-local-only.yaml
@@ -0,0 +1,15 @@
+## When a file contains only local symbols the "no symbols" error should not
+## be shown, so we expect the output to be completely empty.
+# RUN: yaml2obj %s > %t.o
+# RUN: llvm-nm %t.o 2>&1 | count 0
+
+!ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_REL
+  Machine: EM_X86_64
+Symbols:
+  - Name:  foo.c
+Type:  STT_FILE
+Index: SHN_ABS

diff  --git a/llvm/test/tools/llvm-nm/X86/nm-no-symbols.test 
b/llvm/test/tools/llvm-nm/X86/nm-no-symbols.test
index 808a9b1301f9..bb4f0b03a47e 100644
--- a/llvm/test/tools/llvm-nm/X86/nm-no-symbols.test
+++ b/llvm/test/tools/llvm-nm/X86/nm-no-symbols.test
@@ -1,6 +1,5 @@
 # RUN: yaml2obj %s > %t.o
-# RUN: llvm-nm %t.o 2>&1 | FileCheck %s
-# RUN: llvm-nm --print-file-name %t.o 2>&1 | FileCheck %s 
--check-prefix=CHECK-PRINT-FILE-NAME
+# RUN: llvm-nm %t.o 2>&1 | FileCheck %s -DFILE=%t.o
 
 !ELF
 FileHeader:
@@ -9,6 +8,4 @@ FileHeader:
   Type:ET_REL
   Machine: EM_X86_64
 
-# CHECK: {{^}}no symbols{{$}}
-
-# CHECK-PRINT-FILE-NAME: nm-no-symbols.test{{.*}}.o: no symbols{{$}}
+# CHECK: [[FILE]]: no symbols{{$}}

diff  --git a/llvm/tools/llvm-nm/llvm-nm.cpp b/llvm/tools/llvm-nm/llvm-nm.cpp
index 28f30a7b37b5..2cd74af08c88 100644
--- a/llvm/tools/llvm-nm/llvm-nm.cpp
+++ b/llvm/tools/llvm-nm/llvm-nm.cpp
@@ -707,6 +707,19 @@ static bool symbolIsDefined(const NMSymbol ) {
   return Sym.TypeChar != 'U' && Sym.TypeChar != 'w' && Sym.TypeChar != 'v';
 }
 
+static void writeFileName(raw_ostream , StringRef ArchiveName,
+  StringRef ArchitectureName) {
+  if (!ArchitectureName.empty())
+

[PATCH] D72867: [clangd] Support renaming designated initializers

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

{icon check-circle color=green} Unit tests: pass. 61929 tests passed, 0 failed 
and 783 were skipped.

{icon question-circle color=gray} clang-tidy: unknown.

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

Build artifacts 
: 
diff.json 
,
 clang-format.patch 
,
 CMakeCache.txt 
,
 console-log.txt 
,
 test-results.xml 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72867



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


[clang] 932b5d6 - [test] Fix tests after D52810

2020-01-17 Thread Fangrui Song via cfe-commits

Author: Fangrui Song
Date: 2020-01-17T10:02:56-08:00
New Revision: 932b5d6fcad183a5b1584dffc77c340bf0796efa

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

LOG: [test] Fix tests after D52810

Added: 


Modified: 
clang/test/CodeGen/thinlto_backend.ll
clang/test/InterfaceStubs/externstatic.c
clang/test/InterfaceStubs/inline.c

Removed: 




diff  --git a/clang/test/CodeGen/thinlto_backend.ll 
b/clang/test/CodeGen/thinlto_backend.ll
index 6a18a940c367..715ff1ec229e 100644
--- a/clang/test/CodeGen/thinlto_backend.ll
+++ b/clang/test/CodeGen/thinlto_backend.ll
@@ -24,8 +24,7 @@
 ; 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 2>&1 | FileCheck %s -check-prefix=NO-SYMBOLS
-; NO-SYMBOLS: no symbols
+; RUN: llvm-nm %t4.o 2>&1 | count 0
 
 ; 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

diff  --git a/clang/test/InterfaceStubs/externstatic.c 
b/clang/test/InterfaceStubs/externstatic.c
index 8975fe640af2..5715af74d2ad 100644
--- a/clang/test/InterfaceStubs/externstatic.c
+++ b/clang/test/InterfaceStubs/externstatic.c
@@ -13,8 +13,7 @@
 // RUN: %clang -cc1 -fvisibility default -DSTORAGE="static" -o - 
-emit-interface-stubs -std=c99 -xc %s | \
 // RUN: FileCheck -check-prefix=CHECK-STATIC %s
 
-// RUN: %clang -fvisibility=default -DSTORAGE="static" -O0 -o - -c -std=c99 
-xc %s | llvm-nm - 2>&1 | \
-// RUN: FileCheck -check-prefix=CHECK-STATIC %s
+// RUN: %clang -fvisibility=default -DSTORAGE="static" -O0 -o - -c -std=c99 
-xc %s | llvm-nm - 2>&1 | count 0
 
 // CHECK-EXTERN-NOT: foo
 // CHECK-STATIC-NOT: foo

diff  --git a/clang/test/InterfaceStubs/inline.c 
b/clang/test/InterfaceStubs/inline.c
index 3ff7db9597a9..0b0ac83726ad 100644
--- a/clang/test/InterfaceStubs/inline.c
+++ b/clang/test/InterfaceStubs/inline.c
@@ -16,7 +16,7 @@
 // RUN: -emit-interface-stubs -std=c99 -xc %s | \
 // RUN: FileCheck -check-prefix=CHECK-STD %s
 // RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -O0 -o - -c -std=c99 \
-// RUN: -xc %s | llvm-nm - 2>&1 | FileCheck -check-prefix=CHECK-STD %s
+// RUN: -xc %s | llvm-nm - 2>&1 | count 0
 
 // RUN: %clang_cc1 -DINLINE="__attribute__((noinline))" \
 // RUN: -triple x86_64-unknown-linux-gnu -o - -emit-interface-stubs -std=c99 
-xc %s | \
@@ -29,8 +29,7 @@
 // RUN: -emit-interface-stubs -std=c99 -xc %s | \
 // RUN: FileCheck -check-prefix=CHECK-STATIC %s
 // RUN: %clang -DINLINE="static" -target x86_64-linux-gnu -O0 -o - -c \
-// RUN: -std=c99 -xc %s | llvm-nm - 2>&1 | \
-// RUN: FileCheck -check-prefix=CHECK-STATIC %s
+// RUN:   -std=c99 -xc %s | llvm-nm - 2>&1 | count 0
 
 // CHECK-GNU-DAG: foo
 // CHECK-GNU-DAG: foo.var



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


[clang] 03689fe - [perf-training] Ignore ' (in-process)' prefix from -###

2020-01-17 Thread Francis Visoiu Mistrih via cfe-commits

Author: Francis Visoiu Mistrih
Date: 2020-01-17T09:38:35-08:00
New Revision: 03689fe97f2377a3b19864de98b5c14b7fbd85ab

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

LOG: [perf-training] Ignore ' (in-process)' prefix from -###

After D69825, the output of clang -### when running in process can be
prefixed by ' (in-process)'. Skip it.

Added: 


Modified: 
clang/utils/perf-training/perf-helper.py

Removed: 




diff  --git a/clang/utils/perf-training/perf-helper.py 
b/clang/utils/perf-training/perf-helper.py
index 3ab193ee76c0..58eef65c6e73 100644
--- a/clang/utils/perf-training/perf-helper.py
+++ b/clang/utils/perf-training/perf-helper.py
@@ -131,7 +131,15 @@ def get_cc1_command_for_args(cmd, env):
   print('Fatal error: unable to determine cc1 command: %r' % cc_output)
   exit(1)
 
-  cc1_cmd = shlex.split(cc_commands[0])
+  cc_command = cc_commands[0]
+
+  # When cc1 runs in the same process as the driver, it prefixes the cc1
+  # invocation with ' (in-process)'. Skip it.
+  skip_pfx_line = ' (in-process)'
+  if cc_command.startswith(skip_pfx_line):
+  cc_command = cc_command[len(skip_pfx_line):]
+
+  cc1_cmd = shlex.split(cc_command)
   if not cc1_cmd:
   print('Fatal error: unable to determine cc1 command: %r' % cc_output)
   exit(1)



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


[clang] 12e4794 - Rename DW_AT_LLVM_isysroot to DW_AT_LLVM_sysroot

2020-01-17 Thread Adrian Prantl via cfe-commits

Author: Adrian Prantl
Date: 2020-01-17T09:36:48-08:00
New Revision: 12e479475a896f664fb721f98c2d6805185ac352

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

LOG: Rename DW_AT_LLVM_isysroot to DW_AT_LLVM_sysroot

This is a purely cosmetic change that is NFC in terms of the binary
output. I bugs me that I called the attribute DW_AT_LLVM_isysroot
since the "i" is an artifact of GCC command line option syntax
(-isysroot is in the category of -i options) and doesn't carry any
useful information otherwise.

This attribute only appears in Clang module debug info.

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

Added: 
clang/test/CodeGen/debug-info-sysroot.c
llvm/test/DebugInfo/X86/split-dwarf-sysroot.ll

Modified: 
clang/lib/CodeGen/CGDebugInfo.cpp
clang/test/CodeGen/debug-nvptx.c
clang/test/Modules/debug-info-moduleimport.m
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
llvm/bindings/go/llvm/dibuilder.go
llvm/include/llvm-c/DebugInfo.h
llvm/include/llvm/IR/DIBuilder.h
llvm/include/llvm/IR/DebugInfoMetadata.h
llvm/lib/AsmParser/LLParser.cpp
llvm/lib/Bitcode/Reader/MetadataLoader.cpp
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
llvm/lib/IR/AsmWriter.cpp
llvm/lib/IR/DIBuilder.cpp
llvm/lib/IR/DebugInfo.cpp
llvm/lib/IR/DebugInfoMetadata.cpp
llvm/lib/IR/LLVMContextImpl.h
llvm/test/Assembler/dicompileunit.ll
llvm/test/Assembler/dimodule.ll
llvm/test/Bindings/llvm-c/debug_info.ll
llvm/test/CodeGen/X86/load-combine-dbg.ll
llvm/test/DebugInfo/X86/DIModule.ll
llvm/test/DebugInfo/X86/DIModuleContext.ll
llvm/test/DebugInfo/X86/clang-module.ll
llvm/tools/llvm-c-test/debuginfo.c
llvm/unittests/IR/MetadataTest.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGDebugInfo.cpp 
b/clang/lib/CodeGen/CGDebugInfo.cpp
index cbd524eda9d0..ffc3870c153b 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -610,6 +610,10 @@ void CGDebugInfo::CreateCompileUnit() {
   remapDIPath(MainFileName), remapDIPath(getCurrentDirname()), CSInfo,
   getSource(SM, SM.getMainFileID()));
 
+  StringRef Sysroot;
+  if (CGM.getCodeGenOpts().getDebuggerTuning() == llvm::DebuggerKind::LLDB)
+Sysroot = CGM.getHeaderSearchOpts().Sysroot;
+
   // Create new compile unit.
   TheCU = DBuilder.createCompileUnit(
   LangTag, CUFile, CGOpts.EmitVersionIdentMetadata ? Producer : "",
@@ -620,7 +624,7 @@ void CGDebugInfo::CreateCompileUnit() {
   ? llvm::DICompileUnit::DebugNameTableKind::None
   : static_cast(
 CGOpts.DebugNameTable),
-  CGOpts.DebugRangesBaseAddress);
+  CGOpts.DebugRangesBaseAddress, Sysroot);
 }
 
 llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) {
@@ -2471,7 +2475,7 @@ 
CGDebugInfo::getOrCreateModuleRef(ExternalASTSource::ASTSourceDescriptor Mod,
  CreateSkeletonCU);
   llvm::DIModule *DIMod =
   DBuilder.createModule(Parent, Mod.getModuleName(), ConfigMacros,
-Mod.getPath(), CGM.getHeaderSearchOpts().Sysroot);
+Mod.getPath());
   ModuleCache[M].reset(DIMod);
   return DIMod;
 }

diff  --git a/clang/test/CodeGen/debug-info-sysroot.c 
b/clang/test/CodeGen/debug-info-sysroot.c
new file mode 100644
index ..bb3c0c820cee
--- /dev/null
+++ b/clang/test/CodeGen/debug-info-sysroot.c
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -debug-info-kind=limited -triple %itanium_abi_triple \
+// RUN:   %s -isysroot /CLANG_SYSROOT -emit-llvm -o - \
+// RUN:   -debugger-tuning=lldb | FileCheck %s --check-prefix=LLDB
+// RUN: %clang_cc1 -debug-info-kind=limited -triple %itanium_abi_triple \
+// RUN:   %s -isysroot /CLANG_SYSROOT -emit-llvm -o - \
+// RUN:   -debugger-tuning=gdb | FileCheck %s --check-prefix=GDB
+
+void foo() {}
+
+// The sysroot is an LLDB-tuning-specific attribute.
+
+// LLDB: distinct !DICompileUnit({{.*}}sysroot: "/CLANG_SYSROOT"
+// GDB: distinct !DICompileUnit(
+// GDB-NOT: sysroot: "/CLANG_SYSROOT"
+

diff  --git a/clang/test/CodeGen/debug-nvptx.c 
b/clang/test/CodeGen/debug-nvptx.c
index ceff30082960..8780c5db6801 100644
--- a/clang/test/CodeGen/debug-nvptx.c
+++ b/clang/test/CodeGen/debug-nvptx.c
@@ -1,6 +1,6 @@
 // RUN: %clang_cc1 -triple nvptx-unknown-unknown -S -o - 
-debug-info-kind=limited %s -emit-llvm | FileCheck %s
 
-// CHECK: DICompileUnit({{.*}}, nameTableKind: None)
+// CHECK: DICompileUnit({{.*}}, nameTableKind: None
 
 void f1(void) {
 }

diff  --git a/clang/test/Modules/debug-info-moduleimport.m 
b/clang/test/Modules/debug-info-moduleimport.m
index df8a66bebfb6..f07c6fce784d 100644
--- 

[PATCH] D72906: [X86] Improve X86 cmpps/cmppd/cmpss/cmpsd intrinsics with strictfp

2020-01-17 Thread Ulrich Weigand via Phabricator via cfe-commits
uweigand added a comment.

In D72906#1826122 , @craig.topper 
wrote:

> In D72906#1826061 , @uweigand wrote:
>
> > > The constrained fcmp intrinsics don't allow the TRUE/FALSE predicates.
> >
> > Hmm, maybe they should then?   The only reason I didn't add them initially 
> > was that I wasn't sure they were useful for anything; if they are, it 
> > should be straightforward to add them back.
>
>
> What would we lower it to on a target that doesn’t support it natively?


Any supported compare (quiet or signaling as appropriate, just so we get the 
correct exceptions), and then ignore the result (and use true/false constant 
result instead)?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72906



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


[PATCH] D72463: [Driver][X86] Add -malign-branch* and -malign-branch-within-32B-boundaries

2020-01-17 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

In D72463#1826499 , @annita.zhang 
wrote:

> @MaskRay Did you merge it to LLVM 10 branch?


It is included in the release branch.

`git branch origin/release/10.x --contains 
5ca24d09aefaedf8e4148c7fce4b4ab0c4ecc72a  # suceeded`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72463



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


[PATCH] D72934: [ARM,MVE] Support immediate vbicq,vorrq,vmvnq intrinsics.

2020-01-17 Thread Simon Tatham via Phabricator via cfe-commits
simon_tatham created this revision.
simon_tatham added reviewers: dmgreen, MarkMurrayARM, miyuki, ostannard.
Herald added subscribers: llvm-commits, cfe-commits, hiraditya, kristof.beyls.
Herald added projects: clang, LLVM.

Immediate vmvnq is code-generated as a simple vector constant in IR,
and left to the backend to recognize that it can be created with an
MVE VMVN instruction. The predicated version is represented as a
select between the input and the same constant, and I've added a
Tablegen isel rule to turn that into a predicated VMVN. (That should
be better than the previous VMVN + VPSEL: it's the same number of
instructions but now it can fold into an adjacent VPT block.)

The unpredicated forms of VBIC and VORR are done by enabling the same
isel lowering as for NEON, recognizing appropriate immediates and
rewriting them as ARMISD::VBICIMM / ARMISD::VORRIMM SDNodes, which I
then instruction-select into the right MVE instructions (but in custom
C++, because of the awkward MC representation). In order to do that, I
had to promote the Tablegen SDNode instance `NEONvorrImm` to a general
`ARMvorrImm` available in MVE as well, and similarly for `NEONvbicImm`.

For the predicated forms of VBIC and VORR, I've just invented IR
intrinsics. I considered trying to match a call to the existing
predicated VBIC intrinsic where one argument was a vector splat, but
it looked like needing a lot more code than it would give benefit.

This intrinsic family is the first to use the `imm_simd` system I put
into the MveEmitter tablegen backend. So, naturally, it showed up a
bug or two (emitting bogus range checks and the like). Fixed those,
and added a full set of tests for the permissible immediates in the
existing Sema test.

Finally, the new isel support for immediate VBIC has caused changes in
a few existing MVE codegen tests, because `vbic.i16 q0,#0xff00` has
now taken over from `vmovlb.u8 q0,q0` as LLVM's preferred way to clear
the top byte of each 16-bit lane. I think the changes are benign.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72934

Files:
  clang/include/clang/Basic/arm_mve.td
  clang/include/clang/Basic/arm_mve_defs.td
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/arm-mve-intrinsics/bitwise-imm.c
  clang/test/Sema/arm-mve-immediates.c
  clang/utils/TableGen/MveEmitter.cpp
  llvm/include/llvm/IR/IntrinsicsARM.td
  llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
  llvm/lib/Target/ARM/ARMISelLowering.cpp
  llvm/lib/Target/ARM/ARMInstrInfo.td
  llvm/lib/Target/ARM/ARMInstrMVE.td
  llvm/lib/Target/ARM/ARMInstrNEON.td
  llvm/test/CodeGen/Thumb2/mve-gather-ptrs.ll
  llvm/test/CodeGen/Thumb2/mve-intrinsics/bitwise-imm.ll
  llvm/test/CodeGen/Thumb2/mve-masked-load.ll
  llvm/test/CodeGen/Thumb2/mve-sext.ll
  llvm/test/CodeGen/Thumb2/mve-shuffleext.ll

Index: llvm/test/CodeGen/Thumb2/mve-shuffleext.ll
===
--- llvm/test/CodeGen/Thumb2/mve-shuffleext.ll
+++ llvm/test/CodeGen/Thumb2/mve-shuffleext.ll
@@ -73,7 +73,7 @@
 define arm_aapcs_vfpcc <8 x i16> @zext_02468101214(<16 x i8> %src) {
 ; CHECK-LABEL: zext_02468101214:
 ; CHECK:   @ %bb.0: @ %entry
-; CHECK-NEXT:vmovlb.u8 q0, q0
+; CHECK-NEXT:vbic.i16 q0, #0xff00
 ; CHECK-NEXT:bx lr
 entry:
   %strided.vec = shufflevector <16 x i8> %src, <16 x i8> undef, <8 x i32> 
@@ -85,7 +85,7 @@
 ; CHECK-LABEL: zext_13579111315:
 ; CHECK:   @ %bb.0: @ %entry
 ; CHECK-NEXT:vrev16.8 q0, q0
-; CHECK-NEXT:vmovlb.u8 q0, q0
+; CHECK-NEXT:vbic.i16 q0, #0xff00
 ; CHECK-NEXT:bx lr
 entry:
   %strided.vec = shufflevector <16 x i8> %src, <16 x i8> undef, <8 x i32> 
Index: llvm/test/CodeGen/Thumb2/mve-sext.ll
===
--- llvm/test/CodeGen/Thumb2/mve-sext.ll
+++ llvm/test/CodeGen/Thumb2/mve-sext.ll
@@ -277,7 +277,7 @@
 define arm_aapcs_vfpcc <8 x i16> @zext_v8i8_v8i16(<8 x i8> %src) {
 ; CHECK-LABEL: zext_v8i8_v8i16:
 ; CHECK:   @ %bb.0: @ %entry
-; CHECK-NEXT:vmovlb.u8 q0, q0
+; CHECK-NEXT:vbic.i16 q0, #0xff00
 ; CHECK-NEXT:bx lr
 entry:
   %0 = zext <8 x i8> %src to <8 x i16>
@@ -308,41 +308,41 @@
 define arm_aapcs_vfpcc <16 x i16> @zext_v16i8_v16i16(<16 x i8> %src) {
 ; CHECK-LABEL: zext_v16i8_v16i16:
 ; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vmov q2, q0
 ; CHECK-NEXT:vmov.u8 r0, q0[0]
+; CHECK-NEXT:vmov.16 q0[0], r0
+; CHECK-NEXT:vmov.u8 r0, q2[1]
+; CHECK-NEXT:vmov.16 q0[1], r0
+; CHECK-NEXT:vmov.u8 r0, q2[2]
+; CHECK-NEXT:vmov.16 q0[2], r0
+; CHECK-NEXT:vmov.u8 r0, q2[3]
+; CHECK-NEXT:vmov.16 q0[3], r0
+; CHECK-NEXT:vmov.u8 r0, q2[4]
+; CHECK-NEXT:vmov.16 q0[4], r0
+; CHECK-NEXT:vmov.u8 r0, q2[5]
+; CHECK-NEXT:vmov.16 q0[5], r0
+; CHECK-NEXT:vmov.u8 r0, q2[6]
+; CHECK-NEXT:vmov.16 q0[6], r0
+; CHECK-NEXT:vmov.u8 r0, q2[7]
+; CHECK-NEXT:vmov.16 q0[7], r0
+; CHECK-NEXT:vmov.u8 r0, 

[PATCH] D72274: [libTooling] Fix bug in Stencil handling of macro ranges

2020-01-17 Thread Yitzhak Mandelbaum via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb9d2bf38e86e: [libTooling] Fix bug in Stencil handling of 
macro ranges (authored by ymandel).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72274

Files:
  clang/include/clang/Tooling/Transformer/SourceCode.h
  clang/lib/Tooling/Transformer/SourceCode.cpp
  clang/lib/Tooling/Transformer/Stencil.cpp
  clang/unittests/Tooling/SourceCodeTest.cpp
  clang/unittests/Tooling/StencilTest.cpp

Index: clang/unittests/Tooling/StencilTest.cpp
===
--- clang/unittests/Tooling/StencilTest.cpp
+++ clang/unittests/Tooling/StencilTest.cpp
@@ -368,6 +368,21 @@
   testExpr(Id, "3;", run(SimpleFn), "Bound");
 }
 
+TEST_F(StencilTest, CatOfInvalidRangeFails) {
+  StringRef Snippet = R"cpp(
+#define MACRO (3.77)
+  double foo(double d);
+  foo(MACRO);)cpp";
+
+  auto StmtMatch =
+  matchStmt(Snippet, callExpr(callee(functionDecl(hasName("foo"))),
+  argumentCountIs(1),
+  hasArgument(0, expr().bind("arg";
+  ASSERT_TRUE(StmtMatch);
+  Stencil S = cat(node("arg"));
+  EXPECT_THAT_EXPECTED(S->eval(StmtMatch->Result), Failed());
+}
+
 TEST(StencilToStringTest, RawTextOp) {
   auto S = cat("foo bar baz");
   StringRef Expected = R"("foo bar baz")";
Index: clang/unittests/Tooling/SourceCodeTest.cpp
===
--- clang/unittests/Tooling/SourceCodeTest.cpp
+++ clang/unittests/Tooling/SourceCodeTest.cpp
@@ -10,16 +10,20 @@
 #include "TestVisitor.h"
 #include "clang/Basic/Diagnostic.h"
 #include "llvm/Testing/Support/Annotations.h"
+#include "llvm/Testing/Support/Error.h"
 #include "llvm/Testing/Support/SupportHelpers.h"
 #include 
 #include 
 
 using namespace clang;
 
+using llvm::Failed;
+using llvm::Succeeded;
 using llvm::ValueIs;
 using tooling::getExtendedText;
 using tooling::getRangeForEdit;
 using tooling::getText;
+using tooling::validateEditRange;
 
 namespace {
 
@@ -200,4 +204,116 @@
   Visitor.runOver(Code.code());
 }
 
+TEST(SourceCodeTest, EditRangeWithMacroExpansionsIsValid) {
+  // The call expression, whose range we are extracting, includes two macro
+  // expansions.
+  llvm::StringRef Code = R"cpp(
+#define M(a) a * 13
+int foo(int x, int y);
+int a = foo(M(1), M(2));
+)cpp";
+
+  CallsVisitor Visitor;
+
+  Visitor.OnCall = [](CallExpr *CE, ASTContext *Context) {
+auto Range = CharSourceRange::getTokenRange(CE->getSourceRange());
+EXPECT_THAT_ERROR(validateEditRange(Range, Context->getSourceManager()),
+  Succeeded());
+  };
+  Visitor.runOver(Code);
+}
+
+TEST(SourceCodeTest, SpellingRangeOfMacroArgIsValid) {
+  llvm::StringRef Code = R"cpp(
+#define FOO(a) a + 7.0;
+int a = FOO(10);
+)cpp";
+
+  IntLitVisitor Visitor;
+  Visitor.OnIntLit = [](IntegerLiteral *Expr, ASTContext *Context) {
+SourceLocation ArgLoc =
+Context->getSourceManager().getSpellingLoc(Expr->getBeginLoc());
+// The integer literal is a single token.
+auto ArgRange = CharSourceRange::getTokenRange(ArgLoc);
+EXPECT_THAT_ERROR(validateEditRange(ArgRange, Context->getSourceManager()),
+  Succeeded());
+  };
+  Visitor.runOver(Code);
+}
+
+TEST(SourceCodeTest, InvalidEditRangeIsInvalid) {
+  llvm::StringRef Code = "int c = 10;";
+
+  // We use the visitor just to get a valid context.
+  IntLitVisitor Visitor;
+  Visitor.OnIntLit = [](IntegerLiteral *, ASTContext *Context) {
+CharSourceRange Invalid;
+EXPECT_THAT_ERROR(validateEditRange(Invalid, Context->getSourceManager()),
+  Failed());
+  };
+  Visitor.runOver(Code);
+}
+
+TEST(SourceCodeTest, InvertedEditRangeIsInvalid) {
+  llvm::StringRef Code = R"cpp(
+int foo(int x);
+int a = foo(2);
+)cpp";
+
+  CallsVisitor Visitor;
+  Visitor.OnCall = [](CallExpr *Expr, ASTContext *Context) {
+auto InvertedRange = CharSourceRange::getTokenRange(
+SourceRange(Expr->getEndLoc(), Expr->getBeginLoc()));
+EXPECT_THAT_ERROR(
+validateEditRange(InvertedRange, Context->getSourceManager()),
+Failed());
+  };
+  Visitor.runOver(Code);
+}
+
+TEST(SourceCodeTest, MacroArgIsInvalid) {
+  llvm::StringRef Code = R"cpp(
+#define FOO(a) a + 7.0;
+int a = FOO(10);
+)cpp";
+
+  IntLitVisitor Visitor;
+  Visitor.OnIntLit = [](IntegerLiteral *Expr, ASTContext *Context) {
+auto Range = CharSourceRange::getTokenRange(Expr->getSourceRange());
+EXPECT_THAT_ERROR(validateEditRange(Range, Context->getSourceManager()),
+  Failed());
+  };
+  Visitor.runOver(Code);
+}
+
+TEST(SourceCodeTest, EditWholeMacroExpansionIsInvalid) {
+  llvm::StringRef Code = R"cpp(
+#define FOO 10
+int a = FOO;
+)cpp";
+
+  IntLitVisitor Visitor;
+  Visitor.OnIntLit = [](IntegerLiteral *Expr, ASTContext *Context) {
+auto Range = 

[PATCH] D72841: [RFC] Add support for pragma float_control, to control precision and exception behavior at the source level

2020-01-17 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff added inline comments.



Comment at: clang/lib/Sema/SemaExpr.cpp:13129
 if (FunctionDecl *F = dyn_cast(CurContext)) {
+  // If the expression occurs inside an internal global_var_init_function
+  // then the FunctionDecl is not availble

mibintc wrote:
> sepavloff wrote:
> > The standard says that static initializers execute in default FP mode.
> > The standard says ...
> Are you sure about this one?  Can you please provide the standards reference 
> so I can study it?
>> The standard says ...
> Are you sure about this one? Can you please provide the standards reference 
> so I can study it?

http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf, F.8.5:
```
... All computation for initialization of objects that have static or thread 
storage duration is done (as if) at translation time.
```
F.8.2:
```
During translation the IEC 60559 default modes are in effect:
— The rounding direction mode is rounding to nearest.
— The rounding precision mode (if supported) is set so that results are not 
shortened.
— Trapping or stopping (if supported) is disabled on all floating-point 
exceptions.
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72841



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


[clang] b9d2bf3 - [libTooling] Fix bug in Stencil handling of macro ranges

2020-01-17 Thread Yitzhak Mandelbaum via cfe-commits

Author: Yitzhak Mandelbaum
Date: 2020-01-17T12:11:25-05:00
New Revision: b9d2bf38e86e6dd8a2f188d9a24f546aa67de8af

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

LOG: [libTooling] Fix bug in Stencil handling of macro ranges

Summary: Currently, an attempt to rewrite source code inside a macro expansion 
succeeds, but results in empty text, rather than failing with an error.  This 
patch restructures to the code to explicitly validate ranges before attempting 
to edit them.

Reviewers: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang/include/clang/Tooling/Transformer/SourceCode.h
clang/lib/Tooling/Transformer/SourceCode.cpp
clang/lib/Tooling/Transformer/Stencil.cpp
clang/unittests/Tooling/SourceCodeTest.cpp
clang/unittests/Tooling/StencilTest.cpp

Removed: 




diff  --git a/clang/include/clang/Tooling/Transformer/SourceCode.h 
b/clang/include/clang/Tooling/Transformer/SourceCode.h
index bc9cc3d2a258..1b92a117f44c 100644
--- a/clang/include/clang/Tooling/Transformer/SourceCode.h
+++ b/clang/include/clang/Tooling/Transformer/SourceCode.h
@@ -73,13 +73,18 @@ StringRef getExtendedText(const T , tok::TokenKind 
Next,
   return getText(getExtendedRange(Node, Next, Context), Context);
 }
 
-// Attempts to resolve the given range to one that can be edited by a rewrite;
-// generally, one that starts and ends within a particular file. It supports
-// a limited set of cases involving source locations in macro expansions.
+/// Determines whether \p Range is one that can be edited by a rewrite;
+/// generally, one that starts and ends within a particular file.
+llvm::Error validateEditRange(const CharSourceRange ,
+  const SourceManager );
+
+/// Attempts to resolve the given range to one that can be edited by a rewrite;
+/// generally, one that starts and ends within a particular file. It supports a
+/// limited set of cases involving source locations in macro expansions. If a
+/// value is returned, it satisfies \c validateEditRange.
 llvm::Optional
 getRangeForEdit(const CharSourceRange , const SourceManager ,
 const LangOptions );
-
 inline llvm::Optional
 getRangeForEdit(const CharSourceRange , const ASTContext ) {
   return getRangeForEdit(EditRange, Context.getSourceManager(),

diff  --git a/clang/lib/Tooling/Transformer/SourceCode.cpp 
b/clang/lib/Tooling/Transformer/SourceCode.cpp
index 836401d1e605..5c1f8b46fe42 100644
--- a/clang/lib/Tooling/Transformer/SourceCode.cpp
+++ b/clang/lib/Tooling/Transformer/SourceCode.cpp
@@ -11,9 +11,13 @@
 
//===--===//
 #include "clang/Tooling/Transformer/SourceCode.h"
 #include "clang/Lex/Lexer.h"
+#include "llvm/Support/Errc.h"
 
 using namespace clang;
 
+using llvm::errc;
+using llvm::StringError;
+
 StringRef clang::tooling::getText(CharSourceRange Range,
   const ASTContext ) {
   return Lexer::getSourceText(Range, Context.getSourceManager(),
@@ -30,6 +34,34 @@ CharSourceRange 
clang::tooling::maybeExtendRange(CharSourceRange Range,
   return CharSourceRange::getTokenRange(Range.getBegin(), Tok->getLocation());
 }
 
+llvm::Error clang::tooling::validateEditRange(const CharSourceRange ,
+  const SourceManager ) {
+  if (Range.isInvalid())
+return llvm::make_error(errc::invalid_argument,
+ "Invalid range");
+
+  if (Range.getBegin().isMacroID() || Range.getEnd().isMacroID())
+return llvm::make_error(
+errc::invalid_argument, "Range starts or ends in a macro expansion");
+
+  if (SM.isInSystemHeader(Range.getBegin()) ||
+  SM.isInSystemHeader(Range.getEnd()))
+return llvm::make_error(errc::invalid_argument,
+ "Range is in system header");
+
+  std::pair BeginInfo = 
SM.getDecomposedLoc(Range.getBegin());
+  std::pair EndInfo = SM.getDecomposedLoc(Range.getEnd());
+  if (BeginInfo.first != EndInfo.first)
+return llvm::make_error(
+errc::invalid_argument, "Range begins and ends in 
diff erent files");
+
+  if (BeginInfo.second > EndInfo.second)
+return llvm::make_error(
+errc::invalid_argument, "Range's begin is past its end");
+
+  return llvm::Error::success();
+}
+
 llvm::Optional
 clang::tooling::getRangeForEdit(const CharSourceRange ,
 const SourceManager ,
@@ -46,20 +78,9 @@ clang::tooling::getRangeForEdit(const CharSourceRange 
,
   //foo(DO_NOTHING(6))
   // Decide whether the current behavior is desirable and modify if not.
   CharSourceRange Range = Lexer::makeFileCharRange(EditRange, SM, 

[PATCH] D72638: [clangd] Fix rename for explicit destructor calls

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

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

{icon question-circle color=gray} clang-tidy: unknown.

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

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



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72638



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


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

2020-01-17 Thread Diogo N. Sampaio via Phabricator via cfe-commits
dnsampaio created this revision.
dnsampaio added reviewers: rsmith, rjmccall.
Herald added subscribers: cfe-commits, kristof.beyls.
Herald added a project: clang.

This patch resumes the work of D16586 .
According to the AAPCS, volatile bit-fields should
be accessed using containers of the widht of their
declarative type. In such case:

  struct S1 {
short a : 1;
  }

should be accessed using load and stores of the width
(sizeof(short)), where now the compiler does only load
the minimum required width (char in this case).
However, as discussed in D16586 ,
that could overwrite non-volatile bit-fields, which
conflicted with C and C++ object models by creating
data race conditions that are not part of the bit-field,
e.g.

  struct S2 {
short a;
int  b : 16;
  }

Accessing `S2.b` would also access `S2.a`.

The AAPCS Release 2019Q1.1
(https://static.docs.arm.com/ihi0042/g/aapcs32.pdf)
section 8.1 Data Types, page 35, "Volatile bit-fields -
preserving number and width of container accesses" has been
updated to avoid conflict with the C++ Memory Model.
Now it reads in the note:

  This ABI does not place any restrictions on the access widths
  of bit-fields where the container overlaps with a non-bit-field member.
   This is because the C/C++ memory model defines these as being separate
  memory locations, which can be accessed by two threads
   simultaneously. For this reason, compilers must be permitted to use a
  narrower memory access width (including splitting the access
   into multiple instructions) to avoid writing to a different memory location.

I've updated the patch D16586  to follow such 
behavior by verifying that we
only change volatile bit-field access when:

- it won't overlap with any other non-bit-field member
- we only access memory inside the bounds of the record

Regarding the number of memory accesses, that should be preserved, that will
be implemented by D67399 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72932

Files:
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGValue.h
  clang/lib/CodeGen/CodeGenFunction.h
  clang/test/CodeGen/aapcs-bitfield.c

Index: clang/test/CodeGen/aapcs-bitfield.c
===
--- clang/test/CodeGen/aapcs-bitfield.c
+++ clang/test/CodeGen/aapcs-bitfield.c
@@ -151,19 +151,19 @@
 
 // LE-LABEL: @st3_check_load(
 // LE-NEXT:  entry:
-// LE-NEXT:[[TMP0:%.*]] = getelementptr [[STRUCT_ST3:%.*]], %struct.st3* [[M:%.*]], i32 0, i32 0
-// LE-NEXT:[[BF_LOAD:%.*]] = load volatile i8, i8* [[TMP0]], align 2
-// LE-NEXT:[[BF_SHL:%.*]] = shl i8 [[BF_LOAD]], 1
-// LE-NEXT:[[BF_ASHR:%.*]] = ashr exact i8 [[BF_SHL]], 1
-// LE-NEXT:[[CONV:%.*]] = sext i8 [[BF_ASHR]] to i32
+// LE-NEXT:[[TMP0:%.*]] = bitcast %struct.st3* [[M:%.*]] to i16*
+// LE-NEXT:[[BF_LOAD:%.*]] = load volatile i16, i16* [[TMP0]], align 2
+// LE-NEXT:[[BF_SHL:%.*]] = shl i16 [[BF_LOAD]], 9
+// LE-NEXT:[[BF_ASHR:%.*]] = ashr exact i16 [[BF_SHL]], 9
+// LE-NEXT:[[CONV:%.*]] = sext i16 [[BF_ASHR]] to i32
 // LE-NEXT:ret i32 [[CONV]]
 //
 // BE-LABEL: @st3_check_load(
 // BE-NEXT:  entry:
-// BE-NEXT:[[TMP0:%.*]] = getelementptr [[STRUCT_ST3:%.*]], %struct.st3* [[M:%.*]], i32 0, i32 0
-// BE-NEXT:[[BF_LOAD:%.*]] = load volatile i8, i8* [[TMP0]], align 2
-// BE-NEXT:[[BF_ASHR:%.*]] = ashr i8 [[BF_LOAD]], 1
-// BE-NEXT:[[CONV:%.*]] = sext i8 [[BF_ASHR]] to i32
+// BE-NEXT:[[TMP0:%.*]] = bitcast %struct.st3* [[M:%.*]] to i16*
+// BE-NEXT:[[BF_LOAD:%.*]] = load volatile i16, i16* [[TMP0]], align 2
+// BE-NEXT:[[BF_ASHR:%.*]] = ashr i16 [[BF_LOAD]], 9
+// BE-NEXT:[[CONV:%.*]] = sext i16 [[BF_ASHR]] to i32
 // BE-NEXT:ret i32 [[CONV]]
 //
 int st3_check_load(struct st3 *m) {
@@ -172,20 +172,20 @@
 
 // LE-LABEL: @st3_check_store(
 // LE-NEXT:  entry:
-// LE-NEXT:[[TMP0:%.*]] = getelementptr [[STRUCT_ST3:%.*]], %struct.st3* [[M:%.*]], i32 0, i32 0
-// LE-NEXT:[[BF_LOAD:%.*]] = load volatile i8, i8* [[TMP0]], align 2
-// LE-NEXT:[[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], -128
-// LE-NEXT:[[BF_SET:%.*]] = or i8 [[BF_CLEAR]], 1
-// LE-NEXT:store volatile i8 [[BF_SET]], i8* [[TMP0]], align 2
+// LE-NEXT:[[TMP0:%.*]] = bitcast %struct.st3* [[M:%.*]] to i16*
+// LE-NEXT:[[BF_LOAD:%.*]] = load volatile i16, i16* [[TMP0]], align 2
+// LE-NEXT:[[BF_CLEAR:%.*]] = and i16 [[BF_LOAD]], -128
+// LE-NEXT:[[BF_SET:%.*]] = or i16 [[BF_CLEAR]], 1
+// LE-NEXT:store volatile i16 [[BF_SET]], i16* [[TMP0]], align 2
 // LE-NEXT:ret void
 //
 // BE-LABEL: @st3_check_store(
 // BE-NEXT:  entry:
-// BE-NEXT:[[TMP0:%.*]] = getelementptr [[STRUCT_ST3:%.*]], %struct.st3* [[M:%.*]], i32 0, i32 0
-// BE-NEXT:[[BF_LOAD:%.*]] = load volatile i8, i8* [[TMP0]], align 2
-// BE-NEXT:[[BF_CLEAR:%.*]] = 

[PATCH] D72746: [clangd] Add a flag for implicit references in the Index

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

{icon check-circle color=green} Unit tests: pass. 61855 tests passed, 0 failed 
and 781 were skipped.

{icon question-circle color=gray} clang-tidy: unknown.

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

Build artifacts 
: 
diff.json 
,
 clang-format.patch 
,
 CMakeCache.txt 
,
 console-log.txt 
,
 test-results.xml 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72746



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


[PATCH] D72638: [clangd] Fix rename for explicit destructor calls

2020-01-17 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev updated this revision to Diff 238791.
kbobyrev marked 5 inline comments as done.
kbobyrev added a comment.

Address comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72638

Files:
  clang-tools-extra/clangd/FindTarget.cpp
  clang-tools-extra/clangd/unittests/FindTargetTests.cpp
  clang-tools-extra/clangd/unittests/RenameTests.cpp

Index: clang-tools-extra/clangd/unittests/RenameTests.cpp
===
--- clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -265,6 +265,33 @@
 }
   )cpp",
 
+  // Destructor explicit call.
+  R"cpp(
+class [[F^oo]] {
+public:
+  ~[[^Foo]]();
+};
+
+[[Foo^]]::~[[^Foo]]() {}
+
+int main() {
+  [[Fo^o]] f;
+  f.~/*something*/[[^Foo]]();
+  f.~[[^Foo]]();
+}
+  )cpp",
+
+  // Derived destructor explicit call.
+  R"cpp(
+class [[Bas^e]] {};
+class Derived : public [[Bas^e]] {}
+
+int main() {
+  [[Bas^e]] *foo = new Derived();
+  foo->[[^Base]]::~[[^Base]]();
+}
+  )cpp",
+
   // CXXConstructor initializer list.
   R"cpp(
 class Baz {};
Index: clang-tools-extra/clangd/unittests/FindTargetTests.cpp
===
--- clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -879,6 +879,50 @@
 "8: targets = {INT2}, decl\n"
 "9: targets = {NS}, decl\n"
 "10: targets = {ns}\n"},
+   // User-defined conversion operator.
+   {R"cpp(
+void foo() {
+   class $0^Foo {
+   public:
+ $1^operator int();
+   };
+
+   $2^Foo $3^f;
+   $4^f.$5^operator int();
+}
+)cpp",
+"0: targets = {Foo}, decl\n"
+"1: targets = {foo()::Foo::operator int}, decl\n"
+"2: targets = {Foo}\n"
+"3: targets = {f}, decl\n"
+"4: targets = {f}\n"
+"5: targets = {foo()::Foo::operator int}\n"},
+   // Destructor.
+   {R"cpp(
+ void foo() {
+   class $0^Foo {
+   public:
+ ~$1^Foo() {}
+
+ void $2^destructMe() {
+   this->~$3^Foo();
+ }
+   };
+
+   $4^Foo $5^f;
+   $6^f.~ /*...*/ $7^Foo();
+ }
+   )cpp",
+"0: targets = {Foo}, decl\n"
+// FIXME: Should this target destructor instead of the type itself
+// (similar to constructor)?
+"1: targets = {Foo}\n"
+"2: targets = {foo()::Foo::destructMe}, decl\n"
+"3: targets = {Foo}\n"
+"4: targets = {Foo}\n"
+"5: targets = {f}, decl\n"
+"6: targets = {f}\n"
+"7: targets = {Foo}\n"},
// cxx constructor initializer.
{R"cpp(
  class Base {};
Index: clang-tools-extra/clangd/FindTarget.cpp
===
--- clang-tools-extra/clangd/FindTarget.cpp
+++ clang-tools-extra/clangd/FindTarget.cpp
@@ -596,6 +596,10 @@
 }
 
 void VisitMemberExpr(const MemberExpr *E) {
+  // Skip destructor calls to avoid duplication: TypeLoc within will be
+  // visited separately.
+  if (llvm::dyn_cast(E->getFoundDecl().getDecl()))
+return;
   Refs.push_back(ReferenceLoc{E->getQualifierLoc(),
   E->getMemberNameInfo().getLoc(),
   /*IsDecl=*/false,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D72638: [clangd] Fix rename for explicit destructor calls

2020-01-17 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev added inline comments.



Comment at: clang-tools-extra/clangd/unittests/FindTargetTests.cpp:882
 "10: targets = {ns}\n"},
+   // CXX Constructor, destructor and operators.
+   {R"cpp(

hokein wrote:
> could we simplify the newly-added test? I think a test only for explicit 
> destructor calls is sufficient, I think.
> 
> ```
> void foo () {
>   class Foo { ~Foo(); };
>  Foo f;
>  f.~Foo();
> }
> ```
Simplified the test a bit. I don't think it hurts to have more coverage though 
(if this is not duplication).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72638



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


[PATCH] D72153: [libTooling] Add function to determine associated text of a declaration.

2020-01-17 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr2 added inline comments.



Comment at: clang/lib/Tooling/Transformer/SourceCode.cpp:128
+  // First, lex to the current token (which is the last token of the range that
+  // we know to be deleted. Then, we process the first token separately from 
the
+  // rest based on conditions that hold specifically for that first token.

Parenthetical is not closed.



Comment at: clang/lib/Tooling/Transformer/SourceCode.cpp:169
+  if (contains(Terminators, Tok))
+Terminated = true;
+  End = Tok.getEndLoc();

What if the token is not a terminator? It seems like the loop will keep looking 
for a terminator, but I don't understand why -- based on the doc comment, it 
seems like the intent is that this function will only extend the range with 
extra terminators.



Comment at: clang/lib/Tooling/Transformer/SourceCode.cpp:196
+case tok::semi:
+case tok::comma:
+  if (contains(Terminators, Tok)) {

I don't understand this case. We can only reach this loop if we already found 
one terminator. If semicolon is a terminator, fine, we can consume an extra 
one. However, if comma is a terminator, if we enter this "case tok::comma", it 
means we found two commas in a row, which is probably a syntax error.



Comment at: clang/lib/Tooling/Transformer/SourceCode.cpp:294
+Range.setBegin(T->getBeginLoc());
+  }
+

Please add tests for templates. (In particular, out-of-line definitions of 
member templates, which have two template argument lists.)



Comment at: clang/lib/Tooling/Transformer/SourceCode.cpp:312
+//   other entities the comment could refer to), and
+// * it is not a IfThisThenThat lint check.
+if (SM.isBeforeInTranslationUnit(Comment->getBeginLoc(),

Need tests for cases described by this comment.



Comment at: clang/lib/Tooling/Transformer/SourceCode.cpp:352
+// If we didn't see '[[' or '__attribute' it's probably coming from a
+// macro expansion which is already handled by getExpansionRange(),
+// below.

s/getExpansionRange/makeFileCharRange/? Although I don't think it does that, 
because its comment says "... the function will fail because the range overlaps 
with only a part of the macro".





Comment at: clang/unittests/Tooling/SourceCodeTest.cpp:150
+  struct VarDeclsVisitor : TestVisitor {
+llvm::Annotations Code;
+

If you feel motivated, it could be beneficial to lift this member into 
TestVisitor itself (and change RunOver to accept llvm::Annotations).



Comment at: clang/unittests/Tooling/SourceCodeTest.cpp:164
+
+  // Includes newline.
+  Visitor.Code = llvm::Annotations("$r[[int x = 4;]]");

s/newline/semicolon/



Comment at: clang/unittests/Tooling/SourceCodeTest.cpp:211
+}
+bool runOverWithComments(StringRef Code) {
+  std::vector Args = {"-std=c++11", "-fparse-all-comments"};

It assumes that it is invoked with the code that corresponds to this->Code. 
Therefore the argument is redundant, I think.



Comment at: clang/unittests/Tooling/SourceCodeTest.cpp:231
+  // Includes comments even in the presence of trailing whitespace.
+  Visitor.Code = llvm::Annotations("$r[[// Comment.\nint x = 4;]]  ");
+  Visitor.runOverWithComments(Visitor.Code.code());

But there's no whitespace.



Comment at: clang/unittests/Tooling/SourceCodeTest.cpp:258
+  // Does not include comments when either decl or comment are inside macros
+  // (unless both are in the same macro).
+  // FIXME: Change code to allow this.

"Does not include comments when only the decl or the comment come from a macro."


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72153



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


[PATCH] D69840: [Basic] Make SourceLocation usable as key in hash maps, NFCI

2020-01-17 Thread Mikhail Maltsev via Phabricator via cfe-commits
miyuki added a comment.

ping^4


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

https://reviews.llvm.org/D69840



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


[PATCH] D72274: [libTooling] Fix bug in Stencil handling of macro ranges

2020-01-17 Thread Yitzhak Mandelbaum via Phabricator via cfe-commits
ymandel marked an inline comment as done.
ymandel added a comment.

Thanks for the review!

In D72274#1826634 , @gribozavr2 wrote:

> In D72274#1826614 , @ymandel wrote:
>
> > In D72274#1826477 , @gribozavr2 
> > wrote:
> >
> > > The only functional change that I see in this patch is in 
> > > `clang/lib/Tooling/Transformer/Stencil.cpp`. However, I don't understand 
> > > how that change in the (deprecated) selection() stencil can affect other 
> > > stencils.
> >
> >
> > Good point. Actually, `selection` and `text` are still used internally. 
> > See, for example, lines 301-303 in Stencil.cpp.  We deprecated their use 
> > for clients.
>
>
> Oh, that explains everything.


I have to clean up that implementation file...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72274



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


[PATCH] D72746: [clangd] Add a flag for implicit references in the Index

2020-01-17 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev planned changes to this revision.
kbobyrev added a comment.

Need to make use of the `TokenBuffer`, ran into some difficulties when lexing 
some files and triggering assertions in the process. Will figure it out and 
update the patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72746



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


[PATCH] D72746: [clangd] Add a flag for implicit references in the Index

2020-01-17 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev updated this revision to Diff 238786.
kbobyrev marked 4 inline comments as done.
kbobyrev added a comment.

Address alsmost all comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72746

Files:
  clang-tools-extra/clangd/index/Ref.h
  clang-tools-extra/clangd/index/SymbolCollector.cpp
  clang-tools-extra/clangd/refactor/Rename.cpp
  clang-tools-extra/clangd/unittests/RenameTests.cpp

Index: clang-tools-extra/clangd/unittests/RenameTests.cpp
===
--- clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -33,7 +33,7 @@
 // Convert a Range to a Ref.
 Ref refWithRange(const clangd::Range , const std::string ) {
   Ref Result;
-  Result.Kind = RefKind::Reference;
+  Result.Kind = RefKind::Reference | RefKind::Spelled;
   Result.Location.Start.setLine(Range.start.line);
   Result.Location.Start.setColumn(Range.start.character);
   Result.Location.End.setLine(Range.end.line);
@@ -837,7 +837,7 @@
   {
   // variables.
   R"cpp(
-  static const int [[VA^R]] = 123;
+static const int [[VA^R]] = 123;
   )cpp",
   R"cpp(
 #include "foo.h"
@@ -868,6 +868,22 @@
 }
   )cpp",
   },
+  {
+  // Implicit references in macro expansions.
+  R"cpp(
+class [[Fo^o]] {};
+#define FooFoo Foo
+#define FOO Foo
+  )cpp",
+  R"cpp(
+#include "foo.h"
+void bar() {
+  [[Foo]] x;
+  FOO y;
+  FooFoo z;
+}
+  )cpp",
+  },
   };
 
   for (const auto& T : Cases) {
Index: clang-tools-extra/clangd/refactor/Rename.cpp
===
--- clang-tools-extra/clangd/refactor/Rename.cpp
+++ clang-tools-extra/clangd/refactor/Rename.cpp
@@ -296,6 +296,8 @@
   bool HasMore = Index.refs(RQuest, [&](const Ref ) {
 if (AffectedFiles.size() > MaxLimitFiles)
   return;
+if (!static_cast(R.Kind & RefKind::Spelled))
+  return;
 if (auto RefFilePath = filePath(R.Location, /*HintFilePath=*/MainFile)) {
   if (*RefFilePath != MainFile)
 AffectedFiles[*RefFilePath].push_back(toRange(R.Location));
Index: clang-tools-extra/clangd/index/SymbolCollector.cpp
===
--- clang-tools-extra/clangd/index/SymbolCollector.cpp
+++ clang-tools-extra/clangd/index/SymbolCollector.cpp
@@ -28,6 +28,7 @@
 #include "clang/Index/IndexingAction.h"
 #include "clang/Index/USRGeneration.h"
 #include "clang/Lex/Preprocessor.h"
+#include "clang/Tooling/Syntax/Tokens.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/MemoryBuffer.h"
@@ -180,7 +181,16 @@
 }
 
 RefKind toRefKind(index::SymbolRoleSet Roles) {
-  return static_cast(static_cast(RefKind::All) & Roles);
+  RefKind Result = RefKind::Unknown;
+  if (Roles & static_cast(index::SymbolRole::Declaration))
+Result |= RefKind::Declaration;
+  if (Roles & static_cast(index::SymbolRole::Definition))
+Result |= RefKind::Definition;
+  if (Roles & static_cast(index::SymbolRole::Reference))
+Result |= RefKind::Reference;
+  if (!(Roles & static_cast(index::SymbolRole::Implicit)))
+Result |= RefKind::Spelled;
+  return Result;
 }
 
 bool shouldIndexRelation(const index::SymbolRelation ) {
@@ -291,7 +301,7 @@
   // occurrence inside the base-specifier.
   processRelations(*ND, *ID, Relations);
 
-  bool CollectRef = static_cast(Opts.RefFilter) & Roles;
+  bool CollectRef = static_cast(Opts.RefFilter & toRefKind(Roles));
   bool IsOnlyRef =
   !(Roles & (static_cast(index::SymbolRole::Declaration) |
  static_cast(index::SymbolRole::Definition)));
@@ -578,10 +588,22 @@
   }
   // Populate Refs slab from DeclRefs.
   if (auto MainFileURI = GetURI(SM.getMainFileID())) {
-for (const auto  : DeclRefs) {
-  if (auto ID = getSymbolID(It.first)) {
-for (const auto  : It.second)
+for (auto  : DeclRefs) {
+  if (auto ID = getSymbolID(DeclAndRef.first)) {
+for (auto  : DeclAndRef.second) {
+  // Check if the referenced symbol is spelled exactly the same way the
+  // corresponding NamedDecl is. If it isn't, mark this reference as
+  // implicit.  An example of implicit references would be a macro
+  // expansion.
+  llvm::SmallString<16> Buffer;
+  const auto Spelling = Lexer::getSpelling(LocAndRole.first, Buffer, SM,
+   ASTCtx->getLangOpts());
+  DeclarationName Name = DeclAndRef.first->getDeclName();
+  if (Name.isIdentifier() && Name.getAsString() != Spelling)
+LocAndRole.second |=
+static_cast(index::SymbolRole::Implicit);
   CollectRef(*ID, LocAndRole);
+ 

[PATCH] D72274: [libTooling] Fix bug in Stencil handling of macro ranges

2020-01-17 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr2 accepted this revision.
gribozavr2 added a comment.
This revision is now accepted and ready to land.

In D72274#1826614 , @ymandel wrote:

> In D72274#1826477 , @gribozavr2 
> wrote:
>
> > The only functional change that I see in this patch is in 
> > `clang/lib/Tooling/Transformer/Stencil.cpp`. However, I don't understand 
> > how that change in the (deprecated) selection() stencil can affect other 
> > stencils.
>
>
> Good point. Actually, `selection` and `text` are still used internally. See, 
> for example, lines 301-303 in Stencil.cpp.  We deprecated their use for 
> clients.


Oh, that explains everything.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72274



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


[PATCH] D72746: [clangd] Add a flag for implicit references in the Index

2020-01-17 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev added inline comments.



Comment at: clang-tools-extra/clangd/index/Ref.h:36
+  // one below.
+  Implicit = 1 << 3,
+  All = Declaration | Definition | Reference | Implicit,

kadircet wrote:
> kadircet wrote:
> > instead of doing that, could we rather de-couple two enums completely and 
> > have a `symbolRoleToRefKind`(and vice-versa) method instead(we already have 
> > some customization in `toRefKind` now) ?
> > 
> > as current change increases the risk of overlapping in future(e.g. someone 
> > might change symbolrole::declaration and cause failures/regressions in 
> > clangd)
> note that this would also require a bump to version of `on-disk` index in 
> clangd/index/Serialization.cpp, as old information regarding `RefKind` won't 
> be usable anymore.
> instead of doing that, could we rather de-couple two enums completely and 
> have a symbolRoleToRefKind(and vice-versa) method instead(we already have 
> some customization in toRefKind now) ?
> as current change increases the risk of overlapping in future(e.g. someone 
> might change symbolrole::declaration and cause failures/regressions in clangd)

Makes sense, will do!

> note that this would also require a bump to version of on-disk index in 
> clangd/index/Serialization.cpp, as old information regarding RefKind won't be 
> usable anymore.

I checked the Serialization code and the serialization code should be OK as 
long as `RefKind` stays one byte. Can you please elaborate on this?

Do you mean that the index should be generated again after this change because 
it would no longer be valid? (this one I understand)
Or do you mean there should be some other change in the code for me to do to 
land this patch?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72746



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


[PATCH] D72841: [RFC] Add support for pragma float_control, to control precision and exception behavior at the source level

2020-01-17 Thread Melanie Blower via Phabricator via cfe-commits
mibintc marked 3 inline comments as done.
mibintc added a comment.

@sepavloff Thanks a lot for your comments. I added a few replies and I have one 
question, added inline.




Comment at: clang/lib/Parse/ParsePragma.cpp:2522
+  IdentifierInfo *II = Tok.getIdentifierInfo();
+  PragmaFloatControlDecl::FloatControlKind Kind =
+llvm::StringSwitch(

sepavloff wrote:
> Does such treatment allow a pragma like:
> 
> #pragma #pragma float_control(except, on), push
> 
> The comment to `PragmaFloatControlHandler::HandlePragma` says it is valid.
Yes, #pragma float_control(except, on, push) is allowed. That's inherited from 
the Microsoft pragma of the same name. I need to change the .rst documentation 
about this. #pragma float_control(push) or #pragma float_control(pop) is also 
supported. Here's a link to the Microsoft doc, 
https://docs.microsoft.com/en-us/cpp/preprocessor/float-control?view=vs-2019 



Comment at: clang/lib/Sema/SemaAttr.cpp:430
+break;
+  case PragmaFloatControlDecl::FC_Push:
+  case PragmaFloatControlDecl::FC_Pop:

sepavloff wrote:
> `push` cannot be combined with `precise`?
Yes it can be combined: #pragma float_control(precise, push); the "push" is 
coded into the Action, the action can be either "set" or "push". I'm using 
pre-existing code in clang which provides support for microsoft-style pragma 
push/pop/set.  For example, clang supports the Microsoft pragma code_seg which 
supports a stack of code segment names. 



Comment at: clang/lib/Sema/SemaExpr.cpp:13129
 if (FunctionDecl *F = dyn_cast(CurContext)) {
+  // If the expression occurs inside an internal global_var_init_function
+  // then the FunctionDecl is not availble

sepavloff wrote:
> The standard says that static initializers execute in default FP mode.
> The standard says ...
Are you sure about this one?  Can you please provide the standards reference so 
I can study it?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72841



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


[PATCH] D72380: [DataFlow] Factor two worklist implementations out

2020-01-17 Thread Gábor Horváth via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG05c7dc664809: [DataFlow] Factor two worklist implementations 
out (authored by xazax.hun).

Changed prior to commit:
  https://reviews.llvm.org/D72380?vs=238592=238785#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72380

Files:
  clang/include/clang/Analysis/FlowSensitive/DataflowValues.h
  clang/include/clang/Analysis/FlowSensitive/DataflowWorklist.h
  clang/lib/Analysis/LiveVariables.cpp
  clang/lib/Analysis/UninitializedValues.cpp
  clang/unittests/Analysis/CFGBuildResult.h
  clang/unittests/Analysis/CFGTest.cpp

Index: clang/unittests/Analysis/CFGTest.cpp
===
--- clang/unittests/Analysis/CFGTest.cpp
+++ clang/unittests/Analysis/CFGTest.cpp
@@ -7,10 +7,14 @@
 //===--===//
 
 #include "CFGBuildResult.h"
+#include "clang/AST/Decl.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Analysis/AnalysisDeclContext.h"
 #include "clang/Analysis/CFG.h"
+#include "clang/Analysis/FlowSensitive/DataflowWorklist.h"
 #include "clang/Tooling/Tooling.h"
 #include "gtest/gtest.h"
+#include 
 #include 
 #include 
 
@@ -73,14 +77,14 @@
 EXPECT_EQ(IsLinear, B.getCFG()->isLinear());
   };
 
-  expectLinear(true,  "void foo() {}");
-  expectLinear(true,  "void foo() { if (true) return; }");
-  expectLinear(true,  "void foo() { if constexpr (false); }");
+  expectLinear(true, "void foo() {}");
+  expectLinear(true, "void foo() { if (true) return; }");
+  expectLinear(true, "void foo() { if constexpr (false); }");
   expectLinear(false, "void foo(bool coin) { if (coin) return; }");
   expectLinear(false, "void foo() { for(;;); }");
   expectLinear(false, "void foo() { do {} while (true); }");
-  expectLinear(true,  "void foo() { do {} while (false); }");
-  expectLinear(true,  "void foo() { foo(); }"); // Recursion is not our problem.
+  expectLinear(true, "void foo() { do {} while (false); }");
+  expectLinear(true, "void foo() { foo(); }"); // Recursion is not our problem.
 }
 
 TEST(CFG, ElementRefIterator) {
@@ -216,6 +220,54 @@
   EXPECT_EQ(++(CMainBlock->rref_begin()), CMainBlock->rref_begin() + 1);
 }
 
+TEST(CFG, Worklists) {
+  const char *Code = "int f(bool cond) {\n"
+ "  int a = 5;\n"
+ "  if (cond)\n"
+ "a += 1;\n"
+ "  return a;\n"
+ "}\n";
+  BuildResult B = BuildCFG(Code);
+  EXPECT_EQ(BuildResult::BuiltCFG, B.getStatus());
+  const FunctionDecl *Func = B.getFunc();
+  AnalysisDeclContext AC(nullptr, Func);
+  auto *CFG = AC.getCFG();
+
+  std::vector ReferenceOrder;
+  for (const auto *B : *AC.getAnalysis())
+ReferenceOrder.push_back(B);
+
+  {
+ForwardDataflowWorklist ForwardWorklist(*CFG, AC);
+for (const auto *B : *CFG)
+  ForwardWorklist.enqueueBlock(B);
+
+std::vector ForwardNodes;
+while (const CFGBlock *B = ForwardWorklist.dequeue())
+  ForwardNodes.push_back(B);
+
+EXPECT_EQ(ForwardNodes.size(), ReferenceOrder.size());
+EXPECT_TRUE(std::equal(ReferenceOrder.begin(), ReferenceOrder.end(),
+   ForwardNodes.begin()));
+  }
+
+  std::reverse(ReferenceOrder.begin(), ReferenceOrder.end());
+
+  {
+BackwardDataflowWorklist BackwardWorklist(*CFG, AC);
+for (const auto *B : *CFG)
+  BackwardWorklist.enqueueBlock(B);
+
+std::vector BackwardNodes;
+while (const CFGBlock *B = BackwardWorklist.dequeue())
+  BackwardNodes.push_back(B);
+
+EXPECT_EQ(BackwardNodes.size(), ReferenceOrder.size());
+EXPECT_TRUE(std::equal(ReferenceOrder.begin(), ReferenceOrder.end(),
+   BackwardNodes.begin()));
+  }
+}
+
 } // namespace
 } // namespace analysis
 } // namespace clang
Index: clang/unittests/Analysis/CFGBuildResult.h
===
--- clang/unittests/Analysis/CFGBuildResult.h
+++ clang/unittests/Analysis/CFGBuildResult.h
@@ -23,18 +23,21 @@
 BuiltCFG,
   };
 
-  BuildResult(Status S, std::unique_ptr Cfg = nullptr,
+  BuildResult(Status S, const FunctionDecl *Func = nullptr,
+  std::unique_ptr Cfg = nullptr,
   std::unique_ptr AST = nullptr)
-  : S(S), Cfg(std::move(Cfg)), AST(std::move(AST)) {}
+  : S(S), Cfg(std::move(Cfg)), AST(std::move(AST)), Func(Func) {}
 
   Status getStatus() const { return S; }
   CFG *getCFG() const { return Cfg.get(); }
   ASTUnit *getAST() const { return AST.get(); }
+  const FunctionDecl *getFunc() const { return Func; }
 
 private:
   Status S;
   std::unique_ptr Cfg;
   std::unique_ptr AST;
+  const FunctionDecl *Func;
 };
 
 class CFGCallback : public ast_matchers::MatchFinder::MatchCallback {
@@ -54,7 +57,8 @@
 Options.AddImplicitDtors = true;
 if 

[PATCH] D72736: [AIX] Add improved interface for retrieving load module paths

2020-01-17 Thread Steven Wan via Phabricator via cfe-commits
stevewan added a comment.

Provided that you have squashed all changes into the latest commit in your 
branch, `git diff HEAD^ -U1` should emit the context you need. Adjust the 
number of lines of context accordingly to fit the size of your files.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72736



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


[PATCH] D72274: [libTooling] Fix bug in Stencil handling of macro ranges

2020-01-17 Thread Yitzhak Mandelbaum via Phabricator via cfe-commits
ymandel marked 2 inline comments as done.
ymandel added a comment.

In D72274#1826477 , @gribozavr2 wrote:

> The only functional change that I see in this patch is in 
> `clang/lib/Tooling/Transformer/Stencil.cpp`. However, I don't understand how 
> that change in the (deprecated) selection() stencil can affect other stencils.


Good point. Actually, `selection` and `text` are still used internally. See, 
for example, lines 301-303 in Stencil.cpp.  We deprecated their use for clients.




Comment at: clang/unittests/Tooling/StencilTest.cpp:375
+  double foo(double d);
+  foo(MACRO);)cpp";
+

gribozavr2 wrote:
> "foo(MACRO);" will fail parsing at the top level, it should be within a 
> function, I think.
`matchStmt` *(below) handles wrapping the snippet in a function.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72274



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


[PATCH] D72635: Allow arbitrary capability name in Thread Safety Analysis

2020-01-17 Thread Etienne Pierre-Doray via Phabricator via cfe-commits
eti-p-doray added a comment.

Thank you for checking! I updated the changes to lift the restriction. PTAnL?


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

https://reviews.llvm.org/D72635



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


[clang] 0406b4f - Renamed traverseDecl to TraverseDecl in a test

2020-01-17 Thread Dmitri Gribenko via cfe-commits

Author: Dmitri Gribenko
Date: 2020-01-17T17:12:23+01:00
New Revision: 0406b4fab94658381ea58db890b07c1a30ff0ae4

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

LOG: Renamed traverseDecl to TraverseDecl in a test

RecursiveASTVisitor expects TraverseDecl to be implemented by
subclasses.

Added: 


Modified: 
clang/unittests/Tooling/QualTypeNamesTest.cpp

Removed: 




diff  --git a/clang/unittests/Tooling/QualTypeNamesTest.cpp 
b/clang/unittests/Tooling/QualTypeNamesTest.cpp
index ff6b78c2666d..c820b6162285 100644
--- a/clang/unittests/Tooling/QualTypeNamesTest.cpp
+++ b/clang/unittests/Tooling/QualTypeNamesTest.cpp
@@ -17,7 +17,7 @@ struct TypeNameVisitor : TestVisitor {
 
   // ValueDecls are the least-derived decl with both a qualtype and a
   // name.
-  bool traverseDecl(Decl *D) {
+  bool TraverseDecl(Decl *D) {
 return true;  // Always continue
   }
 



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


  1   2   >