[PATCH] D84341: Implement __builtin_eh_return_data_regno for SystemZ

2020-07-22 Thread Slavomír Kučera via Phabricator via cfe-commits
slavek-kucera updated this revision to Diff 280030.

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

https://reviews.llvm.org/D84341

Files:
  clang/lib/Basic/Targets/SystemZ.h
  clang/test/CodeGen/builtins-systemz.c


Index: clang/test/CodeGen/builtins-systemz.c
===
--- clang/test/CodeGen/builtins-systemz.c
+++ clang/test/CodeGen/builtins-systemz.c
@@ -142,3 +142,10 @@
   result = __TM_failure_code (tdb);
 }
 
+void test_eh_return_data_regno() {
+  volatile int res;
+  res = __builtin_eh_return_data_regno(0); // CHECK: store volatile i32 6
+  res = __builtin_eh_return_data_regno(1); // CHECK: store volatile i32 7
+  res = __builtin_eh_return_data_regno(2); // CHECK: store volatile i32 8
+  res = __builtin_eh_return_data_regno(3); // CHECK: store volatile i32 9
+}
Index: clang/lib/Basic/Targets/SystemZ.h
===
--- clang/lib/Basic/Targets/SystemZ.h
+++ clang/lib/Basic/Targets/SystemZ.h
@@ -157,6 +157,10 @@
   const char *getLongDoubleMangling() const override { return "g"; }
 
   bool hasExtIntType() const override { return true; }
+
+  int getEHDataRegisterNumber(unsigned RegNo) const override {
+return RegNo < 4 ? 6 + RegNo : -1;
+  }
 };
 } // namespace targets
 } // namespace clang


Index: clang/test/CodeGen/builtins-systemz.c
===
--- clang/test/CodeGen/builtins-systemz.c
+++ clang/test/CodeGen/builtins-systemz.c
@@ -142,3 +142,10 @@
   result = __TM_failure_code (tdb);
 }
 
+void test_eh_return_data_regno() {
+  volatile int res;
+  res = __builtin_eh_return_data_regno(0); // CHECK: store volatile i32 6
+  res = __builtin_eh_return_data_regno(1); // CHECK: store volatile i32 7
+  res = __builtin_eh_return_data_regno(2); // CHECK: store volatile i32 8
+  res = __builtin_eh_return_data_regno(3); // CHECK: store volatile i32 9
+}
Index: clang/lib/Basic/Targets/SystemZ.h
===
--- clang/lib/Basic/Targets/SystemZ.h
+++ clang/lib/Basic/Targets/SystemZ.h
@@ -157,6 +157,10 @@
   const char *getLongDoubleMangling() const override { return "g"; }
 
   bool hasExtIntType() const override { return true; }
+
+  int getEHDataRegisterNumber(unsigned RegNo) const override {
+return RegNo < 4 ? 6 + RegNo : -1;
+  }
 };
 } // namespace targets
 } // namespace clang
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D83772: [Windows] Fix limit on command line size

2020-07-22 Thread Serge Pavlov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdab898f9ab62: [Windows] Fix limit on command line size 
(authored by sepavloff).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83772

Files:
  lldb/source/Host/windows/ProcessLauncherWindows.cpp
  llvm/include/llvm/Support/Program.h
  llvm/lib/Support/Windows/Program.inc
  llvm/unittests/Support/CommandLineTest.cpp

Index: llvm/unittests/Support/CommandLineTest.cpp
===
--- llvm/unittests/Support/CommandLineTest.cpp
+++ llvm/unittests/Support/CommandLineTest.cpp
@@ -763,6 +763,18 @@
 TEST(CommandLineTest, ArgumentLimit) {
   std::string args(32 * 4096, 'a');
   EXPECT_FALSE(llvm::sys::commandLineFitsWithinSystemLimits("cl", args.data()));
+  std::string args2(256, 'a');
+  EXPECT_TRUE(llvm::sys::commandLineFitsWithinSystemLimits("cl", args2.data()));
+  if (Triple(sys::getProcessTriple()).isOSWindows()) {
+// We use 32000 as a limit for command line length. Program name ('cl'),
+// separating spaces and termination null character occupy 5 symbols.
+std::string long_arg(32000 - 5, 'b');
+EXPECT_TRUE(
+llvm::sys::commandLineFitsWithinSystemLimits("cl", long_arg.data()));
+long_arg += 'b';
+EXPECT_FALSE(
+llvm::sys::commandLineFitsWithinSystemLimits("cl", long_arg.data()));
+  }
 }
 
 TEST(CommandLineTest, ResponseFileWindows) {
Index: llvm/lib/Support/Windows/Program.inc
===
--- llvm/lib/Support/Windows/Program.inc
+++ llvm/lib/Support/Windows/Program.inc
@@ -189,7 +189,13 @@
   // Windows wants a command line, not an array of args, to pass to the new
   // process.  We have to concatenate them all, while quoting the args that
   // have embedded spaces (or are empty).
-  std::string Command = flattenWindowsCommandLine(Args);
+  auto Result = flattenWindowsCommandLine(Args);
+  if (std::error_code ec = Result.getError()) {
+SetLastError(ec.value());
+MakeErrMsg(ErrMsg, std::string("Unable to convert command-line to UTF-16"));
+return false;
+  }
+  std::wstring Command = *Result;
 
   // The pointer to the environment block for the new process.
   std::vector EnvBlock;
@@ -271,18 +277,11 @@
 return false;
   }
 
-  SmallVector CommandUtf16;
-  if (std::error_code ec = windows::UTF8ToUTF16(Command, CommandUtf16)) {
-SetLastError(ec.value());
-MakeErrMsg(ErrMsg,
-   std::string("Unable to convert command-line to UTF-16"));
-return false;
-  }
-
-  BOOL rc = CreateProcessW(ProgramUtf16.data(), CommandUtf16.data(), 0, 0,
-   TRUE, CREATE_UNICODE_ENVIRONMENT,
-   EnvBlock.empty() ? 0 : EnvBlock.data(), 0, ,
-   );
+  std::vector CommandUtf16(Command.size() + 1, 0);
+  std::copy(Command.begin(), Command.end(), CommandUtf16.begin());
+  BOOL rc = CreateProcessW(ProgramUtf16.data(), CommandUtf16.data(), 0, 0, TRUE,
+   CREATE_UNICODE_ENVIRONMENT,
+   EnvBlock.empty() ? 0 : EnvBlock.data(), 0, , );
   DWORD err = GetLastError();
 
   // Regardless of whether the process got created or not, we are done with
@@ -376,7 +375,7 @@
 }
 
 namespace llvm {
-std::string sys::flattenWindowsCommandLine(ArrayRef Args) {
+ErrorOr sys::flattenWindowsCommandLine(ArrayRef Args) {
   std::string Command;
   for (StringRef Arg : Args) {
 if (argNeedsQuotes(Arg))
@@ -387,7 +386,11 @@
 Command.push_back(' ');
   }
 
-  return Command;
+  SmallVector CommandUtf16;
+  if (std::error_code ec = windows::UTF8ToUTF16(Command, CommandUtf16))
+return ec;
+
+  return std::wstring(CommandUtf16.begin(), CommandUtf16.end());
 }
 
 ProcessInfo sys::Wait(const ProcessInfo , unsigned SecondsToWait,
@@ -532,12 +535,16 @@
 
 bool llvm::sys::commandLineFitsWithinSystemLimits(StringRef Program,
   ArrayRef Args) {
-  // The documented max length of the command line passed to CreateProcess.
-  static const size_t MaxCommandStringLength = 32768;
+  // The documentation on CreateProcessW states that the size of the argument
+  // lpCommandLine must not be greater than 32767 characters, including the
+  // Unicode terminating null character. We use smaller value to reduce risk
+  // of getting invalid command line due to unaccounted factors.
+  static const size_t MaxCommandStringLength = 32000;
   SmallVector FullArgs;
   FullArgs.push_back(Program);
   FullArgs.append(Args.begin(), Args.end());
-  std::string Result = flattenWindowsCommandLine(FullArgs);
-  return (Result.size() + 1) <= MaxCommandStringLength;
+  auto Result = flattenWindowsCommandLine(FullArgs);
+  assert(!Result.getError());
+  return (Result->size() + 1) <= MaxCommandStringLength;
 }
 }
Index: llvm/include/llvm/Support/Program.h

[PATCH] D83242: [clang][BPF] support expr with typedef/record type for TYPE_EXISTENCE reloc

2020-07-22 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment.

@anakryiko Please rebase on top of latest clang. There is a recent core change 
which touches BPF code which I am also modifying.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83242



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


[PATCH] D83242: [clang][BPF] support expr with typedef/record type for TYPE_EXISTENCE reloc

2020-07-22 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 280027.
yonghong-song retitled this revision from "[clang][BPF] support expr with 
typedef/record type for FIELD_EXISTENCE reloc" to "[clang][BPF] support expr 
with typedef/record type for TYPE_EXISTENCE reloc".
yonghong-song edited the summary of this revision.
yonghong-song added a comment.

use a different reloc type TYPE_EXISTENCE (defined in 
llvm/lib/Target/BPF/BPFCORE.h) instead of old FIELD_EXISTENCE. This will 
simplify libbpf processing.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83242

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/TargetInfo.h
  clang/lib/Basic/TargetInfo.cpp
  clang/lib/Basic/Targets/BPF.h
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/builtins-bpf-preserve-field-info-3.c
  clang/test/Sema/builtins-bpf.c

Index: clang/test/Sema/builtins-bpf.c
===
--- clang/test/Sema/builtins-bpf.c
+++ clang/test/Sema/builtins-bpf.c
@@ -1,14 +1,27 @@
 // RUN: %clang_cc1 -x c -triple bpf-pc-linux-gnu -dwarf-version=4 -fsyntax-only -verify %s
 
-struct s { int a; int b[4]; int c:1; };
-union u { int a; int b[4]; int c:1; };
+struct s {
+  int a;
+  int b[4];
+  int c:1;
+};
+union u {
+  int a;
+  int b[4];
+  int c:1;
+};
+typedef struct {
+  int a;
+  int b;
+} __t;
+typedef int (*__f)(void);
 
 unsigned invalid1(const int *arg) {
-  return __builtin_preserve_field_info(arg, 1); // expected-error {{__builtin_preserve_field_info argument 1 not a field access}}
+  return __builtin_preserve_field_info(arg, 1); // expected-error {{__builtin_preserve_field_info argument 1 invalid}}
 }
 
 unsigned invalid2(const int *arg) {
-  return __builtin_preserve_field_info(*arg, 1); // expected-error {{__builtin_preserve_field_info argument 1 not a field access}}
+  return __builtin_preserve_field_info(*arg, 1); // expected-error {{__builtin_preserve_field_info argument 1 invalid}}
 }
 
 void *invalid3(struct s *arg) {
@@ -46,3 +59,25 @@
 unsigned invalid11(struct s *arg, int info_kind) {
   return __builtin_preserve_field_info(arg->a, info_kind); // expected-error {{__builtin_preserve_field_info argument 2 not a constant}}
 }
+
+unsigned valid12() {
+  const struct s t = {};
+  return __builtin_preserve_field_info(t, 8);
+}
+
+unsigned valid13() {
+  return __builtin_preserve_field_info(*(struct s *)0, 8);
+}
+
+unsigned valid14() {
+  __t t = {};
+  return __builtin_preserve_field_info(t, 8);
+}
+
+unsigned valid15() {
+  return __builtin_preserve_field_info((const __f)0, 8);
+}
+
+unsigned invalid16(struct s *arg) {
+  return __builtin_preserve_field_info(arg->a + 2, 8); // expected-error {{__builtin_preserve_field_info argument 1 invalid}}
+}
Index: clang/test/CodeGen/builtins-bpf-preserve-field-info-3.c
===
--- /dev/null
+++ clang/test/CodeGen/builtins-bpf-preserve-field-info-3.c
@@ -0,0 +1,33 @@
+// REQUIRES: bpf-registered-target
+// RUN: %clang -target bpf -emit-llvm -S -g %s -o - | FileCheck %s
+
+#define _(x, y) (__builtin_preserve_field_info((x), (y)))
+
+struct s {
+  char a;
+};
+typedef struct {
+  char a;
+} __s1;
+
+typedef int (*__func)(void);
+
+unsigned unit1() {
+  const __s1 v = {};
+  return _(v, 8) + _(*(struct s *)0, 8);
+}
+
+// CHECK: call i32 @llvm.bpf.preserve.field.info.p0s_struct.__s1s(%struct.__s1* %{{[0-9a-z]+}}, i64 8), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[CONST_S1:[0-9]+]]
+// CHECK: call i32 @llvm.bpf.preserve.field.info.p0s_struct.ss(%struct.s* null, i64 8), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[STRUCT_S:[0-9]+]]
+
+unsigned unit2() {
+  __func f;
+  return _((__func)0, 8) + _(f, 8);
+}
+
+// CHECK: call i32 @llvm.bpf.preserve.field.info.p0f_i32f(i32 ()* null, i64 8), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[TYPEDEF:[0-9]+]]
+// CHECK: call i32 @llvm.bpf.preserve.field.info.p0p0f_i32f(i32 ()** %{{[0-9a-z]+}}, i64 8), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[TYPEDEF:[0-9]+]]
+
+// CHECK: ![[STRUCT_S]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "s"
+// CHECK: ![[TYPEDEF]] = !DIDerivedType(tag: DW_TAG_typedef, name: "__func"
+// CHECK: ![[CONST_S1]] = !DIDerivedType(tag: DW_TAG_const_type
Index: clang/lib/Sema/SemaChecking.cpp
===
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -2564,7 +2564,7 @@
CallExpr *TheCall) {
   assert((BuiltinID == BPF::BI__builtin_preserve_field_info ||
   BuiltinID == BPF::BI__builtin_btf_type_id) &&
- "unexpected ARM builtin");
+ "unexpected BPF builtin");
 
   if (checkArgCount(*this, TheCall, 2))
 return true;
@@ -2583,25 +2583,49 @@
 return false;
   }
 
-  // The first argument needs to be 

[PATCH] D83592: [Coverage] Add comment to skipped regions

2020-07-22 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu added a comment.

Just tried the cmake option `-DLLVM_BUILD_INSTRUMENTED_COVERAGE=On`, the result 
still shows count for comments... but it pass the `coverage_comments.cpp` test 
case, need more investigation.


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

https://reviews.llvm.org/D83592



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


[PATCH] D84364: [CUDA][HIP] Defer all diagnostics for host device functions

2020-07-22 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

FWIW, OpenMP does also defer some diagnostics. It feels like a mess we can't 
avoid. That means, I think there is merit in generalizing this. I haven't 
reviewed this in any detail though.


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

https://reviews.llvm.org/D84364



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


[PATCH] D84364: [CUDA][HIP] Defer all diagnostics for host device functions

2020-07-22 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment.

Another thing we can do is to limit the diagnostic messages that can be 
deferred. For example, we only defer semantic diagnostics, or overloading 
resolution related diagnostics. According to previous experience, what bothers 
us most are the diagnostics triggered by the differences in function 
overloading on device and host sides. If a diagnostic tends to happen on both 
sides, e.g. syntax error, there is less value to defer it.


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

https://reviews.llvm.org/D84364



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


[PATCH] D84364: [CUDA][HIP] Defer all diagnostics for host device functions

2020-07-22 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment.

I'd like to clarify a little bit about `deferring` an error.

First it is localized to a function. If an error causes a function not parsed 
completely, it will be emitted immediately.

So if an error is deferred, it means clang at least parses that function 
containing it.

Second, if an entity caused an error which is `deferred`, it does not mean 
clang thinks `gee, let's defer it, and thinks now we do not have error here`. 
It is more like `OK here is an error and we know it. We just save that message 
somewhere and do not print it out for now.` clang knows that error happened and 
propagates the error status the same way as non-deferred diagnostics inside 
that function. In a sense, the deferred diagnostic and immediate diagnostic 
does not differ much.


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

https://reviews.llvm.org/D84364



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


[PATCH] D79279: Add overloaded versions of builtin mem* functions

2020-07-22 Thread JF Bastien via Phabricator via cfe-commits
jfb added a comment.

In D79279#2168479 , @rjmccall wrote:

> Is there a need for an atomic memcpy at all?  Why is it useful to allow this 
> operation to take on "atomic" semantics — which aren't actually atomic 
> because the loads and stores to elements are torn — with hardcoded memory 
> ordering and somewhat arbitrary rules about what the atomic size is?


Hans lays out a rationale for usefulness in his paper, but what I've 
implemented is more useful: it's *unordered* so you can fence as you desire 
around it, yet it guarantees a minimum memory access size based on the pointer 
parameters. For example, copying an atomic `int` will be 4 byte operations 
which are single-copy-atomic, but the accesses from one `int` to the next 
aren't performed in any guaranteed order (or observable in any guaranteed order 
either). I talked about this with him a while ago but IIRC he wasn't sure about 
implementation among other things, so when you asked me to widen my original 
`volatile`-only `memcpy` to also do other qualifiers, I realized that it was a 
neat way to do atomic as well as other qualifiers. I've talked to a few SG1 
folks about this, and I believe (for other reasons too) it's where the design 
will end up for Hans' paper.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79279



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


[PATCH] D84364: [CUDA][HIP] Defer all diagnostics for host device functions

2020-07-22 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment.

In D84364#2168036 , @tra wrote:

> One side effect of this change is that we'll probably stop producing 
> diagnostics for the code that is known to be wrong, but happens to be unused.
>
> E.g.
>
>   __host__ __device__ static void hd() {
>  no_such_type_t t;
>   }
>
>
> We obviously can never compile this function on either side of the 
> compilation and clang currently does diagnose it on both sides.
>  However, if all diagnostics in HD functions are postponed until codegen, 
> this error will go unreported.
>
> What if I have a syntax error in a HD function? I'd still want it to be 
> diagnosed. 
>  It's going to be interesting to see how it affects parsing subsequent code. 
>  E.g https://godbolt.org/z/1vfPcc -- clang complains about the error in 
> `innocent` due to an error in `hd`. If all diags issues in `hd` are postponed 
> and the user only sees `error: function definition is not allowed here`, it 
> will be rather confusing, because the `innocent` itself is perfectly fine.


A diagnostic will be deferred only if clang successfully parsed a function 
declaration and the current context is a function declaration.

In the above situation, clang fails to parse the function and the current 
context is not a function, therefore the error is emitted immediately, like 
before.

I have added a lit test for such situation.

> Also, this patch may need more eyes on it. I'm sure there are more corner 
> cases we may need to think about. 
>  E.g. how would it affect SFINAE? Will it allow some things to succeed where 
> they would've failed previously? If so, is it always the right thing to do?

We only defer diagnostics happen inside a host device function. My guess is 
that SFINAE will work as before since it happens not in a function scope, 
therefore it is not deferred. I will add some tests.


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

https://reviews.llvm.org/D84364



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


[PATCH] D84364: [CUDA][HIP] Defer all diagnostics for host device functions

2020-07-22 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 280013.
yaxunl edited the summary of this revision.
yaxunl added a comment.
Herald added a subscriber: dang.

Added option -fgpu-defer-diag to control this new behavior. By default it is 
off.
Added test for syntax error.


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

https://reviews.llvm.org/D84364

Files:
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Driver/Options.td
  clang/include/clang/Sema/Sema.h
  clang/lib/Driver/ToolChains/Cuda.cpp
  clang/lib/Driver/ToolChains/HIP.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Sema/AnalysisBasedWarnings.cpp
  clang/lib/Sema/Sema.cpp
  clang/lib/Sema/SemaAttr.cpp
  clang/lib/Sema/SemaCUDA.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaExprObjC.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/Sema/SemaSYCL.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/SemaStmtAsm.cpp
  clang/lib/Sema/SemaTemplateInstantiate.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/lib/Sema/SemaTemplateVariadic.cpp
  clang/lib/Sema/SemaType.cpp
  clang/test/SemaCUDA/deferred-all.cu

Index: clang/test/SemaCUDA/deferred-all.cu
===
--- /dev/null
+++ clang/test/SemaCUDA/deferred-all.cu
@@ -0,0 +1,48 @@
+// RUN: %clang_cc1 -fcuda-is-device -fsyntax-only -verify=dev,com %s \
+// RUN:   -fgpu-defer-diag
+// RUN: %clang_cc1 -fsyntax-only -verify=host,com %s \
+// RUN:   -fgpu-defer-diag
+
+#include "Inputs/cuda.h"
+
+__device__ void callee(int);
+__host__ void callee(float); // host-note 2{{candidate function}}
+__host__ void callee(double); // host-note 2{{candidate function}}
+
+// Check no diagnostics for this function since it is never
+// called.
+
+inline __host__ __device__ void hdf_not_called() {
+  callee(1);
+  bad_line
+}
+
+// When emitted on device, there is syntax error.
+// When emitted on host, there is ambiguity and syntax error.
+  
+inline __host__ __device__ void hdf_called() {
+  callee(1); // host-error {{call to 'callee' is ambiguous}}
+  bad_line // com-error {{use of undeclared identifier 'bad_line'}}
+}
+
+// This is similar to the above but is always emitted on
+// both sides.
+
+__host__ __device__ void hdf_always_emitted() {
+  callee(1); // host-error {{call to 'callee' is ambiguous}}
+  bad_line // com-error {{use of undeclared identifier 'bad_line'}}
+}
+
+void hf() {
+ hdf_called(); // host-note {{called by 'hf'}}
+}
+ 
+__device__ void df() {
+ hdf_called(); // dev-note {{called by 'df'}}
+}
+
+// If a syntax error causes a function not declared, it cannot
+// be deferred.
+
+inline __host__ __device__ void bad_func() { // com-note {{to match this '{'}}
+// com-error {{expected '}'}}
Index: clang/lib/Sema/SemaType.cpp
===
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -4087,7 +4087,8 @@
 
 /// Creates a fix-it to insert a C-style nullability keyword at \p pointerLoc,
 /// taking into account whitespace before and after.
-static void fixItNullability(Sema , DiagnosticBuilder ,
+template 
+static void fixItNullability(Sema , DiagBuilderT ,
  SourceLocation PointerLoc,
  NullabilityKind Nullability) {
   assert(PointerLoc.isValid());
Index: clang/lib/Sema/SemaTemplateVariadic.cpp
===
--- clang/lib/Sema/SemaTemplateVariadic.cpp
+++ clang/lib/Sema/SemaTemplateVariadic.cpp
@@ -368,8 +368,8 @@
   Locations.push_back(Unexpanded[I].second);
   }
 
-  DiagnosticBuilder DB = Diag(Loc, diag::err_unexpanded_parameter_pack)
- << (int)UPPC << (int)Names.size();
+  auto DB = Diag(Loc, diag::err_unexpanded_parameter_pack)
+<< (int)UPPC << (int)Names.size();
   for (size_t I = 0, E = std::min(Names.size(), (size_t)2); I != E; ++I)
 DB << Names[I];
 
Index: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
===
--- clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -5999,7 +5999,7 @@
 if (!Result) {
   if (isa(D)) {
 // UsingShadowDecls can instantiate to nothing because of using hiding.
-  } else if (Diags.hasUncompilableErrorOccurred()) {
+  } else if (hasUncompilableErrorOccurred()) {
 // We've already complained about some ill-formed code, so most likely
 // this declaration failed to instantiate. There's no point in
 // complaining further, since this is normal in invalid code.
Index: clang/lib/Sema/SemaTemplateInstantiate.cpp
===
--- clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -237,7 +237,7 @@
   // error have occurred. Any diagnostics we might have raised will not be
   // visible, and we do 

[PATCH] D83997: [os_log] Improve the way we extend the lifetime of objects passed to __builtin_os_log_format

2020-07-22 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

Why is the lifetime extended to the enclosing block scope anyway?  I understand 
why we need a clang.arc.use — the optimizer can't reasonably understand that 
the object has to live within the buffer — but isn't the buffer only used for 
the duration of the call?  Why is extension necessary?




Comment at: clang/include/clang/Serialization/ASTBitCodes.h:1987
+  COK_CompoundLiteral,
+  COK_ImplicitCastExpr
+};

This seems like an excessively general name for what's happening here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83997



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


[PATCH] D79279: Add overloaded versions of builtin mem* functions

2020-07-22 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

Is there a need for an atomic memcpy at all?  Why is it useful to allow this 
operation to take on "atomic" semantics — which aren't actually atomic because 
the loads and stores to elements are torn — with hardcoded memory ordering and 
somewhat arbitrary rules about what the atomic size is?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79279



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


[PATCH] D83592: [Coverage] Add comment to skipped regions

2020-07-22 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu updated this revision to Diff 280005.
zequanwu added a comment.

Fix the bug about merging skipped regions. Simple don't merge, because 
`adjustSkippedRange` will handle those cases if `NextTokLoc` is invalid, which 
will just skip the next if condition.


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

https://reviews.llvm.org/D83592

Files:
  clang/include/clang/Lex/Preprocessor.h
  clang/lib/CodeGen/CodeGenAction.cpp
  clang/lib/CodeGen/CoverageMappingGen.cpp
  clang/lib/CodeGen/CoverageMappingGen.h
  clang/lib/Lex/Preprocessor.cpp
  clang/test/CoverageMapping/break.c
  clang/test/CoverageMapping/builtinmacro.c
  clang/test/CoverageMapping/classtemplate.cpp
  clang/test/CoverageMapping/comment-in-macro.c
  clang/test/CoverageMapping/continue.c
  clang/test/CoverageMapping/coroutine.cpp
  clang/test/CoverageMapping/deferred-region.cpp
  clang/test/CoverageMapping/if.cpp
  clang/test/CoverageMapping/includehell.cpp
  clang/test/CoverageMapping/label.cpp
  clang/test/CoverageMapping/logical.cpp
  clang/test/CoverageMapping/loops.cpp
  clang/test/CoverageMapping/macro-expressions.cpp
  clang/test/CoverageMapping/macroparams2.c
  clang/test/CoverageMapping/macros.c
  clang/test/CoverageMapping/macroscopes.cpp
  clang/test/CoverageMapping/moremacros.c
  clang/test/CoverageMapping/objc.m
  clang/test/CoverageMapping/pr32679.cpp
  clang/test/CoverageMapping/preprocessor.c
  clang/test/CoverageMapping/return.c
  clang/test/CoverageMapping/switch.cpp
  clang/test/CoverageMapping/switchmacro.c
  clang/test/CoverageMapping/test.c
  clang/test/CoverageMapping/trycatch.cpp
  clang/test/CoverageMapping/unreachable-macro.c
  clang/test/CoverageMapping/while.c
  clang/test/lit.cfg.py
  compiler-rt/test/profile/Inputs/instrprof-comdat.h
  compiler-rt/test/profile/coverage_comments.cpp
  compiler-rt/test/profile/instrprof-set-file-object-merging.c

Index: compiler-rt/test/profile/instrprof-set-file-object-merging.c
===
--- compiler-rt/test/profile/instrprof-set-file-object-merging.c
+++ compiler-rt/test/profile/instrprof-set-file-object-merging.c
@@ -34,7 +34,7 @@
 // CHECK:   17|  2|
 // CHECK:   18|  2|  FILE *F = fopen(argv[1], "r+b");
 // CHECK:   19|  2|  if (!F) {
-// CHECK:   20|  1|// File might not exist, try opening with truncation
+// CHECK:   20|   |// File might not exist, try opening with truncation
 // CHECK:   21|  1|F = fopen(argv[1], "w+b");
 // CHECK:   22|  1|  }
 // CHECK:   23|  2|  __llvm_profile_set_file_object(F, 1);
Index: compiler-rt/test/profile/coverage_comments.cpp
===
--- /dev/null
+++ compiler-rt/test/profile/coverage_comments.cpp
@@ -0,0 +1,71 @@
+// RUN: %clangxx_profgen -fcoverage-mapping -Wno-comment -o %t %s
+// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
+// RUN: llvm-profdata merge -o %t.profdata %t.profraw
+// RUN: llvm-cov show %t -instr-profile %t.profdata -path-equivalence=/tmp,%S 2>&1 | FileCheck %s
+
+int main() {   // CHECK:   [[# @LINE]]| 1|int main() {
+/* comment */ int x = 0;   // CHECK-NEXT:  [[# @LINE]]| 1|
+int y = 0; /* comment */   // CHECK-NEXT:  [[# @LINE]]| 1|
+int z = 0; // comment  // CHECK-NEXT:  [[# @LINE]]| 1|
+// comment // CHECK-NEXT:  [[# @LINE]]|  |
+   // CHECK-NEXT:  [[# @LINE]]|  |
+x = 0; /*  // CHECK-NEXT:  [[# @LINE]]| 1|
+comment// CHECK-NEXT:  [[# @LINE]]|  |
+*/ // CHECK-NEXT:  [[# @LINE]]|  |
+   // CHECK-NEXT:  [[# @LINE]]|  |
+/* // CHECK-NEXT:  [[# @LINE]]|  |
+comment// CHECK-NEXT:  [[# @LINE]]|  |
+*/ x = 0;  // CHECK-NEXT:  [[# @LINE]]| 1|
+   // CHECK-NEXT:  [[# @LINE]]|  |
+/* comment */  // CHECK-NEXT:  [[# @LINE]]|  |
+// comment // CHECK-NEXT:  [[# @LINE]]|  |
+/* comment */  // CHECK-NEXT:  [[# @LINE]]|  |
+z =// CHECK-NEXT:  [[# @LINE]]| 1|
+x // comment   // CHECK-NEXT:  [[# @LINE]]| 1|
+// comment // CHECK-NEXT:  [[# @LINE]]|  |
++ /*   // CHECK-NEXT:  [[# @LINE]]| 1|
+comment// CHECK-NEXT:  [[# @LINE]]|  |
+*/ // CHECK-NEXT:  [[# @LINE]]|  |
+/* // CHECK-NEXT:  [[# @LINE]]|  |
+comment// CHECK-NEXT:  [[# @LINE]]|  |
+*/y;   // CHECK-NEXT:  [[# @LINE]]| 1|
+

[PATCH] D84316: [analyzer][NFC] Split CStringChecker to modeling and reporting

2020-07-22 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

Shared accessors look amazing.

If i understood correctly, you're splitting up the part which performs boring 
bookkeeping for the state trait from the part which models `strlen()` and other 
various functions. Such separation also looks amazing because ultimately the 
first part can be made checker-inspecific (i.e., a reusable half-baked trait 
that can be instantiated multiple times to track various things regardless of 
their meaning).

I don't think i understand having `unix.cstring.CStringChecker` as one more 
entry in `Checkers.td`. Do you expect there to be a situation when enabling 
`CStringModeling` without `CStringChecker` actually makes sense? If not, why 
not keep them agglutinated? That doesn't anyhow contradict the above purpose of 
having boring bookkeeping separate from actual API modeling.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84316



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


[PATCH] D83004: [UpdateCCTestChecks] Include generated functions if asked

2020-07-22 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

Due to D82995  I realized we should have a 
test of this in `llvm/test/tools/UpdateTestChecks` as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83004



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


[PATCH] D84364: [CUDA][HIP] Defer all diagnostics for host device functions

2020-07-22 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

In D84364#2168036 , @tra wrote:

> E.g.
>
>   __host__ __device__ static void hd() {
>  no_such_type_t t;
>   }
>
>
> We obviously can never compile this function on either side of the 
> compilation and clang currently does diagnose it on both sides.
>  However, if all diagnostics in HD functions are postponed until codegen, 
> this error will go unreported.


I am not certain but I could imagine a scenario in which problematic code would 
trigger visible changes to the program behavior w/o an error ever being 
emitted. That seems really undesirable.


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

https://reviews.llvm.org/D84364



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


[PATCH] D84048: DR2303: Prefer 'nearer' base classes during template deduction.

2020-07-22 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments.



Comment at: clang/lib/Sema/SemaTemplateDeduction.cpp:1281
+ "Base class that isn't a record?");
+  ToVisit.push_back(Base.getType()->getAs());
+}

erichkeane wrote:
> rsmith wrote:
> > It would be better to add the class to `Visited` here rather than in the 
> > loop below -- that is, only add each class to `ToVisit` once rather than 
> > only processing each class once. That would put a tighter upper bound on 
> > the size of `ToVisit`.
> I'm perhaps missing something here... Can you clarify your suggestion a bit 
> more?  If we add it to 'Visited' here, it will never get visited in the 
> while-loop below, right?  
The idea would be to remove the `Visited` check in the loops below. We would 
guarantee that each class is only visited once by only adding it to `ToVisit` 
once. (As an example, we do the same thing for `Queue` and `Visited` here: 
https://github.com/llvm/llvm-project/blob/master/clang/lib/Sema/SemaLookup.cpp#L1992)


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

https://reviews.llvm.org/D84048



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


[PATCH] D79719: [AIX] Implement AIX special alignment rule about double/long double

2020-07-22 Thread Xiangling Liao via Phabricator via cfe-commits
Xiangling_L updated this revision to Diff 279991.
Xiangling_L added a comment.

- Simplified the test command line;
- Split the `typedef` related tests into two to address the LIT testcase 
failure on windows platform;


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

https://reviews.llvm.org/D79719

Files:
  clang/include/clang/AST/RecordLayout.h
  clang/include/clang/Basic/TargetInfo.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/RecordLayout.cpp
  clang/lib/AST/RecordLayoutBuilder.cpp
  clang/lib/Basic/Targets/OSTargets.h
  clang/lib/Basic/Targets/PPC.h
  clang/test/Layout/aix-Wpacked-expecting-diagnostics.cpp
  clang/test/Layout/aix-Wpacked-no-diagnostics.cpp
  clang/test/Layout/aix-double-struct-member.cpp
  clang/test/Layout/aix-no-unique-address-with-double.cpp
  clang/test/Layout/aix-pack-attr-on-base.cpp
  clang/test/Layout/aix-power-alignment-typedef-2.cpp
  clang/test/Layout/aix-power-alignment-typedef.cpp
  clang/test/Layout/aix-virtual-function-and-base-with-double.cpp

Index: clang/test/Layout/aix-virtual-function-and-base-with-double.cpp
===
--- /dev/null
+++ clang/test/Layout/aix-virtual-function-and-base-with-double.cpp
@@ -0,0 +1,112 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -fdump-record-layouts \
+// RUN: -fsyntax-only %s | \
+// RUN:   FileCheck --check-prefixes=CHECK,CHECK32 %s
+
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -fdump-record-layouts \
+// RUN: -fsyntax-only %s | \
+// RUN:   FileCheck --check-prefixes=CHECK,CHECK64 %s
+
+namespace test1 {
+struct A {
+  double d1;
+  virtual void boo() {}
+};
+
+struct B {
+  double d2;
+  A a;
+};
+
+struct C : public A {
+  double d3;
+};
+
+int i = sizeof(B);
+int j = sizeof(C);
+
+// CHECK:  *** Dumping AST Record Layout
+// CHECK-NEXT:0 | struct test1::A
+// CHECK-NEXT:0 |   (A vtable pointer)
+// CHECK32-NEXT:  4 |   double d1
+// CHECK32-NEXT:| [sizeof=12, dsize=12, align=4, preferredalign=4,
+// CHECK32-NEXT:|  nvsize=12, nvalign=4, preferrednvalign=4]
+// CHECK64-NEXT:  8 |   double d1
+// CHECK64-NEXT:| [sizeof=16, dsize=16, align=8, preferredalign=8,
+// CHECK64-NEXT:|  nvsize=16, nvalign=8, preferrednvalign=8]
+
+// CHECK:  *** Dumping AST Record Layout
+// CHECK-NEXT:0 | struct test1::B
+// CHECK-NEXT:0 |   double d2
+// CHECK-NEXT:8 |   struct test1::A a
+// CHECK-NEXT:8 | (A vtable pointer)
+// CHECK32-NEXT: 12 | double d1
+// CHECK32-NEXT:| [sizeof=24, dsize=20, align=4, preferredalign=8,
+// CHECK32-NEXT:|  nvsize=20, nvalign=4, preferrednvalign=8]
+// CHECK64-NEXT: 16 | double d1
+// CHECK64-NEXT:| [sizeof=24, dsize=24, align=8, preferredalign=8,
+// CHECK64-NEXT:|  nvsize=24, nvalign=8, preferrednvalign=8]
+
+// CHECK:  *** Dumping AST Record Layout
+// CHECK-NEXT:0 | struct test1::C
+// CHECK-NEXT:0 |   struct test1::A (primary base)
+// CHECK-NEXT:0 | (A vtable pointer)
+// CHECK32-NEXT:  4 | double d1
+// CHECK32-NEXT: 12 |   double d3
+// CHECK32-NEXT:| [sizeof=20, dsize=20, align=4, preferredalign=4,
+// CHECK32-NEXT:|  nvsize=20, nvalign=4, preferrednvalign=4]
+// CHECK64-NEXT:  8 | double d1
+// CHECK64-NEXT: 16 |   double d3
+// CHECK64-NEXT:| [sizeof=24, dsize=24, align=8, preferredalign=8,
+// CHECK64-NEXT:|  nvsize=24, nvalign=8, preferrednvalign=8]
+
+} // namespace test1
+
+namespace test2 {
+struct A {
+  long long l1;
+};
+
+struct B : public virtual A {
+  double d2;
+};
+
+#pragma pack(2)
+struct C : public virtual A {
+  double __attribute__((aligned(4))) d3;
+};
+
+int i = sizeof(B);
+int j = sizeof(C);
+
+// CHECK:  *** Dumping AST Record Layout
+// CHECK-NEXT:0 | struct test2::A
+// CHECK-NEXT:0 |   long long l1
+// CHECK-NEXT:  | [sizeof=8, dsize=8, align=8, preferredalign=8,
+// CHECK-NEXT:  |  nvsize=8, nvalign=8, preferrednvalign=8]
+
+// CHECK:  *** Dumping AST Record Layout
+// CHECK-NEXT:0 | struct test2::B
+// CHECK-NEXT:0 |   (B vtable pointer)
+// CHECK32-NEXT:  4 |   double d2
+// CHECK64-NEXT:  8 |   double d2
+// CHECK-NEXT:   16 |   struct test2::A (virtual base)
+// CHECK-NEXT:   16 | long long l1
+// CHECK-NEXT:  | [sizeof=24, dsize=24, align=8, preferredalign=8,
+// CHECK32-NEXT:|  nvsize=12, nvalign=4, preferrednvalign=4]
+// CHECK64-NEXT:|  nvsize=16, nvalign=8, preferrednvalign=8]
+
+// CHECK:  *** Dumping AST Record Layout
+// CHECK-NEXT:0 | struct test2::C
+// CHECK-NEXT:0 |   (C vtable pointer)
+// CHECK32-NEXT:  4 |   double d3
+// 

[PATCH] D84375: [git-clang-format] Add --diffstat parameter

2020-07-22 Thread Roland via Phabricator via cfe-commits
roligugus added a project: clang-format.
roligugus marked an inline comment as done.
roligugus added inline comments.



Comment at: clang/tools/clang-format/git-clang-format:101
  help='print a diff instead of applying the changes')
+  p.add_argument('--diffstat', action='store_true',
+ help='print a diffstat instead of applying the changes')

As mentioned in the description, an alternative would be to add a `--stat` 
parameter and hand that to `print_diff(`). E.g. user would call it then with 
`git-clang-format --diff --stat`.

Would result in less code duplication of `print_diff()` vs `print_diffstat()`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84375



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


[PATCH] D79279: Add overloaded versions of builtin mem* functions

2020-07-22 Thread JF Bastien via Phabricator via cfe-commits
jfb added inline comments.



Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:8917
+
+def err_atomic_type_must_be_lock_free : Error<"_Atomic type must always be 
lock-free, %0 isn't">;
+

rjmccall wrote:
> I don't know why you're adding a bunch of new diagnostics about _Atomic.
Maybe the tests clarify this? Here's my rationale for the 3 new atomic 
diagnostics:

* Don't support mixing `volatile` and `atomic`, because we'd need to add IR 
support for it. It might be useful, but as a follow-up.
* Overloaded `memcpy` figures out the atomic operation size based on the 
element's own size. There's a destination and a source pointer, and we can't 
figure out the expected atomic operation size if they differ. It's likely an 
unintentional error to have different sizes when doing an atomic `memcpy`, so 
instead of figuring out the largest common matching size I figure it's better 
to diagnose.
* Supporting non-lock-free sizes seems fraught with peril, since it's likely 
unintentional. It's certainly doable (loop call the runtime support), but it's 
unclear if we should take the lock just once over the entire loop, or once for 
load+store, or once for load and once for store. I don't see a point in 
supporting it.



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:636
+  return ArgTy->castAs()->getPointeeType();
+}
+

rjmccall wrote:
> Since arrays are handled separately now, this is just `getPointeeType()`, but 
> I don't know why you need to support ObjC object pointer types here at all.
I'll remove ObjC handling for now, I added it because of code like what's in:
clang/test/CodeGenObjC/builtin-memfns.m
```
// PR13697
void cpy1(int *a, id b) {
  // CHECK-LABEL: @cpy1(
  // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* {{.*}}, i8* {{.*}}, i64 8, 
i1 false)
  memcpy(a, b, 8);
}
```
Should we support this? It seems to me like yes, but you seem to think 
otherwise?

On arrays / ObjC being handled now: that's not really true... or rather, it now 
is for the builtins I'm adding, but not for the previously existing builtins. 
We can't just get the pointer argument type for this code:
```
// 
// Make sure we don't over-estimate the alignment of fields of
// packed structs.
struct PS {
  int modes[4];
} __attribute__((packed));
struct PS ps;
void test8(int *arg) {
  // CHECK: @test8
  // CHECK: call void @llvm.memcpy{{.*}} align 4 {{.*}} align 1 {{.*}} 16, i1 
false)
  __builtin_memcpy(arg, ps.modes, sizeof(struct PS));
}
```

Because `__builtin_memcpy` doesn't perform the conversion. Arguable a 
pre-existing bug, which I can patch here as I have, or fix in Sema if you'd 
rather see that? LMK.



Comment at: clang/lib/Sema/SemaChecking.cpp:5468
+  bool isAtomic = (DstTy && DstValTy->isAtomicType()) ||
+  (SrcTy && SrcValTy->isAtomicType());
+

rjmccall wrote:
> You already know that DstTy and SrcTy are non-null here.
> 
> Why do you need to support atomic types for these operations anyway?  It just 
> seems treacherous and unnecessary.
Leftover from the refactoring :)

It's useful to get atomic memcpy, see https://wg21.link/P1478
It's also part of "support overloaded memcpy" which is what doing more than 
`volatile` implies.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79279



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


[PATCH] D79279: Add overloaded versions of builtin mem* functions

2020-07-22 Thread JF Bastien via Phabricator via cfe-commits
jfb updated this revision to Diff 279984.
jfb marked 7 inline comments as done.
jfb added a comment.

Address all but one of John's comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79279

Files:
  clang/docs/LanguageExtensions.rst
  clang/include/clang/Basic/Builtins.def
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/CodeGen/CGBuilder.h
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/builtin-overloaded-memfns.c
  clang/test/CodeGenObjC/builtin-memfns.m
  clang/test/Sema/builtin-overloaded-memfns.cpp
  clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl
  clang/test/SemaOpenCL/to_addr_builtin.cl

Index: clang/test/SemaOpenCL/to_addr_builtin.cl
===
--- clang/test/SemaOpenCL/to_addr_builtin.cl
+++ clang/test/SemaOpenCL/to_addr_builtin.cl
@@ -15,7 +15,7 @@
   // expected-error@-2{{implicit declaration of function 'to_global' is invalid in OpenCL}}
   // expected-warning@-3{{incompatible integer to pointer conversion assigning to '__global int *__private' from 'int'}}
 #else
-  // expected-error@-5{{invalid number of arguments to function: 'to_global'}}
+  // expected-error@-5{{too many arguments to function call, expected 1, have 2}}
 #endif
 
   int x;
Index: clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl
===
--- clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl
+++ clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl
@@ -10,7 +10,7 @@
   read_pipe(p, );
   read_pipe(p, ptr);
   read_pipe(tmp, p);// expected-error {{first argument to 'read_pipe' must be a pipe type}}
-  read_pipe(p);   // expected-error {{invalid number of arguments to function: 'read_pipe'}}
+  read_pipe(p); // expected-error {{invalid number of arguments to function: 'read_pipe'}}
   read_pipe(p, rid, tmp, ptr);
   read_pipe(p, tmp, tmp, ptr);   // expected-error {{invalid argument type to function 'read_pipe' (expecting 'reserve_id_t' having '__private int')}}
   read_pipe(p, rid, rid, ptr);   // expected-error {{invalid argument type to function 'read_pipe' (expecting 'unsigned int' having '__private reserve_id_t')}}
@@ -39,7 +39,7 @@
   write_pipe(p, );
   write_pipe(p, ptr);
   write_pipe(tmp, p);// expected-error {{first argument to 'write_pipe' must be a pipe type}}
-  write_pipe(p);   // expected-error {{invalid number of arguments to function: 'write_pipe'}}
+  write_pipe(p); // expected-error {{invalid number of arguments to function: 'write_pipe'}}
   write_pipe(p, rid, tmp, ptr);
   write_pipe(p, tmp, tmp, ptr);   // expected-error {{invalid argument type to function 'write_pipe' (expecting 'reserve_id_t' having '__private int')}}
   write_pipe(p, rid, rid, ptr);   // expected-error {{invalid argument type to function 'write_pipe' (expecting 'unsigned int' having '__private reserve_id_t')}}
Index: clang/test/Sema/builtin-overloaded-memfns.cpp
===
--- /dev/null
+++ clang/test/Sema/builtin-overloaded-memfns.cpp
@@ -0,0 +1,222 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only -triple=arm64-unknown-unknown -fms-extensions -DCPY=1
+// RUN: %clang_cc1 %s -verify -fsyntax-only -triple=arm64-unknown-unknown -fms-extensions -DCPY=0
+
+// Test memcpy and memmove with the same code, since they're basically the same constraints.
+#if CPY
+#define MEM(...) __builtin_memcpy_overloaded(__VA_ARGS__)
+#else
+#define MEM(...) __builtin_memmove_overloaded(__VA_ARGS__)
+#endif
+
+#define NULL (void *)0
+#define nullptr __nullptr
+using size_t = __SIZE_TYPE__;
+using sizeless_t = __SVInt8_t;
+using float4 = float __attribute__((ext_vector_type(4)));
+struct Intish {
+  int i;
+};
+struct NotLockFree {
+  char buf[512];
+};
+struct TrivialCpy {
+  char buf[8];
+  TrivialCpy();
+  TrivialCpy(const TrivialCpy &) = default;
+};
+struct NotTrivialCpy {
+  char buf[8];
+  NotTrivialCpy();
+  NotTrivialCpy(const NotTrivialCpy &);
+};
+
+void arg_count() {
+  MEM();   // expected-error {{too few arguments to function call, expected 3, have 0}}
+  MEM(0);  // expected-error {{too few arguments to function call, expected 3, have 1}}
+  MEM(0, 0);   // expected-error {{too few arguments to function call, expected 3, have 2}}
+  MEM(0, 0, 0, 0); // expected-error {{too many arguments to function call, expected 3, have 4}}
+  __builtin_memset_overloaded();   // expected-error {{too few arguments to function call, expected 3, have 0}}
+  __builtin_memset_overloaded(0);  // expected-error {{too few arguments to function call, expected 3, have 1}}
+  __builtin_memset_overloaded(0, 0);   // expected-error 

[PATCH] D80858: [CUDA][HIP] Support accessing static device variable in host code

2020-07-22 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment.

ping


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

https://reviews.llvm.org/D80858



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


[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-22 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs marked 2 inline comments as done.
dokyungs added inline comments.



Comment at: compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp:86
+s2++;
+  }
+  return 0;

morehouse wrote:
> Lot's of common code with `internal_strncmp`.  Let's factor it out into a 
> helper function.
Factored it out into a new function: `internal_strcmp_strncmp`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83494



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


[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-22 Thread Matt Morehouse via Phabricator via cfe-commits
morehouse accepted this revision.
morehouse added a comment.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83494



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


[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-22 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs updated this revision to Diff 279982.
dokyungs added a comment.

Introduced a helper function to reduce duplicated code.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83494

Files:
  clang/include/clang/Driver/SanitizerArgs.h
  clang/lib/Driver/SanitizerArgs.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  compiler-rt/lib/fuzzer/CMakeLists.txt
  compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp
  compiler-rt/test/fuzzer/CustomAllocator.cpp
  compiler-rt/test/fuzzer/custom-allocator.test
  compiler-rt/test/fuzzer/memcmp.test
  compiler-rt/test/fuzzer/memcmp64.test
  compiler-rt/test/fuzzer/strcmp.test
  compiler-rt/test/fuzzer/strncmp.test
  compiler-rt/test/fuzzer/strstr.test

Index: compiler-rt/test/fuzzer/strstr.test
===
--- compiler-rt/test/fuzzer/strstr.test
+++ compiler-rt/test/fuzzer/strstr.test
@@ -1,5 +1,11 @@
 UNSUPPORTED: freebsd
 RUN: %cpp_compiler %S/StrstrTest.cpp -o %t-StrstrTest
 RUN: not %run %t-StrstrTest   -seed=1 -runs=200   2>&1 | FileCheck %s
-CHECK: BINGO
 
+RUN: %cpp_compiler -fno-sanitize=address -fno-builtin-strstr %S/StrstrTest.cpp -o %t-NoAsanStrstrTest
+RUN: not %run %t-NoAsanStrstrTest -seed=1 -runs=200   2>&1 | FileCheck %s
+
+RUN: %cpp_compiler -fno-sanitize=address -fno-builtin-calloc -fno-builtin-strstr %S/CustomAllocator.cpp %S/StrstrTest.cpp -o %t-NoAsanCustomAllocatorStrstrTest
+RUN: not %run %t-NoAsanCustomAllocatorStrstrTest -seed=1 -runs=200   2>&1 | FileCheck %s
+
+CHECK: BINGO
Index: compiler-rt/test/fuzzer/strncmp.test
===
--- compiler-rt/test/fuzzer/strncmp.test
+++ compiler-rt/test/fuzzer/strncmp.test
@@ -1,5 +1,11 @@
 UNSUPPORTED: freebsd
 RUN: %cpp_compiler %S/StrncmpTest.cpp -o %t-StrncmpTest
 RUN: not %run %t-StrncmpTest  -seed=2 -runs=1000   2>&1 | FileCheck %s
-CHECK: BINGO
 
+RUN: %cpp_compiler -fno-sanitize=address -fno-builtin-strncmp %S/StrncmpTest.cpp -o %t-NoAsanStrncmpTest
+RUN: not %run %t-NoAsanStrncmpTest-seed=2 -runs=1000   2>&1 | FileCheck %s
+
+RUN: %cpp_compiler -fno-sanitize=address -fno-builtin-calloc -fno-builtin-strncmp %S/CustomAllocator.cpp %S/StrncmpTest.cpp -o %t-NoAsanCustomAllocatorStrncmpTest
+RUN: not %run %t-NoAsanCustomAllocatorStrncmpTest -seed=2 -runs=1000   2>&1 | FileCheck %s
+
+CHECK: BINGO
Index: compiler-rt/test/fuzzer/strcmp.test
===
--- compiler-rt/test/fuzzer/strcmp.test
+++ compiler-rt/test/fuzzer/strcmp.test
@@ -1,5 +1,11 @@
 UNSUPPORTED: freebsd
 RUN: %cpp_compiler %S/StrcmpTest.cpp -o %t-StrcmpTest
 RUN: not %run %t-StrcmpTest   -seed=1 -runs=200   2>&1 | FileCheck %s
-CHECK: BINGO
 
+RUN: %cpp_compiler -fno-sanitize=address -fno-builtin-strcmp %S/StrcmpTest.cpp -o %t-NoAsanStrcmpTest
+RUN: not %run %t-NoAsanStrcmpTest -seed=1 -runs=200   2>&1 | FileCheck %s
+
+RUN: %cpp_compiler -fno-sanitize=address -fno-builtin-calloc -fno-builtin-strcmp %S/CustomAllocator.cpp %S/StrcmpTest.cpp -o %t-NoAsanCustomAllocatorStrcmpTest
+RUN: not %run %t-NoAsanCustomAllocatorStrcmpTest -seed=1 -runs=200   2>&1 | FileCheck %s
+
+CHECK: BINGO
Index: compiler-rt/test/fuzzer/memcmp64.test
===
--- compiler-rt/test/fuzzer/memcmp64.test
+++ compiler-rt/test/fuzzer/memcmp64.test
@@ -1,4 +1,8 @@
 UNSUPPORTED: freebsd
 RUN: %cpp_compiler %S/Memcmp64BytesTest.cpp -o %t-Memcmp64BytesTest
 RUN: not %run %t-Memcmp64BytesTest-seed=1 -runs=100   2>&1 | FileCheck %s
+
+RUN: %cpp_compiler -fno-sanitize=address -fno-builtin-memcmp %S/Memcmp64BytesTest.cpp -o %t-NoAsanMemcmp64BytesTest
+RUN: not %run %t-NoAsanMemcmp64BytesTest  -seed=1 -runs=100   2>&1 | FileCheck %s
+
 CHECK: BINGO
Index: compiler-rt/test/fuzzer/memcmp.test
===
--- compiler-rt/test/fuzzer/memcmp.test
+++ compiler-rt/test/fuzzer/memcmp.test
@@ -1,4 +1,11 @@
 UNSUPPORTED: freebsd
 RUN: %cpp_compiler %S/MemcmpTest.cpp -o %t-MemcmpTest
 RUN: not %run %t-MemcmpTest   -seed=1 -runs=1000   2>&1 | FileCheck %s
+
+RUN: %cpp_compiler -fno-sanitize=address -fno-builtin-memcmp %S/MemcmpTest.cpp -o %t-NoAsanMemcmpTest
+RUN: not %run %t-NoAsanMemcmpTest -seed=1 -runs=1000   2>&1 | FileCheck %s
+
+RUN: %cpp_compiler -fno-sanitize=address -fno-builtin-calloc -fno-builtin-memcmp %S/CustomAllocator.cpp %S/MemcmpTest.cpp -o %t-NoAsanCustomAllocatorMemcmpTest
+RUN: not %run %t-NoAsanCustomAllocatorMemcmpTest -seed=1 -runs=1000   2>&1 | FileCheck %s
+
 CHECK: BINGO
Index: compiler-rt/test/fuzzer/custom-allocator.test
===
--- /dev/null
+++ compiler-rt/test/fuzzer/custom-allocator.test
@@ -0,0 +1,9 

[PATCH] D84375: [git-clang-format] Add --diffstat parameter

2020-07-22 Thread Roland via Phabricator via cfe-commits
roligugus created this revision.
roligugus added reviewers: klimek, aheejin.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

[git-clang-format][PR46815] Add diffstat functionality

Adding a --diffstat parameter to git-clang-format that essentially uses git 
diff --stat, i.e. lists the files needing
formatting. This is useful for CI integration or manual usage where one wants 
to list the files not properly formatted.

I use it for the Suricata project's github action (CI) integration that 
verifies proper formatting of a pull request 
according to project guidelines where it's very helpful to say which files are 
not properly formatted. I find the list
of files much more useful than e.g. showing the diff in this case using 
git-clang-format --diff.

An alternative would be to take an additional parameter to diff, e.g. 
git-clang-format --diff --stat

The goal is not to provide the whole git diff --stat=... parameter 
functionality, just plain git diff --stat.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84375

Files:
  clang/tools/clang-format/git-clang-format


Index: clang/tools/clang-format/git-clang-format
===
--- clang/tools/clang-format/git-clang-format
+++ clang/tools/clang-format/git-clang-format
@@ -98,6 +98,8 @@
  help='default commit to use if none is specified'),
   p.add_argument('--diff', action='store_true',
  help='print a diff instead of applying the changes')
+  p.add_argument('--diffstat', action='store_true',
+ help='print a diffstat instead of applying the changes')
   p.add_argument('--extensions',
  default=config.get('clangformat.extensions',
 default_extensions),
@@ -172,6 +174,8 @@
   print('clang-format did not modify any files')
   elif opts.diff:
 print_diff(old_tree, new_tree)
+  elif opts.diffstat:
+print_diffstat(old_tree, new_tree)
   else:
 changed_files = apply_changes(old_tree, new_tree, force=opts.force,
   patch_mode=opts.patch)
@@ -494,6 +498,17 @@
   subprocess.check_call(['git', 'diff', '--diff-filter=M', old_tree, new_tree,
  '--'])
 
+def print_diffstat(old_tree, new_tree):
+  """Print the diffstat between the two trees to stdout."""
+  # We use the porcelain 'diff' and not plumbing 'diff-tree' because the output
+  # is expected to be viewed by the user, and only the former does nice things
+  # like color and pagination.
+  #
+  # We also only print modified files since `new_tree` only contains the files
+  # that were modified, so unmodified files would show as deleted without the
+  # filter.
+  subprocess.check_call(['git', 'diff', '--diff-filter=M', '--stat', old_tree, 
new_tree,
+ '--'])
 
 def apply_changes(old_tree, new_tree, force=False, patch_mode=False):
   """Apply the changes in `new_tree` to the working directory.


Index: clang/tools/clang-format/git-clang-format
===
--- clang/tools/clang-format/git-clang-format
+++ clang/tools/clang-format/git-clang-format
@@ -98,6 +98,8 @@
  help='default commit to use if none is specified'),
   p.add_argument('--diff', action='store_true',
  help='print a diff instead of applying the changes')
+  p.add_argument('--diffstat', action='store_true',
+ help='print a diffstat instead of applying the changes')
   p.add_argument('--extensions',
  default=config.get('clangformat.extensions',
 default_extensions),
@@ -172,6 +174,8 @@
   print('clang-format did not modify any files')
   elif opts.diff:
 print_diff(old_tree, new_tree)
+  elif opts.diffstat:
+print_diffstat(old_tree, new_tree)
   else:
 changed_files = apply_changes(old_tree, new_tree, force=opts.force,
   patch_mode=opts.patch)
@@ -494,6 +498,17 @@
   subprocess.check_call(['git', 'diff', '--diff-filter=M', old_tree, new_tree,
  '--'])
 
+def print_diffstat(old_tree, new_tree):
+  """Print the diffstat between the two trees to stdout."""
+  # We use the porcelain 'diff' and not plumbing 'diff-tree' because the output
+  # is expected to be viewed by the user, and only the former does nice things
+  # like color and pagination.
+  #
+  # We also only print modified files since `new_tree` only contains the files
+  # that were modified, so unmodified files would show as deleted without the
+  # filter.
+  subprocess.check_call(['git', 'diff', '--diff-filter=M', '--stat', old_tree, new_tree,
+ '--'])
 
 def apply_changes(old_tree, new_tree, force=False, patch_mode=False):
   """Apply the changes in `new_tree` to the working directory.
___
cfe-commits mailing 

[PATCH] D83004: [UpdateCCTestChecks] Include generated functions if asked

2020-07-22 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert accepted this revision.
jdoerfert added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks for the generalization. We'll add update_test support next for the 
opt case, e.g., for D83635 .




Comment at: llvm/utils/update_cc_test_checks.py:331
+# are ordered by prefix instead of by function as in "normal"
+# mode.
+if '-emit-llvm' in clang_args:

This is all unfortunate but at least for OpenMP not easily changeable. Let's go 
with this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83004



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


[PATCH] D84048: DR2303: Prefer 'nearer' base classes during template deduction.

2020-07-22 Thread Erich Keane via Phabricator via cfe-commits
erichkeane marked 5 inline comments as done.
erichkeane added a comment.

Thanks for the review!  I'll get this updated in the morning.  I DO have a 
question on your suggestion for the ToVisit/Visited example, so if you could 
explain a little better, I'd be grateful.




Comment at: clang/lib/Sema/SemaTemplateDeduction.cpp:1281
+ "Base class that isn't a record?");
+  ToVisit.push_back(Base.getType()->getAs());
+}

rsmith wrote:
> It would be better to add the class to `Visited` here rather than in the loop 
> below -- that is, only add each class to `ToVisit` once rather than only 
> processing each class once. That would put a tighter upper bound on the size 
> of `ToVisit`.
I'm perhaps missing something here... Can you clarify your suggestion a bit 
more?  If we add it to 'Visited' here, it will never get visited in the 
while-loop below, right?  



Comment at: clang/lib/Sema/SemaTemplateDeduction.cpp:1329-1331
+  Sema::TemplateDeductionResult BaseResult = DeduceTemplateArguments(
+  S, TemplateParams, SpecParam, QualType(NextT, 0), CurMatch.BaseInfo,
+  CurMatch.Deduction);

rsmith wrote:
> This deduction step seems unnecessary to me (whether deduction succeeds or 
> not here has no impact on the result of the algorithm).
> 
> Instead, you could perform the `erase_if` call below unconditionally. In 
> order for that to be efficient, it'd make sense to also convert `Matches` 
> into a hash map from (canonical) `CXXRecordDecl*` to `BaseMatch`.
Ah, yes, thats a really good observation!  I'll do that.



Comment at: clang/lib/Sema/SemaTemplateDeduction.cpp:1351-1353
+  Info.Param = Matches[0].BaseInfo.Param;
+  Info.FirstArg = Matches[0].BaseInfo.FirstArg;
+  Info.SecondArg = Matches[0].BaseInfo.SecondArg;

rsmith wrote:
> These fields are used to determine how to diagnose a deduction failure, and 
> don't mean anything if deduction succeeds. I think this (and the tracking of 
> `BaseInfo` above) is all dead code (and the corresponding code was similarly 
> dead prior to this change).
I see, so all tracking of BaseInfo isn't useful?  That will simplify the code 
quite a bit then, since BaseInfo accounts for nearly all the code in BaseMatch 
(both the move operations, and the constructor only exist because of it).  
BaseMatch becomes essentially a pair otherwise. I think I can actually remove 
BaseMatch entirely as a result, and change the Matches to a map from 
RecordType* to the SmallVector of Deduction state.



Comment at: clang/test/CXX/drs/dr23xx.cpp:118
+#if __cplusplus >= 201103L
+namespace dr2303 {
+template 

rsmith wrote:
> erichkeane wrote:
> > rsmith wrote:
> > > This should include a comment that `make_cxx_dr_status` can parse, such 
> > > as `// dr2303: 11` to indicate support in Clang 11 onwards.
> > Our current clang-version is 12.0.0, so 12 is correct here, right?
> > 
> > I've not been able to get make_cxx_dr_status work unfortunately. It seems 
> > to generate a blank version of the file (well, it HAS html, but none of the 
> > content).
> > 
> > I used the cwg_index.html from here: 
> > http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_index.html
> > 
> > 
> Oh, right, version 11 already forked. How time flies =) Yes, 12 is correct.
> 
> The current list is built from revision 101m of the core issues list. You'll 
> need to grab that from the WG21 wiki; there hasn't been a public release of 
> the core issues list in over 2 years.  (Though it looks like you got this 
> working anyway?)
Yep, I figured that out with help from @aaron.ballman on IRC :)  I downloaded 
101m from the wiki.



Comment at: clang/www/cxx_dr_status.html:1507
 Destructor lookup
-Clang 11
+Clang 11
   

rsmith wrote:
> Please commit the update from "unreleased" to "full" for Clang 11 changes 
> separately.
Will do!  I'll do that as review-after-commit, then rebase this on top of it.  
Thanks!


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

https://reviews.llvm.org/D84048



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


[PATCH] D83592: [Coverage] Add comment to skipped regions

2020-07-22 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu added a comment.

I found the problem is that I was trying to merge two skipped regions when they 
are adjacent.
So, the following code will fail at assertion, because the skipped regions are 
in different files, but are merged.

  $ cat a.h
  // comment
  $ cat a.c
  #include "a.h"
  // comment
  int main() {}


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

https://reviews.llvm.org/D83592



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


[PATCH] D84048: DR2303: Prefer 'nearer' base classes during template deduction.

2020-07-22 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments.



Comment at: clang/lib/Sema/SemaTemplateDeduction.cpp:1204-1205
 
+// Attempt to deduce the template arguments by checking the base types 
according
+// to (C++ [temp.deduct.call] p4b3.
+///

Missing `///`



Comment at: clang/lib/Sema/SemaTemplateDeduction.cpp:1281
+ "Base class that isn't a record?");
+  ToVisit.push_back(Base.getType()->getAs());
+}

It would be better to add the class to `Visited` here rather than in the loop 
below -- that is, only add each class to `ToVisit` once rather than only 
processing each class once. That would put a tighter upper bound on the size of 
`ToVisit`.



Comment at: clang/lib/Sema/SemaTemplateDeduction.cpp:1329-1331
+  Sema::TemplateDeductionResult BaseResult = DeduceTemplateArguments(
+  S, TemplateParams, SpecParam, QualType(NextT, 0), CurMatch.BaseInfo,
+  CurMatch.Deduction);

This deduction step seems unnecessary to me (whether deduction succeeds or not 
here has no impact on the result of the algorithm).

Instead, you could perform the `erase_if` call below unconditionally. In order 
for that to be efficient, it'd make sense to also convert `Matches` into a hash 
map from (canonical) `CXXRecordDecl*` to `BaseMatch`.



Comment at: clang/lib/Sema/SemaTemplateDeduction.cpp:1333
+
+  // If this iS a match, it isn't valid due to CWG2303. So, remove it
+  // from the possible matches.

Typo "iS".



Comment at: clang/lib/Sema/SemaTemplateDeduction.cpp:1351-1353
+  Info.Param = Matches[0].BaseInfo.Param;
+  Info.FirstArg = Matches[0].BaseInfo.FirstArg;
+  Info.SecondArg = Matches[0].BaseInfo.SecondArg;

These fields are used to determine how to diagnose a deduction failure, and 
don't mean anything if deduction succeeds. I think this (and the tracking of 
`BaseInfo` above) is all dead code (and the corresponding code was similarly 
dead prior to this change).



Comment at: clang/test/CXX/drs/dr23xx.cpp:118
+#if __cplusplus >= 201103L
+namespace dr2303 {
+template 

erichkeane wrote:
> rsmith wrote:
> > This should include a comment that `make_cxx_dr_status` can parse, such as 
> > `// dr2303: 11` to indicate support in Clang 11 onwards.
> Our current clang-version is 12.0.0, so 12 is correct here, right?
> 
> I've not been able to get make_cxx_dr_status work unfortunately. It seems to 
> generate a blank version of the file (well, it HAS html, but none of the 
> content).
> 
> I used the cwg_index.html from here: 
> http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_index.html
> 
> 
Oh, right, version 11 already forked. How time flies =) Yes, 12 is correct.

The current list is built from revision 101m of the core issues list. You'll 
need to grab that from the WG21 wiki; there hasn't been a public release of the 
core issues list in over 2 years.  (Though it looks like you got this working 
anyway?)



Comment at: clang/www/cxx_dr_status.html:1507
 Destructor lookup
-Clang 11
+Clang 11
   

Please commit the update from "unreleased" to "full" for Clang 11 changes 
separately.


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

https://reviews.llvm.org/D84048



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


[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-22 Thread Matt Morehouse via Phabricator via cfe-commits
morehouse added inline comments.



Comment at: compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp:86
+s2++;
+  }
+  return 0;

Lot's of common code with `internal_strncmp`.  Let's factor it out into a 
helper function.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83494



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


LLVM buildmaster will be updated and restarted tonight

2020-07-22 Thread Galina Kistanova via cfe-commits
Hello everyone,

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

Thanks

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


[clang] 5f11027 - [PowerPC][Power10] Fix vins*vlx instructions to have i32 arguments.

2020-07-22 Thread Amy Kwan via cfe-commits

Author: Amy Kwan
Date: 2020-07-22T17:58:14-05:00
New Revision: 5f110273954ac152c9690b6cdf2a2e46f8908f0a

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

LOG: [PowerPC][Power10] Fix vins*vlx instructions to have i32 arguments.

Previously, the vins*vlx instructions were incorrectly defined with i64 as the
second argument. This patches fixes this issue by correcting the second argument
of the vins*vlx instructions/intrinsics to be i32.

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

Added: 


Modified: 
clang/include/clang/Basic/BuiltinsPPC.def
clang/test/CodeGen/builtins-ppc-p10vector.c
llvm/include/llvm/IR/IntrinsicsPowerPC.td
llvm/lib/Target/PowerPC/PPCInstrPrefix.td
llvm/test/CodeGen/PowerPC/builtins-ppc-p10permute.ll

Removed: 




diff  --git a/clang/include/clang/Basic/BuiltinsPPC.def 
b/clang/include/clang/Basic/BuiltinsPPC.def
index b74cb8df78ba..5aed03f74f65 100644
--- a/clang/include/clang/Basic/BuiltinsPPC.def
+++ b/clang/include/clang/Basic/BuiltinsPPC.def
@@ -329,12 +329,12 @@ BUILTIN(__builtin_altivec_vinswlx, "V4UiV4UiUiUi", "")
 BUILTIN(__builtin_altivec_vinswrx, "V4UiV4UiUiUi", "")
 BUILTIN(__builtin_altivec_vinsdlx, "V2ULLiV2ULLiULLiULLi", "")
 BUILTIN(__builtin_altivec_vinsdrx, "V2ULLiV2ULLiULLiULLi", "")
-BUILTIN(__builtin_altivec_vinsbvlx, "V16UcV16UcULLiV16Uc", "")
-BUILTIN(__builtin_altivec_vinsbvrx, "V16UcV16UcULLiV16Uc", "")
-BUILTIN(__builtin_altivec_vinshvlx, "V8UsV8UsULLiV8Us", "")
-BUILTIN(__builtin_altivec_vinshvrx, "V8UsV8UsULLiV8Us", "")
-BUILTIN(__builtin_altivec_vinswvlx, "V4UiV4UiULLiV4Ui", "")
-BUILTIN(__builtin_altivec_vinswvrx, "V4UiV4UiULLiV4Ui", "")
+BUILTIN(__builtin_altivec_vinsbvlx, "V16UcV16UcUiV16Uc", "")
+BUILTIN(__builtin_altivec_vinsbvrx, "V16UcV16UcUiV16Uc", "")
+BUILTIN(__builtin_altivec_vinshvlx, "V8UsV8UsUiV8Us", "")
+BUILTIN(__builtin_altivec_vinshvrx, "V8UsV8UsUiV8Us", "")
+BUILTIN(__builtin_altivec_vinswvlx, "V4UiV4UiUiV4Ui", "")
+BUILTIN(__builtin_altivec_vinswvrx, "V4UiV4UiUiV4Ui", "")
 
 // VSX built-ins.
 

diff  --git a/clang/test/CodeGen/builtins-ppc-p10vector.c 
b/clang/test/CodeGen/builtins-ppc-p10vector.c
index 0d084c6eed85..6f38ac77ee24 100644
--- a/clang/test/CodeGen/builtins-ppc-p10vector.c
+++ b/clang/test/CodeGen/builtins-ppc-p10vector.c
@@ -434,25 +434,25 @@ vector unsigned long long test_vec_insertl_ul(void) {
 }
 
 vector unsigned char test_vec_insertl_ucv(void) {
-  // CHECK-BE: @llvm.ppc.altivec.vinsbvlx(<16 x i8> %{{.+}}, i64 %{{.+}}, <16 
x i8>
+  // CHECK-BE: @llvm.ppc.altivec.vinsbvlx(<16 x i8> %{{.+}}, i32 %{{.+}}, <16 
x i8>
   // CHECK-BE-NEXT: ret <16 x i8>
-  // CHECK-LE: @llvm.ppc.altivec.vinsbvrx(<16 x i8> %{{.+}}, i64 %{{.+}}, <16 
x i8>
+  // CHECK-LE: @llvm.ppc.altivec.vinsbvrx(<16 x i8> %{{.+}}, i32 %{{.+}}, <16 
x i8>
   // CHECK-LE-NEXT: ret <16 x i8>
   return vec_insertl(vuca, vucb, uia);
 }
 
 vector unsigned short test_vec_insertl_usv(void) {
-  // CHECK-BE: @llvm.ppc.altivec.vinshvlx(<8 x i16> %{{.+}}, i64 %{{.+}}, <8 x 
i16>
+  // CHECK-BE: @llvm.ppc.altivec.vinshvlx(<8 x i16> %{{.+}}, i32 %{{.+}}, <8 x 
i16>
   // CHECK-BE-NEXT: ret <8 x i16>
-  // CHECK-LE: @llvm.ppc.altivec.vinshvrx(<8 x i16> %{{.+}}, i64 %{{.+}}, <8 x 
i16>
+  // CHECK-LE: @llvm.ppc.altivec.vinshvrx(<8 x i16> %{{.+}}, i32 %{{.+}}, <8 x 
i16>
   // CHECK-LE-NEXT: ret <8 x i16>
   return vec_insertl(vusa, vusb, uia);
 }
 
 vector unsigned int test_vec_insertl_uiv(void) {
-  // CHECK-BE: @llvm.ppc.altivec.vinswvlx(<4 x i32> %{{.+}}, i64 %{{.+}}, <4 x 
i32>
+  // CHECK-BE: @llvm.ppc.altivec.vinswvlx(<4 x i32> %{{.+}}, i32 %{{.+}}, <4 x 
i32>
   // CHECK-BE-NEXT: ret <4 x i32>
-  // CHECK-LE: @llvm.ppc.altivec.vinswvrx(<4 x i32> %{{.+}}, i64 %{{.+}}, <4 x 
i32>
+  // CHECK-LE: @llvm.ppc.altivec.vinswvrx(<4 x i32> %{{.+}}, i32 %{{.+}}, <4 x 
i32>
   // CHECK-LE-NEXT: ret <4 x i32>
   return vec_insertl(vuia, vuib, uia);
 }
@@ -490,25 +490,25 @@ vector unsigned long long test_vec_inserth_ul(void) {
 }
 
 vector unsigned char test_vec_inserth_ucv(void) {
-  // CHECK-BE: @llvm.ppc.altivec.vinsbvrx(<16 x i8> %{{.+}}, i64 %{{.+}}, <16 
x i8>
+  // CHECK-BE: @llvm.ppc.altivec.vinsbvrx(<16 x i8> %{{.+}}, i32 %{{.+}}, <16 
x i8>
   // CHECK-BE-NEXT: ret <16 x i8>
-  // CHECK-LE: @llvm.ppc.altivec.vinsbvlx(<16 x i8> %{{.+}}, i64 %{{.+}}, <16 
x i8>
+  // CHECK-LE: @llvm.ppc.altivec.vinsbvlx(<16 x i8> %{{.+}}, i32 %{{.+}}, <16 
x i8>
   // CHECK-LE-NEXT: ret <16 x i8>
   return vec_inserth(vuca, vucb, uia);
 }
 
 vector unsigned short test_vec_inserth_usv(void) {
-  // CHECK-BE: @llvm.ppc.altivec.vinshvrx(<8 x i16> %{{.+}}, i64 %{{.+}}, <8 x 
i16>
+  // CHECK-BE: @llvm.ppc.altivec.vinshvrx(<8 x i16> %{{.+}}, i32 %{{.+}}, <8 x 
i16>
   // CHECK-BE-NEXT: ret <8 x i16>
-  // CHECK-LE: 

[PATCH] D84277: [PowerPC][Power10] Fix vins*vlx instructions to have i32 arguments.

2020-07-22 Thread Amy Kwan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5f110273954a: [PowerPC][Power10] Fix vins*vlx instructions 
to have i32 arguments. (authored by amyk).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84277

Files:
  clang/include/clang/Basic/BuiltinsPPC.def
  clang/test/CodeGen/builtins-ppc-p10vector.c
  llvm/include/llvm/IR/IntrinsicsPowerPC.td
  llvm/lib/Target/PowerPC/PPCInstrPrefix.td
  llvm/test/CodeGen/PowerPC/builtins-ppc-p10permute.ll

Index: llvm/test/CodeGen/PowerPC/builtins-ppc-p10permute.ll
===
--- llvm/test/CodeGen/PowerPC/builtins-ppc-p10permute.ll
+++ llvm/test/CodeGen/PowerPC/builtins-ppc-p10permute.ll
@@ -170,67 +170,67 @@
 }
 declare <2 x i64> @llvm.ppc.altivec.vinsdrx(<2 x i64>, i64, i64)
 
-define <16 x i8> @testVINSBVLX(<16 x i8> %a, i64 %b, <16 x i8> %c) {
+define <16 x i8> @testVINSBVLX(<16 x i8> %a, i32 %b, <16 x i8> %c) {
 ; CHECK-LABEL: testVINSBVLX:
 ; CHECK:   # %bb.0: # %entry
 ; CHECK-NEXT:vinsbvlx v2, r5, v3
 ; CHECK-NEXT:blr
 entry:
-  %0 = tail call <16 x i8> @llvm.ppc.altivec.vinsbvlx(<16 x i8> %a, i64 %b, <16 x i8> %c)
+  %0 = tail call <16 x i8> @llvm.ppc.altivec.vinsbvlx(<16 x i8> %a, i32 %b, <16 x i8> %c)
   ret <16 x i8> %0
 }
-declare <16 x i8> @llvm.ppc.altivec.vinsbvlx(<16 x i8>, i64, <16 x i8>)
+declare <16 x i8> @llvm.ppc.altivec.vinsbvlx(<16 x i8>, i32, <16 x i8>)
 
-define <16 x i8> @testVINSBVRX(<16 x i8> %a, i64 %b, <16 x i8> %c) {
+define <16 x i8> @testVINSBVRX(<16 x i8> %a, i32 %b, <16 x i8> %c) {
 ; CHECK-LABEL: testVINSBVRX:
 ; CHECK:   # %bb.0: # %entry
 ; CHECK-NEXT:vinsbvrx v2, r5, v3
 ; CHECK-NEXT:blr
 entry:
-  %0 = tail call <16 x i8> @llvm.ppc.altivec.vinsbvrx(<16 x i8> %a, i64 %b, <16 x i8> %c)
+  %0 = tail call <16 x i8> @llvm.ppc.altivec.vinsbvrx(<16 x i8> %a, i32 %b, <16 x i8> %c)
   ret <16 x i8> %0
 }
-declare <16 x i8> @llvm.ppc.altivec.vinsbvrx(<16 x i8>, i64, <16 x i8>)
+declare <16 x i8> @llvm.ppc.altivec.vinsbvrx(<16 x i8>, i32, <16 x i8>)
 
-define <8 x i16> @testVINSHVLX(<8 x i16> %a, i64 %b, <8 x i16> %c) {
+define <8 x i16> @testVINSHVLX(<8 x i16> %a, i32 %b, <8 x i16> %c) {
 ; CHECK-LABEL: testVINSHVLX:
 ; CHECK:   # %bb.0: # %entry
 ; CHECK-NEXT:vinshvlx v2, r5, v3
 ; CHECK-NEXT:blr
 entry:
-  %0 = tail call <8 x i16> @llvm.ppc.altivec.vinshvlx(<8 x i16> %a, i64 %b, <8 x i16> %c)
+  %0 = tail call <8 x i16> @llvm.ppc.altivec.vinshvlx(<8 x i16> %a, i32 %b, <8 x i16> %c)
   ret <8 x i16> %0
 }
-declare <8 x i16> @llvm.ppc.altivec.vinshvlx(<8 x i16>, i64, <8 x i16>)
+declare <8 x i16> @llvm.ppc.altivec.vinshvlx(<8 x i16>, i32, <8 x i16>)
 
-define <8 x i16> @testVINSHVRX(<8 x i16> %a, i64 %b, <8 x i16> %c) {
+define <8 x i16> @testVINSHVRX(<8 x i16> %a, i32 %b, <8 x i16> %c) {
 entry:
-  %0 = tail call <8 x i16> @llvm.ppc.altivec.vinshvrx(<8 x i16> %a, i64 %b, <8 x i16> %c)
+  %0 = tail call <8 x i16> @llvm.ppc.altivec.vinshvrx(<8 x i16> %a, i32 %b, <8 x i16> %c)
   ret <8 x i16> %0
 }
-declare <8 x i16> @llvm.ppc.altivec.vinshvrx(<8 x i16>, i64, <8 x i16>)
+declare <8 x i16> @llvm.ppc.altivec.vinshvrx(<8 x i16>, i32, <8 x i16>)
 
-define <4 x i32> @testVINSWVLX(<4 x i32> %a, i64 %b, <4 x i32> %c) {
+define <4 x i32> @testVINSWVLX(<4 x i32> %a, i32 %b, <4 x i32> %c) {
 ; CHECK-LABEL: testVINSWVLX:
 ; CHECK:   # %bb.0: # %entry
 ; CHECK-NEXT:vinswvlx v2, r5, v3
 ; CHECK-NEXT:blr
 entry:
-  %0 = tail call <4 x i32> @llvm.ppc.altivec.vinswvlx(<4 x i32> %a, i64 %b, <4 x i32> %c)
+  %0 = tail call <4 x i32> @llvm.ppc.altivec.vinswvlx(<4 x i32> %a, i32 %b, <4 x i32> %c)
   ret <4 x i32> %0
 }
-declare <4 x i32> @llvm.ppc.altivec.vinswvlx(<4 x i32>, i64, <4 x i32>)
+declare <4 x i32> @llvm.ppc.altivec.vinswvlx(<4 x i32>, i32, <4 x i32>)
 
-define <4 x i32> @testVINSWVRX(<4 x i32> %a, i64 %b, <4 x i32> %c) {
+define <4 x i32> @testVINSWVRX(<4 x i32> %a, i32 %b, <4 x i32> %c) {
 ; CHECK-LABEL: testVINSWVRX:
 ; CHECK:   # %bb.0: # %entry
 ; CHECK-NEXT:vinswvrx v2, r5, v3
 ; CHECK-NEXT:blr
 entry:
-  %0 = tail call <4 x i32> @llvm.ppc.altivec.vinswvrx(<4 x i32> %a, i64 %b, <4 x i32> %c)
+  %0 = tail call <4 x i32> @llvm.ppc.altivec.vinswvrx(<4 x i32> %a, i32 %b, <4 x i32> %c)
   ret <4 x i32> %0
 }
-declare <4 x i32> @llvm.ppc.altivec.vinswvrx(<4 x i32>, i64, <4 x i32>)
+declare <4 x i32> @llvm.ppc.altivec.vinswvrx(<4 x i32>, i32, <4 x i32>)
 
 define <4 x i32> @testVINSW(<4 x i32> %a, i32 %b) {
 ; CHECK-LABEL: testVINSW:
Index: llvm/lib/Target/PowerPC/PPCInstrPrefix.td
===
--- llvm/lib/Target/PowerPC/PPCInstrPrefix.td
+++ llvm/lib/Target/PowerPC/PPCInstrPrefix.td
@@ -245,7 +245,7 @@
 // VX-Form: [PO VRT RA VRB XO].
 // Destructive (insert) forms are suffixed with _ins.
 class VXForm_VTB5_RA5_ins xo, string opc, list pattern>
-  : 

[PATCH] D80263: [HeaderSearch] Fix processing #import-ed headers multiple times with modules enabled.

2020-07-22 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai added a comment.

Ping.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80263



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


[PATCH] D83731: Add Debug Info Size to Symbol Status

2020-07-22 Thread Greg Clayton via Phabricator via cfe-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Looks like there is an indentation issue in the test. See inline comments.




Comment at: lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py:55-61
+active_modules = self.vscode.get_active_modules()
+program_module = active_modules[program_basename]
+self.assertEqual(program_basename, program_module['name'])
+self.assertEqual(program, program_module['path'])
+self.assertIn('symbolFilePath', program_module)
+self.assertEqual(symbols_path, program_module['symbolFilePath'])
+self.assertIn('addressRange', program_module)

Unindent everything after the self.waitUntil()? Otherwise we are not testing 
the program, symbolFilePath and addressRange on symbols with size.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83731



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


[PATCH] D84364: [CUDA][HIP] Defer all diagnostics for host device functions

2020-07-22 Thread Artem Belevich via Phabricator via cfe-commits
tra added a subscriber: rsmith.
tra added a comment.

It's an interesting idea and it may be needed to handle wider range of 
implicitly-HD functions.
However it's likely to have interesting consequences, not all of them 
desirable. 
It may be worth considering hiding the new behavior behind a flag, make it 
optional at first, give it some soak time and only then make it the default.
Summoning @rsmith for the big picture input.

One side effect of this change is that we'll probably stop producing 
diagnostics for the code that is known to be wrong, but happens to be unused.

E.g.

  __host__ __device__ static void hd() {
 no_such_type_t t;
  }

We obviously can never compile this function on either side of the compilation 
and clang currently does diagnose it on both sides.
However, if all diagnostics in HD functions are postponed until codegen, this 
error will go unreported.

What if I have a syntax error in a HD function? I'd still want it to be 
diagnosed. 
It's going to be interesting to see how it affects parsing subsequent code. 
E.g https://godbolt.org/z/1vfPcc -- clang complains about the error in 
`innocent` due to an error in `hd`. If all diags issues in `hd` are postponed 
and the user only sees `error: function definition is not allowed here`, it 
will be rather confusing, because the `innocent` itself is perfectly fine.

Also, this patch may need more eyes on it. I'm sure there are more corner cases 
we may need to think about. 
E.g. how would it affect SFINAE? Will it allow some things to succeed where 
they would've failed previously? If so, is it always the right thing to do?

We'll certainly want to have more tests that cover the errors that we still 
want to be produced.


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

https://reviews.llvm.org/D84364



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


[clang] 50da55a - [PGO] Supporting code for always instrumenting entry block

2020-07-22 Thread Rong Xu via cfe-commits

Author: Rong Xu
Date: 2020-07-22T15:01:53-07:00
New Revision: 50da55a58534e9207d8d5e31c8b4b5cf0c624175

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

LOG: [PGO] Supporting code for always instrumenting entry block

This patch includes the supporting code that enables always
instrumenting the function entry block by default.

This patch will NOT the default behavior.

It adds a variant bit in the profile version, adds new directives in
text profile format, and changes llvm-profdata tool accordingly.

This patch is a split of D83024 (https://reviews.llvm.org/D83024)
Many test changes from D83024 are also included.

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

Added: 
clang/test/CodeGenCXX/Inputs/profile-remap_entry.proftext
clang/test/Profile/Inputs/gcc-flag-compatibility_IR_entry.proftext
llvm/test/Transforms/PGOProfile/Inputs/branch2_entry.proftext
llvm/test/Transforms/PGOProfile/Inputs/criticaledge_entry.proftext
llvm/test/Transforms/PGOProfile/Inputs/indirectbr_entry.proftext
llvm/test/Transforms/PGOProfile/Inputs/irreducible_entry.proftext
llvm/test/Transforms/PGOProfile/Inputs/landingpad_entry.proftext
llvm/test/Transforms/PGOProfile/Inputs/loop1_entry.proftext
llvm/test/Transforms/PGOProfile/Inputs/loop2_entry.proftext
llvm/test/Transforms/PGOProfile/Inputs/misexpect-branch_entry.proftext

llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch-correct_entry.proftext
llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch_entry.proftext
llvm/test/Transforms/PGOProfile/Inputs/switch_entry.proftext
llvm/test/tools/llvm-profdata/Inputs/header-directives-1.proftext
llvm/test/tools/llvm-profdata/Inputs/header-directives-2.proftext
llvm/test/tools/llvm-profdata/Inputs/header-directives-3.proftext
llvm/test/tools/llvm-profdata/header-directives.test

Modified: 
clang/test/CodeGenCXX/profile-remap.cpp
clang/test/Profile/gcc-flag-compatibility.c
llvm/include/llvm/ProfileData/InstrProf.h
llvm/include/llvm/ProfileData/InstrProfData.inc
llvm/include/llvm/ProfileData/InstrProfReader.h
llvm/include/llvm/ProfileData/InstrProfWriter.h
llvm/lib/ProfileData/InstrProf.cpp
llvm/lib/ProfileData/InstrProfReader.cpp
llvm/lib/ProfileData/InstrProfWriter.cpp
llvm/lib/Transforms/Instrumentation/CFGMST.h
llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
llvm/test/Transforms/PGOProfile/Inputs/func_entry.proftext
llvm/test/Transforms/PGOProfile/Inputs/select1.proftext
llvm/test/Transforms/PGOProfile/Inputs/select2.proftext
llvm/test/Transforms/PGOProfile/branch2.ll
llvm/test/Transforms/PGOProfile/counter_promo_exit_catchswitch.ll
llvm/test/Transforms/PGOProfile/criticaledge.ll
llvm/test/Transforms/PGOProfile/cspgo_profile_summary.ll
llvm/test/Transforms/PGOProfile/indirectbr.ll
llvm/test/Transforms/PGOProfile/irreducible.ll
llvm/test/Transforms/PGOProfile/landingpad.ll
llvm/test/Transforms/PGOProfile/loop1.ll
llvm/test/Transforms/PGOProfile/loop2.ll
llvm/test/Transforms/PGOProfile/misexpect-branch-stripped.ll
llvm/test/Transforms/PGOProfile/misexpect-branch.ll
llvm/test/Transforms/PGOProfile/misexpect-switch-default.ll
llvm/test/Transforms/PGOProfile/misexpect-switch.ll
llvm/test/Transforms/PGOProfile/switch.ll
llvm/test/Transforms/PGOProfile/thinlto_cspgo_use.ll
llvm/tools/llvm-profdata/llvm-profdata.cpp

Removed: 




diff  --git a/clang/test/CodeGenCXX/Inputs/profile-remap_entry.proftext 
b/clang/test/CodeGenCXX/Inputs/profile-remap_entry.proftext
new file mode 100644
index ..65bc6ff46711
--- /dev/null
+++ b/clang/test/CodeGenCXX/Inputs/profile-remap_entry.proftext
@@ -0,0 +1,8 @@
+:ir
+:entry_first
+_ZN3Foo8functionENS_1XE
+29667547796
+2
+100
+90
+

diff  --git a/clang/test/CodeGenCXX/profile-remap.cpp 
b/clang/test/CodeGenCXX/profile-remap.cpp
index 0fc7c7b40033..b519e55d2112 100644
--- a/clang/test/CodeGenCXX/profile-remap.cpp
+++ b/clang/test/CodeGenCXX/profile-remap.cpp
@@ -3,6 +3,8 @@
 // RUN: %clang_cc1 -triple x86_64-linux-gnu 
-fprofile-sample-use=%S/Inputs/profile-remap.samples 
-fprofile-remapping-file=%S/Inputs/profile-remap.map 
-fexperimental-new-pass-manager -O2 %s -emit-llvm -o - | FileCheck %s 
--check-prefixes=CHECK,CHECK-SAMPLES
 // RUN: llvm-profdata merge -output %T.profdata 
%S/Inputs/profile-remap.proftext
 // RUN: %clang_cc1 -triple x86_64-linux-gnu 
-fprofile-instrument-use-path=%T.profdata 
-fprofile-remapping-file=%S/Inputs/profile-remap.map 
-fexperimental-new-pass-manager -O2 %s -emit-llvm -o - | FileCheck %s 
--check-prefixes=CHECK,CHECK-INSTR
+// RUN: llvm-profdata merge -output %T.profdata 
%S/Inputs/profile-remap_entry.proftext
+// RUN: %clang_cc1 

[PATCH] D84261: [PGO] Supporting code for always instrumenting entry block

2020-07-22 Thread Rong Xu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG50da55a58534: [PGO] Supporting code for always instrumenting 
entry block (authored by xur).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Changed prior to commit:
  https://reviews.llvm.org/D84261?vs=279904=279952#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84261

Files:
  clang/test/CodeGenCXX/Inputs/profile-remap_entry.proftext
  clang/test/CodeGenCXX/profile-remap.cpp
  clang/test/Profile/Inputs/gcc-flag-compatibility_IR_entry.proftext
  clang/test/Profile/gcc-flag-compatibility.c
  llvm/include/llvm/ProfileData/InstrProf.h
  llvm/include/llvm/ProfileData/InstrProfData.inc
  llvm/include/llvm/ProfileData/InstrProfReader.h
  llvm/include/llvm/ProfileData/InstrProfWriter.h
  llvm/lib/ProfileData/InstrProf.cpp
  llvm/lib/ProfileData/InstrProfReader.cpp
  llvm/lib/ProfileData/InstrProfWriter.cpp
  llvm/lib/Transforms/Instrumentation/CFGMST.h
  llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
  llvm/test/Transforms/PGOProfile/Inputs/branch2_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/criticaledge_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/func_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/indirectbr_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/irreducible_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/landingpad_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/loop1_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/loop2_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/misexpect-branch_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch-correct_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/select1.proftext
  llvm/test/Transforms/PGOProfile/Inputs/select2.proftext
  llvm/test/Transforms/PGOProfile/Inputs/switch_entry.proftext
  llvm/test/Transforms/PGOProfile/branch2.ll
  llvm/test/Transforms/PGOProfile/counter_promo_exit_catchswitch.ll
  llvm/test/Transforms/PGOProfile/criticaledge.ll
  llvm/test/Transforms/PGOProfile/cspgo_profile_summary.ll
  llvm/test/Transforms/PGOProfile/indirectbr.ll
  llvm/test/Transforms/PGOProfile/irreducible.ll
  llvm/test/Transforms/PGOProfile/landingpad.ll
  llvm/test/Transforms/PGOProfile/loop1.ll
  llvm/test/Transforms/PGOProfile/loop2.ll
  llvm/test/Transforms/PGOProfile/misexpect-branch-stripped.ll
  llvm/test/Transforms/PGOProfile/misexpect-branch.ll
  llvm/test/Transforms/PGOProfile/misexpect-switch-default.ll
  llvm/test/Transforms/PGOProfile/misexpect-switch.ll
  llvm/test/Transforms/PGOProfile/switch.ll
  llvm/test/Transforms/PGOProfile/thinlto_cspgo_use.ll
  llvm/test/tools/llvm-profdata/Inputs/header-directives-1.proftext
  llvm/test/tools/llvm-profdata/Inputs/header-directives-2.proftext
  llvm/test/tools/llvm-profdata/Inputs/header-directives-3.proftext
  llvm/test/tools/llvm-profdata/header-directives.test
  llvm/tools/llvm-profdata/llvm-profdata.cpp

Index: llvm/tools/llvm-profdata/llvm-profdata.cpp
===
--- llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -251,6 +251,7 @@
 Filename);
 return;
   }
+  WC->Writer.setInstrEntryBBEnabled(Reader->instrEntryBBEnabled());
 
   for (auto  : *Reader) {
 if (Remapper)
@@ -977,8 +978,11 @@
   if (TextFormat)
 return 0;
   std::unique_ptr PS(Builder.getSummary());
-  OS << "Instrumentation level: "
- << (Reader->isIRLevelProfile() ? "IR" : "Front-end") << "\n";
+  bool IsIR = Reader->isIRLevelProfile();
+  OS << "Instrumentation level: " << (IsIR ? "IR" : "Front-end");
+  if (IsIR)
+OS << "  entry_first = " << Reader->instrEntryBBEnabled();
+  OS << "\n";
   if (ShowAllFunctions || !ShowFunction.empty())
 OS << "Functions shown: " << ShownFunctions << "\n";
   OS << "Total functions: " << PS->getNumFunctions() << "\n";
Index: llvm/test/tools/llvm-profdata/header-directives.test
===
--- /dev/null
+++ llvm/test/tools/llvm-profdata/header-directives.test
@@ -0,0 +1,10 @@
+RUN: llvm-profdata show %p/Inputs/header-directives-1.proftext -o - | FileCheck %s --check-prefixes=ENTRYFIRST,CHECK
+RUN: llvm-profdata show %p/Inputs/header-directives-2.proftext -o - | FileCheck %s --check-prefixes=NOTENTRYFIRST,CHECK
+RUN: llvm-profdata show %p/Inputs/header-directives-3.proftext -o - | FileCheck %s --check-prefixes=ENTRYFIRST,CHECK
+
+ENTRYFIRST: Instrumentation level: IR  entry_first = 1
+NOTENTRYFIRST: Instrumentation level: IR  entry_first = 0
+CHECK: Total functions: 1
+CHECK: Maximum function count: 100
+CHECK: Maximum internal block count: 90
+
Index: llvm/test/tools/llvm-profdata/Inputs/header-directives-3.proftext

[PATCH] D84362: [NFC] Add missing functions to PartialDiagnostic

2020-07-22 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 279951.
yaxunl added a comment.

fix build failure


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

https://reviews.llvm.org/D84362

Files:
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/Attr.h
  clang/include/clang/AST/CanonicalType.h
  clang/include/clang/AST/Decl.h
  clang/include/clang/AST/DeclarationName.h
  clang/include/clang/AST/NestedNameSpecifier.h
  clang/include/clang/AST/TemplateBase.h
  clang/include/clang/AST/Type.h
  clang/include/clang/Basic/Diagnostic.h
  clang/include/clang/Basic/PartialDiagnostic.h
  clang/include/clang/Sema/Ownership.h
  clang/include/clang/Sema/ParsedAttr.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/TemplateBase.cpp
  clang/lib/Basic/Diagnostic.cpp

Index: clang/lib/Basic/Diagnostic.cpp
===
--- clang/lib/Basic/Diagnostic.cpp
+++ clang/lib/Basic/Diagnostic.cpp
@@ -40,26 +40,6 @@
 
 using namespace clang;
 
-const DiagnosticBuilder ::operator<<(const DiagnosticBuilder ,
-   DiagNullabilityKind nullability) {
-  StringRef string;
-  switch (nullability.first) {
-  case NullabilityKind::NonNull:
-string = nullability.second ? "'nonnull'" : "'_Nonnull'";
-break;
-
-  case NullabilityKind::Nullable:
-string = nullability.second ? "'nullable'" : "'_Nullable'";
-break;
-
-  case NullabilityKind::Unspecified:
-string = nullability.second ? "'null_unspecified'" : "'_Null_unspecified'";
-break;
-  }
-
-  DB.AddString(string);
-  return DB;
-}
 
 const DiagnosticBuilder ::operator<<(const DiagnosticBuilder ,
llvm::Error &) {
Index: clang/lib/AST/TemplateBase.cpp
===
--- clang/lib/AST/TemplateBase.cpp
+++ clang/lib/AST/TemplateBase.cpp
@@ -26,6 +26,7 @@
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/LangOptions.h"
+#include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/SourceLocation.h"
 #include "llvm/ADT/APSInt.h"
 #include "llvm/ADT/FoldingSet.h"
@@ -448,8 +449,8 @@
   llvm_unreachable("Invalid TemplateArgument Kind!");
 }
 
-const DiagnosticBuilder ::operator<<(const DiagnosticBuilder ,
-   const TemplateArgument ) {
+template 
+static const T (const T , const TemplateArgument ) {
   switch (Arg.getKind()) {
   case TemplateArgument::Null:
 // This is bad, but not as bad as crashing because of argument
@@ -502,6 +503,16 @@
   llvm_unreachable("Invalid TemplateArgument Kind!");
 }
 
+const DiagnosticBuilder ::operator<<(const DiagnosticBuilder ,
+   const TemplateArgument ) {
+  return DiagTemplateArg(DB, Arg);
+}
+
+const PartialDiagnostic ::operator<<(const PartialDiagnostic ,
+   const TemplateArgument ) {
+  return DiagTemplateArg(DB, Arg);
+}
+
 const ASTTemplateArgumentListInfo *
 ASTTemplateArgumentListInfo::Create(const ASTContext ,
 const TemplateArgumentListInfo ) {
Index: clang/lib/AST/ASTContext.cpp
===
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -11164,3 +11164,11 @@
 return DB << Section.Decl;
   return DB << "a prior #pragma section";
 }
+
+const PartialDiagnostic ::
+operator<<(const PartialDiagnostic ,
+   const ASTContext::SectionInfo ) {
+  if (Section.Decl)
+return DB << Section.Decl;
+  return DB << "a prior #pragma section";
+}
Index: clang/include/clang/Sema/Sema.h
===
--- clang/include/clang/Sema/Sema.h
+++ clang/include/clang/Sema/Sema.h
@@ -1511,6 +1511,7 @@
   BaseDiag << Value;
   return Diag;
 }
+const static bool IsDiagBuilder = false;
   };
 
   /// Emit a diagnostic.
Index: clang/include/clang/Sema/ParsedAttr.h
===
--- clang/include/clang/Sema/ParsedAttr.h
+++ clang/include/clang/Sema/ParsedAttr.h
@@ -1040,34 +1040,26 @@
   ExpectedFunctionWithProtoType,
 };
 
-inline const DiagnosticBuilder <<(const DiagnosticBuilder ,
-   const ParsedAttr ) {
+template <
+typename DiagBuilderT,
+typename std::enable_if::type * = nullptr>
+inline const DiagBuilderT <<(const DiagBuilderT ,
+  const ParsedAttr ) {
   DB.AddTaggedVal(reinterpret_cast(At.getAttrName()),
   DiagnosticsEngine::ak_identifierinfo);
   return DB;
 }
 
-inline const PartialDiagnostic <<(const PartialDiagnostic ,
-   const ParsedAttr ) {
-  PD.AddTaggedVal(reinterpret_cast(At.getAttrName()),
-  DiagnosticsEngine::ak_identifierinfo);
-  

[clang] e0ee228 - [clang][test] Fix test for external assemblers

2020-07-22 Thread Douglas Yung via cfe-commits

Author: Douglas Yung
Date: 2020-07-22T14:50:20-07:00
New Revision: e0ee2288424952e0445f096ae7800472eac11249

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

LOG: [clang][test] Fix test for external assemblers

This test depends on using the integrated assembler, so make it
explicit by specifying -fintegrated-as.

Added: 


Modified: 
clang/test/Driver/pch-codegen.cpp

Removed: 




diff  --git a/clang/test/Driver/pch-codegen.cpp 
b/clang/test/Driver/pch-codegen.cpp
index c6b6d9217e42..f16f6b51bf40 100644
--- a/clang/test/Driver/pch-codegen.cpp
+++ b/clang/test/Driver/pch-codegen.cpp
@@ -23,7 +23,7 @@
 
 // Create PCH's object file for -fpch-codegen.
 // RUN: touch %t/foo-cg.pch
-// RUN: %clang -c %t/foo-cg.pch -o %t/foo-cg.o -### 2>&1 | FileCheck %s 
-check-prefix=CHECK-PCH-CODEGEN-OBJ
+// RUN: %clang -c -fintegrated-as %t/foo-cg.pch -o %t/foo-cg.o -### 2>&1 | 
FileCheck %s -check-prefix=CHECK-PCH-CODEGEN-OBJ
 // CHECK-PCH-CODEGEN-OBJ: -emit-obj
 // CHECK-PCH-CODEGEN-OBJ: "-main-file-name" "foo-cg.pch"
 // CHECK-PCH-CODEGEN-OBJ: "-o" "{{.*}}foo-cg.o"
@@ -31,7 +31,7 @@
 
 // Create PCH's object file for -fpch-debuginfo.
 // RUN: touch %t/foo-di.pch
-// RUN: %clang -c %t/foo-di.pch -g -o %t/foo-di.o -### 2>&1 | FileCheck %s 
-check-prefix=CHECK-PCH-DEBUGINFO-OBJ
+// RUN: %clang -c -fintegrated-as %t/foo-di.pch -g -o %t/foo-di.o -### 2>&1 | 
FileCheck %s -check-prefix=CHECK-PCH-DEBUGINFO-OBJ
 // CHECK-PCH-DEBUGINFO-OBJ: -emit-obj
 // CHECK-PCH-DEBUGINFO-OBJ: "-main-file-name" "foo-di.pch"
 // CHECK-PCH-DEBUGINFO-OBJ: "-o" "{{.*}}foo-di.o"



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


[PATCH] D84364: [CUDA][HIP] Defer all diagnostics for host device functions

2020-07-22 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 279950.
yaxunl added a comment.

update for depending patch change


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

https://reviews.llvm.org/D84364

Files:
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/AnalysisBasedWarnings.cpp
  clang/lib/Sema/Sema.cpp
  clang/lib/Sema/SemaAttr.cpp
  clang/lib/Sema/SemaCUDA.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaExprObjC.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/Sema/SemaSYCL.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/SemaStmtAsm.cpp
  clang/lib/Sema/SemaTemplateInstantiate.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/lib/Sema/SemaTemplateVariadic.cpp
  clang/lib/Sema/SemaType.cpp
  clang/test/SemaCUDA/asm-constraints-mixed.cu
  clang/test/SemaCUDA/constexpr-variables.cu
  clang/test/SemaCUDA/cxx11-kernel-call.cu
  clang/test/SemaCUDA/exceptions.cu
  clang/test/SemaCUDA/implicit-member-target-inherited.cu
  clang/test/SemaCUDA/lambda.cu
  clang/test/SemaCUDA/no-call-stack-for-immediate-errs.cu
  clang/test/SemaCUDA/union-init.cu
  clang/test/SemaCUDA/usual-deallocators.cu

Index: clang/test/SemaCUDA/usual-deallocators.cu
===
--- clang/test/SemaCUDA/usual-deallocators.cu
+++ clang/test/SemaCUDA/usual-deallocators.cu
@@ -81,9 +81,9 @@
 __host__ __device__ void tests_hd(void *t) {
   test_hd(t);
   test_hd(t);
-  // host-note@-1 {{in instantiation of function template specialization 'test_hd' requested here}}
+  // host-note@-1 {{called by 'tests_hd'}}
   test_hd(t);
-  // device-note@-1 {{in instantiation of function template specialization 'test_hd' requested here}}
+  // device-note@-1 {{called by 'tests_hd'}}
   test_hd(t);
   test_hd(t);
   test_hd(t);
Index: clang/test/SemaCUDA/union-init.cu
===
--- clang/test/SemaCUDA/union-init.cu
+++ clang/test/SemaCUDA/union-init.cu
@@ -1,4 +1,7 @@
-// RUN: %clang_cc1 %s --std=c++11 -triple x86_64-linux-unknown -fsyntax-only -o - -verify
+// RUN: %clang_cc1 %s --std=c++11 -triple x86_64-linux-unknown \
+// RUN:   -fsyntax-only -o - -verify=com,host
+// RUN: %clang_cc1 %s --std=c++11 -triple nvptx -fcuda-is-device \
+// RUN:   -fsyntax-only -o - -verify=com,dev
 
 #include "Inputs/cuda.h"
 
@@ -31,14 +34,14 @@
 
 __device__ B b;
 __device__ C c;
-// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, and __shared__ variables.}}
+// com-error@-1 {{dynamic initialization is not supported for __device__, __constant__, and __shared__ variables.}}
 __device__ D d;
-// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, and __shared__ variables.}}
+// com-error@-1 {{dynamic initialization is not supported for __device__, __constant__, and __shared__ variables.}}
 
 __device__ void foo() {
   __shared__ B b;
   __shared__ C c;
-  // expected-error@-1 {{initialization is not supported for __shared__ variables.}}
+  // com-error@-1 {{initialization is not supported for __shared__ variables.}}
   __shared__ D d;
-  // expected-error@-1 {{initialization is not supported for __shared__ variables.}}
+  // com-error@-1 {{initialization is not supported for __shared__ variables.}}
 }
Index: clang/test/SemaCUDA/no-call-stack-for-immediate-errs.cu
===
--- clang/test/SemaCUDA/no-call-stack-for-immediate-errs.cu
+++ clang/test/SemaCUDA/no-call-stack-for-immediate-errs.cu
@@ -2,11 +2,6 @@
 
 #include "Inputs/cuda.h"
 
-// Here we should dump an error about the VLA in device_fn, but we should not
-// print a callstack indicating how device_fn becomes known-emitted, because
-// it's an error to use a VLA in any __device__ function, even one that doesn't
-// get emitted.
-
 inline __device__ void device_fn(int n);
 inline __device__ void device_fn2() { device_fn(42); }
 
Index: clang/test/SemaCUDA/lambda.cu
===
--- clang/test/SemaCUDA/lambda.cu
+++ clang/test/SemaCUDA/lambda.cu
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify=com %s
+// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify=com,host %s
 // RUN: %clang_cc1 -std=c++17 -fsyntax-only -fcuda-is-device -verify=com,dev %s
 
 #include "Inputs/cuda.h"
Index: clang/test/SemaCUDA/implicit-member-target-inherited.cu
===
--- clang/test/SemaCUDA/implicit-member-target-inherited.cu
+++ clang/test/SemaCUDA/implicit-member-target-inherited.cu
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s -Wno-defaulted-function-deleted
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify=expected,host %s -Wno-defaulted-function-deleted
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fcuda-is-device -verify=expected,dev %s -Wno-defaulted-function-deleted
 
 #include "Inputs/cuda.h"
 
Index: 

[PATCH] D83592: [Coverage] Add comment to skipped regions

2020-07-22 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu added a comment.

In D83592#2167926 , @vsk wrote:

> @zequanwu I'm not sure whether this is something you've already tried, but 
> for frontend changes, it can be helpful to verify that a stage2 clang 
> self-host with assertions enabled completes  successfully. For coverage 
> specifically, it's possible to do that by setting 
> '-DLLVM_BUILD_INSTRUMENTED_COVERAGE=On' during the stage2 cmake step.


I didn't know that before. I will try.

When including some standard libraries, the assertion 
`assert(SM.isWrittenInSameFile(LocStart, LocEnd) && "region spans multiple 
files");` fails, like  or  etc, still investigating.


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

https://reviews.llvm.org/D83592



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


[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-22 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs marked 4 inline comments as done.
dokyungs added inline comments.



Comment at: compiler-rt/test/fuzzer/custom-allocator.test:2
+UNSUPPORTED: freebsd
+RUN: %cpp_compiler -fno-sanitize=all -fno-builtin %S/CustomAllocator.cpp -fPIC 
%ld_flags_rpath_so1 -O0 -shared -o %dynamiclib1
+RUN: %cpp_compiler -fno-sanitize=address %S/CustomAllocatorTest.cpp 
%ld_flags_rpath_exe1 -o %t-NoAsanCustomAllocatorTest

morehouse wrote:
> dokyungs wrote:
> > morehouse wrote:
> > > Why do we need each of these flags?
> > With all the flags, I designed this test for the recent failure scenario in 
> > which tcmalloc calls strncmp (+memcmp/strstr) when the fuzzer interceptor 
> > library is linked into the libFuzzer executable.
> > 
> > As such, we need to turn off ASan (-fno-sanitize=address) when building the 
> > executable to let the fuzzer interceptor library be linked.
> > 
> > As to the flags used to build the allocator shared library, I wanted to 
> > disable ASan and Fuzzer (via `-fno-sanitize=all`) because allocator 
> > libraries are typically not instrumented for OOB/UAF errors or coverage. I 
> > also wanted to prevent the compiler from optimizing out our calls to 
> > strncmp(+memcmp/strstr) by giving `-fno-builtin`; calls to these functions 
> > must go to the fuzzer interceptor library to comply with the scenario.
> Yes, those flags make sense.  What about `-fPIC %ld_flags_rpath_so1 -O0 
> -shared`?
Removed unnecessary use of a shared library for testing custom allocator. 
Instead, compile and statically link the allocator into the test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83494



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


[PATCH] D67833: [OpenMP 5.0] Codegen support to pass user-defined mapper functions to runtime

2020-07-22 Thread Joachim Protze via Phabricator via cfe-commits
protze.joachim added a comment.

I'm executing:

  $ /usr/bin/python bin/llvm-lit -vv -a 
projects/openmp/libomptarget/test/offloading/target_depend_nowait.cpp

which executes:

  "/dev/shm/jprotze/build-tsan-fiber-as/./bin/clang++" "-fopenmp" "-pthread" 
"-fno-experimental-isel" "-I" 
"/dev/shm/jprotze/llvm-project/openmp/libomptarget/test" "-I" 
"/dev/shm/jprotze/build-tsan-fiber-as/projects/openmp/libomptarget/../runtime/src"
 "-L" "/dev/shm/jprotze/build-tsan-fiber-as/lib" 
"-fopenmp-targets=x86_64-pc-linux-gnu" 
"/dev/shm/jprotze/llvm-project/openmp/libomptarget/test/offloading/target_depend_nowait.cpp"
 "-o" 
"/dev/shm/jprotze/build-tsan-fiber-as/projects/openmp/libomptarget/test/offloading/Output/target_depend_nowait.cpp.tmp-x86_64-pc-linux-gnu"

According to gdb, the segfault happens in  0x400fcf. %rcx is 0 at that time.

   400f89:   e8 62 fc ff ff  callq  400bf0 
<__kmpc_omp_target_task_alloc@plt>
400f8e:   45 31 c9xor%r9d,%r9d
400f91:   31 c9   xor%ecx,%ecx
400f93:   48 8d 55 88 lea-0x78(%rbp),%rdx
400f97:   48 8b 75 e0 mov-0x20(%rbp),%rsi
400f9b:   48 89 70 28 mov%rsi,0x28(%rax)
400f9f:   48 8b 75 e8 mov-0x18(%rbp),%rsi
400fa3:   48 89 70 30 mov%rsi,0x30(%rax)
400fa7:   48 8b 75 d0 mov-0x30(%rbp),%rsi
400fab:   48 89 70 38 mov%rsi,0x38(%rax)
400faf:   48 8b 75 d8 mov-0x28(%rbp),%rsi
400fb3:   48 89 70 40 mov%rsi,0x40(%rax)
400fb7:   48 8b 34 25 40 1f 40mov0x401f40,%rsi
400fbe:   00 
400fbf:   48 89 70 48 mov%rsi,0x48(%rax)
400fc3:   48 8b 34 25 48 1f 40mov0x401f48,%rsi
400fca:   00 
400fcb:   48 89 70 50 mov%rsi,0x50(%rax)
  > 400fcf:   48 8b 31mov(%rcx),%rsi
400fd2:   48 89 70 58 mov%rsi,0x58(%rax)
400fd6:   48 8b 49 08 mov0x8(%rcx),%rcx
400fda:   48 89 48 60 mov%rcx,0x60(%rax)
400fde:   48 b9 00 61 60 00 00movabs $0x606100,%rcx
400fe5:   00 00 00 
400fe8:   48 89 4d 88 mov%rcx,-0x78(%rbp)
400fec:   48 c7 45 90 04 00 00movq   $0x4,-0x70(%rbp)
400ff3:   00 
400ff4:   c6 45 98 03 movb   $0x3,-0x68(%rbp)
400ff8:   48 c7 45 80 01 00 00movq   $0x1,-0x80(%rbp)
400fff:   00 
401000:   48 8b 4d f8 mov-0x8(%rbp),%rcx
401004:   8b 31   mov(%rcx),%esi
401006:   48 b9 97 1f 40 00 00movabs $0x401f97,%rcx
40100d:   00 00 00 
401010:   48 89 4d b0 mov%rcx,-0x50(%rbp)
401014:   48 8d 7d a0 lea-0x60(%rbp),%rdi
401018:   48 89 95 18 fe ff ffmov%rdx,-0x1e8(%rbp)
40101f:   48 89 c2mov%rax,%rdx
401022:   b9 01 00 00 00  mov$0x1,%ecx
401027:   4c 8b 85 18 fe ff ffmov-0x1e8(%rbp),%r8
40102e:   48 c7 04 24 00 00 00movq   $0x0,(%rsp)
401035:   00 
401036:   e8 55 fb ff ff  callq  400b90 
<__kmpc_omp_task_with_deps@plt>


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67833



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


[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-22 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs updated this revision to Diff 279946.
dokyungs marked an inline comment as done.
dokyungs added a comment.

Introduce internal_strcmp and update tests accordingly.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83494

Files:
  clang/include/clang/Driver/SanitizerArgs.h
  clang/lib/Driver/SanitizerArgs.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  compiler-rt/lib/fuzzer/CMakeLists.txt
  compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp
  compiler-rt/test/fuzzer/CustomAllocator.cpp
  compiler-rt/test/fuzzer/custom-allocator.test
  compiler-rt/test/fuzzer/memcmp.test
  compiler-rt/test/fuzzer/memcmp64.test
  compiler-rt/test/fuzzer/strcmp.test
  compiler-rt/test/fuzzer/strncmp.test
  compiler-rt/test/fuzzer/strstr.test

Index: compiler-rt/test/fuzzer/strstr.test
===
--- compiler-rt/test/fuzzer/strstr.test
+++ compiler-rt/test/fuzzer/strstr.test
@@ -1,5 +1,11 @@
 UNSUPPORTED: freebsd
 RUN: %cpp_compiler %S/StrstrTest.cpp -o %t-StrstrTest
 RUN: not %run %t-StrstrTest   -seed=1 -runs=200   2>&1 | FileCheck %s
-CHECK: BINGO
 
+RUN: %cpp_compiler -fno-sanitize=address -fno-builtin-strstr %S/StrstrTest.cpp -o %t-NoAsanStrstrTest
+RUN: not %run %t-NoAsanStrstrTest -seed=1 -runs=200   2>&1 | FileCheck %s
+
+RUN: %cpp_compiler -fno-sanitize=address -fno-builtin-calloc -fno-builtin-strstr %S/CustomAllocator.cpp %S/StrstrTest.cpp -o %t-NoAsanCustomAllocatorStrstrTest
+RUN: not %run %t-NoAsanCustomAllocatorStrstrTest -seed=1 -runs=200   2>&1 | FileCheck %s
+
+CHECK: BINGO
Index: compiler-rt/test/fuzzer/strncmp.test
===
--- compiler-rt/test/fuzzer/strncmp.test
+++ compiler-rt/test/fuzzer/strncmp.test
@@ -1,5 +1,11 @@
 UNSUPPORTED: freebsd
 RUN: %cpp_compiler %S/StrncmpTest.cpp -o %t-StrncmpTest
 RUN: not %run %t-StrncmpTest  -seed=2 -runs=1000   2>&1 | FileCheck %s
-CHECK: BINGO
 
+RUN: %cpp_compiler -fno-sanitize=address -fno-builtin-strncmp %S/StrncmpTest.cpp -o %t-NoAsanStrncmpTest
+RUN: not %run %t-NoAsanStrncmpTest-seed=2 -runs=1000   2>&1 | FileCheck %s
+
+RUN: %cpp_compiler -fno-sanitize=address -fno-builtin-calloc -fno-builtin-strncmp %S/CustomAllocator.cpp %S/StrncmpTest.cpp -o %t-NoAsanCustomAllocatorStrncmpTest
+RUN: not %run %t-NoAsanCustomAllocatorStrncmpTest -seed=2 -runs=1000   2>&1 | FileCheck %s
+
+CHECK: BINGO
Index: compiler-rt/test/fuzzer/strcmp.test
===
--- compiler-rt/test/fuzzer/strcmp.test
+++ compiler-rt/test/fuzzer/strcmp.test
@@ -1,5 +1,11 @@
 UNSUPPORTED: freebsd
 RUN: %cpp_compiler %S/StrcmpTest.cpp -o %t-StrcmpTest
 RUN: not %run %t-StrcmpTest   -seed=1 -runs=200   2>&1 | FileCheck %s
-CHECK: BINGO
 
+RUN: %cpp_compiler -fno-sanitize=address -fno-builtin-strcmp %S/StrcmpTest.cpp -o %t-NoAsanStrcmpTest
+RUN: not %run %t-NoAsanStrcmpTest -seed=1 -runs=200   2>&1 | FileCheck %s
+
+RUN: %cpp_compiler -fno-sanitize=address -fno-builtin-calloc -fno-builtin-strcmp %S/CustomAllocator.cpp %S/StrcmpTest.cpp -o %t-NoAsanCustomAllocatorStrcmpTest
+RUN: not %run %t-NoAsanCustomAllocatorStrcmpTest -seed=1 -runs=200   2>&1 | FileCheck %s
+
+CHECK: BINGO
Index: compiler-rt/test/fuzzer/memcmp64.test
===
--- compiler-rt/test/fuzzer/memcmp64.test
+++ compiler-rt/test/fuzzer/memcmp64.test
@@ -1,4 +1,8 @@
 UNSUPPORTED: freebsd
 RUN: %cpp_compiler %S/Memcmp64BytesTest.cpp -o %t-Memcmp64BytesTest
 RUN: not %run %t-Memcmp64BytesTest-seed=1 -runs=100   2>&1 | FileCheck %s
+
+RUN: %cpp_compiler -fno-sanitize=address -fno-builtin-memcmp %S/Memcmp64BytesTest.cpp -o %t-NoAsanMemcmp64BytesTest
+RUN: not %run %t-NoAsanMemcmp64BytesTest  -seed=1 -runs=100   2>&1 | FileCheck %s
+
 CHECK: BINGO
Index: compiler-rt/test/fuzzer/memcmp.test
===
--- compiler-rt/test/fuzzer/memcmp.test
+++ compiler-rt/test/fuzzer/memcmp.test
@@ -1,4 +1,11 @@
 UNSUPPORTED: freebsd
 RUN: %cpp_compiler %S/MemcmpTest.cpp -o %t-MemcmpTest
 RUN: not %run %t-MemcmpTest   -seed=1 -runs=1000   2>&1 | FileCheck %s
+
+RUN: %cpp_compiler -fno-sanitize=address -fno-builtin-memcmp %S/MemcmpTest.cpp -o %t-NoAsanMemcmpTest
+RUN: not %run %t-NoAsanMemcmpTest -seed=1 -runs=1000   2>&1 | FileCheck %s
+
+RUN: %cpp_compiler -fno-sanitize=address -fno-builtin-calloc -fno-builtin-memcmp %S/CustomAllocator.cpp %S/MemcmpTest.cpp -o %t-NoAsanCustomAllocatorMemcmpTest
+RUN: not %run %t-NoAsanCustomAllocatorMemcmpTest -seed=1 -runs=1000   2>&1 | FileCheck %s
+
 CHECK: BINGO
Index: compiler-rt/test/fuzzer/custom-allocator.test
===
--- /dev/null
+++ 

[PATCH] D84362: [NFC] Add missing functions to PartialDiagnostic

2020-07-22 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment.

FYI, the patch does not compile:

  In file included from llvm/repo/clang/lib/Parse/ParseStmtAsm.cpp:13:
  In file included from /llvm/repo/clang/include/clang/Parse/Parser.h:24:
  llvm/repo/clang/include/clang/Sema/Sema.h:1833:10: error: use of overloaded 
operator '<<' is ambiguous (with operand types 'const 
clang::Sema::SemaDiagnosticBuilder' and 'clang::QualType')
DB << T;
~~ ^  ~
  llvm/repo/clang/include/clang/AST/Type.h:7144:28: note: candidate function 
[with DiagBuilderT = clang::Sema::SemaDiagnosticBuilder, $1 = nullptr]
  inline const DiagBuilderT <<(const DiagBuilderT , QualType T) {
 ^
  llvm/repo/clang/include/clang/Sema/Sema.h:1508:41: note: candidate function 
[with T = clang::QualType]
  friend const SemaDiagnosticBuilder <<(
  ^
  llvm/repo/clang/include/clang/AST/TemplateBase.h:684:26: note: candidate 
function
  const DiagnosticBuilder <<(const DiagnosticBuilder ,


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

https://reviews.llvm.org/D84362



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


[PATCH] D84364: [CUDA][HIP] Defer all diagnostics for host device functions

2020-07-22 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl created this revision.
yaxunl added a reviewer: tra.
Herald added subscribers: sstefan1, kristof.beyls.
Herald added a reviewer: jdoerfert.

In CUDA/HIP a function may become implicit host device function by
pragma or constexpr. A host device function is checked in both
host and device compilation. However it may be emitted only
on host or device side, therefore the diagnostics should be
deferred until it is known to be emitted.

Currently clang is only able to defer certain diagnostics. This causes
false alarms and limits the usefulness of host device functions.

This patch lets clang defer all diagnostics for host device functions.

It is NFC for other languages.


https://reviews.llvm.org/D84364

Files:
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/AnalysisBasedWarnings.cpp
  clang/lib/Sema/Sema.cpp
  clang/lib/Sema/SemaAttr.cpp
  clang/lib/Sema/SemaCUDA.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaExprObjC.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/Sema/SemaSYCL.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/SemaStmtAsm.cpp
  clang/lib/Sema/SemaTemplateInstantiate.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/lib/Sema/SemaTemplateVariadic.cpp
  clang/lib/Sema/SemaType.cpp
  clang/test/SemaCUDA/asm-constraints-mixed.cu
  clang/test/SemaCUDA/constexpr-variables.cu
  clang/test/SemaCUDA/cxx11-kernel-call.cu
  clang/test/SemaCUDA/exceptions.cu
  clang/test/SemaCUDA/implicit-member-target-inherited.cu
  clang/test/SemaCUDA/lambda.cu
  clang/test/SemaCUDA/no-call-stack-for-immediate-errs.cu
  clang/test/SemaCUDA/union-init.cu
  clang/test/SemaCUDA/usual-deallocators.cu

Index: clang/test/SemaCUDA/usual-deallocators.cu
===
--- clang/test/SemaCUDA/usual-deallocators.cu
+++ clang/test/SemaCUDA/usual-deallocators.cu
@@ -81,9 +81,9 @@
 __host__ __device__ void tests_hd(void *t) {
   test_hd(t);
   test_hd(t);
-  // host-note@-1 {{in instantiation of function template specialization 'test_hd' requested here}}
+  // host-note@-1 {{called by 'tests_hd'}}
   test_hd(t);
-  // device-note@-1 {{in instantiation of function template specialization 'test_hd' requested here}}
+  // device-note@-1 {{called by 'tests_hd'}}
   test_hd(t);
   test_hd(t);
   test_hd(t);
Index: clang/test/SemaCUDA/union-init.cu
===
--- clang/test/SemaCUDA/union-init.cu
+++ clang/test/SemaCUDA/union-init.cu
@@ -1,4 +1,7 @@
-// RUN: %clang_cc1 %s --std=c++11 -triple x86_64-linux-unknown -fsyntax-only -o - -verify
+// RUN: %clang_cc1 %s --std=c++11 -triple x86_64-linux-unknown \
+// RUN:   -fsyntax-only -o - -verify=com,host
+// RUN: %clang_cc1 %s --std=c++11 -triple nvptx -fcuda-is-device \
+// RUN:   -fsyntax-only -o - -verify=com,dev
 
 #include "Inputs/cuda.h"
 
@@ -31,14 +34,14 @@
 
 __device__ B b;
 __device__ C c;
-// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, and __shared__ variables.}}
+// com-error@-1 {{dynamic initialization is not supported for __device__, __constant__, and __shared__ variables.}}
 __device__ D d;
-// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, and __shared__ variables.}}
+// com-error@-1 {{dynamic initialization is not supported for __device__, __constant__, and __shared__ variables.}}
 
 __device__ void foo() {
   __shared__ B b;
   __shared__ C c;
-  // expected-error@-1 {{initialization is not supported for __shared__ variables.}}
+  // com-error@-1 {{initialization is not supported for __shared__ variables.}}
   __shared__ D d;
-  // expected-error@-1 {{initialization is not supported for __shared__ variables.}}
+  // com-error@-1 {{initialization is not supported for __shared__ variables.}}
 }
Index: clang/test/SemaCUDA/no-call-stack-for-immediate-errs.cu
===
--- clang/test/SemaCUDA/no-call-stack-for-immediate-errs.cu
+++ clang/test/SemaCUDA/no-call-stack-for-immediate-errs.cu
@@ -2,11 +2,6 @@
 
 #include "Inputs/cuda.h"
 
-// Here we should dump an error about the VLA in device_fn, but we should not
-// print a callstack indicating how device_fn becomes known-emitted, because
-// it's an error to use a VLA in any __device__ function, even one that doesn't
-// get emitted.
-
 inline __device__ void device_fn(int n);
 inline __device__ void device_fn2() { device_fn(42); }
 
Index: clang/test/SemaCUDA/lambda.cu
===
--- clang/test/SemaCUDA/lambda.cu
+++ clang/test/SemaCUDA/lambda.cu
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify=com %s
+// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify=com,host %s
 // RUN: %clang_cc1 -std=c++17 -fsyntax-only -fcuda-is-device -verify=com,dev %s
 
 #include "Inputs/cuda.h"
Index: clang/test/SemaCUDA/implicit-member-target-inherited.cu

[PATCH] D83592: [Coverage] Add comment to skipped regions

2020-07-22 Thread Vedant Kumar via Phabricator via cfe-commits
vsk added a comment.

@zequanwu I'm not sure whether this is something you've already tried, but for 
frontend changes, it can be helpful to verify that a stage2 clang self-host 
with assertions enabled completes  successfully. For coverage specifically, 
it's possible to do that by setting '-DLLVM_BUILD_INSTRUMENTED_COVERAGE=On' 
during the stage2 cmake step.


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

https://reviews.llvm.org/D83592



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


[PATCH] D84244: [clang] Disable -Wsuggest-override for unittests/

2020-07-22 Thread Logan Smith via Phabricator via cfe-commits
logan-5 added a comment.

In D84244#2167663 , @dblaikie wrote:

> Sometimes it's OK to commit stuff an see how it goes on the buildbots - doing 
> so out of peak times and with the intention of rolling back 
> quickly/immediately if the buildbots report breakage is sometimes the best 
> tool we have (not great, but such is the way of things).


In that case, I've enabled it again using `add_compile_options` instead of 
`add_definitions`. I've got my finger hovering over the button to revert.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84244



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


[clang] 388c9fb - Try enabling -Wsuggest-override again, using add_compile_options instead of add_compile_definitions for disabling it in unittests/ directories.

2020-07-22 Thread Logan Smith via cfe-commits

Author: Logan Smith
Date: 2020-07-22T14:19:34-07:00
New Revision: 388c9fb1af48b059d8b65cb2e002e0992d147aa5

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

LOG: Try enabling -Wsuggest-override again, using add_compile_options instead 
of add_compile_definitions for disabling it in unittests/ directories.

Using add_compile_definitions caused the flag to be passed to rc.exe on Windows 
and thus broke Windows builds.

Added: 


Modified: 
clang-tools-extra/clangd/unittests/CMakeLists.txt
clang-tools-extra/unittests/CMakeLists.txt
clang/unittests/CMakeLists.txt
compiler-rt/cmake/Modules/AddCompilerRT.cmake
compiler-rt/cmake/config-ix.cmake
flang/unittests/CMakeLists.txt
libcxx/CMakeLists.txt
libcxxabi/CMakeLists.txt
lld/unittests/CMakeLists.txt
lldb/unittests/CMakeLists.txt
llvm/cmake/modules/HandleLLVMOptions.cmake
llvm/lib/Testing/Support/CMakeLists.txt
llvm/unittests/CMakeLists.txt
llvm/utils/benchmark/CMakeLists.txt
llvm/utils/unittest/CMakeLists.txt
mlir/unittests/CMakeLists.txt
parallel-libs/acxxel/CMakeLists.txt
polly/unittests/CMakeLists.txt

Removed: 




diff  --git a/clang-tools-extra/clangd/unittests/CMakeLists.txt 
b/clang-tools-extra/clangd/unittests/CMakeLists.txt
index c25e2b7f8103..b4514e95c9e5 100644
--- a/clang-tools-extra/clangd/unittests/CMakeLists.txt
+++ b/clang-tools-extra/clangd/unittests/CMakeLists.txt
@@ -22,6 +22,10 @@ if(CLANG_BUILT_STANDALONE)
   endif()
 endif()
 
+if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
+  add_compile_options("-Wno-suggest-override")
+endif()
+
 if (CLANGD_ENABLE_REMOTE)
   include_directories(${CMAKE_CURRENT_BINARY_DIR}/../index/remote)
   add_definitions(-DGOOGLE_PROTOBUF_NO_RTTI=1)

diff  --git a/clang-tools-extra/unittests/CMakeLists.txt 
b/clang-tools-extra/unittests/CMakeLists.txt
index 086a68e63830..72abe0fa6d0c 100644
--- a/clang-tools-extra/unittests/CMakeLists.txt
+++ b/clang-tools-extra/unittests/CMakeLists.txt
@@ -5,6 +5,10 @@ function(add_extra_unittest test_dirname)
   add_unittest(ExtraToolsUnitTests ${test_dirname} ${ARGN})
 endfunction()
 
+if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
+  add_compile_options("-Wno-suggest-override")
+endif()
+
 add_subdirectory(clang-apply-replacements)
 add_subdirectory(clang-change-namespace)
 add_subdirectory(clang-doc)

diff  --git a/clang/unittests/CMakeLists.txt b/clang/unittests/CMakeLists.txt
index 4c222e24599f..f156372cbc4f 100644
--- a/clang/unittests/CMakeLists.txt
+++ b/clang/unittests/CMakeLists.txt
@@ -10,6 +10,10 @@ if(CLANG_BUILT_STANDALONE)
   endif()
 endif()
 
+if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
+  add_compile_options("-Wno-suggest-override")
+endif()
+
 # add_clang_unittest(test_dirname file1.cpp file2.cpp)
 #
 # Will compile the list of files together and link against the clang

diff  --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake 
b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
index dab55707338a..efb660818270 100644
--- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -403,6 +403,7 @@ set(COMPILER_RT_GMOCK_CFLAGS
 
 append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 
COMPILER_RT_UNITTEST_CFLAGS)
 append_list_if(COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG 
-Wno-covered-switch-default COMPILER_RT_UNITTEST_CFLAGS)
+append_list_if(COMPILER_RT_HAS_WSUGGEST_OVERRIDE_FLAG -Wno-suggest-override 
COMPILER_RT_UNITTEST_CFLAGS)
 
 if(MSVC)
   # gtest use a lot of stuff marked as deprecated on Windows.

diff  --git a/compiler-rt/cmake/config-ix.cmake 
b/compiler-rt/cmake/config-ix.cmake
index f535123351d6..0a27910ed494 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -106,6 +106,7 @@ check_cxx_compiler_flag("-Werror -Wnon-virtual-dtor"   
COMPILER_RT_HAS_WNON_VIRT
 check_cxx_compiler_flag("-Werror -Wvariadic-macros"
COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG)
 check_cxx_compiler_flag("-Werror -Wunused-parameter"   
COMPILER_RT_HAS_WUNUSED_PARAMETER_FLAG)
 check_cxx_compiler_flag("-Werror -Wcovered-switch-default" 
COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG)
+check_cxx_compiler_flag("-Werror -Wsuggest-override"   
COMPILER_RT_HAS_WSUGGEST_OVERRIDE_FLAG)
 check_cxx_compiler_flag(-Wno-pedantic COMPILER_RT_HAS_WNO_PEDANTIC)
 
 check_cxx_compiler_flag(/W4 COMPILER_RT_HAS_W4_FLAG)

diff  --git a/flang/unittests/CMakeLists.txt b/flang/unittests/CMakeLists.txt
index d53d155f2f2b..21da59f3afcb 100644
--- a/flang/unittests/CMakeLists.txt
+++ b/flang/unittests/CMakeLists.txt
@@ -5,6 +5,10 @@ function(add_flang_unittest test_dirname)
   add_unittest(FlangUnitTests ${test_dirname} ${ARGN})
 endfunction()
 
+if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
+  add_compile_options("-Wno-suggest-override")
+endif()
+
 

[clang-tools-extra] 388c9fb - Try enabling -Wsuggest-override again, using add_compile_options instead of add_compile_definitions for disabling it in unittests/ directories.

2020-07-22 Thread Logan Smith via cfe-commits

Author: Logan Smith
Date: 2020-07-22T14:19:34-07:00
New Revision: 388c9fb1af48b059d8b65cb2e002e0992d147aa5

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

LOG: Try enabling -Wsuggest-override again, using add_compile_options instead 
of add_compile_definitions for disabling it in unittests/ directories.

Using add_compile_definitions caused the flag to be passed to rc.exe on Windows 
and thus broke Windows builds.

Added: 


Modified: 
clang-tools-extra/clangd/unittests/CMakeLists.txt
clang-tools-extra/unittests/CMakeLists.txt
clang/unittests/CMakeLists.txt
compiler-rt/cmake/Modules/AddCompilerRT.cmake
compiler-rt/cmake/config-ix.cmake
flang/unittests/CMakeLists.txt
libcxx/CMakeLists.txt
libcxxabi/CMakeLists.txt
lld/unittests/CMakeLists.txt
lldb/unittests/CMakeLists.txt
llvm/cmake/modules/HandleLLVMOptions.cmake
llvm/lib/Testing/Support/CMakeLists.txt
llvm/unittests/CMakeLists.txt
llvm/utils/benchmark/CMakeLists.txt
llvm/utils/unittest/CMakeLists.txt
mlir/unittests/CMakeLists.txt
parallel-libs/acxxel/CMakeLists.txt
polly/unittests/CMakeLists.txt

Removed: 




diff  --git a/clang-tools-extra/clangd/unittests/CMakeLists.txt 
b/clang-tools-extra/clangd/unittests/CMakeLists.txt
index c25e2b7f8103..b4514e95c9e5 100644
--- a/clang-tools-extra/clangd/unittests/CMakeLists.txt
+++ b/clang-tools-extra/clangd/unittests/CMakeLists.txt
@@ -22,6 +22,10 @@ if(CLANG_BUILT_STANDALONE)
   endif()
 endif()
 
+if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
+  add_compile_options("-Wno-suggest-override")
+endif()
+
 if (CLANGD_ENABLE_REMOTE)
   include_directories(${CMAKE_CURRENT_BINARY_DIR}/../index/remote)
   add_definitions(-DGOOGLE_PROTOBUF_NO_RTTI=1)

diff  --git a/clang-tools-extra/unittests/CMakeLists.txt 
b/clang-tools-extra/unittests/CMakeLists.txt
index 086a68e63830..72abe0fa6d0c 100644
--- a/clang-tools-extra/unittests/CMakeLists.txt
+++ b/clang-tools-extra/unittests/CMakeLists.txt
@@ -5,6 +5,10 @@ function(add_extra_unittest test_dirname)
   add_unittest(ExtraToolsUnitTests ${test_dirname} ${ARGN})
 endfunction()
 
+if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
+  add_compile_options("-Wno-suggest-override")
+endif()
+
 add_subdirectory(clang-apply-replacements)
 add_subdirectory(clang-change-namespace)
 add_subdirectory(clang-doc)

diff  --git a/clang/unittests/CMakeLists.txt b/clang/unittests/CMakeLists.txt
index 4c222e24599f..f156372cbc4f 100644
--- a/clang/unittests/CMakeLists.txt
+++ b/clang/unittests/CMakeLists.txt
@@ -10,6 +10,10 @@ if(CLANG_BUILT_STANDALONE)
   endif()
 endif()
 
+if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
+  add_compile_options("-Wno-suggest-override")
+endif()
+
 # add_clang_unittest(test_dirname file1.cpp file2.cpp)
 #
 # Will compile the list of files together and link against the clang

diff  --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake 
b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
index dab55707338a..efb660818270 100644
--- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -403,6 +403,7 @@ set(COMPILER_RT_GMOCK_CFLAGS
 
 append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 
COMPILER_RT_UNITTEST_CFLAGS)
 append_list_if(COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG 
-Wno-covered-switch-default COMPILER_RT_UNITTEST_CFLAGS)
+append_list_if(COMPILER_RT_HAS_WSUGGEST_OVERRIDE_FLAG -Wno-suggest-override 
COMPILER_RT_UNITTEST_CFLAGS)
 
 if(MSVC)
   # gtest use a lot of stuff marked as deprecated on Windows.

diff  --git a/compiler-rt/cmake/config-ix.cmake 
b/compiler-rt/cmake/config-ix.cmake
index f535123351d6..0a27910ed494 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -106,6 +106,7 @@ check_cxx_compiler_flag("-Werror -Wnon-virtual-dtor"   
COMPILER_RT_HAS_WNON_VIRT
 check_cxx_compiler_flag("-Werror -Wvariadic-macros"
COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG)
 check_cxx_compiler_flag("-Werror -Wunused-parameter"   
COMPILER_RT_HAS_WUNUSED_PARAMETER_FLAG)
 check_cxx_compiler_flag("-Werror -Wcovered-switch-default" 
COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG)
+check_cxx_compiler_flag("-Werror -Wsuggest-override"   
COMPILER_RT_HAS_WSUGGEST_OVERRIDE_FLAG)
 check_cxx_compiler_flag(-Wno-pedantic COMPILER_RT_HAS_WNO_PEDANTIC)
 
 check_cxx_compiler_flag(/W4 COMPILER_RT_HAS_W4_FLAG)

diff  --git a/flang/unittests/CMakeLists.txt b/flang/unittests/CMakeLists.txt
index d53d155f2f2b..21da59f3afcb 100644
--- a/flang/unittests/CMakeLists.txt
+++ b/flang/unittests/CMakeLists.txt
@@ -5,6 +5,10 @@ function(add_flang_unittest test_dirname)
   add_unittest(FlangUnitTests ${test_dirname} ${ARGN})
 endfunction()
 
+if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
+  add_compile_options("-Wno-suggest-override")
+endif()
+
 

[PATCH] D83296: [clang-format] Add a MacroExpander.

2020-07-22 Thread Marek Kurdej via Phabricator via cfe-commits
curdeius added inline comments.



Comment at: clang/lib/Format/MacroExpander.cpp:46
+
+  // Parse the token stream and return the corresonding Defintion object.
+  // Returns an empty definition object with a null-Name on error.

Nit: typo "corresponding Definition".



Comment at: clang/lib/Format/MacroExpander.cpp:110
+
+MacroExpander::~MacroExpander() {}
+

Why isn't it defaulted?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83296



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


[PATCH] D84362: [NFC] Add missing functions to PartialDiagnostic

2020-07-22 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl created this revision.
yaxunl added a reviewer: tra.

PartialDiagnostic misses some functions compared to DiagnosticBuilder.

This patch adds missing functions to PartialDiagnostic so that can emit
all diagnostics that can be emitted by DiagnosticBuilder.


https://reviews.llvm.org/D84362

Files:
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/Attr.h
  clang/include/clang/AST/CanonicalType.h
  clang/include/clang/AST/Decl.h
  clang/include/clang/AST/DeclarationName.h
  clang/include/clang/AST/NestedNameSpecifier.h
  clang/include/clang/AST/TemplateBase.h
  clang/include/clang/AST/Type.h
  clang/include/clang/Basic/Diagnostic.h
  clang/include/clang/Basic/PartialDiagnostic.h
  clang/include/clang/Sema/Ownership.h
  clang/include/clang/Sema/ParsedAttr.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/TemplateBase.cpp
  clang/lib/Basic/Diagnostic.cpp

Index: clang/lib/Basic/Diagnostic.cpp
===
--- clang/lib/Basic/Diagnostic.cpp
+++ clang/lib/Basic/Diagnostic.cpp
@@ -40,26 +40,6 @@
 
 using namespace clang;
 
-const DiagnosticBuilder ::operator<<(const DiagnosticBuilder ,
-   DiagNullabilityKind nullability) {
-  StringRef string;
-  switch (nullability.first) {
-  case NullabilityKind::NonNull:
-string = nullability.second ? "'nonnull'" : "'_Nonnull'";
-break;
-
-  case NullabilityKind::Nullable:
-string = nullability.second ? "'nullable'" : "'_Nullable'";
-break;
-
-  case NullabilityKind::Unspecified:
-string = nullability.second ? "'null_unspecified'" : "'_Null_unspecified'";
-break;
-  }
-
-  DB.AddString(string);
-  return DB;
-}
 
 const DiagnosticBuilder ::operator<<(const DiagnosticBuilder ,
llvm::Error &) {
Index: clang/lib/AST/TemplateBase.cpp
===
--- clang/lib/AST/TemplateBase.cpp
+++ clang/lib/AST/TemplateBase.cpp
@@ -26,6 +26,7 @@
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/LangOptions.h"
+#include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/SourceLocation.h"
 #include "llvm/ADT/APSInt.h"
 #include "llvm/ADT/FoldingSet.h"
@@ -448,8 +449,8 @@
   llvm_unreachable("Invalid TemplateArgument Kind!");
 }
 
-const DiagnosticBuilder ::operator<<(const DiagnosticBuilder ,
-   const TemplateArgument ) {
+template 
+static const T (const T , const TemplateArgument ) {
   switch (Arg.getKind()) {
   case TemplateArgument::Null:
 // This is bad, but not as bad as crashing because of argument
@@ -502,6 +503,16 @@
   llvm_unreachable("Invalid TemplateArgument Kind!");
 }
 
+const DiagnosticBuilder ::operator<<(const DiagnosticBuilder ,
+   const TemplateArgument ) {
+  return DiagTemplateArg(DB, Arg);
+}
+
+const PartialDiagnostic ::operator<<(const PartialDiagnostic ,
+   const TemplateArgument ) {
+  return DiagTemplateArg(DB, Arg);
+}
+
 const ASTTemplateArgumentListInfo *
 ASTTemplateArgumentListInfo::Create(const ASTContext ,
 const TemplateArgumentListInfo ) {
Index: clang/lib/AST/ASTContext.cpp
===
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -11164,3 +11164,11 @@
 return DB << Section.Decl;
   return DB << "a prior #pragma section";
 }
+
+const PartialDiagnostic ::
+operator<<(const PartialDiagnostic ,
+   const ASTContext::SectionInfo ) {
+  if (Section.Decl)
+return DB << Section.Decl;
+  return DB << "a prior #pragma section";
+}
Index: clang/include/clang/Sema/ParsedAttr.h
===
--- clang/include/clang/Sema/ParsedAttr.h
+++ clang/include/clang/Sema/ParsedAttr.h
@@ -1040,34 +1040,26 @@
   ExpectedFunctionWithProtoType,
 };
 
-inline const DiagnosticBuilder <<(const DiagnosticBuilder ,
-   const ParsedAttr ) {
+template <
+typename DiagBuilderT,
+typename std::enable_if::type * = nullptr>
+inline const DiagBuilderT <<(const DiagBuilderT ,
+  const ParsedAttr ) {
   DB.AddTaggedVal(reinterpret_cast(At.getAttrName()),
   DiagnosticsEngine::ak_identifierinfo);
   return DB;
 }
 
-inline const PartialDiagnostic <<(const PartialDiagnostic ,
-   const ParsedAttr ) {
-  PD.AddTaggedVal(reinterpret_cast(At.getAttrName()),
-  DiagnosticsEngine::ak_identifierinfo);
-  return PD;
-}
-
-inline const DiagnosticBuilder <<(const DiagnosticBuilder ,
-   const ParsedAttr *At) {
+template <
+typename DiagBuilderT,
+typename std::enable_if::type * = nullptr>
+inline const DiagBuilderT 

[PATCH] D83242: [clang][BPF] support expr with typedef/record type for FIELD_EXISTENCE reloc

2020-07-22 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment.

In D83242#2167721 , @anakryiko wrote:

> After thinking about this a bit more, I think adding a new TYPE_EXISTENCE 
> (instead of FIELD_EXISTENCE) relocation type is the better way to handle 
> this. It would allow Clang to be stricter as to what is passed into 
> FIELD_EXISTENCE (only fields, not types) vs TYPE_EXISTENCE(only types, no 
> fields). It will make it cleaner on libbpf side as well, because the 
> validation and relocation logic is different between handling fields and 
> types. So overall, I think it will be beneficial on every level of the stack 
> to separate them.  I hope it's not too hard to make this change?


Yes. Sounds better to separate them as they handle disjoint patterns. Will make 
the change.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83242



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


[PATCH] D71227: [cuda][hip] Fix function overload resolution in the global initiailizer.

2020-07-22 Thread Michael Liao via Phabricator via cfe-commits
hliao added a comment.

Hi @rsmith, @rjmccall and @tra what's your suggestion to make progress on this 
review?

In D71227#2167596 , @tra wrote:

> Is this patch still actual?


I need to rebase this to the latest trunk. Interrupt with other heavy loads.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71227



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


[clang] 6c18f7d - For PR46800, implement the GCC __builtin_complex builtin.

2020-07-22 Thread Richard Smith via cfe-commits

Author: Richard Smith
Date: 2020-07-22T13:43:10-07:00
New Revision: 6c18f7db73a08f1ae39a76a86b414c5b0c24ee86

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

LOG: For PR46800, implement the GCC __builtin_complex builtin.

glibc's implementation of the CMPLX macro uses it (with -fgnuc-version
set to 4.7 or later).

Added: 
clang/test/CodeGen/builtin-complex.c
clang/test/CodeGen/complex-builtins-3.c

Modified: 
clang/docs/LanguageExtensions.rst
clang/include/clang/Basic/Builtins.def
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Sema/Sema.h
clang/lib/AST/ExprConstant.cpp
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/Sema/DeclSpec.cpp
clang/lib/Sema/SemaChecking.cpp
clang/test/Sema/Float16.c
clang/test/Sema/builtins.c
clang/test/Sema/fp16-sema.c
clang/test/SemaCXX/builtins.cpp

Removed: 
clang/test/CodeGen/complex-builtints.c



diff  --git a/clang/docs/LanguageExtensions.rst 
b/clang/docs/LanguageExtensions.rst
index 06ecc186c7dc..e12bc2ce9633 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -1719,6 +1719,9 @@ This extension also works in C++ mode, as far as that 
goes, but does not apply
 to the C++ ``std::complex``.  (In C++11, list initialization allows the same
 syntax to be used with ``std::complex`` with the same meaning.)
 
+For GCC compatibility, ``__builtin_complex(re, im)`` can also be used to
+construct a complex number from the given real and imaginary components.
+
 Builtin Functions
 =
 

diff  --git a/clang/include/clang/Basic/Builtins.def 
b/clang/include/clang/Basic/Builtins.def
index 1416a64543a4..fb5b7ec22d07 100644
--- a/clang/include/clang/Basic/Builtins.def
+++ b/clang/include/clang/Basic/Builtins.def
@@ -395,6 +395,9 @@ BUILTIN(__builtin_ctanh, "XdXd", "Fne")
 BUILTIN(__builtin_ctanhf, "XfXf", "Fne")
 BUILTIN(__builtin_ctanhl, "XLdXLd", "Fne")
 
+// GCC-compatible C99 CMPLX implementation.
+BUILTIN(__builtin_complex, "v.", "nct")
+
 // FP Comparisons.
 BUILTIN(__builtin_isgreater , "i.", "Fnct")
 BUILTIN(__builtin_isgreaterequal, "i.", "Fnct")

diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 2e0791526aec..adfd4c207da8 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -8148,6 +8148,10 @@ def warn_cast_pointer_from_sel : Warning<
 def warn_function_def_in_objc_container : Warning<
   "function definition inside an Objective-C container is deprecated">,
   InGroup;
+def err_typecheck_call_requires_real_fp : Error<
+  "argument type %0 is not a real floating point type">;
+def err_typecheck_call_
diff erent_arg_types : Error<
+  "arguments are of 
diff erent types%
diff { ($ vs $)|}0,1">;
 
 def warn_cast_calling_conv : Warning<
   "cast between incompatible calling conventions '%0' and '%1'; "

diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 376765dc1138..0721720f7908 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -12172,6 +12172,7 @@ class Sema final {
   bool SemaBuiltinVAStartARMMicrosoft(CallExpr *Call);
   bool SemaBuiltinUnorderedCompare(CallExpr *TheCall);
   bool SemaBuiltinFPClassification(CallExpr *TheCall, unsigned NumArgs);
+  bool SemaBuiltinComplex(CallExpr *TheCall);
   bool SemaBuiltinVSX(CallExpr *TheCall);
   bool SemaBuiltinOSLogFormat(CallExpr *TheCall);
 

diff  --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 5f8ad18c0ed2..d0587cb723bc 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -13281,6 +13281,7 @@ class ComplexExprEvaluator
   bool VisitBinaryOperator(const BinaryOperator *E);
   bool VisitUnaryOperator(const UnaryOperator *E);
   bool VisitInitListExpr(const InitListExpr *E);
+  bool VisitCallExpr(const CallExpr *E);
 };
 } // end anonymous namespace
 
@@ -13749,6 +13750,23 @@ bool ComplexExprEvaluator::VisitInitListExpr(const 
InitListExpr *E) {
   return ExprEvaluatorBaseTy::VisitInitListExpr(E);
 }
 
+bool ComplexExprEvaluator::VisitCallExpr(const CallExpr *E) {
+  switch (E->getBuiltinCallee()) {
+  case Builtin::BI__builtin_complex:
+Result.makeComplexFloat();
+if (!EvaluateFloat(E->getArg(0), Result.FloatReal, Info))
+  return false;
+if (!EvaluateFloat(E->getArg(1), Result.FloatImag, Info))
+  return false;
+return true;
+
+  default:
+break;
+  }
+
+  return ExprEvaluatorBaseTy::VisitCallExpr(E);
+}
+
 
//===--===//
 // Atomic expression evaluation, essentially just handling the 
NonAtomicToAtomic
 // implicit conversion.


[PATCH] D83731: Add Debug Info Size to Symbol Status

2020-07-22 Thread Yifan Shen via Phabricator via cfe-commits
aelitashen updated this revision to Diff 279936.
aelitashen added a comment.

Fix the accidentally removed test contents


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83731

Files:
  clang/tools/clang-format/git-clang-format
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
  lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
  lldb/tools/lldb-vscode/JSONUtils.cpp

Index: lldb/tools/lldb-vscode/JSONUtils.cpp
===
--- lldb/tools/lldb-vscode/JSONUtils.cpp
+++ lldb/tools/lldb-vscode/JSONUtils.cpp
@@ -7,6 +7,8 @@
 //===--===//
 
 #include 
+#include 
+#include 
 
 #include "llvm/ADT/Optional.h"
 #include "llvm/Support/FormatAdapters.h"
@@ -327,6 +329,50 @@
   return llvm::json::Value(std::move(object));
 }
 
+static uint64_t GetDebugInfoSizeInSection(lldb::SBSection section) {
+  uint64_t debug_info_size = 0;
+  llvm::StringRef section_name(section.GetName());
+  if (section_name.startswith(".debug") || section_name.startswith("__debug") ||
+  section_name.startswith(".apple") || section_name.startswith("__apple"))
+debug_info_size += section.GetFileByteSize();
+  size_t num_sub_sections = section.GetNumSubSections();
+  for (size_t i = 0; i < num_sub_sections; i++) {
+debug_info_size +=
+GetDebugInfoSizeInSection(section.GetSubSectionAtIndex(i));
+  }
+  return debug_info_size;
+}
+
+static uint64_t GetDebugInfoSize(lldb::SBModule module) {
+  uint64_t debug_info_size = 0;
+  size_t num_sections = module.GetNumSections();
+  for (size_t i = 0; i < num_sections; i++) {
+debug_info_size += GetDebugInfoSizeInSection(module.GetSectionAtIndex(i));
+  }
+  return debug_info_size;
+}
+
+static std::string ConvertDebugInfoSizeToString(uint64_t debug_info) {
+  std::ostringstream oss;
+  oss << " (";
+  oss << std::fixed << std::setprecision(1);
+
+  if (debug_info < 1024) {
+oss << debug_info << "B";
+  } else if (debug_info < 1024 * 1024) {
+double kb = double(debug_info) / 1024.0;
+oss << kb << "KB";
+  } else if (debug_info < 1024 * 1024 * 1024) {
+double mb = double(debug_info) / (1024.0 * 1024.0);
+oss << mb << "MB";
+  } else {
+double gb = double(debug_info) / (1024.0 * 1024.0 * 1024.0);
+oss << gb << "GB";
+;
+  }
+  oss << ")";
+  return oss.str();
+}
 llvm::json::Value CreateModule(lldb::SBModule ) {
   llvm::json::Object object;
   if (!module.IsValid())
@@ -339,9 +385,15 @@
   std::string module_path(module_path_arr);
   object.try_emplace("path", module_path);
   if (module.GetNumCompileUnits() > 0) {
-object.try_emplace("symbolStatus", "Symbols loaded.");
+std::string symbol_str = "Symbols loaded.";
+uint64_t debug_info = GetDebugInfoSize(module);
+if (debug_info > 0) {
+  symbol_str += ConvertDebugInfoSizeToString(debug_info);
+}
+object.try_emplace("symbolStatus", symbol_str);
 char symbol_path_arr[PATH_MAX];
-module.GetSymbolFileSpec().GetPath(symbol_path_arr, sizeof(symbol_path_arr));
+module.GetSymbolFileSpec().GetPath(symbol_path_arr,
+   sizeof(symbol_path_arr));
 std::string symbol_path(symbol_path_arr);
 object.try_emplace("symbolFilePath", symbol_path);
   } else {
@@ -352,8 +404,9 @@
   object.try_emplace("addressRange", loaded_addr);
   std::string version_str;
   uint32_t version_nums[3];
-  uint32_t num_versions = module.GetVersion(version_nums, sizeof(version_nums)/sizeof(uint32_t));
-  for (uint32_t i=0; ihttps://llvm.org/LICENSE.txt for license information.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-#======#
-
-r"""
-clang-format git integration
-
-
-This file provides a clang-format integration for git. Put it somewhere in your
-path and ensure that it is executable. Then, "git clang-format" will invoke
-clang-format on the changes in current files or a specific commit.
-
-For further details, run:
-git clang-format -h
-
-Requires Python 2.7 or Python 3
-"""
-
-from __future__ import absolute_import, division, print_function
-import argparse
-import collections
-import contextlib
-import errno
-import os
-import re
-import subprocess
-import sys
-
-usage = 'git clang-format [OPTIONS] [] [] [--] [...]'
-
-desc = '''
-If zero or one commits are given, run clang-format on all lines that differ
-between the working directory and , which defaults to HEAD.  Changes are
-only applied to the working directory.
-
-If two commits are given (requires --diff), run clang-format on all lines in the
-second  that differ from the first .
-
-The following git-config settings set the default of the corresponding option:
-  clangFormat.binary
-  clangFormat.commit
-  clangFormat.extensions
-  

[PATCH] D79719: [AIX] Implement AIX special alignment rule about double/long double

2020-07-22 Thread Jason Liu via Phabricator via cfe-commits
jasonliu added a comment.

Thanks. No further comments from me.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79719



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


[PATCH] D84356: [AIX] remote -u from the clang when invoke aix as assembler

2020-07-22 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

remote -> remove


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84356



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


[PATCH] D83004: [UpdateCCTestChecks] Include generated functions if asked

2020-07-22 Thread David Greene via Phabricator via cfe-commits
greened updated this revision to Diff 279932.
greened added a comment.

Updated to move the option into `common.py`.  Also had to rework the output 
loop to account for differences between python 2 and 3.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83004

Files:
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c
  
clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.generated.expected
  
clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.no-generated.expected
  clang/test/utils/update_cc_test_checks/generated-funcs.test
  llvm/utils/UpdateTestChecks/asm.py
  llvm/utils/UpdateTestChecks/common.py
  llvm/utils/update_cc_test_checks.py
  llvm/utils/update_llc_test_checks.py
  llvm/utils/update_test_checks.py

Index: llvm/utils/update_test_checks.py
===
--- llvm/utils/update_test_checks.py
+++ llvm/utils/update_test_checks.py
@@ -137,9 +137,11 @@
   prefix_list.append((check_prefixes, tool_cmd_args))
 
 func_dict = {}
+func_order = {}
 for prefixes, _ in prefix_list:
   for prefix in prefixes:
 func_dict.update({prefix: dict()})
+func_order.update({prefix: []})
 for prefixes, opt_args in prefix_list:
   common.debug('Extracted opt cmd: ' + opt_basename + ' ' + opt_args)
   common.debug('Extracted FileCheck prefixes: ' + str(prefixes))
@@ -147,7 +149,7 @@
   raw_tool_output = common.invoke_tool(args.opt_binary, opt_args, test)
   common.build_function_body_dictionary(
   common.OPT_FUNCTION_RE, common.scrub_body, [],
-  raw_tool_output, prefixes, func_dict, args.verbose,
+  raw_tool_output, prefixes, func_dict, func_order, args.verbose,
   args.function_signature)
 
 is_in_function = False
Index: llvm/utils/update_llc_test_checks.py
===
--- llvm/utils/update_llc_test_checks.py
+++ llvm/utils/update_llc_test_checks.py
@@ -123,10 +123,12 @@
 autogenerated_note = (comment_sym + ADVERT + 'utils/' + script_name)
 
 func_dict = {}
+func_order = {}
 for p in run_list:
   prefixes = p[0]
   for prefix in prefixes:
 func_dict.update({prefix: dict()})
+func_order.update({prefix: []})
 for prefixes, llc_args, triple_in_cmd, march_in_cmd in run_list:
   common.debug('Extracted LLC cmd:', llc_tool, llc_args)
   common.debug('Extracted FileCheck prefixes:', str(prefixes))
@@ -138,7 +140,7 @@
 triple = asm.get_triple_from_march(march_in_cmd)
 
   asm.build_function_body_dictionary_for_triple(args, raw_tool_output,
-  triple, prefixes, func_dict)
+  triple, prefixes, func_dict, func_order)
 
 is_in_function = False
 is_in_function_start = False
Index: llvm/utils/update_cc_test_checks.py
===
--- llvm/utils/update_cc_test_checks.py
+++ llvm/utils/update_cc_test_checks.py
@@ -168,7 +168,8 @@
   return args
 
 
-def get_function_body(args, filename, clang_args, extra_commands, prefixes, triple_in_cmd, func_dict):
+def get_function_body(args, filename, clang_args, extra_commands, prefixes,
+  triple_in_cmd, func_dict, func_order):
   # TODO Clean up duplication of asm/common build_function_body_dictionary
   # Invoke external tool and extract function bodies.
   raw_tool_output = common.invoke_tool(args.clang, clang_args, filename)
@@ -188,7 +189,8 @@
   if '-emit-llvm' in clang_args:
 common.build_function_body_dictionary(
 common.OPT_FUNCTION_RE, common.scrub_body, [],
-raw_tool_output, prefixes, func_dict, args.verbose, args.function_signature)
+raw_tool_output, prefixes, func_dict, func_order, args.verbose,
+args.function_signature)
   else:
 print('The clang command line should include -emit-llvm as asm tests '
   'are discouraged in Clang testsuite.', file=sys.stderr)
@@ -267,15 +269,18 @@
 
 # Execute clang, generate LLVM IR, and extract functions.
 func_dict = {}
+func_order = {}
 for p in run_list:
   prefixes = p[0]
   for prefix in prefixes:
 func_dict.update({prefix: dict()})
+func_order.update({prefix: []})
 for prefixes, clang_args, extra_commands, triple_in_cmd in run_list:
   common.debug('Extracted clang cmd: clang {}'.format(clang_args))
   common.debug('Extracted FileCheck prefixes: {}'.format(prefixes))
 
-  get_function_body(args, filename, clang_args, extra_commands, prefixes, triple_in_cmd, func_dict)
+  get_function_body(args, filename, clang_args, extra_commands, prefixes,
+triple_in_cmd, func_dict, func_order)
 
   # Invoke clang -Xclang -ast-dump=json to get mapping from start lines to
   # mangled names. Forward all clang 

[PATCH] D79719: [AIX] Implement AIX special alignment rule about double/long double

2020-07-22 Thread Xiangling Liao via Phabricator via cfe-commits
Xiangling_L updated this revision to Diff 279930.
Xiangling_L marked 3 inline comments as done.
Xiangling_L added a comment.

Add one more testcase;
Addressed other comments;


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79719

Files:
  clang/include/clang/AST/RecordLayout.h
  clang/include/clang/Basic/TargetInfo.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/RecordLayout.cpp
  clang/lib/AST/RecordLayoutBuilder.cpp
  clang/lib/Basic/Targets/OSTargets.h
  clang/lib/Basic/Targets/PPC.h
  clang/test/Layout/aix-Wpacked-expecting-diagnostics.cpp
  clang/test/Layout/aix-Wpacked-no-diagnostics.cpp
  clang/test/Layout/aix-double-struct-member.cpp
  clang/test/Layout/aix-no-unique-address-with-double.cpp
  clang/test/Layout/aix-pack-attr-on-base.cpp
  clang/test/Layout/aix-power-alignment-typedef.cpp
  clang/test/Layout/aix-virtual-function-and-base-with-double.cpp

Index: clang/test/Layout/aix-virtual-function-and-base-with-double.cpp
===
--- /dev/null
+++ clang/test/Layout/aix-virtual-function-and-base-with-double.cpp
@@ -0,0 +1,112 @@
+// RUN: %clang_cc1 -emit-llvm-only -triple powerpc-ibm-aix-xcoff \
+// RUN: -fdump-record-layouts -fsyntax-only %s | \
+// RUN:   FileCheck --check-prefixes=CHECK,CHECK32 %s
+
+// RUN: %clang_cc1 -emit-llvm-only -triple powerpc64-ibm-aix-xcoff \
+// RUN: -fdump-record-layouts -fsyntax-only %s | \
+// RUN:   FileCheck --check-prefixes=CHECK,CHECK64 %s
+
+namespace test1 {
+struct A {
+  double d1;
+  virtual void boo() {}
+};
+
+struct B {
+  double d2;
+  A a;
+};
+
+struct C : public A {
+  double d3;
+};
+
+int i = sizeof(B);
+int j = sizeof(C);
+
+// CHECK:  *** Dumping AST Record Layout
+// CHECK-NEXT:0 | struct test1::A
+// CHECK-NEXT:0 |   (A vtable pointer)
+// CHECK32-NEXT:  4 |   double d1
+// CHECK32-NEXT:| [sizeof=12, dsize=12, align=4, preferredalign=4,
+// CHECK32-NEXT:|  nvsize=12, nvalign=4, preferrednvalign=4]
+// CHECK64-NEXT:  8 |   double d1
+// CHECK64-NEXT:| [sizeof=16, dsize=16, align=8, preferredalign=8,
+// CHECK64-NEXT:|  nvsize=16, nvalign=8, preferrednvalign=8]
+
+// CHECK:  *** Dumping AST Record Layout
+// CHECK-NEXT:0 | struct test1::B
+// CHECK-NEXT:0 |   double d2
+// CHECK-NEXT:8 |   struct test1::A a
+// CHECK-NEXT:8 | (A vtable pointer)
+// CHECK32-NEXT: 12 | double d1
+// CHECK32-NEXT:| [sizeof=24, dsize=20, align=4, preferredalign=8,
+// CHECK32-NEXT:|  nvsize=20, nvalign=4, preferrednvalign=8]
+// CHECK64-NEXT: 16 | double d1
+// CHECK64-NEXT:| [sizeof=24, dsize=24, align=8, preferredalign=8,
+// CHECK64-NEXT:|  nvsize=24, nvalign=8, preferrednvalign=8]
+
+// CHECK:  *** Dumping AST Record Layout
+// CHECK-NEXT:0 | struct test1::C
+// CHECK-NEXT:0 |   struct test1::A (primary base)
+// CHECK-NEXT:0 | (A vtable pointer)
+// CHECK32-NEXT:  4 | double d1
+// CHECK32-NEXT: 12 |   double d3
+// CHECK32-NEXT:| [sizeof=20, dsize=20, align=4, preferredalign=4,
+// CHECK32-NEXT:|  nvsize=20, nvalign=4, preferrednvalign=4]
+// CHECK64-NEXT:  8 | double d1
+// CHECK64-NEXT: 16 |   double d3
+// CHECK64-NEXT:| [sizeof=24, dsize=24, align=8, preferredalign=8,
+// CHECK64-NEXT:|  nvsize=24, nvalign=8, preferrednvalign=8]
+
+} // namespace test1
+
+namespace test2 {
+struct A {
+  long long l1;
+};
+
+struct B : public virtual A {
+  double d2;
+};
+
+#pragma pack(2)
+struct C : public virtual A {
+  double __attribute__((aligned(4))) d3;
+};
+
+int i = sizeof(B);
+int j = sizeof(C);
+
+// CHECK:  *** Dumping AST Record Layout
+// CHECK-NEXT:0 | struct test2::A
+// CHECK-NEXT:0 |   long long l1
+// CHECK-NEXT:  | [sizeof=8, dsize=8, align=8, preferredalign=8,
+// CHECK-NEXT:  |  nvsize=8, nvalign=8, preferrednvalign=8]
+
+// CHECK:  *** Dumping AST Record Layout
+// CHECK-NEXT:0 | struct test2::B
+// CHECK-NEXT:0 |   (B vtable pointer)
+// CHECK32-NEXT:  4 |   double d2
+// CHECK64-NEXT:  8 |   double d2
+// CHECK-NEXT:   16 |   struct test2::A (virtual base)
+// CHECK-NEXT:   16 | long long l1
+// CHECK-NEXT:  | [sizeof=24, dsize=24, align=8, preferredalign=8,
+// CHECK32-NEXT:|  nvsize=12, nvalign=4, preferrednvalign=4]
+// CHECK64-NEXT:|  nvsize=16, nvalign=8, preferrednvalign=8]
+
+// CHECK:  *** Dumping AST Record Layout
+// CHECK-NEXT:0 | struct test2::C
+// CHECK-NEXT:0 |   (C vtable pointer)
+// CHECK32-NEXT:  4 |   double d3
+// CHECK32-NEXT: 12 |   

[PATCH] D83722: [PowerPC] Add options to control paired vector memops support

2020-07-22 Thread Baptiste Saleil via Phabricator via cfe-commits
bsaleil marked an inline comment as done.
bsaleil added inline comments.



Comment at: llvm/lib/Target/PowerPC/PPC.td:243
+   "32Byte load and store instructions",
+   [FeatureISA3_0]>;
 

amyk wrote:
> Is this supposed to be `FeatureISA3_1`?
We need to keep `FeatureISA3_0` to be able to enable MMA (that depends on this 
feature) with P9 codegen.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83722



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


[PATCH] D79719: [AIX] Implement AIX special alignment rule about double/long double

2020-07-22 Thread Xiangling Liao via Phabricator via cfe-commits
Xiangling_L marked 13 inline comments as done.
Xiangling_L added inline comments.



Comment at: clang/lib/AST/ASTContext.cpp:2418
+
   if (!Target->allowsLargerPreferedTypeAlignment())
 return ABIAlign;

jasonliu wrote:
> Should this if statement go above the `if (const auto *RT = 
> T->getAs()) ` ?
> When Target does not allow larger prefered type alignment, then we should 
> return ABIAlign immediately without going through the RecordType query?
Agree. I will update this.



Comment at: clang/test/Layout/aix-double-struct-member.cpp:2
+// RUN: %clang_cc1 -emit-llvm-only -triple powerpc-ibm-aix-xcoff \
+// RUN: -fdump-record-layouts -fsyntax-only -x c++ %s | \
+// RUN:   FileCheck %s

jasonliu wrote:
> You are not using ` < %s` here. So `-x c++` is redundant?
Yeah, thanks, I will remove it.



Comment at: clang/test/Layout/aix-no-unique-address-with-double.cpp:138
+// CHECK-NEXT:|  nvsize=8, nvalign=4, preferrednvalign=4]
+
+int a = sizeof(Empty);

jasonliu wrote:
> I think this case is interesting and may worth adding too:
> ```
> struct F {
>   [[no_unique_address]] Empty emp, emp2;
>   double d;
> };
> ```
Sure.


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

https://reviews.llvm.org/D79719



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


[PATCH] D79279: Add overloaded versions of builtin mem* functions

2020-07-22 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

You need to add user docs for these builtins.




Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:8917
+
+def err_atomic_type_must_be_lock_free : Error<"_Atomic type must always be 
lock-free, %0 isn't">;
+

I don't know why you're adding a bunch of new diagnostics about _Atomic.



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:636
+  return ArgTy->castAs()->getPointeeType();
+}
+

Since arrays are handled separately now, this is just `getPointeeType()`, but I 
don't know why you need to support ObjC object pointer types here at all.



Comment at: clang/lib/CodeGen/CGExpr.cpp:1070
   // We allow this with ObjC object pointers because of fragile ABIs.
-  assert(E->getType()->isPointerType() ||
+  assert(E->getType()->isPointerType() || E->getType()->isArrayType() ||
  E->getType()->isObjCObjectPointerType());

Why arrays?



Comment at: clang/lib/Sema/SemaChecking.cpp:5446
+return ExprError();
+  clang::Expr *SrcOp = SrcPtr.get();
+

Do you ever write these back into the call?



Comment at: clang/lib/Sema/SemaChecking.cpp:5468
+  bool isAtomic = (DstTy && DstValTy->isAtomicType()) ||
+  (SrcTy && SrcValTy->isAtomicType());
+

You already know that DstTy and SrcTy are non-null here.

Why do you need to support atomic types for these operations anyway?  It just 
seems treacherous and unnecessary.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79279



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


[PATCH] D84356: [AIX] remote -u from the clang when invoke aix as assembler

2020-07-22 Thread Digger via Phabricator via cfe-commits
DiggerLin created this revision.
DiggerLin added reviewers: jasonliu, yuanwu, hubert.reinterpretcast.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84356

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/test/Driver/aix-as.c


Index: clang/test/Driver/aix-as.c
===
--- clang/test/Driver/aix-as.c
+++ clang/test/Driver/aix-as.c
@@ -9,7 +9,6 @@
 // CHECK-AS32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
 // CHECK-AS32: "{{.*}}as{{(.exe)?}}" 
 // CHECK-AS32: "-a32" 
-// CHECK-AS32: "-u" 
 // CHECK-AS32: "-many" 
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit.
@@ -20,7 +19,6 @@
 // CHECK-AS64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" 
"powerpc64-ibm-aix7.1.0.0"
 // CHECK-AS64: "{{.*}}as{{(.exe)?}}" 
 // CHECK-AS64: "-a64" 
-// CHECK-AS64: "-u" 
 // CHECK-AS64: "-many"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. -Xassembler  option. 
@@ -32,7 +30,6 @@
 // CHECK-AS32-Xassembler: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
 // CHECK-AS32-Xassembler: "{{.*}}as{{(.exe)?}}" 
 // CHECK-AS32-Xassembler: "-a32" 
-// CHECK-AS32-Xassembler: "-u" 
 // CHECK-AS32-Xassembler: "-many"
 // CHECK-AS32-Xassembler: "-w"
 
@@ -45,7 +42,6 @@
 // CHECK-AS64-Wa: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" 
"powerpc64-ibm-aix7.1.0.0"
 // CHECK-AS64-Wa: "{{.*}}as{{(.exe)?}}" 
 // CHECK-AS64-Wa: "-a64" 
-// CHECK-AS64-Wa: "-u" 
 // CHECK-AS64-Wa: "-many"
 // CHECK-AS64-Wa: "-v"
 // CHECK-AS64-Wa: "-w"
@@ -60,13 +56,10 @@
 // CHECK-AS32-MultiInput-NOT: warning:
 // CHECK-AS32-MultiInput: "{{.*}}as{{(.exe)?}}"
 // CHECK-AS32-MultiInput: "-a32"
-// CHECK-AS32-MultiInput: "-u"
 // CHECK-AS32-MultiInput: "-many"
 // CHECK-AS32-MultiInput: "{{.*}}as{{(.exe)?}}"
 // CHECK-AS32-MultiInput: "-a32"
-// CHECK-AS32-MultiInput: "-u"
 // CHECK-AS32-MultiInput: "-many"
 // CHECK-AS32-MultiInput: "{{.*}}as{{(.exe)?}}"
 // CHECK-AS32-MultiInput: "-a32"
-// CHECK-AS32-MultiInput: "-u"
 // CHECK-AS32-MultiInput: "-many"
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -44,12 +44,6 @@
 CmdArgs.push_back("-a64");
   }
 
-  // Accept an undefined symbol as an extern so that an error message is not
-  // displayed. Otherwise, undefined symbols are flagged with error messages.
-  // FIXME: This should be removed when the assembly generation from the
-  // compiler is able to write externs properly.
-  CmdArgs.push_back("-u");
-
   // Accept any mixture of instructions.
   // On Power for AIX and Linux, this behaviour matches that of GCC for both 
the
   // user-provided assembler source case and the compiler-produced assembler


Index: clang/test/Driver/aix-as.c
===
--- clang/test/Driver/aix-as.c
+++ clang/test/Driver/aix-as.c
@@ -9,7 +9,6 @@
 // CHECK-AS32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
 // CHECK-AS32: "{{.*}}as{{(.exe)?}}" 
 // CHECK-AS32: "-a32" 
-// CHECK-AS32: "-u" 
 // CHECK-AS32: "-many" 
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit.
@@ -20,7 +19,6 @@
 // CHECK-AS64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
 // CHECK-AS64: "{{.*}}as{{(.exe)?}}" 
 // CHECK-AS64: "-a64" 
-// CHECK-AS64: "-u" 
 // CHECK-AS64: "-many"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. -Xassembler  option. 
@@ -32,7 +30,6 @@
 // CHECK-AS32-Xassembler: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
 // CHECK-AS32-Xassembler: "{{.*}}as{{(.exe)?}}" 
 // CHECK-AS32-Xassembler: "-a32" 
-// CHECK-AS32-Xassembler: "-u" 
 // CHECK-AS32-Xassembler: "-many"
 // CHECK-AS32-Xassembler: "-w"
 
@@ -45,7 +42,6 @@
 // CHECK-AS64-Wa: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
 // CHECK-AS64-Wa: "{{.*}}as{{(.exe)?}}" 
 // CHECK-AS64-Wa: "-a64" 
-// CHECK-AS64-Wa: "-u" 
 // CHECK-AS64-Wa: "-many"
 // CHECK-AS64-Wa: "-v"
 // CHECK-AS64-Wa: "-w"
@@ -60,13 +56,10 @@
 // CHECK-AS32-MultiInput-NOT: warning:
 // CHECK-AS32-MultiInput: "{{.*}}as{{(.exe)?}}"
 // CHECK-AS32-MultiInput: "-a32"
-// CHECK-AS32-MultiInput: "-u"
 // CHECK-AS32-MultiInput: "-many"
 // CHECK-AS32-MultiInput: "{{.*}}as{{(.exe)?}}"
 // CHECK-AS32-MultiInput: "-a32"
-// CHECK-AS32-MultiInput: "-u"
 // CHECK-AS32-MultiInput: "-many"
 // CHECK-AS32-MultiInput: "{{.*}}as{{(.exe)?}}"
 // CHECK-AS32-MultiInput: "-a32"
-// CHECK-AS32-MultiInput: "-u"
 // CHECK-AS32-MultiInput: "-many"
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -44,12 +44,6 @@
 CmdArgs.push_back("-a64");
   }
 
-  // Accept an undefined symbol as an extern so that an error message is not
-  // displayed. 

[PATCH] D83242: [clang][BPF] support expr with typedef/record type for FIELD_EXISTENCE reloc

2020-07-22 Thread Andrii Nakryiko via Phabricator via cfe-commits
anakryiko added a comment.

After thinking about this a bit more, I think adding a new TYPE_EXISTENCE 
(instead of FIELD_EXISTENCE) relocation type is the better way to handle this. 
It would allow Clang to be stricter as to what is passed into FIELD_EXISTENCE 
(only fields, not types) vs TYPE_EXISTENCE(only types, no fields). It will make 
it cleaner on libbpf side as well, because the validation and relocation logic 
is different between handling fields and types. So overall, I think it will be 
beneficial on every level of the stack to separate them.  I hope it's not too 
hard to make this change?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83242



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


[clang] b198de6 - Merge some of the PCH object support with modular codegen

2020-07-22 Thread David Blaikie via cfe-commits

Author: David Blaikie
Date: 2020-07-22T12:46:12-07:00
New Revision: b198de67e0bab462217db50814b1434796fa7caf

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

LOG: Merge some of the PCH object support with modular codegen

I was trying to pick this up a bit when reviewing D48426 (& perhaps D69778) - 
in any case, looks like D48426 added a module level flag that might not be 
needed.

The D48426 implementation worked by setting a module level flag, then code 
generating contents from the PCH a special case in 
ASTContext::DeclMustBeEmitted would be used to delay emitting the definition of 
these functions if they came from a Module with this flag.

This strategy is similar to the one initially implemented for modular codegen 
that was removed in D29901 in favor of the modular decls list and a bit on each 
decl to specify whether it's homed to a module.

One major difference between PCH object support and modular code generation, 
other than the specific list of decls that are homed, is the compilation model: 
MSVC PCH modules are built into the object file for some other source file 
(when compiling that source file /Yc is specified to say "this compilation is 
where the PCH is homed"), whereas modular code generation invokes a separate 
compilation for the PCH alone. So the current modular code generation test of 
to decide if a decl should be emitted "is the module where this decl is 
serialized the current main file" has to be extended (as Lubos did in D69778) 
to also test the command line flag -building-pch-with-obj.

Otherwise the whole thing is basically streamlined down to the modular code 
generation path.

This even offers one extra material improvement compared to the existing 
divergent implementation: Homed functions are not emitted into object files 
that use the pch. Instead at -O0 they are not emitted into the IR at all, and 
at -O1 they are emitted using available_externally (existing functionality 
implemented for modular code generation). The pch-codegen test has been updated 
to reflect this new behavior.

[If possible: I'd love it if we could not have the extra MSVC-style way of 
accessing dllexport-pch-homing, and just do it the modular codegen way, but I 
understand that it might be a limitation of existing build systems. @hans / 
@thakis: Do either of you know if it'd be practical to move to something more 
similar to .pcm handling, where the pch itself is passed to the compilation, 
rather than homed as a side effect of compiling some other source file?]

Reviewers: llunak, hans

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

Added: 


Modified: 
clang/include/clang/AST/ExternalASTSource.h
clang/include/clang/Sema/MultiplexExternalSemaSource.h
clang/include/clang/Serialization/ASTReader.h
clang/include/clang/Serialization/ModuleFile.h
clang/lib/AST/ASTContext.cpp
clang/lib/Sema/MultiplexExternalSemaSource.cpp
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTReaderDecl.cpp
clang/lib/Serialization/ASTWriter.cpp
clang/lib/Serialization/ASTWriterDecl.cpp
clang/test/CodeGen/pch-dllexport.cpp

Removed: 




diff  --git a/clang/include/clang/AST/ExternalASTSource.h 
b/clang/include/clang/AST/ExternalASTSource.h
index def877b91816..caae0770931b 100644
--- a/clang/include/clang/AST/ExternalASTSource.h
+++ b/clang/include/clang/AST/ExternalASTSource.h
@@ -161,10 +161,6 @@ class ExternalASTSource : public 
RefCountedBase {
   /// Retrieve the module that corresponds to the given module ID.
   virtual Module *getModule(unsigned ID) { return nullptr; }
 
-  /// Determine whether D comes from a PCH which was built with a corresponding
-  /// object file.
-  virtual bool DeclIsFromPCHWithObjectFile(const Decl *D) { return false; }
-
   /// Return a descriptor for the corresponding module, if one exists.
   virtual llvm::Optional getSourceDescriptor(unsigned ID);
 

diff  --git a/clang/include/clang/Sema/MultiplexExternalSemaSource.h 
b/clang/include/clang/Sema/MultiplexExternalSemaSource.h
index e94dd5d46871..b54a6283d640 100644
--- a/clang/include/clang/Sema/MultiplexExternalSemaSource.h
+++ b/clang/include/clang/Sema/MultiplexExternalSemaSource.h
@@ -153,8 +153,6 @@ class MultiplexExternalSemaSource : public 
ExternalSemaSource {
   /// Retrieve the module that corresponds to the given module ID.
   Module *getModule(unsigned ID) override;
 
-  bool DeclIsFromPCHWithObjectFile(const Decl *D) override;
-
   /// Perform layout on the given record.
   ///
   /// This routine allows the external AST source to provide an specific

diff  --git a/clang/include/clang/Serialization/ASTReader.h 
b/clang/include/clang/Serialization/ASTReader.h
index 1d5571cd2854..e883eb2f1749 100644
--- 

[PATCH] D83652: Merge some of the PCH object support with modular codegen

2020-07-22 Thread David Blaikie via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb198de67e0ba: Merge some of the PCH object support with 
modular codegen (authored by dblaikie).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83652

Files:
  clang/include/clang/AST/ExternalASTSource.h
  clang/include/clang/Sema/MultiplexExternalSemaSource.h
  clang/include/clang/Serialization/ASTReader.h
  clang/include/clang/Serialization/ModuleFile.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/Sema/MultiplexExternalSemaSource.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTReaderDecl.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/lib/Serialization/ASTWriterDecl.cpp
  clang/test/CodeGen/pch-dllexport.cpp

Index: clang/test/CodeGen/pch-dllexport.cpp
===
--- clang/test/CodeGen/pch-dllexport.cpp
+++ clang/test/CodeGen/pch-dllexport.cpp
@@ -3,13 +3,20 @@
 // RUN: %clang_cc1 -triple i686-pc-win32 -fms-extensions -emit-obj -emit-llvm -include-pch %t -o - %s | FileCheck -check-prefix=PCH %s
 
 // Build PCH with object file, then use it.
-// RUN: %clang_cc1 -triple i686-pc-win32 -fms-extensions -emit-pch -building-pch-with-obj -o %t %s
-// RUN: %clang_cc1 -triple i686-pc-win32 -fms-extensions -emit-obj -emit-llvm -include-pch %t -building-pch-with-obj -o - %s | FileCheck -check-prefix=OBJ %s
-// RUN: %clang_cc1 -triple i686-pc-win32 -fms-extensions -emit-obj -emit-llvm -include-pch %t -o - %s | FileCheck -check-prefix=PCHWITHOBJ %s
+// RUN: %clang_cc1 -triple i686-pc-win32 -O1 -fms-extensions -emit-pch -building-pch-with-obj -o %t %s
+// RUN: %clang_cc1 -triple i686-pc-win32 -O1 -disable-llvm-optzns -fms-extensions -emit-obj -emit-llvm -include-pch %t -building-pch-with-obj -o - %s | FileCheck -check-prefix=OBJ %s
+// RUN: %clang_cc1 -triple i686-pc-win32 -O1 -disable-llvm-optzns -fms-extensions -emit-obj -emit-llvm -include-pch %t -o - %s | FileCheck -check-prefix=PCHWITHOBJ -check-prefix=PCHWITHOBJ-O1 %s
 
 // Check for vars separately to avoid having to reorder the check statements.
+// RUN: %clang_cc1 -triple i686-pc-win32 -O1 -disable-llvm-optzns -fms-extensions -emit-obj -emit-llvm -include-pch %t -o - %s | FileCheck -check-prefix=PCHWITHOBJVARS %s
+
+// Test the PCHWITHOBJ at -O0 where available_externally definitions are not
+// provided:
+// RUN: %clang_cc1 -triple i686-pc-win32 -fms-extensions -emit-pch -building-pch-with-obj -o %t %s
+// RUN: %clang_cc1 -triple i686-pc-win32 -fms-extensions -emit-obj -emit-llvm -include-pch %t -o - %s | FileCheck -check-prefix=PCHWITHOBJ -check-prefix=PCHWITHOBJ-O0 %s
 // RUN: %clang_cc1 -triple i686-pc-win32 -fms-extensions -emit-obj -emit-llvm -include-pch %t -o - %s | FileCheck -check-prefix=PCHWITHOBJVARS %s
 
+
 #ifndef IN_HEADER
 #define IN_HEADER
 
@@ -23,7 +30,8 @@
 inline void __declspec(dllexport) baz() {}
 // OBJ: define weak_odr dso_local dllexport void @"?baz@@YAXXZ"
 // PCH: define weak_odr dso_local dllexport void @"?baz@@YAXXZ"
-// PCHWITHOBJ: define weak_odr dso_local dllexport void @"?baz@@YAXXZ"
+// PCHWITHOBJ-O1: define available_externally dso_local void @"?baz@@YAXXZ"
+// PCHWITHOBJ-O0-NOT: define {{.*}}"?baz@@YAXXZ"
 
 
 struct __declspec(dllexport) S {
Index: clang/lib/Serialization/ASTWriterDecl.cpp
===
--- clang/lib/Serialization/ASTWriterDecl.cpp
+++ clang/lib/Serialization/ASTWriterDecl.cpp
@@ -1031,8 +1031,10 @@
   // that module interface unit, not by its users. (Inline variables are
   // still emitted in module users.)
   ModulesCodegen =
-  (Writer.WritingModule->Kind == Module::ModuleInterfaceUnit &&
-   Writer.Context->GetGVALinkageForVariable(D) == GVA_StrongExternal);
+  (Writer.WritingModule->Kind == Module::ModuleInterfaceUnit ||
+   (D->hasAttr() &&
+Writer.Context->getLangOpts().BuildingPCHWithObjectFile)) &&
+  Writer.Context->GetGVALinkageForVariable(D) == GVA_StrongExternal;
 }
 Record.push_back(ModulesCodegen);
 if (ModulesCodegen)
@@ -2469,7 +2471,10 @@
   Linkage = Writer->Context->GetGVALinkageForFunction(FD);
   ModulesCodegen = *Linkage == GVA_StrongExternal;
 }
-if (Writer->Context->getLangOpts().ModulesCodegen) {
+if (Writer->Context->getLangOpts().ModulesCodegen ||
+(FD->hasAttr() &&
+ Writer->Context->getLangOpts().BuildingPCHWithObjectFile)) {
+
   // Under -fmodules-codegen, codegen is performed for all non-internal,
   // non-always_inline functions, unless they are available elsewhere.
   if (!FD->hasAttr()) {
Index: clang/lib/Serialization/ASTWriter.cpp
===
--- clang/lib/Serialization/ASTWriter.cpp
+++ clang/lib/Serialization/ASTWriter.cpp
@@ -1119,7 +1119,6 @@
   

[PATCH] D84244: [clang] Disable -Wsuggest-override for unittests/

2020-07-22 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

In D84244#2167661 , @logan-5 wrote:

> In D84244#2167625 , @hans wrote:
>
> > I don't really know why this doesn't happen with other warning flags, but I 
> > think it would be better to add flags like this with add_compile_options 
> > rather than add_compile_definitions. I imagine that would prevent it from 
> > reaching rc.exe.
>
>
> That sounds pretty reasonable. Without any way of testing the Windows setup 
> myself though, I don't feel comfortable making that change.


Sometimes it's OK to commit stuff an see how it goes on the buildbots - doing 
so out of peak times and with the intention of rolling back quickly/immediately 
if the buildbots report breakage is sometimes the best tool we have (not great, 
but such is the way of things).

Alternatively @hans might be able to test it for you before that, or have other 
ideas/suggestions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84244



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


[PATCH] D84244: [clang] Disable -Wsuggest-override for unittests/

2020-07-22 Thread Logan Smith via Phabricator via cfe-commits
logan-5 added a comment.

In D84244#2167625 , @hans wrote:

> I don't really know why this doesn't happen with other warning flags, but I 
> think it would be better to add flags like this with add_compile_options 
> rather than add_compile_definitions. I imagine that would prevent it from 
> reaching rc.exe.


That sounds pretty reasonable. Without any way of testing the Windows setup 
myself though, I don't feel comfortable making that change.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84244



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


[PATCH] D84192: [OpenMP5.0] map item can be non-contiguous for target update

2020-07-22 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen added a comment.

In D84192#2167649 , @ABataev wrote:

> In D84192#2167636 , @cchen wrote:
>
> > In D84192#2165522 , @ABataev wrote:
> >
> > > In D84192#2165517 , @cchen wrote:
> > >
> > > > In D84192#2165438 , @ABataev 
> > > > wrote:
> > > >
> > > > > In D84192#2165396 , @cchen 
> > > > > wrote:
> > > > >
> > > > > > In D84192#2165249 , 
> > > > > > @ABataev wrote:
> > > > > >
> > > > > > > In D84192#2165235 , 
> > > > > > > @cchen wrote:
> > > > > > >
> > > > > > > > In D84192#2164885 , 
> > > > > > > > @ABataev wrote:
> > > > > > > >
> > > > > > > > > Also, what about compatibility with declare mapper? Can you 
> > > > > > > > > add tests for it?
> > > > > > > >
> > > > > > > >
> > > > > > > > There's a restriction for map clause that non-contiguous is not 
> > > > > > > > allowed and I guess it also applies to declare mapper.
> > > > > > >
> > > > > > >
> > > > > > > I see that to/from clauses allow to use mappers too:
> > > > > > >
> > > > > > >   to([mapper(mapper-identifier):]locator-list) 
> > > > > > > from([mapper(mapper-identifier):]locator-list
> > > > > > >   
> > > > > >
> > > > > >
> > > > > > I'm confused of how to use 
> > > > > > to([mapper(mapper-identifier):]locator-list) with array section.
> > > > > >  For this case:
> > > > > >
> > > > > >   class C {
> > > > > >   public:
> > > > > > int a;
> > > > > > double b[3][4][5];
> > > > > >   };
> > > > > >  
> > > > > >   #pragma omp declare mapper(id: C s) map(s.a, s.b[0:3][0:4][0:5])
> > > > > >  
> > > > > >   #pragma omp target update from(mapper(id): c)
> > > > > >
> > > > > >
> > > > > > Clang already has a semantic check in from clause when mapper is 
> > > > > > used: "mapper type must be of struct, union or class type".
> > > > > >  So the only item I can put in from clause in the above example is 
> > > > > > `c` and I cannot put c.b[0:2][1:2][0:2] or any even c.b[0:2].
> > > > >
> > > > >
> > > > > Does clang compile your example? If not, shall it be allowed for 
> > > > > to/from clauses or not?
> > > >
> > > >
> > > > Clang can compile my example but the problem is that Clang do not 
> > > > accept something like `#pragma omp target update from(mapper(id): 
> > > > c.b[0:2][1:2][2:2])` (non-contiguous) or even `#pragma omp target 
> > > > update from(mapper(id): c.b[2][1][0:2])` (contiguous).
> > > >  Actually, Clang now only accepts `c` as struct/union/class type in 
> > > > `from(mapper(id): c)`. And the reason for the restriction is from 
> > > > declare mapper directive - "The type must be of struct, union or class 
> > > > type in C and C++".
> > >
> > >
> > > And it is fine. How does it work in declare mapper, the main question? 
> > > Does it support extended array sections format mapoers with maps, to and 
> > > from? Shall it be supported in declare mapper at all?
> >
> >
> > After discussing with @dreachem, my understanding is that it is not 
> > incorrect to not allowing extended/non-contiguous array section to appear 
> > in declare mapper.
> >  For the declare mapper directive, since spec only allows map clause, 
> > extended array section (with stride) or non-contiguous array section are 
> > both not allowed.
> >  For using the mapper in map/to/from clause, if mapping or updating an 
> > array section of type T, where there is a mapper declared for T, then the 
> > mapper needs to apply as if to each element of the array or array section. 
> > Spec is intentionally not sufficiently clear on this for target update so 
> > the semantic check in Clang is not incorrect. Which lead to the fact that I 
> > might not need to support extended/non-contiguous array section for declare 
> > mapper.
>
>
> What exactly is incorrect in clang sema?


I mean "not" incorrect for not allowing extended/non-contiguous array section 
in `to/from([mapper(mapper-identifier):] location-list).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84192



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


[PATCH] D84192: [OpenMP5.0] map item can be non-contiguous for target update

2020-07-22 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added a comment.

In D84192#2167636 , @cchen wrote:

> In D84192#2165522 , @ABataev wrote:
>
> > In D84192#2165517 , @cchen wrote:
> >
> > > In D84192#2165438 , @ABataev 
> > > wrote:
> > >
> > > > In D84192#2165396 , @cchen 
> > > > wrote:
> > > >
> > > > > In D84192#2165249 , @ABataev 
> > > > > wrote:
> > > > >
> > > > > > In D84192#2165235 , @cchen 
> > > > > > wrote:
> > > > > >
> > > > > > > In D84192#2164885 , 
> > > > > > > @ABataev wrote:
> > > > > > >
> > > > > > > > Also, what about compatibility with declare mapper? Can you add 
> > > > > > > > tests for it?
> > > > > > >
> > > > > > >
> > > > > > > There's a restriction for map clause that non-contiguous is not 
> > > > > > > allowed and I guess it also applies to declare mapper.
> > > > > >
> > > > > >
> > > > > > I see that to/from clauses allow to use mappers too:
> > > > > >
> > > > > >   to([mapper(mapper-identifier):]locator-list) 
> > > > > > from([mapper(mapper-identifier):]locator-list
> > > > > >   
> > > > >
> > > > >
> > > > > I'm confused of how to use 
> > > > > to([mapper(mapper-identifier):]locator-list) with array section.
> > > > >  For this case:
> > > > >
> > > > >   class C {
> > > > >   public:
> > > > > int a;
> > > > > double b[3][4][5];
> > > > >   };
> > > > >  
> > > > >   #pragma omp declare mapper(id: C s) map(s.a, s.b[0:3][0:4][0:5])
> > > > >  
> > > > >   #pragma omp target update from(mapper(id): c)
> > > > >
> > > > >
> > > > > Clang already has a semantic check in from clause when mapper is 
> > > > > used: "mapper type must be of struct, union or class type".
> > > > >  So the only item I can put in from clause in the above example is 
> > > > > `c` and I cannot put c.b[0:2][1:2][0:2] or any even c.b[0:2].
> > > >
> > > >
> > > > Does clang compile your example? If not, shall it be allowed for 
> > > > to/from clauses or not?
> > >
> > >
> > > Clang can compile my example but the problem is that Clang do not accept 
> > > something like `#pragma omp target update from(mapper(id): 
> > > c.b[0:2][1:2][2:2])` (non-contiguous) or even `#pragma omp target update 
> > > from(mapper(id): c.b[2][1][0:2])` (contiguous).
> > >  Actually, Clang now only accepts `c` as struct/union/class type in 
> > > `from(mapper(id): c)`. And the reason for the restriction is from declare 
> > > mapper directive - "The type must be of struct, union or class type in C 
> > > and C++".
> >
> >
> > And it is fine. How does it work in declare mapper, the main question? Does 
> > it support extended array sections format mapoers with maps, to and from? 
> > Shall it be supported in declare mapper at all?
>
>
> After discussing with @dreachem, my understanding is that it is not incorrect 
> to not allowing extended/non-contiguous array section to appear in declare 
> mapper.
>  For the declare mapper directive, since spec only allows map clause, 
> extended array section (with stride) or non-contiguous array section are both 
> not allowed.
>  For using the mapper in map/to/from clause, if mapping or updating an array 
> section of type T, where there is a mapper declared for T, then the mapper 
> needs to apply as if to each element of the array or array section. Spec is 
> intentionally not sufficiently clear on this for target update so the 
> semantic check in Clang is not incorrect. Which lead to the fact that I might 
> not need to support extended/non-contiguous array section for declare mapper.


What exactly is incorrect in clang sema?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84192



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


[PATCH] D83645: Bump the default target CPU for i386-freebsd to i686

2020-07-22 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

llvm/utils/git/pre-push.py is recommended for your future commits. I guess `arc 
land` is a bad choice because llvm/llvm-project uses the github community 
version which can't set a pre-receive hook.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83645



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


[PATCH] D84192: [OpenMP5.0] map item can be non-contiguous for target update

2020-07-22 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen added a comment.

In D84192#2165522 , @ABataev wrote:

> In D84192#2165517 , @cchen wrote:
>
> > In D84192#2165438 , @ABataev wrote:
> >
> > > In D84192#2165396 , @cchen wrote:
> > >
> > > > In D84192#2165249 , @ABataev 
> > > > wrote:
> > > >
> > > > > In D84192#2165235 , @cchen 
> > > > > wrote:
> > > > >
> > > > > > In D84192#2164885 , 
> > > > > > @ABataev wrote:
> > > > > >
> > > > > > > Also, what about compatibility with declare mapper? Can you add 
> > > > > > > tests for it?
> > > > > >
> > > > > >
> > > > > > There's a restriction for map clause that non-contiguous is not 
> > > > > > allowed and I guess it also applies to declare mapper.
> > > > >
> > > > >
> > > > > I see that to/from clauses allow to use mappers too:
> > > > >
> > > > >   to([mapper(mapper-identifier):]locator-list) 
> > > > > from([mapper(mapper-identifier):]locator-list
> > > > >   
> > > >
> > > >
> > > > I'm confused of how to use to([mapper(mapper-identifier):]locator-list) 
> > > > with array section.
> > > >  For this case:
> > > >
> > > >   class C {
> > > >   public:
> > > > int a;
> > > > double b[3][4][5];
> > > >   };
> > > >  
> > > >   #pragma omp declare mapper(id: C s) map(s.a, s.b[0:3][0:4][0:5])
> > > >  
> > > >   #pragma omp target update from(mapper(id): c)
> > > >
> > > >
> > > > Clang already has a semantic check in from clause when mapper is used: 
> > > > "mapper type must be of struct, union or class type".
> > > >  So the only item I can put in from clause in the above example is `c` 
> > > > and I cannot put c.b[0:2][1:2][0:2] or any even c.b[0:2].
> > >
> > >
> > > Does clang compile your example? If not, shall it be allowed for to/from 
> > > clauses or not?
> >
> >
> > Clang can compile my example but the problem is that Clang do not accept 
> > something like `#pragma omp target update from(mapper(id): 
> > c.b[0:2][1:2][2:2])` (non-contiguous) or even `#pragma omp target update 
> > from(mapper(id): c.b[2][1][0:2])` (contiguous).
> >  Actually, Clang now only accepts `c` as struct/union/class type in 
> > `from(mapper(id): c)`. And the reason for the restriction is from declare 
> > mapper directive - "The type must be of struct, union or class type in C 
> > and C++".
>
>
> And it is fine. How does it work in declare mapper, the main question? Does 
> it support extended array sections format mapoers with maps, to and from? 
> Shall it be supported in declare mapper at all?


After discussing with @dreachem, my understanding is that it is not incorrect 
to not allowing extended/non-contiguous array section to appear in declare 
mapper.
For the declare mapper directive, since spec only allows map clause, extended 
array section (with stride) or non-contiguous array section are both not 
allowed.
For using the mapper in map/to/from clause, if mapping or updating an array 
section of type T, where there is a mapper declared for T, then the mapper 
needs to apply as if to each element of the array or array section. Spec is 
intentionally not sufficiently clear on this for target update so the semantic 
check in Clang is not incorrect. Which lead to the fact that I might not need 
to support extended/non-contiguous array section for declare mapper.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84192



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


[PATCH] D84244: [clang] Disable -Wsuggest-override for unittests/

2020-07-22 Thread Hans Wennborg via Phabricator via cfe-commits
hans added a comment.

In D84244#2167602 , @logan-5 wrote:

> Thanks for reverting--I agree that that's the right move at this point.
>
> Pretty much totally out my depth here, and I don't have a way of debugging 
> the Windows issue, so I'm not sure how to proceed. I'm tempted to just let 
> this whole thing rest for now and maybe try again sometime in the future.


I don't really know why this doesn't happen with other warning flags, but I 
think it would be better to add flags like this with add_compile_options rather 
than add_compile_definitions. I imagine that would prevent it from reaching 
rc.exe.

> I didn't realize quite how much I was biting off by volunteering to do this. 
> I want to apologize again for all the trouble.

No worries, these things happen. I'd say a lot of the trouble was caused by our 
build system, and also that lack of a good system to try out patches before 
landing.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84244



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


[PATCH] D83592: [Coverage] Add comment to skipped regions

2020-07-22 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

(This was committed within 10 minutes after it was approved. As a large change 
with updates to some sensitive places like clang/Lex/Preprocessor.h, this 
probably should have been waited a bit longer.)


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

https://reviews.llvm.org/D83592



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


[PATCH] D84345: [AMDGPU] Set the default globals address space to 1

2020-07-22 Thread Amy Huang via Phabricator via cfe-commits
akhuang added inline comments.



Comment at: llvm/lib/IR/AutoUpgrade.cpp:4297
+  // address space of 1.
+  if (T.isAMDGPU() && !DL.contains("-G") && !DL.startswith("G")) {
+return DL.empty() ? std::string("G1") : (DL + "-G1").str();

arichardson wrote:
> arsenm wrote:
> > I would expect datalayout upgrades to work by parsing the old string, and 
> > checking the field values inside. I guess directly checking the string 
> > isn't a new problem here
> I agree that would be less error prone. I wonder if there are cases where the 
> old string may fail to parse so you have to do the textual upgrade first. I'm 
> happy to make this change.
> 
> @akhuang is there a reason you used string parsing in D67631? Any objections 
> to changing the code to parse the datalayout and add missing attributes?
I don't think so; parsing the datalayout sounds better to me too. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84345



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


[PATCH] D84244: [clang] Disable -Wsuggest-override for unittests/

2020-07-22 Thread Logan Smith via Phabricator via cfe-commits
logan-5 added a comment.

Thanks for reverting--I agree that that's the right move at this point.

Pretty much totally out my depth here, and I don't have a way of debugging the 
Windows issue, so I'm not sure how to proceed. I'm tempted to just let this 
whole thing rest for now and maybe try again sometime in the future.

I didn't realize quite how much I was biting off by volunteering to do this. I 
want to apologize again for all the trouble.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84244



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


[PATCH] D71227: [cuda][hip] Fix function overload resolution in the global initiailizer.

2020-07-22 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment.

Is this patch still actual?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71227



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


[PATCH] D67833: [OpenMP 5.0] Codegen support to pass user-defined mapper functions to runtime

2020-07-22 Thread Lingda Li via Phabricator via cfe-commits
lildmh added a comment.

I couldn't reproduce this problem because all commands are ignored on my 
machine. Could you send the exact compiling and running commands?
In the IR files you sent me before, any idea where segfault happens?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67833



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


[Differential] D78648: [CMake] Bump CMake minimum version to 3.13.4

2020-07-22 Thread Louis Dionne via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGafa1afd4108d: [CMake] Bump CMake minimum version to 3.13.4 
(authored by ldionne).
Herald added subscribers: llvm-commits, msifontes, sstefan1, jurahul, 
stephenneuendorffer, aartbik.
Herald added projects: MLIR, LLVM.

Changed prior to commit:
  https://reviews.llvm.org/D78648?vs=259300=279101#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78648

Files:
  clang/CMakeLists.txt
  clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt
  compiler-rt/CMakeLists.txt
  compiler-rt/cmake/Modules/CustomLibcxx/CMakeLists.txt
  compiler-rt/lib/builtins/CMakeLists.txt
  flang/CMakeLists.txt
  libclc/CMakeLists.txt
  libcxx/CMakeLists.txt
  libcxx/utils/ci/runtimes/CMakeLists.txt
  libcxxabi/CMakeLists.txt
  libunwind/CMakeLists.txt
  lld/CMakeLists.txt
  lldb/CMakeLists.txt
  lldb/tools/debugserver/CMakeLists.txt
  llvm/CMakeLists.txt
  llvm/docs/CMake.rst
  llvm/docs/CMakePrimer.rst
  llvm/docs/GettingStarted.rst
  llvm/runtimes/CMakeLists.txt
  llvm/utils/benchmark/CMakeLists.txt
  mlir/examples/standalone/CMakeLists.txt
  openmp/CMakeLists.txt
  openmp/cmake/DetectTestCompiler/CMakeLists.txt
  openmp/runtime/cmake/LibompCheckLinkerFlag.cmake
  parallel-libs/CMakeLists.txt
  parallel-libs/acxxel/CMakeLists.txt
  polly/CMakeLists.txt
  pstl/CMakeLists.txt

Index: pstl/CMakeLists.txt
===
--- pstl/CMakeLists.txt
+++ pstl/CMakeLists.txt
@@ -5,7 +5,7 @@
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 #
 #===--===##
-cmake_minimum_required(VERSION 3.4.3)
+cmake_minimum_required(VERSION 3.13.4)
 
 set(PARALLELSTL_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/include/pstl/internal/pstl_config.h")
 file(STRINGS "${PARALLELSTL_VERSION_FILE}" PARALLELSTL_VERSION_SOURCE REGEX "#define _PSTL_VERSION .*$")
Index: polly/CMakeLists.txt
===
--- polly/CMakeLists.txt
+++ polly/CMakeLists.txt
@@ -1,7 +1,7 @@
 # Check if this is a in tree build.
 if (NOT DEFINED LLVM_MAIN_SRC_DIR)
   project(Polly)
-  cmake_minimum_required(VERSION 3.4.3)
+  cmake_minimum_required(VERSION 3.13.4)
 
   # Where is LLVM installed?
   find_package(LLVM CONFIG REQUIRED)
Index: parallel-libs/acxxel/CMakeLists.txt
===
--- parallel-libs/acxxel/CMakeLists.txt
+++ parallel-libs/acxxel/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.13.4)
 
 option(ACXXEL_ENABLE_UNIT_TESTS "enable acxxel unit tests" ON)
 option(ACXXEL_ENABLE_MULTI_DEVICE_UNIT_TESTS "enable acxxel multi-device unit tests" OFF)
Index: parallel-libs/CMakeLists.txt
===
--- parallel-libs/CMakeLists.txt
+++ parallel-libs/CMakeLists.txt
@@ -1 +1 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.13.4)
Index: openmp/runtime/cmake/LibompCheckLinkerFlag.cmake
===
--- openmp/runtime/cmake/LibompCheckLinkerFlag.cmake
+++ openmp/runtime/cmake/LibompCheckLinkerFlag.cmake
@@ -17,7 +17,7 @@
   set(library_source
 "int foo(int a) { return a*a; }")
   set(cmake_source
-"cmake_minimum_required(VERSION 2.8)
+"cmake_minimum_required(VERSION 3.13.4)
  project(foo C)
  set(CMAKE_SHARED_LINKER_FLAGS \"${flag}\")
  add_library(foo SHARED src_to_link.c)")
Index: openmp/cmake/DetectTestCompiler/CMakeLists.txt
===
--- openmp/cmake/DetectTestCompiler/CMakeLists.txt
+++ openmp/cmake/DetectTestCompiler/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.13.4)
 project(DetectTestCompiler C CXX)
 
 include(CheckCCompilerFlag)
Index: openmp/CMakeLists.txt
===
--- openmp/CMakeLists.txt
+++ openmp/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.13.4)
 
 # Add cmake directory to search for custom cmake functions.
 set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
Index: mlir/examples/standalone/CMakeLists.txt
===
--- mlir/examples/standalone/CMakeLists.txt
+++ mlir/examples/standalone/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.13.4)
 
 if(POLICY CMP0068)
   cmake_policy(SET CMP0068 NEW)
Index: llvm/utils/benchmark/CMakeLists.txt
===
--- 

[PATCH] D78648: [CMake] Bump CMake minimum version to 3.13.4

2020-07-22 Thread Louis Dionne via Phabricator via cfe-commits
ldionne added a comment.
Herald added subscribers: llvm-commits, msifontes, sstefan1, jurahul, 
stephenneuendorffer, aartbik.
Herald added projects: MLIR, LLVM.

Okay, the previous patch has landed and no issues have come up, so I'm going to 
move forward with this patch now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78648



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


[PATCH] D78648: [CMake] Bump CMake minimum version to 3.13.4

2020-07-22 Thread Louis Dionne via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGafa1afd4108d: [CMake] Bump CMake minimum version to 3.13.4 
(authored by ldionne).

Changed prior to commit:
  https://reviews.llvm.org/D78648?vs=259300=279895#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78648

Files:
  clang/CMakeLists.txt
  clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt
  compiler-rt/CMakeLists.txt
  compiler-rt/cmake/Modules/CustomLibcxx/CMakeLists.txt
  compiler-rt/lib/builtins/CMakeLists.txt
  flang/CMakeLists.txt
  libclc/CMakeLists.txt
  libcxx/CMakeLists.txt
  libcxx/utils/ci/runtimes/CMakeLists.txt
  libcxxabi/CMakeLists.txt
  libunwind/CMakeLists.txt
  lld/CMakeLists.txt
  lldb/CMakeLists.txt
  lldb/tools/debugserver/CMakeLists.txt
  llvm/CMakeLists.txt
  llvm/docs/CMake.rst
  llvm/docs/CMakePrimer.rst
  llvm/docs/GettingStarted.rst
  llvm/runtimes/CMakeLists.txt
  llvm/utils/benchmark/CMakeLists.txt
  mlir/examples/standalone/CMakeLists.txt
  openmp/CMakeLists.txt
  openmp/cmake/DetectTestCompiler/CMakeLists.txt
  openmp/runtime/cmake/LibompCheckLinkerFlag.cmake
  parallel-libs/CMakeLists.txt
  parallel-libs/acxxel/CMakeLists.txt
  polly/CMakeLists.txt
  pstl/CMakeLists.txt

Index: pstl/CMakeLists.txt
===
--- pstl/CMakeLists.txt
+++ pstl/CMakeLists.txt
@@ -5,7 +5,7 @@
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 #
 #===--===##
-cmake_minimum_required(VERSION 3.4.3)
+cmake_minimum_required(VERSION 3.13.4)
 
 set(PARALLELSTL_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/include/pstl/internal/pstl_config.h")
 file(STRINGS "${PARALLELSTL_VERSION_FILE}" PARALLELSTL_VERSION_SOURCE REGEX "#define _PSTL_VERSION .*$")
Index: polly/CMakeLists.txt
===
--- polly/CMakeLists.txt
+++ polly/CMakeLists.txt
@@ -1,7 +1,7 @@
 # Check if this is a in tree build.
 if (NOT DEFINED LLVM_MAIN_SRC_DIR)
   project(Polly)
-  cmake_minimum_required(VERSION 3.4.3)
+  cmake_minimum_required(VERSION 3.13.4)
 
   # Where is LLVM installed?
   find_package(LLVM CONFIG REQUIRED)
Index: parallel-libs/acxxel/CMakeLists.txt
===
--- parallel-libs/acxxel/CMakeLists.txt
+++ parallel-libs/acxxel/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.13.4)
 
 option(ACXXEL_ENABLE_UNIT_TESTS "enable acxxel unit tests" ON)
 option(ACXXEL_ENABLE_MULTI_DEVICE_UNIT_TESTS "enable acxxel multi-device unit tests" OFF)
Index: parallel-libs/CMakeLists.txt
===
--- parallel-libs/CMakeLists.txt
+++ parallel-libs/CMakeLists.txt
@@ -1 +1 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.13.4)
Index: openmp/runtime/cmake/LibompCheckLinkerFlag.cmake
===
--- openmp/runtime/cmake/LibompCheckLinkerFlag.cmake
+++ openmp/runtime/cmake/LibompCheckLinkerFlag.cmake
@@ -17,7 +17,7 @@
   set(library_source
 "int foo(int a) { return a*a; }")
   set(cmake_source
-"cmake_minimum_required(VERSION 2.8)
+"cmake_minimum_required(VERSION 3.13.4)
  project(foo C)
  set(CMAKE_SHARED_LINKER_FLAGS \"${flag}\")
  add_library(foo SHARED src_to_link.c)")
Index: openmp/cmake/DetectTestCompiler/CMakeLists.txt
===
--- openmp/cmake/DetectTestCompiler/CMakeLists.txt
+++ openmp/cmake/DetectTestCompiler/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.13.4)
 project(DetectTestCompiler C CXX)
 
 include(CheckCCompilerFlag)
Index: openmp/CMakeLists.txt
===
--- openmp/CMakeLists.txt
+++ openmp/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.13.4)
 
 # Add cmake directory to search for custom cmake functions.
 set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
Index: mlir/examples/standalone/CMakeLists.txt
===
--- mlir/examples/standalone/CMakeLists.txt
+++ mlir/examples/standalone/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.13.4)
 
 if(POLICY CMP0068)
   cmake_policy(SET CMP0068 NEW)
Index: llvm/utils/benchmark/CMakeLists.txt
===
--- llvm/utils/benchmark/CMakeLists.txt
+++ llvm/utils/benchmark/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.13.4)
 
 # Tell cmake 3.0+ that it's 

[PATCH] D83004: [UpdateCCTestChecks] Include generated functions if asked

2020-07-22 Thread David Greene via Phabricator via cfe-commits
greened marked an inline comment as done.
greened added inline comments.



Comment at: llvm/utils/update_cc_test_checks.py:133
+  parser.add_argument('--include-generated-funcs', action='store_true',
+  help='Output checks for functions not in source')
   parser.add_argument('tests', nargs='+')

jdoerfert wrote:
> greened wrote:
> > jdoerfert wrote:
> > > greened wrote:
> > > > greened wrote:
> > > > > jdoerfert wrote:
> > > > > > I think this should go into common.py (after D78618). I would also 
> > > > > > make this the default but OK.
> > > > > Yes I suppose it should in case `opt` and friends generate functions. 
> > > > >  I hadn't considered that use-case.
> > > > > 
> > > > > While I would like to make it default unfortunately it would require 
> > > > > updating a bunch of the existing clang tests which doesn't seem too 
> > > > > friendly.  See the patch update comment for details.
> > > > > 
> > > > Just realized it wouldn't necessarily require regeneration of tests, it 
> > > > would just cause regenerated tests to change a lot when they are 
> > > > eventually regenerated.  We should discuss as to whether that's 
> > > > acceptable.  I think for now this should be non-default to at least get 
> > > > the functionality in without disturbing existing users and then we can 
> > > > discuss a separate change to make it default.
> > > > 
> > > > It's also possible we could change how clang orders functions.  I 
> > > > discovered there's a difference in clang 10 vs. 11 in the order 
> > > > functions are output when OpenMP outlining happens.  clang 10 seems to 
> > > > preserve the source order of functions and clang 11 does not.  Perhaps 
> > > > that needs to be fixed as I don't know whether that change was 
> > > > intentional or not.
> > > Best case, without the option the original behavior is preserved. Is that 
> > > not the case?
> > That's right.  I was referring to making this behavior default.  If we do 
> > that, we could clean up the script code a bit but it would mean clang tests 
> > would change pretty dramatically when they are regenerated.  If we fix the 
> > clang output, the test changes wouldn't be so dramatic.
> > 
> > The way clang is behaving now, I would expect any tests that use 
> > `-fopenmp`, have multiple functions with OpenMP regions and use function 
> > prototypes for some of those functions would break given clang's reordering 
> > of function definitions.  Perhaps we don't have any tests like that though.
> We (almost) do not have OpenMP tests with autogenerated test lines. 
> Partially, because we do not test new functions. I would really like this to 
> be available for OpenMP, both in _cc_ and IR tests. If people can opt out of 
> this, especially if the default is "off", the ordering is not a problem 
> (IMHO). With UTC_ARGS we also remember the choice so I really don't see the 
> downside to this being in the common part for all scripts.
I agree it can be in the common part. I'll move it there and will leave it off 
by default so it doesn't disturb existing tests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83004



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


[PATCH] D79719: [AIX] Implement AIX special alignment rule about double/long double

2020-07-22 Thread Jason Liu via Phabricator via cfe-commits
jasonliu added inline comments.



Comment at: clang/lib/AST/ASTContext.cpp:2418
+
   if (!Target->allowsLargerPreferedTypeAlignment())
 return ABIAlign;

Should this if statement go above the `if (const auto *RT = 
T->getAs()) ` ?
When Target does not allow larger prefered type alignment, then we should 
return ABIAlign immediately without going through the RecordType query?



Comment at: clang/lib/AST/RecordLayoutBuilder.cpp:1234
+
+  bool DefaultsToAIXPowerAlignment =
+  Context.getTargetInfo().defaultsToAIXPowerAlignment();

Add const?



Comment at: clang/lib/AST/RecordLayoutBuilder.cpp:1801
+
+  bool DefaultsToAIXPowerAlignment =
+  Context.getTargetInfo().defaultsToAIXPowerAlignment();

const ?



Comment at: clang/lib/Basic/Targets/PPC.h:425
+} else if (Triple.isOSAIX()) {
+  SuitableAlign = 64;
+  LongDoubleWidth = 64;

SuitableAlign is set in line 412 as well. Please consider combining the two 
`if` statements if grouping things together makes code easier to parse.



Comment at: clang/test/Layout/aix-double-struct-member.cpp:2
+// RUN: %clang_cc1 -emit-llvm-only -triple powerpc-ibm-aix-xcoff \
+// RUN: -fdump-record-layouts -fsyntax-only -x c++ %s | \
+// RUN:   FileCheck %s

You are not using ` < %s` here. So `-x c++` is redundant?



Comment at: clang/test/Layout/aix-double-struct-member.cpp:305
+struct A { double x; };
+struct B : A {} b;
+

`b` is not necessary when you take the `sizeof` of B below?



Comment at: clang/test/Layout/aix-no-unique-address-with-double.cpp:138
+// CHECK-NEXT:|  nvsize=8, nvalign=4, preferrednvalign=4]
+
+int a = sizeof(Empty);

I think this case is interesting and may worth adding too:
```
struct F {
  [[no_unique_address]] Empty emp, emp2;
  double d;
};
```



Comment at: clang/test/Layout/aix-power-alignment-typedef.cpp:12
+  double x;
+} c;
+typedef struct C __attribute__((__aligned__(2))) CC;

remove `c` ?



Comment at: clang/test/Layout/aix-power-alignment-typedef.cpp:25
+  Dbl x;
+} a;
+

remove `a`?



Comment at: clang/test/Layout/aix-power-alignment-typedef.cpp:43
+  char x;
+} u;
+

remove `u`? 


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

https://reviews.llvm.org/D79719



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


[PATCH] D83772: [Windows] Fix limit on command line size

2020-07-22 Thread Max Kudryavtsev via Phabricator via cfe-commits
max-kudr accepted this revision.
max-kudr added a comment.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83772



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


[clang] 08b4a50 - [PowerPC][Power10] Fix the Test LSB by Byte (xvtlsbb) Builtins Implementation

2020-07-22 Thread Amy Kwan via cfe-commits

Author: Amy Kwan
Date: 2020-07-22T13:27:05-05:00
New Revision: 08b4a50e39d8b8db17b8eddacba795e99304e418

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

LOG: [PowerPC][Power10] Fix the Test LSB by Byte (xvtlsbb) Builtins 
Implementation

The implementation of the xvtlsbb builtins/intrinsics were not correct as the
intrinsics previously used i1 as an argument type. This patch changes the i1
argument type used in these intrinsics to be i32 instead, as having the second
as an i1 can lead to issues in the backend.

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

Added: 


Modified: 
clang/include/clang/Basic/BuiltinsPPC.def
clang/test/CodeGen/builtins-ppc-p10vector.c
llvm/include/llvm/IR/IntrinsicsPowerPC.td
llvm/lib/Target/PowerPC/PPCInstrPrefix.td
llvm/test/CodeGen/PowerPC/builtins-ppc-p10vsx.ll

Removed: 




diff  --git a/clang/include/clang/Basic/BuiltinsPPC.def 
b/clang/include/clang/Basic/BuiltinsPPC.def
index 5d445c253a85..b74cb8df78ba 100644
--- a/clang/include/clang/Basic/BuiltinsPPC.def
+++ b/clang/include/clang/Basic/BuiltinsPPC.def
@@ -467,7 +467,7 @@ BUILTIN(__builtin_vsx_xxsldwi, "v.", "t")
 
 BUILTIN(__builtin_vsx_xxeval, "V2ULLiV2ULLiV2ULLiV2ULLiIi", "")
 
-BUILTIN(__builtin_vsx_xvtlsbb, "iV16Ucb", "")
+BUILTIN(__builtin_vsx_xvtlsbb, "iV16UcUi", "")
 
 // P10 Vector Permute Extended built-in.
 BUILTIN(__builtin_vsx_xxpermx, "V16UcV16UcV16UcV16UcIi", "")

diff  --git a/clang/test/CodeGen/builtins-ppc-p10vector.c 
b/clang/test/CodeGen/builtins-ppc-p10vector.c
index 4e804fbafb30..0d084c6eed85 100644
--- a/clang/test/CodeGen/builtins-ppc-p10vector.c
+++ b/clang/test/CodeGen/builtins-ppc-p10vector.c
@@ -583,13 +583,13 @@ vector float test_vec_vec_splati_ins_f(void) {
 }
 
 int test_vec_test_lsbb_all_ones(void) {
-  // CHECK: @llvm.ppc.vsx.xvtlsbb(<16 x i8> %{{.+}}, i1 true
+  // CHECK: @llvm.ppc.vsx.xvtlsbb(<16 x i8> %{{.+}}, i32 1
   // CHECK-NEXT: ret i32
   return vec_test_lsbb_all_ones(vuca);
 }
 
 int test_vec_test_lsbb_all_zeros(void) {
-  // CHECK: @llvm.ppc.vsx.xvtlsbb(<16 x i8> %{{.+}}, i1 false
+  // CHECK: @llvm.ppc.vsx.xvtlsbb(<16 x i8> %{{.+}}, i32 0
   // CHECK-NEXT: ret i32
   return vec_test_lsbb_all_zeros(vuca);
 }

diff  --git a/llvm/include/llvm/IR/IntrinsicsPowerPC.td 
b/llvm/include/llvm/IR/IntrinsicsPowerPC.td
index 2abb6b4e55fe..d2d418bc2d64 100644
--- a/llvm/include/llvm/IR/IntrinsicsPowerPC.td
+++ b/llvm/include/llvm/IR/IntrinsicsPowerPC.td
@@ -1069,7 +1069,7 @@ def int_ppc_vsx_xxinsertw :
 [IntrNoMem]>;
 def int_ppc_vsx_xvtlsbb :
   PowerPC_VSX_Intrinsic<"xvtlsbb", [llvm_i32_ty],
-[llvm_v16i8_ty, llvm_i1_ty], [IntrNoMem]>;
+[llvm_v16i8_ty, llvm_i32_ty], [IntrNoMem]>;
 def int_ppc_vsx_xxeval :
   PowerPC_VSX_Intrinsic<"xxeval", [llvm_v2i64_ty],
[llvm_v2i64_ty, llvm_v2i64_ty,

diff  --git a/llvm/lib/Target/PowerPC/PPCInstrPrefix.td 
b/llvm/lib/Target/PowerPC/PPCInstrPrefix.td
index 6bf8475a7947..4c9f9e8bb083 100644
--- a/llvm/lib/Target/PowerPC/PPCInstrPrefix.td
+++ b/llvm/lib/Target/PowerPC/PPCInstrPrefix.td
@@ -1085,7 +1085,7 @@ let Predicates = [IsISA3_1] in {
 (v4i32 (COPY_TO_REGCLASS (XXGENPCVWM $VRB, imm:$IMM), VRRC))>;
   def : Pat<(v2i64 (int_ppc_vsx_xxgenpcvdm v2i64:$VRB, imm:$IMM)),
 (v2i64 (COPY_TO_REGCLASS (XXGENPCVDM $VRB, imm:$IMM), VRRC))>;
-  def : Pat<(i32 (int_ppc_vsx_xvtlsbb v16i8:$XB, -1)),
+  def : Pat<(i32 (int_ppc_vsx_xvtlsbb v16i8:$XB, 1)),
 (EXTRACT_SUBREG (XVTLSBB (COPY_TO_REGCLASS $XB, VSRC)), sub_lt)>;
   def : Pat<(i32 (int_ppc_vsx_xvtlsbb v16i8:$XB, 0)),
 (EXTRACT_SUBREG (XVTLSBB (COPY_TO_REGCLASS $XB, VSRC)), sub_eq)>;

diff  --git a/llvm/test/CodeGen/PowerPC/builtins-ppc-p10vsx.ll 
b/llvm/test/CodeGen/PowerPC/builtins-ppc-p10vsx.ll
index d4e71d18c6eb..2ac1b2b7514b 100644
--- a/llvm/test/CodeGen/PowerPC/builtins-ppc-p10vsx.ll
+++ b/llvm/test/CodeGen/PowerPC/builtins-ppc-p10vsx.ll
@@ -2,11 +2,14 @@
 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
 ; RUN:   -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | \
 ; RUN:   FileCheck %s
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O0 \
+; RUN:   -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | \
+; RUN:   FileCheck %s
 
 ; These test cases aims to test the builtins for the Power10 VSX vector
 ; instructions introduced in ISA 3.1.
 
-declare i32 @llvm.ppc.vsx.xvtlsbb(<16 x i8>, i1)
+declare i32 @llvm.ppc.vsx.xvtlsbb(<16 x i8>, i32)
 
 define signext i32 @test_vec_test_lsbb_all_ones(<16 x i8> %vuca) {
 ; CHECK-LABEL: test_vec_test_lsbb_all_ones:
@@ -17,7 +20,7 @@ define signext i32 

[PATCH] D84291: [PowerPC][Power10] Fix the Test LSB by Byte (xvtlsbb) Builtins Implementation

2020-07-22 Thread Amy Kwan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG08b4a50e39d8: [PowerPC][Power10] Fix the Test LSB by Byte 
(xvtlsbb) Builtins Implementation (authored by amyk).

Changed prior to commit:
  https://reviews.llvm.org/D84291?vs=279698=279897#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84291

Files:
  clang/include/clang/Basic/BuiltinsPPC.def
  clang/test/CodeGen/builtins-ppc-p10vector.c
  llvm/include/llvm/IR/IntrinsicsPowerPC.td
  llvm/lib/Target/PowerPC/PPCInstrPrefix.td
  llvm/test/CodeGen/PowerPC/builtins-ppc-p10vsx.ll


Index: llvm/test/CodeGen/PowerPC/builtins-ppc-p10vsx.ll
===
--- llvm/test/CodeGen/PowerPC/builtins-ppc-p10vsx.ll
+++ llvm/test/CodeGen/PowerPC/builtins-ppc-p10vsx.ll
@@ -2,11 +2,14 @@
 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
 ; RUN:   -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | \
 ; RUN:   FileCheck %s
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O0 \
+; RUN:   -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | \
+; RUN:   FileCheck %s
 
 ; These test cases aims to test the builtins for the Power10 VSX vector
 ; instructions introduced in ISA 3.1.
 
-declare i32 @llvm.ppc.vsx.xvtlsbb(<16 x i8>, i1)
+declare i32 @llvm.ppc.vsx.xvtlsbb(<16 x i8>, i32)
 
 define signext i32 @test_vec_test_lsbb_all_ones(<16 x i8> %vuca) {
 ; CHECK-LABEL: test_vec_test_lsbb_all_ones:
@@ -17,7 +20,7 @@
 ; CHECK-NEXT:extsw r3, r3
 ; CHECK-NEXT:blr
 entry:
-  %0 = tail call i32 @llvm.ppc.vsx.xvtlsbb(<16 x i8> %vuca, i1 1)
+  %0 = tail call i32 @llvm.ppc.vsx.xvtlsbb(<16 x i8> %vuca, i32 1)
   ret i32 %0
 }
 
@@ -30,6 +33,6 @@
 ; CHECK-NEXT:extsw r3, r3
 ; CHECK-NEXT:blr
 entry:
-  %0 = tail call i32 @llvm.ppc.vsx.xvtlsbb(<16 x i8> %vuca, i1 0)
+  %0 = tail call i32 @llvm.ppc.vsx.xvtlsbb(<16 x i8> %vuca, i32 0)
   ret i32 %0
 }
Index: llvm/lib/Target/PowerPC/PPCInstrPrefix.td
===
--- llvm/lib/Target/PowerPC/PPCInstrPrefix.td
+++ llvm/lib/Target/PowerPC/PPCInstrPrefix.td
@@ -1085,7 +1085,7 @@
 (v4i32 (COPY_TO_REGCLASS (XXGENPCVWM $VRB, imm:$IMM), VRRC))>;
   def : Pat<(v2i64 (int_ppc_vsx_xxgenpcvdm v2i64:$VRB, imm:$IMM)),
 (v2i64 (COPY_TO_REGCLASS (XXGENPCVDM $VRB, imm:$IMM), VRRC))>;
-  def : Pat<(i32 (int_ppc_vsx_xvtlsbb v16i8:$XB, -1)),
+  def : Pat<(i32 (int_ppc_vsx_xvtlsbb v16i8:$XB, 1)),
 (EXTRACT_SUBREG (XVTLSBB (COPY_TO_REGCLASS $XB, VSRC)), sub_lt)>;
   def : Pat<(i32 (int_ppc_vsx_xvtlsbb v16i8:$XB, 0)),
 (EXTRACT_SUBREG (XVTLSBB (COPY_TO_REGCLASS $XB, VSRC)), sub_eq)>;
Index: llvm/include/llvm/IR/IntrinsicsPowerPC.td
===
--- llvm/include/llvm/IR/IntrinsicsPowerPC.td
+++ llvm/include/llvm/IR/IntrinsicsPowerPC.td
@@ -1069,7 +1069,7 @@
 [IntrNoMem]>;
 def int_ppc_vsx_xvtlsbb :
   PowerPC_VSX_Intrinsic<"xvtlsbb", [llvm_i32_ty],
-[llvm_v16i8_ty, llvm_i1_ty], [IntrNoMem]>;
+[llvm_v16i8_ty, llvm_i32_ty], [IntrNoMem]>;
 def int_ppc_vsx_xxeval :
   PowerPC_VSX_Intrinsic<"xxeval", [llvm_v2i64_ty],
[llvm_v2i64_ty, llvm_v2i64_ty,
Index: clang/test/CodeGen/builtins-ppc-p10vector.c
===
--- clang/test/CodeGen/builtins-ppc-p10vector.c
+++ clang/test/CodeGen/builtins-ppc-p10vector.c
@@ -583,13 +583,13 @@
 }
 
 int test_vec_test_lsbb_all_ones(void) {
-  // CHECK: @llvm.ppc.vsx.xvtlsbb(<16 x i8> %{{.+}}, i1 true
+  // CHECK: @llvm.ppc.vsx.xvtlsbb(<16 x i8> %{{.+}}, i32 1
   // CHECK-NEXT: ret i32
   return vec_test_lsbb_all_ones(vuca);
 }
 
 int test_vec_test_lsbb_all_zeros(void) {
-  // CHECK: @llvm.ppc.vsx.xvtlsbb(<16 x i8> %{{.+}}, i1 false
+  // CHECK: @llvm.ppc.vsx.xvtlsbb(<16 x i8> %{{.+}}, i32 0
   // CHECK-NEXT: ret i32
   return vec_test_lsbb_all_zeros(vuca);
 }
Index: clang/include/clang/Basic/BuiltinsPPC.def
===
--- clang/include/clang/Basic/BuiltinsPPC.def
+++ clang/include/clang/Basic/BuiltinsPPC.def
@@ -467,7 +467,7 @@
 
 BUILTIN(__builtin_vsx_xxeval, "V2ULLiV2ULLiV2ULLiV2ULLiIi", "")
 
-BUILTIN(__builtin_vsx_xvtlsbb, "iV16Ucb", "")
+BUILTIN(__builtin_vsx_xvtlsbb, "iV16UcUi", "")
 
 // P10 Vector Permute Extended built-in.
 BUILTIN(__builtin_vsx_xxpermx, "V16UcV16UcV16UcV16UcIi", "")


Index: llvm/test/CodeGen/PowerPC/builtins-ppc-p10vsx.ll
===
--- llvm/test/CodeGen/PowerPC/builtins-ppc-p10vsx.ll
+++ llvm/test/CodeGen/PowerPC/builtins-ppc-p10vsx.ll
@@ -2,11 +2,14 @@
 ; RUN: llc -verify-machineinstrs 

[PATCH] D84348: WIP: Add complete id-expression support to syntax trees

2020-07-22 Thread Eduardo Caldas via Phabricator via cfe-commits
eduucaldas added a reviewer: gribozavr2.
eduucaldas marked 6 inline comments as done.
eduucaldas added inline comments.



Comment at: clang/include/clang/Tooling/Syntax/Nodes.h:101-106
+  UnknownNameSpecifier,
+  GlobalNameSpecifier,
+  NamespaceNameSpecifier,
+  TypeNameSpecifier,
+  IdentifierNameSpecifier,
+  TypeWithTemplateNameSpecifier

All of this is ephemeral, we are gonna have just one Name Specifier with a 
PointerUnion.



Comment at: clang/include/clang/Tooling/Syntax/Nodes.h:206-276
+class NameSpecifier : public Tree {
 public:
-  NameSpecifier() : Tree(NodeKind::NameSpecifier) {}
+  NameSpecifier(NodeKind K) : Tree(K) {}
   static bool classof(const Node *N) {
-return N->kind() == NodeKind::NameSpecifier;
+return N->kind() == NodeKind::GlobalNameSpecifier ||
+   N->kind() == NodeKind::TypeNameSpecifier ||
+   N->kind() == NodeKind::NamespaceNameSpecifier ||

(bis) All of this is temporary, we are gonna have just one Name Specifier with 
a PointerUnion.



Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:768-769
-// Get `UnqualifiedId` from `DeclRefExpr`.
-// FIXME: Extract this logic so that it can be used by `MemberExpr`,
-// and other semantic constructs, now it is tied to `DeclRefExpr`.
-if (!S->hasExplicitTemplateArgs()) {

We extracted the logic into `getUnqualifiedSourceRange`



Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:831-850
+  // FIXME: Same logic as DeclRefExpr. How to DRY?
+  SourceRange getUnqualifiedIdSourceRange(DependentScopeDeclRefExpr *S) {
+if (S->hasExplicitTemplateArgs())
+  return SourceRange(S->getNameInfo().getBeginLoc(), S->getRAngleLoc());
+return S->getNameInfo().getSourceRange();
+  }
+

This is the same logic as `DeclRefExpr`! Exacly the same code!
`DependentScopeDeclRefExpr` is important because it enables `T::template S::`



Comment at: clang/lib/Tooling/Syntax/Nodes.cpp:119-130
+  case NodeKind::GlobalNameSpecifier:
+return OS << "GlobalNameSpecifier";
+  case NodeKind::NamespaceNameSpecifier:
+return OS << "NamespaceNameSpecifier";
+  case NodeKind::TypeNameSpecifier:
+return OS << "TypeNameSpecifier";
+  case NodeKind::UnknownNameSpecifier:

(bis) All of this is temporary, we are gonna have just one Name Specifier with 
a PointerUnion.



Comment at: clang/unittests/Tooling/Syntax/TreeTest.cpp:958-964
-struct X {
-  template static void f();
-  template
-  struct Y {
-static void f();
-  };
-};

I noticed that we don't need that as everything is dependent on the template 
anyways


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84348



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


[PATCH] D79279: Add overloaded versions of builtin mem* functions

2020-07-22 Thread JF Bastien via Phabricator via cfe-commits
jfb updated this revision to Diff 279896.
jfb added a comment.

Follow John's suggestions


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79279

Files:
  clang/include/clang/Basic/Builtins.def
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/CodeGen/CGBuilder.h
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/builtin-overloaded-memfns.c
  clang/test/CodeGenObjC/builtin-memfns.m
  clang/test/Sema/builtin-overloaded-memfns.cpp
  clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl
  clang/test/SemaOpenCL/to_addr_builtin.cl

Index: clang/test/SemaOpenCL/to_addr_builtin.cl
===
--- clang/test/SemaOpenCL/to_addr_builtin.cl
+++ clang/test/SemaOpenCL/to_addr_builtin.cl
@@ -15,7 +15,7 @@
   // expected-error@-2{{implicit declaration of function 'to_global' is invalid in OpenCL}}
   // expected-warning@-3{{incompatible integer to pointer conversion assigning to '__global int *__private' from 'int'}}
 #else
-  // expected-error@-5{{invalid number of arguments to function: 'to_global'}}
+  // expected-error@-5{{too many arguments to function call, expected 1, have 2}}
 #endif
 
   int x;
Index: clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl
===
--- clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl
+++ clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl
@@ -10,7 +10,7 @@
   read_pipe(p, );
   read_pipe(p, ptr);
   read_pipe(tmp, p);// expected-error {{first argument to 'read_pipe' must be a pipe type}}
-  read_pipe(p);   // expected-error {{invalid number of arguments to function: 'read_pipe'}}
+  read_pipe(p); // expected-error {{invalid number of arguments to function: 'read_pipe'}}
   read_pipe(p, rid, tmp, ptr);
   read_pipe(p, tmp, tmp, ptr);   // expected-error {{invalid argument type to function 'read_pipe' (expecting 'reserve_id_t' having '__private int')}}
   read_pipe(p, rid, rid, ptr);   // expected-error {{invalid argument type to function 'read_pipe' (expecting 'unsigned int' having '__private reserve_id_t')}}
@@ -39,7 +39,7 @@
   write_pipe(p, );
   write_pipe(p, ptr);
   write_pipe(tmp, p);// expected-error {{first argument to 'write_pipe' must be a pipe type}}
-  write_pipe(p);   // expected-error {{invalid number of arguments to function: 'write_pipe'}}
+  write_pipe(p); // expected-error {{invalid number of arguments to function: 'write_pipe'}}
   write_pipe(p, rid, tmp, ptr);
   write_pipe(p, tmp, tmp, ptr);   // expected-error {{invalid argument type to function 'write_pipe' (expecting 'reserve_id_t' having '__private int')}}
   write_pipe(p, rid, rid, ptr);   // expected-error {{invalid argument type to function 'write_pipe' (expecting 'unsigned int' having '__private reserve_id_t')}}
Index: clang/test/Sema/builtin-overloaded-memfns.cpp
===
--- /dev/null
+++ clang/test/Sema/builtin-overloaded-memfns.cpp
@@ -0,0 +1,222 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only -triple=arm64-unknown-unknown -fms-extensions -DCPY=1
+// RUN: %clang_cc1 %s -verify -fsyntax-only -triple=arm64-unknown-unknown -fms-extensions -DCPY=0
+
+// Test memcpy and memmove with the same code, since they're basically the same constraints.
+#if CPY
+#define MEM(...) __builtin_memcpy_overloaded(__VA_ARGS__)
+#else
+#define MEM(...) __builtin_memmove_overloaded(__VA_ARGS__)
+#endif
+
+#define NULL (void *)0
+#define nullptr __nullptr
+using size_t = __SIZE_TYPE__;
+using sizeless_t = __SVInt8_t;
+using float4 = float __attribute__((ext_vector_type(4)));
+struct Intish {
+  int i;
+};
+struct NotLockFree {
+  char buf[512];
+};
+struct TrivialCpy {
+  char buf[8];
+  TrivialCpy();
+  TrivialCpy(const TrivialCpy &) = default;
+};
+struct NotTrivialCpy {
+  char buf[8];
+  NotTrivialCpy();
+  NotTrivialCpy(const NotTrivialCpy &);
+};
+
+void arg_count() {
+  MEM();   // expected-error {{too few arguments to function call, expected 3, have 0}}
+  MEM(0);  // expected-error {{too few arguments to function call, expected 3, have 1}}
+  MEM(0, 0);   // expected-error {{too few arguments to function call, expected 3, have 2}}
+  MEM(0, 0, 0, 0); // expected-error {{too many arguments to function call, expected 3, have 4}}
+  __builtin_memset_overloaded();   // expected-error {{too few arguments to function call, expected 3, have 0}}
+  __builtin_memset_overloaded(0);  // expected-error {{too few arguments to function call, expected 3, have 1}}
+  __builtin_memset_overloaded(0, 0);   // expected-error {{too few arguments to function call, expected 3, have 2}}
+  

[PATCH] D84244: [clang] Disable -Wsuggest-override for unittests/

2020-07-22 Thread Hans Wennborg via Phabricator via cfe-commits
hans added inline comments.



Comment at: clang/unittests/CMakeLists.txt:14
+if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
+  add_definitions("-Wno-suggest-override")
+endif()

Because it's added as a define, this gets passed to rc.exe in Windows builds, 
which is used for some clang-tools-extra unittest target, which then proceeds 
to fail with:

 fatal error RC1106: invalid option: -o-suggest-override

(See e.g. 
https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket.appspot.com/8874065661026292624/+/steps/package_clang/0/stdout)

I don't know why this doesn't happen to other flags, but I think there's been 
enough fallout from this now that it should be reverted while that's figured 
out. Reverting in 3eec65782575a1284391e447142fd004dd5de4a9.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84244



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


[clang-tools-extra] 3eec657 - Revert "Enable -Wsuggest-override in the LLVM build" and the follow-ups.

2020-07-22 Thread Hans Wennborg via cfe-commits

Author: Hans Wennborg
Date: 2020-07-22T20:23:58+02:00
New Revision: 3eec65782575a1284391e447142fd004dd5de4a9

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

LOG: Revert "Enable -Wsuggest-override in the LLVM build" and the follow-ups.

After lots of follow-up fixes, there are still problems, such as
-Wno-suggest-override getting passed to the Windows Resource Compiler
because it was added with add_definitions in the CMake file.

Rather than piling on another fix, let's revert so this can be re-landed
when there's a proper fix.

This reverts commit 21c0b4c1e8d6a171899b31d072a47dac27258fc5.
This reverts commit 81d68ad27b29b1e6bc93807c6e42b14e9a77eade.
This reverts commit a361aa5249856e333a373df90947dabf34cd6aab.
This reverts commit fa42b7cf2949802ff0b8a63a2e111a2a68711067.
This reverts commit 955f87f947fda3072a69b0b00ca83c1f6a0566f6.
This reverts commit 8b16e45f66e24e4c10e2cea1b70d2b85a7ce64d5.
This reverts commit 308a127a38df3940420b98ff45fc1c17715f.
This reverts commit 274b6b0c7a8b584662595762eaeff57d61c6807f.
This reverts commit 1c7037a2a5576d0bb083db10ad947a8308e61f65.

Added: 


Modified: 
clang-tools-extra/clangd/unittests/CMakeLists.txt
clang-tools-extra/unittests/CMakeLists.txt
clang/unittests/CMakeLists.txt
compiler-rt/cmake/Modules/AddCompilerRT.cmake
compiler-rt/cmake/config-ix.cmake
flang/unittests/CMakeLists.txt
libcxx/CMakeLists.txt
libcxxabi/CMakeLists.txt
lld/unittests/CMakeLists.txt
lldb/unittests/CMakeLists.txt
llvm/cmake/modules/HandleLLVMOptions.cmake
llvm/lib/Testing/Support/CMakeLists.txt
llvm/unittests/CMakeLists.txt
llvm/utils/benchmark/CMakeLists.txt
llvm/utils/unittest/CMakeLists.txt
mlir/unittests/CMakeLists.txt
parallel-libs/acxxel/CMakeLists.txt
polly/unittests/CMakeLists.txt

Removed: 




diff  --git a/clang-tools-extra/clangd/unittests/CMakeLists.txt 
b/clang-tools-extra/clangd/unittests/CMakeLists.txt
index 8a4a0fb37fc6..c25e2b7f8103 100644
--- a/clang-tools-extra/clangd/unittests/CMakeLists.txt
+++ b/clang-tools-extra/clangd/unittests/CMakeLists.txt
@@ -22,10 +22,6 @@ if(CLANG_BUILT_STANDALONE)
   endif()
 endif()
 
-if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
-  add_definitions("-Wno-suggest-override")
-endif()
-
 if (CLANGD_ENABLE_REMOTE)
   include_directories(${CMAKE_CURRENT_BINARY_DIR}/../index/remote)
   add_definitions(-DGOOGLE_PROTOBUF_NO_RTTI=1)

diff  --git a/clang-tools-extra/unittests/CMakeLists.txt 
b/clang-tools-extra/unittests/CMakeLists.txt
index 751827cd2a0f..086a68e63830 100644
--- a/clang-tools-extra/unittests/CMakeLists.txt
+++ b/clang-tools-extra/unittests/CMakeLists.txt
@@ -5,10 +5,6 @@ function(add_extra_unittest test_dirname)
   add_unittest(ExtraToolsUnitTests ${test_dirname} ${ARGN})
 endfunction()
 
-if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
-  add_definitions("-Wno-suggest-override")
-endif()
-
 add_subdirectory(clang-apply-replacements)
 add_subdirectory(clang-change-namespace)
 add_subdirectory(clang-doc)

diff  --git a/clang/unittests/CMakeLists.txt b/clang/unittests/CMakeLists.txt
index 64168f44f843..4c222e24599f 100644
--- a/clang/unittests/CMakeLists.txt
+++ b/clang/unittests/CMakeLists.txt
@@ -10,10 +10,6 @@ if(CLANG_BUILT_STANDALONE)
   endif()
 endif()
 
-if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
-  add_definitions("-Wno-suggest-override")
-endif()
-
 # add_clang_unittest(test_dirname file1.cpp file2.cpp)
 #
 # Will compile the list of files together and link against the clang

diff  --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake 
b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
index efb660818270..dab55707338a 100644
--- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -403,7 +403,6 @@ set(COMPILER_RT_GMOCK_CFLAGS
 
 append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 
COMPILER_RT_UNITTEST_CFLAGS)
 append_list_if(COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG 
-Wno-covered-switch-default COMPILER_RT_UNITTEST_CFLAGS)
-append_list_if(COMPILER_RT_HAS_WSUGGEST_OVERRIDE_FLAG -Wno-suggest-override 
COMPILER_RT_UNITTEST_CFLAGS)
 
 if(MSVC)
   # gtest use a lot of stuff marked as deprecated on Windows.

diff  --git a/compiler-rt/cmake/config-ix.cmake 
b/compiler-rt/cmake/config-ix.cmake
index 0a27910ed494..f535123351d6 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -106,7 +106,6 @@ check_cxx_compiler_flag("-Werror -Wnon-virtual-dtor"   
COMPILER_RT_HAS_WNON_VIRT
 check_cxx_compiler_flag("-Werror -Wvariadic-macros"
COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG)
 check_cxx_compiler_flag("-Werror -Wunused-parameter"   
COMPILER_RT_HAS_WUNUSED_PARAMETER_FLAG)
 check_cxx_compiler_flag("-Werror -Wcovered-switch-default" 

[clang] 3eec657 - Revert "Enable -Wsuggest-override in the LLVM build" and the follow-ups.

2020-07-22 Thread Hans Wennborg via cfe-commits

Author: Hans Wennborg
Date: 2020-07-22T20:23:58+02:00
New Revision: 3eec65782575a1284391e447142fd004dd5de4a9

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

LOG: Revert "Enable -Wsuggest-override in the LLVM build" and the follow-ups.

After lots of follow-up fixes, there are still problems, such as
-Wno-suggest-override getting passed to the Windows Resource Compiler
because it was added with add_definitions in the CMake file.

Rather than piling on another fix, let's revert so this can be re-landed
when there's a proper fix.

This reverts commit 21c0b4c1e8d6a171899b31d072a47dac27258fc5.
This reverts commit 81d68ad27b29b1e6bc93807c6e42b14e9a77eade.
This reverts commit a361aa5249856e333a373df90947dabf34cd6aab.
This reverts commit fa42b7cf2949802ff0b8a63a2e111a2a68711067.
This reverts commit 955f87f947fda3072a69b0b00ca83c1f6a0566f6.
This reverts commit 8b16e45f66e24e4c10e2cea1b70d2b85a7ce64d5.
This reverts commit 308a127a38df3940420b98ff45fc1c17715f.
This reverts commit 274b6b0c7a8b584662595762eaeff57d61c6807f.
This reverts commit 1c7037a2a5576d0bb083db10ad947a8308e61f65.

Added: 


Modified: 
clang-tools-extra/clangd/unittests/CMakeLists.txt
clang-tools-extra/unittests/CMakeLists.txt
clang/unittests/CMakeLists.txt
compiler-rt/cmake/Modules/AddCompilerRT.cmake
compiler-rt/cmake/config-ix.cmake
flang/unittests/CMakeLists.txt
libcxx/CMakeLists.txt
libcxxabi/CMakeLists.txt
lld/unittests/CMakeLists.txt
lldb/unittests/CMakeLists.txt
llvm/cmake/modules/HandleLLVMOptions.cmake
llvm/lib/Testing/Support/CMakeLists.txt
llvm/unittests/CMakeLists.txt
llvm/utils/benchmark/CMakeLists.txt
llvm/utils/unittest/CMakeLists.txt
mlir/unittests/CMakeLists.txt
parallel-libs/acxxel/CMakeLists.txt
polly/unittests/CMakeLists.txt

Removed: 




diff  --git a/clang-tools-extra/clangd/unittests/CMakeLists.txt 
b/clang-tools-extra/clangd/unittests/CMakeLists.txt
index 8a4a0fb37fc6..c25e2b7f8103 100644
--- a/clang-tools-extra/clangd/unittests/CMakeLists.txt
+++ b/clang-tools-extra/clangd/unittests/CMakeLists.txt
@@ -22,10 +22,6 @@ if(CLANG_BUILT_STANDALONE)
   endif()
 endif()
 
-if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
-  add_definitions("-Wno-suggest-override")
-endif()
-
 if (CLANGD_ENABLE_REMOTE)
   include_directories(${CMAKE_CURRENT_BINARY_DIR}/../index/remote)
   add_definitions(-DGOOGLE_PROTOBUF_NO_RTTI=1)

diff  --git a/clang-tools-extra/unittests/CMakeLists.txt 
b/clang-tools-extra/unittests/CMakeLists.txt
index 751827cd2a0f..086a68e63830 100644
--- a/clang-tools-extra/unittests/CMakeLists.txt
+++ b/clang-tools-extra/unittests/CMakeLists.txt
@@ -5,10 +5,6 @@ function(add_extra_unittest test_dirname)
   add_unittest(ExtraToolsUnitTests ${test_dirname} ${ARGN})
 endfunction()
 
-if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
-  add_definitions("-Wno-suggest-override")
-endif()
-
 add_subdirectory(clang-apply-replacements)
 add_subdirectory(clang-change-namespace)
 add_subdirectory(clang-doc)

diff  --git a/clang/unittests/CMakeLists.txt b/clang/unittests/CMakeLists.txt
index 64168f44f843..4c222e24599f 100644
--- a/clang/unittests/CMakeLists.txt
+++ b/clang/unittests/CMakeLists.txt
@@ -10,10 +10,6 @@ if(CLANG_BUILT_STANDALONE)
   endif()
 endif()
 
-if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
-  add_definitions("-Wno-suggest-override")
-endif()
-
 # add_clang_unittest(test_dirname file1.cpp file2.cpp)
 #
 # Will compile the list of files together and link against the clang

diff  --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake 
b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
index efb660818270..dab55707338a 100644
--- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -403,7 +403,6 @@ set(COMPILER_RT_GMOCK_CFLAGS
 
 append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 
COMPILER_RT_UNITTEST_CFLAGS)
 append_list_if(COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG 
-Wno-covered-switch-default COMPILER_RT_UNITTEST_CFLAGS)
-append_list_if(COMPILER_RT_HAS_WSUGGEST_OVERRIDE_FLAG -Wno-suggest-override 
COMPILER_RT_UNITTEST_CFLAGS)
 
 if(MSVC)
   # gtest use a lot of stuff marked as deprecated on Windows.

diff  --git a/compiler-rt/cmake/config-ix.cmake 
b/compiler-rt/cmake/config-ix.cmake
index 0a27910ed494..f535123351d6 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -106,7 +106,6 @@ check_cxx_compiler_flag("-Werror -Wnon-virtual-dtor"   
COMPILER_RT_HAS_WNON_VIRT
 check_cxx_compiler_flag("-Werror -Wvariadic-macros"
COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG)
 check_cxx_compiler_flag("-Werror -Wunused-parameter"   
COMPILER_RT_HAS_WUNUSED_PARAMETER_FLAG)
 check_cxx_compiler_flag("-Werror -Wcovered-switch-default" 

[PATCH] D83660: [analyzer] Fix a crash for dereferencing an empty llvm::Optional variable in SMTConstraintManager.h.

2020-07-22 Thread Valeriy Savchenko via Phabricator via cfe-commits
vsavchenko added a comment.

In D83660#2167391 , @NoQ wrote:

> In D83660#2166917 , @steakhal wrote:
>
> > Although I'm not the most experienced one here, I think it's good to go.
>
>
> Let's wait for the test to be added, sounds like it's close.
>
> (@OikawaKirie, you can use delta debugging tools like `creduce` or `delta` to 
> automatically write test cases for crashes)


+1 for the test.  It's not like we don't trust the fix, it is pretty obvious.  
However, it would be good to cover it for the future because it might help with 
tests around this area of code.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83660



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


[PATCH] D84348: WIP: Add complete id-expression support to syntax trees

2020-07-22 Thread Eduardo Caldas via Phabricator via cfe-commits
eduucaldas created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84348

Files:
  clang/include/clang/Tooling/Syntax/Nodes.h
  clang/lib/Tooling/Syntax/BuildTree.cpp
  clang/lib/Tooling/Syntax/Nodes.cpp
  clang/unittests/Tooling/Syntax/TreeTest.cpp

Index: clang/unittests/Tooling/Syntax/TreeTest.cpp
===
--- clang/unittests/Tooling/Syntax/TreeTest.cpp
+++ clang/unittests/Tooling/Syntax/TreeTest.cpp
@@ -867,24 +867,47 @@
   }
   EXPECT_TRUE(treeDumpEqual(
   R"cpp(
-namespace a {
+namespace n {
   struct S {
 template
-static T f(){}
+struct TS {
+  static void f();
+};
   };
 }
+template
+struct TS {
+  struct S {
+template
+static U f();
+  };
+};
 void test() {
-  ::  // global-namespace-specifier
-  a:: // namespace-specifier
-  S:: // type-name-specifier
+  :: // global-namespace-specifier
+  n::// namespace-specifier
+  S::// type-name-specifier
+  template TS:: // type-template-instantiation-specifier
+  f();
+
+  n::// namespace-specifier
+  S::// type-name-specifier
+  TS::  // type-template-instantiation-specifier
+  f();
+
+  TS:: // type-name-specifier
+  S::   // type-name-specifier
   f();
+
+  TS:: // type-name-specifier
+  S::   // type-name-specifier
+  template f();
 }
 )cpp",
   R"txt(
 *: TranslationUnit
 |-NamespaceDefinition
 | |-namespace
-| |-a
+| |-n
 | |-{
 | |-SimpleDeclaration
 | | |-struct
@@ -898,19 +921,58 @@
 | | | | `-T
 | | | |->
 | | | `-SimpleDeclaration
-| | |   |-static
-| | |   |-T
-| | |   |-SimpleDeclarator
-| | |   | |-f
-| | |   | `-ParametersAndQualifiers
-| | |   |   |-(
-| | |   |   `-)
-| | |   `-CompoundStatement
-| | | |-{
-| | | `-}
+| | |   |-struct
+| | |   |-TS
+| | |   |-{
+| | |   |-SimpleDeclaration
+| | |   | |-static
+| | |   | |-void
+| | |   | |-SimpleDeclarator
+| | |   | | |-f
+| | |   | | `-ParametersAndQualifiers
+| | |   | |   |-(
+| | |   | |   `-)
+| | |   | `-;
+| | |   |-}
+| | |   `-;
 | | |-}
 | | `-;
 | `-}
+|-TemplateDeclaration
+| |-template
+| |-<
+| |-UnknownDeclaration
+| | |-typename
+| | `-T
+| |->
+| `-SimpleDeclaration
+|   |-struct
+|   |-TS
+|   |-{
+|   |-SimpleDeclaration
+|   | |-struct
+|   | |-S
+|   | |-{
+|   | |-TemplateDeclaration
+|   | | |-template
+|   | | |-<
+|   | | |-UnknownDeclaration
+|   | | | |-typename
+|   | | | `-U
+|   | | |->
+|   | | `-SimpleDeclaration
+|   | |   |-static
+|   | |   |-U
+|   | |   |-SimpleDeclarator
+|   | |   | |-f
+|   | |   | `-ParametersAndQualifiers
+|   | |   |   |-(
+|   | |   |   `-)
+|   | |   `-;
+|   | |-}
+|   | `-;
+|   |-}
+|   `-;
 `-SimpleDeclaration
   |-void
   |-SimpleDeclarator
@@ -924,14 +986,82 @@
 | |-UnknownExpression
 | | |-IdExpression
 | | | |-NestedNameSpecifier
-| | | | |-NameSpecifier
+| | | | |-GlobalNameSpecifier
+| | | | | `-::
+| | | | |-NamespaceNameSpecifier
+| | | | | |-n
+| | | | | `-::
+| | | | |-TypeNameSpecifier
+| | | | | |-S
+| | | | | `-::
+| | | | `-TypeWithTemplateNameSpecifier
+| | | |   |-template
+| | | |   |-TS
+| | | |   |-<
+| | | |   |-int
+| | | |   |->
+| | | |   `-::
+| | | `-UnqualifiedId
+| | |   `-f
+| | |-(
+| | `-)
+| `-;
+|-ExpressionStatement
+| |-UnknownExpression
+| | |-IdExpression
+| | | |-NestedNameSpecifier
+| | | | |-NamespaceNameSpecifier
+| | | | | |-n
+| | | | | `-::
+| | | | |-TypeNameSpecifier
+| | | | | |-S
+| | | | | `-::
+| | | | `-TypeNameSpecifier
+| | | |   |-TS
+| | | |   |-<
+| | | |   |-int
+| | | |   |->
+| | | |   `-::
+| | | `-UnqualifiedId
+| | |   `-f
+| | |-(
+| | `-)
+| `-;
+|-ExpressionStatement
+| |-UnknownExpression
+| | |-IdExpression
+| | | |-NestedNameSpecifier
+| | | | |-TypeNameSpecifier
+| | | | | |-TS
+| | | | | |-<
+| | | | | |-int
+| | | | | |->
 | | | | | `-::
-| | | | |-NameSpecifier
-| | | | | |-a
+| | | | `-TypeNameSpecifier
+| | | |   |-S
+| | | |   `-::
+| | | `-UnqualifiedId
+| | |   |-f
+| | |   |-<
+| | |   |-int
+| | |   `->
+| | |-(
+| | `-)
+| `-;
+|-ExpressionStatement
+| |-UnknownExpression
+| | |-IdExpression
+| | | |-NestedNameSpecifier
+| | | | |-TypeNameSpecifier
+| | | | | |-TS
+| | | | | |-<
+| | | | | |-int
+| | | | | |->
 | | | | | `-::
-| | | | `-NameSpecifier
+| | | | `-TypeNameSpecifier
 | | | |   |-S
 | | | |   `-::
+| | | |-template
 | | | `-UnqualifiedId
 | | |   |-f
 | | |   |-<
@@ -944,7 +1074,7 @@
 )txt"));
 }
 
-TEST_P(SyntaxTreeTest, 

[clang-tools-extra] 1c7037a - [clangd] Disable -Wsuggest-override for unittests/

2020-07-22 Thread Logan Smith via cfe-commits

Author: Logan Smith
Date: 2020-07-22T10:49:09-07:00
New Revision: 1c7037a2a5576d0bb083db10ad947a8308e61f65

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

LOG: [clangd] Disable -Wsuggest-override for unittests/

Added: 


Modified: 
clang-tools-extra/clangd/unittests/CMakeLists.txt

Removed: 




diff  --git a/clang-tools-extra/clangd/unittests/CMakeLists.txt 
b/clang-tools-extra/clangd/unittests/CMakeLists.txt
index c25e2b7f8103..8a4a0fb37fc6 100644
--- a/clang-tools-extra/clangd/unittests/CMakeLists.txt
+++ b/clang-tools-extra/clangd/unittests/CMakeLists.txt
@@ -22,6 +22,10 @@ if(CLANG_BUILT_STANDALONE)
   endif()
 endif()
 
+if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
+  add_definitions("-Wno-suggest-override")
+endif()
+
 if (CLANGD_ENABLE_REMOTE)
   include_directories(${CMAKE_CURRENT_BINARY_DIR}/../index/remote)
   add_definitions(-DGOOGLE_PROTOBUF_NO_RTTI=1)



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


[PATCH] D84345: [AMDGPU] Set the default globals address space to 1

2020-07-22 Thread Alexander Richardson via Phabricator via cfe-commits
arichardson marked an inline comment as done.
arichardson added a subscriber: akhuang.
arichardson added inline comments.



Comment at: llvm/lib/IR/AutoUpgrade.cpp:4297
+  // address space of 1.
+  if (T.isAMDGPU() && !DL.contains("-G") && !DL.startswith("G")) {
+return DL.empty() ? std::string("G1") : (DL + "-G1").str();

arsenm wrote:
> I would expect datalayout upgrades to work by parsing the old string, and 
> checking the field values inside. I guess directly checking the string isn't 
> a new problem here
I agree that would be less error prone. I wonder if there are cases where the 
old string may fail to parse so you have to do the textual upgrade first. I'm 
happy to make this change.

@akhuang is there a reason you used string parsing in D67631? Any objections to 
changing the code to parse the datalayout and add missing attributes?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84345



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


[PATCH] D83660: [analyzer] Fix a crash for dereferencing an empty llvm::Optional variable in SMTConstraintManager.h.

2020-07-22 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

In D83660#2166917 , @steakhal wrote:

> Although I'm not the most experienced one here, I think it's good to go.


Let's wait for the test to be added, sounds like it's close.

(@OikawaKirie, you can use delta debugging tools like `creduce` or `delta` to 
automatically write test cases for crashes)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83660



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


  1   2   3   >