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

2019-05-28 Thread Kan Shengchen via Phabricator via cfe-commits
skan added a comment.

ping


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

https://reviews.llvm.org/D62115



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


[PATCH] D60748: Fix i386 struct and union parameter alignment

2019-05-28 Thread Wei Xiao via Phabricator via cfe-commits
wxiao3 added a comment.

Ok for merge now?


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

https://reviews.llvm.org/D60748



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


Re: [PATCH] D37035: Implement __builtin_LINE() et. al. to support source location capture.

2019-05-28 Thread Eric Fiselier via cfe-commits
* The alignment check can be removed, and I'll do so tomorrow if someone
doesn't beat me to it.

On Tue, May 28, 2019 at 1:54 AM Eric Fiselier  wrote:

> The alignment check can just be removed.
>
> On Mon., May 27, 2019, 7:57 p.m. Ulrich Weigand via Phabricator, <
> revi...@reviews.llvm.org> wrote:
>
>> uweigand added a comment.
>>
>> Looks like this test is failing on SystemZ since it was added, making all
>> our build bots red:
>>
>>
>> /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/tools/clang/test/CodeGenCXX/builtin_FUNCTION.cpp:9:11:
>> error: CHECK: expected string not found in input
>>   // CHECK: @[[EMPTY_STR:.+]] = private unnamed_addr constant [1 x i8]
>> zeroinitializer, align 1
>> ^
>>
>> /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/tools/clang/test/CodeGenCXX/Output/builtin_FUNCTION.cpp.tmp.ll:1:1:
>> note: scanning from here
>>   ; ModuleID =
>> '/home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/tools/clang/test/CodeGenCXX/builtin_FUNCTION.cpp'
>>   ^
>>
>> /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/tools/clang/test/CodeGenCXX/Output/builtin_FUNCTION.cpp.tmp.ll:8:1:
>> note: possible intended match here
>>   @.str = private unnamed_addr constant [1 x i8] zeroinitializer, align 2
>>   ^
>>
>> The problem is that string constants are 2-aligned according to the
>> SystemZ ABI (this is a bit different, but deliberate in order to allow
>> computing their addresses with a LARL instruction).  This makes all the
>> "align 1" checks fail.
>>
>> Is this test deliberately verifying the alignment, or could this just be
>> removed?
>>
>>
>> Repository:
>>   rC Clang
>>
>> CHANGES SINCE LAST ACTION
>>   https://reviews.llvm.org/D37035/new/
>>
>> https://reviews.llvm.org/D37035
>>
>>
>>
>>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D62391: [CodeComplete] Complete 'return true/false' in boolean functions

2019-05-28 Thread Ilya Biryukov via cfe-commits
I don't think it's related. All the changes are in code completion code,
which is not run during normal compiles.

On Tue, May 28, 2019 at 2:36 AM Mike Lothian via Phabricator <
revi...@reviews.llvm.org> wrote:

> FireBurn added a comment.
>
> Could this commit be causing the following build failure of Chromium, this
> same version build a few days ago with clang from git:
>
> FAILED:
> obj/third_party/blink/renderer/bindings/core/v8/bindings_core_impl/v8_feature_policy.o
> clang++ -MMD -MF
> obj/third_party/blink/renderer/bindings/core/v8/bindings_core_impl/v8_feature_policy.o.d
> -DUSE_UDEV -DUSE_AURA=1 -DUSE_GLIB=1 -DUSE_NSS_CERTS=1 -DUSE_X11=1
> -DNO_TCMALLOC -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD
> -DSAFE_BROWSING_DB_LOCAL -DCHROMIUM_BUILD -D_FILE_OFFSET_BITS=64
> -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE
> -DCR_CLANG_REVISION=\"360094-5\" -D__STDC_CONSTANT_MACROS
> -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -DNDEBUG -DNVALGRIND
> -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DBLINK_CORE_IMPLEMENTATION=1
> -DENABLE_IPC_FUZZER -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
> -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26 -DGL_GLEXT_PROTOTYPES
> -DUSE_GLX -DUSE_EGL -DVK_NO_PROTOTYPES -DBLINK_IMPLEMENTATION=1
> -DINSIDE_BLINK -DWEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0
> -DWEBRTC_CHROMIUM_BUILD -DWEBRTC_POSIX -DWEBRTC_LINUX
> -DABSL_ALLOCATOR_NOTHROW=1 -DNO_MAIN_THREAD_WRAPPING
> -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DUSE_CHROMIUM_ICU=1
> -DU_STATIC_IMPLEMENTATION -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE
> -DUCHAR_TYPE=uint16_t -DGOOGLE_PROTOBUF_NO_RTTI
> -DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER -DHAVE_PTHREAD -DSK_HAS_PNG_LIBRARY
> -DSK_HAS_WEBP_LIBRARY
> -DSK_USER_CONFIG_HEADER=\"../../skia/config/SkUserConfig.h\"
> -DSK_HAS_JPEG_LIBRARY
> -DSK_VULKAN_HEADER=\"../../skia/config/SkVulkanConfig.h\" -DSK_VULKAN=1
> -DSK_SUPPORT_GPU=1
> -DSK_GPU_WORKAROUNDS_HEADER=\"gpu/config/gpu_driver_bug_workaround_autogen.h\"
> -DVK_NO_PROTOTYPES -DV8_DEPRECATION_WARNINGS -DLEVELDB_PLATFORM_CHROMIUM=1
> -DLEVELDB_PLATFORM_CHROMIUM=1 -DWTF_USE_WEBAUDIO_FFMPEG=1
> -DSUPPORT_WEBGL2_COMPUTE_CONTEXT=1 -DUSE_SYSTEM_LIBJPEG
> -DV8_DEPRECATION_WARNINGS -DUSE_SYSTEM_ZLIB=1 -I../.. -Igen
> -Igen/shim_headers/zlib_shim -I../../third_party/libyuv/include
> -Igen/shim_headers/libpng_shim -Igen/shim_headers/libwebp_shim
> -Igen/shim_headers/libdrm_shim -Igen/shim_headers/re2_shim
> -Igen/shim_headers/snappy_shim -I../../third_party/khronos -I../../gpu
> -I../../third_party/vulkan/include -Igen/third_party/dawn
> -I../../third_party/dawn/src/include
> -I../../third_party/boringssl/src/include
> -I../../third_party/webrtc_overrides -I../../third_party/webrtc
> -Igen/third_party/webrtc -I../../third_party/abseil-cpp
> -I../../third_party/ced/src -I../../third_party/icu/source/common
> -I../../third_party/icu/source/i18n -I../../third_party/protobuf/src
> -I../../third_party/protobuf/src -Igen/protoc_out -I../../third_party/skia
> -I../../third_party/vulkan/include
> -I../../third_party/skia/third_party/vulkanmemoryallocator
> -I../../third_party/vulkan/include -I../../third_party/angle/include
> -I../../third_party/angle/src/common/third_party/base -Igen/angle
> -I../../third_party/angle/include -I../../v8/include -Igen/v8/include
> -I../../third_party/libwebm/source -I../../third_party/leveldatabase
> -I../../third_party/leveldatabase/src
> -I../../third_party/leveldatabase/src/include -I../../third_party/iccjpeg
> -I../../third_party/ots/include -I../../v8/include -Igen/v8/include
> -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector
> -funwind-tables -fPIC -pthread -fcolor-diagnostics -fmerge-all-constants
> -fcrash-diagnostics-dir=../../tools/clang/crashreports -Xclang -mllvm
> -Xclang -instcombine-lower-dbg-declare=0 -m64 -march=x86-64
> -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__=
> -no-canonical-prefixes -Wall -Wextra -Wimplicit-fallthrough -Wthread-safety
> -Wextra-semi -Wno-missing-field-initializers -Wno-unused-parameter
> -Wno-c++11-narrowing -Wno-unneeded-internal-declaration
> -Wno-undefined-var-template -Wno-ignored-pragma-optimize -O2 -fno-ident
> -fdata-sections -ffunction-sections -fno-omit-frame-pointer
> -fvisibility=hidden -Wheader-hygiene -Wstring-conversion
> -Wtautological-overlap-compare -Wexit-time-destructors
> -Wglobal-constructors -g0 -I/usr/include/glib-2.0
> -I/usr/lib64/glib-2.0/include -Wconversion -Wno-float-conversion
> -Wno-sign-conversion -Wno-implicit-float-conversion
> -Wno-implicit-int-conversion -Wno-shorten-64-to-32 -Wno-header-guard
> -I/usr/include/nss -I/usr/include/nspr -I/usr/include/libpng16
> -I/usr/include/libxml2 -I/usr/include/libxml2 -std=c++14 -fno-exceptions
> -fno-rtti -fvisibility-inlines-hidden -O3 -pipe -flto=thin -march=native -c
> gen/third_party/blink/renderer/bindings/core/v8/v8_feature_policy.cc -o
> obj/third_party/blink/renderer/bindings/core/v8/bindings_core_impl/v8_feature_policy.o
> In file included from
> gen/third_party/bl

[PATCH] D62391: [CodeComplete] Complete 'return true/false' in boolean functions

2019-05-28 Thread Mike Lothian via Phabricator via cfe-commits
FireBurn added a comment.

Sorry for the noise, I'll do a bisect


Repository:
  rC Clang

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

https://reviews.llvm.org/D62391



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


[clang-tools-extra] r361798 - [clangd] Rename -run-synchronously to -sync

2019-05-28 Thread Ilya Biryukov via cfe-commits
Author: ibiryukov
Date: Tue May 28 02:20:57 2019
New Revision: 361798

URL: http://llvm.org/viewvc/llvm-project?rev=361798&view=rev
Log:
[clangd] Rename -run-synchronously to -sync

Modified:
clang-tools-extra/trunk/clangd/test/delimited-input-comment-at-the-end.test
clang-tools-extra/trunk/clangd/test/input-mirror.test
clang-tools-extra/trunk/clangd/test/protocol.test
clang-tools-extra/trunk/clangd/test/spaces-in-delimited-input.test
clang-tools-extra/trunk/clangd/test/too_large.test
clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp

Modified: 
clang-tools-extra/trunk/clangd/test/delimited-input-comment-at-the-end.test
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/test/delimited-input-comment-at-the-end.test?rev=361798&r1=361797&r2=361798&view=diff
==
--- clang-tools-extra/trunk/clangd/test/delimited-input-comment-at-the-end.test 
(original)
+++ clang-tools-extra/trunk/clangd/test/delimited-input-comment-at-the-end.test 
Tue May 28 02:20:57 2019
@@ -1,4 +1,4 @@
-# RUN: clangd -input-style=delimited -run-synchronously -input-mirror-file %t 
< %s
+# RUN: clangd -input-style=delimited -sync -input-mirror-file %t < %s
 # RUN: grep '{"jsonrpc":"2.0","id":3,"method":"exit"}' %t
 #
 # RUN: clangd -lit-test -input-mirror-file %t < %s

Modified: clang-tools-extra/trunk/clangd/test/input-mirror.test
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/test/input-mirror.test?rev=361798&r1=361797&r2=361798&view=diff
==
--- clang-tools-extra/trunk/clangd/test/input-mirror.test (original)
+++ clang-tools-extra/trunk/clangd/test/input-mirror.test Tue May 28 02:20:57 
2019
@@ -1,4 +1,4 @@
-# RUN: clangd -pretty -run-synchronously -input-mirror-file %t < %s
+# RUN: clangd -pretty -sync -input-mirror-file %t < %s
 # Note that we have to use '-b' as -input-mirror-file does not have a newline 
at the end of file.
 # RUN: diff -b %t %s
 # It is absolutely vital that this file has CRLF line endings.

Modified: clang-tools-extra/trunk/clangd/test/protocol.test
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/test/protocol.test?rev=361798&r1=361797&r2=361798&view=diff
==
--- clang-tools-extra/trunk/clangd/test/protocol.test (original)
+++ clang-tools-extra/trunk/clangd/test/protocol.test Tue May 28 02:20:57 2019
@@ -1,5 +1,5 @@
-# RUN: not clangd -pretty -run-synchronously -enable-test-uri-scheme < %s | 
FileCheck -strict-whitespace %s
-# RUN: not clangd -pretty -run-synchronously -enable-test-uri-scheme < %s 2>&1 
| FileCheck -check-prefix=STDERR %s
+# RUN: not clangd -pretty -sync -enable-test-uri-scheme < %s | FileCheck 
-strict-whitespace %s
+# RUN: not clangd -pretty -sync -enable-test-uri-scheme < %s 2>&1 | FileCheck 
-check-prefix=STDERR %s
 # vim: fileformat=dos
 # It is absolutely vital that this file has CRLF line endings.
 #

Modified: clang-tools-extra/trunk/clangd/test/spaces-in-delimited-input.test
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/test/spaces-in-delimited-input.test?rev=361798&r1=361797&r2=361798&view=diff
==
--- clang-tools-extra/trunk/clangd/test/spaces-in-delimited-input.test 
(original)
+++ clang-tools-extra/trunk/clangd/test/spaces-in-delimited-input.test Tue May 
28 02:20:57 2019
@@ -1,5 +1,5 @@
-# RUN: clangd -input-style=delimited -run-synchronously < %s 2>&1 | FileCheck 
%s
-# RUN: clangd -lit-test -run-synchronously < %s 2>&1 | FileCheck %s
+# RUN: clangd -input-style=delimited -sync < %s 2>&1 | FileCheck %s
+# RUN: clangd -lit-test -sync < %s 2>&1 | FileCheck %s
 #
 
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
 

Modified: clang-tools-extra/trunk/clangd/test/too_large.test
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/test/too_large.test?rev=361798&r1=361797&r2=361798&view=diff
==
--- clang-tools-extra/trunk/clangd/test/too_large.test (original)
+++ clang-tools-extra/trunk/clangd/test/too_large.test Tue May 28 02:20:57 2019
@@ -1,4 +1,4 @@
-# RUN: not clangd -run-synchronously < %s 2>&1 | FileCheck 
-check-prefix=STDERR %s
+# RUN: not clangd -sync < %s 2>&1 | FileCheck -check-prefix=STDERR %s
 # vim: fileformat=dos
 # It is absolutely vital that this file has CRLF line endings.
 #

Modified: clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp?rev=361798&r1=361797&r2=361798&view=diff
==
--- clang-tools-extra/trunk/clangd/tool/C

[clang-tools-extra] r361800 - [clangd] Never end command-line flag description with a period. NFC

2019-05-28 Thread Ilya Biryukov via cfe-commits
Author: ibiryukov
Date: Tue May 28 02:31:27 2019
New Revision: 361800

URL: http://llvm.org/viewvc/llvm-project?rev=361800&view=rev
Log:
[clangd] Never end command-line flag description with a period. NFC

For consistency. Not having a period at the end is much more common and
seems to be the preferred style for command-line options.

Modified:
clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp

Modified: clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp?rev=361800&r1=361799&r2=361800&view=diff
==
--- clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp (original)
+++ clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp Tue May 28 02:31:27 2019
@@ -37,14 +37,14 @@ namespace clangd {
 // FIXME: remove this option when Dex is cheap enough.
 static llvm::cl::opt
 UseDex("use-dex-index",
-   llvm::cl::desc("Use experimental Dex dynamic index."),
+   llvm::cl::desc("Use experimental Dex dynamic index"),
llvm::cl::init(true), llvm::cl::Hidden);
 
 static llvm::cl::opt CompileCommandsDir(
 "compile-commands-dir",
 llvm::cl::desc("Specify a path to look for compile_commands.json. If path "
"is invalid, clangd will look in the current directory and "
-   "parent paths of each source file."));
+   "parent paths of each source file"));
 
 static llvm::cl::opt
 WorkerThreadsCount("j",
@@ -59,10 +59,10 @@ static llvm::cl::opt
 Test("lit-test",
  llvm::cl::desc("Abbreviation for -input-style=delimited -pretty -sync 
"
 "-enable-test-scheme -log=verbose."
-"Intended to simplify lit tests."),
+"Intended to simplify lit tests"),
  llvm::cl::init(false), llvm::cl::Hidden);
 
 static llvm::cl::opt EnableTestScheme(
 "enable-test-uri-scheme",
-llvm::cl::desc("Enable 'test:' URI scheme. Only use in lit tests."),
+llvm::cl::desc("Enable 'test:' URI scheme. Only use in lit tests"),
 llvm::cl::init(false), llvm::cl::Hidden);
 
 enum PCHStorageFlag { Disk, Memory };
@@ -119,7 +119,7 @@ static llvm::cl::opt PCH
 static llvm::cl::opt LimitResults(
 "limit-results",
 llvm::cl::desc("Limit the number of results returned by clangd. "
-   "0 means no limit. (default=100)"),
+   "0 means no limit (default=100)"),
 llvm::cl::init(100));
 
 static llvm::cl::opt
@@ -134,7 +134,7 @@ static llvm::cl::opt
 static llvm::cl::opt InputMirrorFile(
 "input-mirror-file",
 llvm::cl::desc(
-"Mirror all LSP input to the specified file. Useful for debugging."),
+"Mirror all LSP input to the specified file. Useful for debugging"),
 llvm::cl::init(""), llvm::cl::Hidden);
 
 static llvm::cl::opt EnableIndex(
@@ -142,7 +142,7 @@ static llvm::cl::opt EnableIndex(
 llvm::cl::desc(
 "Enable index-based features. By default, clangd maintains an index "
 "built from symbols in opened files. Global index support needs to "
-"enabled separatedly."),
+"enabled separatedly"),
 llvm::cl::init(true), llvm::cl::Hidden);
 
 static llvm::cl::opt AllScopesCompletion(
@@ -151,7 +151,7 @@ static llvm::cl::opt AllScopesComp
 "If set to true, code completion will include index symbols that are "
 "not defined in the scopes (e.g. "
 "namespaces) visible from the code completion point. Such completions "
-"can insert scope qualifiers."),
+"can insert scope qualifiers"),
 llvm::cl::init(true));
 
 static llvm::cl::opt ShowOrigins(
@@ -167,7 +167,7 @@ static llvm::cl::opt HeaderInserti
 "header-insertion-decorators",
 llvm::cl::desc("Prepend a circular dot or space before the completion "
"label, depending on whether "
-   "an include line will be inserted or not."),
+   "an include line will be inserted or not"),
 llvm::cl::init(true));
 
 static llvm::cl::opt IndexFile(
 "index-file",
 llvm::cl::desc(
 "Index file to build the static index. The file must have been created 
"
-"by a compatible clangd-indexer.\n"
+"by a compatible clangd-indexer\n"
 "WARNING: This option is experimental only, and will be removed "
-"eventually. Don't rely on it."),
+"eventually. Don't rely on it"),
 llvm::cl::init(""), llvm::cl::Hidden);
 
 static llvm::cl::opt EnableBackgroundIndex(
@@ -200,7 +200,7 @@ static llvm::cl::opt BackgroundInde
 llvm::cl::desc(
 "If set to non-zero, the background index rebuilds the symbol index "
 "periodically every X milliseconds; otherwise, the "
-"symbol index will be updated for each indexed file."),
+"symbol index will be updated for each indexed file"),
 llvm::cl::init(5000), llvm

[PATCH] D61497: [clangd] Introduce a structured hover response

2019-05-28 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet updated this revision to Diff 201628.
kadircet added a comment.

- clang-format Definition


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61497

Files:
  clang-tools-extra/clangd/ClangdLSPServer.cpp
  clang-tools-extra/clangd/ClangdServer.cpp
  clang-tools-extra/clangd/ClangdServer.h
  clang-tools-extra/clangd/Protocol.cpp
  clang-tools-extra/clangd/XRefs.cpp
  clang-tools-extra/clangd/XRefs.h
  clang-tools-extra/clangd/test/hover.test
  clang-tools-extra/clangd/unittests/TestTU.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
@@ -9,6 +9,7 @@
 #include "ClangdUnit.h"
 #include "Compiler.h"
 #include "Matchers.h"
+#include "Protocol.h"
 #include "SyncAPI.h"
 #include "TestFS.h"
 #include "TestTU.h"
@@ -16,6 +17,7 @@
 #include "index/FileIndex.h"
 #include "index/SymbolCollector.h"
 #include "clang/Index/IndexingAction.h"
+#include "llvm/ADT/None.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/ScopedPrinter.h"
 #include "gmock/gmock.h"
@@ -558,6 +560,306 @@
   HeaderNotInPreambleAnnotations.range(;
 }
 
+TEST(Hover, Structured) {
+  struct {
+const char *const Code;
+const std::function ExpectedBuilder;
+  } Cases[] = {
+  // Global scope.
+  {R"cpp(
+  // Best foo ever.
+  void [[fo^o]]() {}
+  )cpp",
+   [](HoverInfo &HI) {
+ HI.NamespaceScope = "";
+ HI.Name = "foo";
+ HI.Kind = SymbolKind::Function;
+ HI.Documentation = "Best foo ever.";
+ HI.Definition = "void foo()";
+ HI.ReturnType = "void";
+ HI.Type = "void()";
+ HI.Parameters.emplace();
+   }},
+  // Inside namespace
+  {R"cpp(
+  namespace ns1 { namespace ns2 {
+/// Best foo ever.
+void [[fo^o]]() {}
+  }}
+  )cpp",
+   [](HoverInfo &HI) {
+ HI.NamespaceScope = "ns1::ns2::";
+ HI.Name = "foo";
+ HI.Kind = SymbolKind::Function;
+ HI.Documentation = "Best foo ever.";
+ HI.Definition = "void foo()";
+ HI.ReturnType = "void";
+ HI.Type = "void()";
+ HI.Parameters.emplace();
+   }},
+  // Field
+  {R"cpp(
+  namespace ns1 { namespace ns2 {
+struct Foo {
+  int [[b^ar]];
+};
+  }}
+  )cpp",
+   [](HoverInfo &HI) {
+ HI.NamespaceScope = "ns1::ns2::";
+ HI.LocalScope = "Foo::";
+ HI.Name = "bar";
+ HI.Kind = SymbolKind::Field;
+ HI.Definition = "int bar";
+ HI.Type = "int";
+   }},
+  // Local to class method.
+  {R"cpp(
+  namespace ns1 { namespace ns2 {
+struct Foo {
+  void foo() {
+int [[b^ar]];
+  }
+};
+  }}
+  )cpp",
+   [](HoverInfo &HI) {
+ HI.NamespaceScope = "ns1::ns2::";
+ HI.LocalScope = "Foo::foo::";
+ HI.Name = "bar";
+ HI.Kind = SymbolKind::Variable;
+ HI.Definition = "int bar";
+ HI.Type = "int";
+   }},
+  // Anon namespace and local scope.
+  {R"cpp(
+  namespace ns1 { namespace {
+struct {
+  int [[b^ar]];
+} T;
+  }}
+  )cpp",
+   [](HoverInfo &HI) {
+ HI.NamespaceScope = "ns1::(anonymous)::";
+ HI.LocalScope = "(anonymous struct)::";
+ HI.Name = "bar";
+ HI.Kind = SymbolKind::Field;
+ HI.Definition = "int bar";
+ HI.Type = "int";
+   }},
+  // Variable with template type
+  {R"cpp(
+  template  class Foo {};
+  Foo [[fo^o]];
+  )cpp",
+   [](HoverInfo &HI) {
+ HI.NamespaceScope = "";
+ HI.Name = "foo";
+ HI.Kind = SymbolKind::Variable;
+ HI.Definition = "Foo foo";
+ HI.Type = "Foo";
+   }},
+  // Implicit template instantiation
+  {R"cpp(
+  template  class vector{};
+  [[vec^tor]] foo;
+  )cpp",
+   [](HoverInfo &HI) {
+ HI.NamespaceScope = "";
+ HI.Name = "vector";
+ HI.Kind = SymbolKind::Class;
+ HI.Definition = "template  class vector {}";
+ HI.TemplateParameters = {
+ {std::string("typename"), std::string("T"), llvm::None},
+ };
+   }},
+  // Class template
+  {R"cpp(
+  template  class C,
+typename = char,
+int = 0,
+bool Q = false,
+class... Ts> class Foo {};
+  template  class T>
+  [[F^oo]] foo;
+  )cpp",
+   [](HoverInfo &HI) 

[PATCH] D60691: [ARM] Replace fp-only-sp and d16 with fp64 and d32.

2019-05-28 Thread Simon Tatham via Phabricator via cfe-commits
simon_tatham marked an inline comment as done.
simon_tatham added inline comments.



Comment at: llvm/test/MC/ARM/armv8.3a-js.s:16
 // REQ-V83: error: instruction requires: armv8.3a
-// REQ-FP: error: instruction requires: FPARMv8
+// REQ-FP: error: invalid instruction

ostannard wrote:
> Do you know why this diagnostic got worse?
I do now :-) It's because that instruction is invalid for two reasons: firstly, 
`vjcvt` requires FP-ARMv8 which the command line has turned off, and secondly, 
using d18 requires the new `d32` feature which the command line has also turned 
off. So `llc -debug` reports "Opcode result: multiple types of mismatch, so not 
reporting near-miss".


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D60691



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


[PATCH] D62514: [CodeComplete] Set preferred type for qualified-id

2019-05-28 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov created this revision.
ilya-biryukov added a reviewer: kadircet.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62514

Files:
  clang/include/clang/Sema/Sema.h
  clang/lib/Parse/ParseExprCXX.cpp
  clang/lib/Sema/SemaCodeComplete.cpp
  clang/unittests/Sema/CodeCompleteTest.cpp


Index: clang/unittests/Sema/CodeCompleteTest.cpp
===
--- clang/unittests/Sema/CodeCompleteTest.cpp
+++ clang/unittests/Sema/CodeCompleteTest.cpp
@@ -454,5 +454,18 @@
 }
   )cpp";
   EXPECT_THAT(collectPreferredTypes(Code), Each("volatile double *"));
+
+  Code = R"cpp(
+namespace ns {
+  struct vector {
+  };
+}
+void accepts_vector(ns::vector);
+
+void test() {
+  accepts_vector(^::^ns::^vector());
+}
+  )cpp";
+  EXPECT_THAT(collectPreferredTypes(Code), Each("ns::vector"));
 }
 } // namespace
Index: clang/lib/Sema/SemaCodeComplete.cpp
===
--- clang/lib/Sema/SemaCodeComplete.cpp
+++ clang/lib/Sema/SemaCodeComplete.cpp
@@ -5207,7 +5207,8 @@
 }
 
 void Sema::CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS,
-   bool EnteringContext, QualType BaseType) {
+   bool EnteringContext, QualType BaseType,
+   QualType PreferredType) {
   if (SS.isEmpty() || !CodeCompleter)
 return;
 
@@ -5216,13 +5217,15 @@
   // it can be useful for global code completion which have information about
   // contexts/symbols that are not in the AST.
   if (SS.isInvalid()) {
-CodeCompletionContext CC(CodeCompletionContext::CCC_Symbol);
+CodeCompletionContext CC(CodeCompletionContext::CCC_Symbol, PreferredType);
 CC.setCXXScopeSpecifier(SS);
 // As SS is invalid, we try to collect accessible contexts from the current
 // scope with a dummy lookup so that the completion consumer can try to
 // guess what the specified scope is.
 ResultBuilder DummyResults(*this, CodeCompleter->getAllocator(),
CodeCompleter->getCodeCompletionTUInfo(), CC);
+if (!PreferredType.isNull())
+  DummyResults.setPreferredType(PreferredType);
 if (S->getEntity()) {
   CodeCompletionDeclConsumer Consumer(DummyResults, S->getEntity(),
   BaseType);
@@ -5245,9 +5248,12 @@
   if (!isDependentScopeSpecifier(SS) && RequireCompleteDeclContext(SS, Ctx))
 return;
 
-  ResultBuilder Results(*this, CodeCompleter->getAllocator(),
-CodeCompleter->getCodeCompletionTUInfo(),
-CodeCompletionContext::CCC_Symbol);
+  ResultBuilder Results(
+  *this, CodeCompleter->getAllocator(),
+  CodeCompleter->getCodeCompletionTUInfo(),
+  CodeCompletionContext(CodeCompletionContext::CCC_Symbol, PreferredType));
+  if (!PreferredType.isNull())
+Results.setPreferredType(PreferredType);
   Results.EnterNewScope();
 
   // The "template" keyword can follow "::" in the grammar, but only
Index: clang/lib/Parse/ParseExprCXX.cpp
===
--- clang/lib/Parse/ParseExprCXX.cpp
+++ clang/lib/Parse/ParseExprCXX.cpp
@@ -238,7 +238,8 @@
 // Code completion for a nested-name-specifier, where the code
 // completion token follows the '::'.
 Actions.CodeCompleteQualifiedId(getCurScope(), SS, EnteringContext,
-ObjectType.get());
+ObjectType.get(),
+PreferredType.get(SS.getBeginLoc()));
 // Include code completion token into the range of the scope otherwise
 // when we try to annotate the scope tokens the dangling code 
completion
 // token will cause assertion in
Index: clang/include/clang/Sema/Sema.h
===
--- clang/include/clang/Sema/Sema.h
+++ clang/include/clang/Sema/Sema.h
@@ -10646,8 +10646,8 @@
   void CodeCompleteInitializer(Scope *S, Decl *D);
   void CodeCompleteAfterIf(Scope *S);
 
-  void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS,
-   bool EnteringContext, QualType BaseType);
+  void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS, bool 
EnteringContext,
+   QualType BaseType, QualType PreferredType);
   void CodeCompleteUsing(Scope *S);
   void CodeCompleteUsingDirective(Scope *S);
   void CodeCompleteNamespaceDecl(Scope *S);


Index: clang/unittests/Sema/CodeCompleteTest.cpp
===
--- clang/unittests/Sema/CodeCompleteTest.cpp
+++ clang/unittests/Sema/CodeCompleteTest.cpp
@@ -454,5 +454,18 @@
 }
   )cpp";
   EXPECT_THAT(collectPreferredTypes(Code), Each("volatile double *"));
+
+  Code = R"cpp(
+names

[clang-tools-extra] r361803 - [clangd] Introduce a structured hover response

2019-05-28 Thread Kadir Cetinkaya via cfe-commits
Author: kadircet
Date: Tue May 28 03:29:58 2019
New Revision: 361803

URL: http://llvm.org/viewvc/llvm-project?rev=361803&view=rev
Log:
[clangd] Introduce a structured hover response

Summary:
Change ClangdServer layer to output a structured response for Hover,
which can be rendered by client according to their needs.

Reviewers: sammccall, ilya-biryukov

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

Tags: #clang

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

Modified:
clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
clang-tools-extra/trunk/clangd/ClangdServer.cpp
clang-tools-extra/trunk/clangd/ClangdServer.h
clang-tools-extra/trunk/clangd/Protocol.cpp
clang-tools-extra/trunk/clangd/XRefs.cpp
clang-tools-extra/trunk/clangd/XRefs.h
clang-tools-extra/trunk/clangd/test/hover.test
clang-tools-extra/trunk/clangd/unittests/TestTU.cpp
clang-tools-extra/trunk/clangd/unittests/XRefsTests.cpp

Modified: clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp?rev=361803&r1=361802&r2=361803&view=diff
==
--- clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp Tue May 28 03:29:58 2019
@@ -842,7 +842,20 @@ void ClangdLSPServer::onDocumentHighligh
 void ClangdLSPServer::onHover(const TextDocumentPositionParams &Params,
   Callback> Reply) {
   Server->findHover(Params.textDocument.uri.file(), Params.position,
-std::move(Reply));
+Bind(
+[](decltype(Reply) Reply,
+   llvm::Expected> HIorErr) {
+  if (!HIorErr)
+return Reply(HIorErr.takeError());
+  const auto &HI = HIorErr.get();
+  if (!HI)
+return Reply(llvm::None);
+  Hover H;
+  H.range = HI->SymRange;
+  H.contents = HI->render();
+  return Reply(H);
+},
+std::move(Reply)));
 }
 
 void ClangdLSPServer::onTypeHierarchy(

Modified: clang-tools-extra/trunk/clangd/ClangdServer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdServer.cpp?rev=361803&r1=361802&r2=361803&view=diff
==
--- clang-tools-extra/trunk/clangd/ClangdServer.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangdServer.cpp Tue May 28 03:29:58 2019
@@ -461,15 +461,18 @@ void ClangdServer::findDocumentHighlight
 }
 
 void ClangdServer::findHover(PathRef File, Position Pos,
- Callback> CB) {
-  auto Action = [Pos](Callback> CB,
+ Callback> CB) {
+  auto Action = [Pos](Callback> CB, Path File,
   llvm::Expected InpAST) {
 if (!InpAST)
   return CB(InpAST.takeError());
-CB(clangd::getHover(InpAST->AST, Pos));
+format::FormatStyle Style = getFormatStyleForFile(
+File, InpAST->Inputs.Contents, InpAST->Inputs.FS.get());
+CB(clangd::getHover(InpAST->AST, Pos, std::move(Style)));
   };
 
-  WorkScheduler.runWithAST("Hover", File, Bind(Action, std::move(CB)));
+  WorkScheduler.runWithAST("Hover", File,
+   Bind(Action, std::move(CB), File.str()));
 }
 
 void ClangdServer::typeHierarchy(PathRef File, Position Pos, int Resolve,

Modified: clang-tools-extra/trunk/clangd/ClangdServer.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdServer.h?rev=361803&r1=361802&r2=361803&view=diff
==
--- clang-tools-extra/trunk/clangd/ClangdServer.h (original)
+++ clang-tools-extra/trunk/clangd/ClangdServer.h Tue May 28 03:29:58 2019
@@ -186,7 +186,7 @@ public:
 
   /// Get code hover for a given position.
   void findHover(PathRef File, Position Pos,
- Callback> CB);
+ Callback> CB);
 
   /// Get information about type hierarchy for a given position.
   void typeHierarchy(PathRef File, Position Pos, int Resolve,

Modified: clang-tools-extra/trunk/clangd/Protocol.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/Protocol.cpp?rev=361803&r1=361802&r2=361803&view=diff
==
--- clang-tools-extra/trunk/clangd/Protocol.cpp (original)
+++ clang-tools-extra/trunk/clangd/Protocol.cpp Tue May 28 03:29:58 2019
@@ -17,6 +17,7 @@
 #include "llvm/ADT/Hashing.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringSwitch.h"
+#include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/Format.h"

[PATCH] D61497: [clangd] Introduce a structured hover response

2019-05-28 Thread Kadir Cetinkaya via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL361803: [clangd] Introduce a structured hover response 
(authored by kadircet, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D61497?vs=201628&id=201630#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D61497

Files:
  clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
  clang-tools-extra/trunk/clangd/ClangdServer.cpp
  clang-tools-extra/trunk/clangd/ClangdServer.h
  clang-tools-extra/trunk/clangd/Protocol.cpp
  clang-tools-extra/trunk/clangd/XRefs.cpp
  clang-tools-extra/trunk/clangd/XRefs.h
  clang-tools-extra/trunk/clangd/test/hover.test
  clang-tools-extra/trunk/clangd/unittests/TestTU.cpp
  clang-tools-extra/trunk/clangd/unittests/XRefsTests.cpp

Index: clang-tools-extra/trunk/clangd/unittests/TestTU.cpp
===
--- clang-tools-extra/trunk/clangd/unittests/TestTU.cpp
+++ clang-tools-extra/trunk/clangd/unittests/TestTU.cpp
@@ -59,8 +59,7 @@
 /*OldPreamble=*/nullptr,
 /*OldCompileCommand=*/Inputs.CompileCommand, Inputs,
 /*StoreInMemory=*/true, /*PreambleCallback=*/nullptr);
-  auto AST = buildAST(FullFilename, createInvocationFromCommandLine(Cmd),
-  Inputs, Preamble);
+  auto AST = buildAST(FullFilename, std::move(CI), Inputs, Preamble);
   if (!AST.hasValue()) {
 ADD_FAILURE() << "Failed to build code:\n" << Code;
 llvm_unreachable("Failed to build TestTU!");
Index: clang-tools-extra/trunk/clangd/unittests/XRefsTests.cpp
===
--- clang-tools-extra/trunk/clangd/unittests/XRefsTests.cpp
+++ clang-tools-extra/trunk/clangd/unittests/XRefsTests.cpp
@@ -9,6 +9,7 @@
 #include "ClangdUnit.h"
 #include "Compiler.h"
 #include "Matchers.h"
+#include "Protocol.h"
 #include "SyncAPI.h"
 #include "TestFS.h"
 #include "TestTU.h"
@@ -16,6 +17,7 @@
 #include "index/FileIndex.h"
 #include "index/SymbolCollector.h"
 #include "clang/Index/IndexingAction.h"
+#include "llvm/ADT/None.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/ScopedPrinter.h"
 #include "gmock/gmock.h"
@@ -569,6 +571,306 @@
   HeaderNotInPreambleAnnotations.range(;
 }
 
+TEST(Hover, Structured) {
+  struct {
+const char *const Code;
+const std::function ExpectedBuilder;
+  } Cases[] = {
+  // Global scope.
+  {R"cpp(
+  // Best foo ever.
+  void [[fo^o]]() {}
+  )cpp",
+   [](HoverInfo &HI) {
+ HI.NamespaceScope = "";
+ HI.Name = "foo";
+ HI.Kind = SymbolKind::Function;
+ HI.Documentation = "Best foo ever.";
+ HI.Definition = "void foo()";
+ HI.ReturnType = "void";
+ HI.Type = "void()";
+ HI.Parameters.emplace();
+   }},
+  // Inside namespace
+  {R"cpp(
+  namespace ns1 { namespace ns2 {
+/// Best foo ever.
+void [[fo^o]]() {}
+  }}
+  )cpp",
+   [](HoverInfo &HI) {
+ HI.NamespaceScope = "ns1::ns2::";
+ HI.Name = "foo";
+ HI.Kind = SymbolKind::Function;
+ HI.Documentation = "Best foo ever.";
+ HI.Definition = "void foo()";
+ HI.ReturnType = "void";
+ HI.Type = "void()";
+ HI.Parameters.emplace();
+   }},
+  // Field
+  {R"cpp(
+  namespace ns1 { namespace ns2 {
+struct Foo {
+  int [[b^ar]];
+};
+  }}
+  )cpp",
+   [](HoverInfo &HI) {
+ HI.NamespaceScope = "ns1::ns2::";
+ HI.LocalScope = "Foo::";
+ HI.Name = "bar";
+ HI.Kind = SymbolKind::Field;
+ HI.Definition = "int bar";
+ HI.Type = "int";
+   }},
+  // Local to class method.
+  {R"cpp(
+  namespace ns1 { namespace ns2 {
+struct Foo {
+  void foo() {
+int [[b^ar]];
+  }
+};
+  }}
+  )cpp",
+   [](HoverInfo &HI) {
+ HI.NamespaceScope = "ns1::ns2::";
+ HI.LocalScope = "Foo::foo::";
+ HI.Name = "bar";
+ HI.Kind = SymbolKind::Variable;
+ HI.Definition = "int bar";
+ HI.Type = "int";
+   }},
+  // Anon namespace and local scope.
+  {R"cpp(
+  namespace ns1 { namespace {
+struct {
+  int [[b^ar]];
+} T;
+  }}
+  )cpp",
+   [](HoverInfo &HI) {
+ HI.NamespaceScope = "ns1::(anonymous)::";
+ HI.LocalScope = "(anonymous struct)::";
+ HI.Name = "bar";
+ HI.Kind = SymbolKind::Field;
+ HI.Definition = "int bar";
+ HI.Type = "int";
+   }},
+  // Variable with template type
+  {

[PATCH] D60455: [SYCL] Implement SYCL device code outlining

2019-05-28 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment.

In D60455#1518178 , @bader wrote:

> In D60455#1513499 , @Anastasia wrote:
>
> > //**Design question**//: since you are not aware what functions are to be 
> > run on a device while parsing them, at what point do you plan to diagnose 
> > the invalid behavior from the standard C++ i.e. using function pointers in 
> > kernel code is likely to cause issues?
>
>
> We are going to use DeviceDiagBuilder and related infrastructure implemented 
> in Clang to diagnose device side code errors in OpenMP/CUDA modes.
>  More details are in the comments here:
>  
> https://clang.llvm.org/doxygen/classclang_1_1Sema_1_1DeviceDiagBuilder.html#details


Just a thought, if you parse host code first and provide the device outlining 
information to the device compilation phase would you then be able to reuse 
more parsing functionality from OpenCL?

> 
> 
>> Also do you need to outline the data structures too? For example classes 
>> used on device are not allowed to have virtual function.
> 
> Yes. This restriction is already implemented in our code base on GitHub.

Cool, is it implemented in `SemaSYCL.cpp` too?




Comment at: clang/include/clang/Basic/Attr.td:1017
+  let LangOpts = [SYCL];
+  let Documentation = [Undocumented];
+}

bader wrote:
> Anastasia wrote:
> > Anastasia wrote:
> > > Fznamznon wrote:
> > > > bader wrote:
> > > > > Anastasia wrote:
> > > > > > Ok, I thought the earlier request was not to add undocumented 
> > > > > > attributes with the spelling?
> > > > > > 
> > > > > > Also did `__kernel` attribute not work at the end?
> > > > > > 
> > > > > > I can't quite get where the current disconnect comes from but I 
> > > > > > find it extremely unhelpful.
> > > > > Hi @Anastasia, let me try to help.
> > > > > 
> > > > > > Ok, I thought the earlier request was not to add undocumented 
> > > > > > attributes with the spelling?
> > > > > 
> > > > > Right. @Fznamznon, could you document `sycl_kernel` attribute, please?
> > > > > 
> > > > > > Also did __kernel attribute not work at the end?
> > > > > 
> > > > > Maria left a comment with the summary of our experiment: 
> > > > > https://reviews.llvm.org/D60455#1472705. There is a link to pull 
> > > > > request, where @keryell and @agozillon expressed preference to have 
> > > > > separate SYCL attributes. Let me copy their feedback here:
> > > > > 
> > > > > @keryell :
> > > > > 
> > > > > > Thank you for the experiment.
> > > > > > That looks like a straight forward change.
> > > > > > The interesting part is that it does not expose any advantage from 
> > > > > > reusing OpenCL __kernel marker So I am not more convinced that 
> > > > > > it is the way to go, because we would use any other keyword or 
> > > > > > attribute and it would be the same...
> > > > > > 
> > > > > 
> > > > > @agozillon :
> > > > > 
> > > > > > Just my two cents, I think a separation of concerns and having 
> > > > > > separate attributes will simplify things long-term.
> > > > > > 
> > > > > > While possibly similar just now, the SYCL specification is evolving 
> > > > > > and may end up targeting more than just OpenCL. So the semantics of 
> > > > > > the attributes may end up being quite different, even if at the 
> > > > > > moment the SYCL attribute is there mostly just to mark something 
> > > > > > for outlining.
> > > > > > 
> > > > > > If it doesn't then the case for refactoring and merging them in a 
> > > > > > future patch could be brought up again.
> > > > > 
> > > > > To summarize: we don't have good arguments to justify re-use of 
> > > > > OpenCL `__kernel` keyword for SYCL mode requested by @aaron.ballman 
> > > > > here https://reviews.llvm.org/D60455#1469150.
> > > > > 
> > > > > > I can't quite get where the current disconnect comes from but I 
> > > > > > find it extremely unhelpful.
> > > > > 
> > > > > Let me know how I can help here.
> > > > > 
> > > > > Additional note. I've submitted initial version of SYCL compiler 
> > > > > design document to the GItHub: 
> > > > > https://github.com/intel/llvm/blob/sycl/sycl/doc/SYCL_compiler_and_runtime_design.md.
> > > > >  Please, take a look and let me know if you have questions.
> > > > >> Ok, I thought the earlier request was not to add undocumented 
> > > > >> attributes with the spelling?
> > > > > Right. @Fznamznon, could you document sycl_kernel attribute, please?
> > > > 
> > > > Do we really need add documentation for attribute which is not 
> > > > presented in SYCL spec and used for internal implementation details 
> > > > only because it has spelling?
> > > > 
> > > > Ok, I thought the earlier request was not to add undocumented 
> > > > attributes with the spelling?
> > > > 
> > > > Right. @Fznamznon, could you document sycl_kernel attribute, please?
> > > > 
> > > > Do we really need add documentation for attribute which is not 
> > > > presented in SY

[PATCH] D62515: [clangd] Compute expected type for templates

2019-05-28 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.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62515

Files:
  clang-tools-extra/clangd/ExpectedTypes.cpp
  clang-tools-extra/clangd/unittests/ExpectedTypeTest.cpp


Index: clang-tools-extra/clangd/unittests/ExpectedTypeTest.cpp
===
--- clang-tools-extra/clangd/unittests/ExpectedTypeTest.cpp
+++ clang-tools-extra/clangd/unittests/ExpectedTypeTest.cpp
@@ -11,6 +11,7 @@
 #include "TestTU.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Decl.h"
+#include "llvm/ADT/None.h"
 #include "llvm/ADT/StringRef.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
@@ -31,16 +32,14 @@
 AST = TestTU::withCode(Code).build();
   }
 
-  const ValueDecl *decl(llvm::StringRef Name) {
-return &cast(findDecl(*AST, Name));
-  }
+  const NamedDecl *decl(llvm::StringRef Name) { return &findDecl(*AST, Name); }
 
   QualType typeOf(llvm::StringRef Name) {
-return decl(Name)->getType().getCanonicalType();
+return cast(decl(Name))->getType().getCanonicalType();
   }
 
   /// An overload for convenience.
-  llvm::Optional fromCompletionResult(const ValueDecl *D) {
+  llvm::Optional fromCompletionResult(const NamedDecl *D) {
 return OpaqueType::fromCompletionResult(
 ASTCtx(), CodeCompletionResult(D, CCP_Declaration));
   }
@@ -148,6 +147,29 @@
   EXPECT_EQ(fromCompletionResult(decl("returns_ptr")), IntPtrTy);
 }
 
+TEST_F(ExpectedTypeConversionTest, Templates) {
+  build(R"cpp(
+template 
+int* returns_not_dependent();
+template 
+T* returns_dependent();
+
+template 
+int* var_not_dependent = nullptr;
+template 
+T* var_dependent = nullptr;
+
+int* int_ptr_;
+  )cpp");
+
+  auto IntPtrTy = *OpaqueType::fromType(ASTCtx(), typeOf("int_ptr_"));
+  EXPECT_EQ(fromCompletionResult(decl("returns_not_dependent")), IntPtrTy);
+  EXPECT_EQ(fromCompletionResult(decl("returns_dependent")), llvm::None);
+
+  EXPECT_EQ(fromCompletionResult(decl("var_not_dependent")), IntPtrTy);
+  EXPECT_EQ(fromCompletionResult(decl("var_dependent")), llvm::None);
+}
+
 } // namespace
 } // namespace clangd
 } // namespace clang
Index: clang-tools-extra/clangd/ExpectedTypes.cpp
===
--- clang-tools-extra/clangd/ExpectedTypes.cpp
+++ clang-tools-extra/clangd/ExpectedTypes.cpp
@@ -8,9 +8,11 @@
 
 #include "ExpectedTypes.h"
 #include "clang/AST/ASTContext.h"
+#include "clang/AST/DeclTemplate.h"
 #include "clang/AST/Type.h"
 #include "clang/Index/USRGeneration.h"
 #include "clang/Sema/CodeCompleteConsumer.h"
+#include "llvm/ADT/None.h"
 #include "llvm/ADT/STLExtras.h"
 
 namespace clang {
@@ -41,7 +43,13 @@
 
 static llvm::Optional
 typeOfCompletion(const CodeCompletionResult &R) {
-  auto *VD = dyn_cast_or_null(R.Declaration);
+  const NamedDecl *D = R.Declaration;
+  if (!D)
+return llvm::None;
+  // Templates do not have a type on their own, look at the templated decl.
+  if (auto *Template = dyn_cast(D))
+D = Template->getTemplatedDecl();
+  auto *VD = dyn_cast(D);
   if (!VD)
 return llvm::None; // We handle only variables and functions below.
   auto T = VD->getType();


Index: clang-tools-extra/clangd/unittests/ExpectedTypeTest.cpp
===
--- clang-tools-extra/clangd/unittests/ExpectedTypeTest.cpp
+++ clang-tools-extra/clangd/unittests/ExpectedTypeTest.cpp
@@ -11,6 +11,7 @@
 #include "TestTU.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Decl.h"
+#include "llvm/ADT/None.h"
 #include "llvm/ADT/StringRef.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
@@ -31,16 +32,14 @@
 AST = TestTU::withCode(Code).build();
   }
 
-  const ValueDecl *decl(llvm::StringRef Name) {
-return &cast(findDecl(*AST, Name));
-  }
+  const NamedDecl *decl(llvm::StringRef Name) { return &findDecl(*AST, Name); }
 
   QualType typeOf(llvm::StringRef Name) {
-return decl(Name)->getType().getCanonicalType();
+return cast(decl(Name))->getType().getCanonicalType();
   }
 
   /// An overload for convenience.
-  llvm::Optional fromCompletionResult(const ValueDecl *D) {
+  llvm::Optional fromCompletionResult(const NamedDecl *D) {
 return OpaqueType::fromCompletionResult(
 ASTCtx(), CodeCompletionResult(D, CCP_Declaration));
   }
@@ -148,6 +147,29 @@
   EXPECT_EQ(fromCompletionResult(decl("returns_ptr")), IntPtrTy);
 }
 
+TEST_F(ExpectedTypeConversionTest, Templates) {
+  build(R"cpp(
+template 
+int* returns_not_dependent();
+template 
+T* returns_dependent();
+
+template 
+int* var_not_dependent = nullptr;
+template 
+T* var_dependent = nullptr;
+
+int* int_ptr_;
+  )cpp");
+
+  auto IntPtrTy = *OpaqueType::fromType(ASTCtx(), typeOf("int_ptr_"));
+  EXPECT_EQ(fromCompletionResult(decl("returns_not_dependent")), IntPtrTy);
+  EXP

[PATCH] D62367: [X86] VP2INTERSECT clang

2019-05-28 Thread Simon Pilgrim via Phabricator via cfe-commits
RKSimon added inline comments.



Comment at: lib/Headers/avx512vlvp2intersectintrin.h:39
+
+static __inline__ void __DEFAULT_FN_ATTRS256
+_mm256_2intersect_epi32(__m256i __a, __m256i __b, __mmask8 *__m0, __mmask8 
*__m1) {

craig.topper wrote:
> xiangzhangllvm wrote:
> > craig.topper wrote:
> > > Can you add doxygen comments for the new intrinsics? @RKSimon has been 
> > > asking for it on other reviews. I forgot to say something in our internal 
> > > review.
> > OK! But I really find many ntrinsicxxx.h have no doxygen comments, Is it 
> > like this format: ?
> > 
> > 
> > ```
> > /// Rounds up each element of the 128-bit vector of [4 x float] to an
> > ///integer and returns the rounded values in a 128-bit vector of
> > ///[4 x float].
> > ///
> > /// \headerfile 
> > ///
> > /// \code
> > /// __m128 _mm_ceil_ps(__m128 X);
> > /// \endcode
> > ///
> > /// This intrinsic corresponds to the  VROUNDPS / ROUNDPS  
> > instruction.
> > ///
> > /// \param X
> > ///A 128-bit vector of [4 x float] values to be rounded up.
> > /// \returns A 128-bit vector of [4 x float] containing the rounded values.
> > #define _mm_ceil_ps(X)   _mm_round_ps((X), _MM_FROUND_CEIL)
> > ```
> > 
> Yeah that looks right. Someone was kind enough to provide comments for some 
> of the header files a few years ago, but it wasn't complete. I know avx512* 
> especially are missing comments.
The hope is that these will get added as time goes on - usually it just 
requires a copy + paste of existing comments and tweak for ymm/zmm/whatever.

New intrinsics should always include documentation since the person adding it 
is the most likely to be able to correct describe it.


Repository:
  rC Clang

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

https://reviews.llvm.org/D62367



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


[PATCH] D62479: [Analyzer] Replace `CXXSelfAssignmentBRVisitor` with `NoteTags`

2019-05-28 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus accepted this revision.
Szelethus added a comment.

I love this.


Repository:
  rC Clang

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

https://reviews.llvm.org/D62479



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


[PATCH] D62404: [clang-tidy] Fix null pointer dereference in readability-identifier-naming

2019-05-28 Thread Mark Stegeman via Phabricator via cfe-commits
markstegeman added a comment.

Great. Can someone commit this for me?


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

https://reviews.llvm.org/D62404



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


[PATCH] D62404: [clang-tidy] Fix null pointer dereference in readability-identifier-naming

2019-05-28 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision.
hokein added inline comments.



Comment at: 
clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp:804
+if (const auto *Typedef = TypePtr->getAs()) {
+  addUsage(NamingCheckFailures, Typedef->getDecl(),
+   Value->getSourceRange());

aaron.ballman wrote:
> madsravn wrote:
> > hokein wrote:
> > > We are risky of dereferencing a nullptr, as the `TypePtr` can be null now.
> > Are we not checking for null in the line where `TypePtr` gets declared? Or 
> > am I misunderstanding? 
> I don't see a null pointer dereference here for `TypePtr`; I think the code 
> is fine as-is.
Ah, I missed the if statement, it is guarded by the `if` statement.


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

https://reviews.llvm.org/D62404



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


[PATCH] D60455: [SYCL] Implement SYCL device code outlining

2019-05-28 Thread Mariya Podchishchaeva via Phabricator via cfe-commits
Fznamznon added inline comments.



Comment at: clang/test/SemaSYCL/device-attributes-on-non-sycl.cpp:1
+// RUN: %clang_cc1 -fsyntax-only -fsycl-is-device -verify %s
+// Now pretend that we're compiling regular C++ file without SYCL mode enabled.

Anastasia wrote:
> Another confusion I have at the moment even though it doesn't belong to this 
> patch - isn't SYCL based on C++11?
Sorry for confusion. The C++ features used in SYCL are a subset of the C++11 
standard features.
I will add -std=c++11 key to run line to avoid such confusion in future.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D60455



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


[PATCH] D62514: [CodeComplete] Set preferred type for qualified-id

2019-05-28 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet accepted this revision.
kadircet added a comment.
This revision is now accepted and ready to land.

thanks, lgtm.

one irrelevant question though, it looks like most of the calls to 
`ResultBuilder::setPreferredType` performs a `!isNull` check before hand. 
should we perform this check implicitly and make the `setPreferredType` no-op 
in case of a null type?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62514



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


[PATCH] D62367: [X86] VP2INTERSECT clang

2019-05-28 Thread Xiang Zhang via Phabricator via cfe-commits
xiangzhangllvm marked an inline comment as done.
xiangzhangllvm added inline comments.



Comment at: lib/Headers/avx512vlvp2intersectintrin.h:39
+
+static __inline__ void __DEFAULT_FN_ATTRS256
+_mm256_2intersect_epi32(__m256i __a, __m256i __b, __mmask8 *__m0, __mmask8 
*__m1) {

RKSimon wrote:
> craig.topper wrote:
> > xiangzhangllvm wrote:
> > > craig.topper wrote:
> > > > Can you add doxygen comments for the new intrinsics? @RKSimon has been 
> > > > asking for it on other reviews. I forgot to say something in our 
> > > > internal review.
> > > OK! But I really find many ntrinsicxxx.h have no doxygen comments, Is it 
> > > like this format: ?
> > > 
> > > 
> > > ```
> > > /// Rounds up each element of the 128-bit vector of [4 x float] to an
> > > ///integer and returns the rounded values in a 128-bit vector of
> > > ///[4 x float].
> > > ///
> > > /// \headerfile 
> > > ///
> > > /// \code
> > > /// __m128 _mm_ceil_ps(__m128 X);
> > > /// \endcode
> > > ///
> > > /// This intrinsic corresponds to the  VROUNDPS / ROUNDPS  
> > > instruction.
> > > ///
> > > /// \param X
> > > ///A 128-bit vector of [4 x float] values to be rounded up.
> > > /// \returns A 128-bit vector of [4 x float] containing the rounded 
> > > values.
> > > #define _mm_ceil_ps(X)   _mm_round_ps((X), _MM_FROUND_CEIL)
> > > ```
> > > 
> > Yeah that looks right. Someone was kind enough to provide comments for some 
> > of the header files a few years ago, but it wasn't complete. I know avx512* 
> > especially are missing comments.
> The hope is that these will get added as time goes on - usually it just 
> requires a copy + paste of existing comments and tweak for ymm/zmm/whatever.
> 
> New intrinsics should always include documentation since the person adding it 
> is the most likely to be able to correct describe it.
Yes, That make sense!


Repository:
  rC Clang

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

https://reviews.llvm.org/D62367



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


[clang-tools-extra] r361809 - [clang-tidy] Fix null pointer dereference in readability-identifier-naming

2019-05-28 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Tue May 28 04:54:01 2019
New Revision: 361809

URL: http://llvm.org/viewvc/llvm-project?rev=361809&view=rev
Log:
[clang-tidy] Fix null pointer dereference in readability-identifier-naming

Summary:
readability-identifier-naming causes a null pointer dereference when checking 
an identifier introduced by a structured binding whose right hand side is an 
undeclared identifier.

Running the check on a file that is just the following results in a crash:
```
auto [left] = right;
```

Patch by Mark Stegeman!

Reviewers: alexfh, hokein, aaron.ballman, JonasToth

Reviewed By: hokein, aaron.ballman

Subscribers: madsravn, xazax.hun, cfe-commits

Tags: #clang-tools-extra, #clang

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

Added:

clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-bugfix.cpp
Modified:
clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp

Modified: 
clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp?rev=361809&r1=361808&r2=361809&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp 
Tue May 28 04:54:01 2019
@@ -800,10 +800,11 @@ void IdentifierNamingCheck::check(const
 
 // Fix type aliases in value declarations
 if (const auto *Value = Result.Nodes.getNodeAs("decl")) {
-  if (const auto *Typedef =
-  Value->getType().getTypePtr()->getAs()) {
-addUsage(NamingCheckFailures, Typedef->getDecl(),
- Value->getSourceRange());
+  if (const auto *TypePtr = Value->getType().getTypePtrOrNull()) {
+if (const auto *Typedef = TypePtr->getAs()) {
+  addUsage(NamingCheckFailures, Typedef->getDecl(),
+   Value->getSourceRange());
+}
   }
 }
 

Added: 
clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-bugfix.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-bugfix.cpp?rev=361809&view=auto
==
--- 
clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-bugfix.cpp
 (added)
+++ 
clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-bugfix.cpp
 Tue May 28 04:54:01 2019
@@ -0,0 +1,5 @@
+// RUN: %check_clang_tidy -expect-clang-tidy-error %s 
readability-identifier-naming %t
+
+// This used to cause a null pointer dereference.
+auto [left] = right;
+// CHECK-MESSAGES: :[[@LINE-1]]:15: error: use of undeclared identifier 'right'


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


[PATCH] D62404: [clang-tidy] Fix null pointer dereference in readability-identifier-naming

2019-05-28 Thread Haojian Wu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL361809: [clang-tidy] Fix null pointer dereference in 
readability-identifier-naming (authored by hokein, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D62404?vs=201401&id=201639#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62404

Files:
  clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
  
clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-bugfix.cpp


Index: clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -800,10 +800,11 @@
 
 // Fix type aliases in value declarations
 if (const auto *Value = Result.Nodes.getNodeAs("decl")) {
-  if (const auto *Typedef =
-  Value->getType().getTypePtr()->getAs()) {
-addUsage(NamingCheckFailures, Typedef->getDecl(),
- Value->getSourceRange());
+  if (const auto *TypePtr = Value->getType().getTypePtrOrNull()) {
+if (const auto *Typedef = TypePtr->getAs()) {
+  addUsage(NamingCheckFailures, Typedef->getDecl(),
+   Value->getSourceRange());
+}
   }
 }
 
Index: 
clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-bugfix.cpp
===
--- 
clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-bugfix.cpp
+++ 
clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-bugfix.cpp
@@ -0,0 +1,5 @@
+// RUN: %check_clang_tidy -expect-clang-tidy-error %s 
readability-identifier-naming %t
+
+// This used to cause a null pointer dereference.
+auto [left] = right;
+// CHECK-MESSAGES: :[[@LINE-1]]:15: error: use of undeclared identifier 'right'


Index: clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -800,10 +800,11 @@
 
 // Fix type aliases in value declarations
 if (const auto *Value = Result.Nodes.getNodeAs("decl")) {
-  if (const auto *Typedef =
-  Value->getType().getTypePtr()->getAs()) {
-addUsage(NamingCheckFailures, Typedef->getDecl(),
- Value->getSourceRange());
+  if (const auto *TypePtr = Value->getType().getTypePtrOrNull()) {
+if (const auto *Typedef = TypePtr->getAs()) {
+  addUsage(NamingCheckFailures, Typedef->getDecl(),
+   Value->getSourceRange());
+}
   }
 }
 
Index: clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-bugfix.cpp
===
--- clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-bugfix.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-bugfix.cpp
@@ -0,0 +1,5 @@
+// RUN: %check_clang_tidy -expect-clang-tidy-error %s readability-identifier-naming %t
+
+// This used to cause a null pointer dereference.
+auto [left] = right;
+// CHECK-MESSAGES: :[[@LINE-1]]:15: error: use of undeclared identifier 'right'
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D60455: [SYCL] Implement SYCL device code outlining

2019-05-28 Thread Mariya Podchishchaeva via Phabricator via cfe-commits
Fznamznon updated this revision to Diff 201641.
Fznamznon added a comment.

Applied comments from @Anastasia

- Added documentation for sycl_kernel function
- Added comments to Sema.h
- Added -std=c++11 to test run lines


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D60455

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Sema/Sema.h
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Parse/ParseAST.cpp
  clang/lib/Sema/CMakeLists.txt
  clang/lib/Sema/Sema.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/lib/Sema/SemaSYCL.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/test/CodeGenSYCL/device-functions.cpp
  clang/test/Misc/pragma-attribute-supported-attributes-list.test
  clang/test/SemaSYCL/device-attributes-on-non-sycl.cpp
  clang/test/SemaSYCL/device-attributes.cpp

Index: clang/test/SemaSYCL/device-attributes.cpp
===
--- /dev/null
+++ clang/test/SemaSYCL/device-attributes.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fsycl-is-device -verify %s
+
+[[clang::sycl_kernel]] int gv2 = 0; // expected-warning {{'sycl_kernel' attribute only applies to functions}}
+__attribute((sycl_kernel)) int gv3 = 0; // expected-warning {{'sycl_kernel' attribute only applies to functions}}
+
+__attribute((sycl_kernel)) void foo();
+[[clang::sycl_kernel]] void foo1();
+
+__attribute((sycl_kernel(1))) void foo(); // expected-error {{'sycl_kernel' attribute takes no arguments}}
+[[clang::sycl_kernel(1)]] void foo2(); // expected-error {{'sycl_kernel' attribute takes no arguments}}
Index: clang/test/SemaSYCL/device-attributes-on-non-sycl.cpp
===
--- /dev/null
+++ clang/test/SemaSYCL/device-attributes-on-non-sycl.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fsycl-is-device -verify %s
+// Now pretend that we're compiling regular C++ file without SYCL mode enabled.
+// There should be warnings.
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -x c++ %s
+
+#if not defined(__SYCL_DEVICE_ONLY__)
+// expected-warning@+6 {{'sycl_kernel' attribute ignored}}
+// expected-warning@+6 {{'sycl_kernel' attribute ignored}}
+#else
+// expected-no-diagnostics
+#endif
+
+__attribute((sycl_kernel)) void foo();
+[[clang::sycl_kernel]] void foo2();
+
Index: clang/test/Misc/pragma-attribute-supported-attributes-list.test
===
--- clang/test/Misc/pragma-attribute-supported-attributes-list.test
+++ clang/test/Misc/pragma-attribute-supported-attributes-list.test
@@ -124,6 +124,7 @@
 // CHECK-NEXT: ReturnTypestate (SubjectMatchRule_function, SubjectMatchRule_variable_is_parameter)
 // CHECK-NEXT: ReturnsNonNull (SubjectMatchRule_objc_method, SubjectMatchRule_function)
 // CHECK-NEXT: ReturnsTwice (SubjectMatchRule_function)
+// CHECK-NEXT: SYCLKernel (SubjectMatchRule_function)
 // CHECK-NEXT: ScopedLockable (SubjectMatchRule_record)
 // CHECK-NEXT: Section (SubjectMatchRule_function, SubjectMatchRule_variable_is_global, SubjectMatchRule_objc_method, SubjectMatchRule_objc_property)
 // CHECK-NEXT: SetTypestate (SubjectMatchRule_function_is_member)
Index: clang/test/CodeGenSYCL/device-functions.cpp
===
--- /dev/null
+++ clang/test/CodeGenSYCL/device-functions.cpp
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -triple spir64-unknown-unknown -std=c++11 -fsycl-is-device -S -emit-llvm %s -o - | FileCheck %s
+
+template 
+T bar(T arg);
+
+void foo() {
+  int a = 1 + 1 + bar(1);
+}
+
+template 
+T bar(T arg) {
+  return arg;
+}
+
+template 
+__attribute__((sycl_kernel)) void kernel_single_task(Func kernelFunc) {
+  kernelFunc();
+}
+
+int main() {
+  kernel_single_task([]() { foo(); });
+  return 0;
+}
+// CHECK: define spir_func void @{{.*}}foo
+// CHECK: define linkonce_odr spir_func i32 @{{.*}}bar
+// CHECK: define internal spir_func void @{{.*}}kernel_single_task
+// FIXME: Next function is lambda () operator. spir_func calling convention
+// is missed for C++ methods.
+// CHECK: define internal void @"_ZZ4mainENK3$_0clEv"(%class.anon* %this)
Index: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
===
--- clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -5517,14 +5517,30 @@
 Function, [this, Inst, DefinitionRequired](FunctionDecl *CurFD) {
   InstantiateFunctionDefinition(/*FIXME:*/ Inst.second, CurFD, true,
 DefinitionRequired, true);
-  if (CurFD->isDefined())
+  if (CurFD->isDefined()) {
+// Because all SYCL kernel functions are template functions - they
+// have deferred instantination.

r361811 - Re-commit r357452 (take 2): "SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function calls without used results (PR41259)"

2019-05-28 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Tue May 28 05:19:38 2019
New Revision: 361811

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

This was reverted in r360086 as it was supected of causing mysterious test
failures internally. However, it was never concluded that this patch was the
root cause.

> The code was previously checking that candidates for sinking had exactly
> one use or were a store instruction (which can't have uses). This meant
> we could sink call instructions only if they had a use.
>
> That limitation seemed a bit arbitrary, so this patch changes it to
> "instruction has zero or one use" which seems more natural and removes
> the need to special-case stores.
>
> Differential revision: https://reviews.llvm.org/D59936

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

Modified: cfe/trunk/test/CodeGenCXX/nrvo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/nrvo.cpp?rev=361811&r1=361810&r2=361811&view=diff
==
--- cfe/trunk/test/CodeGenCXX/nrvo.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/nrvo.cpp Tue May 28 05:19:38 2019
@@ -60,7 +60,6 @@ X test2(bool B) {
   // CHECK-NEXT: call void @llvm.lifetime.start
   // CHECK-NEXT: call {{.*}} @_ZN1XC1Ev
   // CHECK: call {{.*}} @_ZN1XC1ERKS_
-  // CHECK: call {{.*}} @_ZN1XC1ERKS_
   // CHECK: call {{.*}} @_ZN1XD1Ev
   // CHECK-NEXT: call void @llvm.lifetime.end
   // CHECK: call {{.*}} @_ZN1XD1Ev

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

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


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


Re: [PATCH] D62133: test/CodeGen/builtin-stackaddress.c duplicates test/CodeGen/2004-02-13-BuiltinFrameReturnAddress.c

2019-05-28 Thread A. Skrobov via cfe-commits
Ping?

On Mon, May 20, 2019 at 1:43 PM A. Skrobov via Phabricator
 wrote:
>
> t.yomitch created this revision.
> t.yomitch added reviewers: efriedma, echristo, ddunbar.
> Herald added a subscriber: kristina.
> Herald added a project: clang.
>
> Repository:
>   rC Clang
>
> https://reviews.llvm.org/D62133
>
> Files:
>   test/CodeGen/builtin-stackaddress.c
>
>
> Index: test/CodeGen/builtin-stackaddress.c
> ===
> --- test/CodeGen/builtin-stackaddress.c
> +++ /dev/null
> @@ -1,9 +0,0 @@
> -// RUN: %clang_cc1 -emit-llvm < %s | grep "llvm.returnaddress"
> -// RUN: %clang_cc1 -emit-llvm < %s | grep "llvm.frameaddress"
> -void* a(unsigned x) {
> -return __builtin_return_address(0);
> -}
> -
> -void* c(unsigned x) {
> -return __builtin_frame_address(0);
> -}
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r361818 - [Analyzer] Replace `CXXSelfAssignmentBRVisitor` with `NoteTags`

2019-05-28 Thread Adam Balogh via cfe-commits
Author: baloghadamsoftware
Date: Tue May 28 06:07:09 2019
New Revision: 361818

URL: http://llvm.org/viewvc/llvm-project?rev=361818&view=rev
Log:
[Analyzer] Replace `CXXSelfAssignmentBRVisitor` with `NoteTags`

The `cplusplus.SelfAssignment` checker has a visitor that is added
to every `BugReport` to mark the to branch of the self assignment
operator with e.g. `rhs == *this` and `rhs != *this`. With the new
`NoteTag` feature this visitor is not needed anymore. Instead the
checker itself marks the two branches using the `NoteTag`s.

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


Modified:

cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
cfe/trunk/lib/StaticAnalyzer/Checkers/CXXSelfAssignmentChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp

Modified: 
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h?rev=361818&r1=361817&r2=361818&view=diff
==
--- 
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h 
(original)
+++ 
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h 
Tue May 28 06:07:09 2019
@@ -294,20 +294,6 @@ public:
  BugReport &BR) override;
 };
 
-class CXXSelfAssignmentBRVisitor final : public BugReporterVisitor {
-  bool Satisfied = false;
-
-public:
-  CXXSelfAssignmentBRVisitor() = default;
-
-  void Profile(llvm::FoldingSetNodeID &ID) const override {}
-
-  std::shared_ptr VisitNode(const ExplodedNode *Succ,
- BugReporterContext &BRC,
- BugReport &BR) override;
-};
-
-
 /// The bug visitor will walk all the nodes in a path and collect all the
 /// constraints. When it reaches the root node, will create a refutation
 /// manager and check if the constraints are satisfiable

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CXXSelfAssignmentChecker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CXXSelfAssignmentChecker.cpp?rev=361818&r1=361817&r2=361818&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CXXSelfAssignmentChecker.cpp 
(original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CXXSelfAssignmentChecker.cpp Tue May 
28 06:07:09 2019
@@ -50,10 +50,26 @@ void CXXSelfAssignmentChecker::checkBegi
   State->getSVal(SVB.getCXXThis(MD, LCtx->getStackFrame()));
   auto Param = SVB.makeLoc(State->getRegion(MD->getParamDecl(0), LCtx));
   auto ParamVal = State->getSVal(Param);
+
   ProgramStateRef SelfAssignState = State->bindLoc(Param, ThisVal, LCtx);
-  C.addTransition(SelfAssignState);
+  const NoteTag *SelfAssignTag =
+C.getNoteTag([MD](BugReport &BR) -> std::string {
+SmallString<256> Msg;
+llvm::raw_svector_ostream Out(Msg);
+Out << "Assuming " << MD->getParamDecl(0)->getName() << " == *this";
+return Out.str();
+  });
+  C.addTransition(SelfAssignState, SelfAssignTag);
+
   ProgramStateRef NonSelfAssignState = State->bindLoc(Param, ParamVal, LCtx);
-  C.addTransition(NonSelfAssignState);
+  const NoteTag *NonSelfAssignTag =
+C.getNoteTag([MD](BugReport &BR) -> std::string {
+SmallString<256> Msg;
+llvm::raw_svector_ostream Out(Msg);
+Out << "Assuming " << MD->getParamDecl(0)->getName() << " != *this";
+return Out.str();
+  });
+  C.addTransition(NonSelfAssignState, NonSelfAssignTag);
 }
 
 void ento::registerCXXSelfAssignmentChecker(CheckerManager &Mgr) {

Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp?rev=361818&r1=361817&r2=361818&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp Tue May 28 06:07:09 2019
@@ -2610,7 +2610,6 @@ std::pairaddVisitor(llvm::make_unique());
 R->addVisitor(llvm::make_unique());
-R->addVisitor(llvm::make_unique());
 R->addVisitor(llvm::make_unique());
 
 BugReporterContext BRC(Reporter, ErrorGraph.BackMap);

Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp?rev=361818&r1=361817&r2=361818&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/BugRepor

[PATCH] D62479: [Analyzer] Replace `CXXSelfAssignmentBRVisitor` with `NoteTags`

2019-05-28 Thread Balogh, Ádám via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC361818: [Analyzer] Replace `CXXSelfAssignmentBRVisitor` with 
`NoteTags` (authored by baloghadamsoftware, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D62479?vs=201494&id=201645#toc

Repository:
  rC Clang

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

https://reviews.llvm.org/D62479

Files:
  include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
  lib/StaticAnalyzer/Checkers/CXXSelfAssignmentChecker.cpp
  lib/StaticAnalyzer/Core/BugReporter.cpp
  lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
  lib/StaticAnalyzer/Core/PathDiagnostic.cpp

Index: lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
===
--- lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -2371,59 +2371,6 @@
   return nullptr;
 }
 
-std::shared_ptr
-CXXSelfAssignmentBRVisitor::VisitNode(const ExplodedNode *Succ,
-  BugReporterContext &BRC, BugReport &) {
-  if (Satisfied)
-return nullptr;
-
-  const auto Edge = Succ->getLocation().getAs();
-  if (!Edge.hasValue())
-return nullptr;
-
-  auto Tag = Edge->getTag();
-  if (!Tag)
-return nullptr;
-
-  if (Tag->getTagDescription() != "cplusplus.SelfAssignment")
-return nullptr;
-
-  Satisfied = true;
-
-  const auto *Met =
-  dyn_cast(Succ->getCodeDecl().getAsFunction());
-  assert(Met && "Not a C++ method.");
-  assert((Met->isCopyAssignmentOperator() || Met->isMoveAssignmentOperator()) &&
- "Not a copy/move assignment operator.");
-
-  const auto *LCtx = Edge->getLocationContext();
-
-  const auto &State = Succ->getState();
-  auto &SVB = State->getStateManager().getSValBuilder();
-
-  const auto Param =
-  State->getSVal(State->getRegion(Met->getParamDecl(0), LCtx));
-  const auto This =
-  State->getSVal(SVB.getCXXThis(Met, LCtx->getStackFrame()));
-
-  auto L = PathDiagnosticLocation::create(Met, BRC.getSourceManager());
-
-  if (!L.isValid() || !L.asLocation().isValid())
-return nullptr;
-
-  SmallString<256> Buf;
-  llvm::raw_svector_ostream Out(Buf);
-
-  Out << "Assuming " << Met->getParamDecl(0)->getName() <<
-((Param == This) ? " == " : " != ") << "*this";
-
-  auto Piece = std::make_shared(L, Out.str());
-  Piece->addRange(Met->getSourceRange());
-
-  return std::move(Piece);
-}
-
-
 FalsePositiveRefutationBRVisitor::FalsePositiveRefutationBRVisitor()
 : Constraints(ConstraintRangeTy::Factory().getEmptyMap()) {}
 
Index: lib/StaticAnalyzer/Core/BugReporter.cpp
===
--- lib/StaticAnalyzer/Core/BugReporter.cpp
+++ lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -2610,7 +2610,6 @@
 // Register additional node visitors.
 R->addVisitor(llvm::make_unique());
 R->addVisitor(llvm::make_unique());
-R->addVisitor(llvm::make_unique());
 R->addVisitor(llvm::make_unique());
 
 BugReporterContext BRC(Reporter, ErrorGraph.BackMap);
Index: lib/StaticAnalyzer/Core/PathDiagnostic.cpp
===
--- lib/StaticAnalyzer/Core/PathDiagnostic.cpp
+++ lib/StaticAnalyzer/Core/PathDiagnostic.cpp
@@ -732,6 +732,15 @@
 
 } else {
   S = BSrc->getTerminatorCondition();
+  if (!S) {
+// If the BlockEdge has no terminator condition statement but its
+// source is the entry of the CFG (e.g. a checker crated the branch at
+// the beginning of a function), use the function's declaration instead.
+assert(BSrc == &BSrc->getParent()->getEntry() && "CFGBlock has no "
+   "TerminatorCondition and is not the enrty block of the CFG");
+return PathDiagnosticLocation::createBegin(
+P.getLocationContext()->getDecl(), SMng);
+  }
 }
   } else if (Optional SP = P.getAs()) {
 S = SP->getStmt();
Index: lib/StaticAnalyzer/Checkers/CXXSelfAssignmentChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/CXXSelfAssignmentChecker.cpp
+++ lib/StaticAnalyzer/Checkers/CXXSelfAssignmentChecker.cpp
@@ -50,10 +50,26 @@
   State->getSVal(SVB.getCXXThis(MD, LCtx->getStackFrame()));
   auto Param = SVB.makeLoc(State->getRegion(MD->getParamDecl(0), LCtx));
   auto ParamVal = State->getSVal(Param);
+
   ProgramStateRef SelfAssignState = State->bindLoc(Param, ThisVal, LCtx);
-  C.addTransition(SelfAssignState);
+  const NoteTag *SelfAssignTag =
+C.getNoteTag([MD](BugReport &BR) -> std::string {
+SmallString<256> Msg;
+llvm::raw_svector_ostream Out(Msg);
+Out << "Assuming " << MD->getParamDecl(0)->getName() << " == *this";
+return Out.str();
+  });
+  C.addTransition(SelfAssignState, SelfAssignTag);
+
   ProgramStateRef NonSelfAssignState = State->bindLoc(Param, ParamVal, LCtx);
-  C.add

[PATCH] D61742: [Driver][Windows] Add dependent lib argument for profile instr generate

2019-05-28 Thread Russell Gallop via Phabricator via cfe-commits
russell.gallop added a subscriber: ruiu.
russell.gallop added a comment.

> Hello, this embeds an absolute path into the generated .obj file, which means 
> the output now is no longer deterministic (since it depends on the absolute 
> path to clang_rt.profile-x86_64.lib).

Yes, it embeds the absolute path. Note that -fsanitize=undefined has done that 
since r241225 (in 2015).

> This means the output will be different on different machines, which breaks 
> things like caching in distributed builds and whatnot.

I assume that your distributed build sandboxes tool paths so this is 
deterministic from one users point of view, just not deterministic across users 
with tools installed in different locations so it defeats the cache. Yes, 
that's not ideal.

> I can't see an obvious way to save this patch either, since you won't know at 
> compile time what the CWD will be at link time.

I assume you're considering relative paths here. Yes, I don't think that would 
work nicely.

> As-is, this breaks Chromium's deterministic builds. ("Only" the coverage 
> builds, and they don't yet check for determinism, which is why it took us a 
> while to notice.)
>  Suggestions?

If this was made into a library name instead of a path (e.g. 
--dependent-lib=clang_rt.profile-x86_64.lib) then it would solve the problem of 
different paths on different nodes, but then you would have to tell the linker 
where to find this library.

That is *almost* as bad as having to specify the full path to the library to 
the linker in the first place! It's not quite as bad as you don't have to 
specify the architecture and you only need to specify it once regardless of 
whether you're using profiling or sanitizers. If lld-link added the clang 
library path itself, then the library name would be all that was needed from 
the compiler side.

Rui, would it be possible for lld-link to search the path to the clang 
libraries (e.g. C:\Program Files\LLVM\lib\clang\8.0.0\lib\windows) by default? 
Would this have any undesirable side effects?


Repository:
  rC Clang

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

https://reviews.llvm.org/D61742



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


[PATCH] D62522: [clang-tidy] Verify fix description for misc-unused-using-decl.

2019-05-28 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision.
hokein added a reviewer: gribozavr.
Herald added a subscriber: xazax.hun.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62522

Files:
  clang-tools-extra/test/clang-tidy/misc-unused-using-decls.cpp


Index: clang-tools-extra/test/clang-tidy/misc-unused-using-decls.cpp
===
--- clang-tools-extra/test/clang-tidy/misc-unused-using-decls.cpp
+++ clang-tools-extra/test/clang-tidy/misc-unused-using-decls.cpp
@@ -79,6 +79,7 @@
 // eol-comments aren't removed (yet)
 using n::A; // A
 // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: using decl 'A' is unused
+// CHECK-MESSAGES: :[[@LINE-2]]:10: note: remove the using
 // CHECK-FIXES: {{^}}// A
 using n::B;
 using n::C;


Index: clang-tools-extra/test/clang-tidy/misc-unused-using-decls.cpp
===
--- clang-tools-extra/test/clang-tidy/misc-unused-using-decls.cpp
+++ clang-tools-extra/test/clang-tidy/misc-unused-using-decls.cpp
@@ -79,6 +79,7 @@
 // eol-comments aren't removed (yet)
 using n::A; // A
 // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: using decl 'A' is unused
+// CHECK-MESSAGES: :[[@LINE-2]]:10: note: remove the using
 // CHECK-FIXES: {{^}}// A
 using n::B;
 using n::C;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r361823 - [clangd] Compute expected type for templates

2019-05-28 Thread Ilya Biryukov via cfe-commits
Author: ibiryukov
Date: Tue May 28 06:56:21 2019
New Revision: 361823

URL: http://llvm.org/viewvc/llvm-project?rev=361823&view=rev
Log:
[clangd] Compute expected type for templates

Reviewers: sammccall

Reviewed By: sammccall

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

Tags: #clang

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

Modified:
clang-tools-extra/trunk/clangd/ExpectedTypes.cpp
clang-tools-extra/trunk/clangd/unittests/ExpectedTypeTest.cpp

Modified: clang-tools-extra/trunk/clangd/ExpectedTypes.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ExpectedTypes.cpp?rev=361823&r1=361822&r2=361823&view=diff
==
--- clang-tools-extra/trunk/clangd/ExpectedTypes.cpp (original)
+++ clang-tools-extra/trunk/clangd/ExpectedTypes.cpp Tue May 28 06:56:21 2019
@@ -8,9 +8,11 @@
 
 #include "ExpectedTypes.h"
 #include "clang/AST/ASTContext.h"
+#include "clang/AST/DeclTemplate.h"
 #include "clang/AST/Type.h"
 #include "clang/Index/USRGeneration.h"
 #include "clang/Sema/CodeCompleteConsumer.h"
+#include "llvm/ADT/None.h"
 #include "llvm/ADT/STLExtras.h"
 
 namespace clang {
@@ -41,7 +43,13 @@ static const Type *toEquivClass(ASTConte
 
 static llvm::Optional
 typeOfCompletion(const CodeCompletionResult &R) {
-  auto *VD = dyn_cast_or_null(R.Declaration);
+  const NamedDecl *D = R.Declaration;
+  if (!D)
+return llvm::None;
+  // Templates do not have a type on their own, look at the templated decl.
+  if (auto *Template = dyn_cast(D))
+D = Template->getTemplatedDecl();
+  auto *VD = dyn_cast(D);
   if (!VD)
 return llvm::None; // We handle only variables and functions below.
   auto T = VD->getType();

Modified: clang-tools-extra/trunk/clangd/unittests/ExpectedTypeTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/unittests/ExpectedTypeTest.cpp?rev=361823&r1=361822&r2=361823&view=diff
==
--- clang-tools-extra/trunk/clangd/unittests/ExpectedTypeTest.cpp (original)
+++ clang-tools-extra/trunk/clangd/unittests/ExpectedTypeTest.cpp Tue May 28 
06:56:21 2019
@@ -11,6 +11,7 @@
 #include "TestTU.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Decl.h"
+#include "llvm/ADT/None.h"
 #include "llvm/ADT/StringRef.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
@@ -31,16 +32,14 @@ protected:
 AST = TestTU::withCode(Code).build();
   }
 
-  const ValueDecl *decl(llvm::StringRef Name) {
-return &cast(findDecl(*AST, Name));
-  }
+  const NamedDecl *decl(llvm::StringRef Name) { return &findDecl(*AST, Name); }
 
   QualType typeOf(llvm::StringRef Name) {
-return decl(Name)->getType().getCanonicalType();
+return cast(decl(Name))->getType().getCanonicalType();
   }
 
   /// An overload for convenience.
-  llvm::Optional fromCompletionResult(const ValueDecl *D) {
+  llvm::Optional fromCompletionResult(const NamedDecl *D) {
 return OpaqueType::fromCompletionResult(
 ASTCtx(), CodeCompletionResult(D, CCP_Declaration));
   }
@@ -148,6 +147,29 @@ TEST_F(ExpectedTypeConversionTest, Funct
   EXPECT_EQ(fromCompletionResult(decl("returns_ptr")), IntPtrTy);
 }
 
+TEST_F(ExpectedTypeConversionTest, Templates) {
+  build(R"cpp(
+template 
+int* returns_not_dependent();
+template 
+T* returns_dependent();
+
+template 
+int* var_not_dependent = nullptr;
+template 
+T* var_dependent = nullptr;
+
+int* int_ptr_;
+  )cpp");
+
+  auto IntPtrTy = *OpaqueType::fromType(ASTCtx(), typeOf("int_ptr_"));
+  EXPECT_EQ(fromCompletionResult(decl("returns_not_dependent")), IntPtrTy);
+  EXPECT_EQ(fromCompletionResult(decl("returns_dependent")), llvm::None);
+
+  EXPECT_EQ(fromCompletionResult(decl("var_not_dependent")), IntPtrTy);
+  EXPECT_EQ(fromCompletionResult(decl("var_dependent")), llvm::None);
+}
+
 } // namespace
 } // namespace clangd
 } // namespace clang


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


[PATCH] D62515: [clangd] Compute expected type for templates

2019-05-28 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rCTE361823: [clangd] Compute expected type for templates 
(authored by ibiryukov, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D62515?vs=201632&id=201656#toc

Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D62515

Files:
  clangd/ExpectedTypes.cpp
  clangd/unittests/ExpectedTypeTest.cpp


Index: clangd/ExpectedTypes.cpp
===
--- clangd/ExpectedTypes.cpp
+++ clangd/ExpectedTypes.cpp
@@ -8,9 +8,11 @@
 
 #include "ExpectedTypes.h"
 #include "clang/AST/ASTContext.h"
+#include "clang/AST/DeclTemplate.h"
 #include "clang/AST/Type.h"
 #include "clang/Index/USRGeneration.h"
 #include "clang/Sema/CodeCompleteConsumer.h"
+#include "llvm/ADT/None.h"
 #include "llvm/ADT/STLExtras.h"
 
 namespace clang {
@@ -41,7 +43,13 @@
 
 static llvm::Optional
 typeOfCompletion(const CodeCompletionResult &R) {
-  auto *VD = dyn_cast_or_null(R.Declaration);
+  const NamedDecl *D = R.Declaration;
+  if (!D)
+return llvm::None;
+  // Templates do not have a type on their own, look at the templated decl.
+  if (auto *Template = dyn_cast(D))
+D = Template->getTemplatedDecl();
+  auto *VD = dyn_cast(D);
   if (!VD)
 return llvm::None; // We handle only variables and functions below.
   auto T = VD->getType();
Index: clangd/unittests/ExpectedTypeTest.cpp
===
--- clangd/unittests/ExpectedTypeTest.cpp
+++ clangd/unittests/ExpectedTypeTest.cpp
@@ -11,6 +11,7 @@
 #include "TestTU.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Decl.h"
+#include "llvm/ADT/None.h"
 #include "llvm/ADT/StringRef.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
@@ -31,16 +32,14 @@
 AST = TestTU::withCode(Code).build();
   }
 
-  const ValueDecl *decl(llvm::StringRef Name) {
-return &cast(findDecl(*AST, Name));
-  }
+  const NamedDecl *decl(llvm::StringRef Name) { return &findDecl(*AST, Name); }
 
   QualType typeOf(llvm::StringRef Name) {
-return decl(Name)->getType().getCanonicalType();
+return cast(decl(Name))->getType().getCanonicalType();
   }
 
   /// An overload for convenience.
-  llvm::Optional fromCompletionResult(const ValueDecl *D) {
+  llvm::Optional fromCompletionResult(const NamedDecl *D) {
 return OpaqueType::fromCompletionResult(
 ASTCtx(), CodeCompletionResult(D, CCP_Declaration));
   }
@@ -148,6 +147,29 @@
   EXPECT_EQ(fromCompletionResult(decl("returns_ptr")), IntPtrTy);
 }
 
+TEST_F(ExpectedTypeConversionTest, Templates) {
+  build(R"cpp(
+template 
+int* returns_not_dependent();
+template 
+T* returns_dependent();
+
+template 
+int* var_not_dependent = nullptr;
+template 
+T* var_dependent = nullptr;
+
+int* int_ptr_;
+  )cpp");
+
+  auto IntPtrTy = *OpaqueType::fromType(ASTCtx(), typeOf("int_ptr_"));
+  EXPECT_EQ(fromCompletionResult(decl("returns_not_dependent")), IntPtrTy);
+  EXPECT_EQ(fromCompletionResult(decl("returns_dependent")), llvm::None);
+
+  EXPECT_EQ(fromCompletionResult(decl("var_not_dependent")), IntPtrTy);
+  EXPECT_EQ(fromCompletionResult(decl("var_dependent")), llvm::None);
+}
+
 } // namespace
 } // namespace clangd
 } // namespace clang


Index: clangd/ExpectedTypes.cpp
===
--- clangd/ExpectedTypes.cpp
+++ clangd/ExpectedTypes.cpp
@@ -8,9 +8,11 @@
 
 #include "ExpectedTypes.h"
 #include "clang/AST/ASTContext.h"
+#include "clang/AST/DeclTemplate.h"
 #include "clang/AST/Type.h"
 #include "clang/Index/USRGeneration.h"
 #include "clang/Sema/CodeCompleteConsumer.h"
+#include "llvm/ADT/None.h"
 #include "llvm/ADT/STLExtras.h"
 
 namespace clang {
@@ -41,7 +43,13 @@
 
 static llvm::Optional
 typeOfCompletion(const CodeCompletionResult &R) {
-  auto *VD = dyn_cast_or_null(R.Declaration);
+  const NamedDecl *D = R.Declaration;
+  if (!D)
+return llvm::None;
+  // Templates do not have a type on their own, look at the templated decl.
+  if (auto *Template = dyn_cast(D))
+D = Template->getTemplatedDecl();
+  auto *VD = dyn_cast(D);
   if (!VD)
 return llvm::None; // We handle only variables and functions below.
   auto T = VD->getType();
Index: clangd/unittests/ExpectedTypeTest.cpp
===
--- clangd/unittests/ExpectedTypeTest.cpp
+++ clangd/unittests/ExpectedTypeTest.cpp
@@ -11,6 +11,7 @@
 #include "TestTU.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Decl.h"
+#include "llvm/ADT/None.h"
 #include "llvm/ADT/StringRef.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
@@ -31,16 +32,14 @@
 AST = TestTU::withCode(Code).build();
   }
 
-  const ValueDecl *decl(llvm::StringRef Name) {
-return &cast(findDecl(*AST, Name));
-  }
+  const NamedDecl *decl(llvm::StringRef Name) { return &findDecl(*AST, Name); }

[PATCH] D62523: Add release note entries for recent typo correction changes

2019-05-28 Thread Nico Weber via Phabricator via cfe-commits
thakis created this revision.
thakis added a reviewer: hans.
Herald added a project: LLVM.

https://reviews.llvm.org/D62523

Files:
  clang/docs/ReleaseNotes.rst
  lld/docs/ReleaseNotes.rst


Index: lld/docs/ReleaseNotes.rst
===
--- lld/docs/ReleaseNotes.rst
+++ lld/docs/ReleaseNotes.rst
@@ -24,11 +24,17 @@
 ELF Improvements
 
 
+* ld.lld now has typo suggestions for flags:
+  ``$ ld.lld --call-shared`` now prints
+  ``unknown argument '--call-shared', did you mean '--call_shared'``.
+
 * ...
 
 COFF Improvements
 -
 
+* Like the ELF driver, lld-link now has typo suggestions for flags.
+
 * lld-link now correctly reports duplicate symbol errors for obj files
   that were compiled with /Gy.
 
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -75,7 +75,7 @@
 Modified Compiler Flags
 ---
 
-- `clang -dumpversion` now returns the version of Clang itself.
+- ``clang -dumpversion`` now returns the version of Clang itself.
 
 - ...
 
@@ -92,7 +92,10 @@
 Windows Support
 ---
 
-- ...
+- clang-cl now treats non-existent files as possible typos for flags,
+  ``clang-cl /diagnostic:caret /c test.cc`` for example now produces
+  ``clang: error: no such file or directory: '/diagnostic:caret'; did you mean 
'/diagnostics:caret'?``
+
 
 
 C Language Changes in Clang


Index: lld/docs/ReleaseNotes.rst
===
--- lld/docs/ReleaseNotes.rst
+++ lld/docs/ReleaseNotes.rst
@@ -24,11 +24,17 @@
 ELF Improvements
 
 
+* ld.lld now has typo suggestions for flags:
+  ``$ ld.lld --call-shared`` now prints
+  ``unknown argument '--call-shared', did you mean '--call_shared'``.
+
 * ...
 
 COFF Improvements
 -
 
+* Like the ELF driver, lld-link now has typo suggestions for flags.
+
 * lld-link now correctly reports duplicate symbol errors for obj files
   that were compiled with /Gy.
 
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -75,7 +75,7 @@
 Modified Compiler Flags
 ---
 
-- `clang -dumpversion` now returns the version of Clang itself.
+- ``clang -dumpversion`` now returns the version of Clang itself.
 
 - ...
 
@@ -92,7 +92,10 @@
 Windows Support
 ---
 
-- ...
+- clang-cl now treats non-existent files as possible typos for flags,
+  ``clang-cl /diagnostic:caret /c test.cc`` for example now produces
+  ``clang: error: no such file or directory: '/diagnostic:caret'; did you mean '/diagnostics:caret'?``
+
 
 
 C Language Changes in Clang
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r361824 - Add release note entries for recent typo correction changes

2019-05-28 Thread Nico Weber via cfe-commits
Author: nico
Date: Tue May 28 07:04:48 2019
New Revision: 361824

URL: http://llvm.org/viewvc/llvm-project?rev=361824&view=rev
Log:
Add release note entries for recent typo correction changes

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

Modified:
cfe/trunk/docs/ReleaseNotes.rst

Modified: cfe/trunk/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=361824&r1=361823&r2=361824&view=diff
==
--- cfe/trunk/docs/ReleaseNotes.rst (original)
+++ cfe/trunk/docs/ReleaseNotes.rst Tue May 28 07:04:48 2019
@@ -75,7 +75,7 @@ future versions of Clang.
 Modified Compiler Flags
 ---
 
-- `clang -dumpversion` now returns the version of Clang itself.
+- ``clang -dumpversion`` now returns the version of Clang itself.
 
 - ...
 
@@ -92,7 +92,10 @@ Attribute Changes in Clang
 Windows Support
 ---
 
-- ...
+- clang-cl now treats non-existent files as possible typos for flags,
+  ``clang-cl /diagnostic:caret /c test.cc`` for example now produces
+  ``clang: error: no such file or directory: '/diagnostic:caret'; did you mean 
'/diagnostics:caret'?``
+
 
 
 C Language Changes in Clang


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


[PATCH] D60691: [ARM] Replace fp-only-sp and d16 with fp64 and d32.

2019-05-28 Thread Simon Tatham via Phabricator via cfe-commits
simon_tatham marked 4 inline comments as done.
simon_tatham added inline comments.



Comment at: llvm/lib/Target/ARM/ARMSubtarget.h:587
 
   bool hasVFP2() const { return HasVFPv2; }
   bool hasVFP3() const { return HasVFPv3; }

ostannard wrote:
> Are the old functions still used anywhere? If they are not used (much), I 
> think it would be better to just have one set of functions for the base FPU 
> version, and check hasFP64 and hasD32 where needed, to avoid the rick of 
> using the wrong version of these functions.
Indeed, it turned out the old functions weren't used anywhere at all.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D60691



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


[PATCH] D62523: Add release note entries for recent typo correction changes

2019-05-28 Thread Hans Wennborg via Phabricator via cfe-commits
hans accepted this revision.
hans added a comment.
This revision is now accepted and ready to land.

Looks great, thanks!


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

https://reviews.llvm.org/D62523



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


[PATCH] D62523: Add release note entries for recent typo correction changes

2019-05-28 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD361824: Add release note entries for recent typo 
correction changes (authored by nico, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D62523?vs=201657&id=201659#toc

Repository:
  rLLD LLVM Linker

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

https://reviews.llvm.org/D62523

Files:
  docs/ReleaseNotes.rst


Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -24,11 +24,17 @@
 ELF Improvements
 
 
+* ld.lld now has typo suggestions for flags:
+  ``$ ld.lld --call-shared`` now prints
+  ``unknown argument '--call-shared', did you mean '--call_shared'``.
+
 * ...
 
 COFF Improvements
 -
 
+* Like the ELF driver, lld-link now has typo suggestions for flags.
+
 * lld-link now correctly reports duplicate symbol errors for obj files
   that were compiled with /Gy.
 


Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -24,11 +24,17 @@
 ELF Improvements
 
 
+* ld.lld now has typo suggestions for flags:
+  ``$ ld.lld --call-shared`` now prints
+  ``unknown argument '--call-shared', did you mean '--call_shared'``.
+
 * ...
 
 COFF Improvements
 -
 
+* Like the ELF driver, lld-link now has typo suggestions for flags.
+
 * lld-link now correctly reports duplicate symbol errors for obj files
   that were compiled with /Gy.
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D61989: [clang-tidy] enable modernize-concat-nested-namespaces on header files

2019-05-28 Thread Xiao Shi via Phabricator via cfe-commits
shixiao marked 2 inline comments as done.
shixiao added a comment.

> Could you please run this check over LLVM and give a short report of your 
> finding? I would imagine that there is a lot of duplication, given the 
> include-heavy nature of big c++ code bases.

Sure. I'll run it and report back. By "a lot of duplication", do you mean 
duplication across multiple translation units (since the same header would be 
included in many TUs)? Not knowing when and how `XXXCheck::check()` is invoked, 
I'd expect this to be a problem on any check that reports diagnostics in header 
files, right?




Comment at: 
clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.cpp:70
+  if (!utils::parseHeaderFileExtensions(RawStringHeaderFileExtensions,
+HeaderFileExtensions, ','))
+llvm::errs() << "Invalid header file extension: "

JonasToth wrote:
> Can we use the semicolon instead for the options list? Other options in 
> checks use that character for separating lists instead and I would like to go 
> for consistency.
> 
> What happens for the error case here? Is the default list used?
@JonasToth, I followed the `HeaderFileExtensions` options for 
`misc-definitions-in-headers`, `google-build-namespaces`, and 
`google-global-names-in-headers` checks. (They have different defaults... but 
the format is the same). I thought consistency with the same option in other 
checks would be preferable and less confusing.

---

Currently, the error case results in using an empty list as header extensions. 
I could change it to use the default list if you prefer.



Comment at: clang-tools-extra/docs/ReleaseNotes.rst:143
+  ` now supports
+  `HeaderFileExtensions` option and issues warnings for transitively included
+  header files that passes the header filter.

JonasToth wrote:
> I think the sentence is a bit off.
> 
> - `now supports _the_ ...`
> - `header files that _pass_ the header filter`
Ah, thanks! I'll make corresponding edits here and above.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61989



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


[PATCH] D60691: [ARM] Replace fp-only-sp and d16 with fp64 and d32.

2019-05-28 Thread Sjoerd Meijer via Phabricator via cfe-commits
SjoerdMeijer accepted this revision.
SjoerdMeijer added a comment.
This revision is now accepted and ready to land.

There already was consensus that this is was a good change, and also that we 
don't care about auto-upgrading. With the last minor comments addressed, this 
looks good I think. Perhaps you can wait with committing until tomorrow morning 
just in case there are more comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D60691



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


[PATCH] D62524: [clang-tidy] Fix description for misc-definitions-in-headers.

2019-05-28 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision.
hokein added a reviewer: gribozavr.
Herald added a subscriber: xazax.hun.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62524

Files:
  clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
  clang-tools-extra/test/clang-tidy/misc-definitions-in-headers.hpp


Index: clang-tools-extra/test/clang-tidy/misc-definitions-in-headers.hpp
===
--- clang-tools-extra/test/clang-tidy/misc-definitions-in-headers.hpp
+++ clang-tools-extra/test/clang-tidy/misc-definitions-in-headers.hpp
@@ -2,6 +2,7 @@
 
 int f() {
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: function 'f' defined in a header 
file; function definitions in header files can lead to ODR violations 
[misc-definitions-in-headers]
+// CHECK-MESSAGES: :[[@LINE-2]]:5: note: make 'inline'
 // CHECK-FIXES: inline int f() {
   return 1;
 }
Index: clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
===
--- clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -124,13 +124,16 @@
   }
 }
 
-bool is_full_spec = FD->getTemplateSpecializationKind() != TSK_Undeclared;
+bool IsFullSpec = FD->getTemplateSpecializationKind() != TSK_Undeclared;
 diag(FD->getLocation(),
  "%select{function|full function template specialization}0 %1 defined "
  "in a header file; function definitions in header files can lead to "
  "ODR violations")
-<< is_full_spec << FD << FixItHint::CreateInsertion(
- FD->getReturnTypeSourceRange().getBegin(), "inline ");
+<< IsFullSpec << FD;
+diag(FD->getLocation(), /*FixDescription=*/"make 'inline'",
+ DiagnosticIDs::Note)
+<< 
FixItHint::CreateInsertion(FD->getReturnTypeSourceRange().getBegin(),
+  "inline ");
   } else if (const auto *VD = dyn_cast(ND)) {
 // Static data members of a class template are allowed.
 if (VD->getDeclContext()->isDependentContext() && VD->isStaticDataMember())


Index: clang-tools-extra/test/clang-tidy/misc-definitions-in-headers.hpp
===
--- clang-tools-extra/test/clang-tidy/misc-definitions-in-headers.hpp
+++ clang-tools-extra/test/clang-tidy/misc-definitions-in-headers.hpp
@@ -2,6 +2,7 @@
 
 int f() {
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: function 'f' defined in a header file; function definitions in header files can lead to ODR violations [misc-definitions-in-headers]
+// CHECK-MESSAGES: :[[@LINE-2]]:5: note: make 'inline'
 // CHECK-FIXES: inline int f() {
   return 1;
 }
Index: clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
===
--- clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -124,13 +124,16 @@
   }
 }
 
-bool is_full_spec = FD->getTemplateSpecializationKind() != TSK_Undeclared;
+bool IsFullSpec = FD->getTemplateSpecializationKind() != TSK_Undeclared;
 diag(FD->getLocation(),
  "%select{function|full function template specialization}0 %1 defined "
  "in a header file; function definitions in header files can lead to "
  "ODR violations")
-<< is_full_spec << FD << FixItHint::CreateInsertion(
- FD->getReturnTypeSourceRange().getBegin(), "inline ");
+<< IsFullSpec << FD;
+diag(FD->getLocation(), /*FixDescription=*/"make 'inline'",
+ DiagnosticIDs::Note)
+<< FixItHint::CreateInsertion(FD->getReturnTypeSourceRange().getBegin(),
+  "inline ");
   } else if (const auto *VD = dyn_cast(ND)) {
 // Static data members of a class template are allowed.
 if (VD->getDeclContext()->isDependentContext() && VD->isStaticDataMember())
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D62525: [Analyzer] Add new visitor to the iterator checkers

2019-05-28 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware created this revision.
baloghadamsoftware added reviewers: NoQ, Szelethus.
baloghadamsoftware added a project: clang.
Herald added subscribers: Charusso, gamesh411, donat.nagy, mikhail.ramalho, 
a.sidorin, rnkovacs, szepet, xazax.hun, whisperity.

Iterator bugs such as dereference of out-of-range or any access of invalidated 
iterators are difficult to understand. A `BugReporterVisitor` that marks the 
place where the iterator reached to past-the-end or the first position, became 
invalidated and marks the execution path with a message about the emptiness of 
the container helps much in understanding the actual bug. It also helps 
deciding whether the finding is a true or a false positive. This patch adds 
such a visitor to the iterator checkers.


Repository:
  rC Clang

https://reviews.llvm.org/D62525

Files:
  lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
  test/Analysis/Inputs/system-header-simulator-cxx.h
  test/Analysis/diagnostics/explicit-suppression.cpp
  test/Analysis/invalidated-iterator.cpp
  test/Analysis/iterator-range.cpp

Index: test/Analysis/iterator-range.cpp
===
--- test/Analysis/iterator-range.cpp
+++ test/Analysis/iterator-range.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core,cplusplus,alpha.cplusplus.IteratorRange -analyzer-config aggressive-binary-operation-simplification=true -analyzer-config c++-container-inlining=false %s -verify
-// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core,cplusplus,alpha.cplusplus.IteratorRange -analyzer-config aggressive-binary-operation-simplification=true -analyzer-config c++-container-inlining=true -DINLINE=1 %s -verify
+// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core,cplusplus,alpha.cplusplus.IteratorRange -analyzer-config aggressive-binary-operation-simplification=true -analyzer-config c++-container-inlining=false %s -analyzer-output=text -verify
+// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core,cplusplus,alpha.cplusplus.IteratorRange -analyzer-config aggressive-binary-operation-simplification=true -analyzer-config c++-container-inlining=true -DINLINE=1 %s -analyzer-output=text -verify
 
 #include "Inputs/system-header-simulator-cxx.h"
 
@@ -22,14 +22,16 @@
 }
 
 void simple_bad_end(const std::vector &v) {
-  auto i = v.end();
+  auto i = v.end(); // expected-note{{Iterator reached the past-the-end position of the container}}
   *i; // expected-warning{{Past-the-end iterator dereferenced}}
+  // expected-note@-1{{Past-the-end iterator dereferenced}}
 }
 
 void copy(const std::vector &v) {
   auto i1 = v.end();
-  auto i2 = i1;
+  auto i2 = i1; // expected-note{{Iterator reached the past-the-end position of the container}}
   *i2; // expected-warning{{Past-the-end iterator dereferenced}}
+   // expected-note@-1{{Past-the-end iterator dereferenced}}
 }
 
 void decrease(const std::vector &v) {
@@ -47,9 +49,10 @@
 
 void copy_and_decrease2(const std::vector &v) {
   auto i1 = v.end();
-  auto i2 = i1;
+  auto i2 = i1; // expected-note{{Iterator reached the past-the-end position of the container}}
   --i1;
   *i2; // expected-warning{{Past-the-end iterator dereferenced}}
+   // expected-note@-1{{Past-the-end iterator dereferenced}}
 }
 
 void copy_and_increase1(const std::vector &v) {
@@ -64,16 +67,22 @@
   auto i1 = v.begin();
   auto i2 = i1;
   ++i1;
-  if (i2 == v.end())
+  if (i2 == v.end()) // expected-note 0-1{{Assuming the condition is true}}
+ // expected-note@-1{{Assuming the container/range is empty}}
+ // expected-note@-2{{Taking true branch}}
 *i2; // expected-warning{{Past-the-end iterator dereferenced}}
+ // expected-note@-1{{Past-the-end iterator dereferenced}}
 }
 
 void copy_and_increase3(const std::vector &v) {
   auto i1 = v.begin();
   auto i2 = i1;
   ++i1;
-  if (v.end() == i2)
+  if (v.end() == i2) // expected-note 0-1{{Assuming the condition is true}}
+ // expected-note@-1{{Assuming the container/range is empty}}
+ // expected-note@-2{{Taking true branch}}
 *i2; // expected-warning{{Past-the-end iterator dereferenced}}
+ // expected-note@-1{{Past-the-end iterator dereferenced}}
 }
 
 template 
@@ -94,8 +103,13 @@
 }
 
 void bad_non_std_find(std::vector &V, int e) {
-  auto first = nonStdFind(V.begin(), V.end(), e);
+  auto first = nonStdFind(V.begin(), V.end(), e); // expected-note{{Calling 'nonStdFind<__vector_iterator, int>'}}
+  // expected-note@-16{{Assuming the container/range is empty}}
+  // expected-note@-17{{Loop condition is false. Execution continues on line}}
+  // expected-note@-13{{Iterator reached the past-the-end position of the container}}
+  // expected-note@

[PATCH] D62523: Add release note entries for recent typo correction changes

2019-05-28 Thread Rui Ueyama via Phabricator via cfe-commits
ruiu added a comment.

LGTM


Repository:
  rLLD LLVM Linker

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

https://reviews.llvm.org/D62523



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


[PATCH] D61742: [Driver][Windows] Add dependent lib argument for profile instr generate

2019-05-28 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

After some more reading, it looks like passing `-no-canonical-prefixes` makes 
this path relative, and as long as compiles and links run from the same CWD 
things will work and be path-independent. So I think this is all good. Sorry 
about the false alarm! (Maybe we should have a test that 
fprofile-instr-generate + no-canonical-prefixes doesn't generate an absolute 
path?)


Repository:
  rC Clang

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

https://reviews.llvm.org/D61742



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


[PATCH] D62524: [clang-tidy] Fix description for misc-definitions-in-headers.

2019-05-28 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr accepted this revision.
gribozavr added inline comments.
This revision is now accepted and ready to land.



Comment at: clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp:133
+<< IsFullSpec << FD;
+diag(FD->getLocation(), /*FixDescription=*/"make 'inline'",
+ DiagnosticIDs::Note)

"mark as inline"?

IDK, "make inline" does not read right to me.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62524



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


r361829 - [CodeComplete] Consistently break after '{' in multi-line patterns

2019-05-28 Thread Ilya Biryukov via cfe-commits
Author: ibiryukov
Date: Tue May 28 07:33:16 2019
New Revision: 361829

URL: http://llvm.org/viewvc/llvm-project?rev=361829&view=rev
Log:
[CodeComplete] Consistently break after '{' in multi-line patterns

Summary:
Completion can return multi-line patterns in some cases, e.g.

for (<#init#>; <#cond#>; <#inc#>) {
<#body#>
}

However, most patterns break the line only before closing brace,
resulting in code like:

namespace <#name#> { <#decls#>
}

While some (e.g. the 'for' example above) are breaking lines after the
opening brace too.

This change ensures all patterns consistently break after the opening
brace, this leads to nicer UX when using those in an actual editor.

Reviewers: gribozavr

Reviewed By: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

Modified:
cfe/trunk/lib/Sema/SemaCodeComplete.cpp
cfe/trunk/test/CodeCompletion/ordinary-name-cxx11.cpp
cfe/trunk/test/CodeCompletion/ordinary-name.cpp

Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=361829&r1=361828&r2=361829&view=diff
==
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Tue May 28 07:33:16 2019
@@ -1899,6 +1899,7 @@ static void AddOrdinaryNameResults(Sema:
 Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace);
 Builder.AddPlaceholderChunk("identifier");
 Builder.AddChunk(CodeCompletionString::CK_LeftBrace);
+Builder.AddChunk(CodeCompletionString::CK_VerticalSpace);
 Builder.AddPlaceholderChunk("declarations");
 Builder.AddChunk(CodeCompletionString::CK_VerticalSpace);
 Builder.AddChunk(CodeCompletionString::CK_RightBrace);
@@ -2046,6 +2047,7 @@ static void AddOrdinaryNameResults(Sema:
 SemaRef.getLangOpts().CXXExceptions) {
   Builder.AddTypedTextChunk("try");
   Builder.AddChunk(CodeCompletionString::CK_LeftBrace);
+  Builder.AddChunk(CodeCompletionString::CK_VerticalSpace);
   Builder.AddPlaceholderChunk("statements");
   Builder.AddChunk(CodeCompletionString::CK_VerticalSpace);
   Builder.AddChunk(CodeCompletionString::CK_RightBrace);
@@ -2054,6 +2056,7 @@ static void AddOrdinaryNameResults(Sema:
   Builder.AddPlaceholderChunk("declaration");
   Builder.AddChunk(CodeCompletionString::CK_RightParen);
   Builder.AddChunk(CodeCompletionString::CK_LeftBrace);
+  Builder.AddChunk(CodeCompletionString::CK_VerticalSpace);
   Builder.AddPlaceholderChunk("statements");
   Builder.AddChunk(CodeCompletionString::CK_VerticalSpace);
   Builder.AddChunk(CodeCompletionString::CK_RightBrace);
@@ -2072,6 +2075,7 @@ static void AddOrdinaryNameResults(Sema:
 Builder.AddPlaceholderChunk("expression");
   Builder.AddChunk(CodeCompletionString::CK_RightParen);
   Builder.AddChunk(CodeCompletionString::CK_LeftBrace);
+  Builder.AddChunk(CodeCompletionString::CK_VerticalSpace);
   Builder.AddPlaceholderChunk("statements");
   Builder.AddChunk(CodeCompletionString::CK_VerticalSpace);
   Builder.AddChunk(CodeCompletionString::CK_RightBrace);
@@ -2087,6 +2091,8 @@ static void AddOrdinaryNameResults(Sema:
   Builder.AddChunk(CodeCompletionString::CK_RightParen);
   Builder.AddChunk(CodeCompletionString::CK_LeftBrace);
   Builder.AddChunk(CodeCompletionString::CK_VerticalSpace);
+  Builder.AddPlaceholderChunk("cases");
+  Builder.AddChunk(CodeCompletionString::CK_VerticalSpace);
   Builder.AddChunk(CodeCompletionString::CK_RightBrace);
   Results.AddResult(Result(Builder.TakeString()));
 }
@@ -2117,6 +2123,7 @@ static void AddOrdinaryNameResults(Sema:
 Builder.AddPlaceholderChunk("expression");
   Builder.AddChunk(CodeCompletionString::CK_RightParen);
   Builder.AddChunk(CodeCompletionString::CK_LeftBrace);
+  Builder.AddChunk(CodeCompletionString::CK_VerticalSpace);
   Builder.AddPlaceholderChunk("statements");
   Builder.AddChunk(CodeCompletionString::CK_VerticalSpace);
   Builder.AddChunk(CodeCompletionString::CK_RightBrace);
@@ -2125,6 +2132,7 @@ static void AddOrdinaryNameResults(Sema:
   // do { statements } while ( expression );
   Builder.AddTypedTextChunk("do");
   Builder.AddChunk(CodeCompletionString::CK_LeftBrace);
+  Builder.AddChunk(CodeCompletionString::CK_VerticalSpace);
   Builder.AddPlaceholderChunk("statements");
   Builder.AddChunk(CodeCompletionString::CK_VerticalSpace);
   Builder.AddChunk(CodeCompletionString::CK_RightBrace);

Modified: cfe/trunk/test/CodeCompletion/ordinary-name-cxx11.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeCompletion/ordinary-name-cxx11.cpp?rev=361829&r1=361828&r2=361829&view=diff
==
-

[PATCH] D62405: [CodeComplete] Consistently break after '{' in multi-line patterns

2019-05-28 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC361829: [CodeComplete] Consistently break after 
'{' in multi-line patterns (authored by ibiryukov, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D62405?vs=201274&id=201666#toc

Repository:
  rC Clang

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

https://reviews.llvm.org/D62405

Files:
  lib/Sema/SemaCodeComplete.cpp
  test/CodeCompletion/ordinary-name-cxx11.cpp
  test/CodeCompletion/ordinary-name.cpp

Index: test/CodeCompletion/ordinary-name-cxx11.cpp
===
--- test/CodeCompletion/ordinary-name-cxx11.cpp
+++ test/CodeCompletion/ordinary-name-cxx11.cpp
@@ -14,7 +14,9 @@
   // CHECK-CC1-NEXT: COMPLETION: Pattern : const_cast<<#type#>>(<#expression#>)
   // CHECK-CC1: COMPLETION: Pattern : [#void#]delete <#expression#>
   // CHECK-CC1-NEXT: COMPLETION: Pattern : [#void#]delete [] <#expression#>
-  // CHECK-CC1-NEXT: COMPLETION: Pattern : do{<#statements#>
+  // CHECK-CC1-NEXT: COMPLETION: Pattern : do{
+  // CHECK-CC1-NEXT: <#statements#>
+  // CHECK-CC1-NEXT: }
   // CHECK-CC1: COMPLETION: double
   // CHECK-CC1-NEXT: COMPLETION: Pattern : dynamic_cast<<#type#>>(<#expression#>)
   // CHECK-CC1-NEXT: COMPLETION: enum
@@ -24,7 +26,9 @@
   // CHECK-CC1-NEXT: COMPLETION: foo : [#void#]foo()
   // CHECK-CC1-NEXT: COMPLETION: Pattern : for(<#init-statement#>;<#condition#>;<#inc-expression#>){
   // CHECK-CC1: COMPLETION: Pattern : goto <#label#>;
-  // CHECK-CC1-NEXT: COMPLETION: Pattern : if(<#condition#>){<#statements#>
+  // CHECK-CC1-NEXT: COMPLETION: Pattern : if(<#condition#>){
+  // CHECK-CC1-NEXT: <#statements#>
+  // CHECK-CC1-NEXT: }
   // CHECK-CC1: COMPLETION: int
   // CHECK-CC1-NEXT: COMPLETION: long
   // CHECK-CC1-NEXT: COMPLETION: Pattern : new <#type#>(<#expressions#>)
@@ -47,7 +51,9 @@
   // CHECK-CC1-NEXT: COMPLETION: thread_local
   // CHECK-CC1-NEXT: COMPLETION: Pattern : [#void#]throw <#expression#>
   // CHECK-CC1-NEXT: COMPLETION: Pattern : [#bool#]true
-  // CHECK-CC1-NEXT: COMPLETION: Pattern : try{<#statements#>
+  // CHECK-CC1-NEXT: COMPLETION: Pattern : try{
+  // CHECK-CC1-NEXT: <#statements#>
+  // CHECK-CC1-NEXT: }
   // CHECK-CC1: COMPLETION: TYPEDEF : TYPEDEF
   // CHECK-CC1-NEXT: COMPLETION: Pattern : typedef <#type#> <#name#>
   // CHECK-CC1-NEXT: COMPLETION: Pattern : [#std::type_info#]typeid(<#expression-or-type#>)
@@ -60,7 +66,9 @@
   // CHECK-CC1-NEXT: COMPLETION: void
   // CHECK-CC1-NEXT: COMPLETION: volatile
   // CHECK-CC1-NEXT: COMPLETION: wchar_t
-  // CHECK-CC1-NEXT: COMPLETION: Pattern : while(<#condition#>){<#statements#>
+  // CHECK-CC1-NEXT: COMPLETION: Pattern : while(<#condition#>){
+  // CHECK-CC1-NEXT: <#statements#>
+  // CHECK-CC1-NEXT: }
   // CHECK-CC1: COMPLETION: X : X
   // CHECK-CC1-NEXT: COMPLETION: y : [#int#]y
   // CHECK-CC1-NEXT: COMPLETION: z : [#void#]z(<#int#>)
@@ -83,7 +91,9 @@
   // CHECK-CC2-NEXT: COMPLETION: inline
   // CHECK-CC2-NEXT: COMPLETION: int
   // CHECK-CC2-NEXT: COMPLETION: long
-  // CHECK-CC2-NEXT: COMPLETION: Pattern : namespace <#identifier#>{<#declarations#>
+  // CHECK-CC2-NEXT: COMPLETION: Pattern : namespace <#identifier#>{
+  // CHECK-CC2-NEXT: <#declarations#>
+  // CHECK-CC2-NEXT: }
   // CHECK-CC2: COMPLETION: Pattern : namespace <#name#> = <#namespace#>;
   // CHECK-CC2-NEXT: COMPLETION: operator
   // CHECK-CC2-NEXT: COMPLETION: short
@@ -209,7 +219,9 @@
   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : const_cast<<#type#>>(<#expression#>)
   // CHECK-NO-RTTI: COMPLETION: Pattern : [#void#]delete <#expression#>
   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : [#void#]delete [] <#expression#>
-  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : do{<#statements#>
+  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : do{
+  // CHECK-NO-RTTI-NEXT: <#statements#>
+  // CHECK-NO-RTTI-NEXT: }
   // CHECK-NO-RTTI: COMPLETION: double
   // CHECK-NO-RTTI-NOT: dynamic_cast
   // CHECK-NO-RTTI: COMPLETION: enum
@@ -219,7 +231,9 @@
   // CHECK-NO-RTTI-NEXT: COMPLETION: foo : [#void#]foo()
   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : for(<#init-statement#>;<#condition#>;<#inc-expression#>){
   // CHECK-NO-RTTI: COMPLETION: Pattern : goto <#label#>;
-  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : if(<#condition#>){<#statements#>
+  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : if(<#condition#>){
+  // CHECK-NO-RTTI-NEXT: <#statements#>
+  // CHECK-NO-RTTI-NEXT: }
   // CHECK-NO-RTTI: COMPLETION: int
   // CHECK-NO-RTTI-NEXT: COMPLETION: long
   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : new <#type#>(<#expressions#>)
@@ -254,7 +268,7 @@
   // CHECK-NO-RTTI-NEXT: COMPLETION: void
   // CHECK-NO-RTTI-NEXT: COMPLETION: volatile
   // CHECK-NO-RTTI-NEXT: COMPLETION: wchar_t
-  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : while(<#condition#>){<#statements#>
+  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : while(<#condition#>){
   // CHECK-NO-RTTI: C

[PATCH] D62514: [CodeComplete] Set preferred type for qualified-id

2019-05-28 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment.

In D62514#1518941 , @kadircet wrote:

> thanks, lgtm.
>
> one irrelevant question though, it looks like most of the calls to 
> `ResultBuilder::setPreferredType` performs a `!isNull` check before hand. 
> should we perform this check implicitly and make the `setPreferredType` no-op 
> in case of a null type?


I don't see any reason why not, that could save some typing.
Better yet, we might be able to remove it altogether. Preferred type is also 
stored in completion context and I'm not sure whether it's ever different from 
the one in `ResultBuilder`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62514



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


[PATCH] D62527: [clangd] Remove the whitelist std symbols in CanonicalIncludes.

2019-05-28 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision.
hokein added a reviewer: sammccall.
Herald added subscribers: kadircet, arphaman, jkorous, MaskRay, ilya-biryukov.
Herald added a project: clang.

These symbols have been included via StdSymbolMap.inc.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62527

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


Index: clang-tools-extra/clangd/index/CanonicalIncludes.cpp
===
--- clang-tools-extra/clangd/index/CanonicalIncludes.cpp
+++ clang-tools-extra/clangd/index/CanonicalIncludes.cpp
@@ -88,16 +88,6 @@
 
 void addSystemHeadersMapping(CanonicalIncludes *Includes) {
   static const std::vector> SymbolMap = {
-  // Map symbols in  to their preferred includes.
-  {"std::basic_filebuf", ""},
-  {"std::filebuf", ""},
-  {"std::wfilebuf", ""},
-  {"std::basic_istream", ""},
-  {"std::istream", ""},
-  {"std::wistream", ""},
-  {"std::basic_ostream", ""},
-  {"std::ostream", ""},
-  {"std::wostream", ""},
   {"std::uint_least16_t", ""}, //  redeclares these
   {"std::uint_least32_t", ""},
 #define SYMBOL(Name, NameSpace, Header) { #NameSpace#Name, #Header },
@@ -110,8 +100,6 @@
   // FIXME: remove the std header mapping once we support ambiguous symbols, 
now
   // it serves as a fallback to disambiguate:
   //   - symbols with mulitiple headers (e.g. std::move)
-  //   - symbols with a primary template in one header and a specialization in
-  // another (std::abs)
   static const std::vector>
   SystemHeaderMap = {
   {"include/__stddef_max_align_t.h", ""},


Index: clang-tools-extra/clangd/index/CanonicalIncludes.cpp
===
--- clang-tools-extra/clangd/index/CanonicalIncludes.cpp
+++ clang-tools-extra/clangd/index/CanonicalIncludes.cpp
@@ -88,16 +88,6 @@
 
 void addSystemHeadersMapping(CanonicalIncludes *Includes) {
   static const std::vector> SymbolMap = {
-  // Map symbols in  to their preferred includes.
-  {"std::basic_filebuf", ""},
-  {"std::filebuf", ""},
-  {"std::wfilebuf", ""},
-  {"std::basic_istream", ""},
-  {"std::istream", ""},
-  {"std::wistream", ""},
-  {"std::basic_ostream", ""},
-  {"std::ostream", ""},
-  {"std::wostream", ""},
   {"std::uint_least16_t", ""}, //  redeclares these
   {"std::uint_least32_t", ""},
 #define SYMBOL(Name, NameSpace, Header) { #NameSpace#Name, #Header },
@@ -110,8 +100,6 @@
   // FIXME: remove the std header mapping once we support ambiguous symbols, now
   // it serves as a fallback to disambiguate:
   //   - symbols with mulitiple headers (e.g. std::move)
-  //   - symbols with a primary template in one header and a specialization in
-  // another (std::abs)
   static const std::vector>
   SystemHeaderMap = {
   {"include/__stddef_max_align_t.h", ""},
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r361833 - [clang-tidy] Verify fix description for misc-unused-using-decl.

2019-05-28 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Tue May 28 07:47:39 2019
New Revision: 361833

URL: http://llvm.org/viewvc/llvm-project?rev=361833&view=rev
Log:
[clang-tidy] Verify fix description for misc-unused-using-decl.

Reviewers: gribozavr

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

Modified:
clang-tools-extra/trunk/test/clang-tidy/misc-unused-using-decls.cpp

Modified: clang-tools-extra/trunk/test/clang-tidy/misc-unused-using-decls.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/misc-unused-using-decls.cpp?rev=361833&r1=361832&r2=361833&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/misc-unused-using-decls.cpp 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/misc-unused-using-decls.cpp Tue May 
28 07:47:39 2019
@@ -79,6 +79,7 @@ T ff() { T t; return t; }
 // eol-comments aren't removed (yet)
 using n::A; // A
 // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: using decl 'A' is unused
+// CHECK-MESSAGES: :[[@LINE-2]]:10: note: remove the using
 // CHECK-FIXES: {{^}}// A
 using n::B;
 using n::C;


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


[PATCH] D61467: [Rewrite] Extend to further accept CharSourceRange

2019-05-28 Thread Joel E. Denny via Phabricator via cfe-commits
jdenny added a comment.

Ping.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61467



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


[PATCH] D59407: [clangd] Add RelationSlab

2019-05-28 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added a comment.

btw, I believe you have enough good quality patches to apply for commit access.

Are there any obstacles that is keeping you from applying?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59407



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


[PATCH] D62522: [clang-tidy] Verify fix description for misc-unused-using-decl.

2019-05-28 Thread Haojian Wu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rCTE361833: [clang-tidy] Verify fix description for 
misc-unused-using-decl. (authored by hokein, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D62522?vs=201654&id=201669#toc

Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D62522

Files:
  test/clang-tidy/misc-unused-using-decls.cpp


Index: test/clang-tidy/misc-unused-using-decls.cpp
===
--- test/clang-tidy/misc-unused-using-decls.cpp
+++ test/clang-tidy/misc-unused-using-decls.cpp
@@ -79,6 +79,7 @@
 // eol-comments aren't removed (yet)
 using n::A; // A
 // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: using decl 'A' is unused
+// CHECK-MESSAGES: :[[@LINE-2]]:10: note: remove the using
 // CHECK-FIXES: {{^}}// A
 using n::B;
 using n::C;


Index: test/clang-tidy/misc-unused-using-decls.cpp
===
--- test/clang-tidy/misc-unused-using-decls.cpp
+++ test/clang-tidy/misc-unused-using-decls.cpp
@@ -79,6 +79,7 @@
 // eol-comments aren't removed (yet)
 using n::A; // A
 // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: using decl 'A' is unused
+// CHECK-MESSAGES: :[[@LINE-2]]:10: note: remove the using
 // CHECK-FIXES: {{^}}// A
 using n::B;
 using n::C;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D62524: [clang-tidy] Fix description for misc-definitions-in-headers.

2019-05-28 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 201670.
hokein marked an inline comment as done.
hokein added a comment.

Address comment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62524

Files:
  clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
  clang-tools-extra/test/clang-tidy/misc-definitions-in-headers.hpp


Index: clang-tools-extra/test/clang-tidy/misc-definitions-in-headers.hpp
===
--- clang-tools-extra/test/clang-tidy/misc-definitions-in-headers.hpp
+++ clang-tools-extra/test/clang-tidy/misc-definitions-in-headers.hpp
@@ -2,6 +2,7 @@
 
 int f() {
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: function 'f' defined in a header 
file; function definitions in header files can lead to ODR violations 
[misc-definitions-in-headers]
+// CHECK-MESSAGES: :[[@LINE-2]]:5: note: make as 'inline'
 // CHECK-FIXES: inline int f() {
   return 1;
 }
Index: clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
===
--- clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -124,13 +124,16 @@
   }
 }
 
-bool is_full_spec = FD->getTemplateSpecializationKind() != TSK_Undeclared;
+bool IsFullSpec = FD->getTemplateSpecializationKind() != TSK_Undeclared;
 diag(FD->getLocation(),
  "%select{function|full function template specialization}0 %1 defined "
  "in a header file; function definitions in header files can lead to "
  "ODR violations")
-<< is_full_spec << FD << FixItHint::CreateInsertion(
- FD->getReturnTypeSourceRange().getBegin(), "inline ");
+<< IsFullSpec << FD;
+diag(FD->getLocation(), /*FixDescription=*/"make as 'inline'",
+ DiagnosticIDs::Note)
+<< 
FixItHint::CreateInsertion(FD->getReturnTypeSourceRange().getBegin(),
+  "inline ");
   } else if (const auto *VD = dyn_cast(ND)) {
 // Static data members of a class template are allowed.
 if (VD->getDeclContext()->isDependentContext() && VD->isStaticDataMember())


Index: clang-tools-extra/test/clang-tidy/misc-definitions-in-headers.hpp
===
--- clang-tools-extra/test/clang-tidy/misc-definitions-in-headers.hpp
+++ clang-tools-extra/test/clang-tidy/misc-definitions-in-headers.hpp
@@ -2,6 +2,7 @@
 
 int f() {
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: function 'f' defined in a header file; function definitions in header files can lead to ODR violations [misc-definitions-in-headers]
+// CHECK-MESSAGES: :[[@LINE-2]]:5: note: make as 'inline'
 // CHECK-FIXES: inline int f() {
   return 1;
 }
Index: clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
===
--- clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -124,13 +124,16 @@
   }
 }
 
-bool is_full_spec = FD->getTemplateSpecializationKind() != TSK_Undeclared;
+bool IsFullSpec = FD->getTemplateSpecializationKind() != TSK_Undeclared;
 diag(FD->getLocation(),
  "%select{function|full function template specialization}0 %1 defined "
  "in a header file; function definitions in header files can lead to "
  "ODR violations")
-<< is_full_spec << FD << FixItHint::CreateInsertion(
- FD->getReturnTypeSourceRange().getBegin(), "inline ");
+<< IsFullSpec << FD;
+diag(FD->getLocation(), /*FixDescription=*/"make as 'inline'",
+ DiagnosticIDs::Note)
+<< FixItHint::CreateInsertion(FD->getReturnTypeSourceRange().getBegin(),
+  "inline ");
   } else if (const auto *VD = dyn_cast(ND)) {
 // Static data members of a class template are allowed.
 if (VD->getDeclContext()->isDependentContext() && VD->isStaticDataMember())
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r361834 - [clang-tidy] Fix description for misc-definitions-in-headers.

2019-05-28 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Tue May 28 07:50:42 2019
New Revision: 361834

URL: http://llvm.org/viewvc/llvm-project?rev=361834&view=rev
Log:
[clang-tidy] Fix description for misc-definitions-in-headers.

Reviewers: gribozavr

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

Modified:
clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/misc-definitions-in-headers.hpp

Modified: clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp?rev=361834&r1=361833&r2=361834&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp Tue 
May 28 07:50:42 2019
@@ -124,13 +124,16 @@ void DefinitionsInHeadersCheck::check(co
   }
 }
 
-bool is_full_spec = FD->getTemplateSpecializationKind() != TSK_Undeclared;
+bool IsFullSpec = FD->getTemplateSpecializationKind() != TSK_Undeclared;
 diag(FD->getLocation(),
  "%select{function|full function template specialization}0 %1 defined "
  "in a header file; function definitions in header files can lead to "
  "ODR violations")
-<< is_full_spec << FD << FixItHint::CreateInsertion(
- FD->getReturnTypeSourceRange().getBegin(), "inline ");
+<< IsFullSpec << FD;
+diag(FD->getLocation(), /*FixDescription=*/"make as 'inline'",
+ DiagnosticIDs::Note)
+<< 
FixItHint::CreateInsertion(FD->getReturnTypeSourceRange().getBegin(),
+  "inline ");
   } else if (const auto *VD = dyn_cast(ND)) {
 // Static data members of a class template are allowed.
 if (VD->getDeclContext()->isDependentContext() && VD->isStaticDataMember())

Modified: 
clang-tools-extra/trunk/test/clang-tidy/misc-definitions-in-headers.hpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/misc-definitions-in-headers.hpp?rev=361834&r1=361833&r2=361834&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/misc-definitions-in-headers.hpp 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/misc-definitions-in-headers.hpp Tue 
May 28 07:50:42 2019
@@ -2,6 +2,7 @@
 
 int f() {
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: function 'f' defined in a header 
file; function definitions in header files can lead to ODR violations 
[misc-definitions-in-headers]
+// CHECK-MESSAGES: :[[@LINE-2]]:5: note: make as 'inline'
 // CHECK-FIXES: inline int f() {
   return 1;
 }


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


[PATCH] D62524: [clang-tidy] Fix description for misc-definitions-in-headers.

2019-05-28 Thread Haojian Wu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL361834: [clang-tidy] Fix description for 
misc-definitions-in-headers. (authored by hokein, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D62524?vs=201670&id=201674#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62524

Files:
  clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
  clang-tools-extra/trunk/test/clang-tidy/misc-definitions-in-headers.hpp


Index: clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -124,13 +124,16 @@
   }
 }
 
-bool is_full_spec = FD->getTemplateSpecializationKind() != TSK_Undeclared;
+bool IsFullSpec = FD->getTemplateSpecializationKind() != TSK_Undeclared;
 diag(FD->getLocation(),
  "%select{function|full function template specialization}0 %1 defined "
  "in a header file; function definitions in header files can lead to "
  "ODR violations")
-<< is_full_spec << FD << FixItHint::CreateInsertion(
- FD->getReturnTypeSourceRange().getBegin(), "inline ");
+<< IsFullSpec << FD;
+diag(FD->getLocation(), /*FixDescription=*/"make as 'inline'",
+ DiagnosticIDs::Note)
+<< 
FixItHint::CreateInsertion(FD->getReturnTypeSourceRange().getBegin(),
+  "inline ");
   } else if (const auto *VD = dyn_cast(ND)) {
 // Static data members of a class template are allowed.
 if (VD->getDeclContext()->isDependentContext() && VD->isStaticDataMember())
Index: clang-tools-extra/trunk/test/clang-tidy/misc-definitions-in-headers.hpp
===
--- clang-tools-extra/trunk/test/clang-tidy/misc-definitions-in-headers.hpp
+++ clang-tools-extra/trunk/test/clang-tidy/misc-definitions-in-headers.hpp
@@ -2,6 +2,7 @@
 
 int f() {
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: function 'f' defined in a header 
file; function definitions in header files can lead to ODR violations 
[misc-definitions-in-headers]
+// CHECK-MESSAGES: :[[@LINE-2]]:5: note: make as 'inline'
 // CHECK-FIXES: inline int f() {
   return 1;
 }


Index: clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -124,13 +124,16 @@
   }
 }
 
-bool is_full_spec = FD->getTemplateSpecializationKind() != TSK_Undeclared;
+bool IsFullSpec = FD->getTemplateSpecializationKind() != TSK_Undeclared;
 diag(FD->getLocation(),
  "%select{function|full function template specialization}0 %1 defined "
  "in a header file; function definitions in header files can lead to "
  "ODR violations")
-<< is_full_spec << FD << FixItHint::CreateInsertion(
- FD->getReturnTypeSourceRange().getBegin(), "inline ");
+<< IsFullSpec << FD;
+diag(FD->getLocation(), /*FixDescription=*/"make as 'inline'",
+ DiagnosticIDs::Note)
+<< FixItHint::CreateInsertion(FD->getReturnTypeSourceRange().getBegin(),
+  "inline ");
   } else if (const auto *VD = dyn_cast(ND)) {
 // Static data members of a class template are allowed.
 if (VD->getDeclContext()->isDependentContext() && VD->isStaticDataMember())
Index: clang-tools-extra/trunk/test/clang-tidy/misc-definitions-in-headers.hpp
===
--- clang-tools-extra/trunk/test/clang-tidy/misc-definitions-in-headers.hpp
+++ clang-tools-extra/trunk/test/clang-tidy/misc-definitions-in-headers.hpp
@@ -2,6 +2,7 @@
 
 int f() {
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: function 'f' defined in a header file; function definitions in header files can lead to ODR violations [misc-definitions-in-headers]
+// CHECK-MESSAGES: :[[@LINE-2]]:5: note: make as 'inline'
 // CHECK-FIXES: inline int f() {
   return 1;
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D62435: Add Attribute NoThrow as an Exception Specifier Type

2019-05-28 Thread Erich Keane via Phabricator via cfe-commits
erichkeane updated this revision to Diff 201673.
erichkeane marked 5 inline comments as done.
erichkeane added a comment.

Added warning + other comments from @aaron.ballman

The exception state was further along than I expected, so I was able to make 
the warning better than I thought!


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

https://reviews.llvm.org/D62435

Files:
  clang/include/clang-c/Index.h
  clang/include/clang/AST/Decl.h
  clang/include/clang/AST/Type.h
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/ExceptionSpecificationType.h
  clang/include/clang/Sema/DeclSpec.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/JSONNodeDumper.cpp
  clang/lib/AST/Type.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaType.cpp
  clang/test/SemaCXX/nothrow-vs-exception-specs.cpp
  clang/tools/libclang/CXType.cpp

Index: clang/tools/libclang/CXType.cpp
===
--- clang/tools/libclang/CXType.cpp
+++ clang/tools/libclang/CXType.cpp
@@ -742,6 +742,8 @@
 return CXCursor_ExceptionSpecificationKind_MSAny;
   case EST_BasicNoexcept:
 return CXCursor_ExceptionSpecificationKind_BasicNoexcept;
+  case EST_NoThrow:
+return CXCursor_ExceptionSpecificationKind_NoThrow;
   case EST_NoexceptFalse:
   case EST_NoexceptTrue:
   case EST_DependentNoexcept:
Index: clang/test/SemaCXX/nothrow-vs-exception-specs.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/nothrow-vs-exception-specs.cpp
@@ -0,0 +1,55 @@
+// RUN: %clang_cc1 %s -fcxx-exceptions -fdeclspec -fsyntax-only -Wexceptions -verify -std=c++14
+// RUN: %clang_cc1 %s -fcxx-exceptions -fdeclspec -fsyntax-only -Wexceptions -verify -std=c++17 -DCPP17
+
+__attribute__((nothrow)) void f1();
+static_assert(noexcept(f1()), "");
+void f1() noexcept;
+// expected-error@+2 {{exception specification in declaration does not match previous declaration}}
+// expected-note@-2 {{previous declaration is here}}
+void f1() noexcept(false);
+
+__attribute__((nothrow)) void f2();
+static_assert(noexcept(f2()), "");
+// expected-error@+2 {{exception specification in declaration does not match previous declaration}}
+// expected-note@-3 {{previous declaration is here}}
+void f2() noexcept(false);
+
+void f3() __attribute__((nothrow));
+static_assert(noexcept(f3()), "");
+void f3() noexcept;
+// expected-error@+2 {{exception specification in declaration does not match previous declaration}}
+// expected-note@-2 {{previous declaration is here}}
+void f3() noexcept(false);
+
+// Still noexcept due to throw()
+__attribute__((nothrow)) void f4() throw();
+static_assert(noexcept(f4()), "");
+
+// Still noexcept due to noexcept
+__attribute__((nothrow)) void f5() noexcept;
+static_assert(noexcept(f5()), "");
+
+// Still noexcept due to noexcept(true)
+__attribute__((nothrow)) void f6() noexcept(true);
+static_assert(noexcept(f6()), "");
+
+#ifndef CPP17
+// Doesn't override C++ implementation.
+// expected-warning@+1{{nothrow attribute conflicts with exception specification; attribute ignored}}
+__attribute__((nothrow)) void f7() throw(int);
+static_assert(!noexcept(f7()), "");
+#endif
+
+// Doesn't override C++ implementation.
+// expected-warning@+1{{nothrow attribute conflicts with exception specification; attribute ignored}}
+__attribute__((nothrow)) void f8() noexcept(false);
+static_assert(!noexcept(f8()), "");
+
+__declspec(nothrow) void foo1() noexcept;
+__declspec(nothrow) void foo2() noexcept(true);
+// expected-warning@+1{{nothrow attribute conflicts with exception specification; attribute ignored}}
+__declspec(nothrow) void foo3() noexcept(false);
+__declspec(nothrow) void foo4() noexcept(noexcept(foo1()));
+__declspec(nothrow) void foo5() noexcept(noexcept(foo2()));
+// expected-warning@+1{{nothrow attribute conflicts with exception specification; attribute ignored}}
+__declspec(nothrow) void foo6() noexcept(noexcept(foo3()));
Index: clang/lib/Sema/SemaType.cpp
===
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -130,6 +130,7 @@
   case ParsedAttr::AT_Regparm: \
   case ParsedAttr::AT_AnyX86NoCallerSavedRegisters:\
   case ParsedAttr::AT_AnyX86NoCfCheck: \
+  case ParsedAttr::AT_NoThrow: \
 CALLING_CONV_ATTRS_CASELIST
 
 // Microsoft-specific type qualifiers.
@@ -4516,7 +4517,7 @@
   // If the function declarator has a prototype (i.e. it is not () and
   // does not have a K&R-style identifier list), then the arguments are part
   // of the type, otherwise the argument list is ().
-  const DeclaratorChunk::FunctionTypeInfo &FTI = DeclType.Fun;
+  DeclaratorChunk::Functio

r361838 - [CodeComplete] Set preferred type for qualified-id

2019-05-28 Thread Ilya Biryukov via cfe-commits
Author: ibiryukov
Date: Tue May 28 08:21:03 2019
New Revision: 361838

URL: http://llvm.org/viewvc/llvm-project?rev=361838&view=rev
Log:
[CodeComplete] Set preferred type for qualified-id

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: cfe-commits

Tags: #clang

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

Modified:
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Parse/ParseExprCXX.cpp
cfe/trunk/lib/Sema/SemaCodeComplete.cpp
cfe/trunk/unittests/Sema/CodeCompleteTest.cpp

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=361838&r1=361837&r2=361838&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Tue May 28 08:21:03 2019
@@ -10646,8 +10646,8 @@ public:
   void CodeCompleteInitializer(Scope *S, Decl *D);
   void CodeCompleteAfterIf(Scope *S);
 
-  void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS,
-   bool EnteringContext, QualType BaseType);
+  void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS, bool 
EnteringContext,
+   QualType BaseType, QualType PreferredType);
   void CodeCompleteUsing(Scope *S);
   void CodeCompleteUsingDirective(Scope *S);
   void CodeCompleteNamespaceDecl(Scope *S);

Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=361838&r1=361837&r2=361838&view=diff
==
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Tue May 28 08:21:03 2019
@@ -232,13 +232,16 @@ bool Parser::ParseOptionalCXXScopeSpecif
 HasScopeSpecifier = true;
   }
 
+  // Preferred type might change when parsing qualifiers, we need the original.
+  auto SavedType = PreferredType;
   while (true) {
 if (HasScopeSpecifier) {
   if (Tok.is(tok::code_completion)) {
 // Code completion for a nested-name-specifier, where the code
 // completion token follows the '::'.
 Actions.CodeCompleteQualifiedId(getCurScope(), SS, EnteringContext,
-ObjectType.get());
+ObjectType.get(),
+SavedType.get(SS.getBeginLoc()));
 // Include code completion token into the range of the scope otherwise
 // when we try to annotate the scope tokens the dangling code 
completion
 // token will cause assertion in

Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=361838&r1=361837&r2=361838&view=diff
==
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Tue May 28 08:21:03 2019
@@ -5215,7 +5215,8 @@ void Sema::CodeCompleteAfterIf(Scope *S)
 }
 
 void Sema::CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS,
-   bool EnteringContext, QualType BaseType) {
+   bool EnteringContext, QualType BaseType,
+   QualType PreferredType) {
   if (SS.isEmpty() || !CodeCompleter)
 return;
 
@@ -5224,13 +5225,15 @@ void Sema::CodeCompleteQualifiedId(Scope
   // it can be useful for global code completion which have information about
   // contexts/symbols that are not in the AST.
   if (SS.isInvalid()) {
-CodeCompletionContext CC(CodeCompletionContext::CCC_Symbol);
+CodeCompletionContext CC(CodeCompletionContext::CCC_Symbol, PreferredType);
 CC.setCXXScopeSpecifier(SS);
 // As SS is invalid, we try to collect accessible contexts from the current
 // scope with a dummy lookup so that the completion consumer can try to
 // guess what the specified scope is.
 ResultBuilder DummyResults(*this, CodeCompleter->getAllocator(),
CodeCompleter->getCodeCompletionTUInfo(), CC);
+if (!PreferredType.isNull())
+  DummyResults.setPreferredType(PreferredType);
 if (S->getEntity()) {
   CodeCompletionDeclConsumer Consumer(DummyResults, S->getEntity(),
   BaseType);
@@ -5253,9 +5256,12 @@ void Sema::CodeCompleteQualifiedId(Scope
   if (!isDependentScopeSpecifier(SS) && RequireCompleteDeclContext(SS, Ctx))
 return;
 
-  ResultBuilder Results(*this, CodeCompleter->getAllocator(),
-CodeCompleter->getCodeCompletionTUInfo(),
-CodeCompletionContext::CCC_Symbol);
+  ResultBuilder Results(
+  *this, CodeCompleter->getAllocator(),
+  CodeCompleter->getCodeCompletionTUInfo(),
+  CodeCompletionContext(CodeCompletionContext::CCC_Symbol, Preferre

[PATCH] D62514: [CodeComplete] Set preferred type for qualified-id

2019-05-28 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL361838: [CodeComplete] Set preferred type for qualified-id 
(authored by ibiryukov, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D62514?vs=201629&id=201677#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62514

Files:
  cfe/trunk/include/clang/Sema/Sema.h
  cfe/trunk/lib/Parse/ParseExprCXX.cpp
  cfe/trunk/lib/Sema/SemaCodeComplete.cpp
  cfe/trunk/unittests/Sema/CodeCompleteTest.cpp

Index: cfe/trunk/unittests/Sema/CodeCompleteTest.cpp
===
--- cfe/trunk/unittests/Sema/CodeCompleteTest.cpp
+++ cfe/trunk/unittests/Sema/CodeCompleteTest.cpp
@@ -454,5 +454,31 @@
 }
   )cpp";
   EXPECT_THAT(collectPreferredTypes(Code), Each("volatile double *"));
+
+  Code = R"cpp(
+namespace ns {
+  struct vector {
+  };
+}
+void accepts_vector(ns::vector);
+
+void test() {
+  accepts_vector(^::^ns::^vector());
+}
+  )cpp";
+  EXPECT_THAT(collectPreferredTypes(Code), Each("ns::vector"));
+
+  Code = R"cpp(
+template 
+struct vector { using self = vector; };
+
+void accepts_vector(vector);
+int foo(int);
+
+void test() {
+  accepts_vector(^::^vector::^self);
+}
+  )cpp";
+  EXPECT_THAT(collectPreferredTypes(Code), Each("vector"));
 }
 } // namespace
Index: cfe/trunk/include/clang/Sema/Sema.h
===
--- cfe/trunk/include/clang/Sema/Sema.h
+++ cfe/trunk/include/clang/Sema/Sema.h
@@ -10646,8 +10646,8 @@
   void CodeCompleteInitializer(Scope *S, Decl *D);
   void CodeCompleteAfterIf(Scope *S);
 
-  void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS,
-   bool EnteringContext, QualType BaseType);
+  void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS, bool EnteringContext,
+   QualType BaseType, QualType PreferredType);
   void CodeCompleteUsing(Scope *S);
   void CodeCompleteUsingDirective(Scope *S);
   void CodeCompleteNamespaceDecl(Scope *S);
Index: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
===
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp
@@ -5215,7 +5215,8 @@
 }
 
 void Sema::CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS,
-   bool EnteringContext, QualType BaseType) {
+   bool EnteringContext, QualType BaseType,
+   QualType PreferredType) {
   if (SS.isEmpty() || !CodeCompleter)
 return;
 
@@ -5224,13 +5225,15 @@
   // it can be useful for global code completion which have information about
   // contexts/symbols that are not in the AST.
   if (SS.isInvalid()) {
-CodeCompletionContext CC(CodeCompletionContext::CCC_Symbol);
+CodeCompletionContext CC(CodeCompletionContext::CCC_Symbol, PreferredType);
 CC.setCXXScopeSpecifier(SS);
 // As SS is invalid, we try to collect accessible contexts from the current
 // scope with a dummy lookup so that the completion consumer can try to
 // guess what the specified scope is.
 ResultBuilder DummyResults(*this, CodeCompleter->getAllocator(),
CodeCompleter->getCodeCompletionTUInfo(), CC);
+if (!PreferredType.isNull())
+  DummyResults.setPreferredType(PreferredType);
 if (S->getEntity()) {
   CodeCompletionDeclConsumer Consumer(DummyResults, S->getEntity(),
   BaseType);
@@ -5253,9 +5256,12 @@
   if (!isDependentScopeSpecifier(SS) && RequireCompleteDeclContext(SS, Ctx))
 return;
 
-  ResultBuilder Results(*this, CodeCompleter->getAllocator(),
-CodeCompleter->getCodeCompletionTUInfo(),
-CodeCompletionContext::CCC_Symbol);
+  ResultBuilder Results(
+  *this, CodeCompleter->getAllocator(),
+  CodeCompleter->getCodeCompletionTUInfo(),
+  CodeCompletionContext(CodeCompletionContext::CCC_Symbol, PreferredType));
+  if (!PreferredType.isNull())
+Results.setPreferredType(PreferredType);
   Results.EnterNewScope();
 
   // The "template" keyword can follow "::" in the grammar, but only
Index: cfe/trunk/lib/Parse/ParseExprCXX.cpp
===
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp
@@ -232,13 +232,16 @@
 HasScopeSpecifier = true;
   }
 
+  // Preferred type might change when parsing qualifiers, we need the original.
+  auto SavedType = PreferredType;
   while (true) {
 if (HasScopeSpecifier) {
   if (Tok.is(tok::code_completion)) {
 // Code completion for a nested-name-specifier, where the code
 

[PATCH] D62507: [Dominators] PR42041: Skip nullpointer successors

2019-05-28 Thread Jakub Kuderski via Phabricator via cfe-commits
kuhar added inline comments.



Comment at: clang/include/clang/Analysis/Analyses/Dominators.h:190
+clang::CFGBlock *N, std::integral_constant) {
+  auto RChildren = reverse(children(N));
+  ResultTy Ret(RChildren.begin(), RChildren.end());

Shouldn't one of the cases use `inverse_children`?


Repository:
  rC Clang

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

https://reviews.llvm.org/D62507



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


[clang-tools-extra] r361841 - [clangd] Place cursor better after completing patterns

2019-05-28 Thread Ilya Biryukov via cfe-commits
Author: ibiryukov
Date: Tue May 28 08:33:37 2019
New Revision: 361841

URL: http://llvm.org/viewvc/llvm-project?rev=361841&view=rev
Log:
[clangd] Place cursor better after completing patterns

Summary:
By producing the $0 marker in the snippets at the last placeholder.
This produces nicer results in most cases, e.g. for
   namespace <#name#> {
 <#decls#>
   }

we now produce ${0:decls} instead of ${2:decls} and the final cursor
placement is more convenient.

Reviewers: hokein

Reviewed By: hokein

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

Tags: #clang

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

Modified:
clang-tools-extra/trunk/clangd/CodeComplete.cpp
clang-tools-extra/trunk/clangd/CodeCompletionStrings.cpp
clang-tools-extra/trunk/clangd/CodeCompletionStrings.h
clang-tools-extra/trunk/clangd/unittests/CodeCompleteTests.cpp
clang-tools-extra/trunk/clangd/unittests/CodeCompletionStringsTests.cpp

Modified: clang-tools-extra/trunk/clangd/CodeComplete.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CodeComplete.cpp?rev=361841&r1=361840&r2=361841&view=diff
==
--- clang-tools-extra/trunk/clangd/CodeComplete.cpp (original)
+++ clang-tools-extra/trunk/clangd/CodeComplete.cpp Tue May 28 08:33:37 2019
@@ -394,8 +394,9 @@ struct CodeCompletionBuilder {
 Bundled.emplace_back();
 BundledEntry &S = Bundled.back();
 if (C.SemaResult) {
+  bool IsPattern = C.SemaResult->Kind == CodeCompletionResult::RK_Pattern;
   getSignature(*SemaCCS, &S.Signature, &S.SnippetSuffix,
-   &Completion.RequiredQualifier);
+   &Completion.RequiredQualifier, IsPattern);
   S.ReturnType = getReturnType(*SemaCCS);
 } else if (C.IndexResult) {
   S.Signature = C.IndexResult->Signature;

Modified: clang-tools-extra/trunk/clangd/CodeCompletionStrings.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CodeCompletionStrings.cpp?rev=361841&r1=361840&r2=361841&view=diff
==
--- clang-tools-extra/trunk/clangd/CodeCompletionStrings.cpp (original)
+++ clang-tools-extra/trunk/clangd/CodeCompletionStrings.cpp Tue May 28 
08:33:37 2019
@@ -11,6 +11,8 @@
 #include "clang/AST/DeclObjC.h"
 #include "clang/AST/RawCommentList.h"
 #include "clang/Basic/SourceManager.h"
+#include "clang/Sema/CodeCompleteConsumer.h"
+#include 
 #include 
 
 namespace clang {
@@ -73,8 +75,23 @@ std::string getDeclComment(const ASTCont
 }
 
 void getSignature(const CodeCompletionString &CCS, std::string *Signature,
-  std::string *Snippet, std::string *RequiredQualifiers) {
-  unsigned ArgCount = 0;
+  std::string *Snippet, std::string *RequiredQualifiers,
+  bool CompletingPattern) {
+  // Placeholder with this index will be ${0:…} to mark final cursor 
position.
+  // Usually we do not add $0, so the cursor is placed at end of completed 
text.
+  unsigned CursorSnippetArg = std::numeric_limits::max();
+  if (CompletingPattern) {
+// In patterns, it's best to place the cursor at the last placeholder, to
+// handle cases like
+//namespace ${1:name} {
+//  ${0:decls}
+//}
+CursorSnippetArg =
+llvm::count_if(CCS, [](const CodeCompletionString::Chunk &C) {
+  return C.Kind == CodeCompletionString::CK_Placeholder;
+});
+  }
+  unsigned SnippetArg = 0;
   bool HadObjCArguments = false;
   for (const auto &Chunk : CCS) {
 // Informative qualifier chunks only clutter completion results, skip
@@ -124,8 +141,10 @@ void getSignature(const CodeCompletionSt
   break;
 case CodeCompletionString::CK_Placeholder:
   *Signature += Chunk.Text;
-  ++ArgCount;
-  *Snippet += "${" + std::to_string(ArgCount) + ':';
+  ++SnippetArg;
+  *Snippet +=
+  "${" +
+  std::to_string(SnippetArg == CursorSnippetArg ? 0 : SnippetArg) + 
':';
   appendEscapeSnippet(Chunk.Text, Snippet);
   *Snippet += '}';
   break;

Modified: clang-tools-extra/trunk/clangd/CodeCompletionStrings.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CodeCompletionStrings.h?rev=361841&r1=361840&r2=361841&view=diff
==
--- clang-tools-extra/trunk/clangd/CodeCompletionStrings.h (original)
+++ clang-tools-extra/trunk/clangd/CodeCompletionStrings.h Tue May 28 08:33:37 
2019
@@ -38,12 +38,16 @@ std::string getDeclComment(const ASTCont
 /// Formats the signature for an item, as a display string and snippet.
 /// e.g. for const_reference std::vector::at(size_type) const, this returns:
 ///   *Signature = "(size_type) const"
-///   *Snippet = "(${0:size_type})"
+///   *Snippet = "(${1:size_type})"
 /// If set, RequiredQualifiers is the text that must be typed 

[PATCH] D62389: [clangd] Place cursor better after completing patterns

2019-05-28 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL361841: [clangd] Place cursor better after completing 
patterns (authored by ibiryukov, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D62389?vs=201517&id=201680#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62389

Files:
  clang-tools-extra/trunk/clangd/CodeComplete.cpp
  clang-tools-extra/trunk/clangd/CodeCompletionStrings.cpp
  clang-tools-extra/trunk/clangd/CodeCompletionStrings.h
  clang-tools-extra/trunk/clangd/unittests/CodeCompleteTests.cpp
  clang-tools-extra/trunk/clangd/unittests/CodeCompletionStringsTests.cpp

Index: clang-tools-extra/trunk/clangd/CodeComplete.cpp
===
--- clang-tools-extra/trunk/clangd/CodeComplete.cpp
+++ clang-tools-extra/trunk/clangd/CodeComplete.cpp
@@ -394,8 +394,9 @@
 Bundled.emplace_back();
 BundledEntry &S = Bundled.back();
 if (C.SemaResult) {
+  bool IsPattern = C.SemaResult->Kind == CodeCompletionResult::RK_Pattern;
   getSignature(*SemaCCS, &S.Signature, &S.SnippetSuffix,
-   &Completion.RequiredQualifier);
+   &Completion.RequiredQualifier, IsPattern);
   S.ReturnType = getReturnType(*SemaCCS);
 } else if (C.IndexResult) {
   S.Signature = C.IndexResult->Signature;
Index: clang-tools-extra/trunk/clangd/unittests/CodeCompleteTests.cpp
===
--- clang-tools-extra/trunk/clangd/unittests/CodeCompleteTests.cpp
+++ clang-tools-extra/trunk/clangd/unittests/CodeCompleteTests.cpp
@@ -2382,6 +2382,28 @@
   EXPECT_THAT(C, ElementsAre(SnippetSuffix("${1:(unsigned int)}")));
 }
 
+TEST(CompletionTest, CursorInSnippets) {
+  clangd::CodeCompleteOptions Options;
+  Options.EnableSnippets = true;
+  auto Results = completions(
+  R"cpp(
+void while_foo(int a, int b);
+void test() {
+  whil^
+})cpp",
+  /*IndexSymbols=*/{}, Options);
+
+  // Last placeholder in code patterns should be $0 to put the cursor there.
+  EXPECT_THAT(
+  Results.Completions,
+  Contains(AllOf(Named("while"),
+ SnippetSuffix("(${1:condition}){${0:statements}\n}";
+  // However, snippets for functions must *not* end with $0.
+  EXPECT_THAT(Results.Completions,
+  Contains(AllOf(Named("while_foo"),
+ SnippetSuffix("(${1:int a}, ${2:int b})";
+}
+
 TEST(CompletionTest, WorksWithNullType) {
   auto R = completions(R"cpp(
 int main() {
Index: clang-tools-extra/trunk/clangd/unittests/CodeCompletionStringsTests.cpp
===
--- clang-tools-extra/trunk/clangd/unittests/CodeCompletionStringsTests.cpp
+++ clang-tools-extra/trunk/clangd/unittests/CodeCompletionStringsTests.cpp
@@ -22,10 +22,12 @@
 CCTUInfo(Allocator), Builder(*Allocator, CCTUInfo) {}
 
 protected:
-  void computeSignature(const CodeCompletionString &CCS) {
+  void computeSignature(const CodeCompletionString &CCS,
+bool CompletingPattern = false) {
 Signature.clear();
 Snippet.clear();
-getSignature(CCS, &Signature, &Snippet);
+getSignature(CCS, &Signature, &Snippet, /*RequiredQualifier=*/nullptr,
+ CompletingPattern);
   }
 
   std::shared_ptr Allocator;
@@ -99,6 +101,25 @@
   EXPECT_EQ(Snippet, "(${1:\\$p\\}1})");
 }
 
+TEST_F(CompletionStringTest, SnippetsInPatterns) {
+  auto MakeCCS = [this]() -> const CodeCompletionString & {
+CodeCompletionBuilder Builder(*Allocator, CCTUInfo);
+Builder.AddTypedTextChunk("namespace");
+Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace);
+Builder.AddPlaceholderChunk("name");
+Builder.AddChunk(CodeCompletionString::CK_Equal);
+Builder.AddPlaceholderChunk("target");
+Builder.AddChunk(CodeCompletionString::CK_SemiColon);
+return *Builder.TakeString();
+  };
+  computeSignature(MakeCCS(), /*CompletingPattern=*/false);
+  EXPECT_EQ(Snippet, " ${1:name} = ${2:target};");
+
+  // When completing a pattern, the last placeholder holds the cursor position.
+  computeSignature(MakeCCS(), /*CompletingPattern=*/true);
+  EXPECT_EQ(Snippet, " ${1:name} = ${0:target};");
+}
+
 TEST_F(CompletionStringTest, IgnoreInformativeQualifier) {
   Builder.AddTypedTextChunk("X");
   Builder.AddInformativeChunk("info ok");
Index: clang-tools-extra/trunk/clangd/CodeCompletionStrings.cpp
===
--- clang-tools-extra/trunk/clangd/CodeCompletionStrings.cpp
+++ clang-tools-extra/trunk/clangd/CodeCompletionStrings.cpp
@@ -11,6 +11,8 @@
 #include "clang/AST/DeclObjC.h"
 #include "clang/AST/RawCommentList.h"
 #include "clang/Basic/SourceManager.h"
+#include "clang/Sema/CodeComple

[PATCH] D62507: [Dominators] PR42041: Skip nullpointer successors

2019-05-28 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus updated this revision to Diff 201679.
Szelethus added a comment.

Correctly use `reverse(children(N))` and 
`inverse_children(N)`, based on the original code:

  template 
  struct ChildrenGetter {
using ResultTy = SmallVector;
  
static ResultTy Get(NodePtr N, std::integral_constant) {
  auto RChildren = reverse(children(N));
  return ResultTy(RChildren.begin(), RChildren.end());
}
  
static ResultTy Get(NodePtr N, std::integral_constant) {
  auto IChildren = inverse_children(N);
  return ResultTy(IChildren.begin(), IChildren.end());
}
  
using Tag = std::integral_constant;
  
// etc etc...


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

https://reviews.llvm.org/D62507

Files:
  clang/include/clang/Analysis/Analyses/Dominators.h
  clang/test/Analysis/domtest.cpp

Index: clang/test/Analysis/domtest.cpp
===
--- /dev/null
+++ clang/test/Analysis/domtest.cpp
@@ -0,0 +1,46 @@
+// RUN: %clang_analyze_cc1 %s \
+// RUN:   -analyzer-checker=debug.DumpCFG \
+// RUN:   -analyzer-checker=debug.DumpDominators \
+// RUN:   2>&1 | FileCheck %s
+
+namespace pr42041_unreachable_cfg_successor {
+enum Kind {
+  A
+};
+
+void f() {
+  switch(Kind{}) {
+  case A:
+break;
+  }
+}
+} // end of namespace pr42041_unreachable_cfg_successor
+
+// CHECK:  void f()
+// CHECK-NEXT:  [B3 (ENTRY)]
+// CHECK-NEXT:Succs (1): B1
+//
+// CHECK:   [B1]
+// CHECK-NEXT:1: {}
+// CHECK-NEXT:2: pr42041_unreachable_cfg_successor::Kind[B1.1]
+// CHECK-SAME:(CXXFunctionalCastExpr, NoOp,
+// CHECK-SAME: enum pr42041_unreachable_cfg_successor::Kind)
+// CHECK-NEXT:3: [B1.2] (ImplicitCastExpr, IntegralCast, int)
+// CHECK-NEXT:T: switch [B1.3]
+// CHECK-NEXT:Preds (1): B3
+// CHECK-NEXT:Succs (2): B2 B0(Unreachable)
+//
+// CHECK:   [B2]
+// CHECK-NEXT:   case A:
+// CHECK-NEXT:T: break;
+// CHECK-NEXT:Preds (1): B1
+// CHECK-NEXT:Succs (1): B0
+//
+// CHECK:   [B0 (EXIT)]
+// CHECK-NEXT:Preds (2): B2 B1(Unreachable)
+//
+// CHECK:  Immediate dominance tree (Node#,IDom#):
+// CHECK-NEXT: (0,2)
+// CHECK-NEXT: (1,3)
+// CHECK-NEXT: (2,1)
+// CHECK-NEXT: (3,3)
Index: clang/include/clang/Analysis/Analyses/Dominators.h
===
--- clang/include/clang/Analysis/Analyses/Dominators.h
+++ clang/include/clang/Analysis/Analyses/Dominators.h
@@ -155,13 +155,51 @@
 
 } // namespace clang
 
+namespace llvm {
+
+/// Clang's CFG contains nullpointers for unreachable succesors, e.g. when an
+/// if statement's condition is always false, it's 'then' branch is represented
+/// with a nullptr. This however will result in a nullpointer derefernece for
+/// dominator tree calculation.
+///
+/// To circumvent this, let's just crudely specialize the children getters
+/// used in LLVM's dominator tree builder.
+namespace DomTreeBuilder {
+
+using ClangCFGDomChildrenGetter =
+SemiNCAInfo>::ChildrenGetter;
+
+template <>
+template <>
+ClangCFGDomChildrenGetter::ResultTy ClangCFGDomChildrenGetter::Get(
+clang::CFGBlock *N, std::integral_constant) {
+  auto RChildren = reverse(children(N));
+  ResultTy Ret(RChildren.begin(), RChildren.end());
+  Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
+  return Ret;
+}
+
+using ClangCFGDomReverseChildrenGetter =
+SemiNCAInfo>::ChildrenGetter;
+
+template <>
+template <>
+ClangCFGDomReverseChildrenGetter::ResultTy
+ClangCFGDomReverseChildrenGetter::Get(
+clang::CFGBlock *N, std::integral_constant) {
+  auto RChildren = inverse_children(N);
+  ResultTy Ret(RChildren.begin(), RChildren.end());
+  Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
+  return Ret;
+}
+
+} // end of namespace DomTreeBuilder
+
 //===-
 /// DominatorTree GraphTraits specialization so the DominatorTree can be
 /// iterable by generic graph iterators.
 ///
-namespace llvm {
-
-template <> struct GraphTraits< ::clang::DomTreeNode* > {
+template <> struct GraphTraits {
   using NodeRef = ::clang::DomTreeNode *;
   using ChildIteratorType = ::clang::DomTreeNode::iterator;
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D62507: [Dominators] PR42041: Skip nullpointer successors

2019-05-28 Thread Jakub Kuderski via Phabricator via cfe-commits
kuhar accepted this revision.
kuhar added a comment.
This revision is now accepted and ready to land.

Thanks, I think this is a much better solution than directly hacking on 
DomTreeBuilder.

Note that every time you ask DomTree about a `nullptr` CFG node, it understands 
it as a request for a virtual root. While now this should crash on forward 
dominators, you will get an actual tree node for a nullptr in postdominators. 
In the future, it may happen that forward dominators will also have a virtual 
root (for more efficient updates) and the users of clang CFG and dominators 
should be aware that not every CFG node (i.e., an unreachable successor) has a 
corresponding DomTreeNode.


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

https://reviews.llvm.org/D62507



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


[PATCH] D61742: [Driver][Windows] Add dependent lib argument for profile instr generate

2019-05-28 Thread Russell Gallop via Phabricator via cfe-commits
russell.gallop added a comment.

> it looks like passing -no-canonical-prefixes makes this path relative

Do you see this working? I tried writing a test and it doesn't appear to work 
for me.


Repository:
  rC Clang

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

https://reviews.llvm.org/D61742



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


[PATCH] D61742: [Driver][Windows] Add dependent lib argument for profile instr generate

2019-05-28 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

It seems to work for me from what I can tell:

  $ out/gn/bin/clang-cl /c -fprofile-instr-generate /TC /dev/null -### 
-no-canonical-prefixes 2>&1 | grep -o 'dependent-lib=[^"]*'
  dependent-lib=libcmt
  dependent-lib=oldnames
  dependent-lib=out/gn/lib/clang/9.0.0/lib/windows/clang_rt.profile-x86_64.lib


Repository:
  rC Clang

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

https://reviews.llvm.org/D61742



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


[PATCH] D60691: [ARM] Replace fp-only-sp and d16 with fp64 and d32.

2019-05-28 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC361845: [ARM] Replace fp-only-sp and d16 with fp64 and d32. 
(authored by statham, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D60691?vs=201658&id=201691#toc

Repository:
  rC Clang

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

https://reviews.llvm.org/D60691

Files:
  lib/Basic/Targets/ARM.cpp
  test/CodeGen/arm-target-features.c
  test/Driver/arm-mfpu.c

Index: lib/Basic/Targets/ARM.cpp
===
--- lib/Basic/Targets/ARM.cpp
+++ lib/Basic/Targets/ARM.cpp
@@ -400,8 +400,7 @@
   HasFloat16 = true;
 
   // This does not diagnose illegal cases like having both
-  // "+vfpv2" and "+vfpv3" or having "+neon" and "+fp-only-sp".
-  uint32_t HW_FP_remove = 0;
+  // "+vfpv2" and "+vfpv3" or having "+neon" and "-fp64".
   for (const auto &Feature : Features) {
 if (Feature == "+soft-float") {
   SoftFloat = true;
@@ -409,19 +408,19 @@
   SoftFloatABI = true;
 } else if (Feature == "+vfp2") {
   FPU |= VFP2FPU;
-  HW_FP |= HW_FP_SP | HW_FP_DP;
+  HW_FP |= HW_FP_SP;
 } else if (Feature == "+vfp3") {
   FPU |= VFP3FPU;
-  HW_FP |= HW_FP_SP | HW_FP_DP;
+  HW_FP |= HW_FP_SP;
 } else if (Feature == "+vfp4") {
   FPU |= VFP4FPU;
-  HW_FP |= HW_FP_SP | HW_FP_DP | HW_FP_HP;
+  HW_FP |= HW_FP_SP | HW_FP_HP;
 } else if (Feature == "+fp-armv8") {
   FPU |= FPARMV8;
-  HW_FP |= HW_FP_SP | HW_FP_DP | HW_FP_HP;
+  HW_FP |= HW_FP_SP | HW_FP_HP;
 } else if (Feature == "+neon") {
   FPU |= NeonFPU;
-  HW_FP |= HW_FP_SP | HW_FP_DP;
+  HW_FP |= HW_FP_SP;
 } else if (Feature == "+hwdiv") {
   HWDiv |= HWDivThumb;
 } else if (Feature == "+hwdiv-arm") {
@@ -432,8 +431,8 @@
   Crypto = 1;
 } else if (Feature == "+dsp") {
   DSP = 1;
-} else if (Feature == "+fp-only-sp") {
-  HW_FP_remove |= HW_FP_DP;
+} else if (Feature == "+fp64") {
+  HW_FP |= HW_FP_DP;
 } else if (Feature == "+8msecext") {
   if (CPUProfile != "M" || ArchVersion != 8) {
 Diags.Report(diag::err_target_unsupported_mcmse) << CPU;
@@ -449,7 +448,6 @@
   DotProd = true;
 }
   }
-  HW_FP &= ~HW_FP_remove;
 
   switch (ArchVersion) {
   case 6:
Index: test/CodeGen/arm-target-features.c
===
--- test/CodeGen/arm-target-features.c
+++ test/CodeGen/arm-target-features.c
@@ -1,23 +1,23 @@
 // REQUIRES: arm-registered-target
 
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a8 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP3
-// CHECK-VFP3: "target-features"="+armv7-a,+dsp,+neon,+thumb-mode,+vfp3"
+// CHECK-VFP3: "target-features"="+armv7-a,+d32,+dsp,+fp64,+neon,+thumb-mode,+vfp3"
 
 
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a5 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4
-// CHECK-VFP4: "target-features"="+armv7-a,+dsp,+neon,+thumb-mode,+vfp4"
+// CHECK-VFP4: "target-features"="+armv7-a,+d32,+dsp,+fp64,+neon,+thumb-mode,+vfp4"
 
 
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a7 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabi -target-cpu cortex-a12 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
 // RUN: %clang_cc1 -triple thumbv7s-linux-gnueabi -target-cpu swift -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV-2
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu krait -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
-// CHECK-VFP4-DIV: "target-features"="+armv7-a,+dsp,+hwdiv,+hwdiv-arm,+neon,+thumb-mode,+vfp4"
-// CHECK-VFP4-DIV-2: "target-features"="+armv7s,+dsp,+hwdiv,+hwdiv-arm,+neon,+thumb-mode,+vfp4"
+// CHECK-VFP4-DIV: "target-features"="+armv7-a,+d32,+dsp,+fp64,+hwdiv,+hwdiv-arm,+neon,+thumb-mode,+vfp4"
+// CHECK-VFP4-DIV-2: "target-features"="+armv7s,+d32,+dsp,+fp64,+hwdiv,+hwdiv-arm,+neon,+thumb-mode,+vfp4"
 
 // RUN: %clang_cc1 -triple armv7-linux-gnueabihf -target-cpu cortex-a15 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV-ARM
 // RUN: %clang_cc1 -triple armv7-linux-gnueabihf -target-cpu cortex-a17 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV-ARM
-// CHECK-VFP4-DIV-ARM: "target-features"="+armv7-a,+dsp,+hwdiv,+hwdiv-arm,+neon,+vfp4,-thumb-mode"
+// CHECK-VFP4-DIV-ARM: "target-features"="+armv7-a,+d32,+dsp,+fp64,+hwdiv,+hwdiv-arm,+neon,+vfp4,-thumb-mode"
 
 // RUN: %clang_cc1 -triple thumbv7s-apple-ios7.0 -target-cpu cyclone -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
 // RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a32 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
@@ -28,34 +28,34 @@
 // RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -tar

r361845 - [ARM] Replace fp-only-sp and d16 with fp64 and d32.

2019-05-28 Thread Simon Tatham via cfe-commits
Author: statham
Date: Tue May 28 09:13:20 2019
New Revision: 361845

URL: http://llvm.org/viewvc/llvm-project?rev=361845&view=rev
Log:
[ARM] Replace fp-only-sp and d16 with fp64 and d32.

Those two subtarget features were awkward because their semantics are
reversed: each one indicates the _lack_ of support for something in
the architecture, rather than the presence. As a consequence, you
don't get the behavior you want if you combine two sets of feature
bits.

Each SubtargetFeature for an FP architecture version now comes in four
versions, one for each combination of those options. So you can still
say (for example) '+vfp2' in a feature string and it will mean what
it's always meant, but there's a new string '+vfp2d16sp' meaning the
version without those extra options.

A lot of this change is just mechanically replacing positive checks
for the old features with negative checks for the new ones. But one
more interesting change is that I've rearranged getFPUFeatures() so
that the main FPU feature is appended to the output list *before*
rather than after the features derived from the Restriction field, so
that -fp64 and -d32 can override defaults added by the main feature.

Reviewers: dmgreen, samparker, SjoerdMeijer

Subscribers: srhines, javed.absar, eraman, kristof.beyls, hiraditya, zzheng, 
Petar.Avramovic, cfe-commits, llvm-commits

Tags: #clang, #llvm

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


Modified:
cfe/trunk/lib/Basic/Targets/ARM.cpp
cfe/trunk/test/CodeGen/arm-target-features.c
cfe/trunk/test/Driver/arm-mfpu.c

Modified: cfe/trunk/lib/Basic/Targets/ARM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/ARM.cpp?rev=361845&r1=361844&r2=361845&view=diff
==
--- cfe/trunk/lib/Basic/Targets/ARM.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/ARM.cpp Tue May 28 09:13:20 2019
@@ -400,8 +400,7 @@ bool ARMTargetInfo::handleTargetFeatures
   HasFloat16 = true;
 
   // This does not diagnose illegal cases like having both
-  // "+vfpv2" and "+vfpv3" or having "+neon" and "+fp-only-sp".
-  uint32_t HW_FP_remove = 0;
+  // "+vfpv2" and "+vfpv3" or having "+neon" and "-fp64".
   for (const auto &Feature : Features) {
 if (Feature == "+soft-float") {
   SoftFloat = true;
@@ -409,19 +408,19 @@ bool ARMTargetInfo::handleTargetFeatures
   SoftFloatABI = true;
 } else if (Feature == "+vfp2") {
   FPU |= VFP2FPU;
-  HW_FP |= HW_FP_SP | HW_FP_DP;
+  HW_FP |= HW_FP_SP;
 } else if (Feature == "+vfp3") {
   FPU |= VFP3FPU;
-  HW_FP |= HW_FP_SP | HW_FP_DP;
+  HW_FP |= HW_FP_SP;
 } else if (Feature == "+vfp4") {
   FPU |= VFP4FPU;
-  HW_FP |= HW_FP_SP | HW_FP_DP | HW_FP_HP;
+  HW_FP |= HW_FP_SP | HW_FP_HP;
 } else if (Feature == "+fp-armv8") {
   FPU |= FPARMV8;
-  HW_FP |= HW_FP_SP | HW_FP_DP | HW_FP_HP;
+  HW_FP |= HW_FP_SP | HW_FP_HP;
 } else if (Feature == "+neon") {
   FPU |= NeonFPU;
-  HW_FP |= HW_FP_SP | HW_FP_DP;
+  HW_FP |= HW_FP_SP;
 } else if (Feature == "+hwdiv") {
   HWDiv |= HWDivThumb;
 } else if (Feature == "+hwdiv-arm") {
@@ -432,8 +431,8 @@ bool ARMTargetInfo::handleTargetFeatures
   Crypto = 1;
 } else if (Feature == "+dsp") {
   DSP = 1;
-} else if (Feature == "+fp-only-sp") {
-  HW_FP_remove |= HW_FP_DP;
+} else if (Feature == "+fp64") {
+  HW_FP |= HW_FP_DP;
 } else if (Feature == "+8msecext") {
   if (CPUProfile != "M" || ArchVersion != 8) {
 Diags.Report(diag::err_target_unsupported_mcmse) << CPU;
@@ -449,7 +448,6 @@ bool ARMTargetInfo::handleTargetFeatures
   DotProd = true;
 }
   }
-  HW_FP &= ~HW_FP_remove;
 
   switch (ArchVersion) {
   case 6:

Modified: cfe/trunk/test/CodeGen/arm-target-features.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm-target-features.c?rev=361845&r1=361844&r2=361845&view=diff
==
--- cfe/trunk/test/CodeGen/arm-target-features.c (original)
+++ cfe/trunk/test/CodeGen/arm-target-features.c Tue May 28 09:13:20 2019
@@ -1,23 +1,23 @@
 // REQUIRES: arm-registered-target
 
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a8 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP3
-// CHECK-VFP3: "target-features"="+armv7-a,+dsp,+neon,+thumb-mode,+vfp3"
+// CHECK-VFP3: 
"target-features"="+armv7-a,+d32,+dsp,+fp64,+neon,+thumb-mode,+vfp3"
 
 
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a5 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4
-// CHECK-VFP4: "target-features"="+armv7-a,+dsp,+neon,+thumb-mode,+vfp4"
+// CHECK-VFP4: 
"target-features"="+armv7-a,+d32,+dsp,+fp64,+neon,+thumb-mode,+vfp4"
 
 
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a7 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
 // RUN

[clang-tools-extra] r361846 - [clangd] Fix test output for r361841

2019-05-28 Thread Ilya Biryukov via cfe-commits
Author: ibiryukov
Date: Tue May 28 09:28:27 2019
New Revision: 361846

URL: http://llvm.org/viewvc/llvm-project?rev=361846&view=rev
Log:
[clangd] Fix test output for r361841

Modified:
clang-tools-extra/trunk/clangd/unittests/CodeCompleteTests.cpp

Modified: clang-tools-extra/trunk/clangd/unittests/CodeCompleteTests.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/unittests/CodeCompleteTests.cpp?rev=361846&r1=361845&r2=361846&view=diff
==
--- clang-tools-extra/trunk/clangd/unittests/CodeCompleteTests.cpp (original)
+++ clang-tools-extra/trunk/clangd/unittests/CodeCompleteTests.cpp Tue May 28 
09:28:27 2019
@@ -2397,7 +2397,7 @@ TEST(CompletionTest, CursorInSnippets) {
   EXPECT_THAT(
   Results.Completions,
   Contains(AllOf(Named("while"),
- SnippetSuffix("(${1:condition}){${0:statements}\n}";
+ SnippetSuffix("(${1:condition}){\n${0:statements}\n}";
   // However, snippets for functions must *not* end with $0.
   EXPECT_THAT(Results.Completions,
   Contains(AllOf(Named("while_foo"),


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


[PATCH] D62419: [LibTooling] Add `before` and `after` selectors for selecting point-ranges relative to nodes.

2019-05-28 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision.
ilya-biryukov marked an inline comment as done.
ilya-biryukov added a comment.
This revision is now accepted and ready to land.

LGTM!




Comment at: clang/lib/Tooling/Refactoring/RangeSelector.cpp:124
+return CharSourceRange::getCharRange(Lexer::getLocForEndOfToken(
+SelectedRange->getEnd(), 0, Result.Context->getSourceManager(),
+Result.Context->getLangOpts()));

Ah, we're so lucky to have the source manager here!
It did not occur to me that having `MatchResult` means we also have access to 
all helper structs we need



Comment at: clang/unittests/Tooling/RangeSelectorTest.cpp:130
+int f(int x, int y, int z) { return 3; }
+int g() { return f(/* comment */ 3, 7 /* comment */, 9); }
+  )cc";

NIT: Consider using `llvm::Annotations` from `llvm/Testing/Support`, they might 
help to produce more readable tests.
It allow to mark ranges inside the input text with a special syntax and get 
offsets for those.

No need to change anything in this revision, obviously.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62419



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


Re: [clang-tools-extra] r361841 - [clangd] Place cursor better after completing patterns

2019-05-28 Thread Ilya Biryukov via cfe-commits
This broke buildbots due to a failing test.
r361846 should fit it.

Sorry for the inconvenience.

On Tue, May 28, 2019 at 5:30 PM Ilya Biryukov via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: ibiryukov
> Date: Tue May 28 08:33:37 2019
> New Revision: 361841
>
> URL: http://llvm.org/viewvc/llvm-project?rev=361841&view=rev
> Log:
> [clangd] Place cursor better after completing patterns
>
> Summary:
> By producing the $0 marker in the snippets at the last placeholder.
> This produces nicer results in most cases, e.g. for
>namespace <#name#> {
>  <#decls#>
>}
>
> we now produce ${0:decls} instead of ${2:decls} and the final cursor
> placement is more convenient.
>
> Reviewers: hokein
>
> Reviewed By: hokein
>
> Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits
>
> Tags: #clang
>
> Differential Revision: https://reviews.llvm.org/D62389
>
> Modified:
> clang-tools-extra/trunk/clangd/CodeComplete.cpp
> clang-tools-extra/trunk/clangd/CodeCompletionStrings.cpp
> clang-tools-extra/trunk/clangd/CodeCompletionStrings.h
> clang-tools-extra/trunk/clangd/unittests/CodeCompleteTests.cpp
> clang-tools-extra/trunk/clangd/unittests/CodeCompletionStringsTests.cpp
>
> Modified: clang-tools-extra/trunk/clangd/CodeComplete.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CodeComplete.cpp?rev=361841&r1=361840&r2=361841&view=diff
>
> ==
> --- clang-tools-extra/trunk/clangd/CodeComplete.cpp (original)
> +++ clang-tools-extra/trunk/clangd/CodeComplete.cpp Tue May 28 08:33:37
> 2019
> @@ -394,8 +394,9 @@ struct CodeCompletionBuilder {
>  Bundled.emplace_back();
>  BundledEntry &S = Bundled.back();
>  if (C.SemaResult) {
> +  bool IsPattern = C.SemaResult->Kind ==
> CodeCompletionResult::RK_Pattern;
>getSignature(*SemaCCS, &S.Signature, &S.SnippetSuffix,
> -   &Completion.RequiredQualifier);
> +   &Completion.RequiredQualifier, IsPattern);
>S.ReturnType = getReturnType(*SemaCCS);
>  } else if (C.IndexResult) {
>S.Signature = C.IndexResult->Signature;
>
> Modified: clang-tools-extra/trunk/clangd/CodeCompletionStrings.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CodeCompletionStrings.cpp?rev=361841&r1=361840&r2=361841&view=diff
>
> ==
> --- clang-tools-extra/trunk/clangd/CodeCompletionStrings.cpp (original)
> +++ clang-tools-extra/trunk/clangd/CodeCompletionStrings.cpp Tue May 28
> 08:33:37 2019
> @@ -11,6 +11,8 @@
>  #include "clang/AST/DeclObjC.h"
>  #include "clang/AST/RawCommentList.h"
>  #include "clang/Basic/SourceManager.h"
> +#include "clang/Sema/CodeCompleteConsumer.h"
> +#include 
>  #include 
>
>  namespace clang {
> @@ -73,8 +75,23 @@ std::string getDeclComment(const ASTCont
>  }
>
>  void getSignature(const CodeCompletionString &CCS, std::string *Signature,
> -  std::string *Snippet, std::string *RequiredQualifiers) {
> -  unsigned ArgCount = 0;
> +  std::string *Snippet, std::string *RequiredQualifiers,
> +  bool CompletingPattern) {
> +  // Placeholder with this index will be ${0:…} to mark final cursor
> position.
> +  // Usually we do not add $0, so the cursor is placed at end of
> completed text.
> +  unsigned CursorSnippetArg = std::numeric_limits::max();
> +  if (CompletingPattern) {
> +// In patterns, it's best to place the cursor at the last
> placeholder, to
> +// handle cases like
> +//namespace ${1:name} {
> +//  ${0:decls}
> +//}
> +CursorSnippetArg =
> +llvm::count_if(CCS, [](const CodeCompletionString::Chunk &C) {
> +  return C.Kind == CodeCompletionString::CK_Placeholder;
> +});
> +  }
> +  unsigned SnippetArg = 0;
>bool HadObjCArguments = false;
>for (const auto &Chunk : CCS) {
>  // Informative qualifier chunks only clutter completion results, skip
> @@ -124,8 +141,10 @@ void getSignature(const CodeCompletionSt
>break;
>  case CodeCompletionString::CK_Placeholder:
>*Signature += Chunk.Text;
> -  ++ArgCount;
> -  *Snippet += "${" + std::to_string(ArgCount) + ':';
> +  ++SnippetArg;
> +  *Snippet +=
> +  "${" +
> +  std::to_string(SnippetArg == CursorSnippetArg ? 0 : SnippetArg)
> + ':';
>appendEscapeSnippet(Chunk.Text, Snippet);
>*Snippet += '}';
>break;
>
> Modified: clang-tools-extra/trunk/clangd/CodeCompletionStrings.h
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CodeCompletionStrings.h?rev=361841&r1=361840&r2=361841&view=diff
>
> ==
> --- clang-tools-extra/trunk/clangd/CodeCompletionStrings.h (original)
> +++ clang-tools-extra/trunk/clangd/CodeCompletionSt

[PATCH] D62225: [clang][NewPM] Fixing -O0 tests that are broken under new PM

2019-05-28 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment.

Are the behavior differences between the newpm alwaysinliner and the oldpm 
alwaysinliner intentional?  Specifically, the differences in pass remarks, and 
the differences in the treatment of the alwaysinline attribute seem suspect.  
(I'm not that interested in the different bitcasts and different order of 
inline allocas, although that might be nice to fix if it's a small change.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62225



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


[PATCH] D61742: [Driver][Windows] Add dependent lib argument for profile instr generate

2019-05-28 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

I was going to suggest that maybe what we should do is just embed the basename, 
i.e. `/nodefaultlib:clang_rt.profile-x86_64.lib`, and then we just ask users to 
add one `/libpath:` flag to their linker invocation. That saves users from 
having to come up with a mapping from their build system CPU name to whatever 
compiler-rt is using (i686, i386, x86-64, x86_64h, etc). Users should probably 
put clang's library directory on libpath anyway if they want to be able to find 
the builtins library, which might be necessary even in a standard (no-pgo, 
no-coverage) build configuration. This is also consistent with MSVC in some 
ways, which autolinks the CRT this way.


Repository:
  rC Clang

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

https://reviews.llvm.org/D61742



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


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

2019-05-28 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 201693.
Typz marked 3 inline comments as done.
Typz added a comment.
Herald added subscribers: ormris, mgorny.

- Rebased
- Adapt styles search path to platform conventions
- Allow customizing search path at compile time
- Allow overriding search path at runtime through CLANG_FORMAT_STYLES_PATH env 
variable


Repository:
  rC Clang

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

https://reviews.llvm.org/D50147

Files:
  include/clang/Format/Format.h
  lib/Format/CMakeLists.txt
  lib/Format/Format.cpp
  unittests/Format/FormatTest.cpp

Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -13185,6 +13185,124 @@
   ASSERT_EQ(*Style1, getGoogleStyle());
 }
 
+namespace {
+class EnvSetter {
+StringRef m_key;
+Optional m_oldValue;
+public:
+EnvSetter(StringRef key, StringRef value = StringRef()) : m_key(key) {
+  if (const char *oldValue = ::getenv(m_key.data()))
+m_oldValue.emplace(oldValue);
+  if (value.empty())
+::unsetenv(m_key.data());
+  else
+::setenv(m_key.data(), value.data(), 1);
+}
+~EnvSetter() {
+  if (m_oldValue)
+::setenv(m_key.data(), m_oldValue.getValue().data(), 1);
+}
+EnvSetter(const EnvSetter &) = delete;
+EnvSetter &operator=(const EnvSetter &) = delete;
+};
+}
+
+TEST(FormatStyle, GetExternalStyle) {
+  // Override HOME environment variable to make tests independant of actual user
+  EnvSetter homeEnv("HOME", "/home");
+
+  // Clear CLANG_FORMAT_STYLES_PATH environment variable
+  EnvSetter stylesPathEnv("CLANG_FORMAT_STYLES_PATH");
+
+  llvm::vfs::InMemoryFileSystem FS;
+
+  // Test 1: format file in /usr/local/share/clang-format/
+  ASSERT_TRUE(
+  FS.addFile("/usr/local/share/clang-format/style1", 0,
+ llvm::MemoryBuffer::getMemBuffer("BasedOnStyle: Google")));
+  auto Style1 = getStyle("style1", "", "LLVM", "", &FS);
+  ASSERT_TRUE((bool)Style1);
+  ASSERT_EQ(*Style1, getGoogleStyle());
+
+  // Test 2: format file in /usr/share/clang-format/
+  ASSERT_TRUE(
+  FS.addFile("/usr/share/clang-format/style2", 0,
+ llvm::MemoryBuffer::getMemBuffer("BasedOnStyle: Google")));
+  auto Style2 = getStyle("style2", "", "LLVM", "", &FS);
+  ASSERT_TRUE((bool)Style2);
+  ASSERT_EQ(*Style2, getGoogleStyle());
+
+  // Test 3: format file in ~/.local/share/clang-format/
+  ASSERT_TRUE(
+  FS.addFile("/home/.local/share/clang-format/style3", 0,
+ llvm::MemoryBuffer::getMemBuffer("BasedOnStyle: Google")));
+  auto Style3 = getStyle("style3", "", "LLVM", "", &FS);
+  ASSERT_TRUE((bool)Style3);
+  ASSERT_EQ(*Style3, getGoogleStyle());
+
+  // Test 4: format file in absolute path
+  ASSERT_TRUE(
+  FS.addFile("/clang-format-styles/style4", 0,
+ llvm::MemoryBuffer::getMemBuffer("BasedOnStyle: Google")));
+  auto Style4 = getStyle("/clang-format-styles/style4", "", "LLVM", "", &FS);
+  ASSERT_TRUE((bool)Style4);
+  ASSERT_EQ(*Style4, getGoogleStyle());
+
+  // Test 5: format file in relative path
+  ASSERT_TRUE(
+  FS.addFile("/clang-format-styles/style5", 0,
+ llvm::MemoryBuffer::getMemBuffer("BasedOnStyle: Google")));
+  FS.setCurrentWorkingDirectory("/clang-format-styles");
+  auto Style5 = getStyle("style5", "", "LLVM", "", &FS);
+  ASSERT_TRUE((bool)Style5);
+  ASSERT_EQ(*Style5, getGoogleStyle());
+  FS.setCurrentWorkingDirectory("/");
+
+  // Test 6: file does not exist
+  auto Style6 = getStyle("style6", "", "LLVM", "", &FS);
+  ASSERT_FALSE((bool)Style6);
+  llvm::consumeError(Style6.takeError());
+
+  // Test 7: absolute file does not exist
+  auto Style7 = getStyle("/style7", "", "LLVM", "", &FS);
+  ASSERT_FALSE((bool)Style7);
+  llvm::consumeError(Style7.takeError());
+
+  // Test 8: file is not a format style
+  ASSERT_TRUE(
+  FS.addFile("/usr/local/share/clang-format/nostyle", 0,
+ llvm::MemoryBuffer::getMemBuffer("This is not a style...")));
+  FS.setCurrentWorkingDirectory("/home/clang-format-styles");
+  auto Style8 = getStyle("nostyle", "", "LLVM", "", &FS);
+  ASSERT_FALSE((bool)Style8);
+  llvm::consumeError(Style8.takeError());
+
+  {
+// Override styles path
+EnvSetter customStylesPathEnv("CLANG_FORMAT_STYLES_PATH", "/customPath1:/customPath2");
+
+// Test 8: file in custom styles path
+ASSERT_TRUE(
+FS.addFile("/customPath1/style8_1", 0,
+   llvm::MemoryBuffer::getMemBuffer("BasedOnStyle: Google")));
+auto Style8_1 = getStyle("style8_1", "", "LLVM", "", &FS);
+ASSERT_TRUE((bool)Style8_1);
+ASSERT_EQ(*Style8_1, getGoogleStyle());
+
+ASSERT_TRUE(
+FS.addFile("/customPath2/style8_2", 0,
+   llvm::MemoryBuffer::getMemBuffer("BasedOnStyle: Mozilla")));
+auto Style8_2 = getStyle("style8_2", "", "LLVM", "", &FS);
+ASSERT_TRUE((

[PATCH] D62005: [libunwind] [test] Fix inferring source paths

2019-05-28 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment.

Ping. Could somebody review this, please? It's blocking NetBSD buildbot for 
quite some time already.


Repository:
  rUNW libunwind

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

https://reviews.llvm.org/D62005



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


[PATCH] D62035: [AST] const-ify ObjC inherited class search

2019-05-28 Thread Adam Ernst via Phabricator via cfe-commits
adamjernst added a comment.

@beng (hello!!) I've spotted you reviewing some Objective-C clang stuff … can 
you review, or do you have advice on a qualified reviewer?


Repository:
  rC Clang

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

https://reviews.llvm.org/D62035



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


[PATCH] D58920: [Modules][PR39287] Consolidate multiple std's

2019-05-28 Thread Brian Gesiak via Phabricator via cfe-commits
modocache added a comment.

@rsmith, what do you think of the patch as-is?


Repository:
  rC Clang

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

https://reviews.llvm.org/D58920



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


[PATCH] D62525: [Analyzer] Add new visitor to the iterator checkers

2019-05-28 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment.

Before someone asks: `NoteTag`s are not applicable here since invalidation and 
reaching one end of the range happens in many different places. This is also 
true for container emptiness.


Repository:
  rC Clang

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

https://reviews.llvm.org/D62525



___
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-05-28 Thread David Tenty via Phabricator via cfe-commits
daltenty created this revision.
daltenty added reviewers: hubert.reinterpretcast, xingxue, andusy.
daltenty added projects: LLVM, clang.
Herald added subscribers: llvm-commits, cfe-commits, jsji, mgorny.

It is useful to build with _XOPEN_SOURCE defined on AIX, enabling X/Open
and POSIX compatibility mode, to work around stray macros and other
bugs in the headers provided by the system and build compiler.

This patch adds the config to cmake to build with _XOPEN_SOURCE defined on AIX 
with a few exceptions. Google Test internals require access to platform 
specific thread info constructs on AIX so in that case we build with 
_ALL_SOURCE defined instead. Libclang also uses header which needs _ALL_SOURCE 
on AIX so we leave that as is as well..

We also add building on AIX with the large file API and doing CMake header 
checks with X/OPEN definitions so the results are consistent with the 
environment that will be present in the build.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62533

Files:
  clang/tools/libclang/CMakeLists.txt
  llvm/CMakeLists.txt
  llvm/cmake/config-ix.cmake
  llvm/utils/unittest/CMakeLists.txt
  llvm/utils/unittest/googletest/src/gtest-port.cc


Index: llvm/utils/unittest/googletest/src/gtest-port.cc
===
--- llvm/utils/unittest/googletest/src/gtest-port.cc
+++ llvm/utils/unittest/googletest/src/gtest-port.cc
@@ -59,6 +59,7 @@
 #endif  // GTEST_OS_QNX
 
 #if GTEST_OS_AIX
+#define _ALL_SOURCE
 # include 
 # include 
 #endif  // GTEST_OS_AIX
Index: llvm/utils/unittest/CMakeLists.txt
===
--- llvm/utils/unittest/CMakeLists.txt
+++ llvm/utils/unittest/CMakeLists.txt
@@ -28,6 +28,11 @@
   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")
+endif()
+
 if(SUPPORTS_VARIADIC_MACROS_FLAG)
   add_definitions("-Wno-variadic-macros")
 endif()
Index: llvm/cmake/config-ix.cmake
===
--- llvm/cmake/config-ix.cmake
+++ llvm/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, as we will build with
+# that 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/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -858,6 +858,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: clang/tools/libclang/CMakeLists.txt
===
--- clang/tools/libclang/CMakeLists.txt
+++ clang/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/utils/unittest/googletest/src/gtest-port.cc
===
--- llvm/utils/unittest/googletest/src/gtest-port.cc
+++ llvm/utils/unittest/googletest/src/gtest-port.cc
@@ -59,6 +59,7 @@
 #endif  // GTEST_OS_QNX
 
 #if GTEST_OS_AIX
+#define _ALL_SOURCE
 # include 
 # include 
 #endif  // GTEST_OS_AIX
Index: llvm/utils/unittest/CMakeLists.txt
===
--- llvm/utils/unittest/CMakeLists.txt
+++ llvm/utils/unittest/CMakeLists.txt
@@ -28,6 +28,11 @@
   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")
+endif()
+
 if(SUPPORTS_VARIADIC_MACROS_FLAG)
   add_definitions("-Wno-variadic-macros")
 endif()
Index: llvm/cmake/config-ix.cmake
===

[PATCH] D62035: [AST] const-ify ObjC inherited class search

2019-05-28 Thread Ben Gertzfield via Phabricator via cfe-commits
beng added a comment.

Thanks! @jyknight might want to take a look (this seems fine to me though).


Repository:
  rC Clang

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

https://reviews.llvm.org/D62035



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


[PATCH] D62167: CodeView - add static data members to global variable debug info.

2019-05-28 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added subscribers: manmanren, probinson.
rnk added inline comments.



Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:4385
+// Use the global scope for static members.
+DContext = getContextDescriptor(
+   cast(CGM.getContext().getTranslationUnitDecl()), TheCU);

akhuang wrote:
> akhuang wrote:
> > dblaikie wrote:
> > > akhuang wrote:
> > > > @dblaikie I'm using the global scope here because if the class type is 
> > > > used as the scope it runs into the [[ 
> > > > https://github.com/llvm/llvm-project/blob/a2ee80b084e5c0b20364ed4379384706f5e059b1/llvm/lib/IR/DIBuilder.cpp#L630
> > > >  | assert message ]] `Context of a global variable should not be a type 
> > > > with identifier`. Is there a reason for the assert? 
> > > I think it's generally how LLVM handles definitions for the most part - 
> > > putting them at the global scope.
> > > 
> > > Though I'm confused by this patch - it has a source change in clang, but 
> > > a test in LLVM. Generally there should be testing to cover where the 
> > > source change is, I think?
> > yep, there should be a test for this - added now. 
> So for the global scope, it seems like [[ 
> https://github.com/llvm-mirror/clang/blob/900624ef605b60c613342dac071228539a402ce9/lib/CodeGen/CGDebugInfo.cpp#L3274
>  | elsewhere ]], when creating the debug info for a static data member global 
> variable, the scope is set to be the global scope. But it would be helpful 
> for codeview debug info if the scope remained as the class type, partially so 
> we can use the class type information in the variable name that we emit.
> 
> Does it seem reasonable to remove the assert for global variable scope so 
> that the scope can be the class here?
I think the assertion in question is this one here in DIBuilder:
https://github.com/llvm/llvm-project/blob/master/llvm/lib/IR/DIBuilder.cpp#L634

It looks like @manmanren added this in 2014:
https://github.com/llvm/llvm-project/commit/bfd2b829d912ecd89f73ae32d4c683856dd677a3

@dblaikie do you know if this check is still necessary? It seems like the DWARF 
clang generages today corresponds to C++ written this way:
```
struct Foo { static const int Test2; };
const int Foo::Test2 = 4;
```
When oftentimes the source looks more like this:
```
struct Foo { static const int Test2 = 4; };
```
I saw a conversation between you and @probinson fixing clang irgen to avoid 
this assert sometime back, so I figured you might be a good point of reference.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62167



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


[PATCH] D60748: Fix i386 struct and union parameter alignment

2019-05-28 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

Yes, LGTM.


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

https://reviews.llvm.org/D60748



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


[PATCH] D62333: Fix unresolved symbols when linking tools/clang/unittests/Tooling/ToolingTests

2019-05-28 Thread Guanzhong Chen via Phabricator via cfe-commits
quantum marked 2 inline comments as done.
quantum added inline comments.



Comment at: cfe/trunk/unittests/Tooling/CMakeLists.txt:4
   Support
   TestingSupport
   )

thakis wrote:
> The library is already up here. Why do we need it twice?
We don't. It's removed in the code that's merged.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62333



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


[PATCH] D61742: [Driver][Windows] Add dependent lib argument for profile instr generate

2019-05-28 Thread Russell Gallop via Phabricator via cfe-commits
russell.gallop added a comment.

> I was going to suggest that maybe what we should do is just embed the 
> basename, i.e. /nodefaultlib:clang_rt.profile-x86_64.lib ...

Do you mean /defaultlib:clang_rt.profile-x86_64.lib?

> ... and then we just ask users to add one /libpath: flag to their linker 
> invocation

I'll try that. If it works, should we revisit the ubsan dependent lib support, 
to be consistent?


Repository:
  rC Clang

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

https://reviews.llvm.org/D61742



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


[PATCH] D61742: [Driver][Windows] Add dependent lib argument for profile instr generate

2019-05-28 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

In D61742#1519539 , @russell.gallop 
wrote:

> > I was going to suggest that maybe what we should do is just embed the 
> > basename, i.e. /nodefaultlib:clang_rt.profile-x86_64.lib ...
>
> Do you mean /defaultlib:clang_rt.profile-x86_64.lib?
>
> > ... and then we just ask users to add one /libpath: flag to their linker 
> > invocation
>
> I'll try that. If it works, should we revisit the ubsan dependent lib 
> support, to be consistent?


Yes, definitely. I'd like to do the same for asan, but things there are 
complicated by the various CRT linking modes.


Repository:
  rC Clang

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

https://reviews.llvm.org/D61742



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


[PATCH] D61742: [Driver][Windows] Add dependent lib argument for profile instr generate

2019-05-28 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

Since this seems to work with no-canonical-prefixes, I think this is good as-is 
since people who want build path independent builds need that flag anyway. (At 
least if Russel can reproduce it working with no-canonical-prefixes; not sure 
why it wouldn't.)


Repository:
  rC Clang

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

https://reviews.llvm.org/D61742



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


[PATCH] D61974: [ObjC] Fix encoding of ObjC pointer types that are pointers to typedefs

2019-05-28 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment.

ping


Repository:
  rC Clang

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

https://reviews.llvm.org/D61974



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


[PATCH] D62538: [clangd] Add hidden tweaks to dump AST/selection.

2019-05-28 Thread Sam McCall via Phabricator via cfe-commits
sammccall created this revision.
sammccall added a reviewer: ilya-biryukov.
Herald added subscribers: cfe-commits, kadircet, arphaman, jkorous, MaskRay, 
mgorny.
Herald added a project: clang.

This introduces a few new concepts:

- tweaks have an Intent (they don't all advertise as refactorings)
- tweaks may produce messages (for ShowMessage notification). Generalized 
Replacements -> Effect.
- tweaks (and other features) may be hidden (clangd -hidden-features flag). We 
may choose to promote these one day. I'm not sure they're worth their own 
feature flags though.

Verified it in vim-clangd (not yet open source), curious if the UI is ok in 
VSCode.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D62538

Files:
  clangd/ClangdLSPServer.cpp
  clangd/ClangdServer.cpp
  clangd/ClangdServer.h
  clangd/Protocol.cpp
  clangd/Protocol.h
  clangd/refactor/Tweak.h
  clangd/refactor/tweaks/CMakeLists.txt
  clangd/refactor/tweaks/DumpAST.cpp
  clangd/refactor/tweaks/RawStringLiteral.cpp
  clangd/refactor/tweaks/SwapIfBranches.cpp
  clangd/tool/ClangdMain.cpp
  clangd/unittests/TweakTests.cpp

Index: clangd/unittests/TweakTests.cpp
===
--- clangd/unittests/TweakTests.cpp
+++ clangd/unittests/TweakTests.cpp
@@ -16,12 +16,12 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Testing/Support/Error.h"
+#include "gmock/gmock-matchers.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 #include 
 
 using llvm::Failed;
-using llvm::HasValue;
 using llvm::Succeeded;
 
 namespace clang {
@@ -76,7 +76,8 @@
 void checkNotAvailable(StringRef ID, llvm::StringRef Input) {
   return checkAvailable(ID, Input, /*Available=*/false);
 }
-llvm::Expected apply(StringRef ID, llvm::StringRef Input) {
+
+llvm::Expected apply(StringRef ID, llvm::StringRef Input) {
   Annotations Code(Input);
   Range SelectionRng;
   if (Code.points().size() != 0) {
@@ -98,15 +99,30 @@
   auto T = prepareTweak(ID, S);
   if (!T)
 return T.takeError();
-  auto Replacements = (*T)->apply(S);
-  if (!Replacements)
-return Replacements.takeError();
-  return applyAllReplacements(Code.code(), *Replacements);
+  return (*T)->apply(S);
+}
+
+llvm::Expected applyEdit(StringRef ID, llvm::StringRef Input) {
+  auto Effect = apply(ID, Input);
+  if (!Effect)
+return Effect.takeError();
+  if (!Effect->ApplyEdit)
+return llvm::createStringError(llvm::inconvertibleErrorCode(),
+   "No replacements");
+  Annotations Code(Input);
+  return applyAllReplacements(Code.code(), *Effect->ApplyEdit);
+}
+
+std::string getMessage(StringRef ID, llvm::StringRef Input) {
+  auto Effect = apply(ID, Input);
+  if (!Effect)
+return "error: " + llvm::toString(Effect.takeError());
+  return Effect->ShowMessage.getValueOr("no message produced!");
 }
 
 void checkTransform(llvm::StringRef ID, llvm::StringRef Input,
 std::string Output) {
-  auto Result = apply(ID, Input);
+  auto Result = applyEdit(ID, Input);
   ASSERT_TRUE(bool(Result)) << llvm::toString(Result.takeError()) << Input;
   EXPECT_EQ(Output, std::string(*Result)) << Input;
 }
@@ -217,6 +233,37 @@
   checkTransform(ID, Input, Output);
 }
 
+TEST(TweakTest, DumpAST) {
+  llvm::StringLiteral ID = "DumpAST";
+
+  checkAvailable(ID, "^int f^oo() { re^turn 2 ^+ 2; }");
+  checkNotAvailable(ID, "/*c^omment*/ int foo() return 2 ^ + 2; }");
+
+  const char *Input = "int x = 2 ^+ 2;";
+  const char *Output = R"(BinaryOperator.*'\+'.*
+.*IntegerLiteral.*'int' 2.*
+.*IntegerLiteral.*'int' 2.*)";
+  EXPECT_THAT(getMessage(ID, Input), ::testing::MatchesRegex(Output));
+}
+
+TEST(TweakTest, ShowSelectionTree) {
+  llvm::StringLiteral ID = "ShowSelectionTree";
+
+  checkAvailable(ID, "^int f^oo() { re^turn 2 ^+ 2; }");
+  checkNotAvailable(ID, "/*c^omment*/ int foo() return 2 ^ + 2; }");
+
+  const char *Input = "int fcall(int); int x = fca[[ll(2 +]]2);";
+  const char *Output = R"(TranslationUnitDecl 
+  VarDecl int x = fcall(2 + 2)
+   .CallExpr fcall(2 + 2)
+  ImplicitCastExpr fcall
+   .DeclRefExpr fcall
+ .BinaryOperator 2 + 2
+   *IntegerLiteral 2
+)";
+  EXPECT_EQ(Output, getMessage(ID, Input));
+}
+
 } // namespace
 } // namespace clangd
 } // namespace clang
Index: clangd/tool/ClangdMain.cpp
===
--- clangd/tool/ClangdMain.cpp
+++ clangd/tool/ClangdMain.cpp
@@ -268,6 +268,11 @@
 "Always used text-based completion")),
 llvm::cl::init(CodeCompleteOptions().RunParser), llvm::cl::Hidden);
 
+static llvm::cl::opt HiddenFeatures(
+"hidden-features",
+llvm::cl::desc("Enable hidden features mostly useful to clangd developers"),
+llvm::cl::init(false), llvm::cl::Hidden);
+
 namespace {
 
 /// \brief Supports a test URI scheme with relaxed constraints for lit tests.
@@ -465,6 +470,7 @@
   }
   Opts.StaticIndex = StaticIdx

r361859 - Driver: support `/Zc:char8_t` and `/Zc:char8_t-`

2019-05-28 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Tue May 28 11:26:00 2019
New Revision: 361859

URL: http://llvm.org/viewvc/llvm-project?rev=361859&view=rev
Log:
Driver: support `/Zc:char8_t` and `/Zc:char8_t-`

Update the `cl` emulation to support the `/Zc:char8_t[-]?` options as per the
MSVC 2019.1 toolset.  These are aliases for `-fchar8_t` and `-fno-char8_t`.

Modified:
cfe/trunk/docs/UsersManual.rst
cfe/trunk/include/clang/Driver/CLCompatOptions.td
cfe/trunk/test/Driver/cl-options.c

Modified: cfe/trunk/docs/UsersManual.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.rst?rev=361859&r1=361858&r2=361859&view=diff
==
--- cfe/trunk/docs/UsersManual.rst (original)
+++ cfe/trunk/docs/UsersManual.rst Tue May 28 11:26:00 2019
@@ -3051,6 +3051,8 @@ Execute ``clang-cl /?`` to see a list of
   /Yc   Generate a pch file for all code up to and 
including 
   /Yu   Load a pch file and use it instead of all code 
up to and including 
   /Z7 Enable CodeView debug information in object files
+  /Zc:char8_t Enable C++2a char8_t type
+  /Zc:char8_t-Disable C++2a char8_t type
   /Zc:dllexportInlines-   Don't dllexport/dllimport inline member 
functions of dllexport/import classes
   /Zc:dllexportInlinesdllexport/dllimport inline member functions of 
dllexport/import classes (default)
   /Zc:sizedDealloc-   Disable C++14 sized global deallocation functions

Modified: cfe/trunk/include/clang/Driver/CLCompatOptions.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CLCompatOptions.td?rev=361859&r1=361858&r2=361859&view=diff
==
--- cfe/trunk/include/clang/Driver/CLCompatOptions.td (original)
+++ cfe/trunk/include/clang/Driver/CLCompatOptions.td Tue May 28 11:26:00 2019
@@ -212,6 +212,12 @@ def _SLASH_Zc_alignedNew : CLFlag<"Zc:al
 def _SLASH_Zc_alignedNew_ : CLFlag<"Zc:alignedNew-">,
   HelpText<"Disable C++17 aligned allocation functions">,
   Alias;
+def _SLASH_Zc_char8_t : CLFlag<"Zc:char8_t">,
+  HelpText<"Enable char8_t from C++2a">,
+  Alias;
+def _SLASH_Zc_char8_t_ : CLFlag<"Zc:char8_t-">,
+  HelpText<"Disable char8_t from c++2a">,
+  Alias;
 def _SLASH_Zc_strictStrings : CLFlag<"Zc:strictStrings">,
   HelpText<"Treat string literals as const">, Alias,
   AliasArgs<["error=c++11-compat-deprecated-writable-strings"]>;

Modified: cfe/trunk/test/Driver/cl-options.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=361859&r1=361858&r2=361859&view=diff
==
--- cfe/trunk/test/Driver/cl-options.c (original)
+++ cfe/trunk/test/Driver/cl-options.c Tue May 28 11:26:00 2019
@@ -326,6 +326,13 @@
 // RUN: %clang_cl -c /Zc:twoPhase -### -- %s 2>&1 | FileCheck 
-check-prefix=DELAYEDOFF %s
 // DELAYEDOFF-NOT: "-fdelayed-template-parsing"
 
+// RUN: %clang_cl -c -### /std:c++latest -- %s 2>&1 | FileCheck -check-prefix 
CHECK-LATEST-CHAR8_T %s
+// CHECK-LATEST-CHAR8_T-NOT: "-fchar8_t"
+// RUN: %clang_cl -c -### /Zc:char8_t -- %s 2>&1 | FileCheck -check-prefix 
CHECK-CHAR8_T %s
+// CHECK-CHAR8_T: "-fchar8_t"
+// RUN: %clang_cl -c -### /Zc:char8_t- -- %s 2>&1 | FileCheck -check-prefix 
CHECK-CHAR8_T_ %s
+// CHECK-CHAR8_T_: "-fno-char8_t"
+
 // For some warning ids, we can map from MSVC warning to Clang warning.
 // RUN: %clang_cl -wd4005 -wd4100 -wd4910 -wd4996 -### -- %s 2>&1 | FileCheck 
-check-prefix=Wno %s
 // Wno: "-cc1"


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


[PATCH] D62493: [Driver] Always use Unix-style paths in the Darwin driver

2019-05-28 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

So, there's nothing wrong, functionally speaking, with what we do today, right? 
It's just inconvenient to test.

The difficulty of testing the driver has been a long standing problem. I think 
we might want to instead invent some new kind of alternative to `-###` for 
writing driver tests that is more FileCheck friendly. For example, we could 
print flags one-per line, without quoting. I think it would also be reasonable 
to do some dumb string post-processing to rewrite Windows-style paths to Unix 
style paths so they always look the same.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62493



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


[PATCH] D48680: Add missing visibility annotation for __base

2019-05-28 Thread Manoj Gupta via Phabricator via cfe-commits
manojgupta added a comment.
Herald added a subscriber: libcxx-commits.

Hi Peter and Marshall,

Yunlian has moved to a different project. Can you let me know what is missing 
in this patch so that it can be submitted.


Repository:
  rCXX libc++

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

https://reviews.llvm.org/D48680



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


[PATCH] D61974: [ObjC] Fix encoding of ObjC pointer types that are pointers to typedefs

2019-05-28 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: lib/AST/ASTContext.cpp:6975
-isa(PointeeTy.getTypePtr()) &&
-!Options.EncodePointerToObjCTypedef()) {
-  // Another historical/compatibility reason.

Is this option dead now?


Repository:
  rC Clang

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

https://reviews.llvm.org/D61974



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


[PATCH] D62413: [OpenCL][PR41727] Prevent ICE on global dtors

2019-05-28 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: lib/CodeGen/CGDeclCXX.cpp:132
+  Argument = CGM.getTargetCodeGenInfo().performAddrSpaceCast(
+  CGM, Addr.getPointer(), SrcAS, LangAS::opencl_global, DestTy);
 

Should this code be conditional to OpenCL?  And why does `_cxa_atexit` take a 
`__global` pointer instead of, say, a `__generic` one?


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

https://reviews.llvm.org/D62413



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


[clang-tools-extra] r361867 - [OpenMP] Set pragma start loc to `#pragma` loc

2019-05-28 Thread Joel E. Denny via cfe-commits
Author: jdenny
Date: Tue May 28 12:27:19 2019
New Revision: 361867

URL: http://llvm.org/viewvc/llvm-project?rev=361867&view=rev
Log:
[OpenMP] Set pragma start loc to `#pragma` loc

This patch adjusts `PragmaOpenMPHandler` to set the location of
`tok::annot_pragma_openmp` to the `#pragma` location instead of the
`omp` location so that the former becomes the start location of the
OpenMP AST node.  This can be useful when, for example, rewriting a
directive using Clang's Rewrite facility.  Most of this patch updates
tests for changes to locations in diagnostics and `-ast-dump` output.

Reviewed By: ABataev, lebedev.ri, Meinersbur, aaron.ballman

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

Modified:
clang-tools-extra/trunk/test/clang-tidy/openmp-use-default-none.cpp

Modified: clang-tools-extra/trunk/test/clang-tidy/openmp-use-default-none.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/openmp-use-default-none.cpp?rev=361867&r1=361866&r2=361867&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/openmp-use-default-none.cpp 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/openmp-use-default-none.cpp Tue May 
28 12:27:19 2019
@@ -23,7 +23,7 @@ void n0(const int a) {
 void p0_0() {
 #pragma omp parallel
   ;
-  // CHECK-NOTES: :[[@LINE-2]]:9: warning: OpenMP directive 'parallel' does 
not specify 'default' clause, consider specifying 'default(none)' clause
+  // CHECK-NOTES: :[[@LINE-2]]:1: warning: OpenMP directive 'parallel' does 
not specify 'default' clause, consider specifying 'default(none)' clause
 }
 
 // 'parallel' directive can have 'default' clause, and said clause specified,
@@ -38,7 +38,7 @@ void p0_1() {
 void p0_2() {
 #pragma omp parallel default(shared)
   ;
-  // CHECK-NOTES: :[[@LINE-2]]:9: warning: OpenMP directive 'parallel' 
specifies 'default(shared)' clause, consider using 'default(none)' clause 
instead
+  // CHECK-NOTES: :[[@LINE-2]]:1: warning: OpenMP directive 'parallel' 
specifies 'default(shared)' clause, consider using 'default(none)' clause 
instead
   // CHECK-NOTES: :[[@LINE-3]]:22: note: existing 'default' clause specified 
here
 }
 
@@ -49,7 +49,7 @@ void p0_2() {
 void p1_0() {
 #pragma omp task
   ;
-  // CHECK-NOTES: :[[@LINE-2]]:9: warning: OpenMP directive 'task' does not 
specify 'default' clause, consider specifying 'default(none)' clause
+  // CHECK-NOTES: :[[@LINE-2]]:1: warning: OpenMP directive 'task' does not 
specify 'default' clause, consider specifying 'default(none)' clause
 }
 
 // 'task' directive can have 'default' clause, and said clause specified,
@@ -64,7 +64,7 @@ void p1_1() {
 void p1_2() {
 #pragma omp task default(shared)
   ;
-  // CHECK-NOTES: :[[@LINE-2]]:9: warning: OpenMP directive 'task' specifies 
'default(shared)' clause, consider using 'default(none)' clause instead
+  // CHECK-NOTES: :[[@LINE-2]]:1: warning: OpenMP directive 'task' specifies 
'default(shared)' clause, consider using 'default(none)' clause instead
   // CHECK-NOTES: :[[@LINE-3]]:18: note: existing 'default' clause specified 
here
 }
 
@@ -76,7 +76,7 @@ void p2_0() {
 #pragma omp target
 #pragma omp teams
   ;
-  // CHECK-NOTES: :[[@LINE-2]]:9: warning: OpenMP directive 'teams' does not 
specify 'default' clause, consider specifying 'default(none)' clause
+  // CHECK-NOTES: :[[@LINE-2]]:1: warning: OpenMP directive 'teams' does not 
specify 'default' clause, consider specifying 'default(none)' clause
 }
 
 // 'teams' directive can have 'default' clause, and said clause specified,
@@ -93,7 +93,7 @@ void p2_2() {
 #pragma omp target
 #pragma omp teams default(shared)
   ;
-  // CHECK-NOTES: :[[@LINE-2]]:9: warning: OpenMP directive 'teams' specifies 
'default(shared)' clause, consider using 'default(none)' clause instead
+  // CHECK-NOTES: :[[@LINE-2]]:1: warning: OpenMP directive 'teams' specifies 
'default(shared)' clause, consider using 'default(none)' clause instead
   // CHECK-NOTES: :[[@LINE-3]]:19: note: existing 'default' clause specified 
here
 }
 
@@ -105,7 +105,7 @@ void p3_0(const int a) {
 #pragma omp taskloop
   for (int b = 0; b < a; b++)
 ;
-  // CHECK-NOTES: :[[@LINE-3]]:9: warning: OpenMP directive 'taskloop' does 
not specify 'default' clause, consider specifying 'default(none)' clause
+  // CHECK-NOTES: :[[@LINE-3]]:1: warning: OpenMP directive 'taskloop' does 
not specify 'default' clause, consider specifying 'default(none)' clause
 }
 
 // 'taskloop' directive can have 'default' clause, and said clause specified,
@@ -122,7 +122,7 @@ void p3_2(const int a) {
 #pragma omp taskloop default(shared)
   for (int b = 0; b < a; b++)
 ;
-  // CHECK-NOTES: :[[@LINE-3]]:9: warning: OpenMP directive 'taskloop' 
specifies 'default(shared)' clause, consider using 'default(none)' clause 
instead
+  // CHECK-NOTES: :[[@LINE-3]]:1: warning: OpenMP directive 'taskloop' 
specifies 'default(shared)' clause, consider using 'defaul

[PATCH] D61509: [OpenMP] Set pragma start loc to `#pragma` loc

2019-05-28 Thread Joel E. Denny via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL361867: [OpenMP] Set pragma start loc to `#pragma` loc 
(authored by jdenny, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D61509?vs=198491&id=201741#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D61509

Files:
  cfe/trunk/lib/Parse/ParsePragma.cpp
  cfe/trunk/test/AST/ast-dump-openmp-atomic.c
  cfe/trunk/test/AST/ast-dump-openmp-barrier.c
  cfe/trunk/test/AST/ast-dump-openmp-cancel.c
  cfe/trunk/test/AST/ast-dump-openmp-cancellation-point.c
  cfe/trunk/test/AST/ast-dump-openmp-critical.c
  cfe/trunk/test/AST/ast-dump-openmp-distribute-parallel-for-simd.c
  cfe/trunk/test/AST/ast-dump-openmp-distribute-parallel-for.c
  cfe/trunk/test/AST/ast-dump-openmp-distribute-simd.c
  cfe/trunk/test/AST/ast-dump-openmp-distribute.c
  cfe/trunk/test/AST/ast-dump-openmp-flush.c
  cfe/trunk/test/AST/ast-dump-openmp-for-simd.c
  cfe/trunk/test/AST/ast-dump-openmp-for.c
  cfe/trunk/test/AST/ast-dump-openmp-master.c
  cfe/trunk/test/AST/ast-dump-openmp-ordered.c
  cfe/trunk/test/AST/ast-dump-openmp-parallel-for-simd.c
  cfe/trunk/test/AST/ast-dump-openmp-parallel-for.c
  cfe/trunk/test/AST/ast-dump-openmp-parallel-sections.c
  cfe/trunk/test/AST/ast-dump-openmp-parallel.c
  cfe/trunk/test/AST/ast-dump-openmp-section.c
  cfe/trunk/test/AST/ast-dump-openmp-sections.c
  cfe/trunk/test/AST/ast-dump-openmp-simd.c
  cfe/trunk/test/AST/ast-dump-openmp-single.c
  cfe/trunk/test/AST/ast-dump-openmp-target-data.c
  cfe/trunk/test/AST/ast-dump-openmp-target-enter-data.c
  cfe/trunk/test/AST/ast-dump-openmp-target-exit-data.c
  cfe/trunk/test/AST/ast-dump-openmp-target-parallel-for-simd.c
  cfe/trunk/test/AST/ast-dump-openmp-target-parallel-for.c
  cfe/trunk/test/AST/ast-dump-openmp-target-parallel.c
  cfe/trunk/test/AST/ast-dump-openmp-target-simd.c
  cfe/trunk/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for-simd.c
  cfe/trunk/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for.c
  cfe/trunk/test/AST/ast-dump-openmp-target-teams-distribute-simd.c
  cfe/trunk/test/AST/ast-dump-openmp-target-teams-distribute.c
  cfe/trunk/test/AST/ast-dump-openmp-target-teams.c
  cfe/trunk/test/AST/ast-dump-openmp-target-update.c
  cfe/trunk/test/AST/ast-dump-openmp-target.c
  cfe/trunk/test/AST/ast-dump-openmp-task.c
  cfe/trunk/test/AST/ast-dump-openmp-taskgroup.c
  cfe/trunk/test/AST/ast-dump-openmp-taskloop-simd.c
  cfe/trunk/test/AST/ast-dump-openmp-taskloop.c
  cfe/trunk/test/AST/ast-dump-openmp-taskwait.c
  cfe/trunk/test/AST/ast-dump-openmp-taskyield.c
  cfe/trunk/test/AST/ast-dump-openmp-teams-distribute-parallel-for-simd.c
  cfe/trunk/test/AST/ast-dump-openmp-teams-distribute-parallel-for.c
  cfe/trunk/test/AST/ast-dump-openmp-teams-distribute-simd.c
  cfe/trunk/test/AST/ast-dump-openmp-teams-distribute.c
  cfe/trunk/test/AST/ast-dump-openmp-teams.c
  cfe/trunk/test/AST/dump.cpp
  cfe/trunk/test/OpenMP/parallel_codegen.cpp
  cfe/trunk/test/OpenMP/threadprivate_codegen.cpp
  cfe/trunk/test/PCH/stmt-openmp_structured_block-bit.cpp
  clang-tools-extra/trunk/test/clang-tidy/openmp-use-default-none.cpp



___
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-05-28 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added inline comments.



Comment at: llvm/CMakeLists.txt:862
+# 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")

Use either "code" or English style: `s/LARGE FILE API/large-file API/;`.
Add a period to the end of the sentence.



Comment at: llvm/cmake/config-ix.cmake:27
+# Do checks with _XOPEN_SOURCE and LARGE FILE API on AIX, as we will build with
+# that too
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")

Same comment as above regarding "LARGE FILE API".
Use "because" in place of "as", and replace "that" with "those".
Add a period to the end of the sentence.



Comment at: llvm/utils/unittest/CMakeLists.txt:33
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+remove_definitions("-D_XOPEN_SOURCE=700")
+endif()

Indent only two spaces.



Comment at: llvm/utils/unittest/googletest/src/gtest-port.cc:62
 #if GTEST_OS_AIX
+#define _ALL_SOURCE
 # include 

It's generally a bad idea to define such macros after system headers have 
already been included.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62533



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


[PATCH] D58418: [clang][DirectoryWatcher] Upstream DirectoryWatcher

2019-05-28 Thread Jan Korous via Phabricator via cfe-commits
jkorous updated this revision to Diff 201744.
jkorous added a comment.

Remove DirectoryWatcher::Event::EventKind::Added


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

https://reviews.llvm.org/D58418

Files:
  clang/include/clang/DirectoryWatcher/DirectoryWatcher.h
  clang/lib/CMakeLists.txt
  clang/lib/DirectoryWatcher/CMakeLists.txt
  clang/lib/DirectoryWatcher/DirectoryScanner.cpp
  clang/lib/DirectoryWatcher/DirectoryScanner.h
  clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
  clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
  clang/unittests/CMakeLists.txt
  clang/unittests/DirectoryWatcher/CMakeLists.txt
  clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp

Index: clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp
===
--- /dev/null
+++ clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp
@@ -0,0 +1,425 @@
+//===- unittests/DirectoryWatcher/DirectoryWatcherTest.cpp ===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "clang/DirectoryWatcher/DirectoryWatcher.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Mutex.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/raw_ostream.h"
+#include "gtest/gtest.h"
+#include 
+#include 
+#include 
+#include 
+
+using namespace llvm;
+using namespace llvm::sys;
+using namespace llvm::sys::fs;
+using namespace clang;
+
+namespace clang {
+static bool operator==(const DirectoryWatcher::Event &lhs,
+   const DirectoryWatcher::Event &rhs) {
+  return lhs.Filename == rhs.Filename &&
+ static_cast(lhs.Kind) == static_cast(rhs.Kind);
+}
+} // namespace clang
+
+namespace {
+
+struct DirectoryWatcherTestFixture {
+  std::string TestRootDir;
+  std::string TestWatchedDir;
+
+  DirectoryWatcherTestFixture() {
+SmallString<128> pathBuf;
+std::error_code UniqDirRes = createUniqueDirectory("dirwatcher", pathBuf);
+assert(!UniqDirRes);
+TestRootDir = pathBuf.str();
+path::append(pathBuf, "watch");
+TestWatchedDir = pathBuf.str();
+std::error_code CreateDirRes = create_directory(TestWatchedDir, false);
+assert(!CreateDirRes);
+  }
+
+  ~DirectoryWatcherTestFixture() { remove_directories(TestRootDir); }
+
+  SmallString<128> getPathInWatched(const std::string &testFile) {
+SmallString<128> pathBuf;
+pathBuf = TestWatchedDir;
+path::append(pathBuf, testFile);
+return pathBuf;
+  }
+
+  void addFile(const std::string &testFile) {
+Expected ft = openNativeFileForWrite(getPathInWatched(testFile),
+ CD_CreateNew, OF_None);
+if (ft) {
+  closeFile(*ft);
+} else {
+  llvm::errs() << llvm::toString(ft.takeError()) << "\n";
+  llvm::errs() << getPathInWatched(testFile) << "\n";
+  llvm_unreachable("Couldn't create test file.");
+}
+  }
+
+  void deleteFile(const std::string &testFile) {
+std::error_code EC =
+remove(getPathInWatched(testFile), /*IgnoreNonExisting=*/false);
+ASSERT_FALSE(EC);
+  }
+};
+
+std::string EventKindToString(const DirectoryWatcher::Event::EventKind K) {
+  switch (K) {
+  case DirectoryWatcher::Event::EventKind::Removed:
+return "Removed";
+  case DirectoryWatcher::Event::EventKind::Modified:
+return "Modified";
+  case DirectoryWatcher::Event::EventKind::WatchedDirRemoved:
+return "WatchedDirRemoved";
+  case DirectoryWatcher::Event::EventKind::WatcherGotInvalidated:
+return "WatcherGotInvalidated";
+  }
+  llvm_unreachable("unknown event kind");
+}
+
+struct VerifyingConsumer {
+  std::vector ExpectedInitial;
+  std::vector ExpectedNonInitial;
+  std::vector OptionalNonInitial;
+  std::vector UnexpectedInitial;
+  std::vector UnexpectedNonInitial;
+  std::mutex Mtx;
+  std::condition_variable ResultIsReady;
+
+  VerifyingConsumer(
+  const std::vector &ExpectedInitial,
+  const std::vector &ExpectedNonInitial,
+  const std::vector &OptionalNonInitial = {})
+  : ExpectedInitial(ExpectedInitial),
+ExpectedNonInitial(ExpectedNonInitial),
+OptionalNonInitial(OptionalNonInitial) {}
+
+  // This method is used by DirectoryWatcher
+  void consume(DirectoryWatcher::Event E, bool IsInitial) {
+if (IsInitial)
+  consumeInitial(E);
+else
+  consumeNonInitial(E);
+  }
+
+  void consumeInitial(DirectoryWatcher::Event E) {
+std::unique_lock L(Mtx);
+auto It = std::find(ExpectedInitial.begin(), ExpectedInitial.end(), E);
+if (It == ExpectedInitial.end()) {
+  UnexpectedInitial.push_back(E);
+} else {
+  ExpectedInitial.erase(It);
+}
+if (Result())
+  ResultIsReady.notify_one();
+  }
+
+  void cons

[PATCH] D62525: [Analyzer] Add new visitor to the iterator checkers

2019-05-28 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

In D62525#1519475 , 
@baloghadamsoftware wrote:

> Before someone asks: `NoteTag`s are not applicable here since invalidation 
> and reaching one end of the range happens in many different places. This is 
> also true for container emptiness.


Mm, what's wrong with many different places? If you're worried about code 
duplication, just put tag construction into a function (?)




Comment at: lib/StaticAnalyzer/Checkers/IteratorChecker.cpp:281-282
+
+  // `FoundChange` becomes true when we find the statement the results in the
+  // current state of the iterator.
+  // `FoundEmptyness` becomes true when we find the block edge assuming

I don't think we should stop here. I think it's worth it to highlight *all* 
increments and decrements of the interesting iterator, so that it was clear how 
come that it has the given value.

Additionally, because iterators are copied around, it makes sense to 
"recursively" apply the visitor to the original object when the iterator is 
obtained as a copy (similarly to how `trackExpressionValue` works).


Repository:
  rC Clang

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

https://reviews.llvm.org/D62525



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


[PATCH] D61809: [BPF] Preserve debuginfo array/union/struct type/access index

2019-05-28 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment.

@rsmith @eli.friedman Do you have any comments on the clang intrinsic interface 
in this patch and the llvm intrinsics interface at 
https://reviews.llvm.org/D61810?


Repository:
  rC Clang

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

https://reviews.llvm.org/D61809



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


[PATCH] D48680: Add missing visibility annotation for __base

2019-05-28 Thread Louis Dionne via Phabricator via cfe-commits
ldionne added a comment.

What I don't understand is under which circumstances this changes anything, 
since we don't export `__base` from the dylib, and implicit instantiations of 
`__base` don't cause it to be exported. Can you please provide a sample program 
where this changes what's exported, or the LTO visibility you're mentioning?


Repository:
  rCXX libc++

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

https://reviews.llvm.org/D48680



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


[PATCH] D59253: [AIX][libcxx] AIX system headers need stdint.h and inttypes.h to be re-enterable when macro _STD_TYPES_T is defined

2019-05-28 Thread Xing Xue via Phabricator via cfe-commits
xingxue updated this revision to Diff 201746.
xingxue added a comment.

Updated comments explaining the scenario of the changes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59253

Files:
  clang/lib/Headers/inttypes.h
  clang/lib/Headers/stdint.h
  libcxx/include/inttypes.h
  libcxx/include/stdint.h
  libcxx/test/std/depr/depr.c.headers/stdint_h.sh.cpp

Index: libcxx/test/std/depr/depr.c.headers/stdint_h.sh.cpp
===
--- /dev/null
+++ libcxx/test/std/depr/depr.c.headers/stdint_h.sh.cpp
@@ -0,0 +1,268 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// AIX system headers need stdint.h to be re-enterable when macro _STD_TYPES_T
+// is defined. This test case tests that after including sys/types.h which
+// defines macro _STD_TYPES_T, includes stdint.h, and then undefines
+// _STD_TYPES_T, stdint.h can be entered to get to macros like UINT32_MAX.
+//
+// REQUIRES: aix
+// RUN: %compile -c
+// RUN: %compile -c -D_XOPEN_SOURCE=700
+
+// test 
+//
+// Test that limits macros are available when  is included with
+// or without macro _XOPEN_SOUECE=700.
+
+#include 
+#include 
+
+#ifndef INT8_MIN
+#error INT8_MIN not defined
+#endif
+
+#ifndef INT16_MIN
+#error INT16_MIN not defined
+#endif
+
+#ifndef INT32_MIN
+#error INT32_MIN not defined
+#endif
+
+#ifndef INT64_MIN
+#error INT64_MIN not defined
+#endif
+
+#ifndef INT8_MAX
+#error INT8_MAX not defined
+#endif
+
+#ifndef INT16_MAX
+#error INT16_MAX not defined
+#endif
+
+#ifndef INT32_MAX
+#error INT32_MAX not defined
+#endif
+
+#ifndef INT64_MAX
+#error INT64_MAX not defined
+#endif
+
+#ifndef UINT8_MAX
+#error UINT8_MAX not defined
+#endif
+
+#ifndef UINT16_MAX
+#error UINT16_MAX not defined
+#endif
+
+#ifndef UINT32_MAX
+#error UINT32_MAX not defined
+#endif
+
+#ifndef UINT64_MAX
+#error UINT64_MAX not defined
+#endif
+
+#ifndef INT_LEAST8_MIN
+#error INT_LEAST8_MIN not defined
+#endif
+
+#ifndef INT_LEAST16_MIN
+#error INT_LEAST16_MIN not defined
+#endif
+
+#ifndef INT_LEAST32_MIN
+#error INT_LEAST32_MIN not defined
+#endif
+
+#ifndef INT_LEAST64_MIN
+#error INT_LEAST64_MIN not defined
+#endif
+
+#ifndef INT_LEAST8_MAX
+#error INT_LEAST8_MAX not defined
+#endif
+
+#ifndef INT_LEAST16_MAX
+#error INT_LEAST16_MAX not defined
+#endif
+
+#ifndef INT_LEAST32_MAX
+#error INT_LEAST32_MAX not defined
+#endif
+
+#ifndef INT_LEAST64_MAX
+#error INT_LEAST64_MAX not defined
+#endif
+
+#ifndef UINT_LEAST8_MAX
+#error UINT_LEAST8_MAX not defined
+#endif
+
+#ifndef UINT_LEAST16_MAX
+#error UINT_LEAST16_MAX not defined
+#endif
+
+#ifndef UINT_LEAST32_MAX
+#error UINT_LEAST32_MAX not defined
+#endif
+
+#ifndef UINT_LEAST64_MAX
+#error UINT_LEAST64_MAX not defined
+#endif
+
+#ifndef INT_FAST8_MIN
+#error INT_FAST8_MIN not defined
+#endif
+
+#ifndef INT_FAST16_MIN
+#error INT_FAST16_MIN not defined
+#endif
+
+#ifndef INT_FAST32_MIN
+#error INT_FAST32_MIN not defined
+#endif
+
+#ifndef INT_FAST64_MIN
+#error INT_FAST64_MIN not defined
+#endif
+
+#ifndef INT_FAST8_MAX
+#error INT_FAST8_MAX not defined
+#endif
+
+#ifndef INT_FAST16_MAX
+#error INT_FAST16_MAX not defined
+#endif
+
+#ifndef INT_FAST32_MAX
+#error INT_FAST32_MAX not defined
+#endif
+
+#ifndef INT_FAST64_MAX
+#error INT_FAST64_MAX not defined
+#endif
+
+#ifndef UINT_FAST8_MAX
+#error UINT_FAST8_MAX not defined
+#endif
+
+#ifndef UINT_FAST16_MAX
+#error UINT_FAST16_MAX not defined
+#endif
+
+#ifndef UINT_FAST32_MAX
+#error UINT_FAST32_MAX not defined
+#endif
+
+#ifndef UINT_FAST64_MAX
+#error UINT_FAST64_MAX not defined
+#endif
+
+#ifndef INTPTR_MIN
+#error INTPTR_MIN not defined
+#endif
+
+#ifndef INTPTR_MAX
+#error INTPTR_MAX not defined
+#endif
+
+#ifndef UINTPTR_MAX
+#error UINTPTR_MAX not defined
+#endif
+
+#ifndef INTMAX_MIN
+#error INTMAX_MIN not defined
+#endif
+
+#ifndef INTMAX_MAX
+#error INTMAX_MAX not defined
+#endif
+
+#ifndef UINTMAX_MAX
+#error UINTMAX_MAX not defined
+#endif
+
+#ifndef PTRDIFF_MIN
+#error PTRDIFF_MIN not defined
+#endif
+
+#ifndef PTRDIFF_MAX
+#error PTRDIFF_MAX not defined
+#endif
+
+#ifndef SIG_ATOMIC_MIN
+#error SIG_ATOMIC_MIN not defined
+#endif
+
+#ifndef SIG_ATOMIC_MAX
+#error SIG_ATOMIC_MAX not defined
+#endif
+
+#ifndef SIZE_MAX
+#error SIZE_MAX not defined
+#endif
+
+#ifndef WCHAR_MIN
+#error WCHAR_MIN not defined
+#endif
+
+#ifndef WCHAR_MAX
+#error WCHAR_MAX not defined
+#endif
+
+#ifndef WINT_MIN
+#error WINT_MIN not defined
+#endif
+
+#ifndef WINT_MAX
+#error WINT_MAX not defined
+#endif
+
+#ifndef INT8_C
+#error INT8_C not defined
+#endif
+
+#ifndef INT16_C
+#error INT16_C not defined
+#endif
+
+#i

  1   2   >