[PATCH] D57219: [Fixed Point Arithmetic] Fixed Point Comparisons

2019-01-30 Thread Bjorn Pettersson via Phabricator via cfe-commits
bjope added inline comments.



Comment at: clang/test/Frontend/fixed_point_comparisons.c:2
+// RUN: %clang_cc1 -ffixed-point -triple x86_64-unknown-linux-gnu -S 
-emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,SIGNED
+// RUN: %clang_cc1 -ffixed-point -triple x86_64-unknown-linux-gnu 
-fpadding-on-unsigned-fixed-point -S -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=CHECK,UNSIGNED
+

I think it is easier to understand the checks if you for example use 
UNPADDED/PADDED (or STUDDED/PADDED or something like that) instead of 
SIGNED/UNSIGNED.


Repository:
  rC Clang

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

https://reviews.llvm.org/D57219



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


r352610 - [clang] [Driver] [NetBSD] Append -rpath for shared compiler-rt runtimes

2019-01-30 Thread Michal Gorny via cfe-commits
Author: mgorny
Date: Wed Jan 30 00:20:24 2019
New Revision: 352610

URL: http://llvm.org/viewvc/llvm-project?rev=352610&view=rev
Log:
[clang] [Driver] [NetBSD] Append -rpath for shared compiler-rt runtimes

Append appropriate -rpath when using shared compiler-rt runtimes,
e.g. '-fsanitize=address -shared-libasan'.  There's already a similar
logic in CommonArgs.cpp but it uses non-standard arch-suffixed
installation directory while we want our driver to work with standard
installation paths.

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

Modified:
cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp?rev=352610&r1=352609&r2=352610&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp Wed Jan 30 00:20:24 2019
@@ -255,6 +255,13 @@ void netbsd::Linker::ConstructJob(Compil
   bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs);
   AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA);
 
+  const SanitizerArgs &SanArgs = ToolChain.getSanitizerArgs();
+  if (SanArgs.needsSharedRt()) {
+CmdArgs.push_back("-rpath");
+CmdArgs.push_back(Args.MakeArgString(
+ToolChain.getCompilerRTPath().c_str()));
+  }
+
   unsigned Major, Minor, Micro;
   ToolChain.getTriple().getOSVersion(Major, Minor, Micro);
   bool useLibgcc = true;


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


[PATCH] D56554: [ELF] Add '-z nognustack' opt to suppress emitting PT_GNU_STACK

2019-01-30 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

> This segment is not supported at all on NetBSD (stack is always 
> non-executable), and the option is meant to be used to disable emitting it.

The string `.note.GNU-stack` takes only a few bytes in `.shstrtab` and a few 
for an `Elf64_Shdr` instance. Are there any tools warning about unknown section 
`.note.GNU-stack` on NetBSD?


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

https://reviews.llvm.org/D56554



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


[PATCH] D57303: [ToolChains] [NetBSD] Append -rpath for shared compiler-rt runtimes

2019-01-30 Thread Michał Górny via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL352610: [clang] [Driver] [NetBSD] Append -rpath for shared 
compiler-rt runtimes (authored by mgorny, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D57303?vs=183758&id=184253#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D57303

Files:
  cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp


Index: cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp
+++ cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp
@@ -255,6 +255,13 @@
   bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs);
   AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA);
 
+  const SanitizerArgs &SanArgs = ToolChain.getSanitizerArgs();
+  if (SanArgs.needsSharedRt()) {
+CmdArgs.push_back("-rpath");
+CmdArgs.push_back(Args.MakeArgString(
+ToolChain.getCompilerRTPath().c_str()));
+  }
+
   unsigned Major, Minor, Micro;
   ToolChain.getTriple().getOSVersion(Major, Minor, Micro);
   bool useLibgcc = true;


Index: cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp
+++ cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp
@@ -255,6 +255,13 @@
   bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs);
   AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA);
 
+  const SanitizerArgs &SanArgs = ToolChain.getSanitizerArgs();
+  if (SanArgs.needsSharedRt()) {
+CmdArgs.push_back("-rpath");
+CmdArgs.push_back(Args.MakeArgString(
+ToolChain.getCompilerRTPath().c_str()));
+  }
+
   unsigned Major, Minor, Micro;
   ToolChain.getTriple().getOSVersion(Major, Minor, Micro);
   bool useLibgcc = true;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D56554: [ELF] Add '-z nognustack' opt to suppress emitting PT_GNU_STACK

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

Besides our verbose purists? Not that I'm aware of.


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

https://reviews.llvm.org/D56554



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


Re: [clang-tools-extra] r352494 - [clangd] Interfaces for writing code tweaks

2019-01-30 Thread Mikael Holmén via cfe-commits
Hi Ilya,

I've no idea why, but when I compile this commit with gcc (7.4.0) the 
test fixits-command.test fails, and the output from clangd is rather 
different from when I compile it with clang (3.6.0).

So I run

build-all/bin/clangd -lit-test < 
/data/repo/master/llvm-master/tools/clang/tools/extra/test/clangd/fixits-command.test

and the first diff that I think is significant is that with gcc it says

E[09:44:29.470] error while getting semantic code actions: -32602: 
trying to get AST for non-added document

Before this patch the output from gcc and clang built clangd is identical.

Attaching logs with gcc and clang.

Any idea what the problem is?

Regards,
Mikael

On 1/29/19 3:17 PM, Ilya Biryukov via cfe-commits wrote:
> Author: ibiryukov
> Date: Tue Jan 29 06:17:36 2019
> New Revision: 352494
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=352494&view=rev
> Log:
> [clangd] Interfaces for writing code tweaks
> 
> Summary:
> The code tweaks are an implementation of mini-refactorings exposed
> via the LSP code actions. They run in two stages:
>- Stage 1. Decides whether the action is available to the user and
>  collects all the information required to finish the action.
>  Should be cheap, since this will run over all the actions known to
>  clangd on each textDocument/codeAction request from the client.
> 
>- Stage 2. Uses information from stage 1 to produce the actual edits
>  that the code action should perform. This stage can be expensive and
>  will only run if the user chooses to perform the specified action in
>  the UI.
> 
> One unfortunate consequence of this change is increased latency of
> processing the textDocument/codeAction requests, which now wait for an
> AST. However, we cannot avoid this with what we have available in the LSP
> today.
> 
> Reviewers: kadircet, ioeric, hokein, sammccall
> 
> Reviewed By: sammccall
> 
> Subscribers: mgrang, mgorny, MaskRay, jkorous, arphaman, cfe-commits
> 
> Differential Revision: https://reviews.llvm.org/D56267
> 
> Added:
>  clang-tools-extra/trunk/clangd/refactor/
>  clang-tools-extra/trunk/clangd/refactor/Tweak.cpp
>  clang-tools-extra/trunk/clangd/refactor/Tweak.h
>  clang-tools-extra/trunk/clangd/refactor/tweaks/
>  clang-tools-extra/trunk/clangd/refactor/tweaks/CMakeLists.txt
>  clang-tools-extra/trunk/clangd/refactor/tweaks/Dummy.cpp
> Modified:
>  clang-tools-extra/trunk/clangd/CMakeLists.txt
>  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/Protocol.h
>  clang-tools-extra/trunk/clangd/SourceCode.cpp
>  clang-tools-extra/trunk/clangd/SourceCode.h
>  clang-tools-extra/trunk/clangd/tool/CMakeLists.txt
>  clang-tools-extra/trunk/test/clangd/fixits-command.test
>  clang-tools-extra/trunk/test/clangd/initialize-params.test
> 
> Modified: clang-tools-extra/trunk/clangd/CMakeLists.txt
> URL: 
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CMakeLists.txt?rev=352494&r1=352493&r2=352494&view=diff
> ==
> --- clang-tools-extra/trunk/clangd/CMakeLists.txt (original)
> +++ clang-tools-extra/trunk/clangd/CMakeLists.txt Tue Jan 29 06:17:36 2019
> @@ -71,6 +71,8 @@ add_clang_library(clangDaemon
> index/dex/PostingList.cpp
> index/dex/Trigram.cpp
>   
> +  refactor/Tweak.cpp
> +
> LINK_LIBS
> clangAST
> clangASTMatchers
> @@ -108,6 +110,7 @@ add_clang_library(clangDaemon
> ${CLANGD_ATOMIC_LIB}
> )
>   
> +add_subdirectory(refactor/tweaks)
>   if( LLVM_LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE )
> add_subdirectory(fuzzer)
>   endif()
> 
> Modified: clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp?rev=352494&r1=352493&r2=352494&view=diff
> ==
> --- clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp (original)
> +++ clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp Tue Jan 29 06:17:36 
> 2019
> @@ -8,11 +8,14 @@
>   
>   #include "ClangdLSPServer.h"
>   #include "Diagnostics.h"
> +#include "Protocol.h"
>   #include "SourceCode.h"
>   #include "Trace.h"
>   #include "URI.h"
> +#include "clang/Tooling/Core/Replacement.h"
>   #include "llvm/ADT/ScopeExit.h"
>   #include "llvm/Support/Errc.h"
> +#include "llvm/Support/Error.h"
>   #include "llvm/Support/FormatVariadic.h"
>   #include "llvm/Support/Path.h"
>   #include "llvm/Support/ScopedPrinter.h"
> @@ -30,6 +33,28 @@ public:
> }
>   };
>   
> +/// Transforms a tweak into a code action that would apply it if executed.
> +/// EXPECTS: T.prepare() was called and returned true.
> +CodeAction toCodeAction(const ClangdServer::

Re: [clang-tools-extra] r352494 - [clangd] Interfaces for writing code tweaks

2019-01-30 Thread Ilya Biryukov via cfe-commits
Hi Mikael,

I suspect an undefined value creeps in for protocol capabilities, given
that we have responses in different formats.
I'll investigate, thanks for the report!

On Wed, Jan 30, 2019 at 12:05 PM Mikael Holmén 
wrote:

> Hi Ilya,
>
> I've no idea why, but when I compile this commit with gcc (7.4.0) the
> test fixits-command.test fails, and the output from clangd is rather
> different from when I compile it with clang (3.6.0).
>
> So I run
>
> build-all/bin/clangd -lit-test <
>
> /data/repo/master/llvm-master/tools/clang/tools/extra/test/clangd/fixits-command.test
>
> and the first diff that I think is significant is that with gcc it says
>
> E[09:44:29.470] error while getting semantic code actions: -32602:
> trying to get AST for non-added document
>
> Before this patch the output from gcc and clang built clangd is identical.
>
> Attaching logs with gcc and clang.
>
> Any idea what the problem is?
>
> Regards,
> Mikael
>
> On 1/29/19 3:17 PM, Ilya Biryukov via cfe-commits wrote:
> > Author: ibiryukov
> > Date: Tue Jan 29 06:17:36 2019
> > New Revision: 352494
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=352494&view=rev
> > Log:
> > [clangd] Interfaces for writing code tweaks
> >
> > Summary:
> > The code tweaks are an implementation of mini-refactorings exposed
> > via the LSP code actions. They run in two stages:
> >- Stage 1. Decides whether the action is available to the user and
> >  collects all the information required to finish the action.
> >  Should be cheap, since this will run over all the actions known to
> >  clangd on each textDocument/codeAction request from the client.
> >
> >- Stage 2. Uses information from stage 1 to produce the actual edits
> >  that the code action should perform. This stage can be expensive and
> >  will only run if the user chooses to perform the specified action in
> >  the UI.
> >
> > One unfortunate consequence of this change is increased latency of
> > processing the textDocument/codeAction requests, which now wait for an
> > AST. However, we cannot avoid this with what we have available in the LSP
> > today.
> >
> > Reviewers: kadircet, ioeric, hokein, sammccall
> >
> > Reviewed By: sammccall
> >
> > Subscribers: mgrang, mgorny, MaskRay, jkorous, arphaman, cfe-commits
> >
> > Differential Revision: https://reviews.llvm.org/D56267
> >
> > Added:
> >  clang-tools-extra/trunk/clangd/refactor/
> >  clang-tools-extra/trunk/clangd/refactor/Tweak.cpp
> >  clang-tools-extra/trunk/clangd/refactor/Tweak.h
> >  clang-tools-extra/trunk/clangd/refactor/tweaks/
> >  clang-tools-extra/trunk/clangd/refactor/tweaks/CMakeLists.txt
> >  clang-tools-extra/trunk/clangd/refactor/tweaks/Dummy.cpp
> > Modified:
> >  clang-tools-extra/trunk/clangd/CMakeLists.txt
> >  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/Protocol.h
> >  clang-tools-extra/trunk/clangd/SourceCode.cpp
> >  clang-tools-extra/trunk/clangd/SourceCode.h
> >  clang-tools-extra/trunk/clangd/tool/CMakeLists.txt
> >  clang-tools-extra/trunk/test/clangd/fixits-command.test
> >  clang-tools-extra/trunk/test/clangd/initialize-params.test
> >
> > Modified: clang-tools-extra/trunk/clangd/CMakeLists.txt
> > URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CMakeLists.txt?rev=352494&r1=352493&r2=352494&view=diff
> >
> ==
> > --- clang-tools-extra/trunk/clangd/CMakeLists.txt (original)
> > +++ clang-tools-extra/trunk/clangd/CMakeLists.txt Tue Jan 29 06:17:36
> 2019
> > @@ -71,6 +71,8 @@ add_clang_library(clangDaemon
> > index/dex/PostingList.cpp
> > index/dex/Trigram.cpp
> >
> > +  refactor/Tweak.cpp
> > +
> > LINK_LIBS
> > clangAST
> > clangASTMatchers
> > @@ -108,6 +110,7 @@ add_clang_library(clangDaemon
> > ${CLANGD_ATOMIC_LIB}
> > )
> >
> > +add_subdirectory(refactor/tweaks)
> >   if( LLVM_LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE )
> > add_subdirectory(fuzzer)
> >   endif()
> >
> > Modified: clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp?rev=352494&r1=352493&r2=352494&view=diff
> >
> ==
> > --- clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp (original)
> > +++ clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp Tue Jan 29
> 06:17:36 2019
> > @@ -8,11 +8,14 @@
> >
> >   #include "ClangdLSPServer.h"
> >   #include "Diagnostics.h"
> > +#include "Protocol.h"
> >   #include "SourceCode.h"
> >   #include "Trace.h"
> >   #include "URI.h"
> > +#include "clang/Tooling/Core/Replacement.h"
> >   #include "llvm/ADT/Scope

[PATCH] D52150: [clang-format] BeforeHash added to IndentPPDirectives

2019-01-30 Thread Geza Geleji via Phabricator via cfe-commits
geleji added a comment.

I would find this useful too.


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

https://reviews.llvm.org/D52150



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


[clang-tools-extra] r352612 - [clangd] Fix a use after move

2019-01-30 Thread Ilya Biryukov via cfe-commits
Author: ibiryukov
Date: Wed Jan 30 01:39:01 2019
New Revision: 352612

URL: http://llvm.org/viewvc/llvm-project?rev=352612&view=rev
Log:
[clangd] Fix a use after move

Introduced in r352494.

Modified:
clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp

Modified: clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp?rev=352612&r1=352611&r2=352612&view=diff
==
--- clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp Wed Jan 30 01:39:01 2019
@@ -697,8 +697,8 @@ void ClangdLSPServer::onCodeAction(const
   };
 
   Server->enumerateTweaks(File.file(), Params.range,
-  Bind(ConsumeActions, std::move(Reply),
-   std::move(File), std::move(*Code), Params.range,
+  Bind(ConsumeActions, std::move(Reply), File,
+   std::move(*Code), Params.range,
std::move(FixIts)));
 }
 


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


[PATCH] D57325: [clangd] Collect macros in static index.

2019-01-30 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added inline comments.



Comment at: unittests/clangd/BackgroundIndexTests.cpp:128
   runFuzzyFind(Idx, ""),
   UnorderedElementsAre(Named("common"), Named("A_CC"), Named("g"),
AllOf(Named("f_b"), Declared(), Not(Defined();

Shouldn't we also have `Named("A")` in here ?


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D57325



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


Re: [clang-tools-extra] r352494 - [clangd] Interfaces for writing code tweaks

2019-01-30 Thread Ilya Biryukov via cfe-commits
Should be fixed by r352612, let me know if it pops up again.
This was a use after move, probably gcc and clang prefer different
evaluation order, hence the difference in behaviours.

On Wed, Jan 30, 2019 at 12:12 PM Ilya Biryukov  wrote:

> Hi Mikael,
>
> I suspect an undefined value creeps in for protocol capabilities, given
> that we have responses in different formats.
> I'll investigate, thanks for the report!
>
> On Wed, Jan 30, 2019 at 12:05 PM Mikael Holmén 
> wrote:
>
>> Hi Ilya,
>>
>> I've no idea why, but when I compile this commit with gcc (7.4.0) the
>> test fixits-command.test fails, and the output from clangd is rather
>> different from when I compile it with clang (3.6.0).
>>
>> So I run
>>
>> build-all/bin/clangd -lit-test <
>>
>> /data/repo/master/llvm-master/tools/clang/tools/extra/test/clangd/fixits-command.test
>>
>> and the first diff that I think is significant is that with gcc it says
>>
>> E[09:44:29.470] error while getting semantic code actions: -32602:
>> trying to get AST for non-added document
>>
>> Before this patch the output from gcc and clang built clangd is identical.
>>
>> Attaching logs with gcc and clang.
>>
>> Any idea what the problem is?
>>
>> Regards,
>> Mikael
>>
>> On 1/29/19 3:17 PM, Ilya Biryukov via cfe-commits wrote:
>> > Author: ibiryukov
>> > Date: Tue Jan 29 06:17:36 2019
>> > New Revision: 352494
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=352494&view=rev
>> > Log:
>> > [clangd] Interfaces for writing code tweaks
>> >
>> > Summary:
>> > The code tweaks are an implementation of mini-refactorings exposed
>> > via the LSP code actions. They run in two stages:
>> >- Stage 1. Decides whether the action is available to the user and
>> >  collects all the information required to finish the action.
>> >  Should be cheap, since this will run over all the actions known to
>> >  clangd on each textDocument/codeAction request from the client.
>> >
>> >- Stage 2. Uses information from stage 1 to produce the actual edits
>> >  that the code action should perform. This stage can be expensive
>> and
>> >  will only run if the user chooses to perform the specified action
>> in
>> >  the UI.
>> >
>> > One unfortunate consequence of this change is increased latency of
>> > processing the textDocument/codeAction requests, which now wait for an
>> > AST. However, we cannot avoid this with what we have available in the
>> LSP
>> > today.
>> >
>> > Reviewers: kadircet, ioeric, hokein, sammccall
>> >
>> > Reviewed By: sammccall
>> >
>> > Subscribers: mgrang, mgorny, MaskRay, jkorous, arphaman, cfe-commits
>> >
>> > Differential Revision: https://reviews.llvm.org/D56267
>> >
>> > Added:
>> >  clang-tools-extra/trunk/clangd/refactor/
>> >  clang-tools-extra/trunk/clangd/refactor/Tweak.cpp
>> >  clang-tools-extra/trunk/clangd/refactor/Tweak.h
>> >  clang-tools-extra/trunk/clangd/refactor/tweaks/
>> >  clang-tools-extra/trunk/clangd/refactor/tweaks/CMakeLists.txt
>> >  clang-tools-extra/trunk/clangd/refactor/tweaks/Dummy.cpp
>> > Modified:
>> >  clang-tools-extra/trunk/clangd/CMakeLists.txt
>> >  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/Protocol.h
>> >  clang-tools-extra/trunk/clangd/SourceCode.cpp
>> >  clang-tools-extra/trunk/clangd/SourceCode.h
>> >  clang-tools-extra/trunk/clangd/tool/CMakeLists.txt
>> >  clang-tools-extra/trunk/test/clangd/fixits-command.test
>> >  clang-tools-extra/trunk/test/clangd/initialize-params.test
>> >
>> > Modified: clang-tools-extra/trunk/clangd/CMakeLists.txt
>> > URL:
>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CMakeLists.txt?rev=352494&r1=352493&r2=352494&view=diff
>> >
>> ==
>> > --- clang-tools-extra/trunk/clangd/CMakeLists.txt (original)
>> > +++ clang-tools-extra/trunk/clangd/CMakeLists.txt Tue Jan 29 06:17:36
>> 2019
>> > @@ -71,6 +71,8 @@ add_clang_library(clangDaemon
>> > index/dex/PostingList.cpp
>> > index/dex/Trigram.cpp
>> >
>> > +  refactor/Tweak.cpp
>> > +
>> > LINK_LIBS
>> > clangAST
>> > clangASTMatchers
>> > @@ -108,6 +110,7 @@ add_clang_library(clangDaemon
>> > ${CLANGD_ATOMIC_LIB}
>> > )
>> >
>> > +add_subdirectory(refactor/tweaks)
>> >   if( LLVM_LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE )
>> > add_subdirectory(fuzzer)
>> >   endif()
>> >
>> > Modified: clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
>> > URL:
>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp?rev=352494&r1=352493&r2=352494&view=diff
>> >
>> ==
>> > --- clang-tools-extra/trunk/clangd/ClangdLSPServer.c

Re: [clang-tools-extra] r352494 - [clangd] Interfaces for writing code tweaks

2019-01-30 Thread Mikael Holmén via cfe-commits


On 1/30/19 10:41 AM, Ilya Biryukov wrote:
> Should be fixed by r352612, let me know if it pops up again.
> This was a use after move, probably gcc and clang prefer different 
> evaluation order, hence the difference in behaviours.

Awesome! Now it passes also when I compile with gcc.

Thanks,
Mikael

> 
> On Wed, Jan 30, 2019 at 12:12 PM Ilya Biryukov  > wrote:
> 
> Hi Mikael,
> 
> I suspect an undefined value creeps in for protocol capabilities,
> given that we have responses in different formats.
> I'll investigate, thanks for the report!
> 
> On Wed, Jan 30, 2019 at 12:05 PM Mikael Holmén
> mailto:mikael.hol...@ericsson.com>> wrote:
> 
> Hi Ilya,
> 
> I've no idea why, but when I compile this commit with gcc
> (7.4.0) the
> test fixits-command.test fails, and the output from clangd is
> rather
> different from when I compile it with clang (3.6.0).
> 
> So I run
> 
> build-all/bin/clangd -lit-test <
> 
> /data/repo/master/llvm-master/tools/clang/tools/extra/test/clangd/fixits-command.test
> 
> and the first diff that I think is significant is that with gcc
> it says
> 
> E[09:44:29.470] error while getting semantic code actions: -32602:
> trying to get AST for non-added document
> 
> Before this patch the output from gcc and clang built clangd is
> identical.
> 
> Attaching logs with gcc and clang.
> 
> Any idea what the problem is?
> 
> Regards,
> Mikael
> 
> On 1/29/19 3:17 PM, Ilya Biryukov via cfe-commits wrote:
>  > Author: ibiryukov
>  > Date: Tue Jan 29 06:17:36 2019
>  > New Revision: 352494
>  >
>  > URL: http://llvm.org/viewvc/llvm-project?rev=352494&view=rev
>  > Log:
>  > [clangd] Interfaces for writing code tweaks
>  >
>  > Summary:
>  > The code tweaks are an implementation of mini-refactorings
> exposed
>  > via the LSP code actions. They run in two stages:
>  >    - Stage 1. Decides whether the action is available to the
> user and
>  >      collects all the information required to finish the action.
>  >      Should be cheap, since this will run over all the
> actions known to
>  >      clangd on each textDocument/codeAction request from the
> client.
>  >
>  >    - Stage 2. Uses information from stage 1 to produce the
> actual edits
>  >      that the code action should perform. This stage can be
> expensive and
>  >      will only run if the user chooses to perform the
> specified action in
>  >      the UI.
>  >
>  > One unfortunate consequence of this change is increased
> latency of
>  > processing the textDocument/codeAction requests, which now
> wait for an
>  > AST. However, we cannot avoid this with what we have
> available in the LSP
>  > today.
>  >
>  > Reviewers: kadircet, ioeric, hokein, sammccall
>  >
>  > Reviewed By: sammccall
>  >
>  > Subscribers: mgrang, mgorny, MaskRay, jkorous, arphaman,
> cfe-commits
>  >
>  > Differential Revision: https://reviews.llvm.org/D56267
>  >
>  > Added:
>  >      clang-tools-extra/trunk/clangd/refactor/
>  >      clang-tools-extra/trunk/clangd/refactor/Tweak.cpp
>  >      clang-tools-extra/trunk/clangd/refactor/Tweak.h
>  >      clang-tools-extra/trunk/clangd/refactor/tweaks/
>  > 
> clang-tools-extra/trunk/clangd/refactor/tweaks/CMakeLists.txt
>  >      clang-tools-extra/trunk/clangd/refactor/tweaks/Dummy.cpp
>  > Modified:
>  >      clang-tools-extra/trunk/clangd/CMakeLists.txt
>  >      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/Protocol.h
>  >      clang-tools-extra/trunk/clangd/SourceCode.cpp
>  >      clang-tools-extra/trunk/clangd/SourceCode.h
>  >      clang-tools-extra/trunk/clangd/tool/CMakeLists.txt
>  >      clang-tools-extra/trunk/test/clangd/fixits-command.test
>  >      clang-tools-extra/trunk/test/clangd/initialize-params.test
>  >
>  > Modified: clang-tools-extra/trunk/clangd/CMakeLists.txt
>  > URL:
> 
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CMakeLists.txt?rev=352494&r1=352493&r2=352494&view=diff
>  >
> 
> ==
>  > --- clang-

[PATCH] D56927: Disable PIC/PIE for MSP430 target

2019-01-30 Thread George Rimar via Phabricator via cfe-commits
grimar added a comment.

What I noticed, this seems to introduce the first test case in 
`test\CodeGen\MSP430` folder which uses `clang`. All the others use `llc`. Is 
it OK?


Repository:
  rC Clang

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

https://reviews.llvm.org/D56927



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


[PATCH] D57055: [RISCV] Mark TLS as supported

2019-01-30 Thread Alex Bradbury via Phabricator via cfe-commits
asb added a comment.

Could you add a test for this? I'm not sure if this is best done with a test 
that uses __has_feature or otherwise (I note other targets don't seem to have 
similar tests currently), but I think it would be handy.


Repository:
  rC Clang

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

https://reviews.llvm.org/D57055



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


[PATCH] D56927: Disable PIC/PIE for MSP430 target

2019-01-30 Thread George Rimar via Phabricator via cfe-commits
grimar added a comment.

Oh sorry, I looked in the wrong folder, my previous comment was not correct.

So, this patch adds a test to `test\CodeGen` when we have `test\CodeGen\MSP430` 
folder.
And `test\CodeGen` does not have any tests now at all.
So I **guess** the correct way would probably be:

1. To move the test to `test\CodeGen\MSP430` folder.
2. To make it use 'llc`.


Repository:
  rC Clang

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

https://reviews.llvm.org/D56927



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


[PATCH] D56927: Disable PIC/PIE for MSP430 target

2019-01-30 Thread George Rimar via Phabricator via cfe-commits
grimar added a comment.

Ok, please ignore my comments above. I applied the patch and found it creates 
the test in `llvm\tools\clang\test\CodeGen` and not in `llvm\test\CodeGen`. Was 
confused by phab, sorry for the noise.


Repository:
  rC Clang

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

https://reviews.llvm.org/D56927



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


[PATCH] D56909: [clang-format] Fix line parsing for noexcept lambdas

2019-01-30 Thread Marcus Hultman via Phabricator via cfe-commits
hultman added a comment.

Ping


Repository:
  rC Clang

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

https://reviews.llvm.org/D56909



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


[PATCH] D57388: [clangd] Implement textDocument/declaration from LSP 3.14

2019-01-30 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment.

Looks good overall, most are nits.

> textDocument/definition now returns a definition if one is found, otherwise 
> the declaration. It no longer returns declaration + definition if they are 
> distinct.
>  textDocument/declaration returns the best declaration we can find.
>  For macros, the active macro definition is returned for both methods.
>  For include directive, the top of the target file is returned for both.

Just realized these at the last minutes, I think these are well-documented (and 
very helpful for future-code readers), I'd suggest putting them to the code 
comments as well.




Comment at: clangd/ClangdLSPServer.cpp:332
  }},
+{"declarationProvider", true},
 {"definitionProvider", true},

I believe missing this is a LSP protocol bug, vscode uses this term 
https://github.com/Microsoft/vscode/blob/248aea7fd51a703a7ab94ae5a582c85c11fbff33/src/vs/vscode.d.ts#L2301.



Comment at: clangd/ClangdLSPServer.h:82
 Callback>);
+  void onGoToDeclaration(const TextDocumentPositionParams &,
+ Callback>);

nit: maybe put it before `onGoToDefinition`, it seems to me more natural that 
declaration comes first.



Comment at: clangd/ClangdServer.h:167
 
   /// Get definition of symbol at a specified \p Line and \p Column in \p File.
+  void locateSymbolAt(PathRef File, Position Pos,

nit: this comment seems out-of-date?



Comment at: clangd/XRefs.cpp:38
+  // Only a single declaration is allowed.
+  if (isa(D)) // except cases above
+return D;

is this a case that we were missing before? can we add a unittest for it (I 
didn't find a related change in the unittest).



Comment at: clangd/XRefs.cpp:315
+// Record SymbolID for index lookup later.
 SymbolID Key("");
 if (auto ID = getSymbolID(D))

nit: this is not used anymore.



Comment at: clangd/XRefs.h:29
+//  - a declaration and a distinct definition (e.g. function declared in 
header)
+//  - a declaration and an equal definition (e.g. inline function, or class)
+struct LocatedSymbol {

nit: maybe also mention `marco`? it is unclear to me how the declaration and 
definition would be like for macro without reading the implementation.



Comment at: unittests/clangd/XRefsTests.cpp:339
+if (!T.ranges("def").empty())
+  WantDecl = T.range("def");
+

I think this should be `WantDef`? 


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D57388



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


[PATCH] D57442: [OpenGL] Fix test on PPC after r352540

2019-01-30 Thread Eric Liu via Phabricator via cfe-commits
ioeric created this revision.
ioeric added a reviewer: bkramer.
Herald added a subscriber: Anastasia.

Specify -triple like test/SemaOpenCL/logical-ops.cl. Otherwise, this test fails
on PPC.


Repository:
  rC Clang

https://reviews.llvm.org/D57442

Files:
  test/SemaOpenCL/format-strings-fixit.cl


Index: test/SemaOpenCL/format-strings-fixit.cl
===
--- test/SemaOpenCL/format-strings-fixit.cl
+++ test/SemaOpenCL/format-strings-fixit.cl
@@ -1,7 +1,7 @@
 // RUN: cp %s %t
-// RUN: %clang_cc1 -cl-std=CL1.2 -pedantic -Wall -fixit %t
-// RUN: %clang_cc1 -cl-std=CL1.2 -fsyntax-only -pedantic -Wall -Werror %t
-// RUN: %clang_cc1 -cl-std=CL1.2 -E -o - %t | FileCheck %s
+// RUN: %clang_cc1 -cl-std=CL1.2 -pedantic -Wall -fixit %t -triple 
x86_64-unknown-linux-gnu
+// RUN: %clang_cc1 -cl-std=CL1.2 -fsyntax-only -pedantic -Wall -Werror %t 
-triple x86_64-unknown-linux-gnu
+// RUN: %clang_cc1 -cl-std=CL1.2 -E -o - %t -triple x86_64-unknown-linux-gnu | 
FileCheck %s
 
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
 


Index: test/SemaOpenCL/format-strings-fixit.cl
===
--- test/SemaOpenCL/format-strings-fixit.cl
+++ test/SemaOpenCL/format-strings-fixit.cl
@@ -1,7 +1,7 @@
 // RUN: cp %s %t
-// RUN: %clang_cc1 -cl-std=CL1.2 -pedantic -Wall -fixit %t
-// RUN: %clang_cc1 -cl-std=CL1.2 -fsyntax-only -pedantic -Wall -Werror %t
-// RUN: %clang_cc1 -cl-std=CL1.2 -E -o - %t | FileCheck %s
+// RUN: %clang_cc1 -cl-std=CL1.2 -pedantic -Wall -fixit %t -triple x86_64-unknown-linux-gnu
+// RUN: %clang_cc1 -cl-std=CL1.2 -fsyntax-only -pedantic -Wall -Werror %t -triple x86_64-unknown-linux-gnu
+// RUN: %clang_cc1 -cl-std=CL1.2 -E -o - %t -triple x86_64-unknown-linux-gnu | FileCheck %s
 
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r352617 - [OpenCL] Add generic addr space to the return of implicit assignment.

2019-01-30 Thread Anastasia Stulova via cfe-commits
Author: stulova
Date: Wed Jan 30 03:18:08 2019
New Revision: 352617

URL: http://llvm.org/viewvc/llvm-project?rev=352617&view=rev
Log:
[OpenCL] Add generic addr space to the return of implicit assignment.

When creating the prototype of implicit assignment operators the
returned reference to the class should be qualified with the same
addr space as 'this' (i.e. __generic in OpenCL).

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


Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/CodeGenOpenCLCXX/addrspace-of-this.cl
cfe/trunk/test/SemaOpenCLCXX/address_space_overloading.cl

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=352617&r1=352616&r2=352617&view=diff
==
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Wed Jan 30 03:18:08 2019
@@ -11813,14 +11813,13 @@ CXXMethodDecl *Sema::DeclareImplicitCopy
 return nullptr;
 
   QualType ArgType = Context.getTypeDeclType(ClassDecl);
+  if (Context.getLangOpts().OpenCLCPlusPlus)
+ArgType = Context.getAddrSpaceQualType(ArgType, LangAS::opencl_generic);
   QualType RetType = Context.getLValueReferenceType(ArgType);
   bool Const = ClassDecl->implicitCopyAssignmentHasConstParam();
   if (Const)
 ArgType = ArgType.withConst();
 
-  if (Context.getLangOpts().OpenCLCPlusPlus)
-ArgType = Context.getAddrSpaceQualType(ArgType, LangAS::opencl_generic);
-
   ArgType = Context.getLValueReferenceType(ArgType);
 
   bool Constexpr = defaultedSpecialMemberIsConstexpr(*this, ClassDecl,
@@ -12138,6 +12137,8 @@ CXXMethodDecl *Sema::DeclareImplicitMove
   // constructor rules.
 
   QualType ArgType = Context.getTypeDeclType(ClassDecl);
+  if (Context.getLangOpts().OpenCLCPlusPlus)
+ArgType = Context.getAddrSpaceQualType(ArgType, LangAS::opencl_generic);
   QualType RetType = Context.getLValueReferenceType(ArgType);
   ArgType = Context.getRValueReferenceType(ArgType);
 

Modified: cfe/trunk/test/CodeGenOpenCLCXX/addrspace-of-this.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCLCXX/addrspace-of-this.cl?rev=352617&r1=352616&r2=352617&view=diff
==
--- cfe/trunk/test/CodeGenOpenCLCXX/addrspace-of-this.cl (original)
+++ cfe/trunk/test/CodeGenOpenCLCXX/addrspace-of-this.cl Wed Jan 30 03:18:08 
2019
@@ -1,25 +1,26 @@
-// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=c++ -emit-llvm 
-pedantic -verify -O0 -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=c++ -emit-llvm 
-pedantic -verify -O0 -o - -DDECL | FileCheck %s --check-prefixes="COMMON,EXPL"
+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=c++ -emit-llvm 
-pedantic -verify -O0 -o - -DDECL -DUSE_DEFLT | FileCheck %s 
--check-prefixes="COMMON,IMPL"
+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=c++ -emit-llvm 
-pedantic -verify -O0 -o - | FileCheck %s --check-prefixes="COMMON,IMPL"
 // expected-no-diagnostics
 
 // Test that the 'this' pointer is in the __generic address space.
 
-// FIXME: Add support for __constant address space.
+#ifdef USE_DEFLT
+#define DEFAULT =default
+#else
+#define DEFAULT
+#endif
 
 class C {
 public:
   int v;
-  C() { v = 2; }
-  C(C &&c) { v = c.v; }
-  C(const C &c) { v = c.v; }
-  C &operator=(const C &c) {
-v = c.v;
-return *this;
-  }
-  C &operator=(C &&c) & {
-v = c.v;
-return *this;
-  }
-
+#ifdef DECL
+  C() DEFAULT;
+  C(C &&c) DEFAULT;
+  C(const C &c) DEFAULT;
+  C &operator=(const C &c) DEFAULT;
+  C &operator=(C &&c) & DEFAULT;
+#endif
   C operator+(const C& c) {
 v += c.v;
 return *this;
@@ -30,6 +31,24 @@ public:
   int outside();
 };
 
+#if defined(DECL) && !defined(USE_DEFLT)
+C::C() { v = 2; };
+
+C::C(C &&c) { v = c.v; }
+
+C::C(const C &c) { v = c.v; }
+
+C &C::operator=(const C &c) {
+  v = c.v;
+  return *this;
+}
+
+C &C::operator=(C &&c) & {
+  v = c.v;
+  return *this;
+}
+#endif
+
 int C::outside() {
   return v;
 }
@@ -49,58 +68,76 @@ __kernel void test__global() {
   C c5 = foo();
 }
 
-// CHECK-LABEL: @__cxx_global_var_init()
-// CHECK: call void @_ZNU3AS41CC1Ev(%class.C addrspace(4)* addrspacecast 
(%class.C addrspace(1)* @c to %class.C addrspace(4)*))
+// Test that the address space is __generic for all members
+// EXPL: @_ZNU3AS41CC2Ev(%class.C addrspace(4)* %this)
+// EXPL: @_ZNU3AS41CC1Ev(%class.C addrspace(4)* %this)
+// EXPL: @_ZNU3AS41CC2EOU3AS4S_(%class.C addrspace(4)* %this
+// EXPL: @_ZNU3AS41CC1EOU3AS4S_(%class.C addrspace(4)* %this
+// EXPL: @_ZNU3AS41CC2ERU3AS4KS_(%class.C addrspace(4)* %this
+// EXPL: @_ZNU3AS41CC1ERU3AS4KS_(%class.C addrspace(4)* %this
+// EXPL: @_ZNU3AS41CaSERU3AS4KS_(%class.C addrspace(4)* %this
+// EXPL: @_ZNU3AS4R1CaSEOU3AS4S_(%class.C addrspace(4)* %this
+// COMMON: @_ZNU3AS41C7outsideEv(%class.C addrspace(4)* %this

[PATCH] D57101: [OpenCL] Add generic addr space to the return of implicit assignment

2019-01-30 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL352617: [OpenCL] Add generic addr space to the return of 
implicit assignment. (authored by stulova, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D57101?vs=184052&id=184270#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D57101

Files:
  cfe/trunk/lib/Sema/SemaDeclCXX.cpp
  cfe/trunk/test/CodeGenOpenCLCXX/addrspace-of-this.cl
  cfe/trunk/test/SemaOpenCLCXX/address_space_overloading.cl

Index: cfe/trunk/test/CodeGenOpenCLCXX/addrspace-of-this.cl
===
--- cfe/trunk/test/CodeGenOpenCLCXX/addrspace-of-this.cl
+++ cfe/trunk/test/CodeGenOpenCLCXX/addrspace-of-this.cl
@@ -1,25 +1,26 @@
-// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=c++ -emit-llvm -pedantic -verify -O0 -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=c++ -emit-llvm -pedantic -verify -O0 -o - -DDECL | FileCheck %s --check-prefixes="COMMON,EXPL"
+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=c++ -emit-llvm -pedantic -verify -O0 -o - -DDECL -DUSE_DEFLT | FileCheck %s --check-prefixes="COMMON,IMPL"
+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=c++ -emit-llvm -pedantic -verify -O0 -o - | FileCheck %s --check-prefixes="COMMON,IMPL"
 // expected-no-diagnostics
 
 // Test that the 'this' pointer is in the __generic address space.
 
-// FIXME: Add support for __constant address space.
+#ifdef USE_DEFLT
+#define DEFAULT =default
+#else
+#define DEFAULT
+#endif
 
 class C {
 public:
   int v;
-  C() { v = 2; }
-  C(C &&c) { v = c.v; }
-  C(const C &c) { v = c.v; }
-  C &operator=(const C &c) {
-v = c.v;
-return *this;
-  }
-  C &operator=(C &&c) & {
-v = c.v;
-return *this;
-  }
-
+#ifdef DECL
+  C() DEFAULT;
+  C(C &&c) DEFAULT;
+  C(const C &c) DEFAULT;
+  C &operator=(const C &c) DEFAULT;
+  C &operator=(C &&c) & DEFAULT;
+#endif
   C operator+(const C& c) {
 v += c.v;
 return *this;
@@ -30,6 +31,24 @@
   int outside();
 };
 
+#if defined(DECL) && !defined(USE_DEFLT)
+C::C() { v = 2; };
+
+C::C(C &&c) { v = c.v; }
+
+C::C(const C &c) { v = c.v; }
+
+C &C::operator=(const C &c) {
+  v = c.v;
+  return *this;
+}
+
+C &C::operator=(C &&c) & {
+  v = c.v;
+  return *this;
+}
+#endif
+
 int C::outside() {
   return v;
 }
@@ -49,58 +68,76 @@
   C c5 = foo();
 }
 
-// CHECK-LABEL: @__cxx_global_var_init()
-// CHECK: call void @_ZNU3AS41CC1Ev(%class.C addrspace(4)* addrspacecast (%class.C addrspace(1)* @c to %class.C addrspace(4)*))
+// Test that the address space is __generic for all members
+// EXPL: @_ZNU3AS41CC2Ev(%class.C addrspace(4)* %this)
+// EXPL: @_ZNU3AS41CC1Ev(%class.C addrspace(4)* %this)
+// EXPL: @_ZNU3AS41CC2EOU3AS4S_(%class.C addrspace(4)* %this
+// EXPL: @_ZNU3AS41CC1EOU3AS4S_(%class.C addrspace(4)* %this
+// EXPL: @_ZNU3AS41CC2ERU3AS4KS_(%class.C addrspace(4)* %this
+// EXPL: @_ZNU3AS41CC1ERU3AS4KS_(%class.C addrspace(4)* %this
+// EXPL: @_ZNU3AS41CaSERU3AS4KS_(%class.C addrspace(4)* %this
+// EXPL: @_ZNU3AS4R1CaSEOU3AS4S_(%class.C addrspace(4)* %this
+// COMMON: @_ZNU3AS41C7outsideEv(%class.C addrspace(4)* %this)
 
-// Test that the address space is __generic for the constructor
-// CHECK-LABEL: @_ZNU3AS41CC1Ev(%class.C addrspace(4)* %this)
-// CHECK: entry:
-// CHECK:   %this.addr = alloca %class.C addrspace(4)*, align 4
-// CHECK:   store %class.C addrspace(4)* %this, %class.C addrspace(4)** %this.addr, align 4
-// CHECK:   %this1 = load %class.C addrspace(4)*, %class.C addrspace(4)** %this.addr, align 4
-// CHECK:   call void @_ZNU3AS41CC2Ev(%class.C addrspace(4)* %this1)
-// CHECK:   ret void
+// EXPL-LABEL: @__cxx_global_var_init()
+// EXPL: call void @_ZNU3AS41CC1Ev(%class.C addrspace(4)* addrspacecast (%class.C addrspace(1)* @c to %class.C addrspace(4)*))
 
-// CHECK-LABEL: @_Z12test__globalv()
+// COMMON-LABEL: @_Z12test__globalv()
 
 // Test the address space of 'this' when invoking a method.
-// CHECK: %call = call i32 @_ZNU3AS41C3getEv(%class.C addrspace(4)* addrspacecast (%class.C addrspace(1)* @c to %class.C addrspace(4)*))
+// COMMON: %call = call i32 @_ZNU3AS41C3getEv(%class.C addrspace(4)* addrspacecast (%class.C addrspace(1)* @c to %class.C addrspace(4)*))
 
 // Test the address space of 'this' when invoking a method that is declared in the file contex.
-// CHECK: %call1 = call i32 @_ZNU3AS41C7outsideEv(%class.C addrspace(4)* addrspacecast (%class.C addrspace(1)* @c to %class.C addrspace(4)*))
+// COMMON: %call1 = call i32 @_ZNU3AS41C7outsideEv(%class.C addrspace(4)* addrspacecast (%class.C addrspace(1)* @c to %class.C addrspace(4)*))
 
 // Test the address space of 'this' when invoking copy-constructor.
-// CHECK: [[C1GEN:%[0-9]+]] = addrspacecast %class.C* %c1 to %class.C addrspace(4)*
-// CHECK: call void @_ZNU3AS41CC1ERU3AS4KS_(%class.C addrs

[PATCH] D57442: [OpenGL] Fix test on PPC after r352540

2019-01-30 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg


Repository:
  rC Clang

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

https://reviews.llvm.org/D57442



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


[PATCH] D57442: [OpenGL] Fix test on PPC after r352540

2019-01-30 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia accepted this revision.
Anastasia added a comment.

LGTM! Thanks.

Interesting, that test has been committed in Dec.

Can you please fix the title in the commit message `[OpenGL]` -> `[OpenCL]`.

We are not working on OpenGL yet. :)


Repository:
  rL LLVM

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

https://reviews.llvm.org/D57442



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


[PATCH] D57442: [OpenGL] Fix test on PPC after r352540

2019-01-30 Thread Eric Liu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL352618: [OpenGL] Fix test on PPC after r352540 (authored by 
ioeric, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

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

https://reviews.llvm.org/D57442

Files:
  cfe/trunk/test/SemaOpenCL/format-strings-fixit.cl


Index: cfe/trunk/test/SemaOpenCL/format-strings-fixit.cl
===
--- cfe/trunk/test/SemaOpenCL/format-strings-fixit.cl
+++ cfe/trunk/test/SemaOpenCL/format-strings-fixit.cl
@@ -1,7 +1,7 @@
 // RUN: cp %s %t
-// RUN: %clang_cc1 -cl-std=CL1.2 -pedantic -Wall -fixit %t
-// RUN: %clang_cc1 -cl-std=CL1.2 -fsyntax-only -pedantic -Wall -Werror %t
-// RUN: %clang_cc1 -cl-std=CL1.2 -E -o - %t | FileCheck %s
+// RUN: %clang_cc1 -cl-std=CL1.2 -pedantic -Wall -fixit %t -triple 
x86_64-unknown-linux-gnu
+// RUN: %clang_cc1 -cl-std=CL1.2 -fsyntax-only -pedantic -Wall -Werror %t 
-triple x86_64-unknown-linux-gnu
+// RUN: %clang_cc1 -cl-std=CL1.2 -E -o - %t -triple x86_64-unknown-linux-gnu | 
FileCheck %s
 
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
 


Index: cfe/trunk/test/SemaOpenCL/format-strings-fixit.cl
===
--- cfe/trunk/test/SemaOpenCL/format-strings-fixit.cl
+++ cfe/trunk/test/SemaOpenCL/format-strings-fixit.cl
@@ -1,7 +1,7 @@
 // RUN: cp %s %t
-// RUN: %clang_cc1 -cl-std=CL1.2 -pedantic -Wall -fixit %t
-// RUN: %clang_cc1 -cl-std=CL1.2 -fsyntax-only -pedantic -Wall -Werror %t
-// RUN: %clang_cc1 -cl-std=CL1.2 -E -o - %t | FileCheck %s
+// RUN: %clang_cc1 -cl-std=CL1.2 -pedantic -Wall -fixit %t -triple x86_64-unknown-linux-gnu
+// RUN: %clang_cc1 -cl-std=CL1.2 -fsyntax-only -pedantic -Wall -Werror %t -triple x86_64-unknown-linux-gnu
+// RUN: %clang_cc1 -cl-std=CL1.2 -E -o - %t -triple x86_64-unknown-linux-gnu | FileCheck %s
 
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r352618 - [OpenGL] Fix test on PPC after r352540

2019-01-30 Thread Eric Liu via cfe-commits
Author: ioeric
Date: Wed Jan 30 03:24:04 2019
New Revision: 352618

URL: http://llvm.org/viewvc/llvm-project?rev=352618&view=rev
Log:
[OpenGL] Fix test on PPC after r352540

Summary:
Specify -triple like test/SemaOpenCL/logical-ops.cl. Otherwise, this test fails
on PPC.

Reviewers: bkramer

Subscribers: Anastasia, cfe-commits

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

Modified:
cfe/trunk/test/SemaOpenCL/format-strings-fixit.cl

Modified: cfe/trunk/test/SemaOpenCL/format-strings-fixit.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/format-strings-fixit.cl?rev=352618&r1=352617&r2=352618&view=diff
==
--- cfe/trunk/test/SemaOpenCL/format-strings-fixit.cl (original)
+++ cfe/trunk/test/SemaOpenCL/format-strings-fixit.cl Wed Jan 30 03:24:04 2019
@@ -1,7 +1,7 @@
 // RUN: cp %s %t
-// RUN: %clang_cc1 -cl-std=CL1.2 -pedantic -Wall -fixit %t
-// RUN: %clang_cc1 -cl-std=CL1.2 -fsyntax-only -pedantic -Wall -Werror %t
-// RUN: %clang_cc1 -cl-std=CL1.2 -E -o - %t | FileCheck %s
+// RUN: %clang_cc1 -cl-std=CL1.2 -pedantic -Wall -fixit %t -triple 
x86_64-unknown-linux-gnu
+// RUN: %clang_cc1 -cl-std=CL1.2 -fsyntax-only -pedantic -Wall -Werror %t 
-triple x86_64-unknown-linux-gnu
+// RUN: %clang_cc1 -cl-std=CL1.2 -E -o - %t -triple x86_64-unknown-linux-gnu | 
FileCheck %s
 
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
 


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


[PATCH] D57325: [clangd] Collect macros in static index.

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



Comment at: unittests/clangd/BackgroundIndexTests.cpp:128
   runFuzzyFind(Idx, ""),
   UnorderedElementsAre(Named("common"), Named("A_CC"), Named("g"),
AllOf(Named("f_b"), Declared(), Not(Defined();

kadircet wrote:
> Shouldn't we also have `Named("A")` in here ?
The symbol `A` is filtered out (as it is defined via a compile command-line 
option `-DA=1`).


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D57325



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


r352620 - [HIP] Fix size_t for MSVC environment

2019-01-30 Thread Yaxun Liu via cfe-commits
Author: yaxunl
Date: Wed Jan 30 04:26:54 2019
New Revision: 352620

URL: http://llvm.org/viewvc/llvm-project?rev=352620&view=rev
Log:
[HIP] Fix size_t for MSVC environment

In 64 bit MSVC environment size_t is defined as unsigned long long.
In single source language like HIP, data layout should be consistent
in device and host compilation, therefore copy data layout controlling
fields from Aux target for AMDGPU target.

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

Added:
cfe/trunk/test/SemaCUDA/amdgpu-size_t.cu
Modified:
cfe/trunk/include/clang/Basic/TargetInfo.h
cfe/trunk/lib/Basic/TargetInfo.cpp
cfe/trunk/lib/Basic/Targets/AMDGPU.cpp
cfe/trunk/lib/Basic/Targets/AMDGPU.h
cfe/trunk/lib/Frontend/CompilerInstance.cpp

Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=352620&r1=352619&r2=352620&view=diff
==
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Wed Jan 30 04:26:54 2019
@@ -48,22 +48,10 @@ class SourceManager;
 
 namespace Builtin { struct Info; }
 
-/// Exposes information about the current target.
-///
-class TargetInfo : public RefCountedBase {
-  std::shared_ptr TargetOpts;
-  llvm::Triple Triple;
-protected:
-  // Target values set by the ctor of the actual target implementation.  
Default
-  // values are specified by the TargetInfo constructor.
-  bool BigEndian;
-  bool TLSSupported;
-  bool VLASupported;
-  bool NoAsmVariants;  // True if {|} are normal characters.
-  bool HasLegalHalfType; // True if the backend supports operations on the half
- // LLVM IR type.
-  bool HasFloat128;
-  bool HasFloat16;
+/// Fields controlling how types are laid out in memory; these may need to
+/// be copied for targets like AMDGPU that base their ABIs on an auxiliary
+/// CPU target.
+struct TransferrableTargetInfo {
   unsigned char PointerWidth, PointerAlign;
   unsigned char BoolWidth, BoolAlign;
   unsigned char IntWidth, IntAlign;
@@ -104,15 +92,92 @@ protected:
   unsigned char SuitableAlign;
   unsigned char DefaultAlignForAttributeAligned;
   unsigned char MinGlobalAlign;
-  unsigned char MaxAtomicPromoteWidth, MaxAtomicInlineWidth;
+
+  unsigned short NewAlign;
   unsigned short MaxVectorAlign;
   unsigned short MaxTLSAlign;
+
+  const llvm::fltSemantics *HalfFormat, *FloatFormat, *DoubleFormat,
+*LongDoubleFormat, *Float128Format;
+
+  ///=== Target Data Type Query Methods 
---===//
+  enum IntType {
+NoInt = 0,
+SignedChar,
+UnsignedChar,
+SignedShort,
+UnsignedShort,
+SignedInt,
+UnsignedInt,
+SignedLong,
+UnsignedLong,
+SignedLongLong,
+UnsignedLongLong
+  };
+
+  enum RealType {
+NoFloat = 255,
+Float = 0,
+Double,
+LongDouble,
+Float128
+  };
+protected:
+  IntType SizeType, IntMaxType, PtrDiffType, IntPtrType, WCharType,
+  WIntType, Char16Type, Char32Type, Int64Type, SigAtomicType,
+  ProcessIDType;
+
+  /// Whether Objective-C's built-in boolean type should be signed char.
+  ///
+  /// Otherwise, when this flag is not set, the normal built-in boolean type is
+  /// used.
+  unsigned UseSignedCharForObjCBool : 1;
+
+  /// Control whether the alignment of bit-field types is respected when laying
+  /// out structures. If true, then the alignment of the bit-field type will be
+  /// used to (a) impact the alignment of the containing structure, and (b)
+  /// ensure that the individual bit-field will not straddle an alignment
+  /// boundary.
+  unsigned UseBitFieldTypeAlignment : 1;
+
+  /// Whether zero length bitfields (e.g., int : 0;) force alignment of
+  /// the next bitfield.
+  ///
+  /// If the alignment of the zero length bitfield is greater than the member
+  /// that follows it, `bar', `bar' will be aligned as the type of the
+  /// zero-length bitfield.
+  unsigned UseZeroLengthBitfieldAlignment : 1;
+
+  ///  Whether explicit bit field alignment attributes are honored.
+  unsigned UseExplicitBitFieldAlignment : 1;
+
+  /// If non-zero, specifies a fixed alignment value for bitfields that follow
+  /// zero length bitfield, regardless of the zero length bitfield type.
+  unsigned ZeroLengthBitfieldBoundary;
+};
+
+/// Exposes information about the current target.
+///
+class TargetInfo : public virtual TransferrableTargetInfo,
+   public RefCountedBase {
+  std::shared_ptr TargetOpts;
+  llvm::Triple Triple;
+protected:
+  // Target values set by the ctor of the actual target implementation.  
Default
+  // values are specified by the TargetInfo constructor.
+  bool BigEndian;
+  bool TLSSupported;
+  bool VLASupported;
+  bool NoAsmVariants;  // True if {|} are normal characters.
+  bool HasLegalHalfType; // True if the backend supports operations on the half
+ 

[PATCH] D56318: [HIP] Fix size_t for MSVC environment

2019-01-30 Thread Yaxun Liu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC352620: [HIP] Fix size_t for MSVC environment (authored by 
yaxunl, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D56318?vs=184245&id=184274#toc

Repository:
  rC Clang

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

https://reviews.llvm.org/D56318

Files:
  include/clang/Basic/TargetInfo.h
  lib/Basic/TargetInfo.cpp
  lib/Basic/Targets/AMDGPU.cpp
  lib/Basic/Targets/AMDGPU.h
  lib/Frontend/CompilerInstance.cpp
  test/SemaCUDA/amdgpu-size_t.cu

Index: lib/Basic/Targets/AMDGPU.cpp
===
--- lib/Basic/Targets/AMDGPU.cpp
+++ lib/Basic/Targets/AMDGPU.cpp
@@ -305,3 +305,7 @@
   if (hasFastFMA())
 Builder.defineMacro("FP_FAST_FMA");
 }
+
+void AMDGPUTargetInfo::setAuxTarget(const TargetInfo *Aux) {
+  copyAuxTarget(Aux);
+}
Index: lib/Basic/Targets/AMDGPU.h
===
--- lib/Basic/Targets/AMDGPU.h
+++ lib/Basic/Targets/AMDGPU.h
@@ -351,6 +351,8 @@
   uint64_t getNullPointerValue(LangAS AS) const override {
 return AS == LangAS::opencl_local ? ~0 : 0;
   }
+
+  void setAuxTarget(const TargetInfo *Aux) override;
 };
 
 } // namespace targets
Index: lib/Basic/TargetInfo.cpp
===
--- lib/Basic/TargetInfo.cpp
+++ lib/Basic/TargetInfo.cpp
@@ -796,3 +796,9 @@
   assert(getAccumIBits() >= getUnsignedAccumIBits());
   assert(getLongAccumIBits() >= getUnsignedLongAccumIBits());
 }
+
+void TargetInfo::copyAuxTarget(const TargetInfo *Aux) {
+  auto *Target = static_cast(this);
+  auto *Src = static_cast(Aux);
+  *Target = *Src;
+}
Index: lib/Frontend/CompilerInstance.cpp
===
--- lib/Frontend/CompilerInstance.cpp
+++ lib/Frontend/CompilerInstance.cpp
@@ -928,6 +928,9 @@
   // Adjust target options based on codegen options.
   getTarget().adjustTargetOptions(getCodeGenOpts(), getTargetOpts());
 
+  if (auto *Aux = getAuxTarget())
+getTarget().setAuxTarget(Aux);
+
   // rewriter project will change target built-in bool type from its default.
   if (getFrontendOpts().ProgramAction == frontend::RewriteObjC)
 getTarget().noSignedCharForObjCBool();
Index: include/clang/Basic/TargetInfo.h
===
--- include/clang/Basic/TargetInfo.h
+++ include/clang/Basic/TargetInfo.h
@@ -48,22 +48,10 @@
 
 namespace Builtin { struct Info; }
 
-/// Exposes information about the current target.
-///
-class TargetInfo : public RefCountedBase {
-  std::shared_ptr TargetOpts;
-  llvm::Triple Triple;
-protected:
-  // Target values set by the ctor of the actual target implementation.  Default
-  // values are specified by the TargetInfo constructor.
-  bool BigEndian;
-  bool TLSSupported;
-  bool VLASupported;
-  bool NoAsmVariants;  // True if {|} are normal characters.
-  bool HasLegalHalfType; // True if the backend supports operations on the half
- // LLVM IR type.
-  bool HasFloat128;
-  bool HasFloat16;
+/// Fields controlling how types are laid out in memory; these may need to
+/// be copied for targets like AMDGPU that base their ABIs on an auxiliary
+/// CPU target.
+struct TransferrableTargetInfo {
   unsigned char PointerWidth, PointerAlign;
   unsigned char BoolWidth, BoolAlign;
   unsigned char IntWidth, IntAlign;
@@ -104,15 +92,92 @@
   unsigned char SuitableAlign;
   unsigned char DefaultAlignForAttributeAligned;
   unsigned char MinGlobalAlign;
-  unsigned char MaxAtomicPromoteWidth, MaxAtomicInlineWidth;
+
+  unsigned short NewAlign;
   unsigned short MaxVectorAlign;
   unsigned short MaxTLSAlign;
+
+  const llvm::fltSemantics *HalfFormat, *FloatFormat, *DoubleFormat,
+*LongDoubleFormat, *Float128Format;
+
+  ///=== Target Data Type Query Methods ---===//
+  enum IntType {
+NoInt = 0,
+SignedChar,
+UnsignedChar,
+SignedShort,
+UnsignedShort,
+SignedInt,
+UnsignedInt,
+SignedLong,
+UnsignedLong,
+SignedLongLong,
+UnsignedLongLong
+  };
+
+  enum RealType {
+NoFloat = 255,
+Float = 0,
+Double,
+LongDouble,
+Float128
+  };
+protected:
+  IntType SizeType, IntMaxType, PtrDiffType, IntPtrType, WCharType,
+  WIntType, Char16Type, Char32Type, Int64Type, SigAtomicType,
+  ProcessIDType;
+
+  /// Whether Objective-C's built-in boolean type should be signed char.
+  ///
+  /// Otherwise, when this flag is not set, the normal built-in boolean type is
+  /// used.
+  unsigned UseSignedCharForObjCBool : 1;
+
+  /// Control whether the alignment of bit-field types is respected when laying
+  /// out structures. If true, then the alignment of the bit-field type will be
+  /// used to (a) impact the alignment of the containing structure, and (b)
+  /// ensure that

[PATCH] D55782: Fix isInSystemMacro to handle pasted token

2019-01-30 Thread serge via Phabricator via cfe-commits
serge-sans-paille updated this revision to Diff 184275.
serge-sans-paille added a comment.

Patch updated to take into account @rsmith remarks. Test case added as an 
illustration.


Repository:
  rC Clang

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

https://reviews.llvm.org/D55782

Files:
  include/clang/Basic/SourceManager.h
  test/Misc/no-warn-in-system-macro.c
  test/Misc/no-warn-in-system-macro.c.inc
  test/Misc/warn-in-system-macro-def.c
  test/Misc/warn-in-system-macro-def.c.inc

Index: test/Misc/warn-in-system-macro-def.c.inc
===
--- /dev/null
+++ test/Misc/warn-in-system-macro-def.c.inc
@@ -0,0 +1,4 @@
+extern int __isnanf(float f);
+extern int __isnan(double f);
+extern int __isnanl(long double f);
+#define ISNAN isnan
Index: test/Misc/warn-in-system-macro-def.c
===
--- /dev/null
+++ test/Misc/warn-in-system-macro-def.c
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -isystem %S -Wdouble-promotion -fsyntax-only %s  2>&1 | FileCheck -allow-empty %s
+// CHECK: warning:
+// CHECK: expanded from macro 'ISNAN'
+// CHECK: expanded from macro 'isnan'
+
+#include 
+
+#define isnan(x) \
+	(sizeof (x) == sizeof (float)\
+	? __isnanf (x)\
+	: sizeof (x) == sizeof (double)   \
+	? __isnan (x) : __isnanl (x))
+
+int main(void)
+{
+	double foo = 1.0;
+
+	if (ISNAN(foo))
+		return 1;
+	return 0;
+}
Index: test/Misc/no-warn-in-system-macro.c.inc
===
--- /dev/null
+++ test/Misc/no-warn-in-system-macro.c.inc
@@ -0,0 +1,9 @@
+extern int __isnanf(float f);
+extern int __isnan(double f);
+extern int __isnanl(long double f);
+#define isnan(x) \
+	(sizeof (x) == sizeof (float)\
+	? __isnanf (x)\
+	: sizeof (x) == sizeof (double)   \
+	? __isnan (x) : __isnanl (x))
+
Index: test/Misc/no-warn-in-system-macro.c
===
--- /dev/null
+++ test/Misc/no-warn-in-system-macro.c
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -isystem %S -Wdouble-promotion -fsyntax-only %s  2>&1 | FileCheck -allow-empty %s
+// CHECK-NOT: warning:
+
+#include 
+
+int main(void)
+{
+	double foo = 1.0;
+
+	if (isnan(foo))
+		return 1;
+	return 0;
+}
Index: include/clang/Basic/SourceManager.h
===
--- include/clang/Basic/SourceManager.h
+++ include/clang/Basic/SourceManager.h
@@ -1440,6 +1440,12 @@
 return Filename.equals("");
   }
 
+  /// Returns whether \p Loc is located in a  file.
+  bool isWrittenInScratchSpace(SourceLocation Loc) const {
+StringRef Filename(getPresumedLoc(Loc).getFilename());
+return Filename.equals("");
+  }
+
   /// Returns if a SourceLocation is in a system header.
   bool isInSystemHeader(SourceLocation Loc) const {
 return isSystem(getFileCharacteristic(Loc));
@@ -1452,7 +1458,17 @@
 
   /// Returns whether \p Loc is expanded from a macro in a system header.
   bool isInSystemMacro(SourceLocation loc) const {
-return loc.isMacroID() && isInSystemHeader(getSpellingLoc(loc));
+if(!loc.isMacroID())
+  return false;
+
+// This happens when the macro is the result of a paste, in that case
+// its spelling is the scratch memory, so we take the parent context.
+if(isWrittenInScratchSpace(getSpellingLoc(loc))) {
+  return isInSystemHeader(getSpellingLoc(getImmediateMacroCallerLoc(loc)));
+}
+else {
+  return isInSystemHeader(getSpellingLoc(loc));
+}
   }
 
   /// The size of the SLocEntry that \p FID represents.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28462: clang-format: Add new style option AlignConsecutiveMacros

2019-01-30 Thread Erik Nyquist via Phabricator via cfe-commits
enyquist added a comment.

Looks fine to me, although I confess I did not build and run it because I don't 
have the time to set up the environment again, took a few hours last time I 
built from scratch (side note, if there's an easy way to speed up llvm/clang 
compilation up I'd love to hear it :) ).
You didn't change the tests that I can see, so if those are still  passing then 
it seems to be a fairly successful refactor. However I'm very much a clang 
newbie (just to be clear), whether this satisfies the original request for a 
refactor I cannot comment on.

Thanks for taking this over-- I started this because I really needed the 
feature, but eventually gave up because we didn't need it anymore after a 
while, and after chasing it on here for nearly a year it just wasn't worth the 
effort anymore.
However, if it turns out that this really was the only thing left need to merge 
it, while being slightly annoyed that I gave up on what turned out to be the 
*actual* final change, it will still be nice to finally have this in 
clang-format :)


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

https://reviews.llvm.org/D28462



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


[PATCH] D55782: Fix isInSystemMacro to handle pasted token

2019-01-30 Thread serge via Phabricator via cfe-commits
serge-sans-paille marked 2 inline comments as done.
serge-sans-paille added inline comments.



Comment at: include/clang/Basic/SourceManager.h:1458-1460
+   // This happens when the macro is the result of a paste, in that 
case
+   // its spelling is the scratch memory, so we take the parent 
context.
+isInSystemHeader(getSpellingLoc(getImmediateMacroCallerLoc(loc;

rsmith wrote:
> I think this also matches things like:
> 
> ```
> // system header
> #define BAR FOO
> 
> // user code
> #define FOO x
> BAR
> ```
> 
> ... where the location of `x` token produced by the `BAR` macro will now be 
> considered to be in a system macro. Can you make this more targeted? (Maybe 
> we could change the `SLocEntry` for the token-paste scratch buffer to be 
> considered a system header if the `##` token is in a system macro -- that'll 
> need the preprocessor to store two `ScratchBuffer`s, one for system headers 
> and one for user code, but that seems acceptable.)
Thanks for the advice! This approach should be more efficient and avoid the 
situation you point out - I've added a test case to illustrate that.


Repository:
  rC Clang

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

https://reviews.llvm.org/D55782



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


[PATCH] D57419: [ASTDump] Move Decl node dumping to TextNodeDumper

2019-01-30 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM! It's nice to see this piece going in!


Repository:
  rC Clang

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

https://reviews.llvm.org/D57419



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


[PATCH] D56928: Support attribute used in member funcs of class templates

2019-01-30 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM aside from some formatting nits.




Comment at: lib/Sema/SemaTemplateInstantiateDecl.cpp:2184
+  if (const MemberSpecializationInfo *MSInfo =
+  A->getMemberSpecializationInfo()) {
+Loc = MSInfo->getPointOfInstantiation();

Elide braces



Comment at: lib/Sema/SemaTemplateInstantiateDecl.cpp:2186
+Loc = MSInfo->getPointOfInstantiation();
+  } else if (const auto *Spec =
+ dyn_cast(A)) {

Elide braces



Comment at: 
test/CodeGenCXX/attr-used-member-function-implicit-instantiation.cpp:2
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -O0 -o - %s \
+// RUN:  | FileCheck %s
+

I'd go ahead and leave this on the same line as the previous RUN line. We're 
often less picky about 80-col limits for RUN lines unless they're obnoxiously 
long. You can drop the `-O0` from the RUN line as well (I believe).



Comment at: 
test/CodeGenCXX/attr-used-member-function-implicit-instantiation.cpp:6
+// classes
+namespace InstantiateUsedMemberDefinition {
+  template  struct S {

You should run the patch through clang-format -- the indentation looks 
incorrect here.


Repository:
  rC Clang

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

https://reviews.llvm.org/D56928



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


[PATCH] D55878: [Driver] Use --hash-style=gnu instead of both on FreeBSD

2019-01-30 Thread Konstantin Belousov via Phabricator via cfe-commits
kib added a comment.

I do not like this.  The change makes binaries linked by the default toolchain 
on FreeBSD, non-standard compliant.  Several hundred bytes is not too high cost 
to pay for not having issues with all tools still not adapted to GNU hash (and 
never be).


Repository:
  rC Clang

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

https://reviews.llvm.org/D55878



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


[PATCH] D57086: Ignore trailing NullStmts in StmtExprs for GCC compatibility

2019-01-30 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang/include/clang/AST/Stmt.h:1259
+  // the index of the last one.
+  unsigned getLastNonNullStmt() const {
+assert(!body_empty() && "getLastNonNullStmt");

How about `getIndexOfLastNonNullStmt()` since it doesn't return the `Stmt*` 
itself?



Comment at: clang/lib/CodeGen/CGStmt.cpp:385
 
-  for (CompoundStmt::const_body_iterator I = S.body_begin(),
-   E = S.body_end()-GetLast; I != E; ++I)
-EmitStmt(*I);
-
+  Stmt *ExprResult = GetLast ? S.getStmtExprResult() : nullptr;
   Address RetAlloca = Address::invalid();

`const Stmt *`



Comment at: clang/lib/CodeGen/CGStmt.cpp:390
+  E = S.body_end(); I != E; ++I) {
+if (GetLast && ExprResult == *I) {
+  // We have to special case labels here.  They are statements, but when 
put

What happens if `ExprResult` is `nullptr`?



Comment at: clang/test/CodeGen/exprs.c:202
+int f19() {
+  return ({ 3;;4;; });
+}

Does this test need the extra null statement between the `3;` and `4;`?


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

https://reviews.llvm.org/D57086



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


r352622 - [clang-format] Fix line parsing for noexcept lambdas

2019-01-30 Thread Ben Hamilton via cfe-commits
Author: benhamilton
Date: Wed Jan 30 05:54:32 2019
New Revision: 352622

URL: http://llvm.org/viewvc/llvm-project?rev=352622&view=rev
Log:
[clang-format] Fix line parsing for noexcept lambdas

Summary:
> $ echo "int c = [b]() mutable noexcept { return [&b] { return b++; }(); }();" 
> |clang-format

```
int c = [b]() mutable noexcept {
  return [&b] { return b++; }();
}
();
```
with patch:
> $ echo "int c = [b]() mutable noexcept { return [&b] { return b++; }(); }();" 
> |bin/clang-format
```
int c = [b]() mutable noexcept { return [&b] { return b++; }(); }();
```

Contributed by hultman.

Reviewers: benhamilton, jolesiak, klimek, Wizard

Reviewed By: benhamilton

Subscribers: cfe-commits

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

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

Modified: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineParser.cpp?rev=352622&r1=352621&r2=352622&view=diff
==
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Wed Jan 30 05:54:32 2019
@@ -1422,6 +1422,7 @@ bool UnwrappedLineParser::tryToParseLamb
 case tok::numeric_constant:
 case tok::coloncolon:
 case tok::kw_mutable:
+case tok::kw_noexcept:
   nextToken();
   break;
 case tok::arrow:

Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=352622&r1=352621&r2=352622&view=diff
==
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Wed Jan 30 05:54:32 2019
@@ -11725,6 +11725,8 @@ TEST_F(FormatTest, FormatsWithWebKitStyl
 
 TEST_F(FormatTest, FormatsLambdas) {
   verifyFormat("int c = [b]() mutable { return [&b] { return b++; }(); 
}();\n");
+  verifyFormat(
+  "int c = [b]() mutable noexcept { return [&b] { return b++; }(); 
}();\n");
   verifyFormat("int c = [&] { [=] { return b++; }(); }();\n");
   verifyFormat("int c = [&, &a, a] { [=, c, &d] { return b++; }(); }();\n");
   verifyFormat("int c = [&a, &a, a] { [=, a, b, &c] { return b++; }(); 
}();\n");


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


[PATCH] D56909: [clang-format] Fix line parsing for noexcept lambdas

2019-01-30 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment.
Herald added a subscriber: llvm-commits.

So sorry for the delay. I've landed this diff as rC352622 
.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D56909



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


[PATCH] D56909: [clang-format] Fix line parsing for noexcept lambdas

2019-01-30 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL352622: [clang-format] Fix line parsing for noexcept lambdas 
(authored by benhamilton, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D56909?vs=182514&id=184281#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D56909

Files:
  cfe/trunk/lib/Format/UnwrappedLineParser.cpp
  cfe/trunk/unittests/Format/FormatTest.cpp


Index: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
===
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp
@@ -1422,6 +1422,7 @@
 case tok::numeric_constant:
 case tok::coloncolon:
 case tok::kw_mutable:
+case tok::kw_noexcept:
   nextToken();
   break;
 case tok::arrow:
Index: cfe/trunk/unittests/Format/FormatTest.cpp
===
--- cfe/trunk/unittests/Format/FormatTest.cpp
+++ cfe/trunk/unittests/Format/FormatTest.cpp
@@ -11725,6 +11725,8 @@
 
 TEST_F(FormatTest, FormatsLambdas) {
   verifyFormat("int c = [b]() mutable { return [&b] { return b++; }(); 
}();\n");
+  verifyFormat(
+  "int c = [b]() mutable noexcept { return [&b] { return b++; }(); 
}();\n");
   verifyFormat("int c = [&] { [=] { return b++; }(); }();\n");
   verifyFormat("int c = [&, &a, a] { [=, c, &d] { return b++; }(); }();\n");
   verifyFormat("int c = [&a, &a, a] { [=, a, b, &c] { return b++; }(); 
}();\n");


Index: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
===
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp
@@ -1422,6 +1422,7 @@
 case tok::numeric_constant:
 case tok::coloncolon:
 case tok::kw_mutable:
+case tok::kw_noexcept:
   nextToken();
   break;
 case tok::arrow:
Index: cfe/trunk/unittests/Format/FormatTest.cpp
===
--- cfe/trunk/unittests/Format/FormatTest.cpp
+++ cfe/trunk/unittests/Format/FormatTest.cpp
@@ -11725,6 +11725,8 @@
 
 TEST_F(FormatTest, FormatsLambdas) {
   verifyFormat("int c = [b]() mutable { return [&b] { return b++; }(); }();\n");
+  verifyFormat(
+  "int c = [b]() mutable noexcept { return [&b] { return b++; }(); }();\n");
   verifyFormat("int c = [&] { [=] { return b++; }(); }();\n");
   verifyFormat("int c = [&, &a, a] { [=, c, &d] { return b++; }(); }();\n");
   verifyFormat("int c = [&a, &a, a] { [=, a, b, &c] { return b++; }(); }();\n");
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D57267: [AST] Factor out the logic of the various Expr::Ignore*

2019-01-30 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: lib/AST/Expr.cpp:2562
+static Expr *IgnoreImpCastsSingleStep(Expr *E) {
+  if (auto *ICE = dyn_cast_or_null(E))
+return ICE->getSubExpr();

riccibruno wrote:
> aaron.ballman wrote:
> > Do we really need to accept null arguments? We didn't previously, and this 
> > increases the overhead of something we do pretty often (though it's 
> > probably only a negligible performance hit).
> I did benchmark it to see if there is any difference but could not measure 
> any (looking at the generated code this adds a single null check at the 
> start). My concern was that it could be possible that some AST node has a 
> null child, perhaps when the AST is malformed. I will however defer to you or 
> Richard since I probably lack some of the background needed to make this 
> choice.
If it doesn't seem to have a measurable performance impact, I think it's 
reasonable.



Comment at: lib/AST/Expr.cpp:2563
+
+  else if (auto *FE = dyn_cast_or_null(E))
+return FE->getSubExpr();

No `else` after a `return`



Comment at: lib/AST/Expr.cpp:2580
+
+  else if (auto *NTTP = dyn_cast_or_null(E))
+return NTTP->getReplacement();

No `else` after a `return` (same elsewhere in the patch).



Comment at: lib/AST/Expr.cpp:2684
+
+namespace {
+

Rather than an unnamed namespace, you should prefer static function 
declarations per the style guide.



Comment at: lib/AST/Expr.cpp:2695
+/// Note that a null E is valid; in this case nothing is done.
+template  Expr *IgnoreExprNodes(Expr *E, FnTys &&... Fns) {
   Expr *LastE = nullptr;

Formatting looks off here, did clang-format produce this?


Repository:
  rC Clang

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

https://reviews.llvm.org/D57267



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


[clang-tools-extra] r352624 - [clangd] Drop fixes if replying with tweaks resulted in an error

2019-01-30 Thread Ilya Biryukov via cfe-commits
Author: ibiryukov
Date: Wed Jan 30 06:24:17 2019
New Revision: 352624

URL: http://llvm.org/viewvc/llvm-project?rev=352624&view=rev
Log:
[clangd] Drop fixes if replying with tweaks resulted in an error

This should not happen in normal operation, as it implies that the diagnostics
with some available fixes were produced but the AST is invalid.
Moreover, the code had an error: always returned code actions ignoring the
SupportsCodeAction capability and writing a test for this is impossible,
since this can only happen due to programmer's error rather than invalid inputs.

Modified:
clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
clang-tools-extra/trunk/test/clangd/fixits-codeaction.test

Modified: clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp?rev=352624&r1=352623&r2=352624&view=diff
==
--- clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp Wed Jan 30 06:24:17 2019
@@ -672,14 +672,8 @@ void ClangdLSPServer::onCodeAction(const
   [this](decltype(Reply) Reply, URIForFile File, std::string Code,
  Range Selection, std::vector FixIts,
  llvm::Expected> Tweaks) {
-if (!Tweaks) {
-  auto Err = Tweaks.takeError();
-  if (Err.isA())
-return Reply(std::move(Err)); // do no logging, this is expected.
-  elog("error while getting semantic code actions: {0}",
-   std::move(Err));
-  return Reply(llvm::json::Array(FixIts));
-}
+if (!Tweaks)
+  return Reply(Tweaks.takeError());
 
 std::vector Actions = std::move(FixIts);
 Actions.reserve(Actions.size() + Tweaks->size());

Modified: clang-tools-extra/trunk/test/clangd/fixits-codeaction.test
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clangd/fixits-codeaction.test?rev=352624&r1=352623&r2=352624&view=diff
==
--- clang-tools-extra/trunk/test/clangd/fixits-codeaction.test (original)
+++ clang-tools-extra/trunk/test/clangd/fixits-codeaction.test Wed Jan 30 
06:24:17 2019
@@ -23,7 +23,7 @@
 # CHECK-NEXT:"uri": "file://{{.*}}/foo.c"
 # CHECK-NEXT:  }
 ---
-{"jsonrpc":"2.0","id":2,"method":"textDocument/codeAction","params":{"textDocument":{"uri":"test:///foo.c"},"range":{"start":{"line":104,"character":13},"end":{"line":0,"character":35}},"context":{"diagnostics":[{"range":{"start":
 {"line": 0, "character": 32}, "end": {"line": 0, "character": 
37}},"severity":2,"message":"Using the result of an assignment as a condition 
without parentheses"}]}}}
+{"jsonrpc":"2.0","id":2,"method":"textDocument/codeAction","params":{"textDocument":{"uri":"test:///foo.c"},"range":{"start":{"line":0,"character":13},"end":{"line":0,"character":35}},"context":{"diagnostics":[{"range":{"start":
 {"line": 0, "character": 32}, "end": {"line": 0, "character": 
37}},"severity":2,"message":"Using the result of an assignment as a condition 
without parentheses"}]}}}
 #  CHECK:  "id": 2,
 # CHECK-NEXT:  "jsonrpc": "2.0",
 # CHECK-NEXT:  "result": [


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


[PATCH] D57032: [SemaCXX] Param diagnostic matches overload logic

2019-01-30 Thread Brian Gesiak via Phabricator via cfe-commits
modocache updated this revision to Diff 184284.
modocache added a comment.

Thanks, @cpplearner! You're absolutely right. I got confused because I didn't 
realize that the method `FunctionProtoType::getUnqualifiedType` was being used 
from within `Sema::FunctionParamTypesAreEqual`, not 
`QualType::getUnqualifiedType`. I modified my patch to use 
`ASTContext::hasSameUnqualifiedType` instead.


Repository:
  rC Clang

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

https://reviews.llvm.org/D57032

Files:
  lib/Sema/SemaDecl.cpp
  test/SemaCXX/function-redecl.cpp


Index: test/SemaCXX/function-redecl.cpp
===
--- test/SemaCXX/function-redecl.cpp
+++ test/SemaCXX/function-redecl.cpp
@@ -125,3 +125,9 @@
 }
 void Foo::beEvil() {} // expected-error {{out-of-line definition of 'beEvil' 
does not match any declaration in namespace 'redecl_typo::Foo'; did you mean 
'BeEvil'?}}
 }
+
+struct CVQualFun {
+  void func(int a, int &b); // expected-note {{type of 2nd parameter of member 
declaration does not match definition ('int &' vs 'int')}}
+};
+
+void CVQualFun::func(const int a, int b) {} // expected-error {{out-of-line 
definition of 'func' does not match any declaration in 'CVQualFun'}}
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -5087,7 +5087,7 @@
 QualType DefParamTy = Definition->getParamDecl(Idx)->getType();
 
 // The parameter types are identical
-if (Context.hasSameType(DefParamTy, DeclParamTy))
+if (Context.hasSameUnqualifiedType(DefParamTy, DeclParamTy))
   continue;
 
 QualType DeclParamBaseTy = getCoreType(DeclParamTy);


Index: test/SemaCXX/function-redecl.cpp
===
--- test/SemaCXX/function-redecl.cpp
+++ test/SemaCXX/function-redecl.cpp
@@ -125,3 +125,9 @@
 }
 void Foo::beEvil() {} // expected-error {{out-of-line definition of 'beEvil' does not match any declaration in namespace 'redecl_typo::Foo'; did you mean 'BeEvil'?}}
 }
+
+struct CVQualFun {
+  void func(int a, int &b); // expected-note {{type of 2nd parameter of member declaration does not match definition ('int &' vs 'int')}}
+};
+
+void CVQualFun::func(const int a, int b) {} // expected-error {{out-of-line definition of 'func' does not match any declaration in 'CVQualFun'}}
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -5087,7 +5087,7 @@
 QualType DefParamTy = Definition->getParamDecl(Idx)->getType();
 
 // The parameter types are identical
-if (Context.hasSameType(DefParamTy, DeclParamTy))
+if (Context.hasSameUnqualifiedType(DefParamTy, DeclParamTy))
   continue;
 
 QualType DeclParamBaseTy = getCoreType(DeclParamTy);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D56650: [lld] [ELF] Support customizing behavior on target triple

2019-01-30 Thread Kamil Rytarowski via Phabricator via cfe-commits
krytarowski added a comment.

@rui we need some resolution here. We have stronger feelings from the community 
to customize the linker directly based on detected triple.

At least other !GNU platforms will benefit from it too (at least FreeBSD, 
OpenBSD and other BSD derivations like mentioned CheriBSD).
FreeBSD already adds such target customization based on an emulation name hack, 
we cannot repeat it on NetBSD in the same way.

In the worst case we can even produce a new flavor of lld target that 
resembles/duplicates original ELF and targets (Net)BSD.

Under what circumstances and what model will you let to support this approach?

It does allow us better customization with keeping compat with other toolchain 
components, especially from the the GNU world.

Ideally we would get something for LLVM 8.0.. as it could be still backportable 
at least for downstream purposes. RC2 is planned for Feburary 6th and we need 
unpatched lld functional out of the box.


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

https://reviews.llvm.org/D56650



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


[PATCH] D57450: [RISCV] Set MaxAtomicInlineWidth and MaxAtomicPromoteWidth for RV32/RV64 targets with atomics

2019-01-30 Thread Alex Bradbury via Phabricator via cfe-commits
asb created this revision.
asb added reviewers: jfb, jyknight, wmi.
Herald added subscribers: jocewei, PkmX, rkruppe, the_o, brucehoult, 
MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, 
niosHD, sabuasal, apazos, simoncook, johnrusso, rbar.

This ensures that libcalls aren't generated when the target supports atomics. 
Atomics aren't in the base RV32I/RV64I instruction sets, so 
MaxAtomicInlineWidth and MaxAtomicPromoteWidth are set only when the atomics 
extension is being targeted. This must be done in setMaxAtomicWidth, as this 
should be done after handleTargetFeatures has been called.


Repository:
  rC Clang

https://reviews.llvm.org/D57450

Files:
  lib/Basic/Targets/RISCV.h
  test/CodeGen/riscv-atomics.c

Index: test/CodeGen/riscv-atomics.c
===
--- /dev/null
+++ test/CodeGen/riscv-atomics.c
@@ -0,0 +1,68 @@
+// RUN: %clang_cc1 -triple riscv32 -O1 -emit-llvm %s -o - \
+// RUN:   | FileCheck %s -check-prefix=RV32I
+// RUN: %clang_cc1 -triple riscv32 -target-feature +a -O1 -emit-llvm %s -o - \
+// RUN:   | FileCheck %s -check-prefix=RV32IA
+// RUN: %clang_cc1 -triple riscv64 -O1 -emit-llvm %s -o - \
+// RUN:   | FileCheck %s -check-prefix=RV64I
+// RUN: %clang_cc1 -triple riscv64 -target-feature +a -O1 -emit-llvm %s -o - \
+// RUN:   | FileCheck %s -check-prefix=RV64IA
+
+// This test demonstrates that MaxAtomicInlineWidth is set appropriately when
+// the atomics instruction set extension is enabled.
+
+#include 
+#include 
+
+void test_i8_atomics(_Atomic(int8_t) * a, int8_t b) {
+  // RV32I:  call zeroext i8 @__atomic_load_1
+  // RV32I:  call void @__atomic_store_1
+  // RV32I:  call zeroext i8 @__atomic_fetch_add_1
+  // RV32IA: load atomic i8, i8* %a seq_cst, align 1
+  // RV32IA: store atomic i8 %b, i8* %a seq_cst, align 1
+  // RV32IA: atomicrmw add i8* %a, i8 %b seq_cst
+  // RV64I:  call zeroext i8 @__atomic_load_1
+  // RV64I:  call void @__atomic_store_1
+  // RV64I:  call zeroext i8 @__atomic_fetch_add_1
+  // RV64IA: load atomic i8, i8* %a seq_cst, align 1
+  // RV64IA: store atomic i8 %b, i8* %a seq_cst, align 1
+  // RV64IA: atomicrmw add i8* %a, i8 %b seq_cst
+  __c11_atomic_load(a, memory_order_seq_cst);
+  __c11_atomic_store(a, b, memory_order_seq_cst);
+  __c11_atomic_fetch_add(a, b, memory_order_seq_cst);
+}
+
+void test_i32_atomics(_Atomic(int32_t) * a, int32_t b) {
+  // RV32I:  call i32 @__atomic_load_4
+  // RV32I:  call void @__atomic_store_4
+  // RV32I:  call i32 @__atomic_fetch_add_4
+  // RV32IA: load atomic i32, i32* %a seq_cst, align 4
+  // RV32IA: store atomic i32 %b, i32* %a seq_cst, align 4
+  // RV32IA: atomicrmw add i32* %a, i32 %b seq_cst
+  // RV64I:  call signext i32 @__atomic_load_4
+  // RV64I:  call void @__atomic_store_4
+  // RV64I:  call signext i32 @__atomic_fetch_add_4
+  // RV64IA: load atomic i32, i32* %a seq_cst, align 4
+  // RV64IA: store atomic i32 %b, i32* %a seq_cst, align 4
+  // RV64IA: atomicrmw add i32* %a, i32 %b seq_cst
+  __c11_atomic_load(a, memory_order_seq_cst);
+  __c11_atomic_store(a, b, memory_order_seq_cst);
+  __c11_atomic_fetch_add(a, b, memory_order_seq_cst);
+}
+
+void test_i64_atomics(_Atomic(int64_t) * a, int64_t b) {
+  // RV32I:  call i64 @__atomic_load_8
+  // RV32I:  call void @__atomic_store_8
+  // RV32I:  call i64 @__atomic_fetch_add_8
+  // RV32IA: call i64 @__atomic_load_8
+  // RV32IA: call void @__atomic_store_8
+  // RV32IA: call i64 @__atomic_fetch_add_8
+  // RV64I:  call i64 @__atomic_load_8
+  // RV64I:  call void @__atomic_store_8
+  // RV64I:  call i64 @__atomic_fetch_add_8
+  // RV64IA: load atomic i64, i64* %a seq_cst, align 8
+  // RV64IA: store atomic i64 %b, i64* %a seq_cst, align 8
+  // RV64IA: atomicrmw add i64* %a, i64 %b seq_cst
+  __c11_atomic_load(a, memory_order_seq_cst);
+  __c11_atomic_store(a, b, memory_order_seq_cst);
+  __c11_atomic_fetch_add(a, b, memory_order_seq_cst);
+}
Index: lib/Basic/Targets/RISCV.h
===
--- lib/Basic/Targets/RISCV.h
+++ lib/Basic/Targets/RISCV.h
@@ -88,6 +88,11 @@
 }
 return false;
   }
+
+  void setMaxAtomicWidth() override {
+if (HasA)
+  MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
+  }
 };
 class LLVM_LIBRARY_VISIBILITY RISCV64TargetInfo : public RISCVTargetInfo {
 public:
@@ -106,6 +111,11 @@
 }
 return false;
   }
+
+  void setMaxAtomicWidth() override {
+if (HasA)
+  MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
+  }
 };
 } // namespace targets
 } // namespace clang
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D57242: [RISCV] Specify MaxAtomicInlineWidth for RISC-V

2019-01-30 Thread Alex Bradbury via Phabricator via cfe-commits
asb added a comment.

Thanks Lewis, I actually had a patch for this which I forgot to clean up and 
submit. I've done so now: D57450 . That adds 
tests, and sets MaxAtomicInlineWidth and MaxAtomicPromoteWidth conditionally 
based on whether the target has the atomics extension or not.


Repository:
  rC Clang

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

https://reviews.llvm.org/D57242



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


[PATCH] D57452: [ASTDumper][OpenMP] CapturedDecl has a 'nothrow' bit

2019-01-30 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri created this revision.
lebedev.ri added reviewers: aaron.ballman, steveire.
lebedev.ri added projects: OpenMP, clang.
Herald added a subscriber: guansong.

Was trying to understand how complicated it would be to write
a clang-tidy `openmp-exception-escape`-ish check once D57100 
 lands.

Just so it happens, all the data is already there,
it is just conveniently omitted from AST dump.


Repository:
  rC Clang

https://reviews.llvm.org/D57452

Files:
  lib/AST/ASTDumper.cpp
  test/AST/dump.cpp


Index: test/AST/dump.cpp
===
--- test/AST/dump.cpp
+++ test/AST/dump.cpp
@@ -61,7 +61,7 @@
 // CHECK-NEXT: |   | `-ImplicitCastExpr {{.+}}  'int' 

 // CHECK-NEXT: |   |   `-DeclRefExpr {{.+}}  'int' lvalue 
OMPCapturedExpr {{.+}} '.capture_expr.' 'int'
 // CHECK-NEXT: |   `-CapturedStmt {{.+}} 
-// CHECK-NEXT: | |-CapturedDecl {{.+}} <> 
+// CHECK-NEXT: | |-CapturedDecl {{.+}} <>  
nothrow
 // CHECK-NEXT: | | |-ForStmt {{.+}} 
 // CHECK:  | | | `-UnaryOperator {{.+}}  'int' lvalue prefix '++'
 // CHECK-NEXT: | | |   `-DeclRefExpr {{.+}}  'int' lvalue 
OMPCapturedExpr {{.+}} 'a' 'int &'
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -727,6 +727,8 @@
 }
 
 void ASTDumper::VisitCapturedDecl(const CapturedDecl *D) {
+  if (D->isNothrow())
+OS << " nothrow";
   dumpStmt(D->getBody());
 }
 


Index: test/AST/dump.cpp
===
--- test/AST/dump.cpp
+++ test/AST/dump.cpp
@@ -61,7 +61,7 @@
 // CHECK-NEXT: |   | `-ImplicitCastExpr {{.+}}  'int' 
 // CHECK-NEXT: |   |   `-DeclRefExpr {{.+}}  'int' lvalue OMPCapturedExpr {{.+}} '.capture_expr.' 'int'
 // CHECK-NEXT: |   `-CapturedStmt {{.+}} 
-// CHECK-NEXT: | |-CapturedDecl {{.+}} <> 
+// CHECK-NEXT: | |-CapturedDecl {{.+}} <>  nothrow
 // CHECK-NEXT: | | |-ForStmt {{.+}} 
 // CHECK:  | | | `-UnaryOperator {{.+}}  'int' lvalue prefix '++'
 // CHECK-NEXT: | | |   `-DeclRefExpr {{.+}}  'int' lvalue OMPCapturedExpr {{.+}} 'a' 'int &'
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -727,6 +727,8 @@
 }
 
 void ASTDumper::VisitCapturedDecl(const CapturedDecl *D) {
+  if (D->isNothrow())
+OS << " nothrow";
   dumpStmt(D->getBody());
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D57452: [ASTDumper][OpenMP] CapturedDecl has a 'nothrow' bit

2019-01-30 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev accepted this revision.
ABataev added a comment.
This revision is now accepted and ready to land.

LG


Repository:
  rC Clang

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

https://reviews.llvm.org/D57452



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


[PATCH] D57452: [ASTDumper][OpenMP] CapturedDecl has a 'nothrow' bit

2019-01-30 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment.

In D57452#1377140 , @ABataev wrote:

> LG


Thank you for the review.


Repository:
  rC Clang

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

https://reviews.llvm.org/D57452



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


r352631 - [ASTDumper][OpenMP] CapturedDecl has a 'nothrow' bit

2019-01-30 Thread Roman Lebedev via cfe-commits
Author: lebedevri
Date: Wed Jan 30 07:41:20 2019
New Revision: 352631

URL: http://llvm.org/viewvc/llvm-project?rev=352631&view=rev
Log:
[ASTDumper][OpenMP] CapturedDecl has a 'nothrow' bit

Summary:
Was trying to understand how complicated it would be to write
a clang-tidy `openmp-exception-escape`-ish check once D57100 lands.

Just so it happens, all the data is already there,
it is just conveniently omitted from AST dump.

Reviewers: aaron.ballman, steveire, ABataev

Reviewed By: ABataev

Subscribers: ABataev, guansong, cfe-commits

Tags: #openmp, #clang

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

Modified:
cfe/trunk/lib/AST/ASTDumper.cpp
cfe/trunk/test/AST/dump.cpp

Modified: cfe/trunk/lib/AST/ASTDumper.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=352631&r1=352630&r2=352631&view=diff
==
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ cfe/trunk/lib/AST/ASTDumper.cpp Wed Jan 30 07:41:20 2019
@@ -727,6 +727,8 @@ void ASTDumper::VisitPragmaDetectMismatc
 }
 
 void ASTDumper::VisitCapturedDecl(const CapturedDecl *D) {
+  if (D->isNothrow())
+OS << " nothrow";
   dumpStmt(D->getBody());
 }
 

Modified: cfe/trunk/test/AST/dump.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/AST/dump.cpp?rev=352631&r1=352630&r2=352631&view=diff
==
--- cfe/trunk/test/AST/dump.cpp (original)
+++ cfe/trunk/test/AST/dump.cpp Wed Jan 30 07:41:20 2019
@@ -61,7 +61,7 @@ struct S {
 // CHECK-NEXT: |   | `-ImplicitCastExpr {{.+}}  'int' 

 // CHECK-NEXT: |   |   `-DeclRefExpr {{.+}}  'int' lvalue 
OMPCapturedExpr {{.+}} '.capture_expr.' 'int'
 // CHECK-NEXT: |   `-CapturedStmt {{.+}} 
-// CHECK-NEXT: | |-CapturedDecl {{.+}} <> 
+// CHECK-NEXT: | |-CapturedDecl {{.+}} <>  
nothrow
 // CHECK-NEXT: | | |-ForStmt {{.+}} 
 // CHECK:  | | | `-UnaryOperator {{.+}}  'int' lvalue prefix '++'
 // CHECK-NEXT: | | |   `-DeclRefExpr {{.+}}  'int' lvalue 
OMPCapturedExpr {{.+}} 'a' 'int &'


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


[PATCH] D57452: [ASTDumper][OpenMP] CapturedDecl has a 'nothrow' bit

2019-01-30 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL352631: [ASTDumper][OpenMP] CapturedDecl has a 
'nothrow' bit (authored by lebedevri, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D57452?vs=184298&id=184299#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D57452

Files:
  cfe/trunk/lib/AST/ASTDumper.cpp
  cfe/trunk/test/AST/dump.cpp


Index: cfe/trunk/lib/AST/ASTDumper.cpp
===
--- cfe/trunk/lib/AST/ASTDumper.cpp
+++ cfe/trunk/lib/AST/ASTDumper.cpp
@@ -727,6 +727,8 @@
 }
 
 void ASTDumper::VisitCapturedDecl(const CapturedDecl *D) {
+  if (D->isNothrow())
+OS << " nothrow";
   dumpStmt(D->getBody());
 }
 
Index: cfe/trunk/test/AST/dump.cpp
===
--- cfe/trunk/test/AST/dump.cpp
+++ cfe/trunk/test/AST/dump.cpp
@@ -61,7 +61,7 @@
 // CHECK-NEXT: |   | `-ImplicitCastExpr {{.+}}  'int' 

 // CHECK-NEXT: |   |   `-DeclRefExpr {{.+}}  'int' lvalue 
OMPCapturedExpr {{.+}} '.capture_expr.' 'int'
 // CHECK-NEXT: |   `-CapturedStmt {{.+}} 
-// CHECK-NEXT: | |-CapturedDecl {{.+}} <> 
+// CHECK-NEXT: | |-CapturedDecl {{.+}} <>  
nothrow
 // CHECK-NEXT: | | |-ForStmt {{.+}} 
 // CHECK:  | | | `-UnaryOperator {{.+}}  'int' lvalue prefix '++'
 // CHECK-NEXT: | | |   `-DeclRefExpr {{.+}}  'int' lvalue 
OMPCapturedExpr {{.+}} 'a' 'int &'


Index: cfe/trunk/lib/AST/ASTDumper.cpp
===
--- cfe/trunk/lib/AST/ASTDumper.cpp
+++ cfe/trunk/lib/AST/ASTDumper.cpp
@@ -727,6 +727,8 @@
 }
 
 void ASTDumper::VisitCapturedDecl(const CapturedDecl *D) {
+  if (D->isNothrow())
+OS << " nothrow";
   dumpStmt(D->getBody());
 }
 
Index: cfe/trunk/test/AST/dump.cpp
===
--- cfe/trunk/test/AST/dump.cpp
+++ cfe/trunk/test/AST/dump.cpp
@@ -61,7 +61,7 @@
 // CHECK-NEXT: |   | `-ImplicitCastExpr {{.+}}  'int' 
 // CHECK-NEXT: |   |   `-DeclRefExpr {{.+}}  'int' lvalue OMPCapturedExpr {{.+}} '.capture_expr.' 'int'
 // CHECK-NEXT: |   `-CapturedStmt {{.+}} 
-// CHECK-NEXT: | |-CapturedDecl {{.+}} <> 
+// CHECK-NEXT: | |-CapturedDecl {{.+}} <>  nothrow
 // CHECK-NEXT: | | |-ForStmt {{.+}} 
 // CHECK:  | | | `-UnaryOperator {{.+}}  'int' lvalue prefix '++'
 // CHECK-NEXT: | | |   `-DeclRefExpr {{.+}}  'int' lvalue OMPCapturedExpr {{.+}} 'a' 'int &'
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r352631 - [ASTDumper][OpenMP] CapturedDecl has a 'nothrow' bit

2019-01-30 Thread Aaron Ballman via cfe-commits
On Wed, Jan 30, 2019 at 10:41 AM Roman Lebedev via cfe-commits
 wrote:
>
> Author: lebedevri
> Date: Wed Jan 30 07:41:20 2019
> New Revision: 352631
>
> URL: http://llvm.org/viewvc/llvm-project?rev=352631&view=rev
> Log:
> [ASTDumper][OpenMP] CapturedDecl has a 'nothrow' bit
>
> Summary:
> Was trying to understand how complicated it would be to write
> a clang-tidy `openmp-exception-escape`-ish check once D57100 lands.
>
> Just so it happens, all the data is already there,
> it is just conveniently omitted from AST dump.
>
> Reviewers: aaron.ballman, steveire, ABataev
>
> Reviewed By: ABataev
>
> Subscribers: ABataev, guansong, cfe-commits
>
> Tags: #openmp, #clang
>
> Differential Revision: https://reviews.llvm.org/D57452
>
> Modified:
> cfe/trunk/lib/AST/ASTDumper.cpp
> cfe/trunk/test/AST/dump.cpp
>
> Modified: cfe/trunk/lib/AST/ASTDumper.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=352631&r1=352630&r2=352631&view=diff
> ==
> --- cfe/trunk/lib/AST/ASTDumper.cpp (original)
> +++ cfe/trunk/lib/AST/ASTDumper.cpp Wed Jan 30 07:41:20 2019
> @@ -727,6 +727,8 @@ void ASTDumper::VisitPragmaDetectMismatc
>  }
>
>  void ASTDumper::VisitCapturedDecl(const CapturedDecl *D) {
> +  if (D->isNothrow())
> +OS << " nothrow";

These changes should be to the TextNodeDumper, not the ASTDumper.

~Aaron

>dumpStmt(D->getBody());
>  }
>
>
> Modified: cfe/trunk/test/AST/dump.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/AST/dump.cpp?rev=352631&r1=352630&r2=352631&view=diff
> ==
> --- cfe/trunk/test/AST/dump.cpp (original)
> +++ cfe/trunk/test/AST/dump.cpp Wed Jan 30 07:41:20 2019
> @@ -61,7 +61,7 @@ struct S {
>  // CHECK-NEXT: |   | `-ImplicitCastExpr {{.+}}  'int' 
> 
>  // CHECK-NEXT: |   |   `-DeclRefExpr {{.+}}  'int' lvalue 
> OMPCapturedExpr {{.+}} '.capture_expr.' 'int'
>  // CHECK-NEXT: |   `-CapturedStmt {{.+}}  line:[[@LINE-14]]:9>
> -// CHECK-NEXT: | |-CapturedDecl {{.+}} <>  sloc>
> +// CHECK-NEXT: | |-CapturedDecl {{.+}} <>  sloc> nothrow
>  // CHECK-NEXT: | | |-ForStmt {{.+}}  line:[[@LINE-16]]:9>
>  // CHECK:  | | | `-UnaryOperator {{.+}}  col:9> 'int' lvalue prefix '++'
>  // CHECK-NEXT: | | |   `-DeclRefExpr {{.+}}  'int' lvalue 
> OMPCapturedExpr {{.+}} 'a' 'int &'
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r352631 - [ASTDumper][OpenMP] CapturedDecl has a 'nothrow' bit

2019-01-30 Thread Roman Lebedev via cfe-commits
On Wed, Jan 30, 2019 at 6:46 PM Aaron Ballman  wrote:
>
> On Wed, Jan 30, 2019 at 10:41 AM Roman Lebedev via cfe-commits
>  wrote:
> >
> > Author: lebedevri
> > Date: Wed Jan 30 07:41:20 2019
> > New Revision: 352631
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=352631&view=rev
> > Log:
> > [ASTDumper][OpenMP] CapturedDecl has a 'nothrow' bit
> >
> > Summary:
> > Was trying to understand how complicated it would be to write
> > a clang-tidy `openmp-exception-escape`-ish check once D57100 lands.
> >
> > Just so it happens, all the data is already there,
> > it is just conveniently omitted from AST dump.
> >
> > Reviewers: aaron.ballman, steveire, ABataev
> >
> > Reviewed By: ABataev
> >
> > Subscribers: ABataev, guansong, cfe-commits
> >
> > Tags: #openmp, #clang
> >
> > Differential Revision: https://reviews.llvm.org/D57452
> >
> > Modified:
> > cfe/trunk/lib/AST/ASTDumper.cpp
> > cfe/trunk/test/AST/dump.cpp
> >
> > Modified: cfe/trunk/lib/AST/ASTDumper.cpp
> > URL: 
> > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=352631&r1=352630&r2=352631&view=diff
> > ==
> > --- cfe/trunk/lib/AST/ASTDumper.cpp (original)
> > +++ cfe/trunk/lib/AST/ASTDumper.cpp Wed Jan 30 07:41:20 2019
> > @@ -727,6 +727,8 @@ void ASTDumper::VisitPragmaDetectMismatc
> >  }
> >
> >  void ASTDumper::VisitCapturedDecl(const CapturedDecl *D) {
> > +  if (D->isNothrow())
> > +OS << " nothrow";
>
> These changes should be to the TextNodeDumper, not the ASTDumper.
TextNodeDumper does not have a function that handles CapturedDecl.
Was there some RFC about this on cfe-dev i missed?
If not, might be a good idea to publicly state this..

> ~Aaron
Roman.

> >dumpStmt(D->getBody());
> >  }
> >
> >
> > Modified: cfe/trunk/test/AST/dump.cpp
> > URL: 
> > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/AST/dump.cpp?rev=352631&r1=352630&r2=352631&view=diff
> > ==
> > --- cfe/trunk/test/AST/dump.cpp (original)
> > +++ cfe/trunk/test/AST/dump.cpp Wed Jan 30 07:41:20 2019
> > @@ -61,7 +61,7 @@ struct S {
> >  // CHECK-NEXT: |   | `-ImplicitCastExpr {{.+}}  'int' 
> > 
> >  // CHECK-NEXT: |   |   `-DeclRefExpr {{.+}}  'int' lvalue 
> > OMPCapturedExpr {{.+}} '.capture_expr.' 'int'
> >  // CHECK-NEXT: |   `-CapturedStmt {{.+}}  > line:[[@LINE-14]]:9>
> > -// CHECK-NEXT: | |-CapturedDecl {{.+}} <>  > sloc>
> > +// CHECK-NEXT: | |-CapturedDecl {{.+}} <>  > sloc> nothrow
> >  // CHECK-NEXT: | | |-ForStmt {{.+}}  > line:[[@LINE-16]]:9>
> >  // CHECK:  | | | `-UnaryOperator {{.+}}  > col:9> 'int' lvalue prefix '++'
> >  // CHECK-NEXT: | | |   `-DeclRefExpr {{.+}}  'int' lvalue 
> > OMPCapturedExpr {{.+}} 'a' 'int &'
> >
> >
> > ___
> > cfe-commits mailing list
> > cfe-commits@lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r352631 - [ASTDumper][OpenMP] CapturedDecl has a 'nothrow' bit

2019-01-30 Thread Aaron Ballman via cfe-commits
On Wed, Jan 30, 2019 at 10:49 AM Roman Lebedev  wrote:
>
> On Wed, Jan 30, 2019 at 6:46 PM Aaron Ballman  wrote:
> >
> > On Wed, Jan 30, 2019 at 10:41 AM Roman Lebedev via cfe-commits
> >  wrote:
> > >
> > > Author: lebedevri
> > > Date: Wed Jan 30 07:41:20 2019
> > > New Revision: 352631
> > >
> > > URL: http://llvm.org/viewvc/llvm-project?rev=352631&view=rev
> > > Log:
> > > [ASTDumper][OpenMP] CapturedDecl has a 'nothrow' bit
> > >
> > > Summary:
> > > Was trying to understand how complicated it would be to write
> > > a clang-tidy `openmp-exception-escape`-ish check once D57100 lands.
> > >
> > > Just so it happens, all the data is already there,
> > > it is just conveniently omitted from AST dump.
> > >
> > > Reviewers: aaron.ballman, steveire, ABataev
> > >
> > > Reviewed By: ABataev
> > >
> > > Subscribers: ABataev, guansong, cfe-commits
> > >
> > > Tags: #openmp, #clang
> > >
> > > Differential Revision: https://reviews.llvm.org/D57452
> > >
> > > Modified:
> > > cfe/trunk/lib/AST/ASTDumper.cpp
> > > cfe/trunk/test/AST/dump.cpp
> > >
> > > Modified: cfe/trunk/lib/AST/ASTDumper.cpp
> > > URL: 
> > > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=352631&r1=352630&r2=352631&view=diff
> > > ==
> > > --- cfe/trunk/lib/AST/ASTDumper.cpp (original)
> > > +++ cfe/trunk/lib/AST/ASTDumper.cpp Wed Jan 30 07:41:20 2019
> > > @@ -727,6 +727,8 @@ void ASTDumper::VisitPragmaDetectMismatc
> > >  }
> > >
> > >  void ASTDumper::VisitCapturedDecl(const CapturedDecl *D) {
> > > +  if (D->isNothrow())
> > > +OS << " nothrow";
> >
> > These changes should be to the TextNodeDumper, not the ASTDumper.
> TextNodeDumper does not have a function that handles CapturedDecl.

Correct. You have to add it yourself.

> Was there some RFC about this on cfe-dev i missed?
> If not, might be a good idea to publicly state this..

There have been dozens of reviews over the past few months, as this is
an on-going refactoring.

~Aaron

>
> > ~Aaron
> Roman.
>
> > >dumpStmt(D->getBody());
> > >  }
> > >
> > >
> > > Modified: cfe/trunk/test/AST/dump.cpp
> > > URL: 
> > > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/AST/dump.cpp?rev=352631&r1=352630&r2=352631&view=diff
> > > ==
> > > --- cfe/trunk/test/AST/dump.cpp (original)
> > > +++ cfe/trunk/test/AST/dump.cpp Wed Jan 30 07:41:20 2019
> > > @@ -61,7 +61,7 @@ struct S {
> > >  // CHECK-NEXT: |   | `-ImplicitCastExpr {{.+}}  'int' 
> > > 
> > >  // CHECK-NEXT: |   |   `-DeclRefExpr {{.+}}  'int' lvalue 
> > > OMPCapturedExpr {{.+}} '.capture_expr.' 'int'
> > >  // CHECK-NEXT: |   `-CapturedStmt {{.+}}  > > line:[[@LINE-14]]:9>
> > > -// CHECK-NEXT: | |-CapturedDecl {{.+}} <>  > > sloc>
> > > +// CHECK-NEXT: | |-CapturedDecl {{.+}} <>  > > sloc> nothrow
> > >  // CHECK-NEXT: | | |-ForStmt {{.+}}  > > line:[[@LINE-16]]:9>
> > >  // CHECK:  | | | `-UnaryOperator {{.+}} 
> > >  'int' lvalue prefix '++'
> > >  // CHECK-NEXT: | | |   `-DeclRefExpr {{.+}}  'int' lvalue 
> > > OMPCapturedExpr {{.+}} 'a' 'int &'
> > >
> > >
> > > ___
> > > cfe-commits mailing list
> > > cfe-commits@lists.llvm.org
> > > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28462: clang-format: Add new style option AlignConsecutiveMacros

2019-01-30 Thread Nick Renieris via Phabricator via cfe-commits
VelocityRa added a comment.

In D28462#1376710 , @enyquist wrote:

> Looks fine to me, although I confess I did not build and run it because I 
> don't have the time to set up the environment again, took a few hours last 
> time I built from scratch (side note, if there's an easy way to speed up 
> llvm/clang compilation up I'd love to hear it :) ).


I selected to //only// build clang-format from within Visual Studio by setting 
it up as the "Start-up project" (I'm sure it's possible regardless of the build 
env.) and it only took about 10 minutes - maybe less - on a quad core. It 
doesn't use many LLVM/Clang components.

> Thanks for taking this over-- I started this because I really needed the 
> feature, but eventually gave up because we didn't need it anymore after a 
> while, and after chasing it on here for nearly a year it just wasn't worth 
> the effort anymore.

Props to you for sticking around so long, I know how tedious these things can 
get.


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

https://reviews.llvm.org/D28462



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


[PATCH] D57419: [ASTDump] Move Decl node dumping to TextNodeDumper

2019-01-30 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment.

Needs rebasing for rL352631 .


Repository:
  rC Clang

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

https://reviews.llvm.org/D57419



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


[PATCH] D57100: [clang-tidy] refactor bugprone-exception-escape analysis into class

2019-01-30 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri accepted this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.

Looked this over once more. To me this looks pretty straight-forward.
The caching seems ok, too. As long as `ExceptionAnalyzer` does not outlive
it's `TU`, everything should be fine.

@baloghadamsoftware - thoughts?




Comment at: clang-tidy/bugprone/ExceptionEscapeCheck.cpp:73-81
+  if (Tracer.throwsException(MatchedDecl))
+// FIXME: We should provide more information about the exact location where
+// the exception is thrown, maybe the full path the exception escapes
+diag(MatchedDecl->getLocation(),
+ "an exception may be thrown in function %0 "
+
+ "which should not throw exceptions")

I think you could do early-exit.
Also, if you de-split the string, clang-format might produce better formatting.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D57100



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


[PATCH] D57343: lit: Let lit.util.which() return a normcase()ed path

2019-01-30 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

zturner: ping


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

https://reviews.llvm.org/D57343



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


[PATCH] D57343: lit: Let lit.util.which() return a normcase()ed path

2019-01-30 Thread Zachary Turner via Phabricator via cfe-commits
zturner accepted this revision.
zturner added a comment.
This revision is now accepted and ready to land.

I think it's possible to detect the case insensitivity of the file system 
itself, rather than relying on the operating system which as you point out is 
neither necessary nor sufficient to identify case insensitivity.  But, also 
like you pointed out, that's another can of worms entirely, so I agree this is 
the simplest thing to make things better than before.


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

https://reviews.llvm.org/D57343



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


[PATCH] D57162: [DEBUG_INFO][NVPTX] Generate correct data about variable address class.

2019-01-30 Thread Paul Robinson via Phabricator via cfe-commits
probinson added inline comments.



Comment at: lib/CodeGen/CGDebugInfo.cpp:4235
 CGM.getContext().getTargetAddressSpace(D->getType());
+if (CGM.getLangOpts().CUDA && CGM.getLangOpts().CUDAIsDevice) {
+  if (D->hasAttr())

Can a variable have one of these CUDA attributes when CUDAIsDevice is false? 
I'm just wondering if the extra level of checking is really necessary or useful.


Repository:
  rC Clang

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

https://reviews.llvm.org/D57162



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


[PATCH] D57458: [docs][mips] Clang 8.0 Release notes

2019-01-30 Thread Simon Atanasyan via Phabricator via cfe-commits
atanasyan created this revision.
atanasyan added reviewers: hans, petarj, abeserminji, smaksimovic.
Herald added subscribers: arichardson, sdardis.

MIPS specific part of Clang 8.0 Release notes. Feel free to add more notes if I 
miss something.


Repository:
  rC Clang

https://reviews.llvm.org/D57458

Files:
  docs/ReleaseNotes.rst


Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -127,6 +127,10 @@
   manually and rely on the old behaviour you will need to add appropriate
   compiler flags for finding the corresponding libc++ include directory.
 
+- The integrated assembler is used now by default for all MIPS targets.
+
+- Improved support for MIPS N32 ABI and MIPS R6 target triples.
+
 New Compiler Flags
 --
 
@@ -139,6 +143,10 @@
 - When using a custom stack alignment, the ``stackrealign`` attribute is now
   implicitly set on the main function.
 
+- Emission of ``R_MIPS_JALR`` and ``R_MICROMIPS_JALR`` relocations can now
+  be controlled by the ``-mrelax-pic-calls`` and ``-mno-relax-pic-calls``
+  options.
+
 - ...
 
 Deprecated Compiler Flags


Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -127,6 +127,10 @@
   manually and rely on the old behaviour you will need to add appropriate
   compiler flags for finding the corresponding libc++ include directory.
 
+- The integrated assembler is used now by default for all MIPS targets.
+
+- Improved support for MIPS N32 ABI and MIPS R6 target triples.
+
 New Compiler Flags
 --
 
@@ -139,6 +143,10 @@
 - When using a custom stack alignment, the ``stackrealign`` attribute is now
   implicitly set on the main function.
 
+- Emission of ``R_MIPS_JALR`` and ``R_MICROMIPS_JALR`` relocations can now
+  be controlled by the ``-mrelax-pic-calls`` and ``-mno-relax-pic-calls``
+  options.
+
 - ...
 
 Deprecated Compiler Flags
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D56932: [Driver] [NetBSD] Pass default library search paths to linker

2019-01-30 Thread Rui Ueyama via Phabricator via cfe-commits
ruiu added a comment.

Looks good but I'm probably not the right person to approve a change to this 
file.


Repository:
  rC Clang

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

https://reviews.llvm.org/D56932



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


[PATCH] D57458: [docs][mips] Clang 8.0 Release notes

2019-01-30 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 good from my perspective. Let me know if you'd like me to commit, 
otherwise go and commit directly to the branch when you're ready.


Repository:
  rC Clang

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

https://reviews.llvm.org/D57458



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


[PATCH] D53329: Generate DIFile with main program if source is not available

2019-01-30 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song abandoned this revision.
yonghong-song added a comment.

Abandon this patch as the proposed fix is not correct. I have put relative 
information in the bug https://bugs.llvm.org/show_bug.cgi?id=40170.


Repository:
  rC Clang

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

https://reviews.llvm.org/D53329



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


[PATCH] D57162: [DEBUG_INFO][NVPTX] Generate correct data about variable address class.

2019-01-30 Thread Artem Belevich via Phabricator via cfe-commits
tra added inline comments.



Comment at: lib/CodeGen/CGDebugInfo.cpp:4235
 CGM.getContext().getTargetAddressSpace(D->getType());
+if (CGM.getLangOpts().CUDA && CGM.getLangOpts().CUDAIsDevice) {
+  if (D->hasAttr())

probinson wrote:
> Can a variable have one of these CUDA attributes when CUDAIsDevice is false? 
> I'm just wondering if the extra level of checking is really necessary or 
> useful.
`__shared__` are probably not going to be encountered on the host side, but 
`__constant__` ones may be.  E.g. we may have a global `__constant__` variable 
which will have a host-side address (it's actually the address of its host-side 
'shadow') which may be used by various CUDA functions to refer to it's real 
device-side instance.


Repository:
  rC Clang

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

https://reviews.llvm.org/D57162



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


[PATCH] D57464: Generalize method overloading on addr spaces to C++

2019-01-30 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia created this revision.
Anastasia added reviewers: rjmccall, ebevhan.

Here is my attempt to generalize the earlier work on method overloading with 
address spaces https://reviews.llvm.org/D55850 to work in C++ mode (not just 
OpenCL!).

This implementation doesn't apply yet to templated addr spaces because I would 
need to perform modifications on the extended function info. Also a couple of 
smaller corner cases are not handled. However, if the general direction is 
right, the rest can be build on top of this patch.


https://reviews.llvm.org/D57464

Files:
  lib/Parse/ParseDeclCXX.cpp
  lib/Sema/SemaType.cpp
  test/SemaCXX/address-space-method-overloading.cpp

Index: test/SemaCXX/address-space-method-overloading.cpp
===
--- /dev/null
+++ test/SemaCXX/address-space-method-overloading.cpp
@@ -0,0 +1,29 @@
+//RUN: %clang_cc1 %s -pedantic -verify
+
+struct TestAS1 {
+  int i;
+};
+
+struct TestAS2 {
+  char c;
+};
+
+struct C {
+TestAS1 bar() __attribute__((address_space(1))); // expected-note{{candidate function not viable: address space mismatch in 'this' argument ('__attribute__((address_space(3))) C'), parameter type must be '__attribute__((address_space(1))) C'}} expected-note{{candidate function}}
+TestAS2 bar() __attribute__((address_space(2))); // expected-note{{candidate function not viable: address space mismatch in 'this' argument ('__attribute__((address_space(3))) C'), parameter type must be '__attribute__((address_space(2))) C'}} expected-note{{candidate function}}
+void multiple_as() __attribute__((address_space(1))) __attribute__((address_space(2))); //expected-error{{multiple address spaces specified for type}} 
+// FIXME: Parser gets confused here.
+//auto bar() __attribute__((address_space(4))) -> decltype(this);
+};
+
+__attribute__((address_space(1))) C inas1;
+__attribute__((address_space(3))) C inas3;
+__attribute__((address_space(4))) C inas4;
+
+void foo() {
+   C noas;
+   TestAS1 ret = inas1.bar();
+   inas3.bar(); // expected-error{{no matching member function for call to 'bar'}}
+   //inas4.bar();
+   noas.bar(); // expected-error{{call to member function 'bar' is ambiguous}}
+}
Index: lib/Sema/SemaType.cpp
===
--- lib/Sema/SemaType.cpp
+++ lib/Sema/SemaType.cpp
@@ -3939,6 +3939,9 @@
   return false;
 }
 
+static bool ProcessAddressSpaceAttribute(Sema &S, const ParsedAttr &Attr,
+ LangAS &ASIdx, Expr *&ASArgExpr);
+
 static TypeSourceInfo *
 GetTypeSourceInfoForDeclarator(TypeProcessingState &State,
QualType T, TypeSourceInfo *ReturnTypeInfo);
@@ -4857,25 +4860,46 @@
  state.getDeclarator().getContext() ==
  DeclaratorContext::MemberContext;
 };
-
-if (state.getSema().getLangOpts().OpenCLCPlusPlus && IsClassMember()) {
-  LangAS ASIdx = LangAS::Default;
+if (IsClassMember()) {
+  auto CheckAS =
+  state.getSema().getLangOpts().OpenCLCPlusPlus
+  ? std::function{[&](ParsedAttr
+ &attr) {
+  return attr.asOpenCLLangAS();
+}}
+  : std::function{
+[&](ParsedAttr &attr) {
+  LangAS AS = LangAS::Default;
+  if (attr.getKind() == ParsedAttr::AT_AddressSpace) {
+Expr *ASArgExpr = nullptr;
+ProcessAddressSpaceAttribute(S, attr, AS,
+ ASArgExpr);
+// FIXME: We should extend logic to cover this case
+// or at least give an error?
+if (ASArgExpr->isValueDependent())
+  ;
+  }
+  return AS;
+}};
+  LangAS AS = LangAS::Default;
   // Take address space attr if any and mark as invalid to avoid adding
   // them later while creating QualType.
   if (FTI.MethodQualifiers)
 for (ParsedAttr &attr : FTI.MethodQualifiers->getAttributes()) {
-  LangAS ASIdxNew = attr.asOpenCLLangAS();
-  if (DiagnoseMultipleAddrSpaceAttributes(S, ASIdx, ASIdxNew,
+  LangAS ASNew = CheckAS(attr);
+  if (DiagnoseMultipleAddrSpaceAttributes(S, AS, ASNew,
   attr.getLoc()))
 D.setInvalidType(true);
   else
-ASIdx = ASIdxNew;
+AS = ASNew;
 }
-  // If a class member function's address space is not set, set it to
-  // __generic.
-  LangAS AS =
-  (ASIdx == LangAS::Default ? LangAS::open

[PATCH] D55673: [darwin] parse the SDK settings from SDKSettings.json if it exists and pass in the -target-sdk-version to the compiler and backend

2019-01-30 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment.

Would that be OK to use target_sdk_version to pass *CUDA* SDK version to the 
CC1 compilations?
I have upcoming changes that need to know the version to generate correct glue 
IR for CUDA. The driver currently figures out detected CUDA version in 
lib/Driver/ToolChains/Cuda.cpp and I could use -target-sdk-version to pass it 
on to CC1 instances.

On one hand CUDA is a target SDK and the option appears to be accessible 
exactly where I need it. On the other hand, my use case is not *exactly* the 
case `-target-sdk-version` was intended for (i.e. it's not darwin and it has 
nothing to do with module metadata, though it *may* be eventually useful there 
even for CUDA).

If using the option for CUDA sounds like too much of a hack, I guess I can add 
a separate `-cuda-sdk-version=`, though it would effectively replicate some of 
this patch.

Opinions?


Repository:
  rC Clang

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

https://reviews.llvm.org/D55673



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


[PATCH] D56650: [lld] [ELF] Support customizing behavior on target triple

2019-01-30 Thread Rui Ueyama via Phabricator via cfe-commits
ruiu added a comment.

Kamil,

I understand how adding `--target` option to the linker would make 
target-specific customization easier, but that's as I said not acceptable by 
design in lld. The code we have for FreeBSD just sets one bit in the output 
file, and that's fundamentally different from adding a "master switch" to turn 
on all customization for some specific target. We've been making changes to lld 
to make it work for many targets, but the features we've added are on by 
default (such as the code for Android TLS layout or supporting 
`.openbsd.randomdata` section for OpenBSD) or enabled by per-feature basis by a 
command line flag (such as *-freebsd emulation name). There's no flag like 
"turning lld into FreeBSD mode" or something like that. It seems to be working 
pretty well, and I'm happy about that design. So, I'm sorry, but I don't think 
I can support this patch's approach at all.

Honestly what's special about NetBSD from the lld's perspective seems to be the 
code ownership of the compiler driver. I can help you solve technical issues, 
but I don't think I should accept a patch that's against one of the lld's 
fundamental design choices to solve non-technical problems.


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

https://reviews.llvm.org/D56650



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


[PATCH] D55673: [darwin] parse the SDK settings from SDKSettings.json if it exists and pass in the -target-sdk-version to the compiler and backend

2019-01-30 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added a comment.

In D55673#1377404 , @tra wrote:

> Would that be OK to use target_sdk_version to pass *CUDA* SDK version to the 
> CC1 compilations?
>  I have upcoming changes that need to know the version to generate correct 
> glue IR for CUDA. The driver currently figures out detected CUDA version in 
> lib/Driver/ToolChains/Cuda.cpp and I could use -target-sdk-version to pass it 
> on to CC1 instances.
>
> On one hand CUDA is a target SDK and the option appears to be accessible 
> exactly where I need it. On the other hand, my use case is not *exactly* the 
> case `-target-sdk-version` was intended for (i.e. it's not darwin and it has 
> nothing to do with module metadata, though it *may* be eventually useful 
> there even for CUDA).
>
> If using the option for CUDA sounds like too much of a hack, I guess I can 
> add a separate `-cuda-sdk-version=`, though it would effectively replicate 
> some of this patch.
>
> Opinions?


I would be ok with reusing that option, as long as it's documented that there 
is a difference in terms of how it can be used.


Repository:
  rC Clang

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

https://reviews.llvm.org/D55673



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


[PATCH] D56650: [lld] [ELF] Support customizing behavior on target triple

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

I think the main concern is that if we link `ld -> ld.lld`, gcc will no longer 
work out of the box. So we would have to repeat all the logic in gcc and in any 
other compiler that calls `ld` directly.


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

https://reviews.llvm.org/D56650



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


[PATCH] D57427: [CodeGen][ObjC] Fix assert on calling `__builtin_constant_p` with ObjC objects.

2019-01-30 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai updated this revision to Diff 184334.
vsapsai added a comment.

- Add in the test `-disable-llvm-passes` and relax FileCheck expectations to 
accept alloca-store-load.


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

https://reviews.llvm.org/D57427

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGenObjC/builtin-constant-p.m


Index: clang/test/CodeGenObjC/builtin-constant-p.m
===
--- /dev/null
+++ clang/test/CodeGenObjC/builtin-constant-p.m
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -O3 
-disable-llvm-passes -o - %s | FileCheck %s
+
+// Test that can call `__builtin_constant_p` with instances of different
+// Objective-C classes.
+// rdar://problem/47499250
+@class Foo;
+@class Bar;
+
+extern void callee(void);
+
+// CHECK-LABEL: define void @test(%0* %foo, %1* %bar)
+void test(Foo *foo, Bar *bar) {
+  // CHECK: [[ADDR_FOO:%.*]] = bitcast %0* %{{.*}} to i8*
+  // CHECK-NEXT: call i1 @llvm.is.constant.p0i8(i8* [[ADDR_FOO]])
+  // CHECK: [[ADDR_BAR:%.*]] = bitcast %1* %{{.*}} to i8*
+  // CHECK-NEXT: call i1 @llvm.is.constant.p0i8(i8* [[ADDR_BAR]])
+  if (__builtin_constant_p(foo) && __builtin_constant_p(bar))
+callee();
+}
+
+// Test other Objective-C types.
+// CHECK-LABEL: define void @test_more(i8* %object, i8* %klass)
+void test_more(id object, Class klass) {
+  // CHECK: call i1 @llvm.is.constant.p0i8(i8* %{{.*}})
+  // CHECK: call i1 @llvm.is.constant.p0i8(i8* %{{.*}})
+  if (__builtin_constant_p(object) && __builtin_constant_p(klass))
+callee();
+}
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -1972,6 +1972,12 @@
   return RValue::get(ConstantInt::get(ResultType, 0));
 
 Value *ArgValue = EmitScalarExpr(Arg);
+if (ArgType->isObjCObjectPointerType()) {
+  // Convert Objective-C objects to id because we cannot distinguish 
between
+  // LLVM types for Obj-C classes as they are opaque.
+  ArgType = CGM.getContext().getObjCIdType();
+  ArgValue = Builder.CreateBitCast(ArgValue, ConvertType(ArgType));
+}
 Value *F = CGM.getIntrinsic(Intrinsic::is_constant, ConvertType(ArgType));
 Value *Result = Builder.CreateCall(F, ArgValue);
 if (Result->getType() != ResultType)


Index: clang/test/CodeGenObjC/builtin-constant-p.m
===
--- /dev/null
+++ clang/test/CodeGenObjC/builtin-constant-p.m
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -O3 -disable-llvm-passes -o - %s | FileCheck %s
+
+// Test that can call `__builtin_constant_p` with instances of different
+// Objective-C classes.
+// rdar://problem/47499250
+@class Foo;
+@class Bar;
+
+extern void callee(void);
+
+// CHECK-LABEL: define void @test(%0* %foo, %1* %bar)
+void test(Foo *foo, Bar *bar) {
+  // CHECK: [[ADDR_FOO:%.*]] = bitcast %0* %{{.*}} to i8*
+  // CHECK-NEXT: call i1 @llvm.is.constant.p0i8(i8* [[ADDR_FOO]])
+  // CHECK: [[ADDR_BAR:%.*]] = bitcast %1* %{{.*}} to i8*
+  // CHECK-NEXT: call i1 @llvm.is.constant.p0i8(i8* [[ADDR_BAR]])
+  if (__builtin_constant_p(foo) && __builtin_constant_p(bar))
+callee();
+}
+
+// Test other Objective-C types.
+// CHECK-LABEL: define void @test_more(i8* %object, i8* %klass)
+void test_more(id object, Class klass) {
+  // CHECK: call i1 @llvm.is.constant.p0i8(i8* %{{.*}})
+  // CHECK: call i1 @llvm.is.constant.p0i8(i8* %{{.*}})
+  if (__builtin_constant_p(object) && __builtin_constant_p(klass))
+callee();
+}
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -1972,6 +1972,12 @@
   return RValue::get(ConstantInt::get(ResultType, 0));
 
 Value *ArgValue = EmitScalarExpr(Arg);
+if (ArgType->isObjCObjectPointerType()) {
+  // Convert Objective-C objects to id because we cannot distinguish between
+  // LLVM types for Obj-C classes as they are opaque.
+  ArgType = CGM.getContext().getObjCIdType();
+  ArgValue = Builder.CreateBitCast(ArgValue, ConvertType(ArgType));
+}
 Value *F = CGM.getIntrinsic(Intrinsic::is_constant, ConvertType(ArgType));
 Value *Result = Builder.CreateCall(F, ArgValue);
 if (Result->getType() != ResultType)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D57435: [clang-tidy] Add abseil-wrap-unique check

2019-01-30 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added inline comments.



Comment at: clang-tidy/abseil/AbseilTidyModule.cpp:61
+"abseil-wrap-unique");
+ 
+ }

Unnecessary empty line.



Comment at: clang-tidy/abseil/WrapUniqueCheck.cpp:10
+
+#include 
+#include "WrapUniqueCheck.h"

Please run Clang-format.



Comment at: clang-tidy/abseil/WrapUniqueCheck.cpp:75
+  if(cons){
+   
+if (cons->isListInitialization()){

Unnecessary empty line.



Comment at: docs/ReleaseNotes.rst:70
 
+- New :doc:`abseil-wrap-unique
+  ` check.

Please use alphabetical order in new checks list.



Comment at: docs/ReleaseNotes.rst:74
+  Looks for instances of factory functions which uses a non-public constructor
+  that returns a std::unqiue_ptr then recommends using 
+  absl::wrap_unique(new T(...)).

Please use `` to highlight language constructs. Same in documentation.



Comment at: docs/clang-tidy/checks/abseil-wrap-unique.rst:6
+
+Checks for instances of static function within a class being called and
+returning a std:unique_ptr type. Also checks for instances where reset

Please synchronize first statement with Release Notes.



Comment at: docs/clang-tidy/checks/abseil-wrap-unique.rst:24
+ 
+  //Original - reset called with a static function returning a std::unqiue_ptr
+  a.reset(A::NewA());

Please run Clang-format over code snippets.



Comment at: test/clang-tidy/abseil-wrap-unique.cpp:3
+
+
+namespace std {

Unnecessary empty line.



Comment at: test/clang-tidy/abseil-wrap-unique.cpp:31
+}  // namespace std
+
+

Unnecessary empty line.



Comment at: test/clang-tidy/abseil-wrap-unique.cpp:88
+  //std::unique_ptr e(new int[2] {1,2});
+  
+}

Unnecessary empty line.



Comment at: test/clang-tidy/abseil-wrap-unique.cpp:90
+}
+
+

Unnecessary empty lines.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D57435



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


[PATCH] D56650: [lld] [ELF] Support customizing behavior on target triple

2019-01-30 Thread Rui Ueyama via Phabricator via cfe-commits
ruiu added a comment.

But that's only adding missing `-L` and perhaps a few more, no? That doesn't 
seem too hard to do in gcc. I don't want to repeat what compiler drivers do in 
the linker. Also, even with this patch, you need to make a change to gcc to 
pass `--target` parameter to the linker, right?


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

https://reviews.llvm.org/D56650



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


Re: r352610 - [clang] [Driver] [NetBSD] Append -rpath for shared compiler-rt runtimes

2019-01-30 Thread Hans Wennborg via cfe-commits
Merged to 8.0 in r352650.

On Wed, Jan 30, 2019 at 3:20 AM Michal Gorny via cfe-commits
 wrote:
>
> Author: mgorny
> Date: Wed Jan 30 00:20:24 2019
> New Revision: 352610
>
> URL: http://llvm.org/viewvc/llvm-project?rev=352610&view=rev
> Log:
> [clang] [Driver] [NetBSD] Append -rpath for shared compiler-rt runtimes
>
> Append appropriate -rpath when using shared compiler-rt runtimes,
> e.g. '-fsanitize=address -shared-libasan'.  There's already a similar
> logic in CommonArgs.cpp but it uses non-standard arch-suffixed
> installation directory while we want our driver to work with standard
> installation paths.
>
> Differential Revision: https://reviews.llvm.org/D57303
>
> Modified:
> cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp
>
> Modified: cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp?rev=352610&r1=352609&r2=352610&view=diff
> ==
> --- cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp (original)
> +++ cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp Wed Jan 30 00:20:24 2019
> @@ -255,6 +255,13 @@ void netbsd::Linker::ConstructJob(Compil
>bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs);
>AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA);
>
> +  const SanitizerArgs &SanArgs = ToolChain.getSanitizerArgs();
> +  if (SanArgs.needsSharedRt()) {
> +CmdArgs.push_back("-rpath");
> +CmdArgs.push_back(Args.MakeArgString(
> +ToolChain.getCompilerRTPath().c_str()));
> +  }
> +
>unsigned Major, Minor, Micro;
>ToolChain.getTriple().getOSVersion(Major, Minor, Micro);
>bool useLibgcc = true;
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D56650: [lld] [ELF] Support customizing behavior on target triple

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

In D56650#1377494 , @ruiu wrote:

> But that's only adding missing `-L` and perhaps a few more, no? That doesn't 
> seem too hard to do in gcc.


Probably not, provided nobody will block it. I'm not the one opposed to it.

> I don't want to repeat what compiler drivers do in the linker. Also, even 
> with this patch, you need to make a change to gcc to pass `--target` 
> parameter to the linker, right?

Well, no, since gcc doesn't really support cross-compiling the way clang does, 
so it will just be happy with LLVM's default triple. We will probably want to 
patch GNU ld to accept/ignore `--target` though.


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

https://reviews.llvm.org/D56650



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


[PATCH] D52339: Support enums with a fixed underlying type in all language modes

2019-01-30 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added a comment.
Herald added a subscriber: jkorous.

@erik.pilkington the change to make `objc_fixed_enum` true in non-ObjC mode 
turned out to be problematic for our adoption. Could you please fix it before 
LLVM8 is wrapped up so that we don't ship this extension as on by default for 
all language modes?


Repository:
  rC Clang

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

https://reviews.llvm.org/D52339



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


[PATCH] D53076: [analyzer] Enhance ConditionBRVisitor to write out more information

2019-01-30 Thread Csaba Dabis via Phabricator via cfe-commits
Charusso added a comment.

Thanks you @NoQ! Luckily it is rely on `ProgramPoints` now. The only problem as 
I see the mentioned Z3-test, where I have no idea what happened.


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

https://reviews.llvm.org/D53076



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


[PATCH] D52339: Support enums with a fixed underlying type in all language modes

2019-01-30 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added a comment.

We could introduce a new extension flag like `c_fixed_enum` that can be set for 
all language modes. `objc_fixed_enum` should apply to ObjC only.


Repository:
  rC Clang

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

https://reviews.llvm.org/D52339



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


[libunwind] r352654 - [CMake] Use correct visibility for linked libraries in CMake

2019-01-30 Thread Petr Hosek via cfe-commits
Author: phosek
Date: Wed Jan 30 11:27:26 2019
New Revision: 352654

URL: http://llvm.org/viewvc/llvm-project?rev=352654&view=rev
Log:
[CMake] Use correct visibility for linked libraries in CMake

When linking library dependencies, we shouldn't need to export linked
libraries to dependents. We should be explicit about this in
target_link_libraries, otherwise other targets that depend on these such
as sanitizers get repeated (and possibly even conflicting) dependencies.

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

Modified:
libunwind/trunk/src/CMakeLists.txt

Modified: libunwind/trunk/src/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/CMakeLists.txt?rev=352654&r1=352653&r2=352654&view=diff
==
--- libunwind/trunk/src/CMakeLists.txt (original)
+++ libunwind/trunk/src/CMakeLists.txt Wed Jan 30 11:27:26 2019
@@ -146,7 +146,7 @@ if (LIBUNWIND_ENABLE_SHARED)
   if(COMMAND llvm_setup_rpath)
 llvm_setup_rpath(unwind_shared)
   endif()
-  target_link_libraries(unwind_shared ${libraries})
+  target_link_libraries(unwind_shared PRIVATE ${libraries})
   set_target_properties(unwind_shared
 PROPERTIES
   LINK_FLAGS"${LIBUNWIND_LINK_FLAGS}"
@@ -162,7 +162,7 @@ endif()
 # Build the static library.
 if (LIBUNWIND_ENABLE_STATIC)
   add_library(unwind_static STATIC ${unwind_static_sources})
-  target_link_libraries(unwind_static ${libraries})
+  target_link_libraries(unwind_static PRIVATE ${libraries})
   set_target_properties(unwind_static
 PROPERTIES
   LINK_FLAGS"${LIBUNWIND_LINK_FLAGS}"


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


[PATCH] D56650: [lld] [ELF] Support customizing behavior on target triple

2019-01-30 Thread Rui Ueyama via Phabricator via cfe-commits
ruiu added a comment.

If you still need to patch GNU ld, it doesn't seems like this patch makes 
things easier for you. (But even if this would make it easier for you, this 
patch's approach is not okay by design though.)


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

https://reviews.llvm.org/D56650



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


r352655 - [ASTDump] Move Decl node dumping to TextNodeDumper

2019-01-30 Thread Stephen Kelly via cfe-commits
Author: steveire
Date: Wed Jan 30 11:32:48 2019
New Revision: 352655

URL: http://llvm.org/viewvc/llvm-project?rev=352655&view=rev
Log:
[ASTDump] Move Decl node dumping to TextNodeDumper

Reviewers: aaron.ballman

Subscribers: jfb, cfe-commits

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

Modified:
cfe/trunk/include/clang/AST/TextNodeDumper.h
cfe/trunk/lib/AST/ASTDumper.cpp
cfe/trunk/lib/AST/TextNodeDumper.cpp

Modified: cfe/trunk/include/clang/AST/TextNodeDumper.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TextNodeDumper.h?rev=352655&r1=352654&r2=352655&view=diff
==
--- cfe/trunk/include/clang/AST/TextNodeDumper.h (original)
+++ cfe/trunk/include/clang/AST/TextNodeDumper.h Wed Jan 30 11:32:48 2019
@@ -18,6 +18,7 @@
 #include "clang/AST/AttrVisitor.h"
 #include "clang/AST/CommentCommandTraits.h"
 #include "clang/AST/CommentVisitor.h"
+#include "clang/AST/DeclVisitor.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/StmtVisitor.h"
 #include "clang/AST/TemplateArgumentVisitor.h"
@@ -128,7 +129,8 @@ class TextNodeDumper
   public ConstAttrVisitor,
   public ConstTemplateArgumentVisitor,
   public ConstStmtVisitor,
-  public TypeVisitor {
+  public TypeVisitor,
+  public ConstDeclVisitor {
   raw_ostream &OS;
   const bool ShowColors;
 
@@ -291,6 +293,57 @@ public:
   void VisitObjCInterfaceType(const ObjCInterfaceType *T);
   void VisitPackExpansionType(const PackExpansionType *T);
 
+  void VisitLabelDecl(const LabelDecl *D);
+  void VisitTypedefDecl(const TypedefDecl *D);
+  void VisitEnumDecl(const EnumDecl *D);
+  void VisitRecordDecl(const RecordDecl *D);
+  void VisitEnumConstantDecl(const EnumConstantDecl *D);
+  void VisitIndirectFieldDecl(const IndirectFieldDecl *D);
+  void VisitFunctionDecl(const FunctionDecl *D);
+  void VisitFieldDecl(const FieldDecl *D);
+  void VisitVarDecl(const VarDecl *D);
+  void VisitBindingDecl(const BindingDecl *D);
+  void VisitCapturedDecl(const CapturedDecl *D);
+  void VisitImportDecl(const ImportDecl *D);
+  void VisitPragmaCommentDecl(const PragmaCommentDecl *D);
+  void VisitPragmaDetectMismatchDecl(const PragmaDetectMismatchDecl *D);
+  void VisitOMPDeclareReductionDecl(const OMPDeclareReductionDecl *D);
+  void VisitOMPRequiresDecl(const OMPRequiresDecl *D);
+  void VisitOMPCapturedExprDecl(const OMPCapturedExprDecl *D);
+  void VisitNamespaceDecl(const NamespaceDecl *D);
+  void VisitUsingDirectiveDecl(const UsingDirectiveDecl *D);
+  void VisitNamespaceAliasDecl(const NamespaceAliasDecl *D);
+  void VisitTypeAliasDecl(const TypeAliasDecl *D);
+  void VisitTypeAliasTemplateDecl(const TypeAliasTemplateDecl *D);
+  void VisitCXXRecordDecl(const CXXRecordDecl *D);
+  void VisitFunctionTemplateDecl(const FunctionTemplateDecl *D);
+  void VisitClassTemplateDecl(const ClassTemplateDecl *D);
+  void VisitBuiltinTemplateDecl(const BuiltinTemplateDecl *D);
+  void VisitVarTemplateDecl(const VarTemplateDecl *D);
+  void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D);
+  void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D);
+  void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl *D);
+  void VisitUsingDecl(const UsingDecl *D);
+  void VisitUnresolvedUsingTypenameDecl(const UnresolvedUsingTypenameDecl *D);
+  void VisitUnresolvedUsingValueDecl(const UnresolvedUsingValueDecl *D);
+  void VisitUsingShadowDecl(const UsingShadowDecl *D);
+  void VisitConstructorUsingShadowDecl(const ConstructorUsingShadowDecl *D);
+  void VisitLinkageSpecDecl(const LinkageSpecDecl *D);
+  void VisitAccessSpecDecl(const AccessSpecDecl *D);
+  void VisitFriendDecl(const FriendDecl *D);
+  void VisitObjCIvarDecl(const ObjCIvarDecl *D);
+  void VisitObjCMethodDecl(const ObjCMethodDecl *D);
+  void VisitObjCTypeParamDecl(const ObjCTypeParamDecl *D);
+  void VisitObjCCategoryDecl(const ObjCCategoryDecl *D);
+  void VisitObjCCategoryImplDecl(const ObjCCategoryImplDecl *D);
+  void VisitObjCProtocolDecl(const ObjCProtocolDecl *D);
+  void VisitObjCInterfaceDecl(const ObjCInterfaceDecl *D);
+  void VisitObjCImplementationDecl(const ObjCImplementationDecl *D);
+  void VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D);
+  void VisitObjCPropertyDecl(const ObjCPropertyDecl *D);
+  void VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D);
+  void VisitBlockDecl(const BlockDecl *D);
+
 private:
   void dumpCXXTemporary(const CXXTemporary *Temporary);
 };

Modified: cfe/trunk/lib/AST/ASTDumper.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=352655&r1=352654&r2=352655&view=diff
==
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ cfe/trunk/lib/AST/ASTDumper.cpp Wed Jan 30 11:32:48 2019
@@ -51,9 +51,6 @@ namespace  {
 
 raw_ostream &OS;
 
-/// The policy to use for printing; can be defa

[PATCH] D57419: [ASTDump] Move Decl node dumping to TextNodeDumper

2019-01-30 Thread Stephen Kelly via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL352655: [ASTDump] Move Decl node dumping to TextNodeDumper 
(authored by steveire, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D57419?vs=184190&id=184344#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D57419

Files:
  cfe/trunk/include/clang/AST/TextNodeDumper.h
  cfe/trunk/lib/AST/ASTDumper.cpp
  cfe/trunk/lib/AST/TextNodeDumper.cpp

Index: cfe/trunk/include/clang/AST/TextNodeDumper.h
===
--- cfe/trunk/include/clang/AST/TextNodeDumper.h
+++ cfe/trunk/include/clang/AST/TextNodeDumper.h
@@ -18,6 +18,7 @@
 #include "clang/AST/AttrVisitor.h"
 #include "clang/AST/CommentCommandTraits.h"
 #include "clang/AST/CommentVisitor.h"
+#include "clang/AST/DeclVisitor.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/StmtVisitor.h"
 #include "clang/AST/TemplateArgumentVisitor.h"
@@ -128,7 +129,8 @@
   public ConstAttrVisitor,
   public ConstTemplateArgumentVisitor,
   public ConstStmtVisitor,
-  public TypeVisitor {
+  public TypeVisitor,
+  public ConstDeclVisitor {
   raw_ostream &OS;
   const bool ShowColors;
 
@@ -291,6 +293,57 @@
   void VisitObjCInterfaceType(const ObjCInterfaceType *T);
   void VisitPackExpansionType(const PackExpansionType *T);
 
+  void VisitLabelDecl(const LabelDecl *D);
+  void VisitTypedefDecl(const TypedefDecl *D);
+  void VisitEnumDecl(const EnumDecl *D);
+  void VisitRecordDecl(const RecordDecl *D);
+  void VisitEnumConstantDecl(const EnumConstantDecl *D);
+  void VisitIndirectFieldDecl(const IndirectFieldDecl *D);
+  void VisitFunctionDecl(const FunctionDecl *D);
+  void VisitFieldDecl(const FieldDecl *D);
+  void VisitVarDecl(const VarDecl *D);
+  void VisitBindingDecl(const BindingDecl *D);
+  void VisitCapturedDecl(const CapturedDecl *D);
+  void VisitImportDecl(const ImportDecl *D);
+  void VisitPragmaCommentDecl(const PragmaCommentDecl *D);
+  void VisitPragmaDetectMismatchDecl(const PragmaDetectMismatchDecl *D);
+  void VisitOMPDeclareReductionDecl(const OMPDeclareReductionDecl *D);
+  void VisitOMPRequiresDecl(const OMPRequiresDecl *D);
+  void VisitOMPCapturedExprDecl(const OMPCapturedExprDecl *D);
+  void VisitNamespaceDecl(const NamespaceDecl *D);
+  void VisitUsingDirectiveDecl(const UsingDirectiveDecl *D);
+  void VisitNamespaceAliasDecl(const NamespaceAliasDecl *D);
+  void VisitTypeAliasDecl(const TypeAliasDecl *D);
+  void VisitTypeAliasTemplateDecl(const TypeAliasTemplateDecl *D);
+  void VisitCXXRecordDecl(const CXXRecordDecl *D);
+  void VisitFunctionTemplateDecl(const FunctionTemplateDecl *D);
+  void VisitClassTemplateDecl(const ClassTemplateDecl *D);
+  void VisitBuiltinTemplateDecl(const BuiltinTemplateDecl *D);
+  void VisitVarTemplateDecl(const VarTemplateDecl *D);
+  void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D);
+  void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D);
+  void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl *D);
+  void VisitUsingDecl(const UsingDecl *D);
+  void VisitUnresolvedUsingTypenameDecl(const UnresolvedUsingTypenameDecl *D);
+  void VisitUnresolvedUsingValueDecl(const UnresolvedUsingValueDecl *D);
+  void VisitUsingShadowDecl(const UsingShadowDecl *D);
+  void VisitConstructorUsingShadowDecl(const ConstructorUsingShadowDecl *D);
+  void VisitLinkageSpecDecl(const LinkageSpecDecl *D);
+  void VisitAccessSpecDecl(const AccessSpecDecl *D);
+  void VisitFriendDecl(const FriendDecl *D);
+  void VisitObjCIvarDecl(const ObjCIvarDecl *D);
+  void VisitObjCMethodDecl(const ObjCMethodDecl *D);
+  void VisitObjCTypeParamDecl(const ObjCTypeParamDecl *D);
+  void VisitObjCCategoryDecl(const ObjCCategoryDecl *D);
+  void VisitObjCCategoryImplDecl(const ObjCCategoryImplDecl *D);
+  void VisitObjCProtocolDecl(const ObjCProtocolDecl *D);
+  void VisitObjCInterfaceDecl(const ObjCInterfaceDecl *D);
+  void VisitObjCImplementationDecl(const ObjCImplementationDecl *D);
+  void VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D);
+  void VisitObjCPropertyDecl(const ObjCPropertyDecl *D);
+  void VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D);
+  void VisitBlockDecl(const BlockDecl *D);
+
 private:
   void dumpCXXTemporary(const CXXTemporary *Temporary);
 };
Index: cfe/trunk/lib/AST/ASTDumper.cpp
===
--- cfe/trunk/lib/AST/ASTDumper.cpp
+++ cfe/trunk/lib/AST/ASTDumper.cpp
@@ -51,9 +51,6 @@
 
 raw_ostream &OS;
 
-/// The policy to use for printing; can be defaulted.
-PrintingPolicy PrintPolicy;
-
 /// Indicates whether we should trigger deserialization of nodes that had
 /// not already been loaded.
 bool Deserialize = false;
@@ -81,7 +78,7 @@
   const SourceManager *SM, bool ShowCol

[PATCH] D57419: [ASTDump] Move Decl node dumping to TextNodeDumper

2019-01-30 Thread Stephen Kelly via Phabricator via cfe-commits
steveire added a comment.

In D57419#1377187 , @lebedev.ri wrote:

> Needs rebasing for rL352631 .


Thanks. Rebased and re-tested.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D57419



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


r352656 - [ASTDump] NFC: Inline vestigial methods

2019-01-30 Thread Stephen Kelly via cfe-commits
Author: steveire
Date: Wed Jan 30 11:41:04 2019
New Revision: 352656

URL: http://llvm.org/viewvc/llvm-project?rev=352656&view=rev
Log:
[ASTDump] NFC: Inline vestigial methods

This was a porting aid.

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

Modified: cfe/trunk/lib/AST/ASTDumper.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=352656&r1=352655&r2=352656&view=diff
==
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ cfe/trunk/lib/AST/ASTDumper.cpp Wed Jan 30 11:41:04 2019
@@ -57,14 +57,6 @@ namespace  {
 
 const bool ShowColors;
 
-/// Dump a child of the current node.
-template void dumpChild(Fn DoDumpChild) {
-  NodeDumper.AddChild(DoDumpChild);
-}
-template  void dumpChild(StringRef Label, Fn DoDumpChild) {
-  NodeDumper.AddChild(Label, DoDumpChild);
-}
-
   public:
 ASTDumper(raw_ostream &OS, const CommandTraits *Traits,
   const SourceManager *SM)
@@ -306,14 +298,14 @@ void ASTDumper::dumpTypeAsChild(QualType
   if (!SQT.Quals.hasQualifiers())
 return dumpTypeAsChild(SQT.Ty);
 
-  dumpChild([=] {
+  NodeDumper.AddChild([=] {
 NodeDumper.Visit(T);
 dumpTypeAsChild(T.split().Ty);
   });
 }
 
 void ASTDumper::dumpTypeAsChild(const Type *T) {
-  dumpChild([=] {
+  NodeDumper.AddChild([=] {
 NodeDumper.Visit(T);
 if (!T)
   return;
@@ -335,7 +327,7 @@ void ASTDumper::dumpDeclContext(const De
 }
 
 void ASTDumper::dumpLookups(const DeclContext *DC, bool DumpDecls) {
-  dumpChild([=] {
+  NodeDumper.AddChild([=] {
 OS << "StoredDeclsMap ";
 NodeDumper.dumpBareDeclRef(cast(DC));
 
@@ -354,7 +346,7 @@ void ASTDumper::dumpLookups(const DeclCo
   DeclarationName Name = I.getLookupName();
   DeclContextLookupResult R = *I;
 
-  dumpChild([=] {
+  NodeDumper.AddChild([=] {
 OS << "DeclarationName ";
 {
   ColorScope Color(OS, ShowColors, DeclNameColor);
@@ -363,7 +355,7 @@ void ASTDumper::dumpLookups(const DeclCo
 
 for (DeclContextLookupResult::iterator RI = R.begin(), RE = R.end();
  RI != RE; ++RI) {
-  dumpChild([=] {
+  NodeDumper.AddChild([=] {
 NodeDumper.dumpBareDeclRef(*RI);
 
 if ((*RI)->isHidden())
@@ -385,7 +377,7 @@ void ASTDumper::dumpLookups(const DeclCo
 }
 
 if (HasUndeserializedLookups) {
-  dumpChild([=] {
+  NodeDumper.AddChild([=] {
 ColorScope Color(OS, ShowColors, UndeserializedColor);
 OS << "";
   });
@@ -394,7 +386,7 @@ void ASTDumper::dumpLookups(const DeclCo
 }
 
 void ASTDumper::dumpAttr(const Attr *A) {
-  dumpChild([=] {
+  NodeDumper.AddChild([=] {
 NodeDumper.Visit(A);
 ConstAttrVisitor::Visit(A);
   });
@@ -405,7 +397,7 @@ void ASTDumper::dumpAttr(const Attr *A)
 
//===--===//
 
 void ASTDumper::dumpCXXCtorInitializer(const CXXCtorInitializer *Init) {
-  dumpChild([=] {
+  NodeDumper.AddChild([=] {
 NodeDumper.Visit(Init);
 dumpStmt(Init->getInit());
   });
@@ -437,7 +429,7 @@ void ASTDumper::dumpTemplateArgumentList
 
 void ASTDumper::dumpTemplateArgument(const TemplateArgument &A, SourceRange R,
  const Decl *From, const char *Label) {
-  dumpChild([=] {
+  NodeDumper.AddChild([=] {
 NodeDumper.Visit(A, R, From, Label);
 ConstTemplateArgumentVisitor::Visit(A);
   });
@@ -460,7 +452,7 @@ void ASTDumper::dumpObjCTypeParamList(co
 
//===--===//
 
 void ASTDumper::dumpDecl(const Decl *D) {
-  dumpChild([=] {
+  NodeDumper.AddChild([=] {
 NodeDumper.Visit(D);
 if (!D)
   return;
@@ -741,7 +733,7 @@ void ASTDumper::VisitObjCImplementationD
 }
 
 void ASTDumper::Visit(const BlockDecl::Capture &C) {
-  dumpChild([=] {
+  NodeDumper.AddChild([=] {
 NodeDumper.Visit(C);
 if (C.hasCopyExpr())
   dumpStmt(C.getCopyExpr());
@@ -762,7 +754,7 @@ void ASTDumper::VisitBlockDecl(const Blo
 
//===--===//
 
 void ASTDumper::dumpStmt(const Stmt *S, StringRef Label) {
-  dumpChild(Label, [=] {
+  NodeDumper.AddChild(Label, [=] {
 NodeDumper.Visit(S);
 
 if (!S) {
@@ -804,7 +796,7 @@ void ASTDumper::VisitCapturedStmt(const
 
//===--===//
 
 void ASTDumper::Visit(const OMPClause *C) {
-  dumpChild([=] {
+  NodeDumper.AddChild([=] {
 NodeDumper.Visit(C);
 for (const auto *S : C->children())
   dumpStmt(S);
@@ -838,7 +830,7 @@ void ASTDumper::VisitOpaqueValueExpr(con
 }
 
 void ASTDumper::Visit(const GenericSelectionExpr::ConstAssociation &A) {
-  dumpChild([=] {
+  NodeDumper.AddChild([=] {
 NodeDumper.Visit(A);
 if (const TypeSourceInfo *TSI = A.getTypeSourceInfo())
   dumpTypeAsChild(TSI->getTyp

r352657 - [ASTDump] Rename methods which are conceptually Visits

2019-01-30 Thread Stephen Kelly via cfe-commits
Author: steveire
Date: Wed Jan 30 11:49:49 2019
New Revision: 352657

URL: http://llvm.org/viewvc/llvm-project?rev=352657&view=rev
Log:
[ASTDump] Rename methods which are conceptually Visits

This is consistent with the TextNodeDumper, and is the appropriate name
for the traverser class which will be extracted.

Modified:
cfe/trunk/lib/AST/ASTDumper.cpp
cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp

Modified: cfe/trunk/lib/AST/ASTDumper.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=352657&r1=352656&r2=352657&view=diff
==
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ cfe/trunk/lib/AST/ASTDumper.cpp Wed Jan 30 11:49:49 2019
@@ -74,28 +74,26 @@ namespace  {
 
 void setDeserialize(bool D) { Deserialize = D; }
 
-void dumpDecl(const Decl *D);
-void dumpStmt(const Stmt *S, StringRef Label = {});
+void Visit(const Decl *D);
+void Visit(const Stmt *S, StringRef Label = {});
 
 // Utilities
-void dumpTypeAsChild(QualType T);
-void dumpTypeAsChild(const Type *T);
+void Visit(QualType T);
+void Visit(const Type *T);
 void dumpDeclContext(const DeclContext *DC);
 void dumpLookups(const DeclContext *DC, bool DumpDecls);
-void dumpAttr(const Attr *A);
+void Visit(const Attr *A);
 
 // C++ Utilities
-void dumpCXXCtorInitializer(const CXXCtorInitializer *Init);
+void Visit(const CXXCtorInitializer *Init);
 void dumpTemplateParameters(const TemplateParameterList *TPL);
 void dumpTemplateArgumentListInfo(const TemplateArgumentListInfo &TALI);
 void dumpTemplateArgumentLoc(const TemplateArgumentLoc &A,
  const Decl *From = nullptr,
  const char *Label = nullptr);
 void dumpTemplateArgumentList(const TemplateArgumentList &TAL);
-void dumpTemplateArgument(const TemplateArgument &A,
-  SourceRange R = SourceRange(),
-  const Decl *From = nullptr,
-  const char *Label = nullptr);
+void Visit(const TemplateArgument &A, SourceRange R = SourceRange(),
+   const Decl *From = nullptr, const char *Label = nullptr);
 template 
 void dumpTemplateDeclSpecialization(const SpecializationDecl *D,
 bool DumpExplicitInst,
@@ -108,93 +106,93 @@ namespace  {
 
 // Types
 void VisitComplexType(const ComplexType *T) {
-  dumpTypeAsChild(T->getElementType());
+  Visit(T->getElementType());
 }
 void VisitLocInfoType(const LocInfoType *T) {
-  dumpTypeAsChild(T->getTypeSourceInfo()->getType());
+  Visit(T->getTypeSourceInfo()->getType());
 }
 void VisitPointerType(const PointerType *T) {
-  dumpTypeAsChild(T->getPointeeType());
+  Visit(T->getPointeeType());
 }
 void VisitBlockPointerType(const BlockPointerType *T) {
-  dumpTypeAsChild(T->getPointeeType());
+  Visit(T->getPointeeType());
 }
 void VisitReferenceType(const ReferenceType *T) {
-  dumpTypeAsChild(T->getPointeeType());
+  Visit(T->getPointeeType());
 }
 void VisitMemberPointerType(const MemberPointerType *T) {
-  dumpTypeAsChild(T->getClass());
-  dumpTypeAsChild(T->getPointeeType());
+  Visit(T->getClass());
+  Visit(T->getPointeeType());
 }
 void VisitArrayType(const ArrayType *T) {
-  dumpTypeAsChild(T->getElementType());
+  Visit(T->getElementType());
 }
 void VisitVariableArrayType(const VariableArrayType *T) {
   VisitArrayType(T);
-  dumpStmt(T->getSizeExpr());
+  Visit(T->getSizeExpr());
 }
 void VisitDependentSizedArrayType(const DependentSizedArrayType *T) {
-  dumpTypeAsChild(T->getElementType());
-  dumpStmt(T->getSizeExpr());
+  Visit(T->getElementType());
+  Visit(T->getSizeExpr());
 }
 void VisitDependentSizedExtVectorType(
 const DependentSizedExtVectorType *T) {
-  dumpTypeAsChild(T->getElementType());
-  dumpStmt(T->getSizeExpr());
+  Visit(T->getElementType());
+  Visit(T->getSizeExpr());
 }
 void VisitVectorType(const VectorType *T) {
-  dumpTypeAsChild(T->getElementType());
+  Visit(T->getElementType());
 }
 void VisitFunctionType(const FunctionType *T) {
-  dumpTypeAsChild(T->getReturnType());
+  Visit(T->getReturnType());
 }
 void VisitFunctionProtoType(const FunctionProtoType *T) {
   VisitFunctionType(T);
   for (const QualType &PT : T->getParamTypes())
-dumpTypeAsChild(PT);
+Visit(PT);
 }
 void VisitTypeOfExprType(const TypeOfExprType *T) {
-  dumpStmt(T->getUnderlyingExpr());
+  Visit(T->getUnderlyingExpr());
 }
 void VisitDecltypeType(const DecltypeType *T) {
-  dumpStmt(T->getUnderlyingExpr());
+  Visit(T->getUnderlyingExpr());
 }
 void VisitUnaryT

[libunwind] r352658 - Revert "[CMake] Use correct visibility for linked libraries in CMake"

2019-01-30 Thread Petr Hosek via cfe-commits
Author: phosek
Date: Wed Jan 30 11:51:18 2019
New Revision: 352658

URL: http://llvm.org/viewvc/llvm-project?rev=352658&view=rev
Log:
Revert "[CMake] Use correct visibility for linked libraries in CMake"

This reverts commit r352654: this broke libcxx and sanitizer bots.

Modified:
libunwind/trunk/src/CMakeLists.txt

Modified: libunwind/trunk/src/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/CMakeLists.txt?rev=352658&r1=352657&r2=352658&view=diff
==
--- libunwind/trunk/src/CMakeLists.txt (original)
+++ libunwind/trunk/src/CMakeLists.txt Wed Jan 30 11:51:18 2019
@@ -146,7 +146,7 @@ if (LIBUNWIND_ENABLE_SHARED)
   if(COMMAND llvm_setup_rpath)
 llvm_setup_rpath(unwind_shared)
   endif()
-  target_link_libraries(unwind_shared PRIVATE ${libraries})
+  target_link_libraries(unwind_shared ${libraries})
   set_target_properties(unwind_shared
 PROPERTIES
   LINK_FLAGS"${LIBUNWIND_LINK_FLAGS}"
@@ -162,7 +162,7 @@ endif()
 # Build the static library.
 if (LIBUNWIND_ENABLE_STATIC)
   add_library(unwind_static STATIC ${unwind_static_sources})
-  target_link_libraries(unwind_static PRIVATE ${libraries})
+  target_link_libraries(unwind_static ${libraries})
   set_target_properties(unwind_static
 PROPERTIES
   LINK_FLAGS"${LIBUNWIND_LINK_FLAGS}"


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


r352661 - [ASTDump] Re-arrange method declarations to group Visit together

2019-01-30 Thread Stephen Kelly via cfe-commits
Author: steveire
Date: Wed Jan 30 12:03:47 2019
New Revision: 352661

URL: http://llvm.org/viewvc/llvm-project?rev=352661&view=rev
Log:
[ASTDump] Re-arrange method declarations to group Visit together

This will make follow-up commits easier to review.

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

Modified: cfe/trunk/lib/AST/ASTDumper.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=352661&r1=352660&r2=352661&view=diff
==
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ cfe/trunk/lib/AST/ASTDumper.cpp Wed Jan 30 12:03:47 2019
@@ -76,24 +76,26 @@ namespace  {
 
 void Visit(const Decl *D);
 void Visit(const Stmt *S, StringRef Label = {});
-
-// Utilities
 void Visit(QualType T);
 void Visit(const Type *T);
-void dumpDeclContext(const DeclContext *DC);
-void dumpLookups(const DeclContext *DC, bool DumpDecls);
 void Visit(const Attr *A);
+void Visit(const CXXCtorInitializer *Init);
+void Visit(const TemplateArgument &A, SourceRange R = SourceRange(),
+   const Decl *From = nullptr, const char *Label = nullptr);
+void Visit(const BlockDecl::Capture &C);
+void Visit(const OMPClause *C);
+void Visit(const GenericSelectionExpr::ConstAssociation &A);
+void Visit(const Comment *C, const FullComment *FC);
 
 // C++ Utilities
-void Visit(const CXXCtorInitializer *Init);
+void dumpDeclContext(const DeclContext *DC);
+void dumpLookups(const DeclContext *DC, bool DumpDecls);
 void dumpTemplateParameters(const TemplateParameterList *TPL);
 void dumpTemplateArgumentListInfo(const TemplateArgumentListInfo &TALI);
 void dumpTemplateArgumentLoc(const TemplateArgumentLoc &A,
  const Decl *From = nullptr,
  const char *Label = nullptr);
 void dumpTemplateArgumentList(const TemplateArgumentList &TAL);
-void Visit(const TemplateArgument &A, SourceRange R = SourceRange(),
-   const Decl *From = nullptr, const char *Label = nullptr);
 template 
 void dumpTemplateDeclSpecialization(const SpecializationDecl *D,
 bool DumpExplicitInst,
@@ -242,7 +244,6 @@ namespace  {
 void VisitObjCCategoryDecl(const ObjCCategoryDecl *D);
 void VisitObjCInterfaceDecl(const ObjCInterfaceDecl *D);
 void VisitObjCImplementationDecl(const ObjCImplementationDecl *D);
-void Visit(const BlockDecl::Capture &C);
 void VisitBlockDecl(const BlockDecl *D);
 
 // Stmts.
@@ -252,14 +253,12 @@ namespace  {
 void VisitCapturedStmt(const CapturedStmt *Node);
 
 // OpenMP
-void Visit(const OMPClause *C);
 void VisitOMPExecutableDirective(const OMPExecutableDirective *Node);
 
 // Exprs
 void VisitInitListExpr(const InitListExpr *ILE);
 void VisitBlockExpr(const BlockExpr *Node);
 void VisitOpaqueValueExpr(const OpaqueValueExpr *Node);
-void Visit(const GenericSelectionExpr::ConstAssociation &A);
 void VisitGenericSelectionExpr(const GenericSelectionExpr *E);
 
 // C++
@@ -271,9 +270,6 @@ namespace  {
 // ObjC
 void VisitObjCAtCatchStmt(const ObjCAtCatchStmt *Node);
 
-// Comments.
-void Visit(const Comment *C, const FullComment *FC);
-
 void VisitExpressionTemplateArgument(const TemplateArgument &TA) {
   Visit(TA.getAsExpr());
 }
@@ -291,6 +287,49 @@ namespace  {
 //  Utilities
 
//===--===//
 
+void ASTDumper::Visit(const Decl *D) {
+  NodeDumper.AddChild([=] {
+NodeDumper.Visit(D);
+if (!D)
+  return;
+
+ConstDeclVisitor::Visit(D);
+
+for (const auto &A : D->attrs())
+  Visit(A);
+
+if (const FullComment *Comment =
+D->getASTContext().getLocalCommentForDeclUncached(D))
+  Visit(Comment, Comment);
+
+// Decls within functions are visited by the body.
+if (!isa(*D) && !isa(*D)) {
+  if (const auto *DC = dyn_cast(D))
+dumpDeclContext(DC);
+}
+  });
+}
+
+void ASTDumper::Visit(const Stmt *S, StringRef Label) {
+  NodeDumper.AddChild(Label, [=] {
+NodeDumper.Visit(S);
+
+if (!S) {
+  return;
+}
+
+ConstStmtVisitor::Visit(S);
+
+// Some statements have custom mechanisms for dumping their children.
+if (isa(S) || isa(S)) {
+  return;
+}
+
+for (const Stmt *SubStmt : S->children())
+  Visit(SubStmt);
+  });
+}
+
 void ASTDumper::Visit(QualType T) {
   SplitQualType SQT = T.split();
   if (!SQT.Quals.hasQualifiers())
@@ -316,6 +355,66 @@ void ASTDumper::Visit(const Type *T) {
   });
 }
 
+void ASTDumper::Visit(const Attr *A) {
+  NodeDumper.AddChild([=] {
+NodeDumper.Visit(A);
+ConstAttrVisitor::Visit(A);
+  });
+}
+
+void ASTDumper::Visit(const CXXCtorInitializer *Init) {
+  NodeDumper.AddChild([=] {
+NodeDumper.Visit(Init);
+Visit(Init->getInit());
+ 

r352663 - [ASTDump] Make method definition order matches declaration order

2019-01-30 Thread Stephen Kelly via cfe-commits
Author: steveire
Date: Wed Jan 30 12:06:52 2019
New Revision: 352663

URL: http://llvm.org/viewvc/llvm-project?rev=352663&view=rev
Log:
[ASTDump] Make method definition order matches declaration order

This will make follow-up changes easier to review.

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

Modified: cfe/trunk/lib/AST/ASTDumper.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=352663&r1=352662&r2=352663&view=diff
==
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ cfe/trunk/lib/AST/ASTDumper.cpp Wed Jan 30 12:06:52 2019
@@ -96,12 +96,6 @@ namespace  {
  const Decl *From = nullptr,
  const char *Label = nullptr);
 void dumpTemplateArgumentList(const TemplateArgumentList &TAL);
-template 
-void dumpTemplateDeclSpecialization(const SpecializationDecl *D,
-bool DumpExplicitInst,
-bool DumpRefOnly);
-template 
-void dumpTemplateDecl(const TemplateDecl *D, bool DumpExplicitInst);
 
 // Objective-C utilities.
 void dumpObjCTypeParamList(const ObjCTypeParamList *typeParams);
@@ -215,6 +209,13 @@ namespace  {
 void VisitOMPDeclareReductionDecl(const OMPDeclareReductionDecl *D);
 void VisitOMPCapturedExprDecl(const OMPCapturedExprDecl *D);
 
+template 
+void dumpTemplateDeclSpecialization(const SpecializationDecl *D,
+bool DumpExplicitInst,
+bool DumpRefOnly);
+template 
+void dumpTemplateDecl(const TemplateDecl *D, bool DumpExplicitInst);
+
 // C++ Decls
 void VisitTypeAliasDecl(const TypeAliasDecl *D);
 void VisitTypeAliasTemplateDecl(const TypeAliasTemplateDecl *D);
@@ -227,8 +228,8 @@ namespace  {
 const ClassTemplatePartialSpecializationDecl *D);
 void VisitClassScopeFunctionSpecializationDecl(
 const ClassScopeFunctionSpecializationDecl *D);
-void VisitBuiltinTemplateDecl(const BuiltinTemplateDecl *D);
 void VisitVarTemplateDecl(const VarTemplateDecl *D);
+void VisitBuiltinTemplateDecl(const BuiltinTemplateDecl *D);
 void VisitVarTemplateSpecializationDecl(
 const VarTemplateSpecializationDecl *D);
 void VisitVarTemplatePartialSpecializationDecl(
@@ -605,20 +606,6 @@ void ASTDumper::VisitOMPCapturedExprDecl
 // C++ Declarations
 
//===--===//
 
-void ASTDumper::VisitTypeAliasDecl(const TypeAliasDecl *D) {
-  Visit(D->getUnderlyingType());
-}
-
-void ASTDumper::VisitTypeAliasTemplateDecl(const TypeAliasTemplateDecl *D) {
-  dumpTemplateParameters(D->getTemplateParameters());
-  Visit(D->getTemplatedDecl());
-}
-
-void ASTDumper::VisitStaticAssertDecl(const StaticAssertDecl *D) {
-  Visit(D->getAssertExpr());
-  Visit(D->getMessage());
-}
-
 template 
 void ASTDumper::dumpTemplateDeclSpecialization(const SpecializationDecl *D,
bool DumpExplicitInst,
@@ -672,6 +659,20 @@ void ASTDumper::dumpTemplateDecl(const T
!D->isCanonicalDecl());
 }
 
+void ASTDumper::VisitTypeAliasDecl(const TypeAliasDecl *D) {
+  Visit(D->getUnderlyingType());
+}
+
+void ASTDumper::VisitTypeAliasTemplateDecl(const TypeAliasTemplateDecl *D) {
+  dumpTemplateParameters(D->getTemplateParameters());
+  Visit(D->getTemplatedDecl());
+}
+
+void ASTDumper::VisitStaticAssertDecl(const StaticAssertDecl *D) {
+  Visit(D->getAssertExpr());
+  Visit(D->getMessage());
+}
+
 void ASTDumper::VisitFunctionTemplateDecl(const FunctionTemplateDecl *D) {
   // FIXME: We don't add a declaration of a function template specialization
   // to its context when it's explicitly instantiated, so dump explicit


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


[PATCH] D56650: [lld] [ELF] Support customizing behavior on target triple

2019-01-30 Thread Kamil Rytarowski via Phabricator via cfe-commits
krytarowski added a comment.

If we pass flags from clang, we sacrifice:

- lld usable as a standalone executable
- gcc capable to use lld as a functional linker
- clang driver not capable to call unpatched gnu ld/gold as we grow local flags 
to workaroud the customization (such as -z nognustack)
- compat with a number of programs programs that call linker directly and we 
customize the passed flags (gcc itself is one of them)

We just gain clang+lld tandem to work and we must retain GCC/LD 
interoperability (which as I understand isn't a priority/interesting for other 
OSes).

In theory we can patch:

- GCC to pass lld flags
- GNU LD (/gold) to accept new flags
- all the programs using linker to stop doing so (like the GCC project)

We need to tune in lld at least for start (out of my head, likely not a 
finished list):

- tune the DT_NEEDED behavior,
- rpath behavior,
- GNU stack generation
- specify default target/emulation search paths
- disable 3 segments (disable ro one)

We can address all the issues either in lld or in all the other projects around 
which certainly doesn't scale (and I expect in particular problems to push e.g. 
-z nognustack to GNU ld(1)).

OpenBSD indeed patches downstream their linkers for additional flags and 
accidentally it works better in the lld design. In NetBSD we struggle to get 
sane defaults rather than a set of additional flags. GNU stack is unwanted also 
on at least OpenBSD(/Fuchsia..) and there is no way to disable it in lld as of 
now (a proposal is to grow a custom flag). All OSes need to pass default paths 
for standalone linker usage (I've listed a dozen of examples from FreeBSD ports 
in other review).

The current feeling in the project is that if we cannot set the defaults we 
should fork the lld driver downstream and patch it there, which is a lose as 
the upstream version will keep to be unusable.


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

https://reviews.llvm.org/D56650



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


LLVM buildmaster will be restarted tonight

2019-01-30 Thread Galina Kistanova via cfe-commits
 Hello everyone,

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

Thanks

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


[PATCH] D57353: [clang-tidy] Add the abseil-duration-double-conversion check

2019-01-30 Thread Hyrum Wright via Phabricator via cfe-commits
hwright marked 2 inline comments as done.
hwright added inline comments.



Comment at: docs/clang-tidy/checks/abseil-duration-double-conversion.rst:20
+
+
+  // Original - Conversion to integer and back again

MyDeveloperDay wrote:
> hwright wrote:
> > Eugene.Zelenko wrote:
> > > Unnecessary empty line.
> > This is consistent with other documentation in this directory, such as 
> > `abseil-faster-strsplit-delimiter.rst`.
> In your example `abseil-faster-strsplit-delimiter.rst` , The double blank 
> line in the html doesn't give much delineation between the before and after 
> code and the next example.
> 
> {F7867869}
> 
> There probably isn't a convention per say (which is a shame), across the docs 
> we do a mixture of different styles 
> 
> https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
> https://clang.llvm.org/extra/clang-tidy/checks/android-cloexec-accept.html
> https://clang.llvm.org/extra/clang-tidy/checks/google-objc-function-naming.html
> 
> But there is a desire by some of the regular clang-tidy reviewers to make the 
> documentation consistent
> 
> It may not be ideal but the "Before/After" style, that is used in 
> `modernize-use-emplace`, 
> `modernize-use-using`,`readability-braces-around-statements`,`readability-identifier-naming`
>  and `readability-redundant-function-ptr-dereference` does help a little.
> 
> I'm not saying looks better, but I've added a couple of examples of 
> formatting the strsplit example for comparison, feel free to ignore.
> 
> {F7867960}
> 
> {F7868028}
> 
> 
I like those examples!

Would it be reasonable to update all of the `abseil-duration-*` documentation 
in a separate pass, after this change is submitted?


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

https://reviews.llvm.org/D57353



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


[PATCH] D56571: [RFC prototype] Implementation of asm-goto support in clang

2019-01-30 Thread Jennifer Yu via Phabricator via cfe-commits
jyu2 updated this revision to Diff 184349.
jyu2 marked an inline comment as done.
jyu2 added a comment.

Change test for BE IR change.


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

https://reviews.llvm.org/D56571

Files:
  include/clang/AST/Expr.h
  include/clang/AST/ExprCXX.h
  include/clang/AST/ExprObjC.h
  include/clang/AST/Stmt.h
  include/clang/Basic/DiagnosticASTKinds.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/Sema.h
  lib/AST/ASTImporter.cpp
  lib/AST/Stmt.cpp
  lib/AST/StmtPrinter.cpp
  lib/AST/StmtProfile.cpp
  lib/Analysis/CFG.cpp
  lib/CodeGen/CGStmt.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/Parse/ParseStmtAsm.cpp
  lib/Sema/SemaStmtAsm.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReaderStmt.cpp
  lib/Serialization/ASTWriterStmt.cpp
  test/Analysis/asm-goto.cpp
  test/CodeGen/asm-goto.c
  test/CodeGen/asm.c
  test/CodeGen/inline-asm-mixed-style.c
  test/Coverage/c-language-features.inc
  test/PCH/asm.h
  test/Parser/asm-goto.c
  test/Parser/asm-goto.cpp
  test/Parser/asm.c
  test/Parser/asm.cpp
  test/Sema/asm.c
  test/Sema/inline-asm-validate-tmpl.cpp

Index: test/Sema/inline-asm-validate-tmpl.cpp
===
--- test/Sema/inline-asm-validate-tmpl.cpp
+++ test/Sema/inline-asm-validate-tmpl.cpp
@@ -23,3 +23,13 @@
 	asm("rol %1, %0" :"=r"(value): "I"(N + 1));
 }
 int	foo() { testc<2>(10); }
+
+// these should compile without error
+template  bool testd()
+{
+  __asm goto ("" : : : : lab);
+  return true;
+lab:
+  return false;
+}
+bool foox() { return testd<0> (); }
Index: test/Sema/asm.c
===
--- test/Sema/asm.c
+++ test/Sema/asm.c
@@ -295,3 +295,28 @@
   return r0 + r1;
 }
 
+void test18()
+{
+  // expected-error@+2 {{duplicate use of asm operand name "lab"}}
+  // expected-note@+1 {{asm operand name "lab" first referenced here}}
+  asm goto ("" : : : : lab, lab, lab2, lab);
+  // expected-error@+2 {{duplicate use of asm operand name "lab"}}
+  // expected-note@+1 {{asm operand name "lab" first referenced here}}
+  asm goto ("xorw %[lab], %[lab]; je %l[lab]" : : [lab] "i" (0) : : lab);
+lab:;
+lab2:;
+  int x,x1;
+  // expected-error@+2 {{duplicate use of asm operand name "lab"}}
+  // expected-note@+1 {{asm operand name "lab" first referenced here}}
+  asm ("" : [lab] "=r" (x),[lab] "+r" (x) : [lab1] "r" (x));
+  // expected-error@+2 {{duplicate use of asm operand name "lab"}}
+  // expected-note@+1 {{asm operand name "lab" first referenced here}}
+  asm ("" : [lab] "=r" (x1) : [lab] "r" (x));
+  // expected-error@+1 {{operand with 'l' modifier must refer to a label}}
+  asm ("jne %l0"::"r"(&&lab));
+  // expected-error@+1 {{invalid operand number in inline asm string}}
+  asm ("jne %l0":::);
+  // expected-error@+1 {{operand with 'l' modifier must refer to a label}}
+  asm goto ("jne %l0"::"r"(x)::lab);
+  asm goto ("jne %l0"lab);
+}
Index: test/Parser/asm.cpp
===
--- test/Parser/asm.cpp
+++ test/Parser/asm.cpp
@@ -7,3 +7,28 @@
 int foo5 asm (U"bar5"); // expected-error {{cannot use unicode string literal in 'asm'}}
 int foo6 asm ("bar6"_x); // expected-error {{string literal with user-defined suffix cannot be used here}}
 int foo6 asm ("" L"bar7"); // expected-error {{cannot use wide string literal in 'asm'}}
+
+int zoo ()
+{
+  int x,cond,*e;
+  // expected-error@+1 {{expected ')'}}
+  asm ("mov %[e], %[e]" : : [e] "rm" (*e)::a)
+  // expected-error@+1  {{expected ':'}}
+  asm goto ("decl %0; jnz %l[a]" :"=r"(x): "m"(x) : "memory" : a);
+  // expected-error@+1 {{expected identifie}}
+  asm goto ("decl %0;" :: "m"(x) : "memory" : );
+  // expected-error@+1  {{expected ':'}}
+  asm goto ("decl %0;" :: "m"(x) : "memory" );
+  // expected-error@+1 {{use of undeclared label 'x'}}
+  asm goto ("decl %0;" :: "m"(x) : "memory" :x);
+  // expected-error@+1 {{use of undeclared label 'b'}}
+  asm goto ("decl %0;" :: "m"(x) : "memory" :b);
+  // expected-error@+1 {{invalid operand number in inline asm string}}
+  asm goto ("testl %0, %0; jne %l3;" :: "r"(cond)::label_true, loop)
+  // expected-error@+1 {{unknown symbolic operand name in inline assembly string}}
+  asm goto ("decl %0; jnz %l[b]" :: "m"(x) : "memory" : a);
+label_true:
+loop:
+a:
+  return 0;
+}
Index: test/Parser/asm.c
===
--- test/Parser/asm.c
+++ test/Parser/asm.c
@@ -16,6 +16,31 @@
   asm _Atomic (""); // expected-warning {{ignored _Atomic qualifier on asm}}
 }
 
+int zoo ()
+{
+  int x,cond,*e;
+  // expected-error@+1 {{expected ')'}}
+  asm ("mov %[e], %[e]" : : [e] "rm" (*e)::a)
+  // expected-error@+1 {{expected ':'}}
+  asm goto ("decl %0; jnz %l[a]" :"=r"(x): "m"(x) : "memory" : a);
+  // expected-error@+1 {{expected identifie}}
+  asm goto ("decl %0;" :: "m"(x) : "memory" : );
+  // expected-error@+1 {{expected ':'}}
+  asm 

r352665 - Add a new builtin: __builtin_dynamic_object_size

2019-01-30 Thread Erik Pilkington via cfe-commits
Author: epilk
Date: Wed Jan 30 12:34:53 2019
New Revision: 352665

URL: http://llvm.org/viewvc/llvm-project?rev=352665&view=rev
Log:
Add a new builtin: __builtin_dynamic_object_size

This builtin has the same UI as __builtin_object_size, but has the
potential to be evaluated dynamically. It is meant to be used as a
drop-in replacement for libraries that use __builtin_object_size when
a dynamic checking mode is enabled. For instance,
__builtin_object_size fails to provide any extra checking in the
following function:

  void f(size_t alloc) {
char* p = malloc(alloc);
strcpy(p, "foobar"); // expands to __builtin___strcpy_chk(p, "foobar", 
__builtin_object_size(p, 0))
  }

This is an overflow if alloc < 7, but because LLVM can't fold the
object size intrinsic statically, it folds __builtin_object_size to
-1. With __builtin_dynamic_object_size, alloc is passed through to
__builtin___strcpy_chk.

rdar://32212419

Differential revision: https://reviews.llvm.org/D56760

Modified:
cfe/trunk/docs/LanguageExtensions.rst
cfe/trunk/include/clang/Basic/Builtins.def
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/lib/Analysis/CFG.cpp
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp
cfe/trunk/test/CodeGen/alloc-size.c
cfe/trunk/test/CodeGen/object-size.c
cfe/trunk/test/Sema/builtin-object-size.c

Modified: cfe/trunk/docs/LanguageExtensions.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.rst?rev=352665&r1=352664&r2=352665&view=diff
==
--- cfe/trunk/docs/LanguageExtensions.rst (original)
+++ cfe/trunk/docs/LanguageExtensions.rst Wed Jan 30 12:34:53 2019
@@ -2922,3 +2922,29 @@ Specifying Linker Options on ELF Targets
 The ``#pragma comment(lib, ...)`` directive is supported on all ELF targets.
 The second parameter is the library name (without the traditional Unix prefix 
of
 ``lib``).  This allows you to provide an implicit link of dependent libraries.
+
+Evaluating Object Size Dynamically
+==
+
+Clang supports the builtin ``__builtin_dynamic_object_size``, the semantics are
+the same as GCC's ``__builtin_object_size`` (which Clang also supports), but
+``__builtin_dynamic_object_size`` can evaluate the object's size at runtime.
+``__builtin_dynamic_object_size`` is meant to be used as a drop-in replacement
+for ``__builtin_object_size`` in libraries that support it.
+
+For instance, here is a program that ``__builtin_dynamic_object_size`` will 
make
+safer:
+
+.. code-block:: c
+
+  void copy_into_buffer(size_t size) {
+char* buffer = malloc(size);
+strlcpy(buffer, "some string", strlen("some string"));
+// Previous line preprocesses to:
+// __builtin___strlcpy_chk(buffer, "some string", strlen("some string"), 
__builtin_object_size(buffer, 0))
+  }
+
+Since the size of ``buffer`` can't be known at compile time, Clang will fold
+``__builtin_object_size(buffer, 0)`` into ``-1``. However, if this was written
+as ``__builtin_dynamic_object_size(buffer, 0)``, Clang will fold it into
+``size``, providing some extra runtime safety.

Modified: cfe/trunk/include/clang/Basic/Builtins.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.def?rev=352665&r1=352664&r2=352665&view=diff
==
--- cfe/trunk/include/clang/Basic/Builtins.def (original)
+++ cfe/trunk/include/clang/Basic/Builtins.def Wed Jan 30 12:34:53 2019
@@ -511,6 +511,7 @@ BUILTIN(__builtin_extend_pointer, "ULLiv
 
 // GCC Object size checking builtins
 BUILTIN(__builtin_object_size, "zvC*i", "nu")
+BUILTIN(__builtin_dynamic_object_size, "zvC*i", "nu") // Clang only.
 BUILTIN(__builtin___memcpy_chk, "v*v*vC*zz", "nF")
 BUILTIN(__builtin___memccpy_chk, "v*v*vC*izz", "nF")
 BUILTIN(__builtin___memmove_chk, "v*v*vC*zz", "nF")

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=352665&r1=352664&r2=352665&view=diff
==
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Wed Jan 30 12:34:53 2019
@@ -8190,6 +8190,7 @@ bool IntExprEvaluator::VisitBuiltinCallE
   default:
 return ExprEvaluatorBaseTy::VisitCallExpr(E);
 
+  case Builtin::BI__builtin_dynamic_object_size:
   case Builtin::BI__builtin_object_size: {
 // The type was checked when we built the expression.
 unsigned Type =

Modified: cfe/trunk/lib/Analysis/CFG.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=352665&r1=352664&r2=352665&view=diff
==
--- cf

r352664 - Add a 'dynamic' parameter to the objectsize intrinsic

2019-01-30 Thread Erik Pilkington via cfe-commits
Author: epilk
Date: Wed Jan 30 12:34:35 2019
New Revision: 352664

URL: http://llvm.org/viewvc/llvm-project?rev=352664&view=rev
Log:
Add a 'dynamic' parameter to the objectsize intrinsic

This is meant to be used with clang's __builtin_dynamic_object_size.
When 'true' is passed to this parameter, the intrinsic has the
potential to be folded into instructions that will be evaluated
at run time. When 'false', the objectsize intrinsic behaviour is
unchanged.

rdar://32212419

Differential revision: https://reviews.llvm.org/D56761

Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/test/CodeGen/alloc-size.c
cfe/trunk/test/CodeGen/catch-undef-behavior.c
cfe/trunk/test/CodeGen/object-size.c
cfe/trunk/test/CodeGen/object-size.cpp

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=352664&r1=352663&r2=352664&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Wed Jan 30 12:34:35 2019
@@ -549,7 +549,8 @@ CodeGenFunction::emitBuiltinObjectSize(c
   Value *Min = Builder.getInt1((Type & 2) != 0);
   // For GCC compatibility, __builtin_object_size treat NULL as unknown size.
   Value *NullIsUnknown = Builder.getTrue();
-  return Builder.CreateCall(F, {Ptr, Min, NullIsUnknown});
+  Value *Dynamic = Builder.getFalse();
+  return Builder.CreateCall(F, {Ptr, Min, NullIsUnknown, Dynamic});
 }
 
 namespace {

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=352664&r1=352663&r2=352664&view=diff
==
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Wed Jan 30 12:34:35 2019
@@ -727,9 +727,10 @@ void CodeGenFunction::EmitTypeCheck(Type
   llvm::Value *F = CGM.getIntrinsic(llvm::Intrinsic::objectsize, Tys);
   llvm::Value *Min = Builder.getFalse();
   llvm::Value *NullIsUnknown = Builder.getFalse();
+  llvm::Value *Dynamic = Builder.getFalse();
   llvm::Value *CastAddr = Builder.CreateBitCast(Ptr, Int8PtrTy);
   llvm::Value *LargeEnough = Builder.CreateICmpUGE(
-  Builder.CreateCall(F, {CastAddr, Min, NullIsUnknown}), Size);
+  Builder.CreateCall(F, {CastAddr, Min, NullIsUnknown, Dynamic}), 
Size);
   Checks.push_back(std::make_pair(LargeEnough, SanitizerKind::ObjectSize));
 }
   }

Modified: cfe/trunk/test/CodeGen/alloc-size.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/alloc-size.c?rev=352664&r1=352663&r2=352664&view=diff
==
--- cfe/trunk/test/CodeGen/alloc-size.c (original)
+++ cfe/trunk/test/CodeGen/alloc-size.c Wed Jan 30 12:34:35 2019
@@ -231,7 +231,7 @@ void test7() {
 void test8() {
   // Non-const pointers aren't currently supported.
   void *buf = my_calloc(100, 5);
-  // CHECK: @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false, i1 true)
+  // CHECK: @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false, i1 true, i1 false)
   gi = __builtin_object_size(buf, 0);
   // CHECK: @llvm.objectsize
   gi = __builtin_object_size(buf, 1);

Modified: cfe/trunk/test/CodeGen/catch-undef-behavior.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/catch-undef-behavior.c?rev=352664&r1=352663&r2=352664&view=diff
==
--- cfe/trunk/test/CodeGen/catch-undef-behavior.c (original)
+++ cfe/trunk/test/CodeGen/catch-undef-behavior.c Wed Jan 30 12:34:35 2019
@@ -35,7 +35,7 @@ void foo() {
   union { int i; } u;
 
   // CHECK-COMMON:  %[[I8PTR:.*]] = bitcast i32* %[[PTR:.*]] to i8*
-  // CHECK-COMMON-NEXT: %[[SIZE:.*]] = call i64 @llvm.objectsize.i64.p0i8(i8* 
%[[I8PTR]], i1 false, i1 false)
+  // CHECK-COMMON-NEXT: %[[SIZE:.*]] = call i64 @llvm.objectsize.i64.p0i8(i8* 
%[[I8PTR]], i1 false, i1 false, i1 false)
   // CHECK-COMMON-NEXT: %[[OK:.*]] = icmp uge i64 %[[SIZE]], 4
 
   // CHECK-UBSAN: br i1 %[[OK]], {{.*}} !prof ![[WEIGHT_MD:.*]], !nosanitize

Modified: cfe/trunk/test/CodeGen/object-size.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/object-size.c?rev=352664&r1=352663&r2=352664&view=diff
==
--- cfe/trunk/test/CodeGen/object-size.c (original)
+++ cfe/trunk/test/CodeGen/object-size.c Wed Jan 30 12:34:35 2019
@@ -40,7 +40,7 @@ void test4() {
 // CHECK-LABEL: define void @test5
 void test5() {
   // CHECK: = load i8*, i8** @gp
-  // CHECK-NEXT:= call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false, i1 
true)
+  // CHECK-NEXT:= call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false, i1 
true, i1 false)
   strcpy(gp, "Hi there");
 }
 
@@ -254,31 +254,31 @@ struct Test23

[PATCH] D56650: [lld] [ELF] Support customizing behavior on target triple

2019-01-30 Thread Kamil Rytarowski via Phabricator via cfe-commits
krytarowski added a comment.

In D56650#1377546 , @ruiu wrote:

> If you still need to patch GNU ld, it doesn't seems like this patch makes 
> things easier for you. (But even if this would make it easier for you, this 
> patch's approach is not okay by design though.)


If we can get standalone lld functional out of the box and respecting target, 
we no longer need to patch GCC/LD/distribution/3rd-party-software.

If there is a strong feeling to retain lld ELF target as it is, we can grow a 
custom target like Darwin/Windows and specify customization there. The 
mentioned Darwin adds /usr/lib in the linker directly.  We need analogous 
opportunity on our end.


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

https://reviews.llvm.org/D56650



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


[PATCH] D56760: Add a new builtin: __builtin_dynamic_object_size

2019-01-30 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL352665: Add a new builtin: __builtin_dynamic_object_size 
(authored by epilk, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D56760?vs=181923&id=184352#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D56760

Files:
  cfe/trunk/docs/LanguageExtensions.rst
  cfe/trunk/include/clang/Basic/Builtins.def
  cfe/trunk/lib/AST/ExprConstant.cpp
  cfe/trunk/lib/Analysis/CFG.cpp
  cfe/trunk/lib/CodeGen/CGBuiltin.cpp
  cfe/trunk/lib/CodeGen/CGCall.cpp
  cfe/trunk/lib/CodeGen/CodeGenFunction.h
  cfe/trunk/lib/Sema/SemaChecking.cpp
  cfe/trunk/lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp
  cfe/trunk/test/CodeGen/alloc-size.c
  cfe/trunk/test/CodeGen/object-size.c
  cfe/trunk/test/Sema/builtin-object-size.c

Index: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
===
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp
@@ -494,10 +494,11 @@
 llvm::Value *
 CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type,
  llvm::IntegerType *ResType,
- llvm::Value *EmittedE) {
+ llvm::Value *EmittedE,
+ bool IsDynamic) {
   uint64_t ObjectSize;
   if (!E->tryEvaluateObjectSize(ObjectSize, getContext(), Type))
-return emitBuiltinObjectSize(E, Type, ResType, EmittedE);
+return emitBuiltinObjectSize(E, Type, ResType, EmittedE, IsDynamic);
   return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
 }
 
@@ -513,7 +514,7 @@
 llvm::Value *
 CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type,
llvm::IntegerType *ResType,
-   llvm::Value *EmittedE) {
+   llvm::Value *EmittedE, bool IsDynamic) {
   // We need to reference an argument if the pointer is a parameter with the
   // pass_object_size attribute.
   if (auto *D = dyn_cast(E->IgnoreParenImpCasts())) {
@@ -549,7 +550,7 @@
   Value *Min = Builder.getInt1((Type & 2) != 0);
   // For GCC compatibility, __builtin_object_size treat NULL as unknown size.
   Value *NullIsUnknown = Builder.getTrue();
-  Value *Dynamic = Builder.getFalse();
+  Value *Dynamic = Builder.getInt1(IsDynamic);
   return Builder.CreateCall(F, {Ptr, Min, NullIsUnknown, Dynamic});
 }
 
@@ -1978,6 +1979,7 @@
   Result = Builder.CreateIntCast(Result, ResultType, /*isSigned*/false);
 return RValue::get(Result);
   }
+  case Builtin::BI__builtin_dynamic_object_size:
   case Builtin::BI__builtin_object_size: {
 unsigned Type =
 E->getArg(1)->EvaluateKnownConstInt(getContext()).getZExtValue();
@@ -1985,8 +1987,9 @@
 
 // We pass this builtin onto the optimizer so that it can figure out the
 // object size in more complex cases.
+bool IsDynamic = BuiltinID == Builtin::BI__builtin_dynamic_object_size;
 return RValue::get(emitBuiltinObjectSize(E->getArg(0), Type, ResType,
- /*EmittedE=*/nullptr));
+ /*EmittedE=*/nullptr, IsDynamic));
   }
   case Builtin::BI__builtin_prefetch: {
 Value *Locality, *RW, *Address = EmitScalarExpr(E->getArg(0));
Index: cfe/trunk/lib/CodeGen/CodeGenFunction.h
===
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h
@@ -4177,14 +4177,16 @@
   /// If EmittedExpr is non-null, this will use that instead of re-emitting E.
   llvm::Value *evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type,
llvm::IntegerType *ResType,
-   llvm::Value *EmittedE);
+   llvm::Value *EmittedE,
+   bool IsDynamic);
 
   /// Emits the size of E, as required by __builtin_object_size. This
   /// function is aware of pass_object_size parameters, and will act accordingly
   /// if E is a parameter with the pass_object_size attribute.
   llvm::Value *emitBuiltinObjectSize(const Expr *E, unsigned Type,
  llvm::IntegerType *ResType,
- llvm::Value *EmittedE);
+ llvm::Value *EmittedE,
+ bool IsDynamic);
 
 public:
 #ifndef NDEBUG
Index: cfe/trunk/lib/CodeGen/CGCall.cpp
===
--- cfe/trunk/lib/CodeGen/CGCall.cpp
+++ cfe/trunk/lib/CodeGen/CGCall.cpp
@@ -3459,7 +3459,

r352669 - [OPENMP]Fix PR40536: Do not emit __kmpc_push_target_tripcount if not

2019-01-30 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Wed Jan 30 12:49:52 2019
New Revision: 352669

URL: http://llvm.org/viewvc/llvm-project?rev=352669&view=rev
Log:
[OPENMP]Fix PR40536: Do not emit __kmpc_push_target_tripcount if not
required.

Function __kmpc_push_target_tripcount should be emitted only if the
offloading entry is going to be emitted (for use in tgt_target...
functions). Otherwise, it should not be emitted.

Modified:
cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_codegen.cpp
cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_if_codegen.cpp

cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_simd_if_codegen.cpp

Modified: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=352669&r1=352668&r2=352669&view=diff
==
--- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Wed Jan 30 12:49:52 2019
@@ -4078,8 +4078,9 @@ static void emitCommonOMPTargetDirective
   /*IsSigned=*/false);
 return NumIterations;
   };
-  CGM.getOpenMPRuntime().emitTargetNumIterationsCall(CGF, S, Device,
- SizeEmitter);
+  if (IsOffloadEntry)
+CGM.getOpenMPRuntime().emitTargetNumIterationsCall(CGF, S, Device,
+   SizeEmitter);
   CGM.getOpenMPRuntime().emitTargetCall(CGF, S, Fn, FnID, IfCond, Device);
 }
 

Modified: cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_codegen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_codegen.cpp?rev=352669&r1=352668&r2=352669&view=diff
==
--- cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_codegen.cpp 
(original)
+++ cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_codegen.cpp Wed 
Jan 30 12:49:52 2019
@@ -2,6 +2,7 @@
 #ifndef HEADER
 #define HEADER
 // Test host codegen.
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple 
powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix 
HCK_NO_TGT
 // RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple 
powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu 
-emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64 
--check-prefix HCK1 --check-prefix HCK1-64
 // RUN: %clang_cc1 -DCK1 -fopenmp -x c++ -std=c++11 -triple 
powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu 
-emit-pch -o %t %s
 // RUN: %clang_cc1 -DCK1 -fopenmp -x c++ -triple powerpc64le-unknown-unknown 
-fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify 
%s -emit-llvm -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64 
--check-prefix HCK1 --check-prefix HCK1-64
@@ -38,6 +39,8 @@
 
 #ifdef CK1
 
+// HCK_NO_TGT-NOT: @__kmpc_push_target_tripcount
+
 // HCK1: define{{.*}} i32 @{{.+}}target_teams_fun{{.*}}(
 int target_teams_fun(int *g){
   int n = 1000;

Modified: 
cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_if_codegen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_if_codegen.cpp?rev=352669&r1=352668&r2=352669&view=diff
==
--- cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_if_codegen.cpp 
(original)
+++ cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_if_codegen.cpp 
Wed Jan 30 12:49:52 2019
@@ -83,7 +83,7 @@ int main() {
 // CHECK: call void @__kmpc_push_target_tripcount(i64 -1, i64 100)
 // CHECK: call i{{[0-9]+}} @__tgt_target_teams(
 // CHECK: call void [[OFFLOADING_FUN_0:@.+]](
-// CHECK: call void @__kmpc_push_target_tripcount(i64 -1, i64 100)
+// CHECK-NOT: call void @__kmpc_push_target_tripcount(i64 -1, i64 100)
 // CHECK: call void [[OFFLOADING_FUN_1:@.+]](
 // CHECK: call void @__kmpc_push_target_tripcount(i64 -1, i64 100)
 // CHECK: call i{{[0-9]+}} @__tgt_target_teams(

Modified: 
cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_simd_if_codegen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_simd_if_codegen.cpp?rev=352669&r1=352668&r2=352669&view=diff
==
--- 
cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_simd_if_codegen.cpp 
(original)
+++ 
cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_simd_if_codegen.cpp 
Wed Jan 30 12:49:52 2019
@@ -83,7 +83,7 @@ int main() {
 // CHECK: call void @__kmpc_push_target_tripcount(i64 -1, i64 100)
 // CHECK: call i{{[0-9]+}} @__tgt_target_teams(
 // CHECK: call void [[OFFLOADING_FUN_0:@.+]](
-// CHECK: call void @__kmpc_push_target_tripco

[PATCH] D57100: [clang-tidy] refactor bugprone-exception-escape analysis into class

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

In D57100#1373440 , @JonasToth wrote:

> @baloghadamsoftware Do you see any problems with the refactoring, especially 
> the new `FunctionDecl*`-Caching is not exactly a refactoring. If you have any 
> thoughts on that would be great to hear!


Yes, it looks a good improvement, I expect another huge speedup. (We had a 
previous huge speedup after I optimized the matcher expression in 7.0.1 because 
in 7.0.0 it seemed to hang, it was really bad).




Comment at: clang-tidy/utils/ExceptionAnalyzer.h:23
+/// It can be configured to ignore some exception types, especially
+/// `std::bad_alloc` can be disabled as using dynamic memory will always
+/// give the possibility of an exception.

`std::bad_alloc` is hardwired to ignore, so I think this comment should be 
rephrased.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D57100



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


r352672 - Don't define __has_feature(objc_fixed_enum) in non-objc mode

2019-01-30 Thread Erik Pilkington via cfe-commits
Author: epilk
Date: Wed Jan 30 13:14:08 2019
New Revision: 352672

URL: http://llvm.org/viewvc/llvm-project?rev=352672&view=rev
Log:
Don't define __has_feature(objc_fixed_enum) in non-objc mode

This is only a formal language feature in ObjC, otherwise its just an
extension. Making this change was also an ABI break.

Modified:
cfe/trunk/include/clang/Basic/Features.def
cfe/trunk/test/SemaObjC/enum-fixed-type.m

Modified: cfe/trunk/include/clang/Basic/Features.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Features.def?rev=352672&r1=352671&r2=352672&view=diff
==
--- cfe/trunk/include/clang/Basic/Features.def (original)
+++ cfe/trunk/include/clang/Basic/Features.def Wed Jan 30 13:14:08 2019
@@ -95,7 +95,7 @@ FEATURE(objc_arc, LangOpts.ObjCAutoRefCo
 FEATURE(objc_arc_fields, true)
 FEATURE(objc_arc_weak, LangOpts.ObjCWeak)
 FEATURE(objc_default_synthesize_properties, LangOpts.ObjC)
-FEATURE(objc_fixed_enum, true)
+FEATURE(objc_fixed_enum, LangOpts.ObjC)
 FEATURE(objc_instancetype, LangOpts.ObjC)
 FEATURE(objc_kindof, LangOpts.ObjC)
 FEATURE(objc_modules, LangOpts.ObjC && LangOpts.Modules)

Modified: cfe/trunk/test/SemaObjC/enum-fixed-type.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/enum-fixed-type.m?rev=352672&r1=352671&r2=352672&view=diff
==
--- cfe/trunk/test/SemaObjC/enum-fixed-type.m (original)
+++ cfe/trunk/test/SemaObjC/enum-fixed-type.m Wed Jan 30 13:14:08 2019
@@ -1,9 +1,11 @@
 // RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
 // RUN: %clang_cc1 -fsyntax-only -verify -xc %s
 
+#ifdef __OBJC__
 #if !__has_feature(objc_fixed_enum)
 #  error Enumerations with a fixed underlying type are not supported
 #endif
+#endif
 
 #if !__has_extension(cxx_fixed_enum)
 #  error Enumerations with a fixed underlying type are not supported


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


[PATCH] D52339: Support enums with a fixed underlying type in all language modes

2019-01-30 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington added a comment.

In D52339#1377527 , @arphaman wrote:

> @erik.pilkington the change to make `objc_fixed_enum` true in non-ObjC mode 
> turned out to be problematic for our adoption. Could you please fix it before 
> LLVM8 is wrapped up so that we don't ship this extension as on by default for 
> all language modes?


Yeah, now that I look again, we shouldn't be changing the FEATURE(...) flag 
behaviour, because fixed enums in C aren't a formal language feature. I removed 
this in r352672.

In D52339#1377536 , @arphaman wrote:

> We could introduce a new extension flag like `c_fixed_enum` that can be set 
> for all language modes. `objc_fixed_enum` should apply to ObjC only.


Can't we just use cxx_fixed_enum?


Repository:
  rC Clang

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

https://reviews.llvm.org/D52339



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


Re: r352672 - Don't define __has_feature(objc_fixed_enum) in non-objc mode

2019-01-30 Thread Erik Pilkington via cfe-commits

Hans, can you cherry-pick this into LLVM 8?

Thanks!

On 1/30/19 1:14 PM, Erik Pilkington via cfe-commits wrote:

Author: epilk
Date: Wed Jan 30 13:14:08 2019
New Revision: 352672

URL: http://llvm.org/viewvc/llvm-project?rev=352672&view=rev
Log:
Don't define __has_feature(objc_fixed_enum) in non-objc mode

This is only a formal language feature in ObjC, otherwise its just an
extension. Making this change was also an ABI break.

Modified:
 cfe/trunk/include/clang/Basic/Features.def
 cfe/trunk/test/SemaObjC/enum-fixed-type.m

Modified: cfe/trunk/include/clang/Basic/Features.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Features.def?rev=352672&r1=352671&r2=352672&view=diff
==
--- cfe/trunk/include/clang/Basic/Features.def (original)
+++ cfe/trunk/include/clang/Basic/Features.def Wed Jan 30 13:14:08 2019
@@ -95,7 +95,7 @@ FEATURE(objc_arc, LangOpts.ObjCAutoRefCo
  FEATURE(objc_arc_fields, true)
  FEATURE(objc_arc_weak, LangOpts.ObjCWeak)
  FEATURE(objc_default_synthesize_properties, LangOpts.ObjC)
-FEATURE(objc_fixed_enum, true)
+FEATURE(objc_fixed_enum, LangOpts.ObjC)
  FEATURE(objc_instancetype, LangOpts.ObjC)
  FEATURE(objc_kindof, LangOpts.ObjC)
  FEATURE(objc_modules, LangOpts.ObjC && LangOpts.Modules)

Modified: cfe/trunk/test/SemaObjC/enum-fixed-type.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/enum-fixed-type.m?rev=352672&r1=352671&r2=352672&view=diff
==
--- cfe/trunk/test/SemaObjC/enum-fixed-type.m (original)
+++ cfe/trunk/test/SemaObjC/enum-fixed-type.m Wed Jan 30 13:14:08 2019
@@ -1,9 +1,11 @@
  // RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
  // RUN: %clang_cc1 -fsyntax-only -verify -xc %s
  
+#ifdef __OBJC__

  #if !__has_feature(objc_fixed_enum)
  #  error Enumerations with a fixed underlying type are not supported
  #endif
+#endif
  
  #if !__has_extension(cxx_fixed_enum)

  #  error Enumerations with a fixed underlying type are not supported


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


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


[PATCH] D57458: [docs][mips] Clang 8.0 Release notes

2019-01-30 Thread Simon Atanasyan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL352675: [docs][mips] Clang 8.0 Release notes (authored by 
atanasyan, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D57458?vs=184309&id=184358#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D57458

Files:
  cfe/branches/release_80/docs/ReleaseNotes.rst


Index: cfe/branches/release_80/docs/ReleaseNotes.rst
===
--- cfe/branches/release_80/docs/ReleaseNotes.rst
+++ cfe/branches/release_80/docs/ReleaseNotes.rst
@@ -127,6 +127,10 @@
   manually and rely on the old behaviour you will need to add appropriate
   compiler flags for finding the corresponding libc++ include directory.
 
+- The integrated assembler is used now by default for all MIPS targets.
+
+- Improved support for MIPS N32 ABI and MIPS R6 target triples.
+
 New Compiler Flags
 --
 
@@ -139,6 +143,10 @@
 - When using a custom stack alignment, the ``stackrealign`` attribute is now
   implicitly set on the main function.
 
+- Emission of ``R_MIPS_JALR`` and ``R_MICROMIPS_JALR`` relocations can now
+  be controlled by the ``-mrelax-pic-calls`` and ``-mno-relax-pic-calls``
+  options.
+
 - ...
 
 Deprecated Compiler Flags


Index: cfe/branches/release_80/docs/ReleaseNotes.rst
===
--- cfe/branches/release_80/docs/ReleaseNotes.rst
+++ cfe/branches/release_80/docs/ReleaseNotes.rst
@@ -127,6 +127,10 @@
   manually and rely on the old behaviour you will need to add appropriate
   compiler flags for finding the corresponding libc++ include directory.
 
+- The integrated assembler is used now by default for all MIPS targets.
+
+- Improved support for MIPS N32 ABI and MIPS R6 target triples.
+
 New Compiler Flags
 --
 
@@ -139,6 +143,10 @@
 - When using a custom stack alignment, the ``stackrealign`` attribute is now
   implicitly set on the main function.
 
+- Emission of ``R_MIPS_JALR`` and ``R_MICROMIPS_JALR`` relocations can now
+  be controlled by the ``-mrelax-pic-calls`` and ``-mno-relax-pic-calls``
+  options.
+
 - ...
 
 Deprecated Compiler Flags
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


  1   2   >