[PATCH] D62926: [analyzer] ReturnVisitor: Bypass constructing objects to see inlined calls

2019-06-07 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments.



Comment at: clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp:842-849
+  if (Optional CEE = Node->getLocationAs())
 if (CEE->getCalleeContext()->getCallSite() == S)
   break;
-  if (auto SP = Node->getLocationAs())
-if (SP->getStmt() == S)
-  break;
+
+  if (!IsBypass)
+if (Optional SP = Node->getLocationAs())
+  if (SP->getStmt() == S)

Comparing statements is usually insufficient because the same statement may 
appear multiple times due to recursion. When recursion occurs, you may reach 
the same statement in a different location context. You should think in terms 
of (statement, location context) pairs to avoid these problems. Your aim here 
is to find the `CallExitEnd` node that corresponds to returning from an inlined 
operator new to the current location context. You should stop searching when 
you find an unrelated statement in the current location context or when you 
exit the current location context entirely.


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

https://reviews.llvm.org/D62926



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


[PATCH] D62952: [analyzer][tests] Use normalize_sarif in place of diff_sarif

2019-06-07 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added a comment.

@aaron.ballman, for similar cases in the plist output, it has been proposed

- that the reference expected file be committed into the tree pre-normalized, 
and
- that tool be modified such that the output file has a newline at the end of 
the file.

Does that sound good for this format?


Repository:
  rC Clang

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

https://reviews.llvm.org/D62952



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


[PATCH] D62949: [analyzer][tests] Add normalize_plist to replace diff_plist

2019-06-07 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added a comment.

I've tested the pre-normalization and it looks like I can commit it tomorrow. I 
noticed that the following three files appear to be unreferenced:

  clang/test/Analysis/Inputs/expected-plists/cstring-plist.c.plist
  clang/test/Analysis/Inputs/expected-plists/plist-stats-output.c.plist
  clang/test/Analysis/Inputs/expected-plists/yaccignore.c.plist

I'll commit the deletion of these tomorrow as well.

Modifying the tools to produce a newline at the end of the output also seems to 
work okay with the tests. I've posted the change for that in D63041 
.


Repository:
  rC Clang

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

https://reviews.llvm.org/D62949



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


[PATCH] D63041: [PlistSupport] Produce a newline to end plist output files

2019-06-07 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast created this revision.
hubert.reinterpretcast added reviewers: NoQ, sfertile, xingxue, jasonliu, 
daltenty.
Herald added a subscriber: jsji.
Herald added a project: clang.

As suggested in the review of D62949 , this 
patch updates the plist output to have a newline at the end of the file. This 
makes it so that the plist output file qualifies as a POSIX text file, which 
increases the consumability of the generated plist file in relation to various 
tools.


Repository:
  rC Clang

https://reviews.llvm.org/D63041

Files:
  lib/ARCMigrate/PlistReporter.cpp
  lib/StaticAnalyzer/Core/PlistDiagnostics.cpp


Index: lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
===
--- lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
+++ lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
@@ -748,7 +748,7 @@
   }
 
   // Finish.
-  o << "\n";
+  o << "\n\n";
 }
 
 
//===--===//
Index: lib/ARCMigrate/PlistReporter.cpp
===
--- lib/ARCMigrate/PlistReporter.cpp
+++ lib/ARCMigrate/PlistReporter.cpp
@@ -120,5 +120,5 @@
   o << " \n";
 
   // Finish.
-  o << "\n";
+  o << "\n\n";
 }


Index: lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
===
--- lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
+++ lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
@@ -748,7 +748,7 @@
   }
 
   // Finish.
-  o << "\n";
+  o << "\n\n";
 }
 
 //===--===//
Index: lib/ARCMigrate/PlistReporter.cpp
===
--- lib/ARCMigrate/PlistReporter.cpp
+++ lib/ARCMigrate/PlistReporter.cpp
@@ -120,5 +120,5 @@
   o << " \n";
 
   // Finish.
-  o << "\n";
+  o << "\n\n";
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D61914: [Support][Test] Time profiler: add regression test

2019-06-07 Thread Puyan Lotfi via cfe-commits
--target=

Sent from ProtonMail Mobile

On Fri, Jun 7, 2019 at 2:01 PM, Anton Afanasyev via Phabricator 
 wrote:

> anton-afanasyev marked an inline comment as done.
> anton-afanasyev added a comment.
>
> In D61914#1534508 , @plotfi wrote:
>
>> cfe/trunk/test/Driver/check-time-trace.cpp appears to fail on Darwin. Did 
>> you mean to pass the target explicitly ?
>
> This commit is reverted now. How can I pass the target explicitly?
>
> 
> Comment at: cfe/trunk/test/Driver/check-time-trace.cpp:1
> +// RUN: %clangxx -ftime-trace %s 2>&1 | grep "Time trace json-file dumped 
> to" \
> +// RUN: | awk '{print $NF}' | xargs cat \
> 
> plotfi wrote:
>> This test should probably have // REQUIRES: shell
> Thanks! I haven't found `REQUIRES: shell` here: 
> `https://llvm.org/docs/CommandGuide/FileCheck.html`. Does this directive mean 
> the target OS must have utils like `awk` and `xargs`?
>
> Repository:
> rL LLVM
>
> CHANGES SINCE LAST ACTION
> https://reviews.llvm.org/D61914/new/
>
> https://reviews.llvm.org/D61914-BEGIN PGP PUBLIC KEY BLOCK-
Version: Pmcrypto Golang 0.0.1 (ddacebe0)
Comment: https://protonmail.com

xsBNBFiqrSIBCADBs95WesbqXDDK3y+LLHh/EuIZUAFg6tSOCD3r7VPBjRTAw6+e
H8VztrEyPm6MffHJBCh9K9N+lE7U/jtDzdEMlPX7rxt+VbkNTadkitNxHpJQqifu
qI4SyOQfpedyIJZ/VokXgtqdBV0iugtlRvkC7kyk+H8rOwBDNEGL9eh+zL/k20RP
CNATpXl902yOMC9nCaB7zDZt/twPbUY7qGjV3wxSwIzUySdZPLgPcseip84O3uYX
+QShZAqgi5ajCJflqcQKNUMJDN0dX4tFmaOWQ4HKQ4tTFkX4x6iOFy/1lRb6irHp
g7/BXpNLeagvyjMc598+tYObSpqVHIVAqc/RABEBAAHNIXB1eWFuQHB1eWFuLm9y
ZyA8cHV5YW5AcHV5YW4ub3JnPsLAdQQQAQgAKQUCWKqtIgYLCQcIAwIJEHs5Mm+b
S7GXBBUIAgoDFgIBAhkBAhsDAh4BAAAN8gf7BVfluoQUyiIQx2ponrIRv6jeOTiv
0aYUyFwUzQ7aPdtHSORYoQNKtLbXV2jUMtrsR3MIW2eYVA51iO/V0OqYGAFtc45W
YnQ0XK0bEPjQHx/oMhCGnlcFVGt5dLymqIQN8X0AROYydx0QG8EMGIyrU5OkJOJG
grIfnImUJ5N9naBBolXoGeO4q5tZ9PewcbYWm+jVZa92CO2f6LXeEQUCDXN6GpsT
WF3O8G8fRNC89maOIZKpx23Pv9JnPA0fBWJb1vyJujygtCHkPwa4SwQw9p9bcds9
n22XRIOICNbgT3fJ19JIuVkt9guHXrJE7jLWCAd8f+7vLfYs+LreS1fwBs7ATQRY
qq0iAQgAoUEmT7Epc7aX+Ylh+eHdxeLbGizzm1wzwtQtm/f72DiqJueLC/I1RQKe
M6wTXyfdF2yZ0E0/Hf7YREnLEjqVxmD5ygS1Ifvv2gzNyAvDWc8bey3t3NRGsWvv
8nUeJNM3vhWPpRIEUZ+t0l4fLYFlm1o1lOh6T33LdiyZW62shVmuS82Vr4B223Yx
/oHtgIBD+PTXlETrOPKPdxwbUjaQkqlFlzTH2Wc1ygW8wM+rXuHQPJ8BlIIopIZt
I3ZFz3r3Zy3j4k6I0QyP7Z5j1jm3bIOXgIJeE2HqNWhpYNFAGqzrlGY+1sEH2T/A
6sfca5oe+6ziPpWJxqmou+9GgiYbPwARAQABwsBfBBgBCAATBQJYqq0iCRB7OTJv
m0uxlwIbDAAAO8cH/0UtYyy4pm2E9xfw3cz3/7NfPoY5KZH0DtivFFxmlzo07BJh
qmFVql7yE8yzK8pqssBqmsV012H2+/sqPbudShbW4UOPcnDiHAgfDb+UR8QEqmJf
bDo9Gpk6Bo3VHGbpCtlZY88cHJYpXu2g69jQIyseG0pQKGcRJZ+8t/rK3IX086Uy
ZehflSk3uU3hxdN96JlvFf4GEdgdzxlE6S3AnyjV05yrjkiDhFmSRt1Pr4U9uSES
swXnufUmP+QgdINI94GPhyJSkvdRoFk0nb7E3lCyzCgIEc2p//vfuhBMN2Znrwzp
MccpJXqocidMX0HqjMh9ZUlLkEaYeAGg+qwBVRE=
=HAbn
-END PGP PUBLIC KEY BLOCK-___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D62115: fix a issue that clang is incompatible with gcc with -H option.

2019-06-07 Thread Kan Shengchen via Phabricator via cfe-commits
skan updated this revision to Diff 203664.
skan added a comment.

make macro more compact


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

https://reviews.llvm.org/D62115

Files:
  lib/Frontend/HeaderIncludeGen.cpp
  test/Frontend/clang_H_opt.c


Index: test/Frontend/clang_H_opt.c
===
--- /dev/null
+++ test/Frontend/clang_H_opt.c
@@ -0,0 +1,41 @@
+// RUN: %clang -H -fsyntax-only %s 2>&1 | FileCheck %s
+
+#include "../Index/Inputs/empty.h"
+#include "Inputs/empty.h"
+#include "./Inputs/empty.h"
+#include "././Inputs/empty.h"
+#include "./Inputs/empty.h"
+// CHECK: .
+// CHECK-SAME: ../Index/Inputs/empty.h
+// CHECK: .
+// CHECK-SAME: Inputs/empty.h
+// CHECK: .
+// CHECK-SAME: ./Inputs/empty.h
+// CHECK: .
+// CHECK-SAME: ././Inputs/empty.h
+// CHECK: .
+// CHECK-SAME: ./Inputs/empty.h
+
+#if defined(_WIN32) || defined(_WIN64)
+#include "..\Index\Inputs\empty.h"
+#include "Inputs\empty.h"
+#include ".\Inputs\empty.h"
+#include ".\.\Inputs\empty.h"
+#include ".\Inputs\empty.h"
+#else
+#include "../Index/Inputs/empty.h"
+#include "Inputs/empty.h"
+#include "./Inputs/empty.h"
+#include "././Inputs/empty.h"
+#include "./Inputs/empty.h"
+#endif
+// CHECK: .
+// CHECK-SAME: ..{{\/|}}Index{{\/|}}Inputs{{\/|}}empty.h
+// CHECK: .
+// CHECK-SAME: Inputs{{\/|}}empty.h
+// CHECK: .
+// CHECK-SAME: .{{\/|}}Inputs{{\/|}}empty.h
+// CHECK: .
+// CHECK-SAME: .{{\/|}}.{{\/|}}Inputs{{\/|}}empty.h
+// CHECK: .
+// CHECK-SAME: .{{\/|}}Inputs{{\/|}}empty.h
Index: lib/Frontend/HeaderIncludeGen.cpp
===
--- lib/Frontend/HeaderIncludeGen.cpp
+++ lib/Frontend/HeaderIncludeGen.cpp
@@ -51,6 +51,10 @@
 static void PrintHeaderInfo(raw_ostream *OutputFile, StringRef Filename,
 bool ShowDepth, unsigned CurrentIncludeDepth,
 bool MSStyle) {
+  // Simplify Filename that starts with "./"
+  if (Filename.startswith("./"))
+Filename = Filename.substr(2);
+
   // Write to a temporary string to avoid unnecessary flushing on errs().
   SmallString<512> Pathname(Filename);
   if (!MSStyle)


Index: test/Frontend/clang_H_opt.c
===
--- /dev/null
+++ test/Frontend/clang_H_opt.c
@@ -0,0 +1,41 @@
+// RUN: %clang -H -fsyntax-only %s 2>&1 | FileCheck %s
+
+#include "../Index/Inputs/empty.h"
+#include "Inputs/empty.h"
+#include "./Inputs/empty.h"
+#include "././Inputs/empty.h"
+#include "./Inputs/empty.h"
+// CHECK: .
+// CHECK-SAME: ../Index/Inputs/empty.h
+// CHECK: .
+// CHECK-SAME: Inputs/empty.h
+// CHECK: .
+// CHECK-SAME: ./Inputs/empty.h
+// CHECK: .
+// CHECK-SAME: ././Inputs/empty.h
+// CHECK: .
+// CHECK-SAME: ./Inputs/empty.h
+
+#if defined(_WIN32) || defined(_WIN64)
+#include "..\Index\Inputs\empty.h"
+#include "Inputs\empty.h"
+#include ".\Inputs\empty.h"
+#include ".\.\Inputs\empty.h"
+#include ".\Inputs\empty.h"
+#else
+#include "../Index/Inputs/empty.h"
+#include "Inputs/empty.h"
+#include "./Inputs/empty.h"
+#include "././Inputs/empty.h"
+#include "./Inputs/empty.h"
+#endif
+// CHECK: .
+// CHECK-SAME: ..{{\/|}}Index{{\/|}}Inputs{{\/|}}empty.h
+// CHECK: .
+// CHECK-SAME: Inputs{{\/|}}empty.h
+// CHECK: .
+// CHECK-SAME: .{{\/|}}Inputs{{\/|}}empty.h
+// CHECK: .
+// CHECK-SAME: .{{\/|}}.{{\/|}}Inputs{{\/|}}empty.h
+// CHECK: .
+// CHECK-SAME: .{{\/|}}Inputs{{\/|}}empty.h
Index: lib/Frontend/HeaderIncludeGen.cpp
===
--- lib/Frontend/HeaderIncludeGen.cpp
+++ lib/Frontend/HeaderIncludeGen.cpp
@@ -51,6 +51,10 @@
 static void PrintHeaderInfo(raw_ostream *OutputFile, StringRef Filename,
 bool ShowDepth, unsigned CurrentIncludeDepth,
 bool MSStyle) {
+  // Simplify Filename that starts with "./"
+  if (Filename.startswith("./"))
+Filename = Filename.substr(2);
+
   // Write to a temporary string to avoid unnecessary flushing on errs().
   SmallString<512> Pathname(Filename);
   if (!MSStyle)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D63029: [CUDA] Fix grep pattern in cuda-types.cu

2019-06-07 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast marked 3 inline comments as done.
hubert.reinterpretcast added inline comments.



Comment at: test/Preprocessor/cuda-types.cu:11
 // RUN: %clang --cuda-host-only -nocudainc -target i386-unknown-linux-gnu -x 
cuda -E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > %t/i386-host-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF\|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > %t/i386-host-defines-filtered

hubert.reinterpretcast wrote:
> tra wrote:
> > I believe that was a typo in the original test. It should be 
> > `TYPE|MAX|SIZEOF|WIDTH` now.
> > `SIZEOF` and `WIDTH` are parts of different defines we're looking for.
> > 
> > E.g
> > ```
> > #define __SIZEOF_DOUBLE__ 8
> > ...
> > #define __INTPTR_WIDTH__ 32
> > 
> > ```
> I can give that a try. I'll update on the status of whether the test passes 
> once `SIZEOF` and `WIDTH` is actually tested.
The test still passes after updating the pattern to pick up `SIZEOF` and 
`WIDTH` macros. I've updated the patch.


Repository:
  rC Clang

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

https://reviews.llvm.org/D63029



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


[PATCH] D63029: [NFC][CUDA] Avoid undefined grep in cuda-types.cu

2019-06-07 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast updated this revision to Diff 203659.
hubert.reinterpretcast added a comment.

Fix grep pattern in cuda-types.cu

As requested, further fix so that the `SIZEOF` and `WIDTH` macros are checked.


Repository:
  rC Clang

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

https://reviews.llvm.org/D63029

Files:
  test/Preprocessor/cuda-types.cu


Index: test/Preprocessor/cuda-types.cu
===
--- test/Preprocessor/cuda-types.cu
+++ test/Preprocessor/cuda-types.cu
@@ -8,41 +8,41 @@
 // RUN: mkdir -p %t
 
 // RUN: %clang --cuda-host-only -nocudainc -target i386-unknown-linux-gnu -x 
cuda -E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > %t/i386-host-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > %t/i386-host-defines-filtered
 // RUN: %clang --cuda-device-only -nocudainc -nocudalib -target 
i386-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > %t/i386-device-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > %t/i386-device-defines-filtered
 // RUN: diff %t/i386-host-defines-filtered %t/i386-device-defines-filtered
 
 // RUN: %clang --cuda-host-only -nocudainc -target x86_64-unknown-linux-gnu -x 
cuda -E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > %t/x86_64-host-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > %t/x86_64-host-defines-filtered
 // RUN: %clang --cuda-device-only -nocudainc -nocudalib -target 
x86_64-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > %t/x86_64-device-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > %t/x86_64-device-defines-filtered
 // RUN: diff %t/x86_64-host-defines-filtered %t/x86_64-device-defines-filtered
 
 // RUN: %clang --cuda-host-only -nocudainc -target powerpc64-unknown-linux-gnu 
-x cuda -E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > %t/powerpc64-host-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > %t/powerpc64-host-defines-filtered
 // RUN: %clang --cuda-device-only -nocudainc -nocudalib -target 
powerpc64-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > 
%t/powerpc64-device-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > 
%t/powerpc64-device-defines-filtered
 // RUN: diff %t/powerpc64-host-defines-filtered 
%t/powerpc64-device-defines-filtered
 
 // RUN: %clang --cuda-host-only -nocudainc -target i386-windows-msvc -x cuda 
-E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > %t/i386-msvc-host-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > %t/i386-msvc-host-defines-filtered
 // RUN: %clang --cuda-device-only -nocudainc -nocudalib -target 
i386-windows-msvc -x cuda -E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > 
%t/i386-msvc-device-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > 
%t/i386-msvc-device-defines-filtered
 // RUN: diff %t/i386-msvc-host-defines-filtered 
%t/i386-msvc-device-defines-filtered
 
 // RUN: %clang --cuda-host-only -nocudainc -target x86_64-windows-msvc -x cuda 
-E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > 
%t/x86_64-msvc-host-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > 
%t/x86_64-msvc-host-defines-filtered
 // RUN: %clang --cuda-device-only -nocudainc 

[PATCH] D63039: Various improvements to Clang MSVC Visualizers

2019-06-07 Thread Mike Spertus via Phabricator via cfe-commits
mspertus created this revision.
mspertus added reviewers: aaron.ballman, zturner.
mspertus added a project: clang.
Herald added a subscriber: cfe-commits.

This change adds/improves MSVC visualizers for many Clang types, including 
array types, trailing return types in function, deduction guides, a fix for 
OpaquePtr, etc. It also replaces all of the view(deref) with the "na" 
formatter, which is a better built-in natvis technique for doing the same 
thing. To see these in action, look at the attached image of my Watch Window 
F9111721: visualize2.jpg  or as approximated 
by the ASCII rendering below

  -S.CurScope->DeclsInScope,na  { [Small Mode] size=14, capacity=32 }
  [size]14
  [capacity]32
  [0]   {Identifier (__int128_t)}
  [1]   {Identifier (__uint128_t)}
  [2]   {Identifier (__NSConstantString)}
  [3]   {Identifier (__builtin_ms_va_list)}
  [4]   {Identifier (__builtin_va_list)}
  [5]   int i
  [6]   int j
  [7]   char a[5]
  [8]   template void g(T t);
  [9]   template struct Y;
  [10]  template Y(T ) -> Y;
  [11]  struct X
  DeclKind  CXXRecord
  Members
  [0]   implicit struct X
  [1]   Field {int si}
  [12]  void f(X x)
  [13]  int main(int argc, char * argv[])


Repository:
  rC Clang

https://reviews.llvm.org/D63039

Files:
  utils/ClangVisualizers/clang.natvis

Index: utils/ClangVisualizers/clang.natvis
===
--- utils/ClangVisualizers/clang.natvis
+++ utils/ClangVisualizers/clang.natvis
@@ -27,18 +27,32 @@
 {*(clang::PointerType *)this}
 {*(clang::LValueReferenceType *)this}
 {*(clang::RValueReferenceType *)this}
+{(clang::ConstantArrayType *)this,na}
+{(clang::ConstantArrayType *)this,view(left)na}
+{(clang::ConstantArrayType *)this,view(right)na}
+{(clang::IncompleteArrayType *)this,na}
+{(clang::IncompleteArrayType *)this,view(left)na}
+{(clang::IncompleteArrayType *)this,view(right)na}
 {*(clang::AttributedType *)this}
+{(clang::DecayedType *)this,na}
+{(clang::DecayedType *)this,view(left)na}
+{(clang::DecayedType *)this,view(right)na}
 {*(clang::TemplateTypeParmType *)this}
+{*(clang::TemplateTypeParmType *)this,view(cpp)}
 {*(clang::SubstTemplateTypeParmType *)this}
 {*(clang::RecordType *)this}
 {*(clang::RecordType *)this,view(cpp)}
-{*(clang::FunctionProtoType *)this}
+{(clang::FunctionProtoType *)this,na}
+{(clang::FunctionProtoType *)this,view(left)na}
+{(clang::FunctionProtoType *)this,view(right)na}
 {*(clang::TemplateSpecializationType *)this}
 {*(clang::DeducedTemplateSpecializationType *)this}
 {*(clang::InjectedClassNameType *)this}
 {*(clang::PackExpansionType *)this}
 {*(clang::LocInfoType *)this}
 {*this,view(poly)}
+{*this,view(cpp)}
+
 No visualizer yet for {(clang::Type::TypeClass)TypeBits.TC,en}Type 
 Dependent{" ",sb}
 
@@ -62,13 +76,16 @@
 {*this,view(cmn)}  {{{*this,view(poly)}}}
 
   (clang::Type::TypeClass)TypeBits.TC
-  *this,view(flags)
+  this,view(flags)na
   CanonicalType
   *(clang::BuiltinType *)this
   *(clang::PointerType *)this
   *(clang::LValueReferenceType *)this
   *(clang::RValueReferenceType *)this
+  (clang::ConstantArrayType *)this
+  (clang::IncompleteArrayType *)this
   *(clang::AttributedType *)this
+  (clang::DecayedType *)this
   (clang::TemplateTypeParmType *)this
   (clang::SubstTemplateTypeParmType *)this
   (clang::RecordType *)this
@@ -80,6 +97,28 @@
   (clang::LocInfoType *)this
 
   
+  
+
+  ElementType
+
+  
+  
+{ElementType,view(cpp)}
+[{Size}]
+{ElementType,view(cpp)}[{Size}]
+
+  Size
+  (clang::ArrayType *)this
+
+  
+  
+{ElementType,view(cpp)}
+[]
+{ElementType,view(cpp)}[]
+
+  (clang::ArrayType *)this
+
+  
   
 {PointeeType, view(poly)} *
 
@@ -110,9 +149,9 @@
   
   
   
-{(clang::Decl::Kind)DeclKind,en}Decl
+{(clang::Decl::Kind)DeclContextBits.DeclKind,en}Decl
 
-  (clang::Decl::Kind)DeclKind,en
+  (clang::Decl::Kind)DeclContextBits.DeclKind,en
   
 
 
@@ -147,10 +186,14 @@
 {*this,view(TorC)} {*this,view(MaybeEllipses)}{Name,view(cpp)} 
   
   
-template{TemplateParams,view(deref)} {*TemplatedDecl};
+template{TemplateParams,na} {*TemplatedDecl};
+
+  TemplateParams,na
+  TemplatedDecl,na
+
   
   
-{Storage,view(deref)}
+{Storage,na}
 
   Storage
 
@@ -174,7 +217,7 @@
 
 

r362856 - DebugInfo: Add support for 'nodebug' attribute on typedefs and alias templates

2019-06-07 Thread David Blaikie via cfe-commits
Author: dblaikie
Date: Fri Jun  7 17:01:21 2019
New Revision: 362856

URL: http://llvm.org/viewvc/llvm-project?rev=362856=rev
Log:
DebugInfo: Add support for 'nodebug' attribute on typedefs and alias templates

Seems like a logical extension to me - and of interest because it might
help reduce the debug info size of libc++ by applying this attribute to
type traits that have a disproportionate debug info cost compared to the
benefit (& possibly harm/confusion) they cause users.

Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/test/CodeGenCXX/debug-info-nodebug.cpp
cfe/trunk/test/Misc/pragma-attribute-supported-attributes-list.test
cfe/trunk/test/Sema/attr-nodebug.c

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=362856=362855=362856=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Fri Jun  7 17:01:21 2019
@@ -1434,7 +1434,7 @@ def NoCommon : InheritableAttr {
 
 def NoDebug : InheritableAttr {
   let Spellings = [GCC<"nodebug">];
-  let Subjects = SubjectList<[FunctionLike, ObjCMethod, NonParmVar]>;
+  let Subjects = SubjectList<[TypedefName, FunctionLike, ObjCMethod, 
NonParmVar]>;
   let Documentation = [NoDebugDocs];
 }
 

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=362856=362855=362856=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Jun  7 17:01:21 2019
@@ -1091,15 +1091,18 @@ llvm::DIType *CGDebugInfo::CreateType(co
   assert(Ty->isTypeAlias());
   llvm::DIType *Src = getOrCreateType(Ty->getAliasedType(), Unit);
 
+  auto *AliasDecl =
+  cast(Ty->getTemplateName().getAsTemplateDecl())
+  ->getTemplatedDecl();
+
+  if (AliasDecl->hasAttr())
+return Src;
+
   SmallString<128> NS;
   llvm::raw_svector_ostream OS(NS);
   Ty->getTemplateName().print(OS, getPrintingPolicy(), /*qualified*/ false);
   printTemplateArgumentList(OS, Ty->template_arguments(), getPrintingPolicy());
 
-  auto *AliasDecl =
-  cast(Ty->getTemplateName().getAsTemplateDecl())
-  ->getTemplatedDecl();
-
   SourceLocation Loc = AliasDecl->getLocation();
   return DBuilder.createTypedef(Src, OS.str(), getOrCreateFile(Loc),
 getLineNumber(Loc),
@@ -1108,15 +,20 @@ llvm::DIType *CGDebugInfo::CreateType(co
 
 llvm::DIType *CGDebugInfo::CreateType(const TypedefType *Ty,
   llvm::DIFile *Unit) {
+  llvm::DIType *Underlying =
+  getOrCreateType(Ty->getDecl()->getUnderlyingType(), Unit);
+
+  if (Ty->getDecl()->hasAttr())
+return Underlying;
+
   // We don't set size information, but do specify where the typedef was
   // declared.
   SourceLocation Loc = Ty->getDecl()->getLocation();
 
   // Typedefs are derived from some other type.
-  return DBuilder.createTypedef(
-  getOrCreateType(Ty->getDecl()->getUnderlyingType(), Unit),
-  Ty->getDecl()->getName(), getOrCreateFile(Loc), getLineNumber(Loc),
-  getDeclContextDescriptor(Ty->getDecl()));
+  return DBuilder.createTypedef(Underlying, Ty->getDecl()->getName(),
+getOrCreateFile(Loc), getLineNumber(Loc),
+getDeclContextDescriptor(Ty->getDecl()));
 }
 
 static unsigned getDwarfCC(CallingConv CC) {

Modified: cfe/trunk/test/CodeGenCXX/debug-info-nodebug.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-nodebug.cpp?rev=362856=362855=362856=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-nodebug.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-nodebug.cpp Fri Jun  7 17:01:21 2019
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -DSETNODEBUG=0 -emit-llvm -debug-info-kind=limited %s -o - 
| FileCheck %s --check-prefix=YESINFO
-// RUN: %clang_cc1 -DSETNODEBUG=1 -emit-llvm -debug-info-kind=limited %s -o - 
| FileCheck %s --check-prefix=NOINFO
+// RUN: %clang_cc1 -DSETNODEBUG=0 -emit-llvm -std=c++14 
-debug-info-kind=limited %s -o - | FileCheck %s --check-prefix=YESINFO
+// RUN: %clang_cc1 -DSETNODEBUG=1 -emit-llvm -std=c++14 
-debug-info-kind=limited %s -o - | FileCheck %s --check-prefix=NOINFO
 
 #if SETNODEBUG
 #define NODEBUG __attribute__((nodebug))
@@ -53,3 +53,15 @@ void func4() {
 // NOINFO-NOT:  !DIGlobalVariable(name: "static_local"
 // YESINFO-DAG: !DILocalVariable(name: "normal_local"
 // NOINFO-NOT:  !DILocalVariable(name: "normal_local"
+
+template 
+using y NODEBUG = int;
+void func5() {
+  NODEBUG typedef int x;
+  x a;
+  y b;
+}
+// YESINFO-DAG: !DIDerivedType(tag: DW_TAG_typedef, name: "x"
+// NOINFO-NOT:  

[PATCH] D62885: [analyzer] Add werror flag for analyzer warnings

2019-06-07 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL362855: [analyzer] Add werror flag for analyzer warnings 
(authored by kfischer, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D62885?vs=203047=203643#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62885

Files:
  cfe/trunk/include/clang/Driver/CC1Options.td
  cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
  cfe/trunk/lib/Frontend/CompilerInvocation.cpp
  cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
  cfe/trunk/test/Analysis/override-werror.c

Index: cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
===
--- cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
@@ -245,6 +245,9 @@
   /// strategy. We get better code coverage when retry is enabled.
   unsigned NoRetryExhausted : 1;
 
+  /// Emit analyzer warnings as errors.
+  unsigned AnalyzerWerror : 1;
+
   /// The inlining stack depth limit.
   // Cap the stack depth at 4 calls (5 stack frames, base + 4 calls).
   unsigned InlineMaxStackDepth = 5;
@@ -297,7 +300,7 @@
 AnalyzerDisplayProgress(false), AnalyzeNestedBlocks(false),
 eagerlyAssumeBinOpBifurcation(false), TrimGraph(false),
 visualizeExplodedGraphWithGraphViz(false), UnoptimizedCFG(false),
-PrintStats(false), NoRetryExhausted(false) {
+PrintStats(false), NoRetryExhausted(false), AnalyzerWerror(false) {
 llvm::sort(AnalyzerConfigCmdFlags);
   }
 
Index: cfe/trunk/include/clang/Driver/CC1Options.td
===
--- cfe/trunk/include/clang/Driver/CC1Options.td
+++ cfe/trunk/include/clang/Driver/CC1Options.td
@@ -166,6 +166,9 @@
 def analyzer_config_compatibility_mode_EQ : Joined<["-"], "analyzer-config-compatibility-mode=">,
   Alias;
 
+def analyzer_werror : Flag<["-"], "analyzer-werror">,
+  HelpText<"Emit analyzer results as errors rather than warnings">;
+
 //===--===//
 // Migrator Options
 //===--===//
Index: cfe/trunk/test/Analysis/override-werror.c
===
--- cfe/trunk/test/Analysis/override-werror.c
+++ cfe/trunk/test/Analysis/override-werror.c
@@ -1,14 +1,17 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.core -Werror %s -analyzer-store=region -verify
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.core -Werror %s -analyzer-store=region -analyzer-werror -verify=werror
 
 // This test case illustrates that using '-analyze' overrides the effect of
 // -Werror.  This allows basic warnings not to interfere with producing
 // analyzer results.
 
-char* f(int *p) { 
-  return p; // expected-warning{{incompatible pointer types}}
+char* f(int *p) {
+  return p; // expected-warning{{incompatible pointer types}} \
+   werror-warning{{incompatible pointer types}}
 }
 
 void g(int *p) {
-  if (!p) *p = 0; // expected-warning{{null}}  
+  if (!p) *p = 0; // expected-warning{{null}} \
+ werror-error{{null}}
 }
 
Index: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
===
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp
@@ -309,6 +309,7 @@
 Args.hasArg(OPT_analyzer_viz_egraph_graphviz);
   Opts.DumpExplodedGraphTo = Args.getLastArgValue(OPT_analyzer_dump_egraph);
   Opts.NoRetryExhausted = Args.hasArg(OPT_analyzer_disable_retry_exhausted);
+  Opts.AnalyzerWerror = Args.hasArg(OPT_analyzer_werror);
   Opts.AnalyzeAll = Args.hasArg(OPT_analyzer_opt_analyze_headers);
   Opts.AnalyzerDisplayProgress = Args.hasArg(OPT_analyzer_display_progress);
   Opts.AnalyzeNestedBlocks =
Index: cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
@@ -83,10 +83,11 @@
 namespace {
 class ClangDiagPathDiagConsumer : public PathDiagnosticConsumer {
   DiagnosticsEngine 
-  bool IncludePath;
+  bool IncludePath, ShouldEmitAsError;
+
 public:
   ClangDiagPathDiagConsumer(DiagnosticsEngine )
-: Diag(Diag), IncludePath(false) {}
+  : Diag(Diag), IncludePath(false), ShouldEmitAsError(false) {}
   ~ClangDiagPathDiagConsumer() override {}
   StringRef getName() const override { return "ClangDiags"; }
 
@@ -101,9 +102,14 @@
 IncludePath = true;
   }
 
+  void enableWerror() { ShouldEmitAsError = true; }
+
   void 

r362855 - [analyzer] Add werror flag for analyzer warnings

2019-06-07 Thread Keno Fischer via cfe-commits
Author: kfischer
Date: Fri Jun  7 16:34:00 2019
New Revision: 362855

URL: http://llvm.org/viewvc/llvm-project?rev=362855=rev
Log:
[analyzer] Add werror flag for analyzer warnings

Summary:
We're using the clang static analyzer together with a number of
custom analyses in our CI system to ensure that certain invariants
are statiesfied for by the code every commit. Unfortunately, there
currently doesn't seem to be a good way to determine whether any
analyzer warnings were emitted, other than parsing clang's output
(or using scan-build, which then in turn parses clang's output).
As a simpler mechanism, simply add a `-analyzer-werror` flag to CC1
that causes the analyzer to emit its warnings as errors instead.
I briefly tried to have this be `Werror=analyzer` and make it go
through that machinery instead, but that seemed more trouble than
it was worth in terms of conflicting with options to the actual build
and special cases that would be required to circumvent the analyzers
usual attempts to quiet non-analyzer warnings. This is simple and it
works well.

Reviewed-By: NoQ, Szelethusw
Differential Revision: https://reviews.llvm.org/D62885

Modified:
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
cfe/trunk/test/Analysis/override-werror.c

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=362855=362854=362855=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Fri Jun  7 16:34:00 2019
@@ -166,6 +166,9 @@ def analyzer_config_compatibility_mode :
 def analyzer_config_compatibility_mode_EQ : Joined<["-"], 
"analyzer-config-compatibility-mode=">,
   Alias;
 
+def analyzer_werror : Flag<["-"], "analyzer-werror">,
+  HelpText<"Emit analyzer results as errors rather than warnings">;
+
 
//===--===//
 // Migrator Options
 
//===--===//

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h?rev=362855=362854=362855=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h Fri Jun  7 
16:34:00 2019
@@ -245,6 +245,9 @@ public:
   /// strategy. We get better code coverage when retry is enabled.
   unsigned NoRetryExhausted : 1;
 
+  /// Emit analyzer warnings as errors.
+  unsigned AnalyzerWerror : 1;
+
   /// The inlining stack depth limit.
   // Cap the stack depth at 4 calls (5 stack frames, base + 4 calls).
   unsigned InlineMaxStackDepth = 5;
@@ -297,7 +300,7 @@ public:
 AnalyzerDisplayProgress(false), AnalyzeNestedBlocks(false),
 eagerlyAssumeBinOpBifurcation(false), TrimGraph(false),
 visualizeExplodedGraphWithGraphViz(false), UnoptimizedCFG(false),
-PrintStats(false), NoRetryExhausted(false) {
+PrintStats(false), NoRetryExhausted(false), AnalyzerWerror(false) {
 llvm::sort(AnalyzerConfigCmdFlags);
   }
 

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=362855=362854=362855=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri Jun  7 16:34:00 2019
@@ -309,6 +309,7 @@ static bool ParseAnalyzerArgs(AnalyzerOp
 Args.hasArg(OPT_analyzer_viz_egraph_graphviz);
   Opts.DumpExplodedGraphTo = Args.getLastArgValue(OPT_analyzer_dump_egraph);
   Opts.NoRetryExhausted = Args.hasArg(OPT_analyzer_disable_retry_exhausted);
+  Opts.AnalyzerWerror = Args.hasArg(OPT_analyzer_werror);
   Opts.AnalyzeAll = Args.hasArg(OPT_analyzer_opt_analyze_headers);
   Opts.AnalyzerDisplayProgress = Args.hasArg(OPT_analyzer_display_progress);
   Opts.AnalyzeNestedBlocks =

Modified: cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp?rev=362855=362854=362855=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp Fri Jun  7 
16:34:00 2019
@@ -83,10 +83,11 @@ void ento::createTextPathDiagnosticConsu
 namespace {
 class ClangDiagPathDiagConsumer : public 

LLVM buildmaster will be updated and restarted tonight

2019-06-07 Thread Galina Kistanova via cfe-commits
 Hello everyone,

LLVM buildmaster will be updated and restarted after 6PM Pacific time today.

Thanks

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


[PATCH] D63031: DebugInfo: Render the canonical name of a class template specialization, even when nested in another class template specialization

2019-06-07 Thread David Blaikie via Phabricator via cfe-commits
dblaikie created this revision.
dblaikie added a reviewer: rsmith.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rC Clang

https://reviews.llvm.org/D63031

Files:
  lib/AST/TypePrinter.cpp
  lib/CodeGen/CGDebugInfo.cpp
  test/CodeGenCXX/debug-info-template-explicit-specialization.cpp


Index: test/CodeGenCXX/debug-info-template-explicit-specialization.cpp
===
--- test/CodeGenCXX/debug-info-template-explicit-specialization.cpp
+++ test/CodeGenCXX/debug-info-template-explicit-specialization.cpp
@@ -105,7 +105,12 @@
 };
 extern template class j;
 j jj;
+template 
+struct j_wrap {
+};
+j_wrap> j_wrap_j;
 // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "j"
+// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "j_wrap >"
 
 template 
 struct k {
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -313,7 +313,9 @@
   if (isa(RD)) {
 SmallString<128> Name;
 llvm::raw_svector_ostream OS(Name);
-RD->getNameForDiagnostic(OS, getPrintingPolicy(),
+PrintingPolicy PP = getPrintingPolicy();
+PP.PrintCanonicalTypes = true;
+RD->getNameForDiagnostic(OS, PP,
  /*Qualified*/ false);
 
 // Copy this name on the side and use its reference.
Index: lib/AST/TypePrinter.cpp
===
--- lib/AST/TypePrinter.cpp
+++ lib/AST/TypePrinter.cpp
@@ -1204,7 +1204,8 @@
   // arguments.
   if (const auto *Spec = dyn_cast(D)) {
 ArrayRef Args;
-if (TypeSourceInfo *TAW = Spec->getTypeAsWritten()) {
+TypeSourceInfo *TAW = Spec->getTypeAsWritten();
+if (!Policy.PrintCanonicalTypes && TAW) {
   const TemplateSpecializationType *TST =
 cast(TAW->getType());
   Args = TST->template_arguments();


Index: test/CodeGenCXX/debug-info-template-explicit-specialization.cpp
===
--- test/CodeGenCXX/debug-info-template-explicit-specialization.cpp
+++ test/CodeGenCXX/debug-info-template-explicit-specialization.cpp
@@ -105,7 +105,12 @@
 };
 extern template class j;
 j jj;
+template 
+struct j_wrap {
+};
+j_wrap> j_wrap_j;
 // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "j"
+// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "j_wrap >"
 
 template 
 struct k {
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -313,7 +313,9 @@
   if (isa(RD)) {
 SmallString<128> Name;
 llvm::raw_svector_ostream OS(Name);
-RD->getNameForDiagnostic(OS, getPrintingPolicy(),
+PrintingPolicy PP = getPrintingPolicy();
+PP.PrintCanonicalTypes = true;
+RD->getNameForDiagnostic(OS, PP,
  /*Qualified*/ false);
 
 // Copy this name on the side and use its reference.
Index: lib/AST/TypePrinter.cpp
===
--- lib/AST/TypePrinter.cpp
+++ lib/AST/TypePrinter.cpp
@@ -1204,7 +1204,8 @@
   // arguments.
   if (const auto *Spec = dyn_cast(D)) {
 ArrayRef Args;
-if (TypeSourceInfo *TAW = Spec->getTypeAsWritten()) {
+TypeSourceInfo *TAW = Spec->getTypeAsWritten();
+if (!Policy.PrintCanonicalTypes && TAW) {
   const TemplateSpecializationType *TST =
 cast(TAW->getType());
   Args = TST->template_arguments();
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D60974: Clang IFSO driver action.

2019-06-07 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi updated this revision to Diff 203638.
plotfi added a comment.

-U99


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D60974

Files:
  clang/include/clang/Driver/Options.td
  clang/include/clang/Driver/Types.def
  clang/include/clang/Frontend/FrontendActions.h
  clang/include/clang/Frontend/FrontendOptions.h
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CMakeLists.txt
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
  clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
  clang/test/InterfaceStubs/bad-format.cpp
  clang/test/InterfaceStubs/class-template-specialization.cpp
  clang/test/InterfaceStubs/externstatic.c
  clang/test/InterfaceStubs/function-template-specialization.cpp
  clang/test/InterfaceStubs/hidden-class-inheritance.cpp
  clang/test/InterfaceStubs/inline.c
  clang/test/InterfaceStubs/inline.h
  clang/test/InterfaceStubs/object.cpp
  clang/test/InterfaceStubs/template-namespace-function.cpp
  clang/test/InterfaceStubs/virtual.cpp
  clang/test/InterfaceStubs/visibility.cpp
  clang/test/InterfaceStubs/weak.cpp

Index: clang/test/InterfaceStubs/weak.cpp
===
--- /dev/null
+++ clang/test/InterfaceStubs/weak.cpp
@@ -0,0 +1,27 @@
+// RUN: %clang -target x86_64-linux-gnu -o - -emit-interface-stubs \
+// RUN: -interface-stub-version=experimental-tapi-elf-v1 %s | \
+// RUN: FileCheck %s
+
+// RUN: %clang -target x86_64-linux-gnu -o - -emit-interface-stubs \
+// RUN: -interface-stub-version=experimental-yaml-elf-v1 %s | \
+// RUN: FileCheck --check-prefix=CHECK-YAML %s
+
+// RUN: %clang -target x86_64-unknown-linux-gnu -o - -c %s | llvm-nm - 2>&1 | \
+// RUN: FileCheck -check-prefix=CHECK-SYMBOLS %s
+
+// CHECK: Symbols:
+// CHECK-DAG:  _Z8weakFuncv: { Type: Func, Weak: true }
+// CHECK-DAG:  _Z10strongFuncv: { Type: Func }
+
+// CHECK-YAML: Symbols:
+// CHECK-YAML-DAG:   - Name:_Z8weakFuncv
+// CHECK-YAML-DAG: Type:STT_FUNC
+// CHECK-YAML-DAG: Binding: STB_WEAK
+// CHECK-YAML-DAG:   - Name:_Z10strongFuncv
+// CHECK-YAML-DAG: Type:STT_FUNC
+// CHECK-YAML-DAG: Binding: STB_GLOBAL
+
+// CHECK-SYMBOLS-DAG: _Z10strongFuncv
+// CHECK-SYMBOLS-DAG: _Z8weakFuncv
+__attribute__((weak)) void weakFunc() {}
+int strongFunc() { return 42; }
Index: clang/test/InterfaceStubs/visibility.cpp
===
--- /dev/null
+++ clang/test/InterfaceStubs/visibility.cpp
@@ -0,0 +1,35 @@
+// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
+// RUN: -interface-stub-version=experimental-tapi-elf-v1 -fvisibility=hidden \
+// RUN: %s | FileCheck --check-prefix=CHECK-CMD-HIDDEN %s
+
+// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
+// RUN: -interface-stub-version=experimental-yaml-elf-v1 -fvisibility=hidden \
+// RUN: %s | FileCheck --check-prefix=CHECK-CMD-HIDDEN %s
+
+// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
+// RUN: -interface-stub-version=experimental-tapi-elf-v1 %s | FileCheck %s
+
+// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
+// RUN: -interface-stub-version=experimental-yaml-elf-v1 %s | FileCheck %s
+
+// RUN: %clang -target x86_64-unknown-linux-gnu -o - -c %s | llvm-readelf -s - 2>&1 | \
+// RUN: FileCheck -check-prefix=CHECK-SYMBOLS %s
+
+// Always Be Hidden:
+// CHECK-CMD-HIDDEN-NOT: _Z6hiddenv
+// CHECK-NOT: _Z6hiddenv
+__attribute__((visibility("hidden"))) void hidden() {}
+
+// Always Be Visible:
+// CHECK-CMD-HIDDEN: _Z9nothiddenv
+// CHECK-DAG: _Z9nothiddenv
+__attribute__((visibility("default"))) void nothidden() {}
+
+// Do Whatever -fvisibility says:
+// CHECK-CMD-HIDDEN-NOT: _Z10cmdVisiblev
+// CHECK-DAG: _Z10cmdVisiblev
+void cmdVisible() {}
+
+// CHECK-SYMBOLS-DAG: DEFAULT{{.*}} _Z10cmdVisiblev
+// CHECK-SYMBOLS-DAG: HIDDEN {{.*}} _Z6hiddenv
+// CHECK-SYMBOLS-DAG: DEFAULT{{.*}} _Z9nothiddenv
Index: clang/test/InterfaceStubs/virtual.cpp
===
--- /dev/null
+++ clang/test/InterfaceStubs/virtual.cpp
@@ -0,0 +1,38 @@
+// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
+// RUN: -interface-stub-version=experimental-tapi-elf-v1 %s | \
+// RUN: FileCheck -check-prefix=CHECK-TAPI %s
+// RUN: %clang -target x86_64-unknown-linux-gnu -o - -c %s | \
+// RUN: llvm-readelf -s - 2>&1 | FileCheck -check-prefix=CHECK-SYMBOLS %s
+
+#define HIDDEN  __attribute__((__visibility__(("hidden"
+#define DEFAULT __attribute__((__visibility__(("default"
+
+// CHECK-TAPI-NOT: _ZNK1Q5func1Ev
+// CHECK-TAPI-NOT: _ZNK1Q5func2Ev
+// CHECK-SYMBOLS-DAG: NOTYPE  GLOBAL HIDDEN   {{.*}} _ZNK1Q5func1Ev
+// CHECK-SYMBOLS-DAG: NOTYPE  GLOBAL 

[PATCH] D62926: [analyzer] ReturnVisitor: Bypass constructing objects to see inlined calls

2019-06-07 Thread Csaba Dabis via Phabricator via cfe-commits
Charusso added a comment.

In D62926#1533560 , @NoQ wrote:

> I'd like to have a test in which the constructor is //inlined//.


What do you mean by that test?


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

https://reviews.llvm.org/D62926



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


[PATCH] D62926: [analyzer] ReturnVisitor: Bypass constructing objects to see inlined calls

2019-06-07 Thread Csaba Dabis via Phabricator via cfe-commits
Charusso updated this revision to Diff 203635.
Charusso marked 2 inline comments as done.
Charusso added a comment.

- Added `CallExpr` as being purged away
- More test


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

https://reviews.llvm.org/D62926

Files:
  clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
  clang/test/Analysis/new-ctor-null-throw.cpp
  clang/test/Analysis/new-ctor-null.cpp

Index: clang/test/Analysis/new-ctor-null.cpp
===
--- clang/test/Analysis/new-ctor-null.cpp
+++ clang/test/Analysis/new-ctor-null.cpp
@@ -1,4 +1,6 @@
-// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -analyzer-config c++-allocator-inlining=true -std=c++11 -verify %s
+// RUN: %clang_analyze_cc1 \
+// RUN:  -analyzer-checker=core,debug.ExprInspection \
+// RUN:  -std=c++11 -verify %s
 
 void clang_analyzer_eval(bool);
 void clang_analyzer_warnIfReached();
@@ -24,7 +26,8 @@
 
 void testArrays() {
   S *s = new S[10]; // no-crash
-  s[0].x = 2; // expected-warning{{Dereference of null pointer}}
+  s[0].x = 2;
+  // no-warning: 'Dereference of null pointer' suppressed by ReturnVisitor.
 }
 
 int global;
Index: clang/test/Analysis/new-ctor-null-throw.cpp
===
--- clang/test/Analysis/new-ctor-null-throw.cpp
+++ clang/test/Analysis/new-ctor-null-throw.cpp
@@ -1,4 +1,9 @@
-// RUN: %clang_analyze_cc1 -w -analyzer-checker=core,debug.ExprInspection -analyzer-config c++-allocator-inlining=true -std=c++11 -verify %s
+// RUN: %clang_analyze_cc1 -analyzer-checker=core \
+// RUN:  -analyzer-config suppress-null-return-paths=false \
+// RUN:  -std=c++11 -verify %s
+// RUN: %clang_analyze_cc1 -analyzer-checker=core \
+// RUN:  -DSUPPRESSED=1 \
+// RUN:  -verify %s
 
 void clang_analyzer_eval(bool);
 
@@ -9,18 +14,41 @@
 // operator new.
 void *operator new(size_t size) {
   return nullptr;
+  // expected-warning@-1 {{'operator new' should not return a null pointer unless it is declared 'throw()' or 'noexcept'}}
 }
 void *operator new[](size_t size) {
   return nullptr;
+  // expected-warning@-1 {{'operator new[]' should not return a null pointer unless it is declared 'throw()' or 'noexcept'}}
 }
 
 struct S {
   int x;
   S() : x(1) {}
   ~S() {}
+  int getX() const { return x; }
 };
 
 void testArrays() {
   S *s = new S[10]; // no-crash
-  s[0].x = 2; // expected-warning{{Dereference of null pointer}}
+  s[0].x = 2;
+#ifndef SUPPRESSED
+  // expected-warning@-2 {{Dereference of null pointer}}
+#endif
 }
+
+void testCtor() {
+  S *s = new S();
+  s->x = 13;
+#ifndef SUPPRESSED
+  // expected-warning@-2 {{Access to field 'x' results in a dereference of a null pointer (loaded from variable 's')}}
+#endif
+}
+
+void testMethod() {
+  S *s = new S();
+  const int X = s->getX();
+#ifndef SUPPRESSED
+  // expected-warning@-2 {{Called C++ object pointer is null}}
+#endif
+}
+
Index: clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
===
--- clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -833,13 +833,20 @@
   return;
 
 // First, find when we processed the statement.
+// If we have one of the following cases that is going to be purged away
+// before its call take place. We would catch that purge in the second
+// condition as a 'StmtPoint' so we have to bypass it.
+const bool IsBypass =
+isa(S) || isa(S) || isa(S);
 do {
-  if (auto CEE = Node->getLocationAs())
+  if (Optional CEE = Node->getLocationAs())
 if (CEE->getCalleeContext()->getCallSite() == S)
   break;
-  if (auto SP = Node->getLocationAs())
-if (SP->getStmt() == S)
-  break;
+
+  if (!IsBypass)
+if (Optional SP = Node->getLocationAs())
+  if (SP->getStmt() == S)
+break;
 
   Node = Node->getFirstPred();
 } while (Node);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D63030: [WebAssembly] Modernize include path handling

2019-06-07 Thread Sam Clegg via Phabricator via cfe-commits
sbc100 updated this revision to Diff 203634.
sbc100 added a comment.

- more OS


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63030

Files:
  clang/lib/Driver/ToolChains/WebAssembly.cpp
  clang/lib/Frontend/InitHeaderSearch.cpp


Index: clang/lib/Frontend/InitHeaderSearch.cpp
===
--- clang/lib/Frontend/InitHeaderSearch.cpp
+++ clang/lib/Frontend/InitHeaderSearch.cpp
@@ -414,9 +414,11 @@
   default:
 break; // Everything else continues to use this routine's logic.
 
+  case llvm::Triple::Emscripten:
   case llvm::Triple::Linux:
   case llvm::Triple::Hurd:
   case llvm::Triple::Solaris:
+  case llvm::Triple::WASI:
 return;
 
   case llvm::Triple::Win32:
@@ -424,6 +426,12 @@
 triple.isOSBinFormatMachO())
   return;
 break;
+
+  case llvm::Triple::UnknownOS:
+if (triple.getArch() == llvm::Triple::wasm32 ||
+triple.getArch() == llvm::Triple::wasm64)
+  return;
+break;
   }
 
   // All header search logic is handled in the Driver for Darwin.
Index: clang/lib/Driver/ToolChains/WebAssembly.cpp
===
--- clang/lib/Driver/ToolChains/WebAssembly.cpp
+++ clang/lib/Driver/ToolChains/WebAssembly.cpp
@@ -8,6 +8,7 @@
 
 #include "WebAssembly.h"
 #include "CommonArgs.h"
+#include "clang/Config/config.h"
 #include "clang/Driver/Compilation.h"
 #include "clang/Driver/Driver.h"
 #include "clang/Driver/DriverDiagnostic.h"
@@ -170,14 +171,39 @@
 
 void WebAssembly::AddClangSystemIncludeArgs(const ArgList ,
 ArgStringList ) const {
-  if (!DriverArgs.hasArg(options::OPT_nostdinc)) {
-if (getTriple().getOS() != llvm::Triple::UnknownOS) {
-  const std::string MultiarchTriple =
-  getMultiarchTriple(getDriver(), getTriple(), getDriver().SysRoot);
-  addSystemInclude(DriverArgs, CC1Args, getDriver().SysRoot + "/include/" 
+ MultiarchTriple);
+  if (DriverArgs.hasArg(clang::driver::options::OPT_nostdinc))
+return;
+
+  const Driver  = getDriver();
+
+  if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
+SmallString<128> P(D.ResourceDir);
+llvm::sys::path::append(P, "include");
+addSystemInclude(DriverArgs, CC1Args, P);
+  }
+
+  if (DriverArgs.hasArg(options::OPT_nostdlibinc))
+return;
+
+  // Check for configure-time C include directories.
+  StringRef CIncludeDirs(C_INCLUDE_DIRS);
+  if (CIncludeDirs != "") {
+SmallVector dirs;
+CIncludeDirs.split(dirs, ":");
+for (StringRef dir : dirs) {
+  StringRef Prefix =
+  llvm::sys::path::is_absolute(dir) ? StringRef(D.SysRoot) : "";
+  addExternCSystemInclude(DriverArgs, CC1Args, Prefix + dir);
 }
-addSystemInclude(DriverArgs, CC1Args, getDriver().SysRoot + "/include");
+return;
+  }
+
+  if (getTriple().getOS() != llvm::Triple::UnknownOS) {
+const std::string MultiarchTriple =
+getMultiarchTriple(D, getTriple(), D.SysRoot);
+addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/include/" + 
MultiarchTriple);
   }
+  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/include");
 }
 
 void WebAssembly::AddClangCXXStdlibIncludeArgs(const ArgList ,
@@ -188,7 +214,8 @@
   const std::string MultiarchTriple =
   getMultiarchTriple(getDriver(), getTriple(), getDriver().SysRoot);
   addSystemInclude(DriverArgs, CC1Args,
-   getDriver().SysRoot + "/include/" + MultiarchTriple + 
"/c++/v1");
+   getDriver().SysRoot + "/include/" + MultiarchTriple +
+   "/c++/v1");
 }
 addSystemInclude(DriverArgs, CC1Args,
  getDriver().SysRoot + "/include/c++/v1");


Index: clang/lib/Frontend/InitHeaderSearch.cpp
===
--- clang/lib/Frontend/InitHeaderSearch.cpp
+++ clang/lib/Frontend/InitHeaderSearch.cpp
@@ -414,9 +414,11 @@
   default:
 break; // Everything else continues to use this routine's logic.
 
+  case llvm::Triple::Emscripten:
   case llvm::Triple::Linux:
   case llvm::Triple::Hurd:
   case llvm::Triple::Solaris:
+  case llvm::Triple::WASI:
 return;
 
   case llvm::Triple::Win32:
@@ -424,6 +426,12 @@
 triple.isOSBinFormatMachO())
   return;
 break;
+
+  case llvm::Triple::UnknownOS:
+if (triple.getArch() == llvm::Triple::wasm32 ||
+triple.getArch() == llvm::Triple::wasm64)
+  return;
+break;
   }
 
   // All header search logic is handled in the Driver for Darwin.
Index: clang/lib/Driver/ToolChains/WebAssembly.cpp
===
--- clang/lib/Driver/ToolChains/WebAssembly.cpp
+++ clang/lib/Driver/ToolChains/WebAssembly.cpp
@@ -8,6 +8,7 @@
 
 #include "WebAssembly.h"
 #include "CommonArgs.h"
+#include "clang/Config/config.h"
 #include 

[PATCH] D63030: [WebAssembly] Modernize include path handling

2019-06-07 Thread Sam Clegg via Phabricator via cfe-commits
sbc100 created this revision.
Herald added subscribers: cfe-commits, sunfish, aheejin, jgravelle-google, 
dschuff.
Herald added a project: clang.

Move include path construction from
InitHeaderSearch::AddDefaultIncludePaths in the Driver which appears
to be the more modern/correct way of doing things.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D63030

Files:
  clang/lib/Driver/ToolChains/WebAssembly.cpp
  clang/lib/Frontend/InitHeaderSearch.cpp


Index: clang/lib/Frontend/InitHeaderSearch.cpp
===
--- clang/lib/Frontend/InitHeaderSearch.cpp
+++ clang/lib/Frontend/InitHeaderSearch.cpp
@@ -424,6 +424,12 @@
 triple.isOSBinFormatMachO())
   return;
 break;
+
+  case llvm::Triple::UnknownOS:
+if (triple.getArch() == llvm::Triple::wasm32 ||
+triple.getArch() == llvm::Triple::wasm64)
+  return;
+break;
   }
 
   // All header search logic is handled in the Driver for Darwin.
Index: clang/lib/Driver/ToolChains/WebAssembly.cpp
===
--- clang/lib/Driver/ToolChains/WebAssembly.cpp
+++ clang/lib/Driver/ToolChains/WebAssembly.cpp
@@ -8,6 +8,7 @@
 
 #include "WebAssembly.h"
 #include "CommonArgs.h"
+#include "clang/Config/config.h"
 #include "clang/Driver/Compilation.h"
 #include "clang/Driver/Driver.h"
 #include "clang/Driver/DriverDiagnostic.h"
@@ -170,14 +171,39 @@
 
 void WebAssembly::AddClangSystemIncludeArgs(const ArgList ,
 ArgStringList ) const {
-  if (!DriverArgs.hasArg(options::OPT_nostdinc)) {
-if (getTriple().getOS() != llvm::Triple::UnknownOS) {
-  const std::string MultiarchTriple =
-  getMultiarchTriple(getDriver(), getTriple(), getDriver().SysRoot);
-  addSystemInclude(DriverArgs, CC1Args, getDriver().SysRoot + "/include/" 
+ MultiarchTriple);
+  if (DriverArgs.hasArg(clang::driver::options::OPT_nostdinc))
+return;
+
+  const Driver  = getDriver();
+
+  if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
+SmallString<128> P(D.ResourceDir);
+llvm::sys::path::append(P, "include");
+addSystemInclude(DriverArgs, CC1Args, P);
+  }
+
+  if (DriverArgs.hasArg(options::OPT_nostdlibinc))
+return;
+
+  // Check for configure-time C include directories.
+  StringRef CIncludeDirs(C_INCLUDE_DIRS);
+  if (CIncludeDirs != "") {
+SmallVector dirs;
+CIncludeDirs.split(dirs, ":");
+for (StringRef dir : dirs) {
+  StringRef Prefix =
+  llvm::sys::path::is_absolute(dir) ? StringRef(D.SysRoot) : "";
+  addExternCSystemInclude(DriverArgs, CC1Args, Prefix + dir);
 }
-addSystemInclude(DriverArgs, CC1Args, getDriver().SysRoot + "/include");
+return;
+  }
+
+  if (getTriple().getOS() != llvm::Triple::UnknownOS) {
+const std::string MultiarchTriple =
+getMultiarchTriple(D, getTriple(), D.SysRoot);
+addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/include/" + 
MultiarchTriple);
   }
+  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/include");
 }
 
 void WebAssembly::AddClangCXXStdlibIncludeArgs(const ArgList ,
@@ -188,7 +214,8 @@
   const std::string MultiarchTriple =
   getMultiarchTriple(getDriver(), getTriple(), getDriver().SysRoot);
   addSystemInclude(DriverArgs, CC1Args,
-   getDriver().SysRoot + "/include/" + MultiarchTriple + 
"/c++/v1");
+   getDriver().SysRoot + "/include/" + MultiarchTriple +
+   "/c++/v1");
 }
 addSystemInclude(DriverArgs, CC1Args,
  getDriver().SysRoot + "/include/c++/v1");


Index: clang/lib/Frontend/InitHeaderSearch.cpp
===
--- clang/lib/Frontend/InitHeaderSearch.cpp
+++ clang/lib/Frontend/InitHeaderSearch.cpp
@@ -424,6 +424,12 @@
 triple.isOSBinFormatMachO())
   return;
 break;
+
+  case llvm::Triple::UnknownOS:
+if (triple.getArch() == llvm::Triple::wasm32 ||
+triple.getArch() == llvm::Triple::wasm64)
+  return;
+break;
   }
 
   // All header search logic is handled in the Driver for Darwin.
Index: clang/lib/Driver/ToolChains/WebAssembly.cpp
===
--- clang/lib/Driver/ToolChains/WebAssembly.cpp
+++ clang/lib/Driver/ToolChains/WebAssembly.cpp
@@ -8,6 +8,7 @@
 
 #include "WebAssembly.h"
 #include "CommonArgs.h"
+#include "clang/Config/config.h"
 #include "clang/Driver/Compilation.h"
 #include "clang/Driver/Driver.h"
 #include "clang/Driver/DriverDiagnostic.h"
@@ -170,14 +171,39 @@
 
 void WebAssembly::AddClangSystemIncludeArgs(const ArgList ,
 ArgStringList ) const {
-  if (!DriverArgs.hasArg(options::OPT_nostdinc)) {
-if (getTriple().getOS() != llvm::Triple::UnknownOS) {
-  const std::string MultiarchTriple =
-  getMultiarchTriple(getDriver(), 

[PATCH] D63029: [NFC][CUDA] Avoid undefined grep in cuda-types.cu

2019-06-07 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added inline comments.



Comment at: test/Preprocessor/cuda-types.cu:11
 // RUN: %clang --cuda-host-only -nocudainc -target i386-unknown-linux-gnu -x 
cuda -E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > %t/i386-host-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF\|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > %t/i386-host-defines-filtered

tra wrote:
> I believe that was a typo in the original test. It should be 
> `TYPE|MAX|SIZEOF|WIDTH` now.
> `SIZEOF` and `WIDTH` are parts of different defines we're looking for.
> 
> E.g
> ```
> #define __SIZEOF_DOUBLE__ 8
> ...
> #define __INTPTR_WIDTH__ 32
> 
> ```
I can give that a try. I'll update on the status of whether the test passes 
once `SIZEOF` and `WIDTH` is actually tested.


Repository:
  rC Clang

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

https://reviews.llvm.org/D63029



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


[PATCH] D63029: [NFC][CUDA] Avoid undefined grep in cuda-types.cu

2019-06-07 Thread Artem Belevich via Phabricator via cfe-commits
tra added inline comments.



Comment at: test/Preprocessor/cuda-types.cu:11
 // RUN: %clang --cuda-host-only -nocudainc -target i386-unknown-linux-gnu -x 
cuda -E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > %t/i386-host-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF\|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > %t/i386-host-defines-filtered

I believe that was a typo in the original test. It should be 
`TYPE|MAX|SIZEOF|WIDTH` now.
`SIZEOF` and `WIDTH` are parts of different defines we're looking for.

E.g
```
#define __SIZEOF_DOUBLE__ 8
...
#define __INTPTR_WIDTH__ 32

```


Repository:
  rC Clang

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

https://reviews.llvm.org/D63029



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


[PATCH] D63029: [NFC][CUDA] Avoid undefined grep in cuda-types.cu

2019-06-07 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast created this revision.
hubert.reinterpretcast added reviewers: jlebar, daltenty, xingxue, jasonliu.
Herald added subscribers: jsji, jfb.
Herald added a project: clang.

vertical-line is not a BRE special character.

POSIX.1-2017 XBD Section 9.3.2 indicates that the interpretation of `\|` is 
undefined. This patch uses EREs instead.

Note that this patch keeps the property that `SIZEOF` and `WIDTH` are 
considered uninteresting except when appearing in `SIZEOF|WIDTH`.


Repository:
  rC Clang

https://reviews.llvm.org/D63029

Files:
  test/Preprocessor/cuda-types.cu


Index: test/Preprocessor/cuda-types.cu
===
--- test/Preprocessor/cuda-types.cu
+++ test/Preprocessor/cuda-types.cu
@@ -8,41 +8,41 @@
 // RUN: mkdir -p %t
 
 // RUN: %clang --cuda-host-only -nocudainc -target i386-unknown-linux-gnu -x 
cuda -E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > %t/i386-host-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF\|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > %t/i386-host-defines-filtered
 // RUN: %clang --cuda-device-only -nocudainc -nocudalib -target 
i386-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > %t/i386-device-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF\|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > %t/i386-device-defines-filtered
 // RUN: diff %t/i386-host-defines-filtered %t/i386-device-defines-filtered
 
 // RUN: %clang --cuda-host-only -nocudainc -target x86_64-unknown-linux-gnu -x 
cuda -E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > %t/x86_64-host-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF\|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > %t/x86_64-host-defines-filtered
 // RUN: %clang --cuda-device-only -nocudainc -nocudalib -target 
x86_64-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > %t/x86_64-device-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF\|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > %t/x86_64-device-defines-filtered
 // RUN: diff %t/x86_64-host-defines-filtered %t/x86_64-device-defines-filtered
 
 // RUN: %clang --cuda-host-only -nocudainc -target powerpc64-unknown-linux-gnu 
-x cuda -E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > %t/powerpc64-host-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF\|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > %t/powerpc64-host-defines-filtered
 // RUN: %clang --cuda-device-only -nocudainc -nocudalib -target 
powerpc64-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > 
%t/powerpc64-device-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF\|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > 
%t/powerpc64-device-defines-filtered
 // RUN: diff %t/powerpc64-host-defines-filtered 
%t/powerpc64-device-defines-filtered
 
 // RUN: %clang --cuda-host-only -nocudainc -target i386-windows-msvc -x cuda 
-E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > %t/i386-msvc-host-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF\|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > %t/i386-msvc-host-defines-filtered
 // RUN: %clang --cuda-device-only -nocudainc -nocudalib -target 
i386-windows-msvc -x cuda -E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > 
%t/i386-msvc-device-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF\|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > 
%t/i386-msvc-device-defines-filtered
 // RUN: diff %t/i386-msvc-host-defines-filtered 
%t/i386-msvc-device-defines-filtered
 
 // RUN: %clang --cuda-host-only -nocudainc -target x86_64-windows-msvc -x cuda 
-E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > 

[PATCH] D61914: [Support][Test] Time profiler: add regression test

2019-06-07 Thread Anton Afanasyev via Phabricator via cfe-commits
anton-afanasyev marked an inline comment as done.
anton-afanasyev added a comment.

In D61914#1534508 , @plotfi wrote:

> cfe/trunk/test/Driver/check-time-trace.cpp appears to fail on Darwin. Did you 
> mean to pass the target explicitly ?


This commit is reverted now. How can I pass the target explicitly?




Comment at: cfe/trunk/test/Driver/check-time-trace.cpp:1
+// RUN: %clangxx -ftime-trace %s 2>&1 | grep "Time trace json-file dumped to" \
+// RUN:   | awk '{print $NF}' | xargs cat \

plotfi wrote:
> This test should probably have // REQUIRES: shell
Thanks! I haven't found `REQUIRES: shell` here: 
`https://llvm.org/docs/CommandGuide/FileCheck.html`. Does this directive mean 
the target OS must have utils like `awk` and `xargs`?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D61914



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


[PATCH] D62885: [analyzer] Add werror flag for analyzer warnings

2019-06-07 Thread KristĂłf Umann via Phabricator via cfe-commits
Szelethus accepted this revision.
Szelethus added a comment.






Comment at: include/clang/Driver/CC1Options.td:170
+def analyzer_werror : Flag<["-"], "analyzer-werror">,
+  HelpText<"Emit analyzer results as errors, not warnings">;
+

how about "rather than warnings"?



Comment at: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:86
   DiagnosticsEngine 
-  bool IncludePath;
+  bool IncludePath, Werror;
+

I personally dislike boolean variable names that do not start with "is", "has", 
"should", "was" etc.



Comment at: test/Analysis/override-werror.c:10
+  return p; // expected-warning{{incompatible pointer types}} \
+   werror-warning{{incompatible pointer types}}
 }

loladiro wrote:
> Szelethus wrote:
> > Why isn't this `werror-error`?
> Unlike the other error (which is generated by the analyzer), this is a 
> semantic error (i.e. would get emitted even in the absence of the analyzer). 
> The `-analyzer-werror` flag only touches those warnings generated by the 
> analyzer, so this is the desired behavior.
Ah okay :)


Repository:
  rC Clang

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

https://reviews.llvm.org/D62885



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


[PATCH] D60974: Clang IFSO driver action.

2019-06-07 Thread Jordan Rupprecht via Phabricator via cfe-commits
rupprecht added a reviewer: rupprecht.
rupprecht added a comment.

Can you upload this patch with context? Either use arc or upload w/ -U9

I seem to have a lot of comments, but they're all nits -- my major concern 
being the `llvm_unreachable`s should be errors instead (i.e. should be 
triggered in release builds).

Since this is clearly labeled as experimental, I think you should feel free to 
commit if you can get another lgtm (@compnerd?)




Comment at: clang/lib/Driver/ToolChains/Clang.cpp:3614-3616
+  Args.hasArg(options::OPT_iterface_stub_version_EQ)
+  ? Args.getLastArgValue(options::OPT_iterface_stub_version_EQ)
+  : "")

`Args.getLastArgValue(options::OPT_iterface_stub_version_EQ)` should already 
default to returning the empty string if unset (note the default param)



Comment at: clang/lib/Frontend/CompilerInvocation.cpp:1678-1680
+  Args.hasArg(OPT_iterface_stub_version_EQ)
+  ? Args.getLastArgValue(OPT_iterface_stub_version_EQ)
+  : "")

(same here)



Comment at: clang/lib/Frontend/CompilerInvocation.cpp:1688
+  if (!ProgramActionPair.second)
+llvm_unreachable("Must specify a valid interface stub format.");
+  Opts.ProgramAction = ProgramActionPair.first;

I think this is very much reachable if someone provides 
`--interface-stub-version=x`



Comment at: clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp:20-21
+  CompilerInstance 
+  StringRef InFile = "";
+  StringRef Format = "";
+  std::set ParsedTemplates;

nit: these default initializations are redundant



Comment at: clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp:26
+  struct MangledSymbol {
+std::string ParentName = "";
+uint8_t Type;

ditto



Comment at: clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp:39-41
+if (!(RDO & FromTU))
+  return true;
+if (Symbols.find(ND) != Symbols.end())

Can you add a comment why these two are excluded?



Comment at: clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp:41
+  return true;
+if (Symbols.find(ND) != Symbols.end())
+  return true;

llvm::is_contained(Symbols, ND)



Comment at: clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp:44-47
+if (isa(ND))
+  return true;
+if (isa(ND))
+  return true;

This would be terser (and more readable) combined; `if (isa(ND) || 
isa(ND))`



Comment at: clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp:95
+  index::CodegenNameGenerator CGNameGen(ND->getASTContext());
+  auto MangledNames = CGNameGen.getAllManglings(ND);
+  if (MangledNames.size() == 1)

auto -> std::vector, unless the return type is obvious to anyone 
that commits here (i.e. not me)



Comment at: clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp:107
+  index::CodegenNameGenerator CGNameGen(ND->getASTContext());
+  auto MangledName = CGNameGen.getName(ND);
+  auto MangledNames = CGNameGen.getAllManglings(ND);

auto -> std::string



Comment at: clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp:206-207
+// catch anything that's not a VarDecl or Template/FunctionDecl.
+llvm_unreachable("clang -emit-iterface-stubs: Expected a function or "
+ "function template decl.");
+return false;

This should be an error, not llvm_unreachable (which I think gets filtered out 
in release builds)



Comment at: clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp:242
+MangledSymbols Symbols;
+auto OS = Instance.createDefaultOutputFile(/*Binary=*/false, InFile, 
"ifo");
+if (!OS)

elsewhere it looks like this was changed to "ifs"?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D60974



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


r362836 - Relax test so that the clang binary doesn't need to be named "clang".

2019-06-07 Thread Peter Collingbourne via cfe-commits
Author: pcc
Date: Fri Jun  7 13:26:47 2019
New Revision: 362836

URL: http://llvm.org/viewvc/llvm-project?rev=362836=rev
Log:
Relax test so that the clang binary doesn't need to be named "clang".

Modified:
cfe/trunk/test/Driver/symbol-partition.c

Modified: cfe/trunk/test/Driver/symbol-partition.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/symbol-partition.c?rev=362836=362835=362836=diff
==
--- cfe/trunk/test/Driver/symbol-partition.c (original)
+++ cfe/trunk/test/Driver/symbol-partition.c Fri Jun  7 13:26:47 2019
@@ -2,4 +2,4 @@
 // RUN: %clang -### -target x86_64-pc-win32 -c -fsymbol-partition=foo %s 2>&1 
| FileCheck --check-prefix=ERROR %s
 
 // CHECK: "-fsymbol-partition=foo"
-// ERROR: clang: error: unsupported option '-fsymbol-partition=foo' for target 
'x86_64-pc-windows-msvc'
+// ERROR: error: unsupported option '-fsymbol-partition=foo' for target 
'x86_64-pc-windows-msvc'


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


[PATCH] D63018: [X86] Attempt to make the Intel core CPU inheritance a little more readable and maintainable

2019-06-07 Thread Craig Topper via Phabricator via cfe-commits
craig.topper updated this revision to Diff 203597.
craig.topper added a comment.

Fix mistake in a comment


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

https://reviews.llvm.org/D63018

Files:
  clang/lib/Basic/Targets/X86.cpp


Index: clang/lib/Basic/Targets/X86.cpp
===
--- clang/lib/Basic/Targets/X86.cpp
+++ clang/lib/Basic/Targets/X86.cpp
@@ -138,6 +138,24 @@
 setFeatureEnabledImpl(Features, "mmx", true);
 break;
 
+  case CK_Cooperlake:
+// CPX inherits all CLX features plus AVX512BF16
+setFeatureEnabledImpl(Features, "avx512bf16", true);
+LLVM_FALLTHROUGH;
+  case CK_Cascadelake:
+// CLX inherits all SKX features plus AVX512VNNI
+setFeatureEnabledImpl(Features, "avx512vnni", true);
+LLVM_FALLTHROUGH;
+  case CK_SkylakeServer:
+setFeatureEnabledImpl(Features, "avx512f", true);
+setFeatureEnabledImpl(Features, "avx512cd", true);
+setFeatureEnabledImpl(Features, "avx512dq", true);
+setFeatureEnabledImpl(Features, "avx512bw", true);
+setFeatureEnabledImpl(Features, "avx512vl", true);
+setFeatureEnabledImpl(Features, "clwb", true);
+setFeatureEnabledImpl(Features, "pku", true);
+goto SkylakeCommon;
+
   case CK_IcelakeServer:
 setFeatureEnabledImpl(Features, "pconfig", true);
 setFeatureEnabledImpl(Features, "wbnoinvd", true);
@@ -148,45 +166,29 @@
 setFeatureEnabledImpl(Features, "vpclmulqdq", true);
 setFeatureEnabledImpl(Features, "avx512bitalg", true);
 setFeatureEnabledImpl(Features, "avx512vbmi2", true);
+setFeatureEnabledImpl(Features, "avx512vnni", true);
 setFeatureEnabledImpl(Features, "avx512vpopcntdq", true);
 setFeatureEnabledImpl(Features, "rdpid", true);
+setFeatureEnabledImpl(Features, "clwb", true);
 LLVM_FALLTHROUGH;
   case CK_Cannonlake:
-setFeatureEnabledImpl(Features, "avx512ifma", true);
-setFeatureEnabledImpl(Features, "avx512vbmi", true);
-setFeatureEnabledImpl(Features, "sha", true);
-LLVM_FALLTHROUGH;
-  case CK_Cooperlake:
-// Cannonlake, IcelakeClient and IcelakeServer have no AVX512BF16 feature
-if (Kind != CK_Cannonlake && Kind != CK_IcelakeClient &&
-Kind != CK_IcelakeServer)
-  // CPX inherits all CLX features plus AVX512BF16
-  setFeatureEnabledImpl(Features, "avx512bf16", true);
-LLVM_FALLTHROUGH;
-  case CK_Cascadelake:
-//Cannonlake has no VNNI feature inside while Icelake has
-if (Kind != CK_Cannonlake)
-  // CLK inherits all SKX features plus AVX512_VNNI
-  setFeatureEnabledImpl(Features, "avx512vnni", true);
-LLVM_FALLTHROUGH;
-  case CK_SkylakeServer:
 setFeatureEnabledImpl(Features, "avx512f", true);
 setFeatureEnabledImpl(Features, "avx512cd", true);
 setFeatureEnabledImpl(Features, "avx512dq", true);
 setFeatureEnabledImpl(Features, "avx512bw", true);
 setFeatureEnabledImpl(Features, "avx512vl", true);
+setFeatureEnabledImpl(Features, "avx512ifma", true);
+setFeatureEnabledImpl(Features, "avx512vbmi", true);
 setFeatureEnabledImpl(Features, "pku", true);
-if (Kind != CK_Cannonlake) // CNL inherits all SKX features, except CLWB
-  setFeatureEnabledImpl(Features, "clwb", true);
+setFeatureEnabledImpl(Features, "sha", true);
 LLVM_FALLTHROUGH;
   case CK_SkylakeClient:
+setFeatureEnabledImpl(Features, "sgx", true);
+// SkylakeServer cores inherits all SKL features, except SGX
+SkylakeCommon:
 setFeatureEnabledImpl(Features, "xsavec", true);
 setFeatureEnabledImpl(Features, "xsaves", true);
 setFeatureEnabledImpl(Features, "mpx", true);
-if (Kind != CK_SkylakeServer && Kind != CK_Cascadelake &&
-Kind != CK_Cooperlake)
-  // SKX/CLX/CPX inherits all SKL features, except SGX
-  setFeatureEnabledImpl(Features, "sgx", true);
 setFeatureEnabledImpl(Features, "clflushopt", true);
 setFeatureEnabledImpl(Features, "aes", true);
 LLVM_FALLTHROUGH;


Index: clang/lib/Basic/Targets/X86.cpp
===
--- clang/lib/Basic/Targets/X86.cpp
+++ clang/lib/Basic/Targets/X86.cpp
@@ -138,6 +138,24 @@
 setFeatureEnabledImpl(Features, "mmx", true);
 break;
 
+  case CK_Cooperlake:
+// CPX inherits all CLX features plus AVX512BF16
+setFeatureEnabledImpl(Features, "avx512bf16", true);
+LLVM_FALLTHROUGH;
+  case CK_Cascadelake:
+// CLX inherits all SKX features plus AVX512VNNI
+setFeatureEnabledImpl(Features, "avx512vnni", true);
+LLVM_FALLTHROUGH;
+  case CK_SkylakeServer:
+setFeatureEnabledImpl(Features, "avx512f", true);
+setFeatureEnabledImpl(Features, "avx512cd", true);
+setFeatureEnabledImpl(Features, "avx512dq", true);
+setFeatureEnabledImpl(Features, "avx512bw", true);
+setFeatureEnabledImpl(Features, "avx512vl", true);
+setFeatureEnabledImpl(Features, "clwb", true);
+setFeatureEnabledImpl(Features, "pku", true);
+

[PATCH] D62962: Clang implementation of sizeless types

2019-06-07 Thread JF Bastien via Phabricator via cfe-commits
jfb added a comment.

How do these types mangle?




Comment at: test/Sema/sizeless-1.c:60
+  (void)__atomic_is_lock_free(1, _int8);
+  (void)__atomic_always_lock_free(1, _int8);
+

What do you expect these to return?


Repository:
  rC Clang

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

https://reviews.llvm.org/D62962



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


[PATCH] D63020: [HIP] Fix visibility for 'extern' device variables.

2019-06-07 Thread Michael Liao via Phabricator via cfe-commits
hliao created this revision.
hliao added a reviewer: yaxunl.
Herald added subscribers: cfe-commits, nhaehnle, jvesely.
Herald added a project: clang.

- Fix a bug which misses the change for a variable to be set with 
target-specific attributes.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D63020

Files:
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/test/CodeGenCUDA/amdgpu-visibility.cu


Index: clang/test/CodeGenCUDA/amdgpu-visibility.cu
===
--- clang/test/CodeGenCUDA/amdgpu-visibility.cu
+++ clang/test/CodeGenCUDA/amdgpu-visibility.cu
@@ -13,6 +13,16 @@
 __constant__ int c;
 __device__ int g;
 
+// CHECK-DEFAULT: @e = external addrspace(1) global
+// CHECK-PROTECTED: @e = external protected addrspace(1) global
+// CHECK-HIDDEN: @e = external protected addrspace(1) global
+extern __device__ int e;
+
+// dummy one to hold reference to `e`.
+__device__ int f() {
+  return e;
+}
+
 // CHECK-DEFAULT: define amdgpu_kernel void @_Z3foov()
 // CHECK-PROTECTED: define protected amdgpu_kernel void @_Z3foov()
 // CHECK-HIDDEN: define protected amdgpu_kernel void @_Z3foov()
Index: clang/lib/CodeGen/CodeGenModule.cpp
===
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -3464,6 +3464,9 @@
 }
   }
 
+  if (GV->isDeclaration())
+getTargetCodeGenInfo().setTargetAttributes(D, GV, *this);
+
   LangAS ExpectedAS =
   D ? D->getType().getAddressSpace()
 : (LangOpts.OpenCL ? LangAS::opencl_global : LangAS::Default);
@@ -3473,9 +3476,6 @@
 return getTargetCodeGenInfo().performAddrSpaceCast(*this, GV, AddrSpace,
ExpectedAS, Ty);
 
-  if (GV->isDeclaration())
-getTargetCodeGenInfo().setTargetAttributes(D, GV, *this);
-
   return GV;
 }
 


Index: clang/test/CodeGenCUDA/amdgpu-visibility.cu
===
--- clang/test/CodeGenCUDA/amdgpu-visibility.cu
+++ clang/test/CodeGenCUDA/amdgpu-visibility.cu
@@ -13,6 +13,16 @@
 __constant__ int c;
 __device__ int g;
 
+// CHECK-DEFAULT: @e = external addrspace(1) global
+// CHECK-PROTECTED: @e = external protected addrspace(1) global
+// CHECK-HIDDEN: @e = external protected addrspace(1) global
+extern __device__ int e;
+
+// dummy one to hold reference to `e`.
+__device__ int f() {
+  return e;
+}
+
 // CHECK-DEFAULT: define amdgpu_kernel void @_Z3foov()
 // CHECK-PROTECTED: define protected amdgpu_kernel void @_Z3foov()
 // CHECK-HIDDEN: define protected amdgpu_kernel void @_Z3foov()
Index: clang/lib/CodeGen/CodeGenModule.cpp
===
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -3464,6 +3464,9 @@
 }
   }
 
+  if (GV->isDeclaration())
+getTargetCodeGenInfo().setTargetAttributes(D, GV, *this);
+
   LangAS ExpectedAS =
   D ? D->getType().getAddressSpace()
 : (LangOpts.OpenCL ? LangAS::opencl_global : LangAS::Default);
@@ -3473,9 +3476,6 @@
 return getTargetCodeGenInfo().performAddrSpaceCast(*this, GV, AddrSpace,
ExpectedAS, Ty);
 
-  if (GV->isDeclaration())
-getTargetCodeGenInfo().setTargetAttributes(D, GV, *this);
-
   return GV;
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D61914: [Support][Test] Time profiler: add regression test

2019-06-07 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi added inline comments.



Comment at: cfe/trunk/test/Driver/check-time-trace.cpp:1
+// RUN: %clangxx -ftime-trace %s 2>&1 | grep "Time trace json-file dumped to" \
+// RUN:   | awk '{print $NF}' | xargs cat \

This test should probably have // REQUIRES: shell


Repository:
  rL LLVM

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

https://reviews.llvm.org/D61914



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


[PATCH] D61914: [Support][Test] Time profiler: add regression test

2019-06-07 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi added a comment.

cfe/trunk/test/Driver/check-time-trace.cpp appears to fail on Darwin. Did you 
mean to pass the target explicitly ?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D61914



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


r362830 - Revert "[CodeComplete] Improve overload handling for C++ qualified and ref-qualified methods."

2019-06-07 Thread Vlad Tsyrklevich via cfe-commits
Author: vlad.tsyrklevich
Date: Fri Jun  7 12:18:30 2019
New Revision: 362830

URL: http://llvm.org/viewvc/llvm-project?rev=362830=rev
Log:
Revert "[CodeComplete] Improve overload handling for C++ qualified and 
ref-qualified methods."

This reverts commit f1f6e0fc2468e9c120b22b939507c527d08b8ee8, it was
causing LSan failures on the sanitizer bots:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/32809

Modified:
cfe/trunk/lib/Sema/SemaCodeComplete.cpp
cfe/trunk/test/CodeCompletion/member-access.cpp

Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=362830=362829=362830=diff
==
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Fri Jun  7 12:18:30 2019
@@ -16,9 +16,7 @@
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/ExprObjC.h"
 #include "clang/AST/QualTypeNames.h"
-#include "clang/AST/Type.h"
 #include "clang/Basic/CharInfo.h"
-#include "clang/Basic/Specifiers.h"
 #include "clang/Lex/HeaderSearch.h"
 #include "clang/Lex/MacroInfo.h"
 #include "clang/Lex/Preprocessor.h"
@@ -154,16 +152,9 @@ private:
   /// different levels of, e.g., the inheritance hierarchy.
   std::list ShadowMaps;
 
-  /// Overloaded C++ member functions found by SemaLookup.
-  /// Used to determine when one overload is dominated by another.
-  llvm::DenseMap, ShadowMapEntry>
-  OverloadMap;
-
   /// If we're potentially referring to a C++ member function, the set
   /// of qualifiers applied to the object type.
   Qualifiers ObjectTypeQualifiers;
-  /// The kind of the object expression, for rvalue/lvalue overloads.
-  ExprValueKind ObjectKind;
 
   /// Whether the \p ObjectTypeQualifiers field is active.
   bool HasObjectTypeQualifiers;
@@ -239,9 +230,8 @@ public:
   /// out member functions that aren't available (because there will be a
   /// cv-qualifier mismatch) or prefer functions with an exact qualifier
   /// match.
-  void setObjectTypeQualifiers(Qualifiers Quals, ExprValueKind Kind) {
+  void setObjectTypeQualifiers(Qualifiers Quals) {
 ObjectTypeQualifiers = Quals;
-ObjectKind = Kind;
 HasObjectTypeQualifiers = true;
   }
 
@@ -1167,53 +1157,6 @@ static void setInBaseClass(ResultBuilder
   R.InBaseClass = true;
 }
 
-enum class OverloadCompare { BothViable, Dominates, Dominated };
-// Will Candidate ever be called on the object, when overloaded with Incumbent?
-// Returns Dominates if Candidate is always called, Dominated if Incumbent is
-// always called, BothViable if either may be called dependending on arguments.
-// Precondition: must actually be overloads!
-static OverloadCompare compareOverloads(const CXXMethodDecl ,
-const CXXMethodDecl ,
-const Qualifiers ,
-ExprValueKind ObjectKind) {
-  if (Candidate.isVariadic() != Incumbent.isVariadic() ||
-  Candidate.getNumParams() != Incumbent.getNumParams() ||
-  Candidate.getMinRequiredArguments() !=
-  Incumbent.getMinRequiredArguments())
-return OverloadCompare::BothViable;
-  for (unsigned I = 0, E = Candidate.getNumParams(); I != E; ++I)
-if (Candidate.parameters()[I]->getType().getCanonicalType() !=
-Incumbent.parameters()[I]->getType().getCanonicalType())
-  return OverloadCompare::BothViable;
-  if (!llvm::empty(Candidate.specific_attrs()) ||
-  !llvm::empty(Incumbent.specific_attrs()))
-return OverloadCompare::BothViable;
-  // At this point, we know calls can't pick one or the other based on
-  // arguments, so one of the two must win. (Or both fail, handled elsewhere).
-  RefQualifierKind CandidateRef = Candidate.getRefQualifier();
-  RefQualifierKind IncumbentRef = Incumbent.getRefQualifier();
-  if (CandidateRef != IncumbentRef) {
-// If the object kind is LValue/RValue, there's one acceptable 
ref-qualifier
-// and it can't be mixed with ref-unqualified overloads (in valid code).
-
-// For xvalue objects, we prefer the rvalue overload even if we have to
-// add qualifiers (which is rare, because const&& is rare).
-if (ObjectKind == clang::VK_XValue)
-  return CandidateRef == RQ_RValue ? OverloadCompare::Dominates
-   : OverloadCompare::Dominated;
-  }
-  // Now the ref qualifiers are the same (or we're in some invalid state).
-  // So make some decision based on the qualifiers.
-  Qualifiers CandidateQual = Candidate.getMethodQualifiers();
-  Qualifiers IncumbentQual = Incumbent.getMethodQualifiers();
-  bool CandidateSuperset = CandidateQual.compatiblyIncludes(IncumbentQual);
-  bool IncumbentSuperset = IncumbentQual.compatiblyIncludes(CandidateQual);
-  if (CandidateSuperset == IncumbentSuperset)
-return OverloadCompare::BothViable;
-  return IncumbentSuperset ? 

Re: r362785 - [CodeComplete] Improve overload handling for C++ qualified and ref-qualified methods.

2019-06-07 Thread Vlad Tsyrklevich via cfe-commits
This change caused LSan failures and has been reverted in r362830:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/32809

On Fri, Jun 7, 2019 at 2:42 AM Sam McCall via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: sammccall
> Date: Fri Jun  7 02:45:17 2019
> New Revision: 362785
>
> URL: http://llvm.org/viewvc/llvm-project?rev=362785=rev
> Log:
> [CodeComplete] Improve overload handling for C++ qualified and
> ref-qualified methods.
>
> Summary:
> - when a method is not available because of the target value kind (e.g. an
> &&
>   method on a Foo& variable), then don't offer it.
> - when a method is effectively shadowed by another method from the same
> class
>   with a) an identical argument list and b) superior qualifiers, then don't
>   offer it.
>
> Reviewers: ilya-biryukov
>
> Subscribers: cfe-commits
>
> Tags: #clang
>
> Differential Revision: https://reviews.llvm.org/D62582
>
> Modified:
> cfe/trunk/lib/Sema/SemaCodeComplete.cpp
> cfe/trunk/test/CodeCompletion/member-access.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=362785=362784=362785=diff
>
> ==
> --- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Fri Jun  7 02:45:17 2019
> @@ -16,7 +16,9 @@
>  #include "clang/AST/ExprCXX.h"
>  #include "clang/AST/ExprObjC.h"
>  #include "clang/AST/QualTypeNames.h"
> +#include "clang/AST/Type.h"
>  #include "clang/Basic/CharInfo.h"
> +#include "clang/Basic/Specifiers.h"
>  #include "clang/Lex/HeaderSearch.h"
>  #include "clang/Lex/MacroInfo.h"
>  #include "clang/Lex/Preprocessor.h"
> @@ -152,9 +154,16 @@ private:
>/// different levels of, e.g., the inheritance hierarchy.
>std::list ShadowMaps;
>
> +  /// Overloaded C++ member functions found by SemaLookup.
> +  /// Used to determine when one overload is dominated by another.
> +  llvm::DenseMap,
> ShadowMapEntry>
> +  OverloadMap;
> +
>/// If we're potentially referring to a C++ member function, the set
>/// of qualifiers applied to the object type.
>Qualifiers ObjectTypeQualifiers;
> +  /// The kind of the object expression, for rvalue/lvalue overloads.
> +  ExprValueKind ObjectKind;
>
>/// Whether the \p ObjectTypeQualifiers field is active.
>bool HasObjectTypeQualifiers;
> @@ -230,8 +239,9 @@ public:
>/// out member functions that aren't available (because there will be a
>/// cv-qualifier mismatch) or prefer functions with an exact qualifier
>/// match.
> -  void setObjectTypeQualifiers(Qualifiers Quals) {
> +  void setObjectTypeQualifiers(Qualifiers Quals, ExprValueKind Kind) {
>  ObjectTypeQualifiers = Quals;
> +ObjectKind = Kind;
>  HasObjectTypeQualifiers = true;
>}
>
> @@ -1157,6 +1167,53 @@ static void setInBaseClass(ResultBuilder
>R.InBaseClass = true;
>  }
>
> +enum class OverloadCompare { BothViable, Dominates, Dominated };
> +// Will Candidate ever be called on the object, when overloaded with
> Incumbent?
> +// Returns Dominates if Candidate is always called, Dominated if
> Incumbent is
> +// always called, BothViable if either may be called dependending on
> arguments.
> +// Precondition: must actually be overloads!
> +static OverloadCompare compareOverloads(const CXXMethodDecl ,
> +const CXXMethodDecl ,
> +const Qualifiers ,
> +ExprValueKind ObjectKind) {
> +  if (Candidate.isVariadic() != Incumbent.isVariadic() ||
> +  Candidate.getNumParams() != Incumbent.getNumParams() ||
> +  Candidate.getMinRequiredArguments() !=
> +  Incumbent.getMinRequiredArguments())
> +return OverloadCompare::BothViable;
> +  for (unsigned I = 0, E = Candidate.getNumParams(); I != E; ++I)
> +if (Candidate.parameters()[I]->getType().getCanonicalType() !=
> +Incumbent.parameters()[I]->getType().getCanonicalType())
> +  return OverloadCompare::BothViable;
> +  if (!llvm::empty(Candidate.specific_attrs()) ||
> +  !llvm::empty(Incumbent.specific_attrs()))
> +return OverloadCompare::BothViable;
> +  // At this point, we know calls can't pick one or the other based on
> +  // arguments, so one of the two must win. (Or both fail, handled
> elsewhere).
> +  RefQualifierKind CandidateRef = Candidate.getRefQualifier();
> +  RefQualifierKind IncumbentRef = Incumbent.getRefQualifier();
> +  if (CandidateRef != IncumbentRef) {
> +// If the object kind is LValue/RValue, there's one acceptable
> ref-qualifier
> +// and it can't be mixed with ref-unqualified overloads (in valid
> code).
> +
> +// For xvalue objects, we prefer the rvalue overload even if we have
> to
> +// add qualifiers (which is rare, because const&& is rare).
> +if (ObjectKind == clang::VK_XValue)
> +  

[PATCH] D62636: Driver, IRGen: Set partitions on GlobalValues according to -fsymbol-partition flag.

2019-06-07 Thread Peter Collingbourne via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
pcc marked an inline comment as done.
Closed by commit rL362829: Driver, IRGen: Set partitions on GlobalValues 
according to -fsymbol-partition… (authored by pcc, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D62636?vs=202081=203593#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62636

Files:
  cfe/trunk/include/clang/Basic/CodeGenOptions.h
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/lib/CodeGen/CodeGenModule.cpp
  cfe/trunk/lib/CodeGen/CodeGenModule.h
  cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
  cfe/trunk/lib/Driver/ToolChains/Clang.cpp
  cfe/trunk/lib/Frontend/CompilerInvocation.cpp
  cfe/trunk/test/CodeGenCXX/symbol-partition.cpp
  cfe/trunk/test/Driver/symbol-partition.c

Index: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
===
--- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
+++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
@@ -3420,6 +3420,9 @@
   TypeName->setDLLStorageClass(DLLStorageClass);
   GV->setDLLStorageClass(DLLStorageClass);
 
+  TypeName->setPartition(CGM.getCodeGenOpts().SymbolPartition);
+  GV->setPartition(CGM.getCodeGenOpts().SymbolPartition);
+
   return llvm::ConstantExpr::getBitCast(GV, CGM.Int8PtrTy);
 }
 
Index: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
===
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp
@@ -875,19 +875,20 @@
 void CodeGenModule::setGVProperties(llvm::GlobalValue *GV,
 GlobalDecl GD) const {
   setDLLImportDLLExport(GV, GD);
-  setGlobalVisibilityAndLocal(GV, dyn_cast(GD.getDecl()));
+  setGVPropertiesAux(GV, dyn_cast(GD.getDecl()));
 }
 
 void CodeGenModule::setGVProperties(llvm::GlobalValue *GV,
 const NamedDecl *D) const {
   setDLLImportDLLExport(GV, D);
-  setGlobalVisibilityAndLocal(GV, D);
+  setGVPropertiesAux(GV, D);
 }
 
-void CodeGenModule::setGlobalVisibilityAndLocal(llvm::GlobalValue *GV,
-const NamedDecl *D) const {
+void CodeGenModule::setGVPropertiesAux(llvm::GlobalValue *GV,
+   const NamedDecl *D) const {
   setGlobalVisibility(GV, D);
   setDSOLocal(GV);
+  GV->setPartition(CodeGenOpts.SymbolPartition);
 }
 
 static llvm::GlobalVariable::ThreadLocalMode GetLLVMTLSModel(StringRef S) {
Index: cfe/trunk/lib/CodeGen/CodeGenModule.h
===
--- cfe/trunk/lib/CodeGen/CodeGenModule.h
+++ cfe/trunk/lib/CodeGen/CodeGenModule.h
@@ -759,9 +759,6 @@
   /// Set the visibility for the given LLVM GlobalValue.
   void setGlobalVisibility(llvm::GlobalValue *GV, const NamedDecl *D) const;
 
-  void setGlobalVisibilityAndLocal(llvm::GlobalValue *GV,
-   const NamedDecl *D) const;
-
   void setDSOLocal(llvm::GlobalValue *GV) const;
 
   void setDLLImportDLLExport(llvm::GlobalValue *GV, GlobalDecl D) const;
@@ -771,6 +768,8 @@
   void setGVProperties(llvm::GlobalValue *GV, GlobalDecl GD) const;
   void setGVProperties(llvm::GlobalValue *GV, const NamedDecl *D) const;
 
+  void setGVPropertiesAux(llvm::GlobalValue *GV, const NamedDecl *D) const;
+
   /// Set the TLS mode for the given LLVM GlobalValue for the thread-local
   /// variable declaration D.
   void setTLSMode(llvm::GlobalValue *GV, const VarDecl ) const;
Index: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp
@@ -5410,6 +5410,14 @@
TC.useIntegratedAs()))
 CmdArgs.push_back("-faddrsig");
 
+  if (Arg *A = Args.getLastArg(options::OPT_fsymbol_partition_EQ)) {
+std::string Str = A->getAsString(Args);
+if (!TC.getTriple().isOSBinFormatELF())
+  D.Diag(diag::err_drv_unsupported_opt_for_target)
+  << Str << TC.getTripleString();
+CmdArgs.push_back(Args.MakeArgString(Str));
+  }
+
   // Add the "-o out -x type src.c" flags last. This is done primarily to make
   // the -cc1 command easier to edit when reproducing compiler crashes.
   if (Output.getType() == types::TY_Dependencies) {
Index: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
===
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp
@@ -1345,6 +1345,8 @@
 
   Opts.PassPlugins = Args.getAllArgValues(OPT_fpass_plugin_EQ);
 
+  Opts.SymbolPartition = Args.getLastArgValue(OPT_fsymbol_partition_EQ);
+
   return Success;
 }
 
Index: cfe/trunk/include/clang/Driver/Options.td

r362829 - Driver, IRGen: Set partitions on GlobalValues according to -fsymbol-partition flag.

2019-06-07 Thread Peter Collingbourne via cfe-commits
Author: pcc
Date: Fri Jun  7 12:10:08 2019
New Revision: 362829

URL: http://llvm.org/viewvc/llvm-project?rev=362829=rev
Log:
Driver, IRGen: Set partitions on GlobalValues according to -fsymbol-partition 
flag.

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

Added:
cfe/trunk/test/CodeGenCXX/symbol-partition.cpp
cfe/trunk/test/Driver/symbol-partition.c
Modified:
cfe/trunk/include/clang/Basic/CodeGenOptions.h
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.h
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/include/clang/Basic/CodeGenOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/CodeGenOptions.h?rev=362829=362828=362829=diff
==
--- cfe/trunk/include/clang/Basic/CodeGenOptions.h (original)
+++ cfe/trunk/include/clang/Basic/CodeGenOptions.h Fri Jun  7 12:10:08 2019
@@ -243,6 +243,10 @@ public:
   /// records.
   std::string OptRecordPasses;
 
+  /// The name of the partition that symbols are assigned to, specified with
+  /// -fsymbol-partition (see https://lld.llvm.org/Partitions.html).
+  std::string SymbolPartition;
+
   /// Regular expression to select optimizations for which we should enable
   /// optimization remarks. Transformation passes whose name matches this
   /// expression (and support this feature), will emit a diagnostic

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=362829=362828=362829=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Fri Jun  7 12:10:08 2019
@@ -935,6 +935,8 @@ def fno_cxx_static_destructors : Flag<["
   Group,
   Flags<[CC1Option]>,
   HelpText<"Disable C++ static destructor registration">;
+def fsymbol_partition_EQ : Joined<["-"], "fsymbol-partition=">, Group,
+  Flags<[CC1Option]>;
 
 // Begin sanitizer flags. These should all be core options exposed in all 
driver
 // modes.

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=362829=362828=362829=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Jun  7 12:10:08 2019
@@ -875,19 +875,20 @@ void CodeGenModule::setDLLImportDLLExpor
 void CodeGenModule::setGVProperties(llvm::GlobalValue *GV,
 GlobalDecl GD) const {
   setDLLImportDLLExport(GV, GD);
-  setGlobalVisibilityAndLocal(GV, dyn_cast(GD.getDecl()));
+  setGVPropertiesAux(GV, dyn_cast(GD.getDecl()));
 }
 
 void CodeGenModule::setGVProperties(llvm::GlobalValue *GV,
 const NamedDecl *D) const {
   setDLLImportDLLExport(GV, D);
-  setGlobalVisibilityAndLocal(GV, D);
+  setGVPropertiesAux(GV, D);
 }
 
-void CodeGenModule::setGlobalVisibilityAndLocal(llvm::GlobalValue *GV,
-const NamedDecl *D) const {
+void CodeGenModule::setGVPropertiesAux(llvm::GlobalValue *GV,
+   const NamedDecl *D) const {
   setGlobalVisibility(GV, D);
   setDSOLocal(GV);
+  GV->setPartition(CodeGenOpts.SymbolPartition);
 }
 
 static llvm::GlobalVariable::ThreadLocalMode GetLLVMTLSModel(StringRef S) {

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.h?rev=362829=362828=362829=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.h Fri Jun  7 12:10:08 2019
@@ -759,9 +759,6 @@ public:
   /// Set the visibility for the given LLVM GlobalValue.
   void setGlobalVisibility(llvm::GlobalValue *GV, const NamedDecl *D) const;
 
-  void setGlobalVisibilityAndLocal(llvm::GlobalValue *GV,
-   const NamedDecl *D) const;
-
   void setDSOLocal(llvm::GlobalValue *GV) const;
 
   void setDLLImportDLLExport(llvm::GlobalValue *GV, GlobalDecl D) const;
@@ -771,6 +768,8 @@ public:
   void setGVProperties(llvm::GlobalValue *GV, GlobalDecl GD) const;
   void setGVProperties(llvm::GlobalValue *GV, const NamedDecl *D) const;
 
+  void setGVPropertiesAux(llvm::GlobalValue *GV, const NamedDecl *D) const;
+
   /// Set the TLS mode for the given LLVM GlobalValue for the thread-local
   /// variable declaration D.
   void setTLSMode(llvm::GlobalValue *GV, const VarDecl ) const;

Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
URL: 

[PATCH] D62636: Driver, IRGen: Set partitions on GlobalValues according to -fsymbol-partition flag.

2019-06-07 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.

LGTM




Comment at: clang/include/clang/Driver/Options.td:938
   HelpText<"Disable C++ static destructor registration">;
+def fsymbol_partition_EQ : Joined<["-"], "fsymbol-partition=">, 
Group, Flags<[CC1Option]>;
 

Please wrap to 80 columns.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62636



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


[PATCH] D59963: [clang-tidy] Add a module for the Linux kernel.

2019-06-07 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added inline comments.



Comment at: clang-tools-extra/test/clang-tidy/linuxkernel-must-check-errs.c:6
+// Prototypes of the error functions.
+void * __must_check ERR_PTR(long error);
+long  __must_check PTR_ERR(const void *ptr);

Let's come up with another check; `__must_check` has a bug upstream in the 
kernel sources (I looked into this maybe a month ago).  The kernel disables a 
warning group that this would be under, if I re-enable the lone warning, then 
this works properly at compile time. (I forget the warning, and should have 
filed a bug).  Point being, fixing this upstream in kernel sources is 
preferable to me to a clang tidy check, but it's a good start.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59963



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


[PATCH] D62949: [analyzer][tests] Add normalize_plist to replace diff_plist

2019-06-07 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added a comment.

In D62949#1533605 , @NoQ wrote:

> Ok! I'll be happy to have this addressed incrementally.


I think it should be safe to at least commit the pre-normalization directly 
first. I'll take a look, and update the patch if the pre-normalization lands.


Repository:
  rC Clang

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

https://reviews.llvm.org/D62949



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


r362824 - Revert "[Support][Test] Time profiler: add regression test"

2019-06-07 Thread Anton Afanasyev via cfe-commits
Author: anton-afanasyev
Date: Fri Jun  7 11:35:58 2019
New Revision: 362824

URL: http://llvm.org/viewvc/llvm-project?rev=362824=rev
Log:
Revert "[Support][Test] Time profiler: add regression test"

This reverts commit 44282a60c90fdded249d57d91b12c6c0907102ec.
This breaks buildbot.

Removed:
cfe/trunk/test/Driver/check-time-trace.cpp
Modified:
cfe/trunk/tools/driver/cc1_main.cpp

Removed: cfe/trunk/test/Driver/check-time-trace.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/check-time-trace.cpp?rev=362823=auto
==
--- cfe/trunk/test/Driver/check-time-trace.cpp (original)
+++ cfe/trunk/test/Driver/check-time-trace.cpp (removed)
@@ -1,23 +0,0 @@
-// RUN: %clangxx -ftime-trace -mllvm --time-trace-granularity=0 %s 2>&1 | grep 
"Time trace json-file dumped to" \
-// RUN:   | awk '{print $NF}' | xargs cat \
-// RUN:   | %python -c 'import json, sys; 
json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
-// RUN:   | FileCheck %s
-
-// CHECK: "traceEvents": [
-// CHECK: "args":
-// CHECK: "detail":
-// CHECK: "dur":
-// CHECK: "name":
-// CHECK-NEXT: "ph":
-// CHECK-NEXT: "pid":
-// CHECK-NEXT: "tid":
-// CHECK-NEXT: "ts":
-// CHECK: "name": "clang"
-// CHECK: "name": "process_name"
-
-#include 
-
-int main() {
-  std::cout << "Foo" << std::endl;
-  return 0;
-}

Modified: cfe/trunk/tools/driver/cc1_main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1_main.cpp?rev=362824=362823=362824=diff
==
--- cfe/trunk/tools/driver/cc1_main.cpp (original)
+++ cfe/trunk/tools/driver/cc1_main.cpp Fri Jun  7 11:35:58 2019
@@ -241,11 +241,6 @@ int cc1_main(ArrayRef Argv
 
 llvm::timeTraceProfilerWrite(*profilerOutput);
 llvm::timeTraceProfilerCleanup();
-
-llvm::errs() << "Time trace json-file dumped to " << Path.str() << "\n";
-llvm::errs()
-<< "Use chrome://tracing or Speedscope App "
-   "(https://www.speedscope.app) for flamegraph visualization\n";
   }
 
   // Our error handler depends on the Diagnostics object, which we're


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


[PATCH] D62009: [clang] perform semantic checking in constant context

2019-06-07 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.

Thanks, looks great.




Comment at: clang/lib/Sema/SemaChecking.cpp:13941
 ///
+/// \param isConstantEvaluated wether the evalaution should be permormed in
+/// constant context.

permormed -> performed


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

https://reviews.llvm.org/D62009



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


[PATCH] D62399: [clang] Add storage for APValue in ConstantExpr

2019-06-07 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.

Looks like a good first step, thanks!




Comment at: clang/include/clang/AST/ASTContext.h:2821-2823
+  /// Adds an APValue that will be destructed during the destruction of the
+  /// ASTContext.
+  void AddAPValueCleanup(APValue *Ptr) const { APValueCleanups.push_back(Ptr); 
}

We'll need cleanups for `APSInt`s too, in the case where they don't fit into 
their inline storage. Maybe instead of storing a trailing `APSInt` we could 
store a trailing `uint64_t` (and put the bit-width and `Signed` flag into the 
`ConstantExprBits`), and use the `APValue` representation for `APSInt`s that 
don't fit in 64 bits? (That'd avoid needing a separate list of cleanups and 
would also make `ConstantExpr` 16 bytes smaller in the common case of storing 
an int that fits in 64 bits.)

As an alternative, we could tail-allocate a sequence of `uint64_t`s for an 
`APSInt` that's larger than 64 bits, but that would force a memory allocation 
and a copy on every access to the value, so I think it's not worthwhile.



Comment at: clang/include/clang/Serialization/ASTWriter.h:866
 
+  /// Emit an integral value.
+  void AddAPValue(const APValue );

Comment needs to be updated.



Comment at: clang/lib/AST/Expr.cpp:241
+  switch (Kind) {
+  case APValue::Uninitialized:
+return ConstantExpr::RSK_None;

After recent changes, this has been split into `APValue::None` and 
`APValue::Indeterminate`.



Comment at: clang/lib/Serialization/ASTReader.cpp:9108-9110
+  uint64_t Tmp = Record[Idx++];
+  unsigned Width = Tmp & 0x;
+  unsigned Scale = Tmp >> static_cast(32);

Record values in AST files are typically stored with VBR6 encoding, as 
described here: https://llvm.org/docs/BitCodeFormat.html#variable-width-value

In particular, that encoding means it's usually more space-efficient to store a 
pair of two 32-bit integers as two separate fields rather than packing the bits 
of the integers into one field like this. (If you bit-pack like this, then you 
always use at least 7 VBR6 fields = 42 bits to store these two values, whereas 
if you treat them as separate fields and both are small, they can fit into 2 
VBR6 fields = 12 bits.)

So please store `Width` and `Scale` as two separate vector entries :)


Repository:
  rC Clang

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

https://reviews.llvm.org/D62399



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


r362821 - [Support][Test] Time profiler: add regression test

2019-06-07 Thread Anton Afanasyev via cfe-commits
Author: anton-afanasyev
Date: Fri Jun  7 11:13:48 2019
New Revision: 362821

URL: http://llvm.org/viewvc/llvm-project?rev=362821=rev
Log:
[Support][Test] Time profiler: add regression test

Summary:
Add output to `llvm::errs()` when `-ftime-trace` option is enabled,
add regression test checking this option works as expected.

Reviewers: thakis, aganea

Subscribers: cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 362792

Added:
cfe/trunk/test/Driver/check-time-trace.cpp
Modified:
cfe/trunk/tools/driver/cc1_main.cpp

Added: cfe/trunk/test/Driver/check-time-trace.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/check-time-trace.cpp?rev=362821=auto
==
--- cfe/trunk/test/Driver/check-time-trace.cpp (added)
+++ cfe/trunk/test/Driver/check-time-trace.cpp Fri Jun  7 11:13:48 2019
@@ -0,0 +1,23 @@
+// RUN: %clangxx -ftime-trace -mllvm --time-trace-granularity=0 %s 2>&1 | grep 
"Time trace json-file dumped to" \
+// RUN:   | awk '{print $NF}' | xargs cat \
+// RUN:   | %python -c 'import json, sys; 
json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
+// RUN:   | FileCheck %s
+
+// CHECK: "traceEvents": [
+// CHECK: "args":
+// CHECK: "detail":
+// CHECK: "dur":
+// CHECK: "name":
+// CHECK-NEXT: "ph":
+// CHECK-NEXT: "pid":
+// CHECK-NEXT: "tid":
+// CHECK-NEXT: "ts":
+// CHECK: "name": "clang"
+// CHECK: "name": "process_name"
+
+#include 
+
+int main() {
+  std::cout << "Foo" << std::endl;
+  return 0;
+}

Modified: cfe/trunk/tools/driver/cc1_main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1_main.cpp?rev=362821=362820=362821=diff
==
--- cfe/trunk/tools/driver/cc1_main.cpp (original)
+++ cfe/trunk/tools/driver/cc1_main.cpp Fri Jun  7 11:13:48 2019
@@ -241,6 +241,11 @@ int cc1_main(ArrayRef Argv
 
 llvm::timeTraceProfilerWrite(*profilerOutput);
 llvm::timeTraceProfilerCleanup();
+
+llvm::errs() << "Time trace json-file dumped to " << Path.str() << "\n";
+llvm::errs()
+<< "Use chrome://tracing or Speedscope App "
+   "(https://www.speedscope.app) for flamegraph visualization\n";
   }
 
   // Our error handler depends on the Diagnostics object, which we're


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


r362816 - Revert rL362792 : [Support][Test] Time profiler: add regression test

2019-06-07 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Fri Jun  7 10:37:04 2019
New Revision: 362816

URL: http://llvm.org/viewvc/llvm-project?rev=362816=rev
Log:
Revert rL362792 : [Support][Test] Time profiler: add regression test

Summary:
Add output to `llvm::errs()` when `-ftime-trace` option is enabled,
add regression test checking this option works as expected.

Reviewers: thakis, aganea

Subscribers: cfe-commits, llvm-commits

Tags: #clang, #llvm

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

Breaks buildbots - @anton-afanasyev please can you take a look?

Removed:
cfe/trunk/test/Driver/check-time-trace.cpp
Modified:
cfe/trunk/tools/driver/cc1_main.cpp

Removed: cfe/trunk/test/Driver/check-time-trace.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/check-time-trace.cpp?rev=362815=auto
==
--- cfe/trunk/test/Driver/check-time-trace.cpp (original)
+++ cfe/trunk/test/Driver/check-time-trace.cpp (removed)
@@ -1,23 +0,0 @@
-// RUN: %clangxx -ftime-trace %s 2>&1 | grep "Time trace json-file dumped to" \
-// RUN:   | awk '{print $NF}' | xargs cat \
-// RUN:   | %python -c 'import json, sys; 
json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
-// RUN:   | FileCheck %s
-
-// CHECK: "traceEvents": [
-// CHECK: "args":
-// CHECK: "detail":
-// CHECK: "dur":
-// CHECK: "name": "Source"
-// CHECK-NEXT: "ph":
-// CHECK-NEXT: "pid":
-// CHECK-NEXT: "tid":
-// CHECK-NEXT: "ts":
-// CHECK: "name": "clang"
-// CHECK: "name": "process_name"
-
-#include 
-
-int main() {
-  std::cout << "Foo" << std::endl;
-  return 0;
-}

Modified: cfe/trunk/tools/driver/cc1_main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1_main.cpp?rev=362816=362815=362816=diff
==
--- cfe/trunk/tools/driver/cc1_main.cpp (original)
+++ cfe/trunk/tools/driver/cc1_main.cpp Fri Jun  7 10:37:04 2019
@@ -241,11 +241,6 @@ int cc1_main(ArrayRef Argv
 
 llvm::timeTraceProfilerWrite(*profilerOutput);
 llvm::timeTraceProfilerCleanup();
-
-llvm::errs() << "Time trace json-file dumped to " << Path.str() << "\n";
-llvm::errs()
-<< "Use chrome://tracing or Speedscope App "
-   "(https://www.speedscope.app) for flamegraph visualization\n";
   }
 
   // Our error handler depends on the Diagnostics object, which we're


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


[PATCH] D61790: [C++20] add Basic consteval specifier

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

Only minor comments remain (other than the `-Wc++17-compat` warning). In the 
interest of incremental progress, let's leave the `-Wc++17-compat` warning for 
a later patch; feel free to commit this after fixing up the other things.

(If you don't have commit access yet, now would be a good time to request it; 
please read http://llvm.org/docs/DeveloperPolicy.html for details.)

Thanks again!




Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:1598
+def err_consteval_non_function : Error<
+  "'virtual' can only appear on functions and constructors">;
 def err_virtual_non_function : Error<

Should this say `consteval` rather than `virtual`?

Actually... looks like this new diagnostic is not used, and could just be 
removed?



Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:7860
+  "defaulted declaration of %sub{select_special_member_kind}0 "
+  "cannot be consteval because implicit definition is not be constexpr">;
 def warn_defaulted_method_deleted : Warning<

Remove stray "be" here.



Comment at: clang/lib/AST/ExprConstant.cpp:4561
   // Can we evaluate this function call?
-  if (Definition && Definition->isConstexpr() && Body)
+  if (Definition && Definition->isConstexpr() && !Definition->isInvalidDecl() 
&&
+  Body)

The `Definition && [...] Definition->isInvalidDecl()` case was handled a few 
lines above; this change appears to have no effect.



Comment at: clang/lib/Parse/ParseExprCXX.cpp:1152-1154
 P.Diag(ConstexprLoc, !P.getLangOpts().CPlusPlus17
  ? diag::ext_constexpr_on_lambda_cxx17
  : diag::warn_cxx14_compat_constexpr_on_lambda);

Tyker wrote:
> rsmith wrote:
> > We should produce a `-Wc++17-compat` diagnostic similar to this for uses of 
> > `consteval`.
> a consteval keyword can only be lexed when we are in C++2a because it is a 
> C++2a keyword so the warning would never fire.
The purpose of this warning is to warn about code parsed in C++2a mode that 
would not be valid in C++17. Try (eg) enabling `-Wc++98-compat` and building 
some C++11 code to see what's supposed to happen.



Comment at: clang/lib/Sema/DeclSpec.cpp:1296-1297
   << (TypeSpecType == TST_char16 ? "char16_t" : "char32_t");
-  if (Constexpr_specified)
+  if (hasConstexprSpecifier())
 S.Diag(ConstexprLoc, diag::warn_cxx98_compat_constexpr);
 

Tyker wrote:
> rsmith wrote:
> > For `consteval` we should produce an "incompatible with C++ standards 
> > before C++2a" diagnostic, not an "incompatible with C++98" diagnostic.
> same as previous comment. the consteval keyword cannot be lexed unless we are 
> in c++2a mode so the warning would never fire.
(See previous reply.)


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

https://reviews.llvm.org/D61790



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


[PATCH] D60710: [ARM] Add ACLE feature macros for MVE.

2019-06-07 Thread Dave Green via Phabricator via cfe-commits
dmgreen added a comment.

Hello. Hopefully fixed in rC362814 !


Repository:
  rL LLVM

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

https://reviews.llvm.org/D60710



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


r362814 - [ARM] Add ACLE feature macros for MVE.

2019-06-07 Thread David Green via cfe-commits
Author: dmgreen
Date: Fri Jun  7 10:28:12 2019
New Revision: 362814

URL: http://llvm.org/viewvc/llvm-project?rev=362814=rev
Log:
[ARM] Add ACLE feature macros for MVE.

Fixup uninitialised variable.

Modified:
cfe/trunk/lib/Basic/Targets/ARM.cpp

Modified: cfe/trunk/lib/Basic/Targets/ARM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/ARM.cpp?rev=362814=362813=362814=diff
==
--- cfe/trunk/lib/Basic/Targets/ARM.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/ARM.cpp Fri Jun  7 10:28:12 2019
@@ -400,6 +400,7 @@ bool ARMTargetInfo::initFeatureMap(
 bool ARMTargetInfo::handleTargetFeatures(std::vector ,
  DiagnosticsEngine ) {
   FPU = 0;
+  MVE = 0;
   CRC = 0;
   Crypto = 0;
   DSP = 0;


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


[PATCH] D60710: [ARM] Add ACLE feature macros for MVE.

2019-06-07 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

The test is failing on some bots, e.g. 
http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu/builds/13430/steps/test-stage1-compiler/logs/stdio

  
/home/buildslave/buildslave1a/clang-with-lto-ubuntu/llvm.src/tools/clang/test/Preprocessor/arm-target-features.c:762:20:
 error: CHECK-V81M-MVE: expected string not found in input
  // CHECK-V81M-MVE: #define __ARM_FEATURE_MVE 1
 ^
  :16:1: note: scanning from here
  #define __ARM_FEATURE_FMA 1
  ^
  :20:1: note: possible intended match here
  #define __ARM_FEATURE_MVE 3
  ^


Repository:
  rL LLVM

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

https://reviews.llvm.org/D60710



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


[PATCH] D62814: [clangd] Treat lambdas as functions when preparing hover response

2019-06-07 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov marked an inline comment as done.
ilya-biryukov added inline comments.



Comment at: clang-tools-extra/clangd/unittests/XRefsTests.cpp:831
+ };
  return HI;
}},

kadircet wrote:
> ilya-biryukov wrote:
> > kadircet wrote:
> > > ilya-biryukov wrote:
> > > > kadircet wrote:
> > > > > ilya-biryukov wrote:
> > > > > > Could you add another test with even weirder types where we fail to 
> > > > > > show the signature? To make sure we don't break when reaching the 
> > > > > > limitations of the chosen approach and document what those 
> > > > > > limitations are.
> > > > > > 
> > > > > > Something like:
> > > > > > ```
> > > > > > auto a = [](int a) { return 10; };
> > > > > > auto *b = 
> > > > > > auto *c = 
> > > > > > ```
> > > > > > 
> > > > > > We would fail to show the signature here, but it's totally ok to 
> > > > > > ignore it.
> > > > > added cases, and changed code(a lot simpler now) to generate 
> > > > > signatures for those cases as well.
> > > > Here's an example when the new approach falls short too:
> > > > 
> > > > ```
> > > > auto a = [](int) { return 10; }
> > > > std::function b;
> > > > ```
> > > > 
> > > > In general, are we ok with loosing all the information about the type 
> > > > that we drop?
> > > > One level of references and pointers seemed ok, dropping more is a bit 
> > > > more cheesy..
> > > > 
> > > > At the same time, either case is **so** rare that we probably don't 
> > > > care.
> > > are you talking about hovering over `x` ? I don't think AST contains 
> > > information regarding that one. 
> > > 
> > > for a code like this:
> > > ```
> > > auto foo = []() { return 5; };
> > > 
> > > template 
> > > class Cls {};
> > > 
> > > Cls X;
> > > ```
> > > 
> > > This is the AST dump for variable X:
> > > ```
> > > `-VarDecl 0x2b0e808  col:30 X 'Cls > > (decltype(foo))>':'Cls' callinit
> > >   `-CXXConstructExpr 0x2b12e80  'Cls > > (decltype(foo))>':'Cls' 'void () noexcept'
> > > ```
> > I'm talking about hovering over `b` and, as Sam mentioned, there's a good 
> > chance you don't have this information in the type and we need to look at 
> > `TypeLocs` instead.
> > 
> > Also agree with Sam, we don't want **any** complexity for that case. Just 
> > wanted to make sure we added a test like this just to make sure we have 
> > some idea of what's produced there and it does not crash.
> I see, but then I don't think this case has anything to do with current 
> patch, right?
> 
> It becomes a matter of decomposing a type with sugared components(which I 
> believe should be visited but not in this patch) rather than expanding a 
> lambda to a function like.
Sorry, I missed that we still have the `Type` field set which will contain all 
pointers/references.
We don't seem to loose any information in that case, it's really up to the 
presentation layer to figure it out. LG


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62814



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


r362812 - AST Matchers tutorial requests to enable clang-tools-extra. NFC

2019-06-07 Thread Ilya Biryukov via cfe-commits
Author: ibiryukov
Date: Fri Jun  7 09:31:06 2019
New Revision: 362812

URL: http://llvm.org/viewvc/llvm-project?rev=362812=rev
Log:
AST Matchers tutorial requests to enable clang-tools-extra. NFC

Otherwise the examples do not build.

Modified:
cfe/trunk/docs/LibASTMatchersTutorial.rst

Modified: cfe/trunk/docs/LibASTMatchersTutorial.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersTutorial.rst?rev=362812=362811=362812=diff
==
--- cfe/trunk/docs/LibASTMatchersTutorial.rst (original)
+++ cfe/trunk/docs/LibASTMatchersTutorial.rst Fri Jun  7 09:31:06 2019
@@ -50,7 +50,7 @@ Okay. Now we'll build Clang!
 
   cd ~/clang-llvm
   mkdir build && cd build
-  cmake -G Ninja ../llvm -DLLVM_ENABLE_PROJECTS=clang 
-DLLVM_BUILD_TESTS=ON  # Enable tests; default is off.
+  cmake -G Ninja ../llvm -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" 
-DLLVM_BUILD_TESTS=ON  # Enable tests; default is off.
   ninja
   ninja check   # Test LLVM only.
   ninja clang-test  # Test Clang only.


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


[PATCH] D62999: [clangd] Return empty results on spurious completion triggers

2019-06-07 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL362811: [clangd] Return empty results on spurious completion 
triggers (authored by ibiryukov, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D62999?vs=203567=203572#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62999

Files:
  clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
  clang-tools-extra/trunk/clangd/test/completion-auto-trigger.test


Index: clang-tools-extra/trunk/clangd/test/completion-auto-trigger.test
===
--- clang-tools-extra/trunk/clangd/test/completion-auto-trigger.test
+++ clang-tools-extra/trunk/clangd/test/completion-auto-trigger.test
@@ -4,11 +4,12 @@
 
{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"namespace
 ns { int ns_member; } struct vector { int size; static int default_capacity; 
};\nvoid test(vector *a, vector *b) {\n  if (a > b) {} \n  a->size = 10;\n\n  a 
? a : b;\n  ns::ns_member = 10;\n}"}}}
 ---
 
{"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":2,"character":9},"context":{"triggerKind":2,"triggerCharacter":">"}}}
-#  CHECK:  "error": {
-# CHECK-NEXT:"code": -32001,
-# CHECK-NEXT:"message": "ignored auto-triggered completion, preceding char 
did not match"
-# CHECK-NEXT:  },
-# CHECK-NEXT:  "id": 1,
+#  CHECK:  "id": 1,
+# CHECK-NEXT:  "jsonrpc": "2.0"
+# CHECK-NEXT:  "result": {
+# CHECK-NEXT:"isIncomplete": false,
+# CHECK-NEXT:"items": []
+# CHECK-NEXT:  }
 ---
 
{"jsonrpc":"2.0","id":2,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":3,"character":5},"context":{"triggerKind":2,"triggerCharacter":">"}}}
 #  CHECK:  "id": 2,
@@ -64,11 +65,12 @@
 # CHECK-NEXT:   }
 ---
 
{"jsonrpc":"2.0","id":3,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":5,"character":9},"context":{"triggerKind":2,"triggerCharacter":":"}}}
-#  CHECK:  "error": {
-# CHECK-NEXT:"code": -32001,
-# CHECK-NEXT:"message": "ignored auto-triggered completion, preceding char 
did not match"
-# CHECK-NEXT:  },
-# CHECK-NEXT:  "id": 3,
+#  CHECK:  "id": 3,
+# CHECK-NEXT:  "jsonrpc": "2.0",
+# CHECK-NEXT:  "result": {
+# CHECK-NEXT:"isIncomplete": false,
+# CHECK-NEXT:"items": []
+# CHECK-NEXT:  }
 ---
 
{"jsonrpc":"2.0","id":4,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":6,"character":6},"context":{"triggerKind":2,"triggerCharacter":":"}}}
 ---
Index: clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
===
--- clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
@@ -25,16 +25,6 @@
 namespace clang {
 namespace clangd {
 namespace {
-class IgnoreCompletionError : public llvm::ErrorInfo {
-public:
-  void log(llvm::raw_ostream ) const override {
-OS << "ignored auto-triggered completion, preceding char did not match";
-  }
-  std::error_code convertToErrorCode() const override {
-return std::make_error_code(std::errc::operation_canceled);
-  }
-};
-
 /// Transforms a tweak into a code action that would apply it if executed.
 /// EXPECTS: T.prepare() was called and returned true.
 CodeAction toCodeAction(const ClangdServer::TweakRef , const URIForFile 
,
@@ -738,8 +728,12 @@
 
 void ClangdLSPServer::onCompletion(const CompletionParams ,
Callback Reply) {
-  if (!shouldRunCompletion(Params))
-return Reply(llvm::make_error());
+  if (!shouldRunCompletion(Params)) {
+// Clients sometimes auto-trigger completions in undesired places (e.g.
+// 'a >^ '), we return empty results in those cases.
+vlog("ignored auto-triggered completion, preceding char did not match");
+return Reply(CompletionList());
+  }
   Server->codeComplete(Params.textDocument.uri.file(), Params.position, CCOpts,
Bind(
[this](decltype(Reply) Reply,


Index: clang-tools-extra/trunk/clangd/test/completion-auto-trigger.test
===
--- clang-tools-extra/trunk/clangd/test/completion-auto-trigger.test
+++ clang-tools-extra/trunk/clangd/test/completion-auto-trigger.test
@@ -4,11 +4,12 @@
 {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"namespace ns { int ns_member; } struct vector { int size; static int default_capacity; };\nvoid test(vector *a, vector *b) {\n  if (a 

[clang-tools-extra] r362811 - [clangd] Return empty results on spurious completion triggers

2019-06-07 Thread Ilya Biryukov via cfe-commits
Author: ibiryukov
Date: Fri Jun  7 09:24:38 2019
New Revision: 362811

URL: http://llvm.org/viewvc/llvm-project?rev=362811=rev
Log:
[clangd] Return empty results on spurious completion triggers

Summary:
We currently return an error, this causes `coc.nvim` and VSCode to
show an error message in the logs.

Returning empty list of completions allows to avod the error message
without altering other user-visible behavior.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

Modified:
clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
clang-tools-extra/trunk/clangd/test/completion-auto-trigger.test

Modified: clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp?rev=362811=362810=362811=diff
==
--- clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp Fri Jun  7 09:24:38 2019
@@ -25,16 +25,6 @@
 namespace clang {
 namespace clangd {
 namespace {
-class IgnoreCompletionError : public llvm::ErrorInfo {
-public:
-  void log(llvm::raw_ostream ) const override {
-OS << "ignored auto-triggered completion, preceding char did not match";
-  }
-  std::error_code convertToErrorCode() const override {
-return std::make_error_code(std::errc::operation_canceled);
-  }
-};
-
 /// Transforms a tweak into a code action that would apply it if executed.
 /// EXPECTS: T.prepare() was called and returned true.
 CodeAction toCodeAction(const ClangdServer::TweakRef , const URIForFile 
,
@@ -738,8 +728,12 @@ void ClangdLSPServer::onCodeAction(const
 
 void ClangdLSPServer::onCompletion(const CompletionParams ,
Callback Reply) {
-  if (!shouldRunCompletion(Params))
-return Reply(llvm::make_error());
+  if (!shouldRunCompletion(Params)) {
+// Clients sometimes auto-trigger completions in undesired places (e.g.
+// 'a >^ '), we return empty results in those cases.
+vlog("ignored auto-triggered completion, preceding char did not match");
+return Reply(CompletionList());
+  }
   Server->codeComplete(Params.textDocument.uri.file(), Params.position, CCOpts,
Bind(
[this](decltype(Reply) Reply,

Modified: clang-tools-extra/trunk/clangd/test/completion-auto-trigger.test
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/test/completion-auto-trigger.test?rev=362811=362810=362811=diff
==
--- clang-tools-extra/trunk/clangd/test/completion-auto-trigger.test (original)
+++ clang-tools-extra/trunk/clangd/test/completion-auto-trigger.test Fri Jun  7 
09:24:38 2019
@@ -4,11 +4,12 @@
 
{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"namespace
 ns { int ns_member; } struct vector { int size; static int default_capacity; 
};\nvoid test(vector *a, vector *b) {\n  if (a > b) {} \n  a->size = 10;\n\n  a 
? a : b;\n  ns::ns_member = 10;\n}"}}}
 ---
 
{"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":2,"character":9},"context":{"triggerKind":2,"triggerCharacter":">"}}}
-#  CHECK:  "error": {
-# CHECK-NEXT:"code": -32001,
-# CHECK-NEXT:"message": "ignored auto-triggered completion, preceding char 
did not match"
-# CHECK-NEXT:  },
-# CHECK-NEXT:  "id": 1,
+#  CHECK:  "id": 1,
+# CHECK-NEXT:  "jsonrpc": "2.0"
+# CHECK-NEXT:  "result": {
+# CHECK-NEXT:"isIncomplete": false,
+# CHECK-NEXT:"items": []
+# CHECK-NEXT:  }
 ---
 
{"jsonrpc":"2.0","id":2,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":3,"character":5},"context":{"triggerKind":2,"triggerCharacter":">"}}}
 #  CHECK:  "id": 2,
@@ -64,11 +65,12 @@
 # CHECK-NEXT:   }
 ---
 
{"jsonrpc":"2.0","id":3,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":5,"character":9},"context":{"triggerKind":2,"triggerCharacter":":"}}}
-#  CHECK:  "error": {
-# CHECK-NEXT:"code": -32001,
-# CHECK-NEXT:"message": "ignored auto-triggered completion, preceding char 
did not match"
-# CHECK-NEXT:  },
-# CHECK-NEXT:  "id": 3,
+#  CHECK:  "id": 3,
+# CHECK-NEXT:  "jsonrpc": "2.0",
+# CHECK-NEXT:  "result": {
+# CHECK-NEXT:"isIncomplete": false,
+# CHECK-NEXT:"items": []
+# CHECK-NEXT:  }
 ---
 
{"jsonrpc":"2.0","id":4,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":6,"character":6},"context":{"triggerKind":2,"triggerCharacter":":"}}}
 ---



[PATCH] D62999: [clangd] Return empty results on spurious completion triggers

2019-06-07 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 203567.
ilya-biryukov added a comment.

- Return empty results instead of an error


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62999

Files:
  clang-tools-extra/clangd/ClangdLSPServer.cpp
  clang-tools-extra/clangd/test/completion-auto-trigger.test


Index: clang-tools-extra/clangd/test/completion-auto-trigger.test
===
--- clang-tools-extra/clangd/test/completion-auto-trigger.test
+++ clang-tools-extra/clangd/test/completion-auto-trigger.test
@@ -4,11 +4,12 @@
 
{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"namespace
 ns { int ns_member; } struct vector { int size; static int default_capacity; 
};\nvoid test(vector *a, vector *b) {\n  if (a > b) {} \n  a->size = 10;\n\n  a 
? a : b;\n  ns::ns_member = 10;\n}"}}}
 ---
 
{"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":2,"character":9},"context":{"triggerKind":2,"triggerCharacter":">"}}}
-#  CHECK:  "error": {
-# CHECK-NEXT:"code": -32001,
-# CHECK-NEXT:"message": "ignored auto-triggered completion, preceding char 
did not match"
-# CHECK-NEXT:  },
-# CHECK-NEXT:  "id": 1,
+#  CHECK:  "id": 1,
+# CHECK-NEXT:  "jsonrpc": "2.0"
+# CHECK-NEXT:  "result": {
+# CHECK-NEXT:"isIncomplete": false,
+# CHECK-NEXT:"items": []
+# CHECK-NEXT:  }
 ---
 
{"jsonrpc":"2.0","id":2,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":3,"character":5},"context":{"triggerKind":2,"triggerCharacter":">"}}}
 #  CHECK:  "id": 2,
@@ -64,11 +65,12 @@
 # CHECK-NEXT:   }
 ---
 
{"jsonrpc":"2.0","id":3,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":5,"character":9},"context":{"triggerKind":2,"triggerCharacter":":"}}}
-#  CHECK:  "error": {
-# CHECK-NEXT:"code": -32001,
-# CHECK-NEXT:"message": "ignored auto-triggered completion, preceding char 
did not match"
-# CHECK-NEXT:  },
-# CHECK-NEXT:  "id": 3,
+#  CHECK:  "id": 3,
+# CHECK-NEXT:  "jsonrpc": "2.0",
+# CHECK-NEXT:  "result": {
+# CHECK-NEXT:"isIncomplete": false,
+# CHECK-NEXT:"items": []
+# CHECK-NEXT:  }
 ---
 
{"jsonrpc":"2.0","id":4,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":6,"character":6},"context":{"triggerKind":2,"triggerCharacter":":"}}}
 ---
Index: clang-tools-extra/clangd/ClangdLSPServer.cpp
===
--- clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -25,16 +25,6 @@
 namespace clang {
 namespace clangd {
 namespace {
-class IgnoreCompletionError : public llvm::ErrorInfo {
-public:
-  void log(llvm::raw_ostream ) const override {
-OS << "ignored auto-triggered completion, preceding char did not match";
-  }
-  std::error_code convertToErrorCode() const override {
-return std::make_error_code(std::errc::operation_canceled);
-  }
-};
-
 /// Transforms a tweak into a code action that would apply it if executed.
 /// EXPECTS: T.prepare() was called and returned true.
 CodeAction toCodeAction(const ClangdServer::TweakRef , const URIForFile 
,
@@ -738,8 +728,12 @@
 
 void ClangdLSPServer::onCompletion(const CompletionParams ,
Callback Reply) {
-  if (!shouldRunCompletion(Params))
-return Reply(llvm::make_error());
+  if (!shouldRunCompletion(Params)) {
+// Clients sometimes auto-trigger completions in undesired places (e.g.
+// 'a >^ '), we return empty results in those cases.
+vlog("ignored auto-triggered completion, preceding char did not match");
+return Reply(CompletionList());
+  }
   Server->codeComplete(Params.textDocument.uri.file(), Params.position, CCOpts,
Bind(
[this](decltype(Reply) Reply,


Index: clang-tools-extra/clangd/test/completion-auto-trigger.test
===
--- clang-tools-extra/clangd/test/completion-auto-trigger.test
+++ clang-tools-extra/clangd/test/completion-auto-trigger.test
@@ -4,11 +4,12 @@
 {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"namespace ns { int ns_member; } struct vector { int size; static int default_capacity; };\nvoid test(vector *a, vector *b) {\n  if (a > b) {} \n  a->size = 10;\n\n  a ? a : b;\n  ns::ns_member = 10;\n}"}}}
 ---
 {"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":2,"character":9},"context":{"triggerKind":2,"triggerCharacter":">"}}}

[PATCH] D62999: [clangd] Return empty results on spurious completion triggers

2019-06-07 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov marked 2 inline comments as done.
ilya-biryukov added inline comments.



Comment at: clang-tools-extra/clangd/ClangdLSPServer.cpp:734
+"ignored auto-triggered completion, preceding char did not match",
+ErrorCode::RequestCancelled));
   Server->codeComplete(Params.textDocument.uri.file(), Params.position, CCOpts,

sammccall wrote:
> this error code seems bogus, we should have a comment explaining that 
> returning and empty list breaks vscode and any other error code breaks 
> coc.nvim.
> 
> (Might want to file a vscode or LSP bug - trigger char is a heuristic, if [] 
> isn't the preferred way for a server to say "no" then we should spell it out, 
> if it is then vscode is wrong)
Returning empty completion results seems to work just fine.
Added a comment anyway, but I don't think we need an LSP bug for this, 
returning empty results seems less cheesy than a 'request cancelled' error.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62999



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


[PATCH] D63009: [OpenMP] Add target task alloc function with device ID

2019-06-07 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea created this revision.
gtbercea added reviewers: ABataev, AlexEichenberger, caomhin.
Herald added subscribers: cfe-commits, jdoerfert, guansong.
Herald added a project: clang.

Add a new call to Clang to perform task allocation for the target.


Repository:
  rC Clang

https://reviews.llvm.org/D63009

Files:
  lib/CodeGen/CGOpenMPRuntime.cpp


Index: lib/CodeGen/CGOpenMPRuntime.cpp
===
--- lib/CodeGen/CGOpenMPRuntime.cpp
+++ lib/CodeGen/CGOpenMPRuntime.cpp
@@ -604,6 +604,11 @@
   // kmp_int32 flags, size_t sizeof_kmp_task_t, size_t sizeof_shareds,
   // kmp_routine_entry_t *task_entry);
   OMPRTL__kmpc_omp_task_alloc,
+  // Call to kmp_task_t * __kmpc_omp_target_task_alloc(ident_t *,
+  // kmp_int32 gtid, kmp_int32 flags, size_t sizeof_kmp_task_t,
+  // size_t sizeof_shareds, kmp_routine_entry_t *task_entry,
+  // size_t device_id);
+  OMPRTL__kmpc_omp_target_task_alloc,
   // Call to kmp_int32 __kmpc_omp_task(ident_t *, kmp_int32 gtid, kmp_task_t *
   // new_task);
   OMPRTL__kmpc_omp_task,
@@ -1912,6 +1917,21 @@
 RTLFn = CGM.CreateRuntimeFunction(FnTy, /*Name=*/"__kmpc_omp_task_alloc");
 break;
   }
+  case OMPRTL__kmpc_omp_target_task_alloc: {
+// Build kmp_task_t *__kmpc_omp_task_alloc(ident_t *, kmp_int32 gtid,
+// kmp_int32 flags, size_t sizeof_kmp_task_t, size_t sizeof_shareds,
+// kmp_routine_entry_t *task_entry, size_t device_id);
+assert(KmpRoutineEntryPtrTy != nullptr &&
+   "Type kmp_routine_entry_t must be created.");
+llvm::Type *TypeParams[] = {getIdentTyPointerTy(), CGM.Int32Ty, 
CGM.Int32Ty,
+CGM.SizeTy, CGM.SizeTy, KmpRoutineEntryPtrTy,
+CGM.SizeTy};
+// Return void * and then cast to particular kmp_task_t type.
+auto *FnTy =
+llvm::FunctionType::get(CGM.VoidPtrTy, TypeParams, /*isVarArg=*/false);
+RTLFn = CGM.CreateRuntimeFunction(FnTy, 
/*Name=*/"__kmpc_omp_target_task_alloc");
+break;
+  }
   case OMPRTL__kmpc_omp_task: {
 // Build kmp_int32 __kmpc_omp_task(ident_t *, kmp_int32 gtid, kmp_task_t
 // *new_task);


Index: lib/CodeGen/CGOpenMPRuntime.cpp
===
--- lib/CodeGen/CGOpenMPRuntime.cpp
+++ lib/CodeGen/CGOpenMPRuntime.cpp
@@ -604,6 +604,11 @@
   // kmp_int32 flags, size_t sizeof_kmp_task_t, size_t sizeof_shareds,
   // kmp_routine_entry_t *task_entry);
   OMPRTL__kmpc_omp_task_alloc,
+  // Call to kmp_task_t * __kmpc_omp_target_task_alloc(ident_t *,
+  // kmp_int32 gtid, kmp_int32 flags, size_t sizeof_kmp_task_t,
+  // size_t sizeof_shareds, kmp_routine_entry_t *task_entry,
+  // size_t device_id);
+  OMPRTL__kmpc_omp_target_task_alloc,
   // Call to kmp_int32 __kmpc_omp_task(ident_t *, kmp_int32 gtid, kmp_task_t *
   // new_task);
   OMPRTL__kmpc_omp_task,
@@ -1912,6 +1917,21 @@
 RTLFn = CGM.CreateRuntimeFunction(FnTy, /*Name=*/"__kmpc_omp_task_alloc");
 break;
   }
+  case OMPRTL__kmpc_omp_target_task_alloc: {
+// Build kmp_task_t *__kmpc_omp_task_alloc(ident_t *, kmp_int32 gtid,
+// kmp_int32 flags, size_t sizeof_kmp_task_t, size_t sizeof_shareds,
+// kmp_routine_entry_t *task_entry, size_t device_id);
+assert(KmpRoutineEntryPtrTy != nullptr &&
+   "Type kmp_routine_entry_t must be created.");
+llvm::Type *TypeParams[] = {getIdentTyPointerTy(), CGM.Int32Ty, CGM.Int32Ty,
+CGM.SizeTy, CGM.SizeTy, KmpRoutineEntryPtrTy,
+CGM.SizeTy};
+// Return void * and then cast to particular kmp_task_t type.
+auto *FnTy =
+llvm::FunctionType::get(CGM.VoidPtrTy, TypeParams, /*isVarArg=*/false);
+RTLFn = CGM.CreateRuntimeFunction(FnTy, /*Name=*/"__kmpc_omp_target_task_alloc");
+break;
+  }
   case OMPRTL__kmpc_omp_task: {
 // Build kmp_int32 __kmpc_omp_task(ident_t *, kmp_int32 gtid, kmp_task_t
 // *new_task);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D62533: Build with _XOPEN_SOURCE defined on AIX

2019-06-07 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL362808: Build with _XOPEN_SOURCE defined on AIX (authored by 
daltenty, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D62533?vs=202822=203563#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62533

Files:
  cfe/trunk/tools/libclang/CMakeLists.txt
  llvm/trunk/CMakeLists.txt
  llvm/trunk/cmake/config-ix.cmake
  llvm/trunk/utils/unittest/CMakeLists.txt


Index: llvm/trunk/cmake/config-ix.cmake
===
--- llvm/trunk/cmake/config-ix.cmake
+++ llvm/trunk/cmake/config-ix.cmake
@@ -23,6 +23,13 @@
   list(APPEND CMAKE_REQUIRED_LIBRARIES "cxxrt")
 endif()
 
+# Do checks with _XOPEN_SOURCE and large-file API on AIX, because we will build
+# with those too.
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700")
+  list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_LARGE_FILE_API")
+endif()
+
 # include checks
 check_include_file(dlfcn.h HAVE_DLFCN_H)
 check_include_file(errno.h HAVE_ERRNO_H)
Index: llvm/trunk/CMakeLists.txt
===
--- llvm/trunk/CMakeLists.txt
+++ llvm/trunk/CMakeLists.txt
@@ -819,6 +819,13 @@
 "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-lto_library -Wl,${DARWIN_LTO_LIBRARY}")
 endif()
 
+# Build with _XOPEN_SOURCE on AIX, as stray macros in _ALL_SOURCE mode tend to
+# break things. In this case we need to enable the large-file API as well.
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  add_definitions("-D_XOPEN_SOURCE=700")
+  add_definitions("-D_LARGE_FILE_API")
+endif()
+
 # Work around a broken bfd ld behavior. When linking a binary with a
 # foo.so library, it will try to find any library that foo.so uses and
 # check its symbols. This is wasteful (the check was done when foo.so
Index: llvm/trunk/utils/unittest/CMakeLists.txt
===
--- llvm/trunk/utils/unittest/CMakeLists.txt
+++ llvm/trunk/utils/unittest/CMakeLists.txt
@@ -28,6 +28,12 @@
   add_definitions(-DGTEST_OS_WINDOWS=1)
 endif()
 
+# Google Test requires headers which need _ALL_SOURCE to build on AIX
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  remove_definitions("-D_XOPEN_SOURCE=700")
+  add_definitions("-D_ALL_SOURCE")
+endif()
+
 if(SUPPORTS_VARIADIC_MACROS_FLAG)
   add_definitions("-Wno-variadic-macros")
 endif()
Index: cfe/trunk/tools/libclang/CMakeLists.txt
===
--- cfe/trunk/tools/libclang/CMakeLists.txt
+++ cfe/trunk/tools/libclang/CMakeLists.txt
@@ -89,6 +89,11 @@
   set(output_name "clang")
 endif()
 
+# libclang requires headers which need _ALL_SOURCE to build on AIX
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+remove_definitions("-D_XOPEN_SOURCE=700")
+endif()
+
 add_clang_library(libclang ${ENABLE_SHARED} ${ENABLE_STATIC}
   OUTPUT_NAME ${output_name}
   ${SOURCES}


Index: llvm/trunk/cmake/config-ix.cmake
===
--- llvm/trunk/cmake/config-ix.cmake
+++ llvm/trunk/cmake/config-ix.cmake
@@ -23,6 +23,13 @@
   list(APPEND CMAKE_REQUIRED_LIBRARIES "cxxrt")
 endif()
 
+# Do checks with _XOPEN_SOURCE and large-file API on AIX, because we will build
+# with those too.
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700")
+  list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_LARGE_FILE_API")
+endif()
+
 # include checks
 check_include_file(dlfcn.h HAVE_DLFCN_H)
 check_include_file(errno.h HAVE_ERRNO_H)
Index: llvm/trunk/CMakeLists.txt
===
--- llvm/trunk/CMakeLists.txt
+++ llvm/trunk/CMakeLists.txt
@@ -819,6 +819,13 @@
 "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-lto_library -Wl,${DARWIN_LTO_LIBRARY}")
 endif()
 
+# Build with _XOPEN_SOURCE on AIX, as stray macros in _ALL_SOURCE mode tend to
+# break things. In this case we need to enable the large-file API as well.
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  add_definitions("-D_XOPEN_SOURCE=700")
+  add_definitions("-D_LARGE_FILE_API")
+endif()
+
 # Work around a broken bfd ld behavior. When linking a binary with a
 # foo.so library, it will try to find any library that foo.so uses and
 # check its symbols. This is wasteful (the check was done when foo.so
Index: llvm/trunk/utils/unittest/CMakeLists.txt
===
--- llvm/trunk/utils/unittest/CMakeLists.txt
+++ llvm/trunk/utils/unittest/CMakeLists.txt
@@ -28,6 +28,12 @@
   add_definitions(-DGTEST_OS_WINDOWS=1)
 endif()
 
+# Google Test requires headers which need _ALL_SOURCE to build on AIX
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES 

[PATCH] D60710: [ARM] Add ACLE feature macros for MVE.

2019-06-07 Thread Sjoerd Meijer via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL362806: [ARM] Add ACLE feature macros for MVE (authored by 
SjoerdMeijer, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D60710?vs=203555=203561#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D60710

Files:
  cfe/trunk/lib/Basic/Targets/ARM.cpp
  cfe/trunk/lib/Basic/Targets/ARM.h
  cfe/trunk/test/Preprocessor/arm-target-features.c

Index: cfe/trunk/test/Preprocessor/arm-target-features.c
===
--- cfe/trunk/test/Preprocessor/arm-target-features.c
+++ cfe/trunk/test/Preprocessor/arm-target-features.c
@@ -748,6 +748,27 @@
 // KRAIT-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
 // KRAIT-ALLOW-FP-INSTR:#define  __ARM_VFPV4__ 1
 
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81M %s
+// CHECK-V81M: #define __ARM_ARCH 8
+// CHECK-V81M: #define __ARM_ARCH_8_1M_MAIN__ 1
+// CHECK-V81M: #define __ARM_ARCH_ISA_THUMB 2
+// CHECK-V81M: #define __ARM_ARCH_PROFILE 'M'
+// CHECK-V81M-NOT: #define __ARM_FEATURE_DSP
+// CHECK-V81M-NOT: #define __ARM_FEATURE_MVE
+// CHECK-V81M-NOT: #define __ARM_FEATURE_SIMD32
+
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81M-MVE %s
+// CHECK-V81M-MVE: #define __ARM_FEATURE_DSP 1
+// CHECK-V81M-MVE: #define __ARM_FEATURE_MVE 1
+// CHECK-V81M-MVE: #define __ARM_FEATURE_SIMD32 1
+
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve.fp -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81M-MVE-FP %s
+// CHECK-V81M-MVE-FP: #define __ARM_FEATURE_DSP 1
+// CHECK-V81M-MVE-FP: #define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC 1
+// CHECK-V81M-MVE-FP: #define __ARM_FEATURE_MVE 3
+// CHECK-V81M-MVE-FP: #define __ARM_FEATURE_SIMD32 1
+// CHECK-V81M-MVE-FP: #define __ARM_FPV5__ 1
+
 // RUN: %clang -target armv8.1a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81A %s
 // CHECK-V81A: #define __ARM_ARCH 8
 // CHECK-V81A: #define __ARM_ARCH_8_1A__ 1
Index: cfe/trunk/lib/Basic/Targets/ARM.h
===
--- cfe/trunk/lib/Basic/Targets/ARM.h
+++ cfe/trunk/lib/Basic/Targets/ARM.h
@@ -33,6 +33,11 @@
 FPARMV8 = (1 << 4)
   };
 
+  enum MVEMode {
+  MVE_INT = (1 << 0),
+  MVE_FP  = (1 << 1)
+  };
+
   // Possible HWDiv features.
   enum HWDivMode { HWDivThumb = (1 << 0), HWDivARM = (1 << 1) };
 
@@ -56,6 +61,7 @@
   unsigned ArchVersion;
 
   unsigned FPU : 5;
+  unsigned MVE : 2;
 
   unsigned IsAAPCS : 1;
   unsigned HWDiv : 2;
@@ -100,6 +106,8 @@
   bool isThumb() const;
   bool supportsThumb() const;
   bool supportsThumb2() const;
+  bool hasMVE() const;
+  bool hasMVEFloat() const;
 
   StringRef getCPUAttr() const;
   StringRef getCPUProfile() const;
Index: cfe/trunk/lib/Basic/Targets/ARM.cpp
===
--- cfe/trunk/lib/Basic/Targets/ARM.cpp
+++ cfe/trunk/lib/Basic/Targets/ARM.cpp
@@ -146,6 +146,14 @@
   }
 }
 
+bool ARMTargetInfo::hasMVE() const {
+  return ArchKind == llvm::ARM::ArchKind::ARMV8_1MMainline && MVE != 0;
+}
+
+bool ARMTargetInfo::hasMVEFloat() const {
+  return hasMVE() && (MVE & MVE_FP);
+}
+
 bool ARMTargetInfo::isThumb() const {
   return ArchISA == llvm::ARM::ISAKind::THUMB;
 }
@@ -460,6 +468,15 @@
   HasLegalHalfType = true;
 } else if (Feature == "+dotprod") {
   DotProd = true;
+} else if (Feature == "+mve") {
+  DSP = 1;
+  MVE |= MVE_INT;
+} else if (Feature == "+mve.fp") {
+  DSP = 1;
+  HasLegalHalfType = true;
+  FPU |= FPARMV8;
+  MVE |= MVE_INT | MVE_FP;
+  HW_FP |= HW_FP_SP | HW_FP_HP;
 }
   }
 
@@ -510,6 +527,7 @@
   .Case("vfp", FPU && !SoftFloat)
   .Case("hwdiv", HWDiv & HWDivThumb)
   .Case("hwdiv-arm", HWDiv & HWDivARM)
+  .Case("mve", hasMVE())
   .Default(false);
 }
 
@@ -725,6 +743,10 @@
 "0x" + Twine::utohexstr(HW_FP & ~HW_FP_DP));
   }
 
+  if (hasMVE()) {
+Builder.defineMacro("__ARM_FEATURE_MVE", hasMVEFloat() ? "3" : "1");
+  }
+
   Builder.defineMacro("__ARM_SIZEOF_WCHAR_T",
   Twine(Opts.WCharSize ? Opts.WCharSize : 4));
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r362806 - [ARM] Add ACLE feature macros for MVE

2019-06-07 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Fri Jun  7 08:20:56 2019
New Revision: 362806

URL: http://llvm.org/viewvc/llvm-project?rev=362806=rev
Log:
[ARM] Add ACLE feature macros for MVE

If MVE is present at all, then the macro __ARM_FEATURE_MVE is defined
to a value which has bit 0 set for integer MVE, and bit 1 set for
floating-point MVE.

(Floating-point MVE implies integer MVE, so if this macro is defined
at all then it will be set to 1 or 3, never 2.)

Patch mostly by Simon Tatham

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

Modified:
cfe/trunk/lib/Basic/Targets/ARM.cpp
cfe/trunk/lib/Basic/Targets/ARM.h
cfe/trunk/test/Preprocessor/arm-target-features.c

Modified: cfe/trunk/lib/Basic/Targets/ARM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/ARM.cpp?rev=362806=362805=362806=diff
==
--- cfe/trunk/lib/Basic/Targets/ARM.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/ARM.cpp Fri Jun  7 08:20:56 2019
@@ -146,6 +146,14 @@ void ARMTargetInfo::setAtomic() {
   }
 }
 
+bool ARMTargetInfo::hasMVE() const {
+  return ArchKind == llvm::ARM::ArchKind::ARMV8_1MMainline && MVE != 0;
+}
+
+bool ARMTargetInfo::hasMVEFloat() const {
+  return hasMVE() && (MVE & MVE_FP);
+}
+
 bool ARMTargetInfo::isThumb() const {
   return ArchISA == llvm::ARM::ISAKind::THUMB;
 }
@@ -460,6 +468,15 @@ bool ARMTargetInfo::handleTargetFeatures
   HasLegalHalfType = true;
 } else if (Feature == "+dotprod") {
   DotProd = true;
+} else if (Feature == "+mve") {
+  DSP = 1;
+  MVE |= MVE_INT;
+} else if (Feature == "+mve.fp") {
+  DSP = 1;
+  HasLegalHalfType = true;
+  FPU |= FPARMV8;
+  MVE |= MVE_INT | MVE_FP;
+  HW_FP |= HW_FP_SP | HW_FP_HP;
 }
   }
 
@@ -510,6 +527,7 @@ bool ARMTargetInfo::hasFeature(StringRef
   .Case("vfp", FPU && !SoftFloat)
   .Case("hwdiv", HWDiv & HWDivThumb)
   .Case("hwdiv-arm", HWDiv & HWDivARM)
+  .Case("mve", hasMVE())
   .Default(false);
 }
 
@@ -725,6 +743,10 @@ void ARMTargetInfo::getTargetDefines(con
 "0x" + Twine::utohexstr(HW_FP & ~HW_FP_DP));
   }
 
+  if (hasMVE()) {
+Builder.defineMacro("__ARM_FEATURE_MVE", hasMVEFloat() ? "3" : "1");
+  }
+
   Builder.defineMacro("__ARM_SIZEOF_WCHAR_T",
   Twine(Opts.WCharSize ? Opts.WCharSize : 4));
 

Modified: cfe/trunk/lib/Basic/Targets/ARM.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/ARM.h?rev=362806=362805=362806=diff
==
--- cfe/trunk/lib/Basic/Targets/ARM.h (original)
+++ cfe/trunk/lib/Basic/Targets/ARM.h Fri Jun  7 08:20:56 2019
@@ -33,6 +33,11 @@ class LLVM_LIBRARY_VISIBILITY ARMTargetI
 FPARMV8 = (1 << 4)
   };
 
+  enum MVEMode {
+  MVE_INT = (1 << 0),
+  MVE_FP  = (1 << 1)
+  };
+
   // Possible HWDiv features.
   enum HWDivMode { HWDivThumb = (1 << 0), HWDivARM = (1 << 1) };
 
@@ -56,6 +61,7 @@ class LLVM_LIBRARY_VISIBILITY ARMTargetI
   unsigned ArchVersion;
 
   unsigned FPU : 5;
+  unsigned MVE : 2;
 
   unsigned IsAAPCS : 1;
   unsigned HWDiv : 2;
@@ -100,6 +106,8 @@ class LLVM_LIBRARY_VISIBILITY ARMTargetI
   bool isThumb() const;
   bool supportsThumb() const;
   bool supportsThumb2() const;
+  bool hasMVE() const;
+  bool hasMVEFloat() const;
 
   StringRef getCPUAttr() const;
   StringRef getCPUProfile() const;

Modified: cfe/trunk/test/Preprocessor/arm-target-features.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/arm-target-features.c?rev=362806=362805=362806=diff
==
--- cfe/trunk/test/Preprocessor/arm-target-features.c (original)
+++ cfe/trunk/test/Preprocessor/arm-target-features.c Fri Jun  7 08:20:56 2019
@@ -748,6 +748,27 @@
 // KRAIT-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
 // KRAIT-ALLOW-FP-INSTR:#define  __ARM_VFPV4__ 1
 
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main -x c -E -dM %s 
-o - | FileCheck -match-full-lines --check-prefix=CHECK-V81M %s
+// CHECK-V81M: #define __ARM_ARCH 8
+// CHECK-V81M: #define __ARM_ARCH_8_1M_MAIN__ 1
+// CHECK-V81M: #define __ARM_ARCH_ISA_THUMB 2
+// CHECK-V81M: #define __ARM_ARCH_PROFILE 'M'
+// CHECK-V81M-NOT: #define __ARM_FEATURE_DSP
+// CHECK-V81M-NOT: #define __ARM_FEATURE_MVE
+// CHECK-V81M-NOT: #define __ARM_FEATURE_SIMD32
+
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve -x c -E -dM 
%s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81M-MVE %s
+// CHECK-V81M-MVE: #define __ARM_FEATURE_DSP 1
+// CHECK-V81M-MVE: #define __ARM_FEATURE_MVE 1
+// CHECK-V81M-MVE: #define __ARM_FEATURE_SIMD32 1
+
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve.fp -x c -E 
-dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81M-MVE-FP %s
+// CHECK-V81M-MVE-FP: #define __ARM_FEATURE_DSP 1
+// 

[PATCH] D60710: [ARM] Add ACLE feature macros for MVE.

2019-06-07 Thread Sjoerd Meijer via Phabricator via cfe-commits
SjoerdMeijer added a comment.

Thanks for reviewing!


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

https://reviews.llvm.org/D60710



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


[PATCH] D62574: Initial draft of target-configurable address spaces.

2019-06-07 Thread Bevin Hansson via Phabricator via cfe-commits
ebevhan updated this revision to Diff 203559.
ebevhan added a comment.

Replaced `compatiblyIncludes` and its dependents with ASTContext accessors 
instead.


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

https://reviews.llvm.org/D62574

Files:
  include/clang/AST/ASTContext.h
  include/clang/AST/CanonicalType.h
  include/clang/AST/Type.h
  include/clang/Basic/TargetInfo.h
  lib/AST/ASTContext.cpp
  lib/Sema/SemaCast.cpp
  lib/Sema/SemaChecking.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaExceptionSpec.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaExprCXX.cpp
  lib/Sema/SemaFixItUtils.cpp
  lib/Sema/SemaInit.cpp
  lib/Sema/SemaOpenMP.cpp
  lib/Sema/SemaOverload.cpp
  lib/Sema/SemaTemplateDeduction.cpp
  test/Sema/address_space_print_macro.c
  test/Sema/address_spaces.c

Index: test/Sema/address_spaces.c
===
--- test/Sema/address_spaces.c
+++ test/Sema/address_spaces.c
@@ -71,7 +71,8 @@
 
 // Clang extension doesn't forbid operations on pointers to different address spaces.
 char* cmp(_AS1 char *x,  _AS2 char *y) {
-  return x < y ? x : y; // expected-error{{conditional operator with the second and third operands of type  ('_AS1 char *' and '_AS2 char *') which are pointers to non-overlapping address spaces}}
+  return x < y ? x : y; // expected-error{{conditional operator with the second and third operands of type  ('_AS1 char *' and '_AS2 char *') which are pointers to non-overlapping address spaces}} \
+// expected-error{{comparison between  ('_AS1 char *' and '_AS2 char *') which are pointers to non-overlapping address spaces}}
 }
 
 struct SomeStruct {
Index: test/Sema/address_space_print_macro.c
===
--- test/Sema/address_space_print_macro.c
+++ test/Sema/address_space_print_macro.c
@@ -14,7 +14,8 @@
 }
 
 char *cmp(AS1 char *x, AS2 char *y) {
-  return x < y ? x : y; // expected-error{{conditional operator with the second and third operands of type  ('AS1 char *' and 'AS2 char *') which are pointers to non-overlapping address spaces}}
+  return x < y ? x : y; // expected-error{{conditional operator with the second and third operands of type  ('AS1 char *' and 'AS2 char *') which are pointers to non-overlapping address spaces}} \
+// expected-error{{comparison between  ('AS1 char *' and 'AS2 char *') which are pointers to non-overlapping address spaces}}
 }
 
 __attribute__((address_space(1))) char test_array[10];
Index: lib/Sema/SemaTemplateDeduction.cpp
===
--- lib/Sema/SemaTemplateDeduction.cpp
+++ lib/Sema/SemaTemplateDeduction.cpp
@@ -1444,7 +1444,8 @@
   // C++ [temp.deduct.conv]p4:
   //   If the original A is a reference type, A can be more cv-qualified
   //   than the deduced A
-  if (!Arg.getQualifiers().compatiblyIncludes(Param.getQualifiers()))
+  if (!S.Context.compatiblyIncludes(Arg.getQualifiers(),
+Param.getQualifiers()))
 return Sema::TDK_NonDeducedMismatch;
 
   // Strip out all extra qualifiers from the argument to figure out the
@@ -3212,7 +3213,7 @@
 
 if (AQuals == DeducedAQuals) {
   // Qualifiers match; there's nothing to do.
-} else if (!DeducedAQuals.compatiblyIncludes(AQuals)) {
+} else if (!S.Context.compatiblyIncludes(DeducedAQuals, AQuals)) {
   return Failed();
 } else {
   // Qualifiers are compatible, so have the argument type adopt the
Index: lib/Sema/SemaOverload.cpp
===
--- lib/Sema/SemaOverload.cpp
+++ lib/Sema/SemaOverload.cpp
@@ -2394,7 +2394,7 @@
   if (TQs == Qs)
 return T;
 
-  if (Qs.compatiblyIncludes(TQs))
+  if (Context.compatiblyIncludes(Qs, TQs))
 return Context.getQualifiedType(T, Qs);
 
   return Context.getQualifiedType(T.getUnqualifiedType(), Qs);
@@ -2430,8 +2430,8 @@
   const ObjCInterfaceType* LHS = ToObjCPtr->getInterfaceType();
   const ObjCInterfaceType* RHS = FromObjCPtr->getInterfaceType();
   if (getLangOpts().CPlusPlus && LHS && RHS &&
-  !ToObjCPtr->getPointeeType().isAtLeastAsQualifiedAs(
-FromObjCPtr->getPointeeType()))
+  !Context.isAtLeastAsQualifiedAs(ToObjCPtr->getPointeeType(),
+  FromObjCPtr->getPointeeType()))
 return false;
   ConvertedType = BuildSimilarlyQualifiedPointerType(FromObjCPtr,
ToObjCPtr->getPointeeType(),
@@ -2617,7 +2617,7 @@
 
   // Make sure that we have compatible qualifiers.
   FromQuals.setObjCLifetime(Qualifiers::OCL_Autoreleasing);
-  if (!ToQuals.compatiblyIncludes(FromQuals))
+  if (!Context.compatiblyIncludes(ToQuals, FromQuals))
 return false;
 
   // Remove qualifiers from the pointee type we're 

[PATCH] D62574: Initial draft of target-configurable address spaces.

2019-06-07 Thread Bevin Hansson via Phabricator via cfe-commits
ebevhan added a comment.

>> I'll have to see if that's possible without breaking a few more interfaces, 
>> since you can throw around Qualifiers and check for compatibility without an 
>> ASTContext today.
>> 
>>> I was just thinking about testing the new logic. Should we add something 
>>> like  `-ffake-address-space-map` 
>>> (https://clang.llvm.org/docs/UsersManual.html#opencl-specific-options) that 
>>> will force targets to use some implementation of fake address space 
>>> conversions? It was quite useful in OpenCL before we added concrete targets 
>>> with address spaces. Alternatively, we can try to use SPIR that is a 
>>> generic Clang-only target that has address spaces.
>> 
>> Well, there are a couple targets which have target address spaces even 
>> today, I think. AMDGPU should be one, right?
> 
> Yes, however I am not sure we will be able to test more than what we test 
> with OpenCL. Also I am not sure AMD maintainer would be ok. Do you have any 
> concrete idea of what to test?

Well, since there is a mapping from the OpenCL address spaces to the AMDGPU 
target spaces, I would presume that if the target spaces were used on their own 
(via `__attribute__((address_space(1)))` for example) they should behave 
similarly to their OpenCL counterparts. It wouldn't have to be much, just a 
couple of type definitions and checks for implicit/explicit cast behavior.

There's also the x86 case I mentioned. I'm not really sure how that feature is 
used, though.


Repository:
  rC Clang

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

https://reviews.llvm.org/D62574



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


[PATCH] D60710: [ARM] Add ACLE feature macros for MVE.

2019-06-07 Thread Oliver Stannard (Linaro) via Phabricator via cfe-commits
ostannard accepted this revision.
ostannard added a comment.
This revision is now accepted and ready to land.

LGTM


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

https://reviews.llvm.org/D60710



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


[PATCH] D62696: AMDGPU: Use AMDGPU toolchain for other OSes

2019-06-07 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl accepted this revision.
yaxunl added a comment.
This revision is now accepted and ready to land.

LGTM


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

https://reviews.llvm.org/D62696



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


[PATCH] D60233: [clang-scan-deps] initial outline of the tool that runs preprocessor to find dependencies over a JSON compilation database

2019-06-07 Thread Alexandre Ganea via Phabricator via cfe-commits
aganea added inline comments.



Comment at: clang/test/ClangScanDeps/Inputs/regular_cdb.json:4
+  "directory": "DIR",
+  "command": "clang -c DIR/regular_cdb.cpp -IInputs -MD -MF DIR/regular_cdb.d",
+  "file": "DIR/regular_cdb.cpp"

Is `-MD -MF` required for clang-scan-deps to work? Can't we append those 
arguments automatically, so that only include paths are needed in the CDB?

Would it possible for the tool to produce a collated file? A real-world usage 
would otherwise produce tens of thousands of files. Which then would be 
opened/parsed by the calling application.



Comment at: clang/test/ClangScanDeps/regular_cdb.cpp:8
+// RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/regular_cdb.json > %t.cdb
+// RUN: clang-scan-deps -compilation-database %t.cdb -j 1
+// RUN: cat %t.dir/regular_cdb.d | FileCheck %s

Add a second test to excercice multi-threading? (by providing a few more files 
in the CDB)



Comment at: clang/tools/clang-scan-deps/ClangScanDeps.cpp:140
+int main(int argc, const char **argv) {
+  llvm::cl::ResetAllOptionOccurrences();
+  llvm::cl::HideUnrelatedOptions(DependencyScannerCategory);

`InitLLVM X(argc, argv);` is missing here to print callstacks in case of a 
crash, like the other tools.


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

https://reviews.llvm.org/D60233



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


[PATCH] D62569: [PowerPC] [Clang] Port SSE2 intrinsics to PowerPC

2019-06-07 Thread Jinsong Ji via Phabricator via cfe-commits
jsji accepted this revision.
jsji added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks for porting.


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

https://reviews.llvm.org/D62569



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


[PATCH] D60710: [ARM] Add ACLE feature macros for MVE.

2019-06-07 Thread Sjoerd Meijer via Phabricator via cfe-commits
SjoerdMeijer updated this revision to Diff 203555.
SjoerdMeijer added a comment.

Yep, sorry, missed that one.


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

https://reviews.llvm.org/D60710

Files:
  clang/lib/Basic/Targets/ARM.cpp
  clang/lib/Basic/Targets/ARM.h
  clang/test/Preprocessor/arm-target-features.c

Index: clang/test/Preprocessor/arm-target-features.c
===
--- clang/test/Preprocessor/arm-target-features.c
+++ clang/test/Preprocessor/arm-target-features.c
@@ -748,6 +748,27 @@
 // KRAIT-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
 // KRAIT-ALLOW-FP-INSTR:#define  __ARM_VFPV4__ 1
 
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81M %s
+// CHECK-V81M: #define __ARM_ARCH 8
+// CHECK-V81M: #define __ARM_ARCH_8_1M_MAIN__ 1
+// CHECK-V81M: #define __ARM_ARCH_ISA_THUMB 2
+// CHECK-V81M: #define __ARM_ARCH_PROFILE 'M'
+// CHECK-V81M-NOT: #define __ARM_FEATURE_DSP
+// CHECK-V81M-NOT: #define __ARM_FEATURE_MVE
+// CHECK-V81M-NOT: #define __ARM_FEATURE_SIMD32
+
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81M-MVE %s
+// CHECK-V81M-MVE: #define __ARM_FEATURE_DSP 1
+// CHECK-V81M-MVE: #define __ARM_FEATURE_MVE 1
+// CHECK-V81M-MVE: #define __ARM_FEATURE_SIMD32 1
+
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve.fp -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81M-MVE-FP %s
+// CHECK-V81M-MVE-FP: #define __ARM_FEATURE_DSP 1
+// CHECK-V81M-MVE-FP: #define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC 1
+// CHECK-V81M-MVE-FP: #define __ARM_FEATURE_MVE 3
+// CHECK-V81M-MVE-FP: #define __ARM_FEATURE_SIMD32 1
+// CHECK-V81M-MVE-FP: #define __ARM_FPV5__ 1
+
 // RUN: %clang -target armv8.1a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81A %s
 // CHECK-V81A: #define __ARM_ARCH 8
 // CHECK-V81A: #define __ARM_ARCH_8_1A__ 1
Index: clang/lib/Basic/Targets/ARM.h
===
--- clang/lib/Basic/Targets/ARM.h
+++ clang/lib/Basic/Targets/ARM.h
@@ -33,6 +33,11 @@
 FPARMV8 = (1 << 4)
   };
 
+  enum MVEMode {
+  MVE_INT = (1 << 0),
+  MVE_FP  = (1 << 1)
+  };
+
   // Possible HWDiv features.
   enum HWDivMode { HWDivThumb = (1 << 0), HWDivARM = (1 << 1) };
 
@@ -56,6 +61,7 @@
   unsigned ArchVersion;
 
   unsigned FPU : 5;
+  unsigned MVE : 2;
 
   unsigned IsAAPCS : 1;
   unsigned HWDiv : 2;
@@ -100,6 +106,8 @@
   bool isThumb() const;
   bool supportsThumb() const;
   bool supportsThumb2() const;
+  bool hasMVE() const;
+  bool hasMVEFloat() const;
 
   StringRef getCPUAttr() const;
   StringRef getCPUProfile() const;
Index: clang/lib/Basic/Targets/ARM.cpp
===
--- clang/lib/Basic/Targets/ARM.cpp
+++ clang/lib/Basic/Targets/ARM.cpp
@@ -146,6 +146,14 @@
   }
 }
 
+bool ARMTargetInfo::hasMVE() const {
+  return ArchKind == llvm::ARM::ArchKind::ARMV8_1MMainline && MVE != 0;
+}
+
+bool ARMTargetInfo::hasMVEFloat() const {
+  return hasMVE() && (MVE & MVE_FP);
+}
+
 bool ARMTargetInfo::isThumb() const {
   return ArchISA == llvm::ARM::ISAKind::THUMB;
 }
@@ -448,6 +456,15 @@
   HasLegalHalfType = true;
 } else if (Feature == "+dotprod") {
   DotProd = true;
+} else if (Feature == "+mve") {
+  DSP = 1;
+  MVE |= MVE_INT;
+} else if (Feature == "+mve.fp") {
+  DSP = 1;
+  HasLegalHalfType = true;
+  FPU |= FPARMV8;
+  MVE |= MVE_INT | MVE_FP;
+  HW_FP |= HW_FP_SP | HW_FP_HP;
 }
   }
 
@@ -498,6 +515,7 @@
   .Case("vfp", FPU && !SoftFloat)
   .Case("hwdiv", HWDiv & HWDivThumb)
   .Case("hwdiv-arm", HWDiv & HWDivARM)
+  .Case("mve", hasMVE())
   .Default(false);
 }
 
@@ -713,6 +731,10 @@
 "0x" + Twine::utohexstr(HW_FP & ~HW_FP_DP));
   }
 
+  if (hasMVE()) {
+Builder.defineMacro("__ARM_FEATURE_MVE", hasMVEFloat() ? "3" : "1");
+  }
+
   Builder.defineMacro("__ARM_SIZEOF_WCHAR_T",
   Twine(Opts.WCharSize ? Opts.WCharSize : 4));
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D62009: [clang] perform semantic checking in constant context

2019-06-07 Thread Tyker via Phabricator via cfe-commits
Tyker added a comment.

@rsmith ping.


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

https://reviews.llvm.org/D62009



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


[PATCH] D61790: [C++20] add Basic consteval specifier

2019-06-07 Thread Tyker via Phabricator via cfe-commits
Tyker updated this revision to Diff 203551.
Tyker marked 9 inline comments as done.
Tyker added a comment.

fixed requested changes except some i commented upon.


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

https://reviews.llvm.org/D61790

Files:
  clang/include/clang/AST/Decl.h
  clang/include/clang/AST/DeclBase.h
  clang/include/clang/AST/DeclCXX.h
  clang/include/clang/Basic/DiagnosticParseKinds.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/Specifiers.h
  clang/include/clang/Basic/TokenKinds.def
  clang/include/clang/Sema/DeclSpec.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/Decl.cpp
  clang/lib/AST/DeclCXX.cpp
  clang/lib/AST/DeclPrinter.cpp
  clang/lib/AST/ExprConstant.cpp
  clang/lib/AST/TextNodeDumper.cpp
  clang/lib/Parse/ParseCXXInlineMethods.cpp
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Parse/ParseExprCXX.cpp
  clang/lib/Parse/ParseTentative.cpp
  clang/lib/Sema/DeclSpec.cpp
  clang/lib/Sema/SemaCoroutine.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaLambda.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/SemaTemplate.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/lib/Sema/SemaType.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReaderDecl.cpp
  clang/test/SemaCXX/cxx2a-compat.cpp
  clang/test/SemaCXX/cxx2a-consteval.cpp

Index: clang/test/SemaCXX/cxx2a-consteval.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/cxx2a-consteval.cpp
@@ -0,0 +1,58 @@
+// RUN: %clang_cc1 -std=c++2a -fsyntax-only %s -verify
+
+namespace basic_sema {
+
+consteval int f1(int i) {
+  return i;
+}
+
+consteval constexpr int f2(int i) { 
+  //expected-error@-1 {{cannot combine}}
+  return i;
+}
+
+constexpr auto l_eval = [](int i) consteval {
+
+  return i;
+};
+
+constexpr consteval int f3(int i) {
+  //expected-error@-1 {{cannot combine}}
+  return i;
+}
+
+struct A {
+  consteval int f1(int i) const {
+return i;
+  }
+  consteval A(int i);
+  consteval A() = default;
+  consteval ~A() = default; // expected-error {{destructor cannot be marked consteval}}
+};
+
+consteval struct B {}; // expected-error {{struct cannot be marked consteval}}
+
+consteval typedef B b; // expected-error {{typedef cannot be consteval}}
+
+consteval int redecl() {return 0;} // expected-note {{previous declaration is here}}
+constexpr int redecl() {return 0;} // expected-error {{constexpr declaration of 'redecl' follows consteval declaration}}
+
+consteval int i = 0; // expected-error {{consteval can only be used in function declarations}}
+
+consteval int; // expected-error {{consteval can only be used in function declarations}}
+
+consteval int f1() {} // expected-error {{no return statement in consteval function}}
+
+struct C {
+  C() {}
+};
+
+struct D {
+  C c;
+  consteval D() = default; // expected-error {{cannot be consteval}}
+};
+}
+
+consteval int main() { // expected-error {{'main' is not allowed to be declared consteval}}
+  return 0;
+}
Index: clang/test/SemaCXX/cxx2a-compat.cpp
===
--- clang/test/SemaCXX/cxx2a-compat.cpp
+++ clang/test/SemaCXX/cxx2a-compat.cpp
@@ -56,4 +56,13 @@
 #if !defined(__cpp_conditional_explicit) || __cpp_conditional_explicit != 201806L
 #error "the feature test macro __cpp_conditional_explicit isn't correct"
 #endif
+#endif
+
+auto l = []() consteval {};
+int consteval();
+#if __cplusplus <= 201703L
+// expected-warning@-3 {{'consteval' is a keyword in C++2a}}
+// expected-error@-4 {{expected body of lambda expression}}
+#else
+// expected-error@-5 {{expected unqualified-id}}
 #endif
\ No newline at end of file
Index: clang/lib/Serialization/ASTReaderDecl.cpp
===
--- clang/lib/Serialization/ASTReaderDecl.cpp
+++ clang/lib/Serialization/ASTReaderDecl.cpp
@@ -868,7 +868,7 @@
   FD->setDefaulted(Record.readInt());
   FD->setExplicitlyDefaulted(Record.readInt());
   FD->setHasImplicitReturnZero(Record.readInt());
-  FD->setConstexpr(Record.readInt());
+  FD->setConstexprKind(static_cast(Record.readInt()));
   FD->setUsesSEHTry(Record.readInt());
   FD->setHasSkippedBody(Record.readInt());
   FD->setIsMultiVersion(Record.readInt());
Index: clang/lib/Sema/TreeTransform.h
===
--- clang/lib/Sema/TreeTransform.h
+++ clang/lib/Sema/TreeTransform.h
@@ -11337,7 +11337,7 @@
   Class, E->getIntroducerRange(), NewCallOpTSI,
   E->getCallOperator()->getEndLoc(),
   NewCallOpTSI->getTypeLoc().castAs().getParams(),
-  E->getCallOperator()->isConstexpr(), Mangling);
+  E->getCallOperator()->getConstexprKind(), Mangling);
 
   LSI->CallOperator = NewCallOperator;
 
Index: clang/lib/Sema/SemaType.cpp

[PATCH] D61790: [C++20] add Basic consteval specifier

2019-06-07 Thread Tyker via Phabricator via cfe-commits
Tyker added inline comments.



Comment at: clang/lib/Parse/ParseDecl.cpp:2491
+  if (DS.hasConstexprSpecifier() && DSC != DeclSpecContext::DSC_condition) {
 Diag(DS.getConstexprSpecLoc(), diag::err_typename_invalid_constexpr);
 DS.ClearConstexprSpec();

rsmith wrote:
> Should this say which specifier was used? Or do we somehow reject eg. 
> `sizeof(consteval int)` before we get here?
`sizeof(consteval int)` was rejected before this point but the diagnostics was 
bad. so i improved it.



Comment at: clang/lib/Parse/ParseExprCXX.cpp:1152-1154
 P.Diag(ConstexprLoc, !P.getLangOpts().CPlusPlus17
  ? diag::ext_constexpr_on_lambda_cxx17
  : diag::warn_cxx14_compat_constexpr_on_lambda);

rsmith wrote:
> We should produce a `-Wc++17-compat` diagnostic similar to this for uses of 
> `consteval`.
a consteval keyword can only be lexed when we are in C++2a because it is a 
C++2a keyword so the warning would never fire.



Comment at: clang/lib/Sema/DeclSpec.cpp:1296-1297
   << (TypeSpecType == TST_char16 ? "char16_t" : "char32_t");
-  if (Constexpr_specified)
+  if (hasConstexprSpecifier())
 S.Diag(ConstexprLoc, diag::warn_cxx98_compat_constexpr);
 

rsmith wrote:
> For `consteval` we should produce an "incompatible with C++ standards before 
> C++2a" diagnostic, not an "incompatible with C++98" diagnostic.
same as previous comment. the consteval keyword cannot be lexed unless we are 
in c++2a mode so the warning would never fire.


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

https://reviews.llvm.org/D61790



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


[PATCH] D61637: [Syntax] Introduce syntax trees

2019-06-07 Thread Sam McCall via Phabricator via cfe-commits
sammccall added a comment.

In D61637#1527727 , @ilya-biryukov 
wrote:

> I've addressed most of the comments, except the naming ones.
>  We need a convention for naming the language nodes and names for composite 
> and leaf structural nodes.
>
> For "language" nodes, I suggest we use  `CompoundStatement`, `Recovery`, 
> `TopLevelDeclaration`, `TemplateArgumentList`, `TypeTemplateArgument`, etc. 
> That is, we spell out the words in full, no shorthands like `Stmt` or `Expr`. 
> That would make things a bit more verbose, but hopefully that helps 
> distinguish from clang AST.


SGTM.




Comment at: clang/include/clang/Tooling/Syntax/Tree.h:104
+
+  llvm::ArrayRef tokens() const { return Tokens; }
+

as discussed offline, having a leaf node store a range of tokens (rather than 
just one) looks attractive now, but as the syntax tree gets more detailed there 
are relatively few cases where multiple consecutive tokens should really be 
undifferentiated siblings.

Might be better to bite the bullet now and make leaf hold a single token, so 
our consecutive token ranges become a linked list. This will also flush out 
accidental assumptions that only tokens in the same Leaf are adjacent.

Given this, I'm not sure there's a better name than `syntax::Leaf`. You might 
consider making it a pointer-like object dereferenceable to Token&.



Comment at: clang/include/clang/Tooling/Syntax/Tree.h:111
+/// A composite tree node that has children.
+class TreeNode : public Node {
+public:

As discussed, I think `syntax::Tree` might actually be a better name here.

"A Node is either a Tree or a Leaf" is a bit weird, but not too hard to 
remember I think.



Comment at: clang/include/clang/Tooling/Syntax/Tree.h:129
+  /// by TreeBuilder.
+  void prependChildLowLevel(Node *Child);
+  friend class TreeBuilder;

(curious: why prepend rather than append?)



Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:26
+/// AST. The tree is built left-to-right and bottom-up. At each point of the
+/// traversal we maintain a list of currently processed nodes.
+class syntax::TreeBuilder {

I find "currently processed" a bit vague. "Pending"?



Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:37
+  /// and \p Last are added as children of the new node.
+  void learnNode(SourceLocation Fist, SourceLocation Last,
+ syntax::TreeNode *New);

maybe formNode, formToken, formRoot()?



Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:37
+  /// and \p Last are added as children of the new node.
+  void learnNode(SourceLocation Fist, SourceLocation Last,
+ syntax::TreeNode *New);

sammccall wrote:
> maybe formNode, formToken, formRoot()?
if syntax nodes strictly nest and we form left-to-right and bottom up, then why 
are there ever pending nodes that aren't in the range? Is it because we don't 
aggregate them as early as possible?

(edit: after offline discussion, there are precise invariants here that could 
be documented and asserted)



Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:41
+  /// Add a leaf node for a token starting at \p Loc.
+  void learnTokenNode(SourceLocation Loc, tok::TokenKind Kind);
+

Particularly in view of having tokens be 1:1 with Leaf, *constructing* the 
token nodes as part of higher level constructs / as part of recovery seems a 
little odd.

What if we constructed all the leaf nodes up front, forming a linked list:
`int -> a -> = -> 2 -> + -> 2 -> ; -> eof`

When you form a node that covers a range, you splice out the nodes in that 
range, replacing with the new node:

`int -> a -> = -> (2 + 2) -> ; -> eof`
`(int a = (2 + 2)) -> ; -> eof`
etc

Then the invariant is you have a forest, the roots form a linked list, and the 
trees' respective leaves are a left-to-right partition of the input tokens.

I think this would mean:
 - no separate vector data structure (AFAICS we can reuse Node)
 - don't have the requirement that the formed node must claim a suffix of the 
pending nodes, which simplifies the recursive AST visitior

We lose the binary search, but I think tracking the last accessed root (current 
position) and linear searching left/right will be at least as good in practice, 
because tree traversal is fundamentally pretty local.



Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:48
+  /// Consume the root node.
+  syntax::TranslationUnit *root() && {
+assert(Root);

any particular reason learnRoot() and root() are different functions?

If learnRoot() returned TranslationUnit*, then we avoid the need for the caller 
to know about the dependency, it would track the state itself.



Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:55
+private:
+  struct 

[PATCH] D62962: Clang implementation of sizeless types

2019-06-07 Thread Richard Sandiford via Phabricator via cfe-commits
rsandifo-arm updated this revision to Diff 203546.
rsandifo-arm added a comment.

Add tests for ext_vector_type


Repository:
  rC Clang

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

https://reviews.llvm.org/D62962

Files:
  docs/SizelessTypes.rst
  include/clang/AST/Expr.h
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/Initialization.h
  include/clang/Sema/Sema.h
  lib/AST/ASTContext.cpp
  lib/AST/ExprClassification.cpp
  lib/AST/Type.cpp
  lib/Sema/SemaChecking.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclAttr.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaExprCXX.cpp
  lib/Sema/SemaFixItUtils.cpp
  lib/Sema/SemaInit.cpp
  lib/Sema/SemaLambda.cpp
  lib/Sema/SemaOverload.cpp
  lib/Sema/SemaPseudoObject.cpp
  lib/Sema/SemaStmt.cpp
  lib/Sema/SemaStmtAsm.cpp
  lib/Sema/SemaType.cpp
  test/Sema/sizeless-1.c
  test/SemaCXX/sizeless-1.cpp

Index: test/SemaCXX/sizeless-1.cpp
===
--- /dev/null
+++ test/SemaCXX/sizeless-1.cpp
@@ -0,0 +1,534 @@
+// RUN: %clang_cc1 -fcxx-exceptions -fsyntax-only -verify -W -Wall -Wrange-loop-analysis -triple arm64-linux-gnu -target-feature +sve -std=c++98 %s
+// RUN: %clang_cc1 -fcxx-exceptions -fsyntax-only -verify -W -Wall -Wrange-loop-analysis -triple arm64-linux-gnu -target-feature +sve -std=gnu++98 %s
+// RUN: %clang_cc1 -fcxx-exceptions -fsyntax-only -verify -W -Wall -Wrange-loop-analysis -triple arm64-linux-gnu -target-feature +sve -std=c++11 %s
+// RUN: %clang_cc1 -fcxx-exceptions -fsyntax-only -verify -W -Wall -Wrange-loop-analysis -triple arm64-linux-gnu -target-feature +sve -std=gnu++11 %s
+// RUN: %clang_cc1 -fcxx-exceptions -fsyntax-only -verify -W -Wall -Wrange-loop-analysis -triple arm64-linux-gnu -target-feature +sve -std=c++14 %s
+// RUN: %clang_cc1 -fcxx-exceptions -fsyntax-only -verify -W -Wall -Wrange-loop-analysis -triple arm64-linux-gnu -target-feature +sve -std=gnu++14 %s
+// RUN: %clang_cc1 -fcxx-exceptions -fsyntax-only -verify -W -Wall -Wrange-loop-analysis -triple arm64-linux-gnu -target-feature +sve -std=c++17 %s
+// RUN: %clang_cc1 -fcxx-exceptions -fsyntax-only -verify -W -Wall -Wrange-loop-analysis -triple arm64-linux-gnu -target-feature +sve -std=gnu++17 %s
+
+namespace std { struct type_info; }
+
+typedef __SVInt8_t svint8_t;
+typedef __SVInt16_t svint16_t;
+
+svint8_t global_int8; // expected-error {{non-local variable with sizeless type}}
+extern svint8_t extern_int8; // expected-error {{non-local variable with sizeless type}}
+static svint8_t static_int8; // expected-error {{non-local variable with sizeless type}}
+svint8_t *global_int8_ptr;
+extern svint8_t *extern_int8_ptr;
+static svint8_t *static_int8_ptr;
+
+typedef svint8_t int8_typedef;
+typedef svint8_t *int8_ptr_typedef;
+
+int sizeof_int8 = sizeof(svint8_t); // expected-error {{incomplete type}}
+
+#if __cplusplus >= 201103L
+int alignof_int8 = alignof(svint8_t); // expected-error {{incomplete type}}
+#else
+int alignof_int8 = _Alignof(svint8_t); // expected-error {{incomplete type}}
+#endif
+
+void pass_int8(svint8_t); // expected-note {{no known conversion}}
+
+extern "C" svint8_t return_int8();
+
+typedef svint8_t vec_int8_a __attribute__((vector_size(64))); // expected-error {{invalid vector element type}}
+typedef svint8_t vec_int8_b __attribute__((ext_vector_type(4))); // expected-error {{invalid vector element type}}
+
+void dump(const volatile void *);
+
+void overf(svint8_t);
+void overf(svint16_t);
+
+void overf8(svint8_t); // expected-note + {{not viable}}
+void overf8(int); // expected-note + {{not viable}}
+
+void overf16(svint16_t); // expected-note + {{not viable}}
+void overf16(int); // expected-note + {{not viable}}
+
+void varargs(int, ...);
+
+void unused() {
+  svint8_t unused_int8; // expected-warning {{unused}}
+}
+
+void func(int sel) {
+  svint8_t local_int8;
+  svint16_t local_int16;
+
+  svint8_t __attribute__((aligned)) aligned_int8_1; // expected-error {{sizeless type}}
+  svint8_t __attribute__((aligned(4))) aligned_int8_2; // expected-error {{sizeless type}}
+  svint8_t _Alignas(int) aligned_int8_3; // expected-error {{sizeless type}}
+  int _Alignas(svint8_t) aligned_int; // expected-error {{incomplete type}}
+
+  (void)__atomic_is_lock_free(1, _int8);
+  (void)__atomic_always_lock_free(1, _int8);
+
+  local_int8; // expected-warning {{expression result unused}}
+
+  (void)local_int8;
+
+  local_int8, 0; // expected-warning + {{expression result unused}}
+
+  0, local_int8; // expected-warning + {{expression result unused}}
+
+  svint8_t init_int8 = local_int8;
+  svint8_t bad_init_int8 = for; // expected-error {{expected expression}}
+
+#if __cplusplus >= 201103L
+  int empty_brace_init_int = {};
+  svint8_t empty_brace_init_int8 = {};
+#else
+  int empty_brace_init_int = {}; // expected-error {{scalar initializer cannot be empty}}
+  svint8_t empty_brace_init_int8 = {}; // expected-error {{scalar initializer cannot be empty}}

[PATCH] D62839: [clangd] Index API and implementations for relations

2019-06-07 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet marked an inline comment as done.
kadircet added inline comments.



Comment at: clang-tools-extra/clangd/index/FileIndex.cpp:202
+  for (const auto  : RelationSlabs) {
+for (const auto  : *RelationSlab) {
+  AllRelations.push_back(R);

nit: braces



Comment at: clang-tools-extra/clangd/index/Index.h:76
 
+struct RelationsRequest {
+  SymbolID Subject;

let's have a limit as well



Comment at: clang-tools-extra/clangd/index/Index.h:139
+  void relations(const RelationsRequest &,
+ llvm::function_ref) const override;
+

thinking about this callback, I don't think there is any user that will make 
use of the `SymbolID`s without querying for a `Symbol`.

So to reduce this boilerplate let's rather move this lookup into this API(all 
`SymbolIndex` implementations provide `lookup` anyway so they all have a way to 
convert a `SymbolID` into a `Symbol`) and change the callback to accept a 
`const Symbol&` instead of a `SymbolID`



Comment at: clang-tools-extra/clangd/index/Index.h:107
+  virtual void
+  relations(const SymbolID , index::SymbolRole Predicate,
+llvm::function_ref Callback) const = 0;

nridge wrote:
> kadircet wrote:
> > We might need additional options, like limiting number of results. Could 
> > you instead accept a `RelsRequest` object? You can check `RefsRequest` for 
> > a sample
> I called it `RelationsRequest` to avoid visual confusion with `RefsRequest`.
yeah that's a good call thanks!



Comment at: clang-tools-extra/clangd/index/Merge.cpp:126
+llvm::function_ref Callback) const {
+  // Return results from both indexes but avoid duplicates.
+  llvm::DenseSet SeenObjects;

nridge wrote:
> kadircet wrote:
> > avoiding deduplicates is not enough, we also wouldn't want to report stale 
> > relations coming from static index.
> > 
> > Could you check the logic in `MergedIndex::refs`, and hopefully refactor it 
> > into a class to share between these two?
> The description in `MergedIndex::refs()` says:
> 
> ```
>   // We don't want duplicated refs from the static/dynamic indexes,
>   // and we can't reliably deduplicate them because offsets may differ 
> slightly.
>   // We consider the dynamic index authoritative and report all its refs,
>   // and only report static index refs from other files.
> ```
> 
> It seems to me that the problem of "can't reliably deduplicate them because 
> offsets may differ slightly" doesn't apply to relations, as there are no 
> offsets involved. So, is there still a need to have additional logic here?
> 
> If so, what would the logic be -- don't return an object O1 from the static 
> index if we've returned an object O2 from the dynamic index defined in the 
> same file as O1? (Note that to implement this, we'd have to additionally look 
> up each SymbolID we return in the symbol table, as we don't otherwise know 
> what file the object is located in.)
yes I was referring to second part actually, but you are right we have no good 
way of distinguishing stale information in this case. Let's leave it as it is, 
but add a comment stating that we might return stale relations from static 
index.



Comment at: clang-tools-extra/clangd/index/dex/Dex.cpp:28
+RelationSlab Rels) {
   auto Size = Symbols.bytes() + Refs.bytes();
+  // There is no need to include "Rels" in Data because the relations are self-

nridge wrote:
> kadircet wrote:
> > `+rels.size()`
> `Size` is only the backing data size, so if we don't include the relations in 
> the backing data, we shouldn't include `Rels.size()`, right?
ok, but then let's make sure we include size of the densemap in 
`estimateMemoryUsage` manually.



Comment at: clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp:220
+  // containing the definition of the subject (A_CC).
+  EXPECT_EQ(ShardHeader->Relations->size(), 1u);
 

could we instead check only relation is `A_CC isbaseof B_CC` ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62839



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


[PATCH] D61914: [Support][Test] Time profiler: add regression test

2019-06-07 Thread Anton Afanasyev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL362792: [Support][Test] Time profiler: add regression test 
(authored by anton-afanasyev, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D61914?vs=203532=203544#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D61914

Files:
  cfe/trunk/test/Driver/check-time-trace.cpp
  cfe/trunk/tools/driver/cc1_main.cpp


Index: cfe/trunk/test/Driver/check-time-trace.cpp
===
--- cfe/trunk/test/Driver/check-time-trace.cpp
+++ cfe/trunk/test/Driver/check-time-trace.cpp
@@ -0,0 +1,23 @@
+// RUN: %clangxx -ftime-trace %s 2>&1 | grep "Time trace json-file dumped to" \
+// RUN:   | awk '{print $NF}' | xargs cat \
+// RUN:   | %python -c 'import json, sys; 
json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
+// RUN:   | FileCheck %s
+
+// CHECK: "traceEvents": [
+// CHECK: "args":
+// CHECK: "detail":
+// CHECK: "dur":
+// CHECK: "name": "Source"
+// CHECK-NEXT: "ph":
+// CHECK-NEXT: "pid":
+// CHECK-NEXT: "tid":
+// CHECK-NEXT: "ts":
+// CHECK: "name": "clang"
+// CHECK: "name": "process_name"
+
+#include 
+
+int main() {
+  std::cout << "Foo" << std::endl;
+  return 0;
+}
Index: cfe/trunk/tools/driver/cc1_main.cpp
===
--- cfe/trunk/tools/driver/cc1_main.cpp
+++ cfe/trunk/tools/driver/cc1_main.cpp
@@ -241,6 +241,11 @@
 
 llvm::timeTraceProfilerWrite(*profilerOutput);
 llvm::timeTraceProfilerCleanup();
+
+llvm::errs() << "Time trace json-file dumped to " << Path.str() << "\n";
+llvm::errs()
+<< "Use chrome://tracing or Speedscope App "
+   "(https://www.speedscope.app) for flamegraph visualization\n";
   }
 
   // Our error handler depends on the Diagnostics object, which we're


Index: cfe/trunk/test/Driver/check-time-trace.cpp
===
--- cfe/trunk/test/Driver/check-time-trace.cpp
+++ cfe/trunk/test/Driver/check-time-trace.cpp
@@ -0,0 +1,23 @@
+// RUN: %clangxx -ftime-trace %s 2>&1 | grep "Time trace json-file dumped to" \
+// RUN:   | awk '{print $NF}' | xargs cat \
+// RUN:   | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
+// RUN:   | FileCheck %s
+
+// CHECK: "traceEvents": [
+// CHECK: "args":
+// CHECK: "detail":
+// CHECK: "dur":
+// CHECK: "name": "Source"
+// CHECK-NEXT: "ph":
+// CHECK-NEXT: "pid":
+// CHECK-NEXT: "tid":
+// CHECK-NEXT: "ts":
+// CHECK: "name": "clang"
+// CHECK: "name": "process_name"
+
+#include 
+
+int main() {
+  std::cout << "Foo" << std::endl;
+  return 0;
+}
Index: cfe/trunk/tools/driver/cc1_main.cpp
===
--- cfe/trunk/tools/driver/cc1_main.cpp
+++ cfe/trunk/tools/driver/cc1_main.cpp
@@ -241,6 +241,11 @@
 
 llvm::timeTraceProfilerWrite(*profilerOutput);
 llvm::timeTraceProfilerCleanup();
+
+llvm::errs() << "Time trace json-file dumped to " << Path.str() << "\n";
+llvm::errs()
+<< "Use chrome://tracing or Speedscope App "
+   "(https://www.speedscope.app) for flamegraph visualization\n";
   }
 
   // Our error handler depends on the Diagnostics object, which we're
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r362792 - [Support][Test] Time profiler: add regression test

2019-06-07 Thread Anton Afanasyev via cfe-commits
Author: anton-afanasyev
Date: Fri Jun  7 05:59:32 2019
New Revision: 362792

URL: http://llvm.org/viewvc/llvm-project?rev=362792=rev
Log:
[Support][Test] Time profiler: add regression test

Summary:
Add output to `llvm::errs()` when `-ftime-trace` option is enabled,
add regression test checking this option works as expected.

Reviewers: thakis, aganea

Subscribers: cfe-commits, llvm-commits

Tags: #clang, #llvm

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

Added:
cfe/trunk/test/Driver/check-time-trace.cpp
Modified:
cfe/trunk/tools/driver/cc1_main.cpp

Added: cfe/trunk/test/Driver/check-time-trace.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/check-time-trace.cpp?rev=362792=auto
==
--- cfe/trunk/test/Driver/check-time-trace.cpp (added)
+++ cfe/trunk/test/Driver/check-time-trace.cpp Fri Jun  7 05:59:32 2019
@@ -0,0 +1,23 @@
+// RUN: %clangxx -ftime-trace %s 2>&1 | grep "Time trace json-file dumped to" \
+// RUN:   | awk '{print $NF}' | xargs cat \
+// RUN:   | %python -c 'import json, sys; 
json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
+// RUN:   | FileCheck %s
+
+// CHECK: "traceEvents": [
+// CHECK: "args":
+// CHECK: "detail":
+// CHECK: "dur":
+// CHECK: "name": "Source"
+// CHECK-NEXT: "ph":
+// CHECK-NEXT: "pid":
+// CHECK-NEXT: "tid":
+// CHECK-NEXT: "ts":
+// CHECK: "name": "clang"
+// CHECK: "name": "process_name"
+
+#include 
+
+int main() {
+  std::cout << "Foo" << std::endl;
+  return 0;
+}

Modified: cfe/trunk/tools/driver/cc1_main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1_main.cpp?rev=362792=362791=362792=diff
==
--- cfe/trunk/tools/driver/cc1_main.cpp (original)
+++ cfe/trunk/tools/driver/cc1_main.cpp Fri Jun  7 05:59:32 2019
@@ -241,6 +241,11 @@ int cc1_main(ArrayRef Argv
 
 llvm::timeTraceProfilerWrite(*profilerOutput);
 llvm::timeTraceProfilerCleanup();
+
+llvm::errs() << "Time trace json-file dumped to " << Path.str() << "\n";
+llvm::errs()
+<< "Use chrome://tracing or Speedscope App "
+   "(https://www.speedscope.app) for flamegraph visualization\n";
   }
 
   // Our error handler depends on the Diagnostics object, which we're


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


[PATCH] D61914: [Support][Test] Time profiler: add regression test

2019-06-07 Thread Alexandre Ganea via Phabricator via cfe-commits
aganea accepted this revision.
aganea added a comment.
This revision is now accepted and ready to land.

Thanks Anton!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61914



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


[PATCH] D62998: [ARM] Fix bugs introduced by the fp64/d32 rework.

2019-06-07 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL362791: [ARM] Fix bugs introduced by the fp64/d32 rework. 
(authored by statham, committed by ).
Herald added a subscriber: kristina.

Changed prior to commit:
  https://reviews.llvm.org/D62998?vs=203526=203540#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62998

Files:
  cfe/trunk/lib/Basic/Targets/ARM.cpp
  cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp
  cfe/trunk/test/CodeGen/arm-target-features.c
  cfe/trunk/test/Driver/arm-mfpu.c
  cfe/trunk/test/Driver/armv8.1m.main.c
  cfe/trunk/test/Preprocessor/arm-acle-6.5.c
  cfe/trunk/test/Preprocessor/arm-target-features.c
  llvm/trunk/lib/Support/ARMTargetParser.cpp

Index: llvm/trunk/lib/Support/ARMTargetParser.cpp
===
--- llvm/trunk/lib/Support/ARMTargetParser.cpp
+++ llvm/trunk/lib/Support/ARMTargetParser.cpp
@@ -162,87 +162,63 @@
   if (FPUKind >= FK_LAST || FPUKind == FK_INVALID)
 return false;
 
-  // FPU version subtarget features are inclusive of lower-numbered ones, so
-  // enable the one corresponding to this version and disable all that are
-  // higher. We also have to make sure to disable fp16 when vfp4 is disabled,
-  // as +vfp4 implies +fp16 but -vfp4 does not imply -fp16.
-  switch (FPUNames[FPUKind].FPUVer) {
-  case FPUVersion::VFPV5_FULLFP16:
-Features.push_back("+fp-armv8");
-Features.push_back("+fullfp16");
-break;
-  case FPUVersion::VFPV5:
-Features.push_back("+fp-armv8");
-break;
-  case FPUVersion::VFPV4:
-Features.push_back("+vfp4");
-Features.push_back("-fp-armv8");
-break;
-  case FPUVersion::VFPV3_FP16:
-Features.push_back("+vfp3");
-Features.push_back("+fp16");
-Features.push_back("-vfp4");
-Features.push_back("-fp-armv8");
-break;
-  case FPUVersion::VFPV3:
-Features.push_back("+vfp3");
-Features.push_back("-fp16");
-Features.push_back("-vfp4");
-Features.push_back("-fp-armv8");
-break;
-  case FPUVersion::VFPV2:
-Features.push_back("+vfp2");
-Features.push_back("-vfp3");
-Features.push_back("-fp16");
-Features.push_back("-vfp4");
-Features.push_back("-fp-armv8");
-break;
-  case FPUVersion::NONE:
-Features.push_back("-fpregs");
-Features.push_back("-vfp2");
-Features.push_back("-vfp3");
-Features.push_back("-fp16");
-Features.push_back("-vfp4");
-Features.push_back("-fp-armv8");
-break;
-  }
-
-  // fp64 and d32 subtarget features are independent of each other, so we
-  // must disable/enable both.
-  if (FPUKind == FK_NONE) {
-Features.push_back("-fp64");
-Features.push_back("-d32");
-  } else {
-switch (FPUNames[FPUKind].Restriction) {
-case FPURestriction::SP_D16:
-  Features.push_back("-fp64");
-  Features.push_back("-d32");
-  break;
-case FPURestriction::D16:
-  Features.push_back("+fp64");
-  Features.push_back("-d32");
-  break;
-case FPURestriction::None:
-  Features.push_back("+fp64");
-  Features.push_back("+d32");
-  break;
-}
+  static const struct FPUFeatureNameInfo {
+const char *PlusName, *MinusName;
+FPUVersion MinVersion;
+FPURestriction MaxRestriction;
+  } FPUFeatureInfoList[] = {
+// We have to specify the + and - versions of the name in full so
+// that we can return them as static StringRefs.
+//
+// Also, the SubtargetFeatures ending in just "sp" are listed here
+// under FPURestriction::None, which is the only FPURestriction in
+// which they would be valid (since FPURestriction::SP doesn't
+// exist).
+
+{"+fpregs", "-fpregs", FPUVersion::VFPV2, FPURestriction::SP_D16},
+{"+vfp2", "-vfp2", FPUVersion::VFPV2, FPURestriction::None},
+{"+vfp2d16", "-vfp2d16", FPUVersion::VFPV2, FPURestriction::D16},
+{"+vfp2d16sp", "-vfp2d16sp", FPUVersion::VFPV2, FPURestriction::SP_D16},
+{"+vfp2sp", "-vfp2sp", FPUVersion::VFPV2, FPURestriction::None},
+{"+vfp3", "-vfp3", FPUVersion::VFPV3, FPURestriction::None},
+{"+vfp3d16", "-vfp3d16", FPUVersion::VFPV3, FPURestriction::D16},
+{"+vfp3d16sp", "-vfp3d16sp", FPUVersion::VFPV3, FPURestriction::SP_D16},
+{"+vfp3sp", "-vfp3sp", FPUVersion::VFPV3, FPURestriction::None},
+{"+fp16", "-fp16", FPUVersion::VFPV3_FP16, FPURestriction::SP_D16},
+{"+vfp4", "-vfp4", FPUVersion::VFPV4, FPURestriction::None},
+{"+vfp4d16", "-vfp4d16", FPUVersion::VFPV4, FPURestriction::D16},
+{"+vfp4d16sp", "-vfp4d16sp", FPUVersion::VFPV4, FPURestriction::SP_D16},
+{"+vfp4sp", "-vfp4sp", FPUVersion::VFPV4, FPURestriction::None},
+{"+fp-armv8", "-fp-armv8", FPUVersion::VFPV5, FPURestriction::None},
+{"+fp-armv8d16", "-fp-armv8d16", FPUVersion::VFPV5, FPURestriction::D16},
+{"+fp-armv8d16sp", "-fp-armv8d16sp", FPUVersion::VFPV5, FPURestriction::SP_D16},
+{"+fp-armv8sp", 

r362791 - [ARM] Fix bugs introduced by the fp64/d32 rework.

2019-06-07 Thread Simon Tatham via cfe-commits
Author: statham
Date: Fri Jun  7 05:42:54 2019
New Revision: 362791

URL: http://llvm.org/viewvc/llvm-project?rev=362791=rev
Log:
[ARM] Fix bugs introduced by the fp64/d32 rework.

Change D60691 caused some knock-on failures that weren't caught by the
existing tests. Firstly, selecting a CPU that should have had a
restricted FPU (e.g. `-mcpu=cortex-m4`, which should have 16 d-regs
and no double precision) could give the unrestricted version, because
`ARM::getFPUFeatures` returned a list of features including subtracted
ones (here `-fp64`,`-d32`), but `ARMTargetInfo::initFeatureMap` threw
away all the ones that didn't start with `+`. Secondly, the
preprocessor macros didn't reliably match the actual compilation
settings: for example, `-mfpu=softvfp` could still set `__ARM_FP` as
if hardware FP was available, because the list of features on the cc1
command line would include things like `+vfp4`,`-vfp4d16` and clang
didn't realise that one of those cancelled out the other.

I've fixed both of these issues by rewriting `ARM::getFPUFeatures` so
that it returns a list that enables every FP-related feature
compatible with the selected FPU and disables every feature not
compatible, which is more verbose but means clang doesn't have to
understand the dependency relationships between the backend features.
Meanwhile, `ARMTargetInfo::handleTargetFeatures` is testing for all
the various forms of the FP feature names, so that it won't miss cases
where it should have set `HW_FP` to feed into feature test macros.

That in turn caused an ordering problem when handling `-mcpu=foo+bar`
together with `-mfpu=something_that_turns_off_bar`. To fix that, I've
arranged that the `+bar` suffixes on the end of `-mcpu` and `-march`
cause feature names to be put into a separate vector which is
concatenated after the output of `getFPUFeatures`.

Another side effect of all this is to fix a bug where `clang -target
armv8-eabi` by itself would fail to set `__ARM_FEATURE_FMA`, even
though `armv8` (aka Arm v8-A) implies FP-Armv8 which has FMA. That was
because `HW_FP` was being set to a value including only the `FPARMV8`
bit, but that feature test macro was testing only the `VFP4FPU` bit.
Now `HW_FP` ends up with all the bits set, so it gives the right
answer.

Changes to tests included in this patch:

* `arm-target-features.c`: I had to change basically all the expected
  results. (The Cortex-M4 test in there should function as a
  regression test for the accidental double-precision bug.)
* `arm-mfpu.c`, `armv8.1m.main.c`: switched to using `CHECK-DAG`
  everywhere so that those tests are no longer sensitive to the order
  of cc1 feature options on the command line.
* `arm-acle-6.5.c`: been updated to expect the right answer to that
  FMA test.
* `Preprocessor/arm-target-features.c`: added a regression test for
  the `mfpu=softvfp` issue.

Reviewers: SjoerdMeijer, dmgreen, ostannard, samparker, JamesNagurne

Reviewed By: ostannard

Subscribers: srhines, javed.absar, kristof.beyls, hiraditya, cfe-commits, 
llvm-commits

Tags: #clang, #llvm

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

Modified:
cfe/trunk/lib/Basic/Targets/ARM.cpp
cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp
cfe/trunk/test/CodeGen/arm-target-features.c
cfe/trunk/test/Driver/arm-mfpu.c
cfe/trunk/test/Driver/armv8.1m.main.c
cfe/trunk/test/Preprocessor/arm-acle-6.5.c
cfe/trunk/test/Preprocessor/arm-target-features.c

Modified: cfe/trunk/lib/Basic/Targets/ARM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/ARM.cpp?rev=362791=362790=362791=diff
==
--- cfe/trunk/lib/Basic/Targets/ARM.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/ARM.cpp Fri Jun  7 05:42:54 2019
@@ -408,18 +408,30 @@ bool ARMTargetInfo::handleTargetFeatures
   SoftFloat = true;
 } else if (Feature == "+soft-float-abi") {
   SoftFloatABI = true;
-} else if (Feature == "+vfp2") {
+} else if (Feature == "+vfp2sp" || Feature == "+vfp2d16sp" ||
+   Feature == "+vfp2" || Feature == "+vfp2d16") {
   FPU |= VFP2FPU;
   HW_FP |= HW_FP_SP;
-} else if (Feature == "+vfp3") {
+  if (Feature == "+vfp2" || Feature == "+vfp2d16")
+  HW_FP |= HW_FP_DP;
+} else if (Feature == "+vfp3sp" || Feature == "+vfp3d16sp" ||
+   Feature == "+vfp3" || Feature == "+vfp3d16") {
   FPU |= VFP3FPU;
   HW_FP |= HW_FP_SP;
-} else if (Feature == "+vfp4") {
+  if (Feature == "+vfp3" || Feature == "+vfp3d16")
+  HW_FP |= HW_FP_DP;
+} else if (Feature == "+vfp4sp" || Feature == "+vfp4d16sp" ||
+   Feature == "+vfp4" || Feature == "+vfp4d16") {
   FPU |= VFP4FPU;
   HW_FP |= HW_FP_SP | HW_FP_HP;
-} else if (Feature == "+fp-armv8") {
+  if (Feature == "+vfp4" || Feature == "+vfp4d16")
+  HW_FP |= HW_FP_DP;
+} else if (Feature == "+fp-armv8sp" || Feature == "+fp-armv8d16sp" ||
+  

[PATCH] D60710: [ARM] Add ACLE feature macros for MVE.

2019-06-07 Thread Oliver Stannard (Linaro) via Phabricator via cfe-commits
ostannard added inline comments.



Comment at: clang/lib/Basic/Targets/ARM.cpp:465
+  MVE |= MVE_INT | MVE_FP;
+  HW_FP |= HW_FP_SP | HW_FP_HP;
 }

SjoerdMeijer wrote:
> ostannard wrote:
> > Does this also need to set FPU and HasLegalHalfType?
> Yep, thanks for catching this one, will fix this.
What about FPU? mve.fp requires that the FPU is also enabled, so we should also 
get the ##__ARM_FPV5__## macro (unless we're adding a new one for the v8.1M 
FPU?).


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

https://reviews.llvm.org/D60710



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


[PATCH] D62814: [clangd] Treat lambdas as functions when preparing hover response

2019-06-07 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet updated this revision to Diff 203533.
kadircet marked 3 inline comments as done.
kadircet added a comment.

- Address comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62814

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

Index: clang-tools-extra/clangd/unittests/XRefsTests.cpp
===
--- clang-tools-extra/clangd/unittests/XRefsTests.cpp
+++ clang-tools-extra/clangd/unittests/XRefsTests.cpp
@@ -22,6 +22,7 @@
 #include "llvm/Support/ScopedPrinter.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
+#include 
 
 namespace clang {
 namespace clangd {
@@ -588,7 +589,7 @@
  HI.Documentation = "Best foo ever.";
  HI.Definition = "void foo()";
  HI.ReturnType = "void";
- HI.Type = "void()";
+ HI.Type = "void ()";
  HI.Parameters.emplace();
}},
   // Inside namespace
@@ -605,7 +606,7 @@
  HI.Documentation = "Best foo ever.";
  HI.Definition = "void foo()";
  HI.ReturnType = "void";
- HI.Type = "void()";
+ HI.Type = "void ()";
  HI.Parameters.emplace();
}},
   // Field
@@ -733,7 +734,7 @@
   bool Q = false, class... Ts>
 void foo())cpp";
  HI.ReturnType = "void";
- HI.Type = "void()";
+ HI.Type = "void ()";
  HI.Parameters.emplace();
  HI.TemplateParameters = {
  {std::string("template  class"),
@@ -759,12 +760,76 @@
  HI.Kind = SymbolKind::Function;
  HI.Definition = "Foo foo(int, bool T = false)";
  HI.ReturnType = "Foo";
- HI.Type = "Foo(int, bool)";
+ HI.Type = "Foo (int, bool)";
  HI.Parameters = {
  {std::string("int"), llvm::None, llvm::None},
  {std::string("bool"), std::string("T"), std::string("false")},
  };
}},
+  // Pointers to lambdas
+  {R"cpp(
+void foo() {
+  auto lamb = [](int T, bool B) -> bool { return T && B; };
+  auto *b = 
+  auto *[[^c]] = 
+}
+)cpp",
+   [](HoverInfo ) {
+ HI.NamespaceScope = "";
+ HI.LocalScope = "foo::";
+ HI.Name = "c";
+ HI.Kind = SymbolKind::Variable;
+ HI.Definition = "auto *c = ";
+ HI.Type = "class (lambda) **";
+ HI.ReturnType = "bool";
+ HI.Parameters = {
+ {std::string("int"), std::string("T"), llvm::None},
+ {std::string("bool"), std::string("B"), llvm::None},
+ };
+ return HI;
+   }},
+  // Lambda parameter with decltype reference
+  {R"cpp(
+auto lamb = [](int T, bool B) -> bool { return T && B; };
+void foo(decltype(lamb)& bar) {
+  [[ba^r]](0, false);
+}
+)cpp",
+   [](HoverInfo ) {
+ HI.NamespaceScope = "";
+ HI.LocalScope = "foo::";
+ HI.Name = "bar";
+ HI.Kind = SymbolKind::Variable;
+ HI.Definition = "decltype(lamb) ";
+ HI.Type = "decltype(lamb) &";
+ HI.ReturnType = "bool";
+ HI.Parameters = {
+ {std::string("int"), std::string("T"), llvm::None},
+ {std::string("bool"), std::string("B"), llvm::None},
+ };
+ return HI;
+   }},
+  // Lambda parameter with decltype
+  {R"cpp(
+auto lamb = [](int T, bool B) -> bool { return T && B; };
+void foo(decltype(lamb) bar) {
+  [[ba^r]](0, false);
+}
+)cpp",
+   [](HoverInfo ) {
+ HI.NamespaceScope = "";
+ HI.LocalScope = "foo::";
+ HI.Name = "bar";
+ HI.Kind = SymbolKind::Variable;
+ HI.Definition = "decltype(lamb) bar";
+ HI.Type = "class (lambda)";
+ HI.ReturnType = "bool";
+ HI.Parameters = {
+ {std::string("int"), std::string("T"), llvm::None},
+ {std::string("bool"), std::string("B"), llvm::None},
+ };
+ return HI;
+   }},
   // Lambda variable
   {R"cpp(
 void foo() {
@@ -779,7 +844,12 @@
  HI.Name = "lamb";
  HI.Kind = SymbolKind::Variable;
  HI.Definition = "auto lamb = [](int T, bool B) -> bool {}";
- HI.Type = std::string("class (lambda)");
+ HI.Type = "class (lambda)";
+ HI.ReturnType = "bool";
+ HI.Parameters = {
+ {std::string("int"), std::string("T"), llvm::None},
+ {std::string("bool"), std::string("B"), llvm::None},
+ };
  return HI;
}},
   // Local variable in lambda
Index: clang-tools-extra/clangd/XRefs.cpp
===
--- clang-tools-extra/clangd/XRefs.cpp
+++ clang-tools-extra/clangd/XRefs.cpp
@@ -19,7 +19,9 @@
 #include "index/SymbolLocation.h"
 #include 

[PATCH] D62814: [clangd] Treat lambdas as functions when preparing hover response

2019-06-07 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added inline comments.



Comment at: clang-tools-extra/clangd/unittests/XRefsTests.cpp:831
+ };
  return HI;
}},

ilya-biryukov wrote:
> kadircet wrote:
> > ilya-biryukov wrote:
> > > kadircet wrote:
> > > > ilya-biryukov wrote:
> > > > > Could you add another test with even weirder types where we fail to 
> > > > > show the signature? To make sure we don't break when reaching the 
> > > > > limitations of the chosen approach and document what those 
> > > > > limitations are.
> > > > > 
> > > > > Something like:
> > > > > ```
> > > > > auto a = [](int a) { return 10; };
> > > > > auto *b = 
> > > > > auto *c = 
> > > > > ```
> > > > > 
> > > > > We would fail to show the signature here, but it's totally ok to 
> > > > > ignore it.
> > > > added cases, and changed code(a lot simpler now) to generate signatures 
> > > > for those cases as well.
> > > Here's an example when the new approach falls short too:
> > > 
> > > ```
> > > auto a = [](int) { return 10; }
> > > std::function b;
> > > ```
> > > 
> > > In general, are we ok with loosing all the information about the type 
> > > that we drop?
> > > One level of references and pointers seemed ok, dropping more is a bit 
> > > more cheesy..
> > > 
> > > At the same time, either case is **so** rare that we probably don't care.
> > are you talking about hovering over `x` ? I don't think AST contains 
> > information regarding that one. 
> > 
> > for a code like this:
> > ```
> > auto foo = []() { return 5; };
> > 
> > template 
> > class Cls {};
> > 
> > Cls X;
> > ```
> > 
> > This is the AST dump for variable X:
> > ```
> > `-VarDecl 0x2b0e808  col:30 X 'Cls > (decltype(foo))>':'Cls' callinit
> >   `-CXXConstructExpr 0x2b12e80  'Cls > (decltype(foo))>':'Cls' 'void () noexcept'
> > ```
> I'm talking about hovering over `b` and, as Sam mentioned, there's a good 
> chance you don't have this information in the type and we need to look at 
> `TypeLocs` instead.
> 
> Also agree with Sam, we don't want **any** complexity for that case. Just 
> wanted to make sure we added a test like this just to make sure we have some 
> idea of what's produced there and it does not crash.
I see, but then I don't think this case has anything to do with current patch, 
right?

It becomes a matter of decomposing a type with sugared components(which I 
believe should be visited but not in this patch) rather than expanding a lambda 
to a function like.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62814



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


[PATCH] D61914: [Support][Test] Time profiler: add regression test

2019-06-07 Thread Anton Afanasyev via Phabricator via cfe-commits
anton-afanasyev updated this revision to Diff 203532.
anton-afanasyev marked 2 inline comments as done.
anton-afanasyev added a comment.

Updated


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61914

Files:
  clang/test/Driver/check-time-trace.cpp
  clang/tools/driver/cc1_main.cpp


Index: clang/tools/driver/cc1_main.cpp
===
--- clang/tools/driver/cc1_main.cpp
+++ clang/tools/driver/cc1_main.cpp
@@ -241,6 +241,11 @@
 
 llvm::timeTraceProfilerWrite(*profilerOutput);
 llvm::timeTraceProfilerCleanup();
+
+llvm::errs() << "Time trace json-file dumped to " << Path.str() << "\n";
+llvm::errs()
+<< "Use chrome://tracing or Speedscope App "
+   "(https://www.speedscope.app) for flamegraph visualization\n";
   }
 
   // Our error handler depends on the Diagnostics object, which we're
Index: clang/test/Driver/check-time-trace.cpp
===
--- /dev/null
+++ clang/test/Driver/check-time-trace.cpp
@@ -0,0 +1,23 @@
+// RUN: %clangxx -ftime-trace %s 2>&1 | grep "Time trace json-file dumped to" \
+// RUN:   | awk '{print $NF}' | xargs cat \
+// RUN:   | %python -c 'import json, sys; 
json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
+// RUN:   | FileCheck %s
+
+// CHECK: "traceEvents": [
+// CHECK: "args":
+// CHECK: "detail":
+// CHECK: "dur":
+// CHECK: "name": "Source"
+// CHECK-NEXT: "ph":
+// CHECK-NEXT: "pid":
+// CHECK-NEXT: "tid":
+// CHECK-NEXT: "ts":
+// CHECK: "name": "clang"
+// CHECK: "name": "process_name"
+
+#include 
+
+int main() {
+  std::cout << "Foo" << std::endl;
+  return 0;
+}


Index: clang/tools/driver/cc1_main.cpp
===
--- clang/tools/driver/cc1_main.cpp
+++ clang/tools/driver/cc1_main.cpp
@@ -241,6 +241,11 @@
 
 llvm::timeTraceProfilerWrite(*profilerOutput);
 llvm::timeTraceProfilerCleanup();
+
+llvm::errs() << "Time trace json-file dumped to " << Path.str() << "\n";
+llvm::errs()
+<< "Use chrome://tracing or Speedscope App "
+   "(https://www.speedscope.app) for flamegraph visualization\n";
   }
 
   // Our error handler depends on the Diagnostics object, which we're
Index: clang/test/Driver/check-time-trace.cpp
===
--- /dev/null
+++ clang/test/Driver/check-time-trace.cpp
@@ -0,0 +1,23 @@
+// RUN: %clangxx -ftime-trace %s 2>&1 | grep "Time trace json-file dumped to" \
+// RUN:   | awk '{print $NF}' | xargs cat \
+// RUN:   | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
+// RUN:   | FileCheck %s
+
+// CHECK: "traceEvents": [
+// CHECK: "args":
+// CHECK: "detail":
+// CHECK: "dur":
+// CHECK: "name": "Source"
+// CHECK-NEXT: "ph":
+// CHECK-NEXT: "pid":
+// CHECK-NEXT: "tid":
+// CHECK-NEXT: "ts":
+// CHECK: "name": "clang"
+// CHECK: "name": "process_name"
+
+#include 
+
+int main() {
+  std::cout << "Foo" << std::endl;
+  return 0;
+}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D61914: [Support][Test] Time profiler: add regression test

2019-06-07 Thread Anton Afanasyev via Phabricator via cfe-commits
anton-afanasyev marked 4 inline comments as done.
anton-afanasyev added a comment.

In D61914#1512021 , @aganea wrote:

> Could you please move the test to a more approriate location? (ie. 
> clang/trunk/test/Driver/)


Thanks, I've moved it there.




Comment at: clang/tools/driver/cc1_main.cpp:245
+
+llvm::errs() << "Time trace json-file dumped to " << Path.str() << "\n";
+llvm::errs()

aganea wrote:
> This seems a bit too chatty. Suround these two lines with `if 
> (Config->Verbose)` ?
I don't think it should be done this way for several reasons:
1. This info is actually needed by user when one uses `--ftime-trace` since 
json-file is usually dumped to random filename located in `/tmp/`. Therefore 
`--ftime-trace` means `--ftime-trace --verbose` itself. Without this info user 
cannot understand where dumped file is. How can he know about `--verbose`?
2. Option `--ftime-report` is much more chatty, it dumps several tables to 
terminal. This option just dumps to file, but tells where file is.
3. I have not found elegant way to check `--verbose` option here, one should 
add it to `clang::FrontendOptions` or so.



Comment at: llvm/test/Support/check-time-trace.cxx:4
+
+// CHECK: "args":{"name":"clang"}
+

aganea wrote:
> I don't see any other `-ftime-trace` tests, I would add a few more exhaustive 
> file format checks here.
Ok, I've added more checks, parsing json file by python.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61914



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


[PATCH] D62998: [ARM] Fix bugs introduced by the fp64/d32 rework.

2019-06-07 Thread Sjoerd Meijer via Phabricator via cfe-commits
SjoerdMeijer added a comment.

Cheers, LGTM too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62998



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


[PATCH] D62998: [ARM] Fix bugs introduced by the fp64/d32 rework.

2019-06-07 Thread Simon Tatham via Phabricator via cfe-commits
simon_tatham updated this revision to Diff 203526.
simon_tatham added a comment.

Renamed `FeaturesAfter` to `ExtensionFeatures` and added a comment
explaining why it has to be separate.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62998

Files:
  clang/lib/Basic/Targets/ARM.cpp
  clang/lib/Driver/ToolChains/Arch/ARM.cpp
  clang/test/CodeGen/arm-target-features.c
  clang/test/Driver/arm-mfpu.c
  clang/test/Driver/armv8.1m.main.c
  clang/test/Preprocessor/arm-acle-6.5.c
  clang/test/Preprocessor/arm-target-features.c
  llvm/lib/Support/ARMTargetParser.cpp

Index: llvm/lib/Support/ARMTargetParser.cpp
===
--- llvm/lib/Support/ARMTargetParser.cpp
+++ llvm/lib/Support/ARMTargetParser.cpp
@@ -162,87 +162,63 @@
   if (FPUKind >= FK_LAST || FPUKind == FK_INVALID)
 return false;
 
-  // FPU version subtarget features are inclusive of lower-numbered ones, so
-  // enable the one corresponding to this version and disable all that are
-  // higher. We also have to make sure to disable fp16 when vfp4 is disabled,
-  // as +vfp4 implies +fp16 but -vfp4 does not imply -fp16.
-  switch (FPUNames[FPUKind].FPUVer) {
-  case FPUVersion::VFPV5_FULLFP16:
-Features.push_back("+fp-armv8");
-Features.push_back("+fullfp16");
-break;
-  case FPUVersion::VFPV5:
-Features.push_back("+fp-armv8");
-break;
-  case FPUVersion::VFPV4:
-Features.push_back("+vfp4");
-Features.push_back("-fp-armv8");
-break;
-  case FPUVersion::VFPV3_FP16:
-Features.push_back("+vfp3");
-Features.push_back("+fp16");
-Features.push_back("-vfp4");
-Features.push_back("-fp-armv8");
-break;
-  case FPUVersion::VFPV3:
-Features.push_back("+vfp3");
-Features.push_back("-fp16");
-Features.push_back("-vfp4");
-Features.push_back("-fp-armv8");
-break;
-  case FPUVersion::VFPV2:
-Features.push_back("+vfp2");
-Features.push_back("-vfp3");
-Features.push_back("-fp16");
-Features.push_back("-vfp4");
-Features.push_back("-fp-armv8");
-break;
-  case FPUVersion::NONE:
-Features.push_back("-fpregs");
-Features.push_back("-vfp2");
-Features.push_back("-vfp3");
-Features.push_back("-fp16");
-Features.push_back("-vfp4");
-Features.push_back("-fp-armv8");
-break;
-  }
-
-  // fp64 and d32 subtarget features are independent of each other, so we
-  // must disable/enable both.
-  if (FPUKind == FK_NONE) {
-Features.push_back("-fp64");
-Features.push_back("-d32");
-  } else {
-switch (FPUNames[FPUKind].Restriction) {
-case FPURestriction::SP_D16:
-  Features.push_back("-fp64");
-  Features.push_back("-d32");
-  break;
-case FPURestriction::D16:
-  Features.push_back("+fp64");
-  Features.push_back("-d32");
-  break;
-case FPURestriction::None:
-  Features.push_back("+fp64");
-  Features.push_back("+d32");
-  break;
-}
+  static const struct FPUFeatureNameInfo {
+const char *PlusName, *MinusName;
+FPUVersion MinVersion;
+FPURestriction MaxRestriction;
+  } FPUFeatureInfoList[] = {
+// We have to specify the + and - versions of the name in full so
+// that we can return them as static StringRefs.
+//
+// Also, the SubtargetFeatures ending in just "sp" are listed here
+// under FPURestriction::None, which is the only FPURestriction in
+// which they would be valid (since FPURestriction::SP doesn't
+// exist).
+
+{"+fpregs", "-fpregs", FPUVersion::VFPV2, FPURestriction::SP_D16},
+{"+vfp2", "-vfp2", FPUVersion::VFPV2, FPURestriction::None},
+{"+vfp2d16", "-vfp2d16", FPUVersion::VFPV2, FPURestriction::D16},
+{"+vfp2d16sp", "-vfp2d16sp", FPUVersion::VFPV2, FPURestriction::SP_D16},
+{"+vfp2sp", "-vfp2sp", FPUVersion::VFPV2, FPURestriction::None},
+{"+vfp3", "-vfp3", FPUVersion::VFPV3, FPURestriction::None},
+{"+vfp3d16", "-vfp3d16", FPUVersion::VFPV3, FPURestriction::D16},
+{"+vfp3d16sp", "-vfp3d16sp", FPUVersion::VFPV3, FPURestriction::SP_D16},
+{"+vfp3sp", "-vfp3sp", FPUVersion::VFPV3, FPURestriction::None},
+{"+fp16", "-fp16", FPUVersion::VFPV3_FP16, FPURestriction::SP_D16},
+{"+vfp4", "-vfp4", FPUVersion::VFPV4, FPURestriction::None},
+{"+vfp4d16", "-vfp4d16", FPUVersion::VFPV4, FPURestriction::D16},
+{"+vfp4d16sp", "-vfp4d16sp", FPUVersion::VFPV4, FPURestriction::SP_D16},
+{"+vfp4sp", "-vfp4sp", FPUVersion::VFPV4, FPURestriction::None},
+{"+fp-armv8", "-fp-armv8", FPUVersion::VFPV5, FPURestriction::None},
+{"+fp-armv8d16", "-fp-armv8d16", FPUVersion::VFPV5, FPURestriction::D16},
+{"+fp-armv8d16sp", "-fp-armv8d16sp", FPUVersion::VFPV5, FPURestriction::SP_D16},
+{"+fp-armv8sp", "-fp-armv8sp", FPUVersion::VFPV5, FPURestriction::None},
+{"+fullfp16", "-fullfp16", FPUVersion::VFPV5_FULLFP16, FPURestriction::SP_D16},
+{"+fp64", 

[PATCH] D50147: clang-format: support external styles

2019-06-07 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment.

In D50147#157 , @sammccall wrote:

> One thing that's unclear to me is whether your aim is to
>
> 1. solve a concrete problem for your organization
> 2. solve a family of problems for similar organizations
> 3. add a new way of configuring styles for many types of users/projects


First and forehand, I have a problem to solve in my organization : we have many 
projects, and maintaining the config file in some many repositories is not 
practical.
In some case (like, LLVM, google or mozilla), this is not an issue because the 
formatting rules are hard-coded in clang-format.
In other large organisation (like Qt, KDE or many private compagnies), there 
may be coding-rules already in place and it is not practical to store the 
configuration in clang-format.
(This is not so much an issue in small-organisation, with few 
projects/repositories : each project/repo may manage its own clang-format 
config file)

The goal is to support this use-case : organisation-wide styles, without 
patching clang-format.

> If it's 1) I think this is very reasonable and we should focus on finding the 
> simplest mechanism that will work. Is it possible to always set an 
> environment variable, or a build-time parameter, or install the style file in 
> a well-known absolute path (is there really a mix of win/unix users?)

In our case, we actually have more than one "standard" style, a combination of 
various OS (linux, windows, macos), and not a very strong control on user 
computers. So we cannot rely on a specific file or variable being setup by an 
administrator.
Therefore, I think the solution should still be generic enough, and there is no 
reason to restrict it to one use case.

> If it's 2), I think what's missing is evidence that other orgs have similar 
> problems and requirements.

I think many orgs have the same issue, but some of them have found a solution 
by hard-coding their style in clang-format...

> Option 3) is interesting, but much more ambitious and needs to start with a 
> design doc that discusses the use cases, alternatives, and implications. 
> Certainly anything involving fetching styles via git/http falls into this 
> bucket, I think.

git/http/... is indeed much more complicated. It would solve the issue of 
"transparent" setup, but introduces many subtleties : how to cache the result 
(to handle offline use or downtime issues), how to handle updates

> @klimek in case I'm way off base here, or there have been past discussions 
> that shed light on this.
> 
> With that in mind, I'd be very happy to approve the build time config and/or 
> an env variable, as long as they're off by default. It's easy to turn them on 
> later, but not easy to turn them off.
>  If they're going to be on by default, I think we need a strong reason.

I they are going to be off by default, it means we would still need to patch 
clang-format to use it, correct ?
I would like to avoid this, as it is quite time consuming; and it would 
actually be easier in that case to just add yet another hard-coded style in the 
patched binary...

In D50147#157 , @sammccall wrote:

> >> - understanding how distro packaging is going to work
>
> There's a mechanism, but how is it to be used? Will/should projects with a 
> style guide provide style packages for distros? Or should these be part of 
> the "official" clang-format package? 
>  If separate packages exist, how much is it going to confuse users that 
> clang-format will silently format the same project with a `.clang-format` 
> file different ways depending on what's installed?


The goal is to actually separate the styles from clang-format : so I don't see 
the point to make them part of the official clang-format package.
Usage may be different: the styles may be setup through different packages 
(e.g. Qt style in qt-core package), installed manually by user, 
This is surely not perfect, since different packages may indeed provide the 
same style : technically this is not an issue (packages must just be marked as 
conflicting), but it is indeed the organisation's responsibility to use 
different names for the styles...
(to some extent, this may be improved by passing URLs for external styles, e.g. 
from git ; but this may even be an issue if different mirrors must be used...)


Repository:
  rC Clang

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

https://reviews.llvm.org/D50147



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


[PATCH] D62808: [clangd] Print the ignored variant symbols

2019-06-07 Thread Haojian Wu via Phabricator via cfe-commits
hokein marked an inline comment as done.
hokein added inline comments.



Comment at: clang-tools-extra/clangd/include-mapping/gen_std.py:119
+( a list of tuple (symbol_name, relative_path_to_symbol_page),
+  a list of tuple (variant_symbol_name, caption_text) )
   """

sammccall wrote:
> this is a significantly more complicated signature - do we need the extra 
> precision in the log message vs e.g. `Ignored variant of symbol abs from 
> path/to/complex.html`?
I think the current information is sufficient (`Ignore variant of symbol 
abs(complex)`), we are more caring about the entry name `symbol_name (caption)` 
(it is easy for us to find it in the symbol index page).




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62808



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


[PATCH] D60710: [ARM] Add ACLE feature macros for MVE.

2019-06-07 Thread Sjoerd Meijer via Phabricator via cfe-commits
SjoerdMeijer updated this revision to Diff 203522.
SjoerdMeijer added a comment.

Set FullFP16 for +mve.fp


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

https://reviews.llvm.org/D60710

Files:
  clang/lib/Basic/Targets/ARM.cpp
  clang/lib/Basic/Targets/ARM.h
  clang/test/Preprocessor/arm-target-features.c

Index: clang/test/Preprocessor/arm-target-features.c
===
--- clang/test/Preprocessor/arm-target-features.c
+++ clang/test/Preprocessor/arm-target-features.c
@@ -748,6 +748,26 @@
 // KRAIT-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
 // KRAIT-ALLOW-FP-INSTR:#define  __ARM_VFPV4__ 1
 
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81M %s
+// CHECK-V81M: #define __ARM_ARCH 8
+// CHECK-V81M: #define __ARM_ARCH_8_1M_MAIN__ 1
+// CHECK-V81M: #define __ARM_ARCH_ISA_THUMB 2
+// CHECK-V81M: #define __ARM_ARCH_PROFILE 'M'
+// CHECK-V81M-NOT: #define __ARM_FEATURE_DSP
+// CHECK-V81M-NOT: #define __ARM_FEATURE_MVE
+// CHECK-V81M-NOT: #define __ARM_FEATURE_SIMD32
+
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81M-MVE %s
+// CHECK-V81M-MVE: #define __ARM_FEATURE_DSP 1
+// CHECK-V81M-MVE: #define __ARM_FEATURE_MVE 1
+// CHECK-V81M-MVE: #define __ARM_FEATURE_SIMD32 1
+
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve.fp -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81M-MVE-FP %s
+// CHECK-V81M-MVE-FP: #define __ARM_FEATURE_DSP 1
+// CHECK-V81M-MVE-FP: #define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC 1
+// CHECK-V81M-MVE-FP: #define __ARM_FEATURE_MVE 3
+// CHECK-V81M-MVE-FP: #define __ARM_FEATURE_SIMD32 1
+
 // RUN: %clang -target armv8.1a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81A %s
 // CHECK-V81A: #define __ARM_ARCH 8
 // CHECK-V81A: #define __ARM_ARCH_8_1A__ 1
Index: clang/lib/Basic/Targets/ARM.h
===
--- clang/lib/Basic/Targets/ARM.h
+++ clang/lib/Basic/Targets/ARM.h
@@ -33,6 +33,11 @@
 FPARMV8 = (1 << 4)
   };
 
+  enum MVEMode {
+  MVE_INT = (1 << 0),
+  MVE_FP  = (1 << 1)
+  };
+
   // Possible HWDiv features.
   enum HWDivMode { HWDivThumb = (1 << 0), HWDivARM = (1 << 1) };
 
@@ -56,6 +61,7 @@
   unsigned ArchVersion;
 
   unsigned FPU : 5;
+  unsigned MVE : 2;
 
   unsigned IsAAPCS : 1;
   unsigned HWDiv : 2;
@@ -100,6 +106,8 @@
   bool isThumb() const;
   bool supportsThumb() const;
   bool supportsThumb2() const;
+  bool hasMVE() const;
+  bool hasMVEFloat() const;
 
   StringRef getCPUAttr() const;
   StringRef getCPUProfile() const;
Index: clang/lib/Basic/Targets/ARM.cpp
===
--- clang/lib/Basic/Targets/ARM.cpp
+++ clang/lib/Basic/Targets/ARM.cpp
@@ -146,6 +146,14 @@
   }
 }
 
+bool ARMTargetInfo::hasMVE() const {
+  return ArchKind == llvm::ARM::ArchKind::ARMV8_1MMainline && MVE != 0;
+}
+
+bool ARMTargetInfo::hasMVEFloat() const {
+  return hasMVE() && (MVE & MVE_FP);
+}
+
 bool ARMTargetInfo::isThumb() const {
   return ArchISA == llvm::ARM::ISAKind::THUMB;
 }
@@ -448,6 +456,14 @@
   HasLegalHalfType = true;
 } else if (Feature == "+dotprod") {
   DotProd = true;
+} else if (Feature == "+mve") {
+  DSP = 1;
+  MVE |= MVE_INT;
+} else if (Feature == "+mve.fp") {
+  DSP = 1;
+  HasLegalHalfType = true;
+  MVE |= MVE_INT | MVE_FP;
+  HW_FP |= HW_FP_SP | HW_FP_HP;
 }
   }
 
@@ -498,6 +514,7 @@
   .Case("vfp", FPU && !SoftFloat)
   .Case("hwdiv", HWDiv & HWDivThumb)
   .Case("hwdiv-arm", HWDiv & HWDivARM)
+  .Case("mve", hasMVE())
   .Default(false);
 }
 
@@ -713,6 +730,10 @@
 "0x" + Twine::utohexstr(HW_FP & ~HW_FP_DP));
   }
 
+  if (hasMVE()) {
+Builder.defineMacro("__ARM_FEATURE_MVE", hasMVEFloat() ? "3" : "1");
+  }
+
   Builder.defineMacro("__ARM_SIZEOF_WCHAR_T",
   Twine(Opts.WCharSize ? Opts.WCharSize : 4));
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D60710: [ARM] Add ACLE feature macros for MVE.

2019-06-07 Thread Sjoerd Meijer via Phabricator via cfe-commits
SjoerdMeijer marked an inline comment as done.
SjoerdMeijer added inline comments.



Comment at: clang/lib/Basic/Targets/ARM.cpp:465
+  MVE |= MVE_INT | MVE_FP;
+  HW_FP |= HW_FP_SP | HW_FP_HP;
 }

ostannard wrote:
> Does this also need to set FPU and HasLegalHalfType?
Yep, thanks for catching this one, will fix this.


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

https://reviews.llvm.org/D60710



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


[PATCH] D62850: [X86] Fix builtins-x86.c test where it wasn't using immediates. NFC

2019-06-07 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL362786: [X86][test] Add test cases using immediates to 
builtins-x86.c (authored by russell_gallop, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D62850?vs=203124=203519#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62850

Files:
  cfe/trunk/test/CodeGen/builtins-x86.c


Index: cfe/trunk/test/CodeGen/builtins-x86.c
===
--- cfe/trunk/test/CodeGen/builtins-x86.c
+++ cfe/trunk/test/CodeGen/builtins-x86.c
@@ -399,6 +399,17 @@
 #ifndef OPENCL
   (void) _mm_pause();
 #endif
+
+  tmp_V4s = __builtin_ia32_psllwi(tmp_V4s, imm_i_0_8);
+  tmp_V2i = __builtin_ia32_pslldi(tmp_V2i, imm_i_0_8);
+  tmp_V1LLi = __builtin_ia32_psllqi(tmp_V1LLi, imm_i_0_8);
+  tmp_V4s = __builtin_ia32_psrawi(tmp_V4s, imm_i_0_8);
+  tmp_V2i = __builtin_ia32_psradi(tmp_V2i, imm_i_0_8);
+  tmp_V4s = __builtin_ia32_psrlwi(tmp_V4s, imm_i_0_8);
+  tmp_V2i = __builtin_ia32_psrldi(tmp_V2i, imm_i_0_8);
+  tmp_V1LLi = __builtin_ia32_psrlqi(tmp_V1LLi, imm_i_0_8);
+
+  // Using non-immediate argument supported for gcc compatibility
   tmp_V4s = __builtin_ia32_psllwi(tmp_V4s, tmp_i);
   tmp_V2i = __builtin_ia32_pslldi(tmp_V2i, tmp_i);
   tmp_V1LLi = __builtin_ia32_psllqi(tmp_V1LLi, tmp_i);
@@ -407,6 +418,7 @@
   tmp_V4s = __builtin_ia32_psrlwi(tmp_V4s, tmp_i);
   tmp_V2i = __builtin_ia32_psrldi(tmp_V2i, tmp_i);
   tmp_V1LLi = __builtin_ia32_psrlqi(tmp_V1LLi, tmp_i);
+
   tmp_V1LLi = __builtin_ia32_pmuludq(tmp_V2i, tmp_V2i);
   tmp_V2LLi = __builtin_ia32_pmuludq128(tmp_V4i, tmp_V4i);
   tmp_V8s = __builtin_ia32_psraw128(tmp_V8s, tmp_V8s);
@@ -417,6 +429,17 @@
   tmp_V8s = __builtin_ia32_psllw128(tmp_V8s, tmp_V8s);
   tmp_V4i = __builtin_ia32_pslld128(tmp_V4i, tmp_V4i);
   tmp_V2LLi = __builtin_ia32_psllq128(tmp_V2LLi, tmp_V2LLi);
+
+  tmp_V8s = __builtin_ia32_psllwi128(tmp_V8s, imm_i_0_8);
+  tmp_V4i = __builtin_ia32_pslldi128(tmp_V4i, imm_i_0_8);
+  tmp_V2LLi = __builtin_ia32_psllqi128(tmp_V2LLi, imm_i_0_8);
+  tmp_V8s = __builtin_ia32_psrlwi128(tmp_V8s, imm_i_0_8);
+  tmp_V4i = __builtin_ia32_psrldi128(tmp_V4i, imm_i_0_8);
+  tmp_V2LLi = __builtin_ia32_psrlqi128(tmp_V2LLi, imm_i_0_8);
+  tmp_V8s = __builtin_ia32_psrawi128(tmp_V8s, imm_i_0_8);
+  tmp_V4i = __builtin_ia32_psradi128(tmp_V4i, imm_i_0_8);
+
+  // Using non-immediate argument supported for gcc compatibility
   tmp_V8s = __builtin_ia32_psllwi128(tmp_V8s, tmp_i);
   tmp_V4i = __builtin_ia32_pslldi128(tmp_V4i, tmp_i);
   tmp_V2LLi = __builtin_ia32_psllqi128(tmp_V2LLi, tmp_i);
@@ -425,6 +448,7 @@
   tmp_V2LLi = __builtin_ia32_psrlqi128(tmp_V2LLi, tmp_i);
   tmp_V8s = __builtin_ia32_psrawi128(tmp_V8s, tmp_i);
   tmp_V4i = __builtin_ia32_psradi128(tmp_V4i, tmp_i);
+
   tmp_V4i = __builtin_ia32_pmaddwd128(tmp_V8s, tmp_V8s);
   (void) __builtin_ia32_monitor(tmp_vp, tmp_Ui, tmp_Ui);
   (void) __builtin_ia32_mwait(tmp_Ui, tmp_Ui);


Index: cfe/trunk/test/CodeGen/builtins-x86.c
===
--- cfe/trunk/test/CodeGen/builtins-x86.c
+++ cfe/trunk/test/CodeGen/builtins-x86.c
@@ -399,6 +399,17 @@
 #ifndef OPENCL
   (void) _mm_pause();
 #endif
+
+  tmp_V4s = __builtin_ia32_psllwi(tmp_V4s, imm_i_0_8);
+  tmp_V2i = __builtin_ia32_pslldi(tmp_V2i, imm_i_0_8);
+  tmp_V1LLi = __builtin_ia32_psllqi(tmp_V1LLi, imm_i_0_8);
+  tmp_V4s = __builtin_ia32_psrawi(tmp_V4s, imm_i_0_8);
+  tmp_V2i = __builtin_ia32_psradi(tmp_V2i, imm_i_0_8);
+  tmp_V4s = __builtin_ia32_psrlwi(tmp_V4s, imm_i_0_8);
+  tmp_V2i = __builtin_ia32_psrldi(tmp_V2i, imm_i_0_8);
+  tmp_V1LLi = __builtin_ia32_psrlqi(tmp_V1LLi, imm_i_0_8);
+
+  // Using non-immediate argument supported for gcc compatibility
   tmp_V4s = __builtin_ia32_psllwi(tmp_V4s, tmp_i);
   tmp_V2i = __builtin_ia32_pslldi(tmp_V2i, tmp_i);
   tmp_V1LLi = __builtin_ia32_psllqi(tmp_V1LLi, tmp_i);
@@ -407,6 +418,7 @@
   tmp_V4s = __builtin_ia32_psrlwi(tmp_V4s, tmp_i);
   tmp_V2i = __builtin_ia32_psrldi(tmp_V2i, tmp_i);
   tmp_V1LLi = __builtin_ia32_psrlqi(tmp_V1LLi, tmp_i);
+
   tmp_V1LLi = __builtin_ia32_pmuludq(tmp_V2i, tmp_V2i);
   tmp_V2LLi = __builtin_ia32_pmuludq128(tmp_V4i, tmp_V4i);
   tmp_V8s = __builtin_ia32_psraw128(tmp_V8s, tmp_V8s);
@@ -417,6 +429,17 @@
   tmp_V8s = __builtin_ia32_psllw128(tmp_V8s, tmp_V8s);
   tmp_V4i = __builtin_ia32_pslld128(tmp_V4i, tmp_V4i);
   tmp_V2LLi = __builtin_ia32_psllq128(tmp_V2LLi, tmp_V2LLi);
+
+  tmp_V8s = __builtin_ia32_psllwi128(tmp_V8s, imm_i_0_8);
+  tmp_V4i = __builtin_ia32_pslldi128(tmp_V4i, imm_i_0_8);
+  tmp_V2LLi = __builtin_ia32_psllqi128(tmp_V2LLi, imm_i_0_8);
+  tmp_V8s = __builtin_ia32_psrlwi128(tmp_V8s, imm_i_0_8);
+  tmp_V4i = __builtin_ia32_psrldi128(tmp_V4i, imm_i_0_8);
+  tmp_V2LLi = __builtin_ia32_psrlqi128(tmp_V2LLi, imm_i_0_8);
+  tmp_V8s = 

r362786 - [X86][test] Add test cases using immediates to builtins-x86.c

2019-06-07 Thread Russell Gallop via cfe-commits
Author: russell_gallop
Date: Fri Jun  7 02:51:44 2019
New Revision: 362786

URL: http://llvm.org/viewvc/llvm-project?rev=362786=rev
Log:
[X86][test] Add test cases using immediates to builtins-x86.c

These builtins should work with immediate or variable shift operand for
gcc compatibility.

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

Modified:
cfe/trunk/test/CodeGen/builtins-x86.c

Modified: cfe/trunk/test/CodeGen/builtins-x86.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-x86.c?rev=362786=362785=362786=diff
==
--- cfe/trunk/test/CodeGen/builtins-x86.c (original)
+++ cfe/trunk/test/CodeGen/builtins-x86.c Fri Jun  7 02:51:44 2019
@@ -399,6 +399,17 @@ void f0() {
 #ifndef OPENCL
   (void) _mm_pause();
 #endif
+
+  tmp_V4s = __builtin_ia32_psllwi(tmp_V4s, imm_i_0_8);
+  tmp_V2i = __builtin_ia32_pslldi(tmp_V2i, imm_i_0_8);
+  tmp_V1LLi = __builtin_ia32_psllqi(tmp_V1LLi, imm_i_0_8);
+  tmp_V4s = __builtin_ia32_psrawi(tmp_V4s, imm_i_0_8);
+  tmp_V2i = __builtin_ia32_psradi(tmp_V2i, imm_i_0_8);
+  tmp_V4s = __builtin_ia32_psrlwi(tmp_V4s, imm_i_0_8);
+  tmp_V2i = __builtin_ia32_psrldi(tmp_V2i, imm_i_0_8);
+  tmp_V1LLi = __builtin_ia32_psrlqi(tmp_V1LLi, imm_i_0_8);
+
+  // Using non-immediate argument supported for gcc compatibility
   tmp_V4s = __builtin_ia32_psllwi(tmp_V4s, tmp_i);
   tmp_V2i = __builtin_ia32_pslldi(tmp_V2i, tmp_i);
   tmp_V1LLi = __builtin_ia32_psllqi(tmp_V1LLi, tmp_i);
@@ -407,6 +418,7 @@ void f0() {
   tmp_V4s = __builtin_ia32_psrlwi(tmp_V4s, tmp_i);
   tmp_V2i = __builtin_ia32_psrldi(tmp_V2i, tmp_i);
   tmp_V1LLi = __builtin_ia32_psrlqi(tmp_V1LLi, tmp_i);
+
   tmp_V1LLi = __builtin_ia32_pmuludq(tmp_V2i, tmp_V2i);
   tmp_V2LLi = __builtin_ia32_pmuludq128(tmp_V4i, tmp_V4i);
   tmp_V8s = __builtin_ia32_psraw128(tmp_V8s, tmp_V8s);
@@ -417,6 +429,17 @@ void f0() {
   tmp_V8s = __builtin_ia32_psllw128(tmp_V8s, tmp_V8s);
   tmp_V4i = __builtin_ia32_pslld128(tmp_V4i, tmp_V4i);
   tmp_V2LLi = __builtin_ia32_psllq128(tmp_V2LLi, tmp_V2LLi);
+
+  tmp_V8s = __builtin_ia32_psllwi128(tmp_V8s, imm_i_0_8);
+  tmp_V4i = __builtin_ia32_pslldi128(tmp_V4i, imm_i_0_8);
+  tmp_V2LLi = __builtin_ia32_psllqi128(tmp_V2LLi, imm_i_0_8);
+  tmp_V8s = __builtin_ia32_psrlwi128(tmp_V8s, imm_i_0_8);
+  tmp_V4i = __builtin_ia32_psrldi128(tmp_V4i, imm_i_0_8);
+  tmp_V2LLi = __builtin_ia32_psrlqi128(tmp_V2LLi, imm_i_0_8);
+  tmp_V8s = __builtin_ia32_psrawi128(tmp_V8s, imm_i_0_8);
+  tmp_V4i = __builtin_ia32_psradi128(tmp_V4i, imm_i_0_8);
+
+  // Using non-immediate argument supported for gcc compatibility
   tmp_V8s = __builtin_ia32_psllwi128(tmp_V8s, tmp_i);
   tmp_V4i = __builtin_ia32_pslldi128(tmp_V4i, tmp_i);
   tmp_V2LLi = __builtin_ia32_psllqi128(tmp_V2LLi, tmp_i);
@@ -425,6 +448,7 @@ void f0() {
   tmp_V2LLi = __builtin_ia32_psrlqi128(tmp_V2LLi, tmp_i);
   tmp_V8s = __builtin_ia32_psrawi128(tmp_V8s, tmp_i);
   tmp_V4i = __builtin_ia32_psradi128(tmp_V4i, tmp_i);
+
   tmp_V4i = __builtin_ia32_pmaddwd128(tmp_V8s, tmp_V8s);
   (void) __builtin_ia32_monitor(tmp_vp, tmp_Ui, tmp_Ui);
   (void) __builtin_ia32_mwait(tmp_Ui, tmp_Ui);


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


[PATCH] D62582: [CodeComplete] Improve overload handling for C++ qualified and ref-qualified methods.

2019-06-07 Thread Sam McCall via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
sammccall marked an inline comment as done.
Closed by commit rL362785: [CodeComplete] Improve overload handling for C++ 
qualified and ref-qualified… (authored by sammccall, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D62582?vs=202441=203518#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62582

Files:
  cfe/trunk/lib/Sema/SemaCodeComplete.cpp
  cfe/trunk/test/CodeCompletion/member-access.cpp

Index: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
===
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp
@@ -16,7 +16,9 @@
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/ExprObjC.h"
 #include "clang/AST/QualTypeNames.h"
+#include "clang/AST/Type.h"
 #include "clang/Basic/CharInfo.h"
+#include "clang/Basic/Specifiers.h"
 #include "clang/Lex/HeaderSearch.h"
 #include "clang/Lex/MacroInfo.h"
 #include "clang/Lex/Preprocessor.h"
@@ -152,9 +154,16 @@
   /// different levels of, e.g., the inheritance hierarchy.
   std::list ShadowMaps;
 
+  /// Overloaded C++ member functions found by SemaLookup.
+  /// Used to determine when one overload is dominated by another.
+  llvm::DenseMap, ShadowMapEntry>
+  OverloadMap;
+
   /// If we're potentially referring to a C++ member function, the set
   /// of qualifiers applied to the object type.
   Qualifiers ObjectTypeQualifiers;
+  /// The kind of the object expression, for rvalue/lvalue overloads.
+  ExprValueKind ObjectKind;
 
   /// Whether the \p ObjectTypeQualifiers field is active.
   bool HasObjectTypeQualifiers;
@@ -230,8 +239,9 @@
   /// out member functions that aren't available (because there will be a
   /// cv-qualifier mismatch) or prefer functions with an exact qualifier
   /// match.
-  void setObjectTypeQualifiers(Qualifiers Quals) {
+  void setObjectTypeQualifiers(Qualifiers Quals, ExprValueKind Kind) {
 ObjectTypeQualifiers = Quals;
+ObjectKind = Kind;
 HasObjectTypeQualifiers = true;
   }
 
@@ -1157,6 +1167,53 @@
   R.InBaseClass = true;
 }
 
+enum class OverloadCompare { BothViable, Dominates, Dominated };
+// Will Candidate ever be called on the object, when overloaded with Incumbent?
+// Returns Dominates if Candidate is always called, Dominated if Incumbent is
+// always called, BothViable if either may be called dependending on arguments.
+// Precondition: must actually be overloads!
+static OverloadCompare compareOverloads(const CXXMethodDecl ,
+const CXXMethodDecl ,
+const Qualifiers ,
+ExprValueKind ObjectKind) {
+  if (Candidate.isVariadic() != Incumbent.isVariadic() ||
+  Candidate.getNumParams() != Incumbent.getNumParams() ||
+  Candidate.getMinRequiredArguments() !=
+  Incumbent.getMinRequiredArguments())
+return OverloadCompare::BothViable;
+  for (unsigned I = 0, E = Candidate.getNumParams(); I != E; ++I)
+if (Candidate.parameters()[I]->getType().getCanonicalType() !=
+Incumbent.parameters()[I]->getType().getCanonicalType())
+  return OverloadCompare::BothViable;
+  if (!llvm::empty(Candidate.specific_attrs()) ||
+  !llvm::empty(Incumbent.specific_attrs()))
+return OverloadCompare::BothViable;
+  // At this point, we know calls can't pick one or the other based on
+  // arguments, so one of the two must win. (Or both fail, handled elsewhere).
+  RefQualifierKind CandidateRef = Candidate.getRefQualifier();
+  RefQualifierKind IncumbentRef = Incumbent.getRefQualifier();
+  if (CandidateRef != IncumbentRef) {
+// If the object kind is LValue/RValue, there's one acceptable ref-qualifier
+// and it can't be mixed with ref-unqualified overloads (in valid code).
+
+// For xvalue objects, we prefer the rvalue overload even if we have to
+// add qualifiers (which is rare, because const&& is rare).
+if (ObjectKind == clang::VK_XValue)
+  return CandidateRef == RQ_RValue ? OverloadCompare::Dominates
+   : OverloadCompare::Dominated;
+  }
+  // Now the ref qualifiers are the same (or we're in some invalid state).
+  // So make some decision based on the qualifiers.
+  Qualifiers CandidateQual = Candidate.getMethodQualifiers();
+  Qualifiers IncumbentQual = Incumbent.getMethodQualifiers();
+  bool CandidateSuperset = CandidateQual.compatiblyIncludes(IncumbentQual);
+  bool IncumbentSuperset = IncumbentQual.compatiblyIncludes(CandidateQual);
+  if (CandidateSuperset == IncumbentSuperset)
+return OverloadCompare::BothViable;
+  return IncumbentSuperset ? OverloadCompare::Dominates
+   : OverloadCompare::Dominated;
+}
+
 void ResultBuilder::AddResult(Result R, 

r362785 - [CodeComplete] Improve overload handling for C++ qualified and ref-qualified methods.

2019-06-07 Thread Sam McCall via cfe-commits
Author: sammccall
Date: Fri Jun  7 02:45:17 2019
New Revision: 362785

URL: http://llvm.org/viewvc/llvm-project?rev=362785=rev
Log:
[CodeComplete] Improve overload handling for C++ qualified and ref-qualified 
methods.

Summary:
- when a method is not available because of the target value kind (e.g. an &&
  method on a Foo& variable), then don't offer it.
- when a method is effectively shadowed by another method from the same class
  with a) an identical argument list and b) superior qualifiers, then don't
  offer it.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

Tags: #clang

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

Modified:
cfe/trunk/lib/Sema/SemaCodeComplete.cpp
cfe/trunk/test/CodeCompletion/member-access.cpp

Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=362785=362784=362785=diff
==
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Fri Jun  7 02:45:17 2019
@@ -16,7 +16,9 @@
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/ExprObjC.h"
 #include "clang/AST/QualTypeNames.h"
+#include "clang/AST/Type.h"
 #include "clang/Basic/CharInfo.h"
+#include "clang/Basic/Specifiers.h"
 #include "clang/Lex/HeaderSearch.h"
 #include "clang/Lex/MacroInfo.h"
 #include "clang/Lex/Preprocessor.h"
@@ -152,9 +154,16 @@ private:
   /// different levels of, e.g., the inheritance hierarchy.
   std::list ShadowMaps;
 
+  /// Overloaded C++ member functions found by SemaLookup.
+  /// Used to determine when one overload is dominated by another.
+  llvm::DenseMap, ShadowMapEntry>
+  OverloadMap;
+
   /// If we're potentially referring to a C++ member function, the set
   /// of qualifiers applied to the object type.
   Qualifiers ObjectTypeQualifiers;
+  /// The kind of the object expression, for rvalue/lvalue overloads.
+  ExprValueKind ObjectKind;
 
   /// Whether the \p ObjectTypeQualifiers field is active.
   bool HasObjectTypeQualifiers;
@@ -230,8 +239,9 @@ public:
   /// out member functions that aren't available (because there will be a
   /// cv-qualifier mismatch) or prefer functions with an exact qualifier
   /// match.
-  void setObjectTypeQualifiers(Qualifiers Quals) {
+  void setObjectTypeQualifiers(Qualifiers Quals, ExprValueKind Kind) {
 ObjectTypeQualifiers = Quals;
+ObjectKind = Kind;
 HasObjectTypeQualifiers = true;
   }
 
@@ -1157,6 +1167,53 @@ static void setInBaseClass(ResultBuilder
   R.InBaseClass = true;
 }
 
+enum class OverloadCompare { BothViable, Dominates, Dominated };
+// Will Candidate ever be called on the object, when overloaded with Incumbent?
+// Returns Dominates if Candidate is always called, Dominated if Incumbent is
+// always called, BothViable if either may be called dependending on arguments.
+// Precondition: must actually be overloads!
+static OverloadCompare compareOverloads(const CXXMethodDecl ,
+const CXXMethodDecl ,
+const Qualifiers ,
+ExprValueKind ObjectKind) {
+  if (Candidate.isVariadic() != Incumbent.isVariadic() ||
+  Candidate.getNumParams() != Incumbent.getNumParams() ||
+  Candidate.getMinRequiredArguments() !=
+  Incumbent.getMinRequiredArguments())
+return OverloadCompare::BothViable;
+  for (unsigned I = 0, E = Candidate.getNumParams(); I != E; ++I)
+if (Candidate.parameters()[I]->getType().getCanonicalType() !=
+Incumbent.parameters()[I]->getType().getCanonicalType())
+  return OverloadCompare::BothViable;
+  if (!llvm::empty(Candidate.specific_attrs()) ||
+  !llvm::empty(Incumbent.specific_attrs()))
+return OverloadCompare::BothViable;
+  // At this point, we know calls can't pick one or the other based on
+  // arguments, so one of the two must win. (Or both fail, handled elsewhere).
+  RefQualifierKind CandidateRef = Candidate.getRefQualifier();
+  RefQualifierKind IncumbentRef = Incumbent.getRefQualifier();
+  if (CandidateRef != IncumbentRef) {
+// If the object kind is LValue/RValue, there's one acceptable 
ref-qualifier
+// and it can't be mixed with ref-unqualified overloads (in valid code).
+
+// For xvalue objects, we prefer the rvalue overload even if we have to
+// add qualifiers (which is rare, because const&& is rare).
+if (ObjectKind == clang::VK_XValue)
+  return CandidateRef == RQ_RValue ? OverloadCompare::Dominates
+   : OverloadCompare::Dominated;
+  }
+  // Now the ref qualifiers are the same (or we're in some invalid state).
+  // So make some decision based on the qualifiers.
+  Qualifiers CandidateQual = Candidate.getMethodQualifiers();
+  Qualifiers IncumbentQual = Incumbent.getMethodQualifiers();
+  bool CandidateSuperset = 

[PATCH] D62962: Clang implementation of sizeless types

2019-06-07 Thread JinGu Kang via Phabricator via cfe-commits
jaykang10 added inline comments.



Comment at: test/Sema/sizeless-1.c:29
+
+typedef svint8_t vec_int8 __attribute__((vector_size(64))); // expected-error 
{{invalid vector element type}}
+

Please check "__attribute__((ext_vector_type()))". I guess it is also invalid 
for this type.



Comment at: test/SemaCXX/sizeless-1.cpp:37
+
+typedef svint8_t vec_int8 __attribute__((vector_size(64))); // expected-error 
{{invalid vector element type}}
+

Please check "__attribute__((ext_vector_type()))". I guess it is also invalid 
for this type.


Repository:
  rC Clang

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

https://reviews.llvm.org/D62962



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


[PATCH] D62999: [clangd] Return 'RequestCancelled' on spurious completion triggers

2019-06-07 Thread Sam McCall via Phabricator via cfe-commits
sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.



Comment at: clang-tools-extra/clangd/ClangdLSPServer.cpp:734
+"ignored auto-triggered completion, preceding char did not match",
+ErrorCode::RequestCancelled));
   Server->codeComplete(Params.textDocument.uri.file(), Params.position, CCOpts,

this error code seems bogus, we should have a comment explaining that returning 
and empty list breaks vscode and any other error code breaks coc.nvim.

(Might want to file a vscode or LSP bug - trigger char is a heuristic, if [] 
isn't the preferred way for a server to say "no" then we should spell it out, 
if it is then vscode is wrong)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62999



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


[PATCH] D62958: [clang-tidy] Fix descriptions for modernize-make-unique/shared checks.

2019-06-07 Thread Haojian Wu via Phabricator via cfe-commits
hokein abandoned this revision.
hokein added a comment.

As discussed offline, we don't need a separate fix description for this check, 
as the check warning message clearly implies what the fix will do.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62958



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


[PATCH] D62998: [ARM] Fix bugs introduced by the fp64/d32 rework.

2019-06-07 Thread Sjoerd Meijer via Phabricator via cfe-commits
SjoerdMeijer added inline comments.



Comment at: clang/lib/Driver/ToolChains/Arch/ARM.cpp:103
  std::vector ,
+ std::vector ,
  const llvm::Triple ) {

Nitpick: can you comment in code somewhere what the purpose is of 
`FeaturesAfter`? Can it be renamed to something more descriptive? I don't know 
what it could be to be honest...



Comment at: clang/lib/Driver/ToolChains/Arch/ARM.cpp:449
 //as well.
-for (std::string Feature : {"vfp2", "vfp3", "vfp4", "fp-armv8", "fullfp16",
-"neon", "crypto", "dotprod", "fp16fml"})
-  if (std::find(std::begin(Features), std::end(Features), "+" + Feature) 
!= std::end(Features))
-Features.push_back(Args.MakeArgString("-" + Feature));
-
-// Disable the base feature unconditionally, even if it was not
-// explicitly in the features list (e.g. if we had +vfp3, which
-// implies it).
-Features.push_back("-fpregs");
+for (std::string Feature : {
+"vfp2", "vfp2sp", "vfp2d16", "vfp2d16sp",

This function and this code is truly one of the worst I guess I mean, it's 
not worse than it was before, but you'd really hope that there was a 
(targetparser) API that gives you a list of FPUs, possibly matching some 
criteria, rather than yet another list of hard coded strings. It gets worse, 
this is repeated in `lib/Support/ARMTargetParser.cpp`. End of rant! ;-)

More on topic: do we need to add +mve.fp here?



Comment at: llvm/lib/Support/ARMTargetParser.cpp:178
+
+{"+fpregs", "-fpregs", FPUVersion::VFPV2, FPURestriction::SP_D16},
+{"+vfp2", "-vfp2", FPUVersion::VFPV2, FPURestriction::None},

This looks familiar  I don't think we can easily simplify this? Or get rid 
of? I guess that's best done in a follow up when we this working again? Perhaps 
the only insignificant simplification is that we don't need the + and 
- because they are the same.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62998



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


[PATCH] D60710: [ARM] Add ACLE feature macros for MVE.

2019-06-07 Thread Oliver Stannard (Linaro) via Phabricator via cfe-commits
ostannard added inline comments.



Comment at: clang/lib/Basic/Targets/ARM.cpp:465
+  MVE |= MVE_INT | MVE_FP;
+  HW_FP |= HW_FP_SP | HW_FP_HP;
 }

Does this also need to set FPU and HasLegalHalfType?


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

https://reviews.llvm.org/D60710



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


[PATCH] D62998: [ARM] Fix bugs introduced by the fp64/d32 rework.

2019-06-07 Thread Oliver Stannard (Linaro) via Phabricator via cfe-commits
ostannard accepted this revision.
ostannard added a comment.
This revision is now accepted and ready to land.

LGTM with one change.




Comment at: clang/lib/Driver/ToolChains/Arch/ARM.cpp:294
 
+  std::vector FeaturesAfter;
+

You explained it in the commit message, but I think this could do with a 
comment in the code too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62998



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


[PATCH] D62835: [X86] -march=cooperlake (clang)

2019-06-07 Thread Pengfei Wang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL362781: [X86] -march=cooperlake (clang) (authored by 
pengfei, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D62835?vs=203329=203515#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62835

Files:
  cfe/trunk/include/clang/Basic/X86Target.def
  cfe/trunk/lib/Basic/Targets/X86.cpp
  cfe/trunk/test/Driver/x86-march.c
  cfe/trunk/test/Misc/target-invalid-cpu-note.c
  cfe/trunk/test/Preprocessor/predefined-arch-macros.c

Index: cfe/trunk/lib/Basic/Targets/X86.cpp
===
--- cfe/trunk/lib/Basic/Targets/X86.cpp
+++ cfe/trunk/lib/Basic/Targets/X86.cpp
@@ -156,6 +156,13 @@
 setFeatureEnabledImpl(Features, "avx512vbmi", true);
 setFeatureEnabledImpl(Features, "sha", true);
 LLVM_FALLTHROUGH;
+  case CK_Cooperlake:
+// Cannonlake, IcelakeClient and IcelakeServer have no AVX512BF16 feature
+if (Kind != CK_Cannonlake && Kind != CK_IcelakeClient &&
+Kind != CK_IcelakeServer)
+  // CPX inherits all CLX features plus AVX512BF16
+  setFeatureEnabledImpl(Features, "avx512bf16", true);
+LLVM_FALLTHROUGH;
   case CK_Cascadelake:
 //Cannonlake has no VNNI feature inside while Icelake has
 if (Kind != CK_Cannonlake)
@@ -176,9 +183,9 @@
 setFeatureEnabledImpl(Features, "xsavec", true);
 setFeatureEnabledImpl(Features, "xsaves", true);
 setFeatureEnabledImpl(Features, "mpx", true);
-if (Kind != CK_SkylakeServer
-&& Kind != CK_Cascadelake)
-  // SKX/CLX inherits all SKL features, except SGX
+if (Kind != CK_SkylakeServer && Kind != CK_Cascadelake &&
+Kind != CK_Cooperlake)
+  // SKX/CLX/CPX inherits all SKL features, except SGX
   setFeatureEnabledImpl(Features, "sgx", true);
 setFeatureEnabledImpl(Features, "clflushopt", true);
 setFeatureEnabledImpl(Features, "aes", true);
@@ -981,6 +988,7 @@
   case CK_SkylakeClient:
   case CK_SkylakeServer:
   case CK_Cascadelake:
+  case CK_Cooperlake:
   case CK_Cannonlake:
   case CK_IcelakeClient:
   case CK_IcelakeServer:
Index: cfe/trunk/include/clang/Basic/X86Target.def
===
--- cfe/trunk/include/clang/Basic/X86Target.def
+++ cfe/trunk/include/clang/Basic/X86Target.def
@@ -157,6 +157,10 @@
 /// Cascadelake Server microarchitecture based processors.
 PROC_WITH_FEAT(Cascadelake, "cascadelake", PROC_64_BIT, FEATURE_AVX512VNNI)
 
+/// \name Cooperlake Server
+/// Cooperlake Server microarchitecture based processors.
+PROC_WITH_FEAT(Cooperlake, "cooperlake", PROC_64_BIT, FEATURE_AVX512BF16)
+
 /// \name Cannonlake Client
 /// Cannonlake client microarchitecture based processors.
 PROC_WITH_FEAT(Cannonlake, "cannonlake", PROC_64_BIT, FEATURE_AVX512VBMI)
@@ -292,6 +296,7 @@
 FEATURE(FEATURE_VPCLMULQDQ)
 FEATURE(FEATURE_AVX512VNNI)
 FEATURE(FEATURE_AVX512BITALG)
+FEATURE(FEATURE_AVX512BF16)
 
 
 // FIXME: When commented out features are supported in LLVM, enable them here.
Index: cfe/trunk/test/Driver/x86-march.c
===
--- cfe/trunk/test/Driver/x86-march.c
+++ cfe/trunk/test/Driver/x86-march.c
@@ -52,6 +52,10 @@
 // RUN:   | FileCheck %s -check-prefix=cascadelake
 // cascadelake: "-target-cpu" "cascadelake"
 //
+// RUN: %clang -target x86_64-unknown-unknown -c -### %s -march=cooperlake 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=cooperlake
+// cooperlake: "-target-cpu" "cooperlake"
+//
 // RUN: %clang -target x86_64-unknown-unknown -c -### %s -march=knl 2>&1 \
 // RUN:   | FileCheck %s -check-prefix=knl
 // knl: "-target-cpu" "knl"
Index: cfe/trunk/test/Misc/target-invalid-cpu-note.c
===
--- cfe/trunk/test/Misc/target-invalid-cpu-note.c
+++ cfe/trunk/test/Misc/target-invalid-cpu-note.c
@@ -16,7 +16,7 @@
 // X86-SAME: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont,
 // X86-SAME: nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge,
 // X86-SAME: core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512,
-// X86-SAME: skx, cascadelake, cannonlake, icelake-client, icelake-server, knl, knm, lakemont, k6, k6-2, k6-3,
+// X86-SAME: skx, cascadelake, cooperlake, cannonlake, icelake-client, icelake-server, knl, knm, lakemont, k6, k6-2, k6-3,
 // X86-SAME: athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64,
 // X86-SAME: athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10,
 // X86-SAME: barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2,
@@ -27,7 +27,7 @@
 // X86_64: note: valid target CPU values are: nocona, core2, penryn, bonnell,
 // X86_64-SAME: atom, silvermont, slm, goldmont, 

r362781 - [X86] -march=cooperlake (clang)

2019-06-07 Thread Pengfei Wang via cfe-commits
Author: pengfei
Date: Fri Jun  7 01:53:37 2019
New Revision: 362781

URL: http://llvm.org/viewvc/llvm-project?rev=362781=rev
Log:
[X86] -march=cooperlake (clang)

Support intel -march=cooperlake in clang

Patch by Shengchen Kan (skan)

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

Modified:
cfe/trunk/include/clang/Basic/X86Target.def
cfe/trunk/lib/Basic/Targets/X86.cpp
cfe/trunk/test/Driver/x86-march.c
cfe/trunk/test/Misc/target-invalid-cpu-note.c
cfe/trunk/test/Preprocessor/predefined-arch-macros.c

Modified: cfe/trunk/include/clang/Basic/X86Target.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/X86Target.def?rev=362781=362780=362781=diff
==
--- cfe/trunk/include/clang/Basic/X86Target.def (original)
+++ cfe/trunk/include/clang/Basic/X86Target.def Fri Jun  7 01:53:37 2019
@@ -157,6 +157,10 @@ PROC_ALIAS(SkylakeServer, "skx")
 /// Cascadelake Server microarchitecture based processors.
 PROC_WITH_FEAT(Cascadelake, "cascadelake", PROC_64_BIT, FEATURE_AVX512VNNI)
 
+/// \name Cooperlake Server
+/// Cooperlake Server microarchitecture based processors.
+PROC_WITH_FEAT(Cooperlake, "cooperlake", PROC_64_BIT, FEATURE_AVX512BF16)
+
 /// \name Cannonlake Client
 /// Cannonlake client microarchitecture based processors.
 PROC_WITH_FEAT(Cannonlake, "cannonlake", PROC_64_BIT, FEATURE_AVX512VBMI)
@@ -292,6 +296,7 @@ FEATURE(FEATURE_GFNI)
 FEATURE(FEATURE_VPCLMULQDQ)
 FEATURE(FEATURE_AVX512VNNI)
 FEATURE(FEATURE_AVX512BITALG)
+FEATURE(FEATURE_AVX512BF16)
 
 
 // FIXME: When commented out features are supported in LLVM, enable them here.

Modified: cfe/trunk/lib/Basic/Targets/X86.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/X86.cpp?rev=362781=362780=362781=diff
==
--- cfe/trunk/lib/Basic/Targets/X86.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/X86.cpp Fri Jun  7 01:53:37 2019
@@ -156,6 +156,13 @@ bool X86TargetInfo::initFeatureMap(
 setFeatureEnabledImpl(Features, "avx512vbmi", true);
 setFeatureEnabledImpl(Features, "sha", true);
 LLVM_FALLTHROUGH;
+  case CK_Cooperlake:
+// Cannonlake, IcelakeClient and IcelakeServer have no AVX512BF16 feature
+if (Kind != CK_Cannonlake && Kind != CK_IcelakeClient &&
+Kind != CK_IcelakeServer)
+  // CPX inherits all CLX features plus AVX512BF16
+  setFeatureEnabledImpl(Features, "avx512bf16", true);
+LLVM_FALLTHROUGH;
   case CK_Cascadelake:
 //Cannonlake has no VNNI feature inside while Icelake has
 if (Kind != CK_Cannonlake)
@@ -176,9 +183,9 @@ bool X86TargetInfo::initFeatureMap(
 setFeatureEnabledImpl(Features, "xsavec", true);
 setFeatureEnabledImpl(Features, "xsaves", true);
 setFeatureEnabledImpl(Features, "mpx", true);
-if (Kind != CK_SkylakeServer
-&& Kind != CK_Cascadelake)
-  // SKX/CLX inherits all SKL features, except SGX
+if (Kind != CK_SkylakeServer && Kind != CK_Cascadelake &&
+Kind != CK_Cooperlake)
+  // SKX/CLX/CPX inherits all SKL features, except SGX
   setFeatureEnabledImpl(Features, "sgx", true);
 setFeatureEnabledImpl(Features, "clflushopt", true);
 setFeatureEnabledImpl(Features, "aes", true);
@@ -981,6 +988,7 @@ void X86TargetInfo::getTargetDefines(con
   case CK_SkylakeClient:
   case CK_SkylakeServer:
   case CK_Cascadelake:
+  case CK_Cooperlake:
   case CK_Cannonlake:
   case CK_IcelakeClient:
   case CK_IcelakeServer:

Modified: cfe/trunk/test/Driver/x86-march.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/x86-march.c?rev=362781=362780=362781=diff
==
--- cfe/trunk/test/Driver/x86-march.c (original)
+++ cfe/trunk/test/Driver/x86-march.c Fri Jun  7 01:53:37 2019
@@ -52,6 +52,10 @@
 // RUN:   | FileCheck %s -check-prefix=cascadelake
 // cascadelake: "-target-cpu" "cascadelake"
 //
+// RUN: %clang -target x86_64-unknown-unknown -c -### %s -march=cooperlake 
2>&1 \
+// RUN:   | FileCheck %s -check-prefix=cooperlake
+// cooperlake: "-target-cpu" "cooperlake"
+//
 // RUN: %clang -target x86_64-unknown-unknown -c -### %s -march=knl 2>&1 \
 // RUN:   | FileCheck %s -check-prefix=knl
 // knl: "-target-cpu" "knl"

Modified: cfe/trunk/test/Misc/target-invalid-cpu-note.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/target-invalid-cpu-note.c?rev=362781=362780=362781=diff
==
--- cfe/trunk/test/Misc/target-invalid-cpu-note.c (original)
+++ cfe/trunk/test/Misc/target-invalid-cpu-note.c Fri Jun  7 01:53:37 2019
@@ -16,7 +16,7 @@
 // X86-SAME: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, 
goldmont-plus, tremont,
 // X86-SAME: nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge,
 // X86-SAME: core-avx-i, haswell, core-avx2, 

[PATCH] D62999: [clangd] Return 'RequestCancelled' on spurious completion triggers

2019-06-07 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov created this revision.
ilya-biryukov added a reviewer: sammccall.
Herald added subscribers: kadircet, arphaman, jkorous, MaskRay.
Herald added a project: clang.

We currently return 'UnknownErrorCode' and it causes `coc.nvim` to
show an error message to the user, which we want to avoid.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62999

Files:
  clang-tools-extra/clangd/ClangdLSPServer.cpp
  clang-tools-extra/clangd/test/completion-auto-trigger.test


Index: clang-tools-extra/clangd/test/completion-auto-trigger.test
===
--- clang-tools-extra/clangd/test/completion-auto-trigger.test
+++ clang-tools-extra/clangd/test/completion-auto-trigger.test
@@ -5,7 +5,7 @@
 ---
 
{"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":2,"character":9},"context":{"triggerKind":2,"triggerCharacter":">"}}}
 #  CHECK:  "error": {
-# CHECK-NEXT:"code": -32001,
+# CHECK-NEXT:"code": -32800,
 # CHECK-NEXT:"message": "ignored auto-triggered completion, preceding char 
did not match"
 # CHECK-NEXT:  },
 # CHECK-NEXT:  "id": 1,
@@ -65,7 +65,7 @@
 ---
 
{"jsonrpc":"2.0","id":3,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":5,"character":9},"context":{"triggerKind":2,"triggerCharacter":":"}}}
 #  CHECK:  "error": {
-# CHECK-NEXT:"code": -32001,
+# CHECK-NEXT:"code": -32800,
 # CHECK-NEXT:"message": "ignored auto-triggered completion, preceding char 
did not match"
 # CHECK-NEXT:  },
 # CHECK-NEXT:  "id": 3,
Index: clang-tools-extra/clangd/ClangdLSPServer.cpp
===
--- clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -25,16 +25,6 @@
 namespace clang {
 namespace clangd {
 namespace {
-class IgnoreCompletionError : public llvm::ErrorInfo {
-public:
-  void log(llvm::raw_ostream ) const override {
-OS << "ignored auto-triggered completion, preceding char did not match";
-  }
-  std::error_code convertToErrorCode() const override {
-return std::make_error_code(std::errc::operation_canceled);
-  }
-};
-
 /// Transforms a tweak into a code action that would apply it if executed.
 /// EXPECTS: T.prepare() was called and returned true.
 CodeAction toCodeAction(const ClangdServer::TweakRef , const URIForFile 
,
@@ -739,7 +729,9 @@
 void ClangdLSPServer::onCompletion(const CompletionParams ,
Callback Reply) {
   if (!shouldRunCompletion(Params))
-return Reply(llvm::make_error());
+return Reply(llvm::make_error(
+"ignored auto-triggered completion, preceding char did not match",
+ErrorCode::RequestCancelled));
   Server->codeComplete(Params.textDocument.uri.file(), Params.position, CCOpts,
Bind(
[this](decltype(Reply) Reply,


Index: clang-tools-extra/clangd/test/completion-auto-trigger.test
===
--- clang-tools-extra/clangd/test/completion-auto-trigger.test
+++ clang-tools-extra/clangd/test/completion-auto-trigger.test
@@ -5,7 +5,7 @@
 ---
 {"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":2,"character":9},"context":{"triggerKind":2,"triggerCharacter":">"}}}
 #  CHECK:  "error": {
-# CHECK-NEXT:"code": -32001,
+# CHECK-NEXT:"code": -32800,
 # CHECK-NEXT:"message": "ignored auto-triggered completion, preceding char did not match"
 # CHECK-NEXT:  },
 # CHECK-NEXT:  "id": 1,
@@ -65,7 +65,7 @@
 ---
 {"jsonrpc":"2.0","id":3,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":5,"character":9},"context":{"triggerKind":2,"triggerCharacter":":"}}}
 #  CHECK:  "error": {
-# CHECK-NEXT:"code": -32001,
+# CHECK-NEXT:"code": -32800,
 # CHECK-NEXT:"message": "ignored auto-triggered completion, preceding char did not match"
 # CHECK-NEXT:  },
 # CHECK-NEXT:  "id": 3,
Index: clang-tools-extra/clangd/ClangdLSPServer.cpp
===
--- clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -25,16 +25,6 @@
 namespace clang {
 namespace clangd {
 namespace {
-class IgnoreCompletionError : public llvm::ErrorInfo {
-public:
-  void log(llvm::raw_ostream ) const override {
-OS << "ignored auto-triggered completion, preceding char did not match";
-  }
-  std::error_code convertToErrorCode() const override {
-return std::make_error_code(std::errc::operation_canceled);
-  }
-};
-
 /// Transforms a tweak into a code action that would apply it if executed.
 /// EXPECTS: T.prepare() was called and returned true.
 CodeAction toCodeAction(const 

  1   2   >