[libclc] r365728 - Creating release candidate rc4 from release_801 branch

2019-07-10 Thread Tom Stellard via cfe-commits
Author: tstellar
Date: Wed Jul 10 19:58:32 2019
New Revision: 365728

URL: http://llvm.org/viewvc/llvm-project?rev=365728=rev
Log:
Creating release candidate rc4 from release_801 branch

Added:
libclc/tags/RELEASE_801/rc4/
  - copied from r365727, libclc/branches/release_80/

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


[libunwind] r365728 - Creating release candidate rc4 from release_801 branch

2019-07-10 Thread Tom Stellard via cfe-commits
Author: tstellar
Date: Wed Jul 10 19:58:32 2019
New Revision: 365728

URL: http://llvm.org/viewvc/llvm-project?rev=365728=rev
Log:
Creating release candidate rc4 from release_801 branch

Added:
libunwind/tags/RELEASE_801/rc4/
  - copied from r365727, libunwind/branches/release_80/

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


r365727 - Increase the number of parser diagnostics.

2019-07-10 Thread Richard Trieu via cfe-commits
Author: rtrieu
Date: Wed Jul 10 19:54:15 2019
New Revision: 365727

URL: http://llvm.org/viewvc/llvm-project?rev=365727=rev
Log:
Increase the number of parser diagnostics.

The reserved range for parser diagnostics is getting close to being filled,
so increase the space for them.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticIDs.h

Modified: cfe/trunk/include/clang/Basic/DiagnosticIDs.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticIDs.h?rev=365727=365726=365727=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticIDs.h (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticIDs.h Wed Jul 10 19:54:15 2019
@@ -32,7 +32,7 @@ namespace clang {
   DIAG_SIZE_FRONTEND  =  150,
   DIAG_SIZE_SERIALIZATION =  120,
   DIAG_SIZE_LEX   =  400,
-  DIAG_SIZE_PARSE =  500,
+  DIAG_SIZE_PARSE =  600,
   DIAG_SIZE_AST   =  200,
   DIAG_SIZE_COMMENT   =  100,
   DIAG_SIZE_CROSSTU   =  100,


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


[PATCH] D64482: [Driver] Define _FILE_OFFSET_BITS=64 on Solaris

2019-07-10 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

In D64482#1578376 , @ro wrote:

> In D64482#1578245 , @MaskRay wrote:
>
> > > There's one caveat: gcc defines _LARGEFILE_SOURCE and _LARGEFILE64_SOURCE 
> > > for C++ only, while clang has long been doing it for all languages
> >
> > Can you explain more about the hack 
> > https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=0f97ccfdccc033f543ccbcb220697e62e84bf01f
>
>
> No hack at all ;-)  See the patch submission 
> https://gcc.gnu.org/ml/gcc-patches/2018-06/msg01320.html for details.  Apart 
> from that,
>  this is the direction libstdc++/g++ mean to take in general.


Honestly I find such enforced C/C++ difference very unfortunate... e.g.

  if (Opts.CPlusPlus)
Builder.defineMacro("_GNU_SOURCE");

Solaris seems the only exception that defines these Large File Support 
extension macros on the compiler driver side. Isn't it possible to do it in a 
common system header file?

That rationale will be better than this paragraph in the description:

> make check-all currently fails on x86_64-pc-solaris2.11 when building with 
> GCC 9:

With the current description, a casual reader (like I) would just think this 
patch is probably not doing things at the correct layer.


Repository:
  rC Clang

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

https://reviews.llvm.org/D64482



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


[PATCH] D64538: [Driver] Don't escape backslashes on Windows

2019-07-10 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

In D64538#1579632 , @smeenai wrote:

> I'm not fully understanding this. If the .sh file was generated on Windows, 
> it'll contain backslashes in any arguments that are paths, right? Before this 
> change, those backslashes would have been doubled up, but the backslash still 
> wouldn't work as a path separator on Linux, so those arguments would need 
> manual adjustment. I guess the other case that matters is if you have a 
> backslash in an argument which isn't a path, in which case the old behavior 
> was definitely correct and the new one definitely isn't.


At least in Chromium, users pass flags like 
`-DFOO_EXPORT="__declspec(dllexport)"`. I can't remember a concrete instance 
where a user passed non-path flags with backslashes in them, but you could 
imagine a hypothetical argument like: `-DSOME_STRING="foo \"bar baz\""`, and if 
we don't escape those backslashes, the argument will be tokenized incorrectly. 
I guess that example is an objection to this part of the comment:

>   // double quotes only when it's followed by $, `, ", \, or a literal 
> newline;
>   // the last three are disallowed in paths on Windows and the first two are
>   // unlikely, so this shouldn't cause issues in practice. Note that we always

I can also imagine tokenization going wrong if some inconsequential path ends 
in a trailing backslash: `-fdebug-compilation-dir=C:\foo\bar\` -> 
`"-fdebug-compilation-dir=C:\foo\bar\"`

I like what we do now because it's safe and handles the general case of 
backslashes in flags without any gotchas or corner cases. If the specific issue 
that we have is that driver tests are hard to write because of the variance in 
path printing, driver testing could already be greatly improved by adding a 
filecheck-friendly version of -###, so we should do that anyway.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64538



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


[PATCH] D64277: [X86][PowerPC] Support -mlong-double-128

2019-07-10 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

Ping:) It'll be great to have D64277  
(-mlong-double-128) D64282  (libcall) D64283 
 (-mabi=ieeelongdouble) before 9.0.0 is 
branched.


Repository:
  rC Clang

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

https://reviews.llvm.org/D64277



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


[PATCH] D64283: [PowerPC] Support -mabi=ieeelongdouble and -mabi=ibmlongdouble

2019-07-10 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay updated this revision to Diff 209114.
MaskRay added a comment.

Make -mabi=ieeelongdouble a pure CC1 option so that we can simplify the -mabi= 
loop


Repository:
  rC Clang

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

https://reviews.llvm.org/D64283

Files:
  include/clang/Basic/LangOptions.def
  include/clang/Driver/CC1Options.td
  lib/Basic/Targets/PPC.cpp
  lib/Driver/ToolChains/Clang.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/ppc64-long-double.cpp
  test/Driver/ppc-abi.c

Index: test/Driver/ppc-abi.c
===
--- test/Driver/ppc-abi.c
+++ test/Driver/ppc-abi.c
@@ -66,4 +66,22 @@
 // CHECK-ELFv2-PIC: "-mrelocation-model" "pic" "-pic-level" "2"
 // CHECK-ELFv2-PIC: "-target-abi" "elfv2"
 
+// Check -mabi=ieeelongdouble is passed through but it does not change -target-abi.
+// RUN: %clang -target powerpc64le-linux-gnu %s -mabi=ieeelongdouble -mabi=elfv1 -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-ELFv1-IEEE %s
+// RUN: %clang -target powerpc64le-linux-gnu %s -mabi=elfv1 -mabi=ieeelongdouble -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-ELFv1-IEEE %s
+// RUN: %clang -target powerpc64le-linux-gnu %s -mabi=elfv2 -mabi=elfv1 -mabi=ibmlongdouble -mabi=ieeelongdouble -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-ELFv1-IEEE %s
 
+// CHECK-ELFv1-IEEE: "-mabi=ieeelongdouble"
+// CHECK-ELFv1-IEEE: "-target-abi" "elfv1"
+
+// Check -mabi=ibmlongdouble is the default.
+// RUN: %clang -target powerpc64le-linux-gnu %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-ELFv2-IBM128 %s
+// RUN: %clang -target powerpc64le-linux-gnu %s -mabi=ibmlongdouble -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-ELFv2-IBM128 %s
+
+// CHECK-ELFv2-IBM128-NOT: "-mabi=ieeelongdouble"
+// CHECK-ELFv2-IBM128: "-target-abi" "elfv2"
Index: test/CodeGen/ppc64-long-double.cpp
===
--- test/CodeGen/ppc64-long-double.cpp
+++ test/CodeGen/ppc64-long-double.cpp
@@ -3,6 +3,14 @@
 // RUN: %clang_cc1 -triple powerpc64-linux-gnu -emit-llvm -o - %s -mlong-double-64 | \
 // RUN:   FileCheck --check-prefix=FP64 %s
 
+// musl defaults to -mlong-double-64, so -mlong-double-128 is needed to make
+// -mabi=ieeelongdouble effective.
+// RUN: %clang_cc1 -triple powerpc64-linux-musl -emit-llvm -o - %s -mlong-double-128 \
+// RUN:   -mabi=ieeelongdouble | FileCheck --check-prefix=FP128 %s
+// RUN: %clang_cc1 -triple powerpc64-linux-gnu -emit-llvm -o - %s \
+// RUN:   -mabi=ieeelongdouble | FileCheck --check-prefix=FP128 %s
+
+// IBM extended double is the default.
 // RUN: %clang_cc1 -triple powerpc64-linux-gnu -emit-llvm -o - %s | \
 // RUN:   FileCheck --check-prefix=IBM128 %s
 // RUN: %clang_cc1 -triple powerpc64-linux-musl -emit-llvm -o - -mlong-double-128 %s | \
@@ -13,10 +21,13 @@
 
 // FP64: @x = global double {{.*}}, align 8
 // FP64: @size = global i32 8
+// FP128: @x = global fp128 {{.*}}, align 16
+// FP128: @size = global i32 16
 // IBM128: @x = global ppc_fp128 {{.*}}, align 16
 // IBM128: @size = global i32 16
 
 long double foo(long double d) { return d; }
 
 // FP64: double @_Z3fooe(double %d)
+// FP128: fp128 @_Z3foou9__ieee128(fp128 %d)
 // IBM128: ppc_fp128 @_Z3foog(ppc_fp128 %d)
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -2745,6 +2745,7 @@
   Opts.LongDoubleSize = Args.hasArg(OPT_mlong_double_128)
 ? 128
 : Args.hasArg(OPT_mlong_double_64) ? 64 : 0;
+  Opts.PPCIEEELongDouble = Args.hasArg(OPT_mabi_EQ_ieeelongdouble);
   Opts.PICLevel = getLastArgIntValue(Args, OPT_pic_level, 0, Diags);
   Opts.ROPI = Args.hasArg(OPT_fropi);
   Opts.RWPI = Args.hasArg(OPT_frwpi);
Index: lib/Driver/ToolChains/Clang.cpp
===
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -1808,12 +1808,21 @@
   break;
 }
 
-  if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ))
-// The ppc64 linux abis are all "altivec" abis by default. Accept and ignore
-// the option if given as we don't have backend support for any targets
-// that don't use the altivec abi.
-if (StringRef(A->getValue()) != "altivec")
+  bool IEEELongDouble = false;
+  for (const Arg *A : Args.filtered(options::OPT_mabi_EQ)) {
+StringRef V = A->getValue();
+if (V == "ieeelongdouble")
+  IEEELongDouble = true;
+else if (V == "ibmlongdouble")
+  IEEELongDouble = false;
+else if (V != "altivec")
+  // The ppc64 linux abis are all "altivec" abis by default. Accept and ignore
+  // the option if given as we don't have backend support for any targets
+  // that don't use the altivec abi.
   ABIName = A->getValue();
+  }
+  if (IEEELongDouble)
+

[PATCH] D64526: [NFC] Unforget a colon in a few CHECK: directives.

2019-07-10 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment.

I didn't know spaces are not allowed between "CHECK" and ":". CodeGen tests 
LGTM.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D64526



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


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

2019-07-10 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment.

@jdoerfert Thanks for comments. I will submit another patch to add adequate 
tests for clang frontend as you suggested.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D61809



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


LLVM buildmaster will be updated and restarted tonight

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

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

Thanks

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


[PATCH] D64294: [Driver] Consolidate shouldUseFramePointer() and shouldUseLeafFramePointer()

2019-07-10 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay marked 5 inline comments as done.
MaskRay added inline comments.



Comment at: lib/Driver/ToolChains/Clang.cpp:579
 
-static bool shouldUseFramePointer(const ArgList ,
-  const llvm::Triple ) {
-  if (Arg *A = Args.getLastArg(options::OPT_fno_omit_frame_pointer,
-   options::OPT_fomit_frame_pointer))
-return A->getOption().matches(options::OPT_fno_omit_frame_pointer) ||
-   mustUseNonLeafFramePointerForTarget(Triple);
-
-  if (Args.hasArg(options::OPT_pg))
-return true;
-
-  return useFramePointerForTargetByDefault(Args, Triple);
-}
-
-static bool shouldUseLeafFramePointer(const ArgList ,
-  const llvm::Triple ) {
-  if (Arg *A = Args.getLastArg(options::OPT_mno_omit_leaf_frame_pointer,
-   options::OPT_momit_leaf_frame_pointer))
-return A->getOption().matches(options::OPT_mno_omit_leaf_frame_pointer);
-
-  if (Args.hasArg(options::OPT_pg))
-return true;
-
-  if (Triple.isPS4CPU())
-return false;
-
-  return useFramePointerForTargetByDefault(Args, Triple);
+static FramePointerKind getFramePointerKind(const ArgList ,
+const llvm::Triple ) {

ychen wrote:
> `getFramePointerKind` -> `decideFramePointerKind` / 
> `determineFramePointerKind` ? 
This is a pure function. I think it is fine to use `get`. This is also 
consistent with several other `get*` in this file.



Comment at: lib/Driver/ToolChains/Clang.cpp:585
+  (A && A->getOption().matches(options::OPT_fno_omit_frame_pointer)) ||
+  (!(A && A->getOption().matches(options::OPT_fomit_frame_pointer)) &&
+   (Args.hasArg(options::OPT_pg) ||

ychen wrote:
> MaskRay wrote:
> > ychen wrote:
> > > It looks better if  `frame_pointer` is represented using tri-state. 
> > > Something like this?
> > > 
> > > It would be great to have comments for conditions that are not obvious 
> > > such as the overriding rules.
> > > 
> > > ```
> > >   // There are three states for frame_pointer.
> > >   enum class FpFlag {true, false, none};
> > >   FpFlag FPF = FpFlag::none;
> > >   if (Arg *A = Args.getLastArg(options::OPT_fomit_frame_pointer,
> > >options::OPT_fno_omit_frame_pointer))
> > > FPF = A->getOption().matches(options::OPT_fno_omit_frame_pointer)) ?
> > >  FpFlag::true : FpFlag::false;
> > > 
> > >   if (!mustUseNonLeaf && FPF == FpFlag::false)
> > > return FramePointerKind::None;
> > > 
> > >   if (mustUseNonLeaf || FPF == FpFlag::true || 
> > > Args.hasArg(options::OPT_pg) ||
> > >   useFramePointerForTargetByDefault(Args, Triple)) {
> > > if (Args.hasFlag(options::OPT_momit_leaf_frame_pointer,
> > >  options::OPT_mno_omit_leaf_frame_pointer,
> > >  Triple.isPS4CPU()))
> > >   return FramePointerKind::NonLeaf;
> > > return FramePointerKind::All;
> > >   }
> > >   return FramePointerKind::None;
> > > ```
> > I actually think the current version is clearer.. The local `enum class 
> > FpFlag {true, false, none};` doesn't improve readability in my opinion.
> > 
> > 
> > I can define separate variables for:
> > 
> > * A && A->getOption().matches(options::OPT_fno_omit_frame_pointer)
> > * A && A->getOption().matches(options::OPT_fomit_frame_pointer)
> > 
> > If reviewers think that makes the code easier to read.
> I think local enum may be optional.
> 
> Say 
>   - `Fp  = A && 
> A->getOption().matches(options::OPT_fno_omit_frame_pointer)`
>   - `NoFp = A && A->getOption().matches(options::OPT_fomit_frame_pointer)`
> 
> The `!(A && A->getOption().matches(options::OPT_fomit_frame_pointer))` in the 
> current revision could be `!A`. The implicit logic is `NoFp`  could only be 
> overriden by `mustUseNonLeaf`.
> 
> This block helps to make the implicit logic explicit and simplify the rest of 
> the code.
> 
> ```
> if (!mustUseNonLeaf && NoFp)
>   return FramePointerKind::None;
> }
> ```
> 
> 
I refactored the code a bit.

I still prefer the current approach to return 3 possible values. Too many 
`return` statements just clutter the code I think.


Repository:
  rC Clang

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

https://reviews.llvm.org/D64294



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


[PATCH] D63753: [Sema] Instead of rejecting C unions with non-trivial fields, detect attempts to destruct/initialize/copy them.

2019-07-10 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak marked 2 inline comments as done.
ahatanak added inline comments.



Comment at: lib/Sema/SemaDecl.cpp:12053
+NTCUC_UninitAutoVar);
 }
+

rjmccall wrote:
> Please add a comment explaining why this is specific to local variables.
I was trying to explain why this should be specific to local variables and 
realized that it's not clear to me whether it should be.

Suppose there is a union with two fields that are both non-trivial:

```
union U {
  Type A a;
  Type B a;
};

U global;
```

In this case, is value-initialization (which is essentially 
default-initialization plus a bunch of zero-initialization as per our previous 
discussion) used to initialize `global`? If so, should we reject the code since 
it requires default-initialization? It should be fine if we can assume 
default-initialization means zero-initialization for non-trivial types in C, 
but what if `TypeA` or `TypeB` requires initializing to a non-zero value?


Repository:
  rC Clang

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

https://reviews.llvm.org/D63753



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


[PATCH] D64294: [Driver] Consolidate shouldUseFramePointer() and shouldUseLeafFramePointer()

2019-07-10 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay updated this revision to Diff 209112.
MaskRay added a comment.

Improve readability


Repository:
  rC Clang

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

https://reviews.llvm.org/D64294

Files:
  lib/Driver/ToolChains/Clang.cpp
  test/Driver/cl-options.c
  test/Driver/clang_f_opts.c
  test/Driver/frame-pointer-elim.c
  test/Driver/xcore-opts.c

Index: test/Driver/xcore-opts.c
===
--- test/Driver/xcore-opts.c
+++ test/Driver/xcore-opts.c
@@ -4,8 +4,8 @@
 // RUN: %clang -target xcore %s -g0 -### -o %t.o 2>&1 | FileCheck -check-prefix CHECK-G0 %s
 
 // CHECK: "-nostdsysteminc"
-// CHECK: "-momit-leaf-frame-pointer"
 // CHECK-NOT: "-mdisable-fp-elim"
+// CHECK-NOT: "-momit-leaf-frame-pointer"
 // CHECK: "-fno-signed-char"
 // CHECK: "-fno-use-cxa-atexit"
 // CHECK-NOT: "-fcxx-exceptions"
Index: test/Driver/frame-pointer-elim.c
===
--- test/Driver/frame-pointer-elim.c
+++ test/Driver/frame-pointer-elim.c
@@ -1,48 +1,74 @@
-// For these next two tests when optimized we should omit the leaf frame
-// pointer, for unoptimized we should have a leaf frame pointer.
-// RUN: %clang -### -target i386-pc-linux-gnu -S -O1 %s 2>&1 | \
-// RUN:   FileCheck --check-prefix=LINUX-OPT %s
-// LINUX-OPT: "-momit-leaf-frame-pointer"
-
-// RUN: %clang -### -target i386-pc-linux-gnu -S %s 2>&1 | \
-// RUN:   FileCheck --check-prefix=LINUX %s
-// LINUX-NOT: "-momit-leaf-frame-pointer"
+// KEEP-ALL: "-mdisable-fp-elim"
+// KEEP-ALL-NOT: "-momit-leaf-frame-pointer"
+
+// KEEP-NON-LEAF: "-mdisable-fp-elim"
+// KEEP-NON-LEAF: "-momit-leaf-frame-pointer"
+
+// KEEP-NONE-NOT: "-mdisable-fp-elim"
+// KEEP-NONE-NOT: "-momit-leaf-frame-pointer"
+
+// On Linux x86, omit frame pointer when optimization is enabled.
+// RUN: %clang -### -target i386-linux -S -fomit-frame-pointer %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=KEEP-NONE %s
+// RUN: %clang -### -target i386-linux -S -O1 %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=KEEP-NONE %s
+
+// -fno-omit-frame-pointer or -pg disables frame pointer omission.
+// RUN: %clang -### -target i386-linux -S %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=KEEP-ALL %s
+// RUN: %clang -### -target i386-linux -S -O1 -fno-omit-frame-pointer %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=KEEP-ALL %s
+// RUN: %clang -### -target i386-linux -S -O1 -pg %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=KEEP-ALL %s
+
+// -momit-leaf-frame-pointer omits leaf frame pointer.
+// -fno-omit-frame-pointer loses out to -momit-leaf-frame-pointer.
+// RUN: %clang -### -target i386 -S -momit-leaf-frame-pointer %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=KEEP-NON-LEAF %s
+// RUN: %clang -### -target i386-linux -S -O1 -fno-omit-frame-pointer -momit-leaf-frame-pointer %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=KEEP-NON-LEAF %s
+// RUN: %clang -### -target i386-linux -S -O1 -momit-leaf-frame-pointer %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=KEEP-NONE %s
+
+// Explicit or default -fomit-frame-pointer wins over -mno-omit-leaf-frame-pointer.
+// RUN: %clang -### -target i386 -S %s -fomit-frame-pointer -mno-omit-leaf-frame-pointer 2>&1 | \
+// RUN:   FileCheck --check-prefix=KEEP-NONE %s
+// RUN: %clang -### -target i386-linux -S %s -O1 -mno-omit-leaf-frame-pointer 2>&1 | \
+// RUN:   FileCheck --check-prefix=KEEP-NONE %s
+
+// -pg -fomit-frame-pointer => error.
+// RUN: %clang -### -S -fomit-frame-pointer -pg %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-OMIT-FP-PG %s
+// RUN: %clang -### -S -fomit-frame-pointer -fno-omit-frame-pointer -pg %s 2>&1 | FileCheck -check-prefix=CHECK-MIX-NO-OMIT-FP-PG %s
+// CHECK-NO-MIX-OMIT-FP-PG: '-fomit-frame-pointer' not allowed with '-pg'
+// CHECK-MIX-NO-OMIT-FP-PG-NOT: '-fomit-frame-pointer' not allowed with '-pg'
 
 // CloudABI follows the same rules as Linux.
 // RUN: %clang -### -target x86_64-unknown-cloudabi -S -O1 %s 2>&1 | \
-// RUN:   FileCheck --check-prefix=CLOUDABI-OPT %s
-// CLOUDABI-OPT: "-momit-leaf-frame-pointer"
+// RUN:   FileCheck --check-prefix=KEEP-NONE %s
 
 // RUN: %clang -### -target x86_64-unknown-cloudabi -S %s 2>&1 | \
-// RUN:   FileCheck --check-prefix=CLOUDABI %s
-// CLOUDABI-NOT: "-momit-leaf-frame-pointer"
+// RUN:   FileCheck --check-prefix=KEEP-ALL %s
 
 // NetBSD follows the same rules as Linux.
 // RUN: %clang -### -target x86_64-unknown-netbsd -S -O1 %s 2>&1 | \
-// RUN:   FileCheck --check-prefix=NETBSD-OPT %s
-// NETBSD-OPT: "-momit-leaf-frame-pointer"
+// RUN:   FileCheck --check-prefix=KEEP-NONE %s
 
 // RUN: %clang -### -target x86_64-unknown-netbsd -S %s 2>&1 | \
-// RUN:   FileCheck --check-prefix=NETBSD %s
-// NETBSD-NOT: "-momit-leaf-frame-pointer"
+// RUN:   FileCheck --check-prefix=KEEP-ALL %s
 
 // Darwin disables omitting the leaf frame pointer even under optimization
 // unless the command lines are given.
 // RUN: %clang -### -target i386-apple-darwin -S %s 2>&1 | \

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

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

The test coverage here is not acceptable:

1. The command line of the tests is far from what it should be (see other 
tests).
2. The check lines do little to prevent regressions in the future.
3. There are no test for wrong usage, errors, ...


Repository:
  rL LLVM

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

https://reviews.llvm.org/D61809



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


[PATCH] D64506: clang-cl: Remove -O0 option

2019-07-10 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL365724: clang-cl: Remove -O0 option (authored by nico, 
committed by ).
Herald added a subscriber: delcypher.

Changed prior to commit:
  https://reviews.llvm.org/D64506?vs=209092=209111#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D64506

Files:
  cfe/trunk/include/clang/Driver/CLCompatOptions.td
  compiler-rt/trunk/test/asan/TestCases/Windows/aligned_mallocs.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/allocators_sanity.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/beginthreadex.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/bitfield.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/bitfield_uaf.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/calloc_left_oob.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/calloc_right_oob.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/calloc_uaf.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/coverage-dll-stdio.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/crt_initializers.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/demangled_names.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/dll_aligned_mallocs.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/dll_allocators_sanity.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/dll_cerr.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/dll_control_c.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/dll_global_dead_strip.c
  compiler-rt/trunk/test/asan/TestCases/Windows/dll_host.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/dll_intercept_memchr.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/dll_intercept_memcpy.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/dll_intercept_memcpy_indirect.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/dll_intercept_memset.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/dll_intercept_strlen.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/dll_malloc_left_oob.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/dll_malloc_uaf.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/dll_noreturn.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/dll_null_deref.cc
  
compiler-rt/trunk/test/asan/TestCases/Windows/dll_operator_array_new_left_oob.cc
  
compiler-rt/trunk/test/asan/TestCases/Windows/dll_operator_array_new_with_dtor_left_oob.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/dll_poison_unpoison.cc
  
compiler-rt/trunk/test/asan/TestCases/Windows/dll_report_globals_symbolization_at_startup.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/dll_seh.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/dll_stack_use_after_return.cc
  
compiler-rt/trunk/test/asan/TestCases/Windows/dll_thread_stack_array_left_oob.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/double_free.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/double_operator_delete.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/global_const_string.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/global_const_string_oob.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_doublefree.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_flags_fallback.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_huge.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_sanity.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_uaf.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/heaprealloc.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/hello_world.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/intercept_memcpy.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/intercept_strdup.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/intercept_strlen.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/interface_symbols_windows.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/iostream_sbo.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/malloc_left_oob.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/malloc_right_oob.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/malloc_uaf.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/null_deref_multiple_dlls.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/oom.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/operator_array_new_left_oob.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/operator_array_new_right_oob.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/operator_array_new_uaf.cc
  
compiler-rt/trunk/test/asan/TestCases/Windows/operator_array_new_with_dtor_left_oob.cc
  
compiler-rt/trunk/test/asan/TestCases/Windows/operator_delete_wrong_argument.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/operator_new_left_oob.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/operator_new_right_oob.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/operator_new_uaf.cc
  compiler-rt/trunk/test/asan/TestCases/Windows/queue_user_work_item_report.cc
  

r365724 - clang-cl: Remove -O0 option

2019-07-10 Thread Nico Weber via cfe-commits
Author: nico
Date: Wed Jul 10 18:18:05 2019
New Revision: 365724

URL: http://llvm.org/viewvc/llvm-project?rev=365724=rev
Log:
clang-cl: Remove -O0 option

cl.exe doesn't understand it; there's /Od instead. See also the review
thread for r229575.

Update lots of compiler-rt tests to use -Od instead of -O0.
Ran `rg -l 'clang_cl.*O0' compiler-rt/test/ | xargs sed -i -c 's/-O0/-Od/'`

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

Modified:
cfe/trunk/include/clang/Driver/CLCompatOptions.td

Modified: cfe/trunk/include/clang/Driver/CLCompatOptions.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CLCompatOptions.td?rev=365724=365723=365724=diff
==
--- cfe/trunk/include/clang/Driver/CLCompatOptions.td (original)
+++ cfe/trunk/include/clang/Driver/CLCompatOptions.td Wed Jul 10 18:18:05 2019
@@ -120,8 +120,6 @@ def _SLASH_J : CLFlag<"J">, HelpText<"Ma
 def _SLASH_O : CLJoined<"O">,
   HelpText<"Set multiple /O flags at once; e.g. '/O2y-' for '/O2 /Oy-'">,
   MetaVarName<"">;
-// FIXME: Not sure why we have -O0 here; MSVC doesn't support that.
-def : CLFlag<"O0">, Alias, HelpText<"Disable optimization">;
 def : CLFlag<"O1">, Alias<_SLASH_O>, AliasArgs<["1"]>,
   HelpText<"Optimize for size  (like /Og /Os /Oy /Ob2 /GF /Gy)">;
 def : CLFlag<"O2">, Alias<_SLASH_O>, AliasArgs<["2"]>,


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


[PATCH] D63753: [Sema] Instead of rejecting C unions with non-trivial fields, detect attempts to destruct/initialize/copy them.

2019-07-10 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 209108.
ahatanak marked 3 inline comments as done.
ahatanak added a comment.

Address review comments.


Repository:
  rC Clang

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

https://reviews.llvm.org/D63753

Files:
  include/clang/AST/Decl.h
  include/clang/AST/DeclBase.h
  include/clang/AST/Type.h
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/Sema.h
  lib/AST/Type.cpp
  lib/Sema/Sema.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaType.cpp
  lib/Serialization/ASTReaderDecl.cpp
  lib/Serialization/ASTWriterDecl.cpp
  test/CodeGenObjC/Inputs/strong_in_union.h
  test/CodeGenObjC/strong-in-c-struct.m
  test/PCH/non-trivial-c-union.m
  test/SemaObjC/arc-decls.m
  test/SemaObjC/non-trivial-c-union.m

Index: test/SemaObjC/non-trivial-c-union.m
===
--- /dev/null
+++ test/SemaObjC/non-trivial-c-union.m
@@ -0,0 +1,80 @@
+// RUN: %clang_cc1 -fsyntax-only -fblocks -fobjc-arc -fobjc-runtime-has-weak -verify %s
+
+typedef union { // expected-note 8 {{'U0' has subobjects that are non-trivial to default-initialize}} expected-note 36 {{'U0' has subobjects that are non-trivial to destruct}} expected-note 26 {{'U0' has subobjects that are non-trivial to copy}}
+  id f0; // expected-note 8 {{f0 has type '__strong id' that is non-trivial to default-initialize}} expected-note 36 {{f0 has type '__strong id' that is non-trivial to destruct}} expected-note 26 {{f0 has type '__strong id' that is non-trivial to copy}}
+  __weak id f1; // expected-note 8 {{f1 has type '__weak id' that is non-trivial to default-initialize}} expected-note 36 {{f1 has type '__weak id' that is non-trivial to destruct}} expected-note 26 {{f1 has type '__weak id' that is non-trivial to copy}}
+} U0;
+
+typedef struct {
+  U0 f0;
+  id f1;
+} S0;
+
+id g0;
+U0 ug0;
+U0 ug1 = { .f0 = 0 };
+S0 sg0;
+S0 sg1 = { .f0 = {0}, .f1 = 0 };
+
+U0 foo0(U0); // expected-error {{cannot use type 'U0' for a function/method parameter since it is a union that is non-trivial to destruct}} expected-error {{cannot use type 'U0' for a function/method parameter since it is a union that is non-trivial to copy}} expected-error {{cannot use type 'U0' for function/method return since it is a union that is non-trivial to destruct}} expected-error {{cannot use type 'U0' for function/method return since it is a union that is non-trivial to copy}}
+S0 foo1(S0); // expected-error {{cannot use type 'S0' for a function/method parameter since it contains a union that is non-trivial to destruct}} expected-error {{cannot use type 'S0' for a function/method parameter since it contains a union that is non-trivial to copy}} expected-error {{cannot use type 'S0' for function/method return since it contains a union that is non-trivial to destruct}} expected-error {{cannot use type 'S0' for function/method return since it contains a union that is non-trivial to copy}}
+
+@interface C
+-(U0)m0:(U0)arg; // expected-error {{cannot use type 'U0' for a function/method parameter since it is a union that is non-trivial to destruct}} expected-error {{cannot use type 'U0' for a function/method parameter since it is a union that is non-trivial to copy}} expected-error {{cannot use type 'U0' for function/method return since it is a union that is non-trivial to destruct}} expected-error {{cannot use type 'U0' for function/method return since it is a union that is non-trivial to copy}}
+-(S0)m1:(S0)arg; // expected-error {{cannot use type 'S0' for a function/method parameter since it contains a union that is non-trivial to destruct}} expected-error {{cannot use type 'S0' for a function/method parameter since it contains a union that is non-trivial to copy}} expected-error {{cannot use type 'S0' for function/method return since it contains a union that is non-trivial to destruct}} expected-error {{cannot use type 'S0' for function/method return since it contains a union that is non-trivial to copy}}
+@end
+
+void testBlockFunction(void) {
+  (void)^(U0 a){ return ug0; }; // expected-error {{cannot use type 'U0' for a function/method parameter since it is a union that is non-trivial to destruct}} expected-error {{cannot use type 'U0' for a function/method parameter since it is a union that is non-trivial to copy}} expected-error {{cannot use type 'U0' for function/method return since it is a union that is non-trivial to destruct}} expected-error {{cannot use type 'U0' for function/method return since it is a union that is non-trivial to copy}}
+  (void)^(S0 a){ return sg0; }; // expected-error {{cannot use type 'S0' for a function/method parameter since it contains a union that is non-trivial to destruct}} expected-error {{cannot use type 'S0' for a function/method parameter since it contains a union that is non-trivial to copy}} expected-error {{cannot use type 'S0' for function/method return since it contains a union that is non-trivial to destruct}} 

r365721 - Various minor tweaks to CLCompatOptions.td

2019-07-10 Thread Nico Weber via cfe-commits
Author: nico
Date: Wed Jul 10 18:13:38 2019
New Revision: 365721

URL: http://llvm.org/viewvc/llvm-project?rev=365721=rev
Log:
Various minor tweaks to CLCompatOptions.td

- Add back indentation I accidentally removed in r364901
- Wrap two lines to 80 cols
- Slightly tighten up help text for several flags
- Consistently use "Do not" instead of "Don't"
- Make every option description start with a verb
- Use "Set" instead of "Specify"
- Mark default values of options more consistently
- Remove text about "/Zi" not producing PDBs since it's confusing
  for people not intimately familiar with the implementation of
  the normal PDB pipeline. /Zi lets the linker produce PDBs, which
  is what most users want.
- Consistently use "file" over "filename" in meta var names,
  consistently use "file name" over "filename" in text
- Make all output setting options have consistent language

Modified:
cfe/trunk/include/clang/Driver/CLCompatOptions.td

Modified: cfe/trunk/include/clang/Driver/CLCompatOptions.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CLCompatOptions.td?rev=365721=365720=365721=diff
==
--- cfe/trunk/include/clang/Driver/CLCompatOptions.td (original)
+++ cfe/trunk/include/clang/Driver/CLCompatOptions.td Wed Jul 10 18:13:38 2019
@@ -52,21 +52,21 @@ class CLRemainingArgsJoined
 // already in the right group.)
 
 def _SLASH_Brepro : CLFlag<"Brepro">,
-  HelpText<"Emit an object file which can be reproduced over time">,
+  HelpText<"Do not write current time into COFF output (breaks link.exe 
/incremental)">,
   Alias;
 def _SLASH_Brepro_ : CLFlag<"Brepro-">,
-  HelpText<"Emit an object file which cannot be reproduced over time">,
+  HelpText<"Write current time into COFF output (default)">,
   Alias;
 def _SLASH_C : CLFlag<"C">,
-  HelpText<"Don't discard comments when preprocessing">, Alias;
+  HelpText<"Do not discard comments when preprocessing">, Alias;
 def _SLASH_c : CLFlag<"c">, HelpText<"Compile only">, Alias;
 def _SLASH_d1PP : CLFlag<"d1PP">,
   HelpText<"Retain macro definitions in /E mode">, Alias;
 def _SLASH_d1reportAllClassLayout : CLFlag<"d1reportAllClassLayout">,
   HelpText<"Dump record layout information">,
-Alias, AliasArgs<["-fdump-record-layouts"]>;
+  Alias, AliasArgs<["-fdump-record-layouts"]>;
 def _SLASH_diagnostics_caret : CLFlag<"diagnostics:caret">,
-  HelpText<"Enable caret and column diagnostics (on by default)">;
+  HelpText<"Enable caret and column diagnostics (default)">;
 def _SLASH_diagnostics_column : CLFlag<"diagnostics:column">,
   HelpText<"Disable caret diagnostics but keep column info">;
 def _SLASH_diagnostics_classic : CLFlag<"diagnostics:classic">,
@@ -83,12 +83,14 @@ def _SLASH_fp_precise : CLFlag<"fp:preci
 def _SLASH_fp_strict : CLFlag<"fp:strict">, HelpText<"">, Alias;
 def _SLASH_GA : CLFlag<"GA">, Alias, AliasArgs<["local-exec"]>,
   HelpText<"Assume thread-local variables are defined in the executable">;
-def _SLASH_GR : CLFlag<"GR">, HelpText<"Enable emission of RTTI data">;
-def _SLASH_GR_ : CLFlag<"GR-">, HelpText<"Disable emission of RTTI data">;
-def _SLASH_GF : CLIgnoredFlag<"GF">, HelpText<"Enable string pooling 
(default)">;
+def _SLASH_GR : CLFlag<"GR">, HelpText<"Emit RTTI data (default)">;
+def _SLASH_GR_ : CLFlag<"GR-">, HelpText<"Do not emit RTTI data">;
+def _SLASH_GF : CLIgnoredFlag<"GF">,
+  HelpText<"Enable string pooling (default)">;
 def _SLASH_GF_ : CLFlag<"GF-">, HelpText<"Disable string pooling">,
   Alias;
-def _SLASH_GS : CLFlag<"GS">, HelpText<"Enable buffer security check 
(default)">;
+def _SLASH_GS : CLFlag<"GS">,
+  HelpText<"Enable buffer security check (default)">;
 def _SLASH_GS_ : CLFlag<"GS-">, HelpText<"Disable buffer security check">;
 def : CLFlag<"Gs">, HelpText<"Use stack probes (default)">,
   Alias, AliasArgs<["4096"]>;
@@ -97,12 +99,12 @@ def _SLASH_Gs : CLJoined<"Gs">,
 def _SLASH_Gy : CLFlag<"Gy">, HelpText<"Put each function in its own section">,
   Alias;
 def _SLASH_Gy_ : CLFlag<"Gy-">,
-  HelpText<"Don't put each function in its own section (default)">,
+  HelpText<"Do not put each function in its own section (default)">,
   Alias;
 def _SLASH_Gw : CLFlag<"Gw">, HelpText<"Put each data item in its own 
section">,
   Alias;
 def _SLASH_Gw_ : CLFlag<"Gw-">,
-  HelpText<"Don't put each data item in its own section">,
+  HelpText<"Do not put each data item in its own section (default)">,
   Alias;
 def _SLASH_help : CLFlag<"help">, Alias,
   HelpText<"Display available options">;
@@ -121,13 +123,13 @@ def _SLASH_O : CLJoined<"O">,
 // FIXME: Not sure why we have -O0 here; MSVC doesn't support that.
 def : CLFlag<"O0">, Alias, HelpText<"Disable optimization">;
 def : CLFlag<"O1">, Alias<_SLASH_O>, AliasArgs<["1"]>,
-  HelpText<"Optimize for size  (same as /Og /Os /Oy /Ob2 /GF /Gy)">;
+  HelpText<"Optimize for size  (like /Og /Os /Oy /Ob2 /GF /Gy)">;
 def : CLFlag<"O2">, Alias<_SLASH_O>, 

[PATCH] D64537: [WebAssembly] Implement thread-local storage for non-PIC cases

2019-07-10 Thread Guanzhong Chen via Phabricator via cfe-commits
quantum marked an inline comment as done.
quantum added a comment.

In D64537#1579626 , @sunfish wrote:

> This looks nice!
>
> > __wasm_init_tls(calloc(__builtin_wasm_tls_size(), 1));
>
> Would it make sense to change the API contract for `__wasm_init_tls` to 
> guarantee that initializes all bytes (with zeros as needed)? 
> `__wasm_init_tls` knows what bytes it's initializing, so we could use plain 
> `malloc` instead of `calloc` and avoid redundant zero initialization of those 
> bytes.


Updated the summary. I just realized that the way the code is written, the 
plain `malloc` would already work.




Comment at: llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp:
+
+  return DAG.getNode(ISD::ADD, DL, VT, TLSBase, TLSOffset);
+}

sunfish wrote:
> It looks like this supports local-exec, but would need to be extended to 
> handle initial-exec or the other TLS models. Assuming this is correct, could 
> you add a check for the TLS model and `report_fatal_error` on unsupported 
> models?
I'll add an error for non-local-exec for now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64537



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


[PATCH] D64526: [NFC] Unforget a colon in a few CHECK: directives.

2019-07-10 Thread Jonas Devlieghere via Phabricator via cfe-commits
JDevlieghere added a comment.

The dsymutil part LGTM


Repository:
  rL LLVM

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

https://reviews.llvm.org/D64526



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


[PATCH] D64543: [Docs] Add standardized header links to analyzer doc

2019-07-10 Thread Nathan Huckleberry via Phabricator via cfe-commits
Nathan-Huckleberry updated this revision to Diff 209105.
Nathan-Huckleberry added a comment.

- Fix .m and i..


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64543

Files:
  clang/docs/analyzer/checkers.rst

Index: clang/docs/analyzer/checkers.rst
===
--- clang/docs/analyzer/checkers.rst
+++ clang/docs/analyzer/checkers.rst
@@ -29,6 +29,8 @@
 null pointer dereference, usage of uninitialized values, etc.
 *These checkers must be always switched on as other checker rely on them.*
 
+.. _core-CallAndMessage:
+
 core.CallAndMessage (C, C++, ObjC)
 ""
  Check for logical errors for function calls and Objective-C message expressions (e.g., uninitialized arguments, null function pointers).
@@ -36,6 +38,8 @@
 .. literalinclude:: checkers/callandmessage_example.c
 :language: objc
 
+.. _core-DivideZero:
+
 core.DivideZero (C, C++, ObjC)
 ""
  Check for division by zero.
@@ -43,6 +47,8 @@
 .. literalinclude:: checkers/dividezero_example.c
 :language: c
 
+.. _core-NonNullParamChecker:
+
 core.NonNullParamChecker (C, C++, ObjC)
 """
 Check for null pointers passed as arguments to a function whose arguments are references or marked with the 'nonnull' attribute.
@@ -56,6 +62,8 @@
  f(p); // warn
  }
 
+.. _core-NullDereference:
+
 core.NullDereference (C, C++, ObjC)
 """
 Check for dereferences of null pointers.
@@ -99,6 +107,8 @@
obj->x = 1; // warn
  }
 
+.. _core-StackAddressEscape:
+
 core.StackAddressEscape (C)
 """
 Check that addresses to stack memory do not escape the function.
@@ -123,6 +133,8 @@
  }
 
 
+.. _core-UndefinedBinaryOperatorResult:
+
 core.UndefinedBinaryOperatorResult (C)
 ""
 Check for undefined results of binary operators.
@@ -134,6 +146,8 @@
int y = x + 1; // warn: left operand is garbage
  }
 
+.. _core-VLASize:
+
 core.VLASize (C)
 
 Check for declarations of Variable Length Arrays of undefined or zero size.
@@ -152,6 +166,8 @@
int vla2[x]; // warn: zero size
  }
 
+.. _core-uninitialized-ArraySubscript:
+
 core.uninitialized.ArraySubscript (C)
 "
 Check for uninitialized values used as array subscripts.
@@ -163,6 +179,8 @@
int x = a[i]; // warn: array subscript is undefined
  }
 
+.. _core-uninitialized-Assign:
+
 core.uninitialized.Assign (C)
 "
 Check for assigning uninitialized values.
@@ -174,6 +192,8 @@
x |= 1; // warn: left expression is uninitialized
  }
 
+.. _core-uninitialized-Branch:
+
 core.uninitialized.Branch (C)
 "
 Check for uninitialized values used as branch conditions.
@@ -186,6 +206,8 @@
  return;
  }
 
+.. _core-uninitialized-CapturedBlockVariable:
+
 core.uninitialized.CapturedBlockVariable (C)
 
 Check for blocks that capture uninitialized values.
@@ -197,6 +219,8 @@
^{ int y = x; }(); // warn
  }
 
+.. _core-uninitialized-UndefReturn:
+
 core.uninitialized.UndefReturn (C)
 ""
 Check for uninitialized values being returned to the caller.
@@ -216,10 +240,14 @@
 
 C++ Checkers.
 
+.. _cplusplus-InnerPointer:
+
 cplusplus.InnerPointer
 ""
 Check for inner pointers of C++ containers used after re/deallocation.
 
+.. _cplusplus-NewDelete:
+
 cplusplus.NewDelete (C++)
 "
 Check for double-free and use-after-free problems. Traces memory managed by new/delete.
@@ -227,6 +255,8 @@
 .. literalinclude:: checkers/newdelete_example.cpp
 :language: cpp
 
+.. _cplusplus-NewDeleteLeaks:
+
 cplusplus.NewDeleteLeaks (C++)
 ""
 Check for memory leaks. Traces memory managed by new/delete.
@@ -238,6 +268,8 @@
  } // warn
 
 
+.. _cplusplus-SelfAssignment:
+
 cplusplus.SelfAssignment (C++)
 ""
 Checks C++ copy and move assignment operators for self assignment.
@@ -249,6 +281,8 @@
 
 Dead Code Checkers.
 
+.. _deadcode-DeadStores:
+
 deadcode.DeadStores (C)
 """
 Check for values stored to variables that are never read afterwards.
@@ -267,6 +301,8 @@
 
 Objective C checkers that warn for null pointer passing and dereferencing errors.
 
+.. _nullability-NullPassedToNonnull:
+
 nullability.NullPassedToNonnull (ObjC)
 ""
 Warns when a null pointer is passed to a pointer which has a _Nonnull type.
@@ -278,6 +314,8 @@
  // Warning: nil passed to a callee that requires a non-null 1st parameter
  NSString *greeting = [@"Hello " stringByAppendingString:name];
 
+.. _nullability-NullReturnedFromNonnull:
+
 nullability.NullReturnedFromNonnull (ObjC)
 

[PATCH] D64454: [clang-tidy] Adding static analyzer check to list of clang-tidy checks

2019-07-10 Thread Nathan Huckleberry via Phabricator via cfe-commits
Nathan-Huckleberry added a comment.

In D64454#1579481 , @Eugene.Zelenko 
wrote:

> In D64454#1579466 , 
> @Nathan-Huckleberry wrote:
>
> > Docs exist for these checks on the analyzer side, they're just all on the 
> > same page and hyperlinking to them individually is difficult because the 
> > links have a nonstandard naming convention. Currently I'm just linking to 
> > that page.
>
>
> I think it'll be reasonable to standardize Static Analyzer documentation 
> links first.


Just put up a patch for that: https://reviews.llvm.org/D64543


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64454



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


[PATCH] D64543: [Docs] Add standardized header links to analyzer doc

2019-07-10 Thread Nathan Huckleberry via Phabricator via cfe-commits
Nathan-Huckleberry updated this revision to Diff 209104.
Nathan-Huckleberry added a comment.

- Fix file periods being converted to dashes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64543

Files:
  clang/docs/analyzer/checkers.rst

Index: clang/docs/analyzer/checkers.rst
===
--- clang/docs/analyzer/checkers.rst
+++ clang/docs/analyzer/checkers.rst
@@ -29,6 +29,8 @@
 null pointer dereference, usage of uninitialized values, etc.
 *These checkers must be always switched on as other checker rely on them.*
 
+.. _core-CallAndMessage:
+
 core.CallAndMessage (C, C++, ObjC)
 ""
  Check for logical errors for function calls and Objective-C message expressions (e.g., uninitialized arguments, null function pointers).
@@ -36,6 +38,8 @@
 .. literalinclude:: checkers/callandmessage_example.c
 :language: objc
 
+.. _core-DivideZero:
+
 core.DivideZero (C, C++, ObjC)
 ""
  Check for division by zero.
@@ -43,6 +47,8 @@
 .. literalinclude:: checkers/dividezero_example.c
 :language: c
 
+.. _core-NonNullParamChecker:
+
 core.NonNullParamChecker (C, C++, ObjC)
 """
 Check for null pointers passed as arguments to a function whose arguments are references or marked with the 'nonnull' attribute.
@@ -56,6 +62,8 @@
  f(p); // warn
  }
 
+.. _core-NullDereference:
+
 core.NullDereference (C, C++, ObjC)
 """
 Check for dereferences of null pointers.
@@ -99,6 +107,8 @@
obj->x = 1; // warn
  }
 
+.. _core-StackAddressEscape:
+
 core.StackAddressEscape (C)
 """
 Check that addresses to stack memory do not escape the function.
@@ -123,6 +133,8 @@
  }
 
 
+.. _core-UndefinedBinaryOperatorResult:
+
 core.UndefinedBinaryOperatorResult (C)
 ""
 Check for undefined results of binary operators.
@@ -134,6 +146,8 @@
int y = x + 1; // warn: left operand is garbage
  }
 
+.. _core-VLASize:
+
 core.VLASize (C)
 
 Check for declarations of Variable Length Arrays of undefined or zero size.
@@ -152,6 +166,8 @@
int vla2[x]; // warn: zero size
  }
 
+.. _core-uninitialized-ArraySubscript:
+
 core.uninitialized.ArraySubscript (C)
 "
 Check for uninitialized values used as array subscripts.
@@ -163,6 +179,8 @@
int x = a[i]; // warn: array subscript is undefined
  }
 
+.. _core-uninitialized-Assign:
+
 core.uninitialized.Assign (C)
 "
 Check for assigning uninitialized values.
@@ -174,6 +192,8 @@
x |= 1; // warn: left expression is uninitialized
  }
 
+.. _core-uninitialized-Branch:
+
 core.uninitialized.Branch (C)
 "
 Check for uninitialized values used as branch conditions.
@@ -186,6 +206,8 @@
  return;
  }
 
+.. _core-uninitialized-CapturedBlockVariable:
+
 core.uninitialized.CapturedBlockVariable (C)
 
 Check for blocks that capture uninitialized values.
@@ -197,6 +219,8 @@
^{ int y = x; }(); // warn
  }
 
+.. _core-uninitialized-UndefReturn:
+
 core.uninitialized.UndefReturn (C)
 ""
 Check for uninitialized values being returned to the caller.
@@ -216,10 +240,14 @@
 
 C++ Checkers.
 
+.. _cplusplus-InnerPointer:
+
 cplusplus.InnerPointer
 ""
 Check for inner pointers of C++ containers used after re/deallocation.
 
+.. _cplusplus-NewDelete:
+
 cplusplus.NewDelete (C++)
 "
 Check for double-free and use-after-free problems. Traces memory managed by new/delete.
@@ -227,6 +255,8 @@
 .. literalinclude:: checkers/newdelete_example.cpp
 :language: cpp
 
+.. _cplusplus-NewDeleteLeaks:
+
 cplusplus.NewDeleteLeaks (C++)
 ""
 Check for memory leaks. Traces memory managed by new/delete.
@@ -238,6 +268,8 @@
  } // warn
 
 
+.. _cplusplus-SelfAssignment:
+
 cplusplus.SelfAssignment (C++)
 ""
 Checks C++ copy and move assignment operators for self assignment.
@@ -249,6 +281,8 @@
 
 Dead Code Checkers.
 
+.. _deadcode-DeadStores:
+
 deadcode.DeadStores (C)
 """
 Check for values stored to variables that are never read afterwards.
@@ -267,6 +301,8 @@
 
 Objective C checkers that warn for null pointer passing and dereferencing errors.
 
+.. _nullability-NullPassedToNonnull:
+
 nullability.NullPassedToNonnull (ObjC)
 ""
 Warns when a null pointer is passed to a pointer which has a _Nonnull type.
@@ -278,6 +314,8 @@
  // Warning: nil passed to a callee that requires a non-null 1st parameter
  NSString *greeting = [@"Hello " stringByAppendingString:name];
 
+.. _nullability-NullReturnedFromNonnull:
+
 nullability.NullReturnedFromNonnull (ObjC)
 

[PATCH] D64537: [WebAssembly] Implement thread-local storage for non-PIC cases

2019-07-10 Thread Guanzhong Chen via Phabricator via cfe-commits
quantum updated this revision to Diff 209102.
quantum added a comment.

Fix linker warning.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64537

Files:
  clang/include/clang/Basic/BuiltinsWebAssembly.def
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/builtins-wasm.c
  lld/test/wasm/data-layout.ll
  lld/test/wasm/gc-sections.ll
  lld/test/wasm/tls.ll
  lld/wasm/Driver.cpp
  lld/wasm/Symbols.cpp
  lld/wasm/Symbols.h
  lld/wasm/Writer.cpp
  llvm/include/llvm/BinaryFormat/Wasm.h
  llvm/include/llvm/IR/IntrinsicsWebAssembly.td
  llvm/include/llvm/MC/MCSectionWasm.h
  llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyISD.def
  llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.h
  llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
  llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
  llvm/test/CodeGen/WebAssembly/target-features-tls.ll
  llvm/test/CodeGen/WebAssembly/tls.ll

Index: llvm/test/CodeGen/WebAssembly/tls.ll
===
--- llvm/test/CodeGen/WebAssembly/tls.ll
+++ llvm/test/CodeGen/WebAssembly/tls.ll
@@ -1,17 +1,87 @@
-; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers | FileCheck --check-prefix=SINGLE %s
+; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals | FileCheck --check-prefixes=CHECK,O2 %s
+; RUN: llc -O0 < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals | FileCheck --check-prefixes=CHECK,O0 %s
 target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
 target triple = "wasm32-unknown-unknown"
 
-; SINGLE-LABEL: address_of_tls:
+; O0-LABEL: address_of_tls:
+; O2-LABEL: address_of_tls:
 define i32 @address_of_tls() {
-  ; SINGLE: i32.const $push0=, tls
-  ; SINGLE-NEXT: return $pop0
+  ; O0: i32.const tls
+  ; O0-NEXT: global.get __tls_base
+  ; O0-NEXT: i32.add
+  ; O0-NEXT: return
+
+  ; O2: global.get __tls_base
+  ; O2-NEXT: i32.const tls
+  ; O2-NEXT: i32.add
+  ; O2-NEXT: return
   ret i32 ptrtoint(i32* @tls to i32)
 }
 
-; SINGLE: .type	tls,@object
-; SINGLE-NEXT: .section	.bss.tls,"",@
-; SINGLE-NEXT: .p2align 2
-; SINGLE-NEXT: tls:
-; SINGLE-NEXT: .int32 0
+; O0-LABEL: ptr_to_tls
+; O2-LABEL: ptr_to_tls
+define i32* @ptr_to_tls() {
+  ; O0: i32.const tls
+  ; O0-NEXT: global.get __tls_base
+  ; O0-NEXT: i32.add
+  ; O0-NEXT: return
+
+  ; O2: global.get __tls_base
+  ; O2-NEXT: i32.const tls
+  ; O2-NEXT: i32.add
+  ; O2-NEXT: return
+  ret i32* @tls
+}
+
+; O0-LABEL: tls_load
+; O2-LABEL: tls_load
+define i32 @tls_load() {
+  ; O0: i32.const tls
+  ; O0-NEXT: global.get __tls_base
+  ; O0-NEXT: i32.add
+  ; O0-NEXT: i32.load 0
+  ; O0-NEXT: return
+
+  ; O2: global.get __tls_base
+  ; O2-NEXT: i32.const tls
+  ; O2-NEXT: i32.add
+  ; O2-NEXT: i32.load 0
+  ; O2-NEXT: return
+  %tmp = load i32, i32* @tls, align 4
+  ret i32 %tmp
+}
+
+; O0-LABEL: tls_store
+; O2-LABEL: tls_store
+define void @tls_store(i32 %x) {
+  ; O0: i32.const tls
+  ; O0-NEXT: global.get __tls_base
+  ; O0-NEXT: i32.add
+  ; O0-NEXT: i32.store 0
+  ; O0-NEXT: return
+
+  ; O2: global.get __tls_base
+  ; O2-NEXT: i32.const tls
+  ; O2-NEXT: i32.add
+  ; O2-NEXT: i32.store 0
+  ; O2-NEXT: return
+  store i32 %x, i32* @tls, align 4
+  ret void
+}
+
+; CHECK-LABEL: tls_size:
+; CHECK-NEXT: .functype tls_size () -> (i32)
+; CHECK-NEXT: global.get __tls_size
+; CHECK-NEXT: return
+declare i32 @llvm.wasm.tls.size.i32()
+define i32 @tls_size() {
+  %1 = call i32 @llvm.wasm.tls.size.i32()
+  ret i32 %1
+}
+
+; CHECK: .type tls,@object
+; CHECK-NEXT: .section .tbss.tls,"",@
+; CHECK-NEXT: .p2align 2
+; CHECK-NEXT: tls:
+; CHECK-NEXT: .int32 0
 @tls = internal thread_local global i32 0
Index: llvm/test/CodeGen/WebAssembly/target-features-tls.ll
===
--- llvm/test/CodeGen/WebAssembly/target-features-tls.ll
+++ llvm/test/CodeGen/WebAssembly/target-features-tls.ll
@@ -1,5 +1,5 @@
-; RUN: llc < %s -mattr=-atomics | FileCheck %s --check-prefixes CHECK,NO-ATOMICS
-; RUN: llc < %s -mattr=+atomics | FileCheck %s --check-prefixes CHECK,ATOMICS
+; RUN: llc < %s -mattr=-atomics | FileCheck %s --check-prefixes NO-ATOMICS
+; RUN: llc < %s -mattr=+atomics | FileCheck %s --check-prefixes ATOMICS
 
 ; Test that the target features section contains -atomics or +atomics
 ; for modules that have thread local storage in their source.
@@ -9,16 +9,13 @@
 
 @foo = internal thread_local global i32 0
 
-; CHECK-LABEL: .custom_section.target_features,"",@
 
 ; -atomics
-; NO-ATOMICS-NEXT: .int8 1
-; NO-ATOMICS-NEXT: .int8 45
-; NO-ATOMICS-NEXT: .int8 7
-; NO-ATOMICS-NEXT: .ascii "atomics"
-; NO-ATOMICS-NEXT: 

[PATCH] D64543: [Docs] Add standardized header links to analyzer doc

2019-07-10 Thread Nathan Huckleberry via Phabricator via cfe-commits
Nathan-Huckleberry updated this revision to Diff 209103.
Nathan-Huckleberry added a comment.

- Fixed periods in sentences being dashes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64543

Files:
  clang/docs/analyzer/checkers.rst

Index: clang/docs/analyzer/checkers.rst
===
--- clang/docs/analyzer/checkers.rst
+++ clang/docs/analyzer/checkers.rst
@@ -29,20 +29,26 @@
 null pointer dereference, usage of uninitialized values, etc.
 *These checkers must be always switched on as other checker rely on them.*
 
+.. _core-CallAndMessage:
+
 core.CallAndMessage (C, C++, ObjC)
 ""
  Check for logical errors for function calls and Objective-C message expressions (e.g., uninitialized arguments, null function pointers).
 
-.. literalinclude:: checkers/callandmessage_example.c
+.. literalinclude:: checkers/callandmessage_example-c
 :language: objc
 
+.. _core-DivideZero:
+
 core.DivideZero (C, C++, ObjC)
 ""
  Check for division by zero.
 
-.. literalinclude:: checkers/dividezero_example.c
+.. literalinclude:: checkers/dividezero_example-c
 :language: c
 
+.. _core-NonNullParamChecker:
+
 core.NonNullParamChecker (C, C++, ObjC)
 """
 Check for null pointers passed as arguments to a function whose arguments are references or marked with the 'nonnull' attribute.
@@ -56,6 +62,8 @@
  f(p); // warn
  }
 
+.. _core-NullDereference:
+
 core.NullDereference (C, C++, ObjC)
 """
 Check for dereferences of null pointers.
@@ -99,6 +107,8 @@
obj->x = 1; // warn
  }
 
+.. _core-StackAddressEscape:
+
 core.StackAddressEscape (C)
 """
 Check that addresses to stack memory do not escape the function.
@@ -123,6 +133,8 @@
  }
 
 
+.. _core-UndefinedBinaryOperatorResult:
+
 core.UndefinedBinaryOperatorResult (C)
 ""
 Check for undefined results of binary operators.
@@ -134,6 +146,8 @@
int y = x + 1; // warn: left operand is garbage
  }
 
+.. _core-VLASize:
+
 core.VLASize (C)
 
 Check for declarations of Variable Length Arrays of undefined or zero size.
@@ -152,6 +166,8 @@
int vla2[x]; // warn: zero size
  }
 
+.. _core-uninitialized-ArraySubscript:
+
 core.uninitialized.ArraySubscript (C)
 "
 Check for uninitialized values used as array subscripts.
@@ -163,6 +179,8 @@
int x = a[i]; // warn: array subscript is undefined
  }
 
+.. _core-uninitialized-Assign:
+
 core.uninitialized.Assign (C)
 "
 Check for assigning uninitialized values.
@@ -174,6 +192,8 @@
x |= 1; // warn: left expression is uninitialized
  }
 
+.. _core-uninitialized-Branch:
+
 core.uninitialized.Branch (C)
 "
 Check for uninitialized values used as branch conditions.
@@ -186,6 +206,8 @@
  return;
  }
 
+.. _core-uninitialized-CapturedBlockVariable:
+
 core.uninitialized.CapturedBlockVariable (C)
 
 Check for blocks that capture uninitialized values.
@@ -197,6 +219,8 @@
^{ int y = x; }(); // warn
  }
 
+.. _core-uninitialized-UndefReturn:
+
 core.uninitialized.UndefReturn (C)
 ""
 Check for uninitialized values being returned to the caller.
@@ -216,17 +240,23 @@
 
 C++ Checkers.
 
+.. _cplusplus-InnerPointer:
+
 cplusplus.InnerPointer
 ""
 Check for inner pointers of C++ containers used after re/deallocation.
 
+.. _cplusplus-NewDelete:
+
 cplusplus.NewDelete (C++)
 "
 Check for double-free and use-after-free problems. Traces memory managed by new/delete.
 
-.. literalinclude:: checkers/newdelete_example.cpp
+.. literalinclude:: checkers/newdelete_example-cpp
 :language: cpp
 
+.. _cplusplus-NewDeleteLeaks:
+
 cplusplus.NewDeleteLeaks (C++)
 ""
 Check for memory leaks. Traces memory managed by new/delete.
@@ -238,6 +268,8 @@
  } // warn
 
 
+.. _cplusplus-SelfAssignment:
+
 cplusplus.SelfAssignment (C++)
 ""
 Checks C++ copy and move assignment operators for self assignment.
@@ -249,6 +281,8 @@
 
 Dead Code Checkers.
 
+.. _deadcode-DeadStores:
+
 deadcode.DeadStores (C)
 """
 Check for values stored to variables that are never read afterwards.
@@ -267,6 +301,8 @@
 
 Objective C checkers that warn for null pointer passing and dereferencing errors.
 
+.. _nullability-NullPassedToNonnull:
+
 nullability.NullPassedToNonnull (ObjC)
 ""
 Warns when a null pointer is passed to a pointer which has a _Nonnull type.
@@ -278,6 +314,8 @@
  // Warning: nil passed to a callee that requires a non-null 1st parameter
  NSString *greeting = [@"Hello " 

[PATCH] D64543: [Docs] Add standardized header links to analyzer doc

2019-07-10 Thread Nathan Huckleberry via Phabricator via cfe-commits
Nathan-Huckleberry created this revision.
Herald added subscribers: cfe-commits, dkrupp, donat.nagy, jfb, Szelethus, 
a.sidorin, mgrang, baloghadamsoftware.
Herald added a project: clang.

Header links should have some standard form so clang tidy
docs can easily reference them. The form is as follows.

Start with the analyzer full name including packages.
Replace all periods with dashes and lowercase everything.

Ex: core.CallAndMessage -> core-callandmessage


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D64543

Files:
  clang/docs/analyzer/checkers.rst

Index: clang/docs/analyzer/checkers.rst
===
--- clang/docs/analyzer/checkers.rst
+++ clang/docs/analyzer/checkers.rst
@@ -2,15 +2,15 @@
 Available Checkers
 ==
 
-The analyzer performs checks that are categorized into families or "checkers".
+The analyzer performs checks that are categorized into families or "checkers"-
 
 The default set of checkers covers a variety of checks targeted at finding security and API usage bugs,
-dead code, and other logic errors. See the :ref:`default-checkers` checkers list below.
+dead code, and other logic errors- See the :ref:`default-checkers` checkers list below-
 
-In addition to these, the analyzer contains a number of :ref:`alpha-checkers` (aka *alpha* checkers).
-These checkers are under development and are switched off by default. They may crash or emit a higher number of false positives.
+In addition to these, the analyzer contains a number of :ref:`alpha-checkers` (aka *alpha* checkers)-
+These checkers are under development and are switched off by default- They may crash or emit a higher number of false positives-
 
-The :ref:`debug-checkers` package contains checkers for analyzer developers for debugging purposes.
+The :ref:`debug-checkers` package contains checkers for analyzer developers for debugging purposes-
 
 .. contents:: Table of Contents
:depth: 4
@@ -26,26 +26,32 @@
 core
 
 Models core language features and contains general-purpose checkers such as division by zero,
-null pointer dereference, usage of uninitialized values, etc.
-*These checkers must be always switched on as other checker rely on them.*
+null pointer dereference, usage of uninitialized values, etc-
+*These checkers must be always switched on as other checker rely on them-*
 
-core.CallAndMessage (C, C++, ObjC)
+.. _core-CallAndMessage:
+
+core-CallAndMessage (C, C++, ObjC)
 ""
- Check for logical errors for function calls and Objective-C message expressions (e.g., uninitialized arguments, null function pointers).
+ Check for logical errors for function calls and Objective-C message expressions (e-g-, uninitialized arguments, null function pointers)-
 
 .. literalinclude:: checkers/callandmessage_example.c
 :language: objc
 
-core.DivideZero (C, C++, ObjC)
+.. _core-DivideZero:
+
+core-DivideZero (C, C++, ObjC)
 ""
- Check for division by zero.
+ Check for division by zero-
 
 .. literalinclude:: checkers/dividezero_example.c
 :language: c
 
-core.NonNullParamChecker (C, C++, ObjC)
+.. _core-NonNullParamChecker:
+
+core-NonNullParamChecker (C, C++, ObjC)
 """
-Check for null pointers passed as arguments to a function whose arguments are references or marked with the 'nonnull' attribute.
+Check for null pointers passed as arguments to a function whose arguments are references or marked with the 'nonnull' attribute-
 
 .. code-block:: cpp
 
@@ -56,9 +62,11 @@
  f(p); // warn
  }
 
-core.NullDereference (C, C++, ObjC)
+.. _core-NullDereference:
+
+core-NullDereference (C, C++, ObjC)
 """
-Check for dereferences of null pointers.
+Check for dereferences of null pointers-
 
 .. code-block:: objc
 
@@ -99,9 +107,11 @@
obj->x = 1; // warn
  }
 
-core.StackAddressEscape (C)
+.. _core-StackAddressEscape:
+
+core-StackAddressEscape (C)
 """
-Check that addresses to stack memory do not escape the function.
+Check that addresses to stack memory do not escape the function-
 
 .. code-block:: c
 
@@ -123,9 +133,11 @@
  }
 
 
-core.UndefinedBinaryOperatorResult (C)
+.. _core-UndefinedBinaryOperatorResult:
+
+core-UndefinedBinaryOperatorResult (C)
 ""
-Check for undefined results of binary operators.
+Check for undefined results of binary operators-
 
 .. code-block:: c
 
@@ -134,11 +146,13 @@
int y = x + 1; // warn: left operand is garbage
  }
 
-core.VLASize (C)
+.. _core-VLASize:
+
+core-VLASize (C)
 
-Check for declarations of Variable Length Arrays of undefined or zero size.
+Check for declarations of Variable Length Arrays of undefined or zero size-
 
- Check for declarations of VLA of undefined or zero size.
+ Check for declarations of VLA of undefined or zero size-
 
 .. code-block:: c
 
@@ -152,9 +166,11 @@
int 

[PATCH] D64506: clang-cl: Remove -O0 option

2019-07-10 Thread Reid Kleckner via Phabricator via cfe-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm


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

https://reviews.llvm.org/D64506



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


[PATCH] D64504: Various minor tweaks to CLCompatOptions.td

2019-07-10 Thread Reid Kleckner via Phabricator via cfe-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm




Comment at: clang/include/clang/Driver/CLCompatOptions.td:294
 def _SLASH_GX : CLFlag<"GX">,
-  HelpText<"Enable exception handling">;
+  HelpText<"Deprecated (like /EHsc)">;
 def _SLASH_GX_ : CLFlag<"GX-">,

thakis wrote:
> rnk wrote:
> > "Deprecated in favor of /EHsc"? or "(use /EHsc instead)"?
> The other deprecated flags use "Deprecated (description); use /replacement". 
> Changed  to "Deprecated; use /EHsc"; description and replacement are the same 
> here. (Except that /EH doesn't have a great help text atm.)
 


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

https://reviews.llvm.org/D64504



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


Re: r364424 - [clang/DIVar] Emit the flag for params that have unmodified value

2019-07-10 Thread Vedant Kumar via cfe-commits
Hi Djordje,

Just a heads-up that I’ve landed r365716 to fix a crash in a stage2 build of 
AppleClang with -femit-debug-entry-values enabled.

I went ahead and landed the fix as it seemed simple enough. Let me know if you 
have any concerns.

Thanks,
Vedant

> On Jun 26, 2019, at 6:32 AM, Djordje Todorovic via cfe-commits 
>  wrote:
> 
> Author: djtodoro
> Date: Wed Jun 26 06:32:02 2019
> New Revision: 364424
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=364424=rev
> Log:
> [clang/DIVar] Emit the flag for params that have unmodified value
> 
> Emit the debug info flag that indicates that a parameter has unchanged
> value throughout a function.
> 
> ([5/13] Introduce the debug entry values.)
> 
> Co-authored-by: Ananth Sowda 
> Co-authored-by: Nikola Prica 
> Co-authored-by: Ivan Baev 
> 
> Differential Revision: https://reviews.llvm.org/D58035
> 
> Added:
>cfe/trunk/test/CodeGen/debug-info-param-modification.c
> Modified:
>cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>cfe/trunk/lib/CodeGen/CGDebugInfo.h
> 
> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=364424=364423=364424=diff
> ==
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Jun 26 06:32:02 2019
> @@ -18,6 +18,7 @@
> #include "CodeGenFunction.h"
> #include "CodeGenModule.h"
> #include "ConstantEmitter.h"
> +#include "clang/Analysis/Analyses/ExprMutationAnalyzer.h"
> #include "clang/AST/ASTContext.h"
> #include "clang/AST/DeclFriend.h"
> #include "clang/AST/DeclObjC.h"
> @@ -3588,6 +3589,12 @@ void CGDebugInfo::EmitFunctionStart(Glob
>   if (HasDecl && isa(D))
> DeclCache[D->getCanonicalDecl()].reset(SP);
> 
> +  // We use the SPDefCache only in the case when the debug entry values 
> option
> +  // is set, in order to speed up parameters modification analysis.
> +  if (CGM.getCodeGenOpts().EnableDebugEntryValues && HasDecl &&
> +  isa(D))
> +SPDefCache[cast(D)].reset(SP);
> +
>   if (CGM.getCodeGenOpts().DwarfVersion >= 5) {
> // Starting with DWARF V5 method declarations are emitted as children of
> // the interface type.
> @@ -3964,6 +3971,11 @@ llvm::DILocalVariable *CGDebugInfo::Emit
>  llvm::DebugLoc::get(Line, Column, Scope, 
> CurInlinedAt),
>  Builder.GetInsertBlock());
> 
> +  if (CGM.getCodeGenOpts().EnableDebugEntryValues && ArgNo) {
> +if (auto *PD = dyn_cast(VD))
> +  ParamCache[PD].reset(D);
> +  }
> +
>   return D;
> }
> 
> @@ -4555,6 +4567,29 @@ void CGDebugInfo::setDwoId(uint64_t Sign
>   TheCU->setDWOId(Signature);
> }
> 
> +/// Analyzes each function parameter to determine whether it is constant
> +/// throughout the function body.
> +static void analyzeParametersModification(
> +ASTContext ,
> +llvm::DenseMap ,
> +llvm::DenseMap ) {
> +  for (auto  : SPDefCache) {
> +auto *FD = SP.first;
> +assert(FD->hasBody() && "Functions must have body here");
> +const Stmt *FuncBody = (*FD).getBody();
> +for (auto Parm : FD->parameters()) {
> +  ExprMutationAnalyzer FuncAnalyzer(*FuncBody, Ctx);
> +  if (FuncAnalyzer.isMutated(Parm))
> +continue;
> +
> +  auto I = ParamCache.find(Parm);
> +  assert(I != ParamCache.end() && "Parameters should be already cached");
> +  auto *DIParm = cast(I->second);
> +  DIParm->setIsNotModified();
> +}
> +  }
> +}
> +
> void CGDebugInfo::finalize() {
>   // Creating types might create further types - invalidating the current
>   // element and the size(), so don't cache/reference them.
> @@ -4627,6 +4662,10 @@ void CGDebugInfo::finalize() {
> if (auto MD = TypeCache[RT])
>   DBuilder.retainType(cast(MD));
> 
> +  if (CGM.getCodeGenOpts().EnableDebugEntryValues)
> +// This will be used to emit debug entry values.
> +analyzeParametersModification(CGM.getContext(), SPDefCache, ParamCache);
> +
>   DBuilder.finalize();
> }
> 
> 
> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=364424=364423=364424=diff
> ==
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Wed Jun 26 06:32:02 2019
> @@ -134,6 +134,10 @@ class CGDebugInfo {
> 
>   llvm::DenseMap DIFileCache;
>   llvm::DenseMap SPCache;
> +  /// Cache function definitions relevant to use for parameters mutation
> +  /// analysis.
> +  llvm::DenseMap SPDefCache;
> +  llvm::DenseMap ParamCache;
>   /// Cache declarations relevant to DW_TAG_imported_declarations (C++
>   /// using declarations) that aren't covered by other more specific caches.
>   llvm::DenseMap DeclCache;
> 
> Added: cfe/trunk/test/CodeGen/debug-info-param-modification.c
> URL: 
> 

r365716 - [CGDebugInfo] Fix -femit-debug-entry-values crash on os_log_helpers

2019-07-10 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Wed Jul 10 17:09:16 2019
New Revision: 365716

URL: http://llvm.org/viewvc/llvm-project?rev=365716=rev
Log:
[CGDebugInfo] Fix -femit-debug-entry-values crash on os_log_helpers

An os_log_helper FunctionDecl may not have a body. Ignore these for the
purposes of debug entry value emission.

Fixes an assertion failure seen in a stage2 build of clang:

Assertion failed: (FD->hasBody() && "Functions must have body here"),
function analyzeParametersModification

Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/test/CodeGen/debug-info-param-modification.c

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=365716=365715=365716=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Jul 10 17:09:16 2019
@@ -3587,9 +3587,12 @@ void CGDebugInfo::EmitFunctionStart(Glob
 
   // We use the SPDefCache only in the case when the debug entry values option
   // is set, in order to speed up parameters modification analysis.
-  if (CGM.getCodeGenOpts().EnableDebugEntryValues && HasDecl &&
-  isa(D))
-SPDefCache[cast(D)].reset(SP);
+  //
+  // FIXME: Use AbstractCallee here to support ObjCMethodDecl.
+  if (CGM.getCodeGenOpts().EnableDebugEntryValues && HasDecl)
+if (auto *FD = dyn_cast(D))
+  if (FD->hasBody() && !FD->param_empty())
+SPDefCache[FD].reset(SP);
 
   if (CGM.getCodeGenOpts().DwarfVersion >= 5) {
 // Starting with DWARF V5 method declarations are emitted as children of

Modified: cfe/trunk/test/CodeGen/debug-info-param-modification.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-param-modification.c?rev=365716=365715=365716=diff
==
--- cfe/trunk/test/CodeGen/debug-info-param-modification.c (original)
+++ cfe/trunk/test/CodeGen/debug-info-param-modification.c Wed Jul 10 17:09:16 
2019
@@ -1,12 +1,21 @@
-// RUN: %clang -Xclang -femit-debug-entry-values -g -O2 -S -target 
x86_64-none-linux-gnu -emit-llvm %s -o - | FileCheck %s 
-check-prefix=CHECK-ENTRY-VAL-OPT
+// RUN: %clang -Xclang -femit-debug-entry-values -g -O2 -Xclang 
-disable-llvm-passes -S -target x86_64-none-linux-gnu -emit-llvm %s -o - | 
FileCheck %s -check-prefix=CHECK-ENTRY-VAL-OPT
 // CHECK-ENTRY-VAL-OPT: !DILocalVariable(name: "a", arg: 1, scope: {{.*}}, 
file: {{.*}}, line: {{.*}}, type: {{.*}})
 // CHECK-ENTRY-VAL-OPT: !DILocalVariable(name: "b", arg: 2, scope: {{.*}}, 
file: {{.*}}, line: {{.*}}, type: {{.*}}, flags: DIFlagArgumentNotModified)
 //
-// RUN: %clang -g -O2 -target x86_64-none-linux-gnu -S -emit-llvm %s -o - | 
FileCheck %s
+// For the os_log_helper:
+// CHECK-ENTRY-VAL-OPT: !DILocalVariable(name: "buffer", arg: 1, {{.*}}, 
flags: DIFlagArtificial)
+//
+// RUN: %clang -g -O2 -Xclang -disable-llvm-passes -target 
x86_64-none-linux-gnu -S -emit-llvm %s -o - | FileCheck %s
 // CHECK-NOT: !DILocalVariable(name: "b", arg: 2, scope: {{.*}}, file: {{.*}}, 
line: {{.*}}, type: {{.*}}, flags: DIFlagArgumentNotModified)
 //
+// For the os_log_helper:
+// CHECK: !DILocalVariable(name: "buffer", arg: 1, {{.*}}, flags: 
DIFlagArtificial)
 
 int fn2 (int a, int b) {
   ++a;
   return b;
 }
+
+void test_builtin_os_log(void *buf, int i, const char *data) {
+  __builtin_os_log_format(buf, "%d %{public}s %{private}.16P", i, data, data);
+}


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


[PATCH] D64380: Add 'require_designated_init' and 'required' attribute to clang

2019-07-10 Thread Emmett Neyman via Phabricator via cfe-commits
emmettneyman planned changes to this revision.
emmettneyman added a comment.

Working on adding more information to the documentation and adding more 
in-depth unit tests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64380



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


[PATCH] D63663: [clang-doc] Add html links to references

2019-07-10 Thread Diego Astiazarán via Phabricator via cfe-commits
DiegoAstiazaran updated this revision to Diff 209096.
DiegoAstiazaran added a comment.

In tag nodes with children that are not inline, two text nodes that are 
adjacent won't have a new line between them. Tag nodes are still rendered in 
their own line.

  
A
 B
C
D
  

is now rendered as

  
A B
C
D
  


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

https://reviews.llvm.org/D63663

Files:
  clang-tools-extra/clang-doc/BitcodeReader.cpp
  clang-tools-extra/clang-doc/BitcodeWriter.cpp
  clang-tools-extra/clang-doc/BitcodeWriter.h
  clang-tools-extra/clang-doc/Generators.cpp
  clang-tools-extra/clang-doc/Generators.h
  clang-tools-extra/clang-doc/HTMLGenerator.cpp
  clang-tools-extra/clang-doc/MDGenerator.cpp
  clang-tools-extra/clang-doc/Representation.cpp
  clang-tools-extra/clang-doc/Representation.h
  clang-tools-extra/clang-doc/Serialize.cpp
  clang-tools-extra/clang-doc/YAMLGenerator.cpp
  clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
  clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp
  clang-tools-extra/unittests/clang-doc/YAMLGeneratorTest.cpp

Index: clang-tools-extra/unittests/clang-doc/YAMLGeneratorTest.cpp
===
--- clang-tools-extra/unittests/clang-doc/YAMLGeneratorTest.cpp
+++ clang-tools-extra/unittests/clang-doc/YAMLGeneratorTest.cpp
@@ -25,6 +25,7 @@
 TEST(YAMLGeneratorTest, emitNamespaceYAML) {
   NamespaceInfo I;
   I.Name = "Namespace";
+  I.Path = "path/to/A";
   I.Namespace.emplace_back(EmptySID, "A", InfoType::IT_namespace);
 
   I.ChildNamespaces.emplace_back(EmptySID, "ChildNamespace",
@@ -45,6 +46,7 @@
   R"raw(---
 USR: ''
 Name:'Namespace'
+Path:'path/to/A'
 Namespace:   
   - Type:Namespace
 Name:'A'
@@ -69,15 +71,18 @@
 TEST(YAMLGeneratorTest, emitRecordYAML) {
   RecordInfo I;
   I.Name = "r";
+  I.Path = "path/to/r";
   I.Namespace.emplace_back(EmptySID, "A", InfoType::IT_namespace);
 
   I.DefLoc = Location(10, llvm::SmallString<16>{"test.cpp"});
   I.Loc.emplace_back(12, llvm::SmallString<16>{"test.cpp"});
 
-  I.Members.emplace_back("int", "X", AccessSpecifier::AS_private);
+  I.Members.emplace_back("int", "path/to/int", "X",
+ AccessSpecifier::AS_private);
   I.TagType = TagTypeKind::TTK_Class;
-  I.Parents.emplace_back(EmptySID, "F", InfoType::IT_record);
-  I.VirtualParents.emplace_back(EmptySID, "G", InfoType::IT_record);
+  I.Parents.emplace_back(EmptySID, "F", InfoType::IT_record, "path/to/F");
+  I.VirtualParents.emplace_back(EmptySID, "G", InfoType::IT_record,
+"path/to/G");
 
   I.ChildRecords.emplace_back(EmptySID, "ChildStruct", InfoType::IT_record);
   I.ChildFunctions.emplace_back();
@@ -95,6 +100,7 @@
   R"raw(---
 USR: ''
 Name:'r'
+Path:'path/to/r'
 Namespace:   
   - Type:Namespace
 Name:'A'
@@ -108,14 +114,17 @@
 Members: 
   - Type:
   Name:'int'
+  Path:'path/to/int'
 Name:'X'
 Access:  Private
 Parents: 
   - Type:Record
 Name:'F'
+Path:'path/to/F'
 VirtualParents:  
   - Type:Record
 Name:'G'
+Path:'path/to/G'
 ChildRecords:
   - Type:Record
 Name:'ChildStruct'
@@ -139,8 +148,9 @@
   I.DefLoc = Location(10, llvm::SmallString<16>{"test.cpp"});
   I.Loc.emplace_back(12, llvm::SmallString<16>{"test.cpp"});
 
-  I.ReturnType = TypeInfo(EmptySID, "void", InfoType::IT_default);
-  I.Params.emplace_back("int", "P");
+  I.ReturnType =
+  TypeInfo(EmptySID, "void", InfoType::IT_default, "path/to/void");
+  I.Params.emplace_back("int", "path/to/int", "P");
   I.IsMethod = true;
   I.Parent = Reference(EmptySID, "Parent", InfoType::IT_record);
 
@@ -170,10 +180,12 @@
 Params:  
   - Type:
   Name:'int'
+  Path:'path/to/int'
 Name:'P'
 ReturnType:  
   Type:
 Name:'void'
+Path:'path/to/void'
 ...
 )raw";
   EXPECT_EQ(Expected, Actual.str());
Index: clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp
===
--- clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp
+++ clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp
@@ -57,7 +57,7 @@
   
 OneFunction
 
-   OneFunction()
+  OneFunction()
 
   
   Enums
@@ -73,14 +73,16 @@
 TEST(HTMLGeneratorTest, emitRecordHTML) {
   RecordInfo I;
   I.Name = "r";
+  I.Path = "X/Y/Z";
   I.Namespace.emplace_back(EmptySID, "A", InfoType::IT_namespace);
 
   I.DefLoc = Location(10, 

[PATCH] D64380: Add 'require_designated_init' and 'required' attribute to clang

2019-07-10 Thread Emmett Neyman via Phabricator via cfe-commits
emmettneyman added inline comments.



Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:3533-3541
+def err_require_designated_init_failed : Error<
+  "variable declaration does not use designated initializer syntax">;
+def note_declared_required_designated_init_here : Note<
+  "required by 'require_designated_init' attribute here">;
+
+def err_required_failed : Error<
+  "initializer for variable %0 must explicitly initialize field %1">;

aaron.ballman wrote:
> I'm a little uncomfortable with these being errors rather than warnings. I 
> think of these attributes as being preferences rather than requirements; the 
> code isn't *wrong* if it fails to use the designated initializer (it's 
> conforming to C or C++, does not have UB, etc) and other implementations are 
> free to ignore those attributes and the end result will be identical to 
> what's produced by Clang.
> 
> What do you think about turning these into warnings? Users can always use 
> `-Werror` to strengthen their own requirements.
That makes sense, I'll make the change.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64380



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


r365714 - Attempt to fix bots after r365703

2019-07-10 Thread Nico Weber via cfe-commits
Author: nico
Date: Wed Jul 10 16:50:16 2019
New Revision: 365714

URL: http://llvm.org/viewvc/llvm-project?rev=365714=rev
Log:
Attempt to fix bots after r365703

Modified:
cfe/trunk/test/Driver/as-options.s

Modified: cfe/trunk/test/Driver/as-options.s
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/as-options.s?rev=365714=365713=365714=diff
==
--- cfe/trunk/test/Driver/as-options.s (original)
+++ cfe/trunk/test/Driver/as-options.s Wed Jul 10 16:50:16 2019
@@ -39,10 +39,22 @@
 // Test that assembler options don't cause warnings when there's no assembler
 // stage.
 
-// RUN: %clang -mincremental-linker-compatible -E -o /dev/null %s 2>&1 \
+// RUN: %clang -mincremental-linker-compatible -E \
+// RUN:   -o /dev/null -x c++ %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=WARN --allow-empty %s
-// RUN: %clang -mimplicit-it=always -target armv7-linux-gnueabihf -E %s \
+// RUN: %clang -mincremental-linker-compatible -E \
+// RUN:   -o /dev/null -x assembler-with-cpp %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=WARN --allow-empty %s
-// RUN: %clang -Wa,-mbig-obj -target i386-pc-windows -E %s \
+// RUN: %clang -mimplicit-it=always -target armv7-linux-gnueabi -E \
+// RUN:   -o /dev/null -x c++ %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=WARN --allow-empty %s
+// RUN: %clang -mimplicit-it=always -target armv7-linux-gnueabi -E \
+// RUN:   -o /dev/null -x assembler-with-cpp %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=WARN --allow-empty %s
+// RUN: %clang -Wa,-mbig-obj -target i386-pc-windows -E \
+// RUN:   -o /dev/null -x c++ %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=WARN --allow-empty %s
+// RUN: %clang -Wa,-mbig-obj -target i386-pc-windows -E \
+// RUN:   -o /dev/null -x assembler-with-cpp %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=WARN --allow-empty %s
 // WARN-NOT: unused


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


[PATCH] D64380: Add 'require_designated_init' and 'required' attribute to clang

2019-07-10 Thread Emmett Neyman via Phabricator via cfe-commits
emmettneyman updated this revision to Diff 209097.
emmettneyman marked 32 inline comments as done.
emmettneyman added a comment.

Addressed several of the comments regarding naming and style.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64380

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/test/Misc/pragma-attribute-supported-attributes-list.test
  clang/test/SemaCXX/attr-requires-designator.cpp
  clang/test/SemaCXX/attr-requires-init.cpp

Index: clang/test/SemaCXX/attr-requires-init.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/attr-requires-init.cpp
@@ -0,0 +1,61 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+[[clang::requires_init]] int x;// expected-warning{{'requires_init' attribute only applies to non-static data members}}
+[[clang::requires_init]] void fun(int x) { // expected-warning{{'requires_init' attribute only applies to non-static data members}}
+  return;
+}
+struct [[clang::requires_init]] Foo { // expected-warning{{'requires_init' attribute only applies to non-static data members}}
+  int x;
+};
+
+// Struct with one required field
+struct Bar {
+  [[clang::requires_init]] int y; // expected-note 0+ {{enforced by 'requires_init' attribute here}}
+};
+
+// The following are invalid ways of initializing instances of this struct.
+Bar b1;// expected-warning{{initializer for variable b1 must explicitly initialize field y}}
+Bar b2{};  // expected-warning{{initializer for variable b2 must explicitly initialize field y}}
+Bar b3{1}; // expected-warning{{initializer for variable b3 must explicitly initialize field y}}
+
+// The following are valid ways of initializing instances of this struct.
+Bar b6{.y = 1};
+
+// Struct with multiple required fields
+struct Baz {
+  [[clang::requires_init]] int x; // expected-note 0+ {{enforced by 'requires_init' attribute here}}
+  int y;
+  [[clang::requires_init]] int z; // expected-note 0+ {{enforced by 'requires_init' attribute here}}
+};
+
+// The following are invalid ways of initializing instances of this struct.
+Baz z1; // expected-warning{{initializer for variable z1 must explicitly initialize field x}} expected-warning{{initializer for variable z1 must explicitly initialize field z}}
+Baz z2{};   // expected-warning{{initializer for variable z2 must explicitly initialize field x}} expected-warning{{initializer for variable z2 must explicitly initialize field z}}
+Baz z3{1, 2};   // expected-warning{{initializer for variable z3 must explicitly initialize field x}} expected-warning{{initializer for variable z3 must explicitly initialize field z}}
+Baz z4{1, 2, 3};// expected-warning{{initializer for variable z4 must explicitly initialize field x}} expected-warning{{initializer for variable z4 must explicitly initialize field z}}
+Baz z5{.x = 1, 2};  // expected-warning{{initializer for variable z5 must explicitly initialize field z}}
+Baz z6{.x = 1, .y = 2}; // expected-warning{{initializer for variable z6 must explicitly initialize field z}}
+
+// The following are valid ways of initializing instances of this struct.
+Baz z7{.x = 1, .y = 2, .z = 3};
+Baz z8{.x = 1, .z = 3};
+Baz z9{.x = 1, 2, .z = 3};
+
+// The required attribute can also be applied to public fields of classes.
+class Cla {
+public:
+  [[clang::requires_init]] int x; // expected-note 0+ {{enforced by 'requires_init' attribute here}}
+  int y;
+};
+
+// The following are invalid ways of initializing instances of this class.
+Cla c1;// expected-warning{{initializer for variable c1 must explicitly initialize field x}}
+Cla c2{};  // expected-warning{{initializer for variable c2 must explicitly initialize field x}}
+Cla c3{1}; // expected-warning{{initializer for variable c3 must explicitly initialize field x}}
+Cla c4{1, 2};  // expected-warning{{initializer for variable c4 must explicitly initialize field x}}
+Cla c5{1, .y = 2}; // expected-warning{{initializer for variable c5 must explicitly initialize field x}}
+
+// The following are valid ways of initializing instances of this class.
+Cla c6{.x = 1};
+Cla c7{.x = 1, .y = 2};
+Cla c8{.x = 1, 2};
Index: clang/test/SemaCXX/attr-requires-designator.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/attr-requires-designator.cpp
@@ -0,0 +1,102 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// The requires_designator attribute only applies to types. It will
+// generate a warning when attached to variables, functions, arrays, etc.
+[[clang::requires_designator]] int x;// expected-warning{{'requires_designator' attribute only applies to structs, unions, and 

[clang-tools-extra] r365713 - rL365634 adds a unique_ptr in GobalCompilationDatabase.h:108 but CompilationDatabase is only forward declared. This makes the header not compile stan

2019-07-10 Thread Sterling Augustine via cfe-commits
Author: saugustine
Date: Wed Jul 10 16:38:00 2019
New Revision: 365713

URL: http://llvm.org/viewvc/llvm-project?rev=365713=rev
Log:
rL365634 adds a unique_ptr in 
GobalCompilationDatabase.h:108 but CompilationDatabase is only forward 
declared. This makes the header not compile standalone, because unique_ptrs 
expect to have the full-definition of the...

Summary:
...template argument.

Remove the forward declaration and include the appropriate header instead.
Remove CompileCommand too, which is also in the header.

Modified:
clang-tools-extra/trunk/clangd/GlobalCompilationDatabase.h

Modified: clang-tools-extra/trunk/clangd/GlobalCompilationDatabase.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/GlobalCompilationDatabase.h?rev=365713=365712=365713=diff
==
--- clang-tools-extra/trunk/clangd/GlobalCompilationDatabase.h (original)
+++ clang-tools-extra/trunk/clangd/GlobalCompilationDatabase.h Wed Jul 10 
16:38:00 2019
@@ -11,6 +11,7 @@
 
 #include "Function.h"
 #include "Path.h"
+#include "clang/Tooling/CompilationDatabase.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringMap.h"
 #include 
@@ -19,11 +20,6 @@
 
 namespace clang {
 
-namespace tooling {
-class CompilationDatabase;
-struct CompileCommand;
-} // namespace tooling
-
 namespace clangd {
 
 class Logger;


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


[PATCH] D64504: Various minor tweaks to CLCompatOptions.td

2019-07-10 Thread Nico Weber via Phabricator via cfe-commits
thakis updated this revision to Diff 209093.
thakis marked 4 inline comments as done.
thakis added a comment.

comments


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

https://reviews.llvm.org/D64504

Files:
  clang/include/clang/Driver/CLCompatOptions.td

Index: clang/include/clang/Driver/CLCompatOptions.td
===
--- clang/include/clang/Driver/CLCompatOptions.td
+++ clang/include/clang/Driver/CLCompatOptions.td
@@ -52,21 +52,21 @@
 // already in the right group.)
 
 def _SLASH_Brepro : CLFlag<"Brepro">,
-  HelpText<"Emit an object file which can be reproduced over time">,
+  HelpText<"Do not write current time into COFF output (breaks link.exe /incremental)">,
   Alias;
 def _SLASH_Brepro_ : CLFlag<"Brepro-">,
-  HelpText<"Emit an object file which cannot be reproduced over time">,
+  HelpText<"Write current time into COFF output (default)">,
   Alias;
 def _SLASH_C : CLFlag<"C">,
-  HelpText<"Don't discard comments when preprocessing">, Alias;
+  HelpText<"Do not discard comments when preprocessing">, Alias;
 def _SLASH_c : CLFlag<"c">, HelpText<"Compile only">, Alias;
 def _SLASH_d1PP : CLFlag<"d1PP">,
   HelpText<"Retain macro definitions in /E mode">, Alias;
 def _SLASH_d1reportAllClassLayout : CLFlag<"d1reportAllClassLayout">,
   HelpText<"Dump record layout information">,
-Alias, AliasArgs<["-fdump-record-layouts"]>;
+  Alias, AliasArgs<["-fdump-record-layouts"]>;
 def _SLASH_diagnostics_caret : CLFlag<"diagnostics:caret">,
-  HelpText<"Enable caret and column diagnostics (on by default)">;
+  HelpText<"Enable caret and column diagnostics (default)">;
 def _SLASH_diagnostics_column : CLFlag<"diagnostics:column">,
   HelpText<"Disable caret diagnostics but keep column info">;
 def _SLASH_diagnostics_classic : CLFlag<"diagnostics:classic">,
@@ -83,12 +83,14 @@
 def _SLASH_fp_strict : CLFlag<"fp:strict">, HelpText<"">, Alias;
 def _SLASH_GA : CLFlag<"GA">, Alias, AliasArgs<["local-exec"]>,
   HelpText<"Assume thread-local variables are defined in the executable">;
-def _SLASH_GR : CLFlag<"GR">, HelpText<"Enable emission of RTTI data">;
-def _SLASH_GR_ : CLFlag<"GR-">, HelpText<"Disable emission of RTTI data">;
-def _SLASH_GF : CLIgnoredFlag<"GF">, HelpText<"Enable string pooling (default)">;
+def _SLASH_GR : CLFlag<"GR">, HelpText<"Emit RTTI data (default)">;
+def _SLASH_GR_ : CLFlag<"GR-">, HelpText<"Do not emit RTTI data">;
+def _SLASH_GF : CLIgnoredFlag<"GF">,
+  HelpText<"Enable string pooling (default)">;
 def _SLASH_GF_ : CLFlag<"GF-">, HelpText<"Disable string pooling">,
   Alias;
-def _SLASH_GS : CLFlag<"GS">, HelpText<"Enable buffer security check (default)">;
+def _SLASH_GS : CLFlag<"GS">,
+  HelpText<"Enable buffer security check (default)">;
 def _SLASH_GS_ : CLFlag<"GS-">, HelpText<"Disable buffer security check">;
 def : CLFlag<"Gs">, HelpText<"Use stack probes (default)">,
   Alias, AliasArgs<["4096"]>;
@@ -97,12 +99,12 @@
 def _SLASH_Gy : CLFlag<"Gy">, HelpText<"Put each function in its own section">,
   Alias;
 def _SLASH_Gy_ : CLFlag<"Gy-">,
-  HelpText<"Don't put each function in its own section (default)">,
+  HelpText<"Do not put each function in its own section (default)">,
   Alias;
 def _SLASH_Gw : CLFlag<"Gw">, HelpText<"Put each data item in its own section">,
   Alias;
 def _SLASH_Gw_ : CLFlag<"Gw-">,
-  HelpText<"Don't put each data item in its own section">,
+  HelpText<"Do not put each data item in its own section (default)">,
   Alias;
 def _SLASH_help : CLFlag<"help">, Alias,
   HelpText<"Display available options">;
@@ -121,13 +123,13 @@
 // FIXME: Not sure why we have -O0 here; MSVC doesn't support that.
 def : CLFlag<"O0">, Alias, HelpText<"Disable optimization">;
 def : CLFlag<"O1">, Alias<_SLASH_O>, AliasArgs<["1"]>,
-  HelpText<"Optimize for size  (same as /Og /Os /Oy /Ob2 /GF /Gy)">;
+  HelpText<"Optimize for size  (like /Og /Os /Oy /Ob2 /GF /Gy)">;
 def : CLFlag<"O2">, Alias<_SLASH_O>, AliasArgs<["2"]>,
-  HelpText<"Optimize for speed (same as /Og /Oi /Ot /Oy /Ob2 /GF /Gy)">;
+  HelpText<"Optimize for speed (like /Og /Oi /Ot /Oy /Ob2 /GF /Gy)">;
 def : CLFlag<"Ob0">, Alias<_SLASH_O>, AliasArgs<["b0"]>,
   HelpText<"Disable function inlining">;
 def : CLFlag<"Ob1">, Alias<_SLASH_O>, AliasArgs<["b1"]>,
-  HelpText<"Only inline functions which are (explicitly or implicitly) marked inline">;
+  HelpText<"Only inline functions explicitly or implicitly marked inline">;
 def : CLFlag<"Ob2">, Alias<_SLASH_O>, AliasArgs<["b2"]>,
   HelpText<"Inline functions as deemed beneficial by the compiler">;
 def : CLFlag<"Od">, Alias<_SLASH_O>, AliasArgs<["d"]>,
@@ -143,7 +145,7 @@
 def : CLFlag<"Ot">, Alias<_SLASH_O>, AliasArgs<["t"]>,
   HelpText<"Optimize for speed">;
 def : CLFlag<"Ox">, Alias<_SLASH_O>, AliasArgs<["x"]>,
-  HelpText<"Deprecated (same as /Og /Oi /Ot /Oy /Ob2); use /O2 instead">;
+  HelpText<"Deprecated (like /Og /Oi /Ot /Oy /Ob2); use /O2">;
 def : CLFlag<"Oy">, 

[PATCH] D64504: Various minor tweaks to CLCompatOptions.td

2019-07-10 Thread Nico Weber via Phabricator via cfe-commits
thakis added inline comments.



Comment at: clang/include/clang/Driver/CLCompatOptions.td:250
 def _SLASH_Zi : CLFlag<"Zi">, Alias<_SLASH_Z7>,
-  HelpText<"Alias for /Z7. Does not produce PDBs.">;
+  HelpText<"Like /Z7">;
 def _SLASH_Zp : CLJoined<"Zp">,

rnk wrote:
> I liked "Alias for /Z7". The note that it doesn't produce type server PDBs 
> like /Zi would is interesting, but perhaps too much info for --help text.
"Alias" is a fairly technical word; I figured less jargon is maybe better. 
There's still plenty of jargon left :) Maybe "Same as /Z7"? (I went with "like" 
since that's what some of the parens say)



Comment at: clang/include/clang/Driver/CLCompatOptions.td:294
 def _SLASH_GX : CLFlag<"GX">,
-  HelpText<"Enable exception handling">;
+  HelpText<"Deprecated (like /EHsc)">;
 def _SLASH_GX_ : CLFlag<"GX-">,

rnk wrote:
> "Deprecated in favor of /EHsc"? or "(use /EHsc instead)"?
The other deprecated flags use "Deprecated (description); use /replacement". 
Changed  to "Deprecated; use /EHsc"; description and replacement are the same 
here. (Except that /EH doesn't have a great help text atm.)


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

https://reviews.llvm.org/D64504



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


[PATCH] D64506: clang-cl: Remove -O0 option

2019-07-10 Thread Nico Weber via Phabricator via cfe-commits
thakis updated this revision to Diff 209092.
thakis added a comment.
Herald added subscribers: llvm-commits, kubamracek.
Herald added a project: LLVM.

update tests

(not yet executed, don't have a win machine today)


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

https://reviews.llvm.org/D64506

Files:
  clang/include/clang/Driver/CLCompatOptions.td
  compiler-rt/test/asan/TestCases/Windows/aligned_mallocs.cc
  compiler-rt/test/asan/TestCases/Windows/allocators_sanity.cc
  compiler-rt/test/asan/TestCases/Windows/beginthreadex.cc
  compiler-rt/test/asan/TestCases/Windows/bitfield.cc
  compiler-rt/test/asan/TestCases/Windows/bitfield_uaf.cc
  compiler-rt/test/asan/TestCases/Windows/calloc_left_oob.cc
  compiler-rt/test/asan/TestCases/Windows/calloc_right_oob.cc
  compiler-rt/test/asan/TestCases/Windows/calloc_uaf.cc
  compiler-rt/test/asan/TestCases/Windows/coverage-dll-stdio.cc
  compiler-rt/test/asan/TestCases/Windows/crt_initializers.cc
  compiler-rt/test/asan/TestCases/Windows/demangled_names.cc
  compiler-rt/test/asan/TestCases/Windows/dll_aligned_mallocs.cc
  compiler-rt/test/asan/TestCases/Windows/dll_allocators_sanity.cc
  compiler-rt/test/asan/TestCases/Windows/dll_cerr.cc
  compiler-rt/test/asan/TestCases/Windows/dll_control_c.cc
  compiler-rt/test/asan/TestCases/Windows/dll_global_dead_strip.c
  compiler-rt/test/asan/TestCases/Windows/dll_host.cc
  compiler-rt/test/asan/TestCases/Windows/dll_intercept_memchr.cc
  compiler-rt/test/asan/TestCases/Windows/dll_intercept_memcpy.cc
  compiler-rt/test/asan/TestCases/Windows/dll_intercept_memcpy_indirect.cc
  compiler-rt/test/asan/TestCases/Windows/dll_intercept_memset.cc
  compiler-rt/test/asan/TestCases/Windows/dll_intercept_strlen.cc
  compiler-rt/test/asan/TestCases/Windows/dll_malloc_left_oob.cc
  compiler-rt/test/asan/TestCases/Windows/dll_malloc_uaf.cc
  compiler-rt/test/asan/TestCases/Windows/dll_noreturn.cc
  compiler-rt/test/asan/TestCases/Windows/dll_null_deref.cc
  compiler-rt/test/asan/TestCases/Windows/dll_operator_array_new_left_oob.cc
  
compiler-rt/test/asan/TestCases/Windows/dll_operator_array_new_with_dtor_left_oob.cc
  compiler-rt/test/asan/TestCases/Windows/dll_poison_unpoison.cc
  
compiler-rt/test/asan/TestCases/Windows/dll_report_globals_symbolization_at_startup.cc
  compiler-rt/test/asan/TestCases/Windows/dll_seh.cc
  compiler-rt/test/asan/TestCases/Windows/dll_stack_use_after_return.cc
  compiler-rt/test/asan/TestCases/Windows/dll_thread_stack_array_left_oob.cc
  compiler-rt/test/asan/TestCases/Windows/double_free.cc
  compiler-rt/test/asan/TestCases/Windows/double_operator_delete.cc
  compiler-rt/test/asan/TestCases/Windows/global_const_string.cc
  compiler-rt/test/asan/TestCases/Windows/global_const_string_oob.cc
  compiler-rt/test/asan/TestCases/Windows/heapalloc.cc
  compiler-rt/test/asan/TestCases/Windows/heapalloc_doublefree.cc
  compiler-rt/test/asan/TestCases/Windows/heapalloc_flags_fallback.cc
  compiler-rt/test/asan/TestCases/Windows/heapalloc_huge.cc
  compiler-rt/test/asan/TestCases/Windows/heapalloc_sanity.cc
  compiler-rt/test/asan/TestCases/Windows/heapalloc_uaf.cc
  compiler-rt/test/asan/TestCases/Windows/heaprealloc.cc
  compiler-rt/test/asan/TestCases/Windows/hello_world.cc
  compiler-rt/test/asan/TestCases/Windows/intercept_memcpy.cc
  compiler-rt/test/asan/TestCases/Windows/intercept_strdup.cc
  compiler-rt/test/asan/TestCases/Windows/intercept_strlen.cc
  compiler-rt/test/asan/TestCases/Windows/interface_symbols_windows.cc
  compiler-rt/test/asan/TestCases/Windows/iostream_sbo.cc
  compiler-rt/test/asan/TestCases/Windows/malloc_left_oob.cc
  compiler-rt/test/asan/TestCases/Windows/malloc_right_oob.cc
  compiler-rt/test/asan/TestCases/Windows/malloc_uaf.cc
  compiler-rt/test/asan/TestCases/Windows/null_deref_multiple_dlls.cc
  compiler-rt/test/asan/TestCases/Windows/oom.cc
  compiler-rt/test/asan/TestCases/Windows/operator_array_new_left_oob.cc
  compiler-rt/test/asan/TestCases/Windows/operator_array_new_right_oob.cc
  compiler-rt/test/asan/TestCases/Windows/operator_array_new_uaf.cc
  
compiler-rt/test/asan/TestCases/Windows/operator_array_new_with_dtor_left_oob.cc
  compiler-rt/test/asan/TestCases/Windows/operator_delete_wrong_argument.cc
  compiler-rt/test/asan/TestCases/Windows/operator_new_left_oob.cc
  compiler-rt/test/asan/TestCases/Windows/operator_new_right_oob.cc
  compiler-rt/test/asan/TestCases/Windows/operator_new_uaf.cc
  compiler-rt/test/asan/TestCases/Windows/queue_user_work_item_report.cc
  compiler-rt/test/asan/TestCases/Windows/realloc_left_oob.cc
  compiler-rt/test/asan/TestCases/Windows/realloc_right_oob.cc
  compiler-rt/test/asan/TestCases/Windows/realloc_uaf.cc
  compiler-rt/test/asan/TestCases/Windows/report_globals_reload_dll.cc
  compiler-rt/test/asan/TestCases/Windows/report_globals_vs_freelibrary.cc
  compiler-rt/test/asan/TestCases/Windows/rtlallocateheap.cc
  compiler-rt/test/asan/TestCases/Windows/rtlallocateheap_flags_fallback.cc
  

[PATCH] D64506: clang-cl: Remove -O0 option

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

In D64506#1579251 , @rnk wrote:

> Does `clang-cl -O0` without a `/` still work, though? It's used:
>
> $ git grep O0 ../compiler-rt/test/asan/TestCases/Windows/
>  ../compiler-rt/test/asan/TestCases/Windows/aligned_mallocs.cc:// RUN: 
> %clang_cl_asan -O0 %s -Fe%t
>  ../compiler-rt/test/asan/TestCases/Windows/allocators_sanity.cc:// RUN: 
> %clang_cl_asan -O0 %s -Fe%t
>  ../compiler-rt/test/asan/TestCases/Windows/beginthreadex.cc:// RUN: 
> %clang_cl_asan -O0 %s -Fe%t
>  ../compiler-rt/test/asan/TestCases/Windows/bitfield.cc:// RUN: 
> %clang_cl_asan -O0 %s -Fe%t
>  ../compiler-rt/test/asan/TestCases/Windows/bitfield_uaf.cc:// RUN: 
> %clang_cl_asan -O0 %s -Fe%t
>  ../compiler-rt/test/asan/TestCases/Windows/calloc_left_oob.cc:// RUN: 
> %clang_cl_asan -O0 %s -Fe%t
>  ../compiler-rt/test/asan/TestCases/Windows/calloc_right_oob.cc:// RUN: 
> %clang_cl_asan -O0 %s -Fe%t
>  ...


Oh thanks, I only ran clang tests, not compiler-rt tests.

It no longer works, O isn't a CoreOption:

  $ out/gn/bin/clang-cl test.cc -O0 /c
  clang: warning: argument unused during compilation: '-O0' 
[-Wunused-command-line-argument]

But these tests should just use `/Od`, right?


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

https://reviews.llvm.org/D64506



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


[PATCH] D63753: [Sema] Instead of rejecting C unions with non-trivial fields, detect attempts to destruct/initialize/copy them.

2019-07-10 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: lib/Sema/SemaExpr.cpp:6097
+  // non-trivial to copy or default-initialize.
+  checkNonTrivialCUnionInInitList(ILE);
+  }

ahatanak wrote:
> rjmccall wrote:
> > Can we extract a common function that checks the initializer expression of 
> > a non-trivial C union?  I think there are at least three separate places 
> > that do that in this patch, and it's not too hard to imagine that we might 
> > want to add more cases to the common analysis.
> Do you mean we should have something like `bool 
> checkNonTrivialCUnionInInitList(const Expr *Init)` so that we don't have to 
> call `dyn_cast`? If `Init` is an `InitListExpr`, the function diagnoses 
> non-trivial C unions types and returns true, otherwise it returns false.
Well, the goal is not to eliminate a `dyn_cast`, it's to generally perform 
whatever checking is necessary for an initializer.  Currently all of our 
checking is specific to `InitListExpr`, but there might be other cases we'll 
want to care about, in which case we'll probably care about them in all three 
of these places.


Repository:
  rC Clang

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

https://reviews.llvm.org/D63753



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


[PATCH] D64538: [Driver] Don't escape backslashes on Windows

2019-07-10 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added a comment.

In D64538#1579610 , @rnk wrote:

> In D64538#1579573 , @smeenai wrote:
>
> > In D64538#1579561 , @rnk wrote:
> >
> > > An extremely convenient feature of the current escaping pattern is that 
> > > it magically works for both the cmd shell and various bash 
> > > implementations. You can simply copy paste the commands and run them. 
> > > This matters, for example, for the .sh crash reproducer script. On 
> > > Windows today, you can just run it with bash, and it works. So, I'd 
> > > prefer it if we didn't do this.
> > >
> > > If you want -### output to be more FileCheck friendly, then I would 
> > > recommend adding a new driver flag for testing that dumps the commands 
> > > without doing any escaping. This came up before:
> > >  https://reviews.llvm.org/D62493
> >
> >
> > As long as the backslashes aren't followed by a few special characters (as 
> > detailed in my comment), the backslash should still continue to work. I've 
> > been testing this with git bash and I'm still able to copy-paste the ouptut 
> > command.
>
>
> For the use case of crash reproduction, we often get these .sh files from 
> users, and then try to reproduce and reduce the crash on Linux. Right now 
> it's just a matter of adjusting the clang binary being run to reproduce a 
> crash, but with this change, it will be harder. The current escaping is kind 
> of the universal currency, a quoting style that is accepted everywhere.


I'm not fully understanding this. If the .sh file was generated on Windows, 
it'll contain backslashes in any arguments that are paths, right? Before this 
change, those backslashes would have been doubled up, but the backslash still 
wouldn't work as a path separator on Linux, so those arguments would need 
manual adjustment. I guess the other case that matters is if you have a 
backslash in an argument which isn't a path, in which case the old behavior was 
definitely correct and the new one definitely isn't.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64538



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


[PATCH] D64537: [WebAssembly] Implement thread-local storage for non-PIC cases

2019-07-10 Thread Dan Gohman via Phabricator via cfe-commits
sunfish added a comment.

This looks nice!

> __wasm_init_tls(calloc(__builtin_wasm_tls_size(), 1));

Would it make sense to change the API contract for `__wasm_init_tls` to 
guarantee that initializes all bytes (with zeros as needed)? `__wasm_init_tls` 
knows what bytes it's initializing, so we could use plain `malloc` instead of 
`calloc` and avoid redundant zero initialization of those bytes.




Comment at: llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp:
+
+  return DAG.getNode(ISD::ADD, DL, VT, TLSBase, TLSOffset);
+}

It looks like this supports local-exec, but would need to be extended to handle 
initial-exec or the other TLS models. Assuming this is correct, could you add a 
check for the TLS model and `report_fatal_error` on unsupported models?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64537



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


[PATCH] D64537: [WebAssembly] Implement thread-local storage for non-PIC cases

2019-07-10 Thread Guanzhong Chen via Phabricator via cfe-commits
quantum updated this revision to Diff 209090.
quantum added a comment.

Fix `fail` call.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64537

Files:
  clang/include/clang/Basic/BuiltinsWebAssembly.def
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/builtins-wasm.c
  lld/test/wasm/data-layout.ll
  lld/test/wasm/gc-sections.ll
  lld/test/wasm/tls.ll
  lld/wasm/Driver.cpp
  lld/wasm/Symbols.cpp
  lld/wasm/Symbols.h
  lld/wasm/Writer.cpp
  llvm/include/llvm/BinaryFormat/Wasm.h
  llvm/include/llvm/IR/IntrinsicsWebAssembly.td
  llvm/include/llvm/MC/MCSectionWasm.h
  llvm/lib/MC/WasmObjectWriter.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyISD.def
  llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.h
  llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
  llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
  llvm/test/CodeGen/WebAssembly/target-features-tls.ll
  llvm/test/CodeGen/WebAssembly/tls.ll

Index: llvm/test/CodeGen/WebAssembly/tls.ll
===
--- llvm/test/CodeGen/WebAssembly/tls.ll
+++ llvm/test/CodeGen/WebAssembly/tls.ll
@@ -1,17 +1,87 @@
-; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers | FileCheck --check-prefix=SINGLE %s
+; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals | FileCheck --check-prefixes=CHECK,O2 %s
+; RUN: llc -O0 < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals | FileCheck --check-prefixes=CHECK,O0 %s
 target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
 target triple = "wasm32-unknown-unknown"
 
-; SINGLE-LABEL: address_of_tls:
+; O0-LABEL: address_of_tls:
+; O2-LABEL: address_of_tls:
 define i32 @address_of_tls() {
-  ; SINGLE: i32.const $push0=, tls
-  ; SINGLE-NEXT: return $pop0
+  ; O0: i32.const tls
+  ; O0-NEXT: global.get __tls_base
+  ; O0-NEXT: i32.add
+  ; O0-NEXT: return
+
+  ; O2: global.get __tls_base
+  ; O2-NEXT: i32.const tls
+  ; O2-NEXT: i32.add
+  ; O2-NEXT: return
   ret i32 ptrtoint(i32* @tls to i32)
 }
 
-; SINGLE: .type	tls,@object
-; SINGLE-NEXT: .section	.bss.tls,"",@
-; SINGLE-NEXT: .p2align 2
-; SINGLE-NEXT: tls:
-; SINGLE-NEXT: .int32 0
+; O0-LABEL: ptr_to_tls
+; O2-LABEL: ptr_to_tls
+define i32* @ptr_to_tls() {
+  ; O0: i32.const tls
+  ; O0-NEXT: global.get __tls_base
+  ; O0-NEXT: i32.add
+  ; O0-NEXT: return
+
+  ; O2: global.get __tls_base
+  ; O2-NEXT: i32.const tls
+  ; O2-NEXT: i32.add
+  ; O2-NEXT: return
+  ret i32* @tls
+}
+
+; O0-LABEL: tls_load
+; O2-LABEL: tls_load
+define i32 @tls_load() {
+  ; O0: i32.const tls
+  ; O0-NEXT: global.get __tls_base
+  ; O0-NEXT: i32.add
+  ; O0-NEXT: i32.load 0
+  ; O0-NEXT: return
+
+  ; O2: global.get __tls_base
+  ; O2-NEXT: i32.const tls
+  ; O2-NEXT: i32.add
+  ; O2-NEXT: i32.load 0
+  ; O2-NEXT: return
+  %tmp = load i32, i32* @tls, align 4
+  ret i32 %tmp
+}
+
+; O0-LABEL: tls_store
+; O2-LABEL: tls_store
+define void @tls_store(i32 %x) {
+  ; O0: i32.const tls
+  ; O0-NEXT: global.get __tls_base
+  ; O0-NEXT: i32.add
+  ; O0-NEXT: i32.store 0
+  ; O0-NEXT: return
+
+  ; O2: global.get __tls_base
+  ; O2-NEXT: i32.const tls
+  ; O2-NEXT: i32.add
+  ; O2-NEXT: i32.store 0
+  ; O2-NEXT: return
+  store i32 %x, i32* @tls, align 4
+  ret void
+}
+
+; CHECK-LABEL: tls_size:
+; CHECK-NEXT: .functype tls_size () -> (i32)
+; CHECK-NEXT: global.get __tls_size
+; CHECK-NEXT: return
+declare i32 @llvm.wasm.tls.size.i32()
+define i32 @tls_size() {
+  %1 = call i32 @llvm.wasm.tls.size.i32()
+  ret i32 %1
+}
+
+; CHECK: .type tls,@object
+; CHECK-NEXT: .section .tbss.tls,"",@
+; CHECK-NEXT: .p2align 2
+; CHECK-NEXT: tls:
+; CHECK-NEXT: .int32 0
 @tls = internal thread_local global i32 0
Index: llvm/test/CodeGen/WebAssembly/target-features-tls.ll
===
--- llvm/test/CodeGen/WebAssembly/target-features-tls.ll
+++ llvm/test/CodeGen/WebAssembly/target-features-tls.ll
@@ -1,5 +1,5 @@
-; RUN: llc < %s -mattr=-atomics | FileCheck %s --check-prefixes CHECK,NO-ATOMICS
-; RUN: llc < %s -mattr=+atomics | FileCheck %s --check-prefixes CHECK,ATOMICS
+; RUN: llc < %s -mattr=-atomics | FileCheck %s --check-prefixes NO-ATOMICS
+; RUN: llc < %s -mattr=+atomics | FileCheck %s --check-prefixes ATOMICS
 
 ; Test that the target features section contains -atomics or +atomics
 ; for modules that have thread local storage in their source.
@@ -9,16 +9,13 @@
 
 @foo = internal thread_local global i32 0
 
-; CHECK-LABEL: .custom_section.target_features,"",@
 
 ; -atomics
-; NO-ATOMICS-NEXT: .int8 1
-; NO-ATOMICS-NEXT: .int8 45
-; NO-ATOMICS-NEXT: .int8 7
-; NO-ATOMICS-NEXT: .ascii "atomics"

[PATCH] D64375: [OpenMP][Docs] Provide implementation status details

2019-07-10 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert updated this revision to Diff 209089.
jdoerfert marked 4 inline comments as done.
jdoerfert added a comment.

Fixes according to comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64375

Files:
  clang/docs/OpenMPSupport.rst

Index: clang/docs/OpenMPSupport.rst
===
--- clang/docs/OpenMPSupport.rst
+++ clang/docs/OpenMPSupport.rst
@@ -2,12 +2,12 @@
 
   
 .none { background-color: #FF }
-.partial { background-color: #99 }
+.part { background-color: #99 }
 .good { background-color: #CCFF99 }
   
 
 .. role:: none
-.. role:: partial
+.. role:: part
 .. role:: good
 
 .. contents::
@@ -17,7 +17,7 @@
 OpenMP Support
 ==
 
-Clang supports the following OpenMP 5.0 features
+Clang supports the following OpenMP 5.0 features (see also `OpenMP implementation details`_):
 
 * The `reduction`-based clauses in the `task` and `target`-based directives.
 
@@ -37,7 +37,7 @@
 Clang fully supports OpenMP 4.5. Clang supports offloading to X86_64, AArch64,
 PPC64[LE] and has `basic support for Cuda devices`_.
 
-* #pragma omp declare simd: :partial:`Partial`.  We support parsing/semantic
+* #pragma omp declare simd: :part:`Partial`.  We support parsing/semantic
   analysis + generation of special attributes for X86 target, but still
   missing the LLVM pass for vectorization.
 
@@ -129,3 +129,134 @@
   In some cases the local variables are actually allocated in the global memory,
   but the debug info may be not aware of it.
 
+
+.. _OpenMP implementation details:
+
+OpenMP 5.0 Implementation Details
+-
+
+The following table provides a quick overview over various OpenMP 5.0 features
+and their implementation status. Please contact *openmp-dev* at
+*lists.llvm.org* for more information or if you want to help with the
+implementation.
+
++--+--+--++
+|Category  | Feature  | Status   | Reviews|
++==+==+==++
+| loop extension   | support != in the canonical loop form| :good:`done` | D54441 |
++--+--+--++
+| loop extension   | #pragma omp loop (directive) | :none:`unclaimed`||
++--+--+--++
+| loop extension   | collapse imperfectly nested loop | :none:`unclaimed`||
++--+--+--++
+| loop extension   | collapse non-rectangular nested loop | :part:`worked on`||
++--+--+--++
+| loop extension   | C++ range-base for loop  | :none:`unclaimed`||
++--+--+--++
+| loop extension   | clause: nosimd for SIMD directives   | :none:`unclaimed`||
++--+--+--++
+| loop extension   | inclusive scan extension (matching C++17 PSTL)   | :none:`unclaimed`||
++--+--+--++
+| memory mangagement   | memory allocators| :good:`done` | r341687,r357929|

[PATCH] D64539: [clang-doc] Add stylesheet to generated html docs

2019-07-10 Thread Diego Astiazarán via Phabricator via cfe-commits
DiegoAstiazaran updated this revision to Diff 209088.
DiegoAstiazaran marked 2 inline comments as done.
DiegoAstiazaran added a comment.

Use `llvm::sys::fs::copy_file` to copy css file.


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

https://reviews.llvm.org/D64539

Files:
  clang-tools-extra/clang-doc/HTMLGenerator.cpp
  clang-tools-extra/clang-doc/stylesheets/clang-doc-default-stylesheet.css
  clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
  clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp

Index: clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp
===
--- clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp
+++ clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp
@@ -43,6 +43,7 @@
   std::string Expected = R"raw(
 
 namespace Namespace
+
 
   namespace Namespace
   Namespaces
@@ -101,6 +102,7 @@
   std::string Expected = R"raw(
 
 class r
+
 
   class r
   
@@ -160,6 +162,7 @@
   std::string Expected = R"raw(
 
 
+
 
   f
   
@@ -199,6 +202,7 @@
   std::string Expected = R"raw(
 
 
+
 
   enum class e
   
@@ -259,6 +263,7 @@
   std::string Expected = R"raw(
 
 
+
 
   f
   
Index: clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
===
--- clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -239,5 +239,27 @@
   llvm::errs() << toString(std::move(Err)) << "\n";
   }
 
+  // Generate css stylesheet
+  if (Format == "html") {
+llvm::outs() << "Generating stylesheet for docs...\n";
+auto StylesheetPathWrite = getInfoOutputFile(
+OutDirectory, "", "clang-doc-default-stylesheet", ".css");
+if (!StylesheetPathWrite) {
+  llvm::errs() << toString(StylesheetPathWrite.takeError()) << "\n";
+  return 1;
+}
+llvm::SmallString<128> StylesheetPathRead;
+llvm::sys::path::native("clang-tools-extra/clang-doc/stylesheets/"
+"clang-doc-default-stylesheet.css",
+StylesheetPathRead);
+std::error_code FileErr =
+llvm::sys::fs::copy_file(StylesheetPathRead, StylesheetPathWrite.get());
+if (FileErr != OK) {
+  llvm::errs() << "Error creating stylesheet file: " << FileErr.message()
+   << "\n";
+  return 1;
+}
+  }
+
   return 0;
 }
Index: clang-tools-extra/clang-doc/stylesheets/clang-doc-default-stylesheet.css
===
--- /dev/null
+++ clang-tools-extra/clang-doc/stylesheets/clang-doc-default-stylesheet.css
@@ -0,0 +1,205 @@
+body,div {
+  margin: 0;
+  padding: 0;
+}
+
+body[no-overflow] {
+  overflow: hidden;
+}
+
+li>p:first-child {
+  margin-top: 0;
+}
+
+li>p:last-child {
+  margin-bottom: 0;
+}
+
+html {
+  -webkit-box-sizing: border-box;
+  box-sizing: border-box;
+}
+
+*,*::before,*::after {
+  -webkit-box-sizing: inherit;
+  box-sizing: inherit;
+}
+
+body,html {
+  color: #202124;
+  font: 400 16px/24px Roboto,sans-serif;
+  -moz-osx-font-smoothing: grayscale;
+  -webkit-font-smoothing: antialiased;
+  height: 100%;
+  margin: 36px;
+  -webkit-text-size-adjust: 100%;
+  -moz-text-size-adjust: 100%;
+  -ms-text-size-adjust: 100%;
+  text-size-adjust: 100%;
+}
+
+body[devsite-framebox] {
+  overflow: hidden;
+  padding: 20px;
+}
+
+body[sitemask--active] {
+  overflow: hidden;
+}
+
+p {
+  margin: 16px 0;
+  padding: 0;
+}
+
+:link,:visited {
+  color: #039be5;
+  outline: 0;
+  text-decoration: none;
+}
+
+ul {
+  margin: 0;
+  padding-left: 40px;
+}
+
+ul {
+  list-style: disc outside;
+}
+
+li,li p {
+  margin: 12px 0;
+  padding: 0;
+}
+
+*[visually-hidden] {
+  opacity: 0 !important;
+  pointer-events: none !important;
+  visibility: hidden !important;
+}
+
+*[hidden] {
+  display: none !important;
+}
+
+[render-hidden] {
+  display: inline !important;
+  position: absolute !important;
+  visibility: hidden !important;
+}
+
+*[no-scroll] {
+  overflow: hidden;
+}
+
+@supports (display: flex) {
+  body[ready] .devsite-wrapper {
+display: -webkit-box;
+display: -ms-flexbox;
+display: flex;
+-webkit-box-orient: vertical;
+-webkit-box-direction: normal;
+-ms-flex-direction: column;
+flex-direction: column;
+  }
+}
+
+@media screen and (max-width: 840px) {
+  body[devsite-book-nav--open] {
+overflow: hidden;
+  }
+}
+
+h1,h2,h3,h4,h5,h6 {
+  overflow: hidden;
+  padding: 0;
+  text-overflow: ellipsis;
+}
+
+h1 {
+  color: #80868b;
+  font: 300 34px/40px Roboto,sans-serif;
+  letter-spacing: -0.01em;
+  margin: 40px 0 20px;
+}
+
+[layout=docs] h2 {
+  border-bottom: 1px solid #e8eaed;
+  padding-bottom: 3px;
+}
+
+h2 {
+  font: 300 24px/32px Roboto,sans-serif;
+  letter-spacing: -0.01em;
+  margin: 40px 0 20px;
+}
+
+h3 {
+  font: 400 20px/32px Roboto,sans-serif;
+  margin: 32px 0 16px;
+}
+
+h4,h5,h6 {
+  margin: 32px 0 16px;
+}
+
+h4 {
+  font: 500 

[PATCH] D64538: [Driver] Don't escape backslashes on Windows

2019-07-10 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

In D64538#1579573 , @smeenai wrote:

> In D64538#1579561 , @rnk wrote:
>
> > An extremely convenient feature of the current escaping pattern is that it 
> > magically works for both the cmd shell and various bash implementations. 
> > You can simply copy paste the commands and run them. This matters, for 
> > example, for the .sh crash reproducer script. On Windows today, you can 
> > just run it with bash, and it works. So, I'd prefer it if we didn't do this.
> >
> > If you want -### output to be more FileCheck friendly, then I would 
> > recommend adding a new driver flag for testing that dumps the commands 
> > without doing any escaping. This came up before:
> >  https://reviews.llvm.org/D62493
>
>
> As long as the backslashes aren't followed by a few special characters (as 
> detailed in my comment), the backslash should still continue to work. I've 
> been testing this with git bash and I'm still able to copy-paste the ouptut 
> command.


For the use case of crash reproduction, we often get these .sh files from 
users, and then try to reproduce and reduce the crash on Linux. Right now it's 
just a matter of adjusting the clang binary being run to reproduce a crash, but 
with this change, it will be harder. The current escaping is kind of the 
universal currency, a quoting style that is accepted everywhere.

> I'm okay adding a new driver flag which just skips all escaping, but I'd also 
> prefer for stuff running on Windows to follow Windows path conventions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64538



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


[PATCH] D63663: [clang-doc] Add html links to references

2019-07-10 Thread Julie Hockett via Phabricator via cfe-commits
juliehockett added inline comments.



Comment at: clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp:110-113
+Inherits from 
+F
+, 
+G

This text should be rendered inline



Comment at: clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp:168-171
+f(
+int
+ P
+)

This text should be rendered inline, if possible.


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

https://reviews.llvm.org/D63663



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


[PATCH] D63940: NFC: Pass DataLayout into isBytewiseValue

2019-07-10 Thread Vitaly Buka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL365709: NFC: Pass DataLayout into isBytewiseValue (authored 
by vitalybuka, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D63940?vs=207092=209086#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D63940

Files:
  cfe/trunk/lib/CodeGen/CGDecl.cpp
  llvm/trunk/include/llvm/Analysis/ValueTracking.h
  llvm/trunk/lib/Analysis/ValueTracking.cpp
  llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
  llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp

Index: llvm/trunk/include/llvm/Analysis/ValueTracking.h
===
--- llvm/trunk/include/llvm/Analysis/ValueTracking.h
+++ llvm/trunk/include/llvm/Analysis/ValueTracking.h
@@ -224,7 +224,7 @@
   /// 0.0 etc. If the value can't be handled with a repeated byte store (e.g.
   /// i16 0x1234), return null. If the value is entirely undef and padding,
   /// return undef.
-  Value *isBytewiseValue(Value *V);
+  Value *isBytewiseValue(Value *V, const DataLayout );
 
   /// Given an aggregrate and an sequence of indices, see if the scalar value
   /// indexed is already around as a register, for example if it were inserted
Index: llvm/trunk/lib/Analysis/ValueTracking.cpp
===
--- llvm/trunk/lib/Analysis/ValueTracking.cpp
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp
@@ -3166,7 +3166,7 @@
   return true;
 }
 
-Value *llvm::isBytewiseValue(Value *V) {
+Value *llvm::isBytewiseValue(Value *V, const DataLayout ) {
 
   // All byte-wide stores are splatable, even of arbitrary variables.
   if (V->getType()->isIntegerTy(8))
@@ -3205,7 +3205,8 @@
 else if (CFP->getType()->isDoubleTy())
   Ty = Type::getInt64Ty(Ctx);
 // Don't handle long double formats, which have strange constraints.
-return Ty ? isBytewiseValue(ConstantExpr::getBitCast(CFP, Ty)) : nullptr;
+return Ty ? isBytewiseValue(ConstantExpr::getBitCast(CFP, Ty), DL)
+  : nullptr;
   }
 
   // We can handle constant integers that are multiple of 8 bits.
@@ -3233,20 +3234,20 @@
   if (ConstantDataSequential *CA = dyn_cast(C)) {
 Value *Val = UndefInt8;
 for (unsigned I = 0, E = CA->getNumElements(); I != E; ++I)
-  if (!(Val = Merge(Val, isBytewiseValue(CA->getElementAsConstant(I)
+  if (!(Val = Merge(Val, isBytewiseValue(CA->getElementAsConstant(I), DL
 return nullptr;
 return Val;
   }
 
   if (isa(C)) {
 Constant *Splat = cast(C)->getSplatValue();
-return Splat ? isBytewiseValue(Splat) : nullptr;
+return Splat ? isBytewiseValue(Splat, DL) : nullptr;
   }
 
   if (isa(C) || isa(C)) {
 Value *Val = UndefInt8;
 for (unsigned I = 0, E = C->getNumOperands(); I != E; ++I)
-  if (!(Val = Merge(Val, isBytewiseValue(C->getOperand(I)
+  if (!(Val = Merge(Val, isBytewiseValue(C->getOperand(I), DL
 return nullptr;
 return Val;
   }
Index: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
===
--- llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
+++ llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
@@ -412,7 +412,7 @@
   if (!NextStore->isSimple()) break;
 
   // Check to see if this stored value is of the same byte-splattable value.
-  Value *StoredByte = isBytewiseValue(NextStore->getOperand(0));
+  Value *StoredByte = isBytewiseValue(NextStore->getOperand(0), DL);
   if (isa(ByteVal) && StoredByte)
 ByteVal = StoredByte;
   if (ByteVal != StoredByte)
@@ -749,7 +749,7 @@
   // byte at a time like "0" or "-1" or any width, as well as things like
   // 0xA0A0A0A0 and 0.0.
   auto *V = SI->getOperand(0);
-  if (Value *ByteVal = isBytewiseValue(V)) {
+  if (Value *ByteVal = isBytewiseValue(V, DL)) {
 if (Instruction *I = tryMergingIntoMemset(SI, SI->getPointerOperand(),
   ByteVal)) {
   BBI = I->getIterator(); // Don't invalidate iterator.
@@ -1229,7 +1229,8 @@
   // If copying from a constant, try to turn the memcpy into a memset.
   if (GlobalVariable *GV = dyn_cast(M->getSource()))
 if (GV->isConstant() && GV->hasDefinitiveInitializer())
-  if (Value *ByteVal = isBytewiseValue(GV->getInitializer())) {
+  if (Value *ByteVal = isBytewiseValue(GV->getInitializer(),
+   M->getModule()->getDataLayout())) {
 IRBuilder<> Builder(M);
 Builder.CreateMemSet(M->getRawDest(), ByteVal, M->getLength(),
  M->getDestAlignment(), false);
Index: llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
===
--- llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
+++ 

[PATCH] D64537: [WebAssembly] Implement thread-local storage for non-PIC cases

2019-07-10 Thread Guanzhong Chen via Phabricator via cfe-commits
quantum updated this revision to Diff 209084.
quantum added a comment.

Add tests for `__builtin_wasm_tls_size`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64537

Files:
  clang/include/clang/Basic/BuiltinsWebAssembly.def
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/builtins-wasm.c
  lld/test/wasm/data-layout.ll
  lld/test/wasm/gc-sections.ll
  lld/test/wasm/tls.ll
  lld/wasm/Driver.cpp
  lld/wasm/Symbols.cpp
  lld/wasm/Symbols.h
  lld/wasm/Writer.cpp
  llvm/include/llvm/BinaryFormat/Wasm.h
  llvm/include/llvm/IR/IntrinsicsWebAssembly.td
  llvm/include/llvm/MC/MCSectionWasm.h
  llvm/lib/MC/WasmObjectWriter.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyISD.def
  llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.h
  llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
  llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
  llvm/test/CodeGen/WebAssembly/target-features-tls.ll
  llvm/test/CodeGen/WebAssembly/tls.ll

Index: llvm/test/CodeGen/WebAssembly/tls.ll
===
--- llvm/test/CodeGen/WebAssembly/tls.ll
+++ llvm/test/CodeGen/WebAssembly/tls.ll
@@ -1,17 +1,87 @@
-; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers | FileCheck --check-prefix=SINGLE %s
+; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals | FileCheck --check-prefixes=CHECK,O2 %s
+; RUN: llc -O0 < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals | FileCheck --check-prefixes=CHECK,O0 %s
 target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
 target triple = "wasm32-unknown-unknown"
 
-; SINGLE-LABEL: address_of_tls:
+; O0-LABEL: address_of_tls:
+; O2-LABEL: address_of_tls:
 define i32 @address_of_tls() {
-  ; SINGLE: i32.const $push0=, tls
-  ; SINGLE-NEXT: return $pop0
+  ; O0: i32.const tls
+  ; O0-NEXT: global.get __tls_base
+  ; O0-NEXT: i32.add
+  ; O0-NEXT: return
+
+  ; O2: global.get __tls_base
+  ; O2-NEXT: i32.const tls
+  ; O2-NEXT: i32.add
+  ; O2-NEXT: return
   ret i32 ptrtoint(i32* @tls to i32)
 }
 
-; SINGLE: .type	tls,@object
-; SINGLE-NEXT: .section	.bss.tls,"",@
-; SINGLE-NEXT: .p2align 2
-; SINGLE-NEXT: tls:
-; SINGLE-NEXT: .int32 0
+; O0-LABEL: ptr_to_tls
+; O2-LABEL: ptr_to_tls
+define i32* @ptr_to_tls() {
+  ; O0: i32.const tls
+  ; O0-NEXT: global.get __tls_base
+  ; O0-NEXT: i32.add
+  ; O0-NEXT: return
+
+  ; O2: global.get __tls_base
+  ; O2-NEXT: i32.const tls
+  ; O2-NEXT: i32.add
+  ; O2-NEXT: return
+  ret i32* @tls
+}
+
+; O0-LABEL: tls_load
+; O2-LABEL: tls_load
+define i32 @tls_load() {
+  ; O0: i32.const tls
+  ; O0-NEXT: global.get __tls_base
+  ; O0-NEXT: i32.add
+  ; O0-NEXT: i32.load 0
+  ; O0-NEXT: return
+
+  ; O2: global.get __tls_base
+  ; O2-NEXT: i32.const tls
+  ; O2-NEXT: i32.add
+  ; O2-NEXT: i32.load 0
+  ; O2-NEXT: return
+  %tmp = load i32, i32* @tls, align 4
+  ret i32 %tmp
+}
+
+; O0-LABEL: tls_store
+; O2-LABEL: tls_store
+define void @tls_store(i32 %x) {
+  ; O0: i32.const tls
+  ; O0-NEXT: global.get __tls_base
+  ; O0-NEXT: i32.add
+  ; O0-NEXT: i32.store 0
+  ; O0-NEXT: return
+
+  ; O2: global.get __tls_base
+  ; O2-NEXT: i32.const tls
+  ; O2-NEXT: i32.add
+  ; O2-NEXT: i32.store 0
+  ; O2-NEXT: return
+  store i32 %x, i32* @tls, align 4
+  ret void
+}
+
+; CHECK-LABEL: tls_size:
+; CHECK-NEXT: .functype tls_size () -> (i32)
+; CHECK-NEXT: global.get __tls_size
+; CHECK-NEXT: return
+declare i32 @llvm.wasm.tls.size.i32()
+define i32 @tls_size() {
+  %1 = call i32 @llvm.wasm.tls.size.i32()
+  ret i32 %1
+}
+
+; CHECK: .type tls,@object
+; CHECK-NEXT: .section .tbss.tls,"",@
+; CHECK-NEXT: .p2align 2
+; CHECK-NEXT: tls:
+; CHECK-NEXT: .int32 0
 @tls = internal thread_local global i32 0
Index: llvm/test/CodeGen/WebAssembly/target-features-tls.ll
===
--- llvm/test/CodeGen/WebAssembly/target-features-tls.ll
+++ llvm/test/CodeGen/WebAssembly/target-features-tls.ll
@@ -1,5 +1,5 @@
-; RUN: llc < %s -mattr=-atomics | FileCheck %s --check-prefixes CHECK,NO-ATOMICS
-; RUN: llc < %s -mattr=+atomics | FileCheck %s --check-prefixes CHECK,ATOMICS
+; RUN: llc < %s -mattr=-atomics | FileCheck %s --check-prefixes NO-ATOMICS
+; RUN: llc < %s -mattr=+atomics | FileCheck %s --check-prefixes ATOMICS
 
 ; Test that the target features section contains -atomics or +atomics
 ; for modules that have thread local storage in their source.
@@ -9,16 +9,13 @@
 
 @foo = internal thread_local global i32 0
 
-; CHECK-LABEL: .custom_section.target_features,"",@
 
 ; -atomics
-; NO-ATOMICS-NEXT: .int8 1
-; NO-ATOMICS-NEXT: .int8 45
-; NO-ATOMICS-NEXT: .int8 7
-; 

[PATCH] D63854: NFC: Convert large lambda into method

2019-07-10 Thread Vitaly Buka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL365708: NFC: Convert large lambda into method (authored by 
vitalybuka, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D63854?vs=206771=209085#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D63854

Files:
  cfe/trunk/lib/CodeGen/CGDecl.cpp
  cfe/trunk/lib/CodeGen/CodeGenFunction.h

Index: cfe/trunk/lib/CodeGen/CGDecl.cpp
===
--- cfe/trunk/lib/CodeGen/CGDecl.cpp
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp
@@ -1663,6 +1663,87 @@
   return false;
 }
 
+void CodeGenFunction::emitZeroOrPatternForAutoVarInit(QualType type,
+  const VarDecl ,
+  Address Loc) {
+  auto trivialAutoVarInit = getContext().getLangOpts().getTrivialAutoVarInit();
+  CharUnits Size = getContext().getTypeSizeInChars(type);
+  bool isVolatile = type.isVolatileQualified();
+  if (!Size.isZero()) {
+switch (trivialAutoVarInit) {
+case LangOptions::TrivialAutoVarInitKind::Uninitialized:
+  llvm_unreachable("Uninitialized handled by caller");
+case LangOptions::TrivialAutoVarInitKind::Zero:
+  emitStoresForZeroInit(CGM, D, Loc, isVolatile, Builder);
+  break;
+case LangOptions::TrivialAutoVarInitKind::Pattern:
+  emitStoresForPatternInit(CGM, D, Loc, isVolatile, Builder);
+  break;
+}
+return;
+  }
+
+  // VLAs look zero-sized to getTypeInfo. We can't emit constant stores to
+  // them, so emit a memcpy with the VLA size to initialize each element.
+  // Technically zero-sized or negative-sized VLAs are undefined, and UBSan
+  // will catch that code, but there exists code which generates zero-sized
+  // VLAs. Be nice and initialize whatever they requested.
+  const auto *VlaType = getContext().getAsVariableArrayType(type);
+  if (!VlaType)
+return;
+  auto VlaSize = getVLASize(VlaType);
+  auto SizeVal = VlaSize.NumElts;
+  CharUnits EltSize = getContext().getTypeSizeInChars(VlaSize.Type);
+  switch (trivialAutoVarInit) {
+  case LangOptions::TrivialAutoVarInitKind::Uninitialized:
+llvm_unreachable("Uninitialized handled by caller");
+
+  case LangOptions::TrivialAutoVarInitKind::Zero:
+if (!EltSize.isOne())
+  SizeVal = Builder.CreateNUWMul(SizeVal, CGM.getSize(EltSize));
+Builder.CreateMemSet(Loc, llvm::ConstantInt::get(Int8Ty, 0), SizeVal,
+ isVolatile);
+break;
+
+  case LangOptions::TrivialAutoVarInitKind::Pattern: {
+llvm::Type *ElTy = Loc.getElementType();
+llvm::Constant *Constant = constWithPadding(
+CGM, IsPattern::Yes, initializationPatternFor(CGM, ElTy));
+CharUnits ConstantAlign = getContext().getTypeAlignInChars(VlaSize.Type);
+llvm::BasicBlock *SetupBB = createBasicBlock("vla-setup.loop");
+llvm::BasicBlock *LoopBB = createBasicBlock("vla-init.loop");
+llvm::BasicBlock *ContBB = createBasicBlock("vla-init.cont");
+llvm::Value *IsZeroSizedVLA = Builder.CreateICmpEQ(
+SizeVal, llvm::ConstantInt::get(SizeVal->getType(), 0),
+"vla.iszerosized");
+Builder.CreateCondBr(IsZeroSizedVLA, ContBB, SetupBB);
+EmitBlock(SetupBB);
+if (!EltSize.isOne())
+  SizeVal = Builder.CreateNUWMul(SizeVal, CGM.getSize(EltSize));
+llvm::Value *BaseSizeInChars =
+llvm::ConstantInt::get(IntPtrTy, EltSize.getQuantity());
+Address Begin = Builder.CreateElementBitCast(Loc, Int8Ty, "vla.begin");
+llvm::Value *End =
+Builder.CreateInBoundsGEP(Begin.getPointer(), SizeVal, "vla.end");
+llvm::BasicBlock *OriginBB = Builder.GetInsertBlock();
+EmitBlock(LoopBB);
+llvm::PHINode *Cur = Builder.CreatePHI(Begin.getType(), 2, "vla.cur");
+Cur->addIncoming(Begin.getPointer(), OriginBB);
+CharUnits CurAlign = Loc.getAlignment().alignmentOfArrayElement(EltSize);
+Builder.CreateMemCpy(Address(Cur, CurAlign),
+ createUnnamedGlobalForMemcpyFrom(
+ CGM, D, Builder, Constant, ConstantAlign),
+ BaseSizeInChars, isVolatile);
+llvm::Value *Next =
+Builder.CreateInBoundsGEP(Int8Ty, Cur, BaseSizeInChars, "vla.next");
+llvm::Value *Done = Builder.CreateICmpEQ(Next, End, "vla-init.isdone");
+Builder.CreateCondBr(Done, ContBB, LoopBB);
+Cur->addIncoming(Next, LoopBB);
+EmitBlock(ContBB);
+  } break;
+  }
+}
+
 void CodeGenFunction::EmitAutoVarInit(const AutoVarEmission ) {
   assert(emission.Variable && "emission was not valid!");
 
@@ -1727,87 +1808,11 @@
 if (emission.IsEscapingByRef && !locIsByrefHeader)
   Loc = emitBlockByrefAddress(Loc, , /*follow=*/false);
 
-bool isVolatile = type.isVolatileQualified();
-CharUnits Size = 

[PATCH] D64375: [OpenMP][Docs] Provide implementation status details

2019-07-10 Thread Kelvin Li via Phabricator via cfe-commits
kkwli0 added inline comments.



Comment at: clang/docs/OpenMPSupport.rst:198
++--+--+--++
+| device extension | OMP_TARGET_FALLBACK env variable  
   | :part:`worked on`| D50522  
   |
++--+--+--++

Change OMP_TARGET_FALLBACK to OMP_TARGET_OFFLOAD which is in the spec.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64375



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


r365709 - NFC: Pass DataLayout into isBytewiseValue

2019-07-10 Thread Vitaly Buka via cfe-commits
Author: vitalybuka
Date: Wed Jul 10 15:53:52 2019
New Revision: 365709

URL: http://llvm.org/viewvc/llvm-project?rev=365709=rev
Log:
NFC: Pass DataLayout into isBytewiseValue

Summary:
We will need to handle IntToPtr which I will submit in a separate patch as it's
not going to be NFC.

Reviewers: eugenis, pcc

Reviewed By: eugenis

Subscribers: hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

Modified:
cfe/trunk/lib/CodeGen/CGDecl.cpp

Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=365709=365708=365709=diff
==
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Wed Jul 10 15:53:52 2019
@@ -967,11 +967,12 @@ static bool shouldUseBZeroPlusStoresToIn
 /// FIXME We could be more clever, as we are for bzero above, and generate
 ///   memset followed by stores. It's unclear that's worth the effort.
 static llvm::Value *shouldUseMemSetToInitialize(llvm::Constant *Init,
-uint64_t GlobalSize) {
+uint64_t GlobalSize,
+const llvm::DataLayout ) {
   uint64_t SizeLimit = 32;
   if (GlobalSize <= SizeLimit)
 return nullptr;
-  return llvm::isBytewiseValue(Init);
+  return llvm::isBytewiseValue(Init, DL);
 }
 
 /// Decide whether we want to split a constant structure or array store into a
@@ -1177,7 +1178,8 @@ static void emitStoresForConstant(CodeGe
   }
 
   // If the initializer is a repeated byte pattern, use memset.
-  llvm::Value *Pattern = shouldUseMemSetToInitialize(constant, ConstantSize);
+  llvm::Value *Pattern =
+  shouldUseMemSetToInitialize(constant, ConstantSize, CGM.getDataLayout());
   if (Pattern) {
 uint64_t Value = 0x00;
 if (!isa(Pattern)) {


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


r365708 - NFC: Convert large lambda into method

2019-07-10 Thread Vitaly Buka via cfe-commits
Author: vitalybuka
Date: Wed Jul 10 15:53:50 2019
New Revision: 365708

URL: http://llvm.org/viewvc/llvm-project?rev=365708=rev
Log:
NFC: Convert large lambda into method

Reviewers: pcc, eugenis

Reviewed By: eugenis

Subscribers: cfe-commits, lldb-commits

Tags: #clang, #lldb

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

Modified:
cfe/trunk/lib/CodeGen/CGDecl.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h

Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=365708=365707=365708=diff
==
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Wed Jul 10 15:53:50 2019
@@ -1663,6 +1663,87 @@ bool CodeGenFunction::isTrivialInitializ
   return false;
 }
 
+void CodeGenFunction::emitZeroOrPatternForAutoVarInit(QualType type,
+  const VarDecl ,
+  Address Loc) {
+  auto trivialAutoVarInit = getContext().getLangOpts().getTrivialAutoVarInit();
+  CharUnits Size = getContext().getTypeSizeInChars(type);
+  bool isVolatile = type.isVolatileQualified();
+  if (!Size.isZero()) {
+switch (trivialAutoVarInit) {
+case LangOptions::TrivialAutoVarInitKind::Uninitialized:
+  llvm_unreachable("Uninitialized handled by caller");
+case LangOptions::TrivialAutoVarInitKind::Zero:
+  emitStoresForZeroInit(CGM, D, Loc, isVolatile, Builder);
+  break;
+case LangOptions::TrivialAutoVarInitKind::Pattern:
+  emitStoresForPatternInit(CGM, D, Loc, isVolatile, Builder);
+  break;
+}
+return;
+  }
+
+  // VLAs look zero-sized to getTypeInfo. We can't emit constant stores to
+  // them, so emit a memcpy with the VLA size to initialize each element.
+  // Technically zero-sized or negative-sized VLAs are undefined, and UBSan
+  // will catch that code, but there exists code which generates zero-sized
+  // VLAs. Be nice and initialize whatever they requested.
+  const auto *VlaType = getContext().getAsVariableArrayType(type);
+  if (!VlaType)
+return;
+  auto VlaSize = getVLASize(VlaType);
+  auto SizeVal = VlaSize.NumElts;
+  CharUnits EltSize = getContext().getTypeSizeInChars(VlaSize.Type);
+  switch (trivialAutoVarInit) {
+  case LangOptions::TrivialAutoVarInitKind::Uninitialized:
+llvm_unreachable("Uninitialized handled by caller");
+
+  case LangOptions::TrivialAutoVarInitKind::Zero:
+if (!EltSize.isOne())
+  SizeVal = Builder.CreateNUWMul(SizeVal, CGM.getSize(EltSize));
+Builder.CreateMemSet(Loc, llvm::ConstantInt::get(Int8Ty, 0), SizeVal,
+ isVolatile);
+break;
+
+  case LangOptions::TrivialAutoVarInitKind::Pattern: {
+llvm::Type *ElTy = Loc.getElementType();
+llvm::Constant *Constant = constWithPadding(
+CGM, IsPattern::Yes, initializationPatternFor(CGM, ElTy));
+CharUnits ConstantAlign = getContext().getTypeAlignInChars(VlaSize.Type);
+llvm::BasicBlock *SetupBB = createBasicBlock("vla-setup.loop");
+llvm::BasicBlock *LoopBB = createBasicBlock("vla-init.loop");
+llvm::BasicBlock *ContBB = createBasicBlock("vla-init.cont");
+llvm::Value *IsZeroSizedVLA = Builder.CreateICmpEQ(
+SizeVal, llvm::ConstantInt::get(SizeVal->getType(), 0),
+"vla.iszerosized");
+Builder.CreateCondBr(IsZeroSizedVLA, ContBB, SetupBB);
+EmitBlock(SetupBB);
+if (!EltSize.isOne())
+  SizeVal = Builder.CreateNUWMul(SizeVal, CGM.getSize(EltSize));
+llvm::Value *BaseSizeInChars =
+llvm::ConstantInt::get(IntPtrTy, EltSize.getQuantity());
+Address Begin = Builder.CreateElementBitCast(Loc, Int8Ty, "vla.begin");
+llvm::Value *End =
+Builder.CreateInBoundsGEP(Begin.getPointer(), SizeVal, "vla.end");
+llvm::BasicBlock *OriginBB = Builder.GetInsertBlock();
+EmitBlock(LoopBB);
+llvm::PHINode *Cur = Builder.CreatePHI(Begin.getType(), 2, "vla.cur");
+Cur->addIncoming(Begin.getPointer(), OriginBB);
+CharUnits CurAlign = Loc.getAlignment().alignmentOfArrayElement(EltSize);
+Builder.CreateMemCpy(Address(Cur, CurAlign),
+ createUnnamedGlobalForMemcpyFrom(
+ CGM, D, Builder, Constant, ConstantAlign),
+ BaseSizeInChars, isVolatile);
+llvm::Value *Next =
+Builder.CreateInBoundsGEP(Int8Ty, Cur, BaseSizeInChars, "vla.next");
+llvm::Value *Done = Builder.CreateICmpEQ(Next, End, "vla-init.isdone");
+Builder.CreateCondBr(Done, ContBB, LoopBB);
+Cur->addIncoming(Next, LoopBB);
+EmitBlock(ContBB);
+  } break;
+  }
+}
+
 void CodeGenFunction::EmitAutoVarInit(const AutoVarEmission ) {
   assert(emission.Variable && "emission was not valid!");
 
@@ -1727,87 +1808,11 @@ void CodeGenFunction::EmitAutoVarInit(co
 if (emission.IsEscapingByRef && !locIsByrefHeader)
   Loc = 

[PATCH] D64385: GodeGen, NFC: Add test to track emitStoresForConstant behavior

2019-07-10 Thread Vitaly Buka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL365706: GodeGen, NFC: Add test to track 
emitStoresForConstant behavior (authored by vitalybuka, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D64385?vs=208598=209083#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D64385

Files:
  cfe/trunk/test/CodeGen/init-memset.c


Index: cfe/trunk/test/CodeGen/init-memset.c
===
--- cfe/trunk/test/CodeGen/init-memset.c
+++ cfe/trunk/test/CodeGen/init-memset.c
@@ -0,0 +1,66 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -O0 -emit-llvm -o - %s | 
FileCheck %s
+
+void use(void *);
+
+void test_small() {
+  // CHECK-LABEL: define void @test_small()
+  int a[] = {1, 2, 3, 4};
+  // CHECK: call void @llvm.memcpy.{{.*}}
+  use(a);
+}
+
+void test_small_same() {
+  // CHECK-LABEL: define void @test_small_same()
+  char a[] = {'a', 'a', 'a', 'a'};
+  // CHECK: call void @llvm.memcpy.{{.*}}
+  use(a);
+}
+
+void test_different() {
+  // CHECK-LABEL: define void @test_different()
+  int a[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
+  // CHECK: call void @llvm.memcpy.{{.*}}
+  use(a);
+}
+
+void test_all_zeros() {
+  // CHECK-LABEL: define void @test_all_zeros()
+  int a[16] = {};
+  // CHECK: call void @llvm.memset.{{.*}}
+  use(a);
+}
+
+void test_all_a() {
+  // CHECK-LABEL: define void @test_all_a()
+  char a[] = "aa";
+  // CHECK: call void @llvm.memcpy.{{.*}}
+  use(a);
+}
+
+void test_most_zeros() {
+  // CHECK-LABEL: define void @test_most_zeros()
+  int a[16] = {0, 0, 1};
+  // CHECK: call void @llvm.memset.{{.*}}
+  // CHECK: store i32 1
+  use(a);
+}
+
+void test_most_a() {
+  // CHECK-LABEL: define void @test_most_a()
+  char a[] = "az";
+  // CHECK: call void @llvm.memcpy.{{.*}}
+  use(a);
+}
+
+void test_pointers() {
+  // CHECK-LABEL: define void @test_pointers()
+  void *a[] = {, , , , , };
+  // CHECK: call void @llvm.memset.{{.*}}
+  // CHECK: store i8*
+  // CHECK: store i8*
+  // CHECK: store i8*
+  // CHECK: store i8*
+  // CHECK: store i8*
+  // CHECK: store i8*
+  use(a);
+}


Index: cfe/trunk/test/CodeGen/init-memset.c
===
--- cfe/trunk/test/CodeGen/init-memset.c
+++ cfe/trunk/test/CodeGen/init-memset.c
@@ -0,0 +1,66 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -O0 -emit-llvm -o - %s | FileCheck %s
+
+void use(void *);
+
+void test_small() {
+  // CHECK-LABEL: define void @test_small()
+  int a[] = {1, 2, 3, 4};
+  // CHECK: call void @llvm.memcpy.{{.*}}
+  use(a);
+}
+
+void test_small_same() {
+  // CHECK-LABEL: define void @test_small_same()
+  char a[] = {'a', 'a', 'a', 'a'};
+  // CHECK: call void @llvm.memcpy.{{.*}}
+  use(a);
+}
+
+void test_different() {
+  // CHECK-LABEL: define void @test_different()
+  int a[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
+  // CHECK: call void @llvm.memcpy.{{.*}}
+  use(a);
+}
+
+void test_all_zeros() {
+  // CHECK-LABEL: define void @test_all_zeros()
+  int a[16] = {};
+  // CHECK: call void @llvm.memset.{{.*}}
+  use(a);
+}
+
+void test_all_a() {
+  // CHECK-LABEL: define void @test_all_a()
+  char a[] = "aa";
+  // CHECK: call void @llvm.memcpy.{{.*}}
+  use(a);
+}
+
+void test_most_zeros() {
+  // CHECK-LABEL: define void @test_most_zeros()
+  int a[16] = {0, 0, 1};
+  // CHECK: call void @llvm.memset.{{.*}}
+  // CHECK: store i32 1
+  use(a);
+}
+
+void test_most_a() {
+  // CHECK-LABEL: define void @test_most_a()
+  char a[] = "az";
+  // CHECK: call void @llvm.memcpy.{{.*}}
+  use(a);
+}
+
+void test_pointers() {
+  // CHECK-LABEL: define void @test_pointers()
+  void *a[] = {, , , , , };
+  // CHECK: call void @llvm.memset.{{.*}}
+  // CHECK: store i8*
+  // CHECK: store i8*
+  // CHECK: store i8*
+  // CHECK: store i8*
+  // CHECK: store i8*
+  // CHECK: store i8*
+  use(a);
+}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r365706 - GodeGen, NFC: Add test to track emitStoresForConstant behavior

2019-07-10 Thread Vitaly Buka via cfe-commits
Author: vitalybuka
Date: Wed Jul 10 15:47:07 2019
New Revision: 365706

URL: http://llvm.org/viewvc/llvm-project?rev=365706=rev
Log:
GodeGen, NFC: Add test to track emitStoresForConstant behavior

Reviewers: eugenis, pcc

Reviewed By: eugenis

Subscribers: cfe-commits

Tags: #clang

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

Added:
cfe/trunk/test/CodeGen/init-memset.c

Added: cfe/trunk/test/CodeGen/init-memset.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/init-memset.c?rev=365706=auto
==
--- cfe/trunk/test/CodeGen/init-memset.c (added)
+++ cfe/trunk/test/CodeGen/init-memset.c Wed Jul 10 15:47:07 2019
@@ -0,0 +1,66 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -O0 -emit-llvm -o - %s | 
FileCheck %s
+
+void use(void *);
+
+void test_small() {
+  // CHECK-LABEL: define void @test_small()
+  int a[] = {1, 2, 3, 4};
+  // CHECK: call void @llvm.memcpy.{{.*}}
+  use(a);
+}
+
+void test_small_same() {
+  // CHECK-LABEL: define void @test_small_same()
+  char a[] = {'a', 'a', 'a', 'a'};
+  // CHECK: call void @llvm.memcpy.{{.*}}
+  use(a);
+}
+
+void test_different() {
+  // CHECK-LABEL: define void @test_different()
+  int a[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
+  // CHECK: call void @llvm.memcpy.{{.*}}
+  use(a);
+}
+
+void test_all_zeros() {
+  // CHECK-LABEL: define void @test_all_zeros()
+  int a[16] = {};
+  // CHECK: call void @llvm.memset.{{.*}}
+  use(a);
+}
+
+void test_all_a() {
+  // CHECK-LABEL: define void @test_all_a()
+  char a[] = "aa";
+  // CHECK: call void @llvm.memcpy.{{.*}}
+  use(a);
+}
+
+void test_most_zeros() {
+  // CHECK-LABEL: define void @test_most_zeros()
+  int a[16] = {0, 0, 1};
+  // CHECK: call void @llvm.memset.{{.*}}
+  // CHECK: store i32 1
+  use(a);
+}
+
+void test_most_a() {
+  // CHECK-LABEL: define void @test_most_a()
+  char a[] = "az";
+  // CHECK: call void @llvm.memcpy.{{.*}}
+  use(a);
+}
+
+void test_pointers() {
+  // CHECK-LABEL: define void @test_pointers()
+  void *a[] = {, , , , , };
+  // CHECK: call void @llvm.memset.{{.*}}
+  // CHECK: store i8*
+  // CHECK: store i8*
+  // CHECK: store i8*
+  // CHECK: store i8*
+  // CHECK: store i8*
+  // CHECK: store i8*
+  use(a);
+}


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


[PATCH] D64540: [CGDebugInfo] Simplfiy EmitFunctionDecl parameters, NFC

2019-07-10 Thread Vedant Kumar via Phabricator via cfe-commits
vsk created this revision.
vsk added reviewers: djtodoro, aprantl.

Replace a `llvm::Function *` parameter with a bool, which seems harder
to set to the wrong value by accident.


https://reviews.llvm.org/D64540

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/CodeGen/CGDebugInfo.h


Index: clang/lib/CodeGen/CGDebugInfo.h
===
--- clang/lib/CodeGen/CGDebugInfo.h
+++ clang/lib/CodeGen/CGDebugInfo.h
@@ -408,10 +408,11 @@
   /// End an inlined function scope.
   void EmitInlineFunctionEnd(CGBuilderTy );
 
-  /// Emit debug info for a function declaration.
-  /// \p Fn is set only when a declaration for a debug call site gets created.
-  void EmitFunctionDecl(GlobalDecl GD, SourceLocation Loc,
-QualType FnType, llvm::Function *Fn = nullptr);
+  /// Emit debug info for a function declaration. Set \p IsDeclForCallSite if
+  /// a call site entry must reference the declaration.
+  llvm::DISubprogram *EmitFunctionDecl(GlobalDecl GD, SourceLocation Loc,
+   QualType FnType,
+   bool IsDeclForCallSite = false);
 
   /// Emit debug info for an extern function being called.
   /// This is needed for call site debug info.
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -3618,18 +3618,19 @@
 RegionMap[D].reset(SP);
 }
 
-void CGDebugInfo::EmitFunctionDecl(GlobalDecl GD, SourceLocation Loc,
-   QualType FnType, llvm::Function *Fn) {
+llvm::DISubprogram *CGDebugInfo::EmitFunctionDecl(GlobalDecl GD,
+  SourceLocation Loc,
+  QualType FnType,
+  bool IsDeclForCallSite) {
   StringRef Name;
   StringRef LinkageName;
 
   const Decl *D = GD.getDecl();
   if (!D)
-return;
+return nullptr;
 
   llvm::DINode::DIFlags Flags = llvm::DINode::FlagZero;
   llvm::DIFile *Unit = getOrCreateFile(Loc);
-  bool IsDeclForCallSite = Fn ? true : false;
   llvm::DIScope *FDContext =
   IsDeclForCallSite ? Unit : getDeclContextDescriptor(D);
   llvm::DINodeArray TParamsArray;
@@ -3662,11 +3663,8 @@
   FDContext, Name, LinkageName, Unit, LineNo,
   getOrCreateFunctionType(D, FnType, Unit), ScopeLine, Flags, SPFlags,
   TParamsArray.get(), getFunctionDeclaration(D));
-
-  if (IsDeclForCallSite)
-Fn->setSubprogram(SP);
-
   DBuilder.retainType(SP);
+  return SP;
 }
 
 void CGDebugInfo::EmitFuncDeclForCallSite(llvm::CallBase *CallOrInvoke,
@@ -3688,8 +3686,13 @@
   if (Func->getSubprogram())
 return;
 
-  if (!CalleeDecl->isStatic() && !CalleeDecl->isInlined())
-EmitFunctionDecl(CalleeDecl, CalleeDecl->getLocation(), CalleeType, Func);
+  if (!CalleeDecl->isStatic() && !CalleeDecl->isInlined()) {
+llvm::DISubprogram *SP =
+EmitFunctionDecl(CalleeDecl, CalleeDecl->getLocation(), CalleeType,
+ /*IsDeclForCallSite=*/true);
+assert(SP && "Could not find decl for callee?");
+Func->setSubprogram(SP);
+  }
 }
 
 void CGDebugInfo::EmitInlineFunctionStart(CGBuilderTy , GlobalDecl GD) 
{


Index: clang/lib/CodeGen/CGDebugInfo.h
===
--- clang/lib/CodeGen/CGDebugInfo.h
+++ clang/lib/CodeGen/CGDebugInfo.h
@@ -408,10 +408,11 @@
   /// End an inlined function scope.
   void EmitInlineFunctionEnd(CGBuilderTy );
 
-  /// Emit debug info for a function declaration.
-  /// \p Fn is set only when a declaration for a debug call site gets created.
-  void EmitFunctionDecl(GlobalDecl GD, SourceLocation Loc,
-QualType FnType, llvm::Function *Fn = nullptr);
+  /// Emit debug info for a function declaration. Set \p IsDeclForCallSite if
+  /// a call site entry must reference the declaration.
+  llvm::DISubprogram *EmitFunctionDecl(GlobalDecl GD, SourceLocation Loc,
+   QualType FnType,
+   bool IsDeclForCallSite = false);
 
   /// Emit debug info for an extern function being called.
   /// This is needed for call site debug info.
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -3618,18 +3618,19 @@
 RegionMap[D].reset(SP);
 }
 
-void CGDebugInfo::EmitFunctionDecl(GlobalDecl GD, SourceLocation Loc,
-   QualType FnType, llvm::Function *Fn) {
+llvm::DISubprogram *CGDebugInfo::EmitFunctionDecl(GlobalDecl GD,
+  SourceLocation Loc,
+  QualType FnType,
+

[PATCH] D64375: [OpenMP][Docs] Provide implementation status details

2019-07-10 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: clang/docs/OpenMPSupport.rst:207
++--+--+--++
+| device extension | clause: in_reduction  
   | claimed  ||
++--+--+--++

jdoerfert wrote:
> ABataev wrote:
> > Done.
> I only found a 2017 patch which I added but is this completely done? The 
> category suggest this is device related but I did not find device related 
> code.
Ah, I missed that this is device extension. Then it is unclaimed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64375



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


[PATCH] D64375: [OpenMP][Docs] Provide implementation status details

2019-07-10 Thread Kelvin Li via Phabricator via cfe-commits
kkwli0 added inline comments.



Comment at: clang/docs/OpenMPSupport.rst:184
++--+--+--++
+| task extension   | parallell master taskloop 
   | :none:`unclaimed`| 
   |
++--+--+--++

parallell -> parallel



Comment at: clang/docs/OpenMPSupport.rst:188
++--+--+--++
+| task extension   | parallell master taskloop simd
   | :none:`unclaimed`| 
   |
++--+--+--++

parallell -> parallel


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64375



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


[PATCH] D64539: [clang-doc] Add stylesheet to generated html docs

2019-07-10 Thread Julie Hockett via Phabricator via cfe-commits
juliehockett added inline comments.



Comment at: clang-tools-extra/clang-doc/tool/ClangDocMain.cpp:247
+auto StylesheetPathWrite = getInfoOutputFile(
+OutDirectory, "", "clang-doc-default-stylesheet", ".css");
+if (!StylesheetPathWrite) {

Eventually, we'll want to make this a configurable thing via a flag, but that 
can be done in another patch.


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

https://reviews.llvm.org/D64539



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


[PATCH] D64539: [clang-doc] Add stylesheet to generated html docs

2019-07-10 Thread Julie Hockett via Phabricator via cfe-commits
juliehockett added inline comments.



Comment at: clang-tools-extra/clang-doc/tool/ClangDocMain.cpp:246-271
+auto StylesheetPathWrite = getInfoOutputFile(
+OutDirectory, "", "clang-doc-default-stylesheet", ".css");
+if (!StylesheetPathWrite) {
+  llvm::errs() << toString(StylesheetPathWrite.takeError()) << "\n";
+  return 1;
+}
+std::error_code FileErr;

Could you use  `llvm::sys::fs::copy_file` here? 
https://llvm.org/doxygen/namespacellvm_1_1sys_1_1fs.html#abe768b38d21bfc2bc91a1c1d09cd84de


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

https://reviews.llvm.org/D64539



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


[PATCH] D64538: [Driver] Don't escape backslashes on Windows

2019-07-10 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added a comment.

In D64538#1579561 , @rnk wrote:

> An extremely convenient feature of the current escaping pattern is that it 
> magically works for both the cmd shell and various bash implementations. You 
> can simply copy paste the commands and run them. This matters, for example, 
> for the .sh crash reproducer script. On Windows today, you can just run it 
> with bash, and it works. So, I'd prefer it if we didn't do this.
>
> If you want -### output to be more FileCheck friendly, then I would recommend 
> adding a new driver flag for testing that dumps the commands without doing 
> any escaping. This came up before:
>  https://reviews.llvm.org/D62493


As long as the backslashes aren't followed by a few special characters (as 
detailed in my comment), the backslash should still continue to work. I've been 
testing this with git bash and I'm still able to copy-paste the ouptut command.

I'm okay adding a new driver flag which just skips all escaping, but I'd also 
prefer for stuff running on Windows to follow Windows path conventions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64538



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


[PATCH] D64364: [HIP] Add GPU arch gfx1010, gfx1011, and gfx1012

2019-07-10 Thread Artem Belevich via Phabricator via cfe-commits
tra accepted this revision.
tra added inline comments.



Comment at: lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp:4973-4992
   case CudaArch::GFX600:
   case CudaArch::GFX601:
   case CudaArch::GFX700:
   case CudaArch::GFX701:
   case CudaArch::GFX702:
   case CudaArch::GFX703:
   case CudaArch::GFX704:

Just a side note: 
I wonder if we need these at all -- we'll end up failing with misleading 
"Unexpected NVPTX target without ptx feature" assertion. We may just remove all 
non-SM_xx arch cases and replace them with default: calling llvm_unreachable(). 
Perhaps in a separate patch.



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

https://reviews.llvm.org/D64364



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


[PATCH] D64538: [Driver] Don't escape backslashes on Windows

2019-07-10 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

An extremely convenient feature of the current escaping pattern is that it 
magically works for both the cmd shell and various bash implementations. You 
can simply copy paste the commands and run them. This matters, for example, for 
the .sh crash reproducer script. On Windows today, you can just run it with 
bash, and it works. So, I'd prefer it if we didn't do this.

If you want -### output to be more FileCheck friendly, then I would recommend 
adding a new driver flag for testing that dumps the commands without doing any 
escaping. This came up before:
https://reviews.llvm.org/D62493


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64538



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


[PATCH] D64385: GodeGen, NFC: Add test to track emitStoresForConstant behavior

2019-07-10 Thread Vitaly Buka via Phabricator via cfe-commits
vitalybuka marked an inline comment as done.
vitalybuka added inline comments.



Comment at: clang/test/CodeGen/init-memset.c:36
+  int a[16] = {0, 0, 1};
+  // CHECK: call void @llvm.memset.{{.*}}
+  // CHECK: store i32 1

eugenis wrote:
> Would it be useful to check the range of the memset? I.e. does it overlap 
> with the following store or not.
I don't change ranges to it will only complicate tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64385



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


[PATCH] D64527: driver: Don't warn about assembler flags being unused when not assembling

2019-07-10 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL365703: driver: Dont warn about assembler flags being 
unused when not assembling (authored by nico, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D64527?vs=209041=209081#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D64527

Files:
  cfe/trunk/lib/Driver/ToolChains/Clang.cpp
  cfe/trunk/test/Driver/as-options.s


Index: cfe/trunk/test/Driver/as-options.s
===
--- cfe/trunk/test/Driver/as-options.s
+++ cfe/trunk/test/Driver/as-options.s
@@ -35,3 +35,14 @@
 // RUN:   | FileCheck %s
 
 // CHECK: "-I" "foo_dir"
+
+// Test that assembler options don't cause warnings when there's no assembler
+// stage.
+
+// RUN: %clang -mincremental-linker-compatible -E -o /dev/null %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=WARN --allow-empty %s
+// RUN: %clang -mimplicit-it=always -target armv7-linux-gnueabihf -E %s \
+// RUN:   | FileCheck --check-prefix=WARN --allow-empty %s
+// RUN: %clang -Wa,-mbig-obj -target i386-pc-windows -E %s \
+// RUN:   | FileCheck --check-prefix=WARN --allow-empty %s
+// WARN-NOT: unused
Index: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp
@@ -3545,6 +3545,18 @@
   // Select the appropriate action.
   RewriteKind rewriteKind = RK_None;
 
+  // If CollectArgsForIntegratedAssembler() isn't called below, call it here
+  // with a dummy args list to mark assembler flags as used even when not
+  // running an assembler. Otherwise, clang would emit "argument unused"
+  // warnings for assembler flags when e.g. adding "-E" to flags while 
debugging
+  // something. That'd be somewhat inconvenient, and it's also inconsistent 
with
+  // most other flags -- we don't warn on -ffunction-sections not being used
+  // in -E mode either for example, even though it's not really used either.
+  if (!isa(JA)) {
+ArgStringList DummyArgs;
+CollectArgsForIntegratedAssembler(C, Args, DummyArgs, D);
+  }
+
   if (isa(JA)) {
 assert(JA.getType() == types::TY_Plist && "Invalid output type.");
 CmdArgs.push_back("-analyze");


Index: cfe/trunk/test/Driver/as-options.s
===
--- cfe/trunk/test/Driver/as-options.s
+++ cfe/trunk/test/Driver/as-options.s
@@ -35,3 +35,14 @@
 // RUN:   | FileCheck %s
 
 // CHECK: "-I" "foo_dir"
+
+// Test that assembler options don't cause warnings when there's no assembler
+// stage.
+
+// RUN: %clang -mincremental-linker-compatible -E -o /dev/null %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=WARN --allow-empty %s
+// RUN: %clang -mimplicit-it=always -target armv7-linux-gnueabihf -E %s \
+// RUN:   | FileCheck --check-prefix=WARN --allow-empty %s
+// RUN: %clang -Wa,-mbig-obj -target i386-pc-windows -E %s \
+// RUN:   | FileCheck --check-prefix=WARN --allow-empty %s
+// WARN-NOT: unused
Index: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp
@@ -3545,6 +3545,18 @@
   // Select the appropriate action.
   RewriteKind rewriteKind = RK_None;
 
+  // If CollectArgsForIntegratedAssembler() isn't called below, call it here
+  // with a dummy args list to mark assembler flags as used even when not
+  // running an assembler. Otherwise, clang would emit "argument unused"
+  // warnings for assembler flags when e.g. adding "-E" to flags while debugging
+  // something. That'd be somewhat inconvenient, and it's also inconsistent with
+  // most other flags -- we don't warn on -ffunction-sections not being used
+  // in -E mode either for example, even though it's not really used either.
+  if (!isa(JA)) {
+ArgStringList DummyArgs;
+CollectArgsForIntegratedAssembler(C, Args, DummyArgs, D);
+  }
+
   if (isa(JA)) {
 assert(JA.getType() == types::TY_Plist && "Invalid output type.");
 CmdArgs.push_back("-analyze");
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D64539: [clang-doc] Add stylesheet to generated html docs

2019-07-10 Thread Diego Astiazarán via Phabricator via cfe-commits
DiegoAstiazaran created this revision.
DiegoAstiazaran added reviewers: juliehockett, jakehehrlich, lebedev.ri.
DiegoAstiazaran added a project: clang-tools-extra.
Herald added subscribers: kadircet, arphaman.

A default css stylesheet is included for docs generated in html format.

Depends on D63663 .


https://reviews.llvm.org/D64539

Files:
  clang-tools-extra/clang-doc/HTMLGenerator.cpp
  clang-tools-extra/clang-doc/stylesheets/clang-doc-default-stylesheet.css
  clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
  clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp

Index: clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp
===
--- clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp
+++ clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp
@@ -43,6 +43,7 @@
   std::string Expected = R"raw(
 
 namespace Namespace
+
 
   namespace Namespace
   Namespaces
@@ -101,6 +102,7 @@
   std::string Expected = R"raw(
 
 class r
+
 
   class r
   
@@ -160,6 +162,7 @@
   std::string Expected = R"raw(
 
 
+
 
   f
   
@@ -199,6 +202,7 @@
   std::string Expected = R"raw(
 
 
+
 
   enum class e
   
@@ -259,6 +263,7 @@
   std::string Expected = R"raw(
 
 
+
 
   f
   
Index: clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
===
--- clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -35,6 +35,7 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Support/Signals.h"
@@ -239,5 +240,36 @@
   llvm::errs() << toString(std::move(Err)) << "\n";
   }
 
+  // Generate css stylesheet
+  if (Format == "html") {
+llvm::outs() << "Generating stylesheet for docs...\n";
+auto StylesheetPathWrite = getInfoOutputFile(
+OutDirectory, "", "clang-doc-default-stylesheet", ".css");
+if (!StylesheetPathWrite) {
+  llvm::errs() << toString(StylesheetPathWrite.takeError()) << "\n";
+  return 1;
+}
+std::error_code FileErr;
+llvm::raw_fd_ostream InfoOS(StylesheetPathWrite.get(), FileErr,
+llvm::sys::fs::F_None);
+if (FileErr != OK) {
+  llvm::errs() << "Error creating stylesheet file: " << FileErr.message()
+   << "\n";
+  return 1;
+}
+llvm::SmallString<128> StylesheetPathRead;
+llvm::sys::path::native("clang-tools-extra/clang-doc/stylesheets/"
+"clang-doc-default-stylesheet.css",
+StylesheetPathRead);
+auto StylesheetFileStream =
+llvm::MemoryBuffer::getFileAsStream(StylesheetPathRead);
+if (std::error_code Err = StylesheetFileStream.getError()) {
+  llvm::errs() << "Error reading stylesheet file: " << Err.message()
+   << "\n";
+  return 1;
+}
+InfoOS << StylesheetFileStream.get()->getBuffer();
+  }
+
   return 0;
 }
Index: clang-tools-extra/clang-doc/stylesheets/clang-doc-default-stylesheet.css
===
--- /dev/null
+++ clang-tools-extra/clang-doc/stylesheets/clang-doc-default-stylesheet.css
@@ -0,0 +1,205 @@
+body,div {
+  margin: 0;
+  padding: 0;
+}
+
+body[no-overflow] {
+  overflow: hidden;
+}
+
+li>p:first-child {
+  margin-top: 0;
+}
+
+li>p:last-child {
+  margin-bottom: 0;
+}
+
+html {
+  -webkit-box-sizing: border-box;
+  box-sizing: border-box;
+}
+
+*,*::before,*::after {
+  -webkit-box-sizing: inherit;
+  box-sizing: inherit;
+}
+
+body,html {
+  color: #202124;
+  font: 400 16px/24px Roboto,sans-serif;
+  -moz-osx-font-smoothing: grayscale;
+  -webkit-font-smoothing: antialiased;
+  height: 100%;
+  margin: 36px;
+  -webkit-text-size-adjust: 100%;
+  -moz-text-size-adjust: 100%;
+  -ms-text-size-adjust: 100%;
+  text-size-adjust: 100%;
+}
+
+body[devsite-framebox] {
+  overflow: hidden;
+  padding: 20px;
+}
+
+body[sitemask--active] {
+  overflow: hidden;
+}
+
+p {
+  margin: 16px 0;
+  padding: 0;
+}
+
+:link,:visited {
+  color: #039be5;
+  outline: 0;
+  text-decoration: none;
+}
+
+ul {
+  margin: 0;
+  padding-left: 40px;
+}
+
+ul {
+  list-style: disc outside;
+}
+
+li,li p {
+  margin: 12px 0;
+  padding: 0;
+}
+
+*[visually-hidden] {
+  opacity: 0 !important;
+  pointer-events: none !important;
+  visibility: hidden !important;
+}
+
+*[hidden] {
+  display: none !important;
+}
+
+[render-hidden] {
+  display: inline !important;
+  position: absolute !important;
+  visibility: hidden !important;
+}
+
+*[no-scroll] {
+  overflow: hidden;
+}
+
+@supports (display: flex) {
+  body[ready] .devsite-wrapper {
+display: -webkit-box;
+display: -ms-flexbox;
+display: flex;
+-webkit-box-orient: vertical;
+

[PATCH] D64538: [Driver] Don't escape backslashes on Windows

2019-07-10 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added a subscriber: phosek.
smeenai added a comment.

CC @phosek, since I believe you had issues writing tests referencing the 
installation directory in the past.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64538



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


r365703 - driver: Don't warn about assembler flags being unused when not assembling

2019-07-10 Thread Nico Weber via cfe-commits
Author: nico
Date: Wed Jul 10 15:29:35 2019
New Revision: 365703

URL: http://llvm.org/viewvc/llvm-project?rev=365703=rev
Log:
driver: Don't warn about assembler flags being unused when not assembling

clang currently warns when passing flags for the assembler (e.g.
-Wa,-mbig-obj) to an invocation that doesn't run the assembler (e.g.
-E).

At first sight, that makes sense -- the flag really is unused. But many
other flags don't have an effect if no assembler runs (e.g.
-fno-integrated-as, -ffunction-sections, and many others), and those
currently don't warn. So this seems more like a side effect of how
CollectArgsForIntegratedAssembler() is implemented than like an
intentional feature.

Since it's a bit inconvenient when debugging builds and adding -E,
always call CollectArgsForIntegratedAssembler() to make sure assembler
args always get claimed. Currently, this affects only these flags:
-mincremental-linker-compatible, -mimplicit-it= (on ARM), -Wa, -Xassembler

It does have the side effect that assembler options now need to be valid
even if -E is passed. Previously, `-Wa,-mbig-obj` would error for
non-coff output only if the assembler ran, now it always errors. This
too makes assembler flags more consistent with all the other flags and
seems like a progression.

Fixes PR42066.

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

Modified:
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/test/Driver/as-options.s

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=365703=365702=365703=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Wed Jul 10 15:29:35 2019
@@ -3545,6 +3545,18 @@ void Clang::ConstructJob(Compilation ,
   // Select the appropriate action.
   RewriteKind rewriteKind = RK_None;
 
+  // If CollectArgsForIntegratedAssembler() isn't called below, call it here
+  // with a dummy args list to mark assembler flags as used even when not
+  // running an assembler. Otherwise, clang would emit "argument unused"
+  // warnings for assembler flags when e.g. adding "-E" to flags while 
debugging
+  // something. That'd be somewhat inconvenient, and it's also inconsistent 
with
+  // most other flags -- we don't warn on -ffunction-sections not being used
+  // in -E mode either for example, even though it's not really used either.
+  if (!isa(JA)) {
+ArgStringList DummyArgs;
+CollectArgsForIntegratedAssembler(C, Args, DummyArgs, D);
+  }
+
   if (isa(JA)) {
 assert(JA.getType() == types::TY_Plist && "Invalid output type.");
 CmdArgs.push_back("-analyze");

Modified: cfe/trunk/test/Driver/as-options.s
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/as-options.s?rev=365703=365702=365703=diff
==
--- cfe/trunk/test/Driver/as-options.s (original)
+++ cfe/trunk/test/Driver/as-options.s Wed Jul 10 15:29:35 2019
@@ -35,3 +35,14 @@
 // RUN:   | FileCheck %s
 
 // CHECK: "-I" "foo_dir"
+
+// Test that assembler options don't cause warnings when there's no assembler
+// stage.
+
+// RUN: %clang -mincremental-linker-compatible -E -o /dev/null %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=WARN --allow-empty %s
+// RUN: %clang -mimplicit-it=always -target armv7-linux-gnueabihf -E %s \
+// RUN:   | FileCheck --check-prefix=WARN --allow-empty %s
+// RUN: %clang -Wa,-mbig-obj -target i386-pc-windows -E %s \
+// RUN:   | FileCheck --check-prefix=WARN --allow-empty %s
+// WARN-NOT: unused


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


[PATCH] D64538: [Driver] Don't escape backslashes on Windows

2019-07-10 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added a comment.

In D64538#1579510 , @smeenai wrote:

> Hmm, this only fixes `-###`. Looking into `-v` now.


Ignore this – I was testing with a version without my change :D


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64538



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


[PATCH] D64538: [Driver] Don't escape backslashes on Windows

2019-07-10 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added a comment.

Hmm, this only fixes `-###`. Looking into `-v` now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64538



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


[PATCH] D64538: [Driver] Don't escape backslashes on Windows

2019-07-10 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai created this revision.
smeenai added reviewers: compnerd, hans, mstorsjo, rnk, thakis, zturner.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Escaping backslashes results in unnatural looking output, and the actual
escapes are mostly unnecessary. We were also not consistent about when
we escaped backslashes and when we didn't, making it impossible to e.g.
store the InstalledDir output to a FileCheck variable and then use that
variable to check paths relative to the driver.

This change could be generalized to any platform which uses the
backslash as a path separator instead of just Windows. I'm unaware of
other such platforms, however, and I'm also unsure if not escaping the
backslash would be appropriate for those platforms, so I'm limiting to
Windows for now.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D64538

Files:
  clang/lib/Driver/Job.cpp
  clang/test/Driver/backslash.c


Index: clang/test/Driver/backslash.c
===
--- /dev/null
+++ clang/test/Driver/backslash.c
@@ -0,0 +1,6 @@
+// RUN: %clang -fsyntax-only %s -### 2>&1 | FileCheck %s
+// Ensure the treatment of backslashes is consistent in the printed 
InstalledDir
+// and commands. We would previous escape backslashes in the printed commands
+// but not in the printed InstallDir, causing the match to fail.
+// CHECK: InstalledDir: [[INSTALLEDDIR:.+$]]
+// CHECK: "[[INSTALLEDDIR]]{{[/\\]}}clang
Index: clang/lib/Driver/Job.cpp
===
--- clang/lib/Driver/Job.cpp
+++ clang/lib/Driver/Job.cpp
@@ -107,9 +107,26 @@
   }
 
   // Quote and escape. This isn't really complete, but good enough.
+  // On Windows, the backslash is the path separator, and escaping the 
backslash
+  // results in unnatural-looking output that's also inconsistent with how 
paths
+  // are printed out elsewhere (e.g. when printing out the installation
+  // directory). Windows native shells (cmd and PowerShell) use different 
escape
+  // characters so escaping the backslash is unnecessary.  bash (the most 
common
+  // non-native shell on Windows) uses backslash as an escape character inside
+  // double quotes only when it's followed by $, `, ", \, or a literal newline;
+  // the last three are disallowed in paths on Windows and the first two are
+  // unlikely, so this shouldn't cause issues in practice. Note that we always
+  // enclose an argument containing backslashes in quotes even if we aren't
+  // escaping the backslashes, since bash always interprets it as an escape
+  // character outside quotes.
+#if defined(_WIN32)
+  constexpr bool RunningOnWindows = true;
+#else
+  constexpr bool RunningOnWindows = false;
+#endif
   OS << '"';
   for (const auto c : Arg) {
-if (c == '"' || c == '\\' || c == '$')
+if (c == '"' || (c == '\\' && !RunningOnWindows) || c == '$')
   OS << '\\';
 OS << c;
   }


Index: clang/test/Driver/backslash.c
===
--- /dev/null
+++ clang/test/Driver/backslash.c
@@ -0,0 +1,6 @@
+// RUN: %clang -fsyntax-only %s -### 2>&1 | FileCheck %s
+// Ensure the treatment of backslashes is consistent in the printed InstalledDir
+// and commands. We would previous escape backslashes in the printed commands
+// but not in the printed InstallDir, causing the match to fail.
+// CHECK: InstalledDir: [[INSTALLEDDIR:.+$]]
+// CHECK: "[[INSTALLEDDIR]]{{[/\\]}}clang
Index: clang/lib/Driver/Job.cpp
===
--- clang/lib/Driver/Job.cpp
+++ clang/lib/Driver/Job.cpp
@@ -107,9 +107,26 @@
   }
 
   // Quote and escape. This isn't really complete, but good enough.
+  // On Windows, the backslash is the path separator, and escaping the backslash
+  // results in unnatural-looking output that's also inconsistent with how paths
+  // are printed out elsewhere (e.g. when printing out the installation
+  // directory). Windows native shells (cmd and PowerShell) use different escape
+  // characters so escaping the backslash is unnecessary.  bash (the most common
+  // non-native shell on Windows) uses backslash as an escape character inside
+  // double quotes only when it's followed by $, `, ", \, or a literal newline;
+  // the last three are disallowed in paths on Windows and the first two are
+  // unlikely, so this shouldn't cause issues in practice. Note that we always
+  // enclose an argument containing backslashes in quotes even if we aren't
+  // escaping the backslashes, since bash always interprets it as an escape
+  // character outside quotes.
+#if defined(_WIN32)
+  constexpr bool RunningOnWindows = true;
+#else
+  constexpr bool RunningOnWindows = false;
+#endif
   OS << '"';
   for (const auto c : Arg) {
-if (c == '"' || c == '\\' || c == '$')
+if (c == '"' || (c == '\\' && !RunningOnWindows) || c == '$')
   OS << '\\';
 OS << c;
   }

[PATCH] D64537: [WebAssembly] Implement thread-local storage for non-PIC cases

2019-07-10 Thread Guanzhong Chen via Phabricator via cfe-commits
quantum planned changes to this revision.
quantum added a comment.

Need to add tests for the compiler intrinsic `__builtin_wasm_tls_size`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64537



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


[PATCH] D63753: [Sema] Instead of rejecting C unions with non-trivial fields, detect attempts to destruct/initialize/copy them.

2019-07-10 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak marked 3 inline comments as done.
ahatanak added inline comments.



Comment at: lib/Sema/SemaExpr.cpp:6097
+  // non-trivial to copy or default-initialize.
+  checkNonTrivialCUnionInInitList(ILE);
+  }

rjmccall wrote:
> Can we extract a common function that checks the initializer expression of a 
> non-trivial C union?  I think there are at least three separate places that 
> do that in this patch, and it's not too hard to imagine that we might want to 
> add more cases to the common analysis.
Do you mean we should have something like `bool 
checkNonTrivialCUnionInInitList(const Expr *Init)` so that we don't have to 
call `dyn_cast`? If `Init` is an `InitListExpr`, the function diagnoses 
non-trivial C unions types and returns true, otherwise it returns false.


Repository:
  rC Clang

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

https://reviews.llvm.org/D63753



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


[PATCH] D64537: [WebAssembly] Implement thread-local storage for non-PIC cases

2019-07-10 Thread Guanzhong Chen via Phabricator via cfe-commits
quantum created this revision.
quantum added reviewers: tlively, aheejin, kripken, sbc100.
Herald added subscribers: llvm-commits, cfe-commits, jfb, sunfish, hiraditya, 
jgravelle-google, dschuff.
Herald added projects: clang, LLVM.
quantum planned changes to this revision.
quantum added a comment.

Need to add tests for the compiler intrinsic `__builtin_wasm_tls_size`.


Thread local variables are placed inside a `.tdata` segment. Their symbols are
offsets from the start of the segment. The address of a thread local variable
is computed as `__tls_base` + the offset from the start of the segment.

`.tdata` segment is a passive segment and `memory.init` is used once per thread
to initialize the thread local storage.

`__tls_base` is a wasm global. Since each thread has its own wasm instance,
it is effectively thread local. Currently, `__tls_base` must be initialized
at thread startup, and so cannot be used with dynamic libraries.

`__tls_base` is to be initialized with a new linker-synthesized function,
`__wasm_init_tls`, which takes as an argument a block of memory to use as the
storage for thread locals. It then initializes the block of memory and sets
`__tls_base`.

To help allocating memory for thread-local storage, a new compiler intrinsic
is introduced: `__builtin_wasm_tls_size()`. This instrinsic function returns
the size of the thread-local storage for the current function.

The expected usage is to run something like the following upon thread startup:

  __wasm_init_tls(calloc(__builtin_wasm_tls_size(), 1));


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D64537

Files:
  clang/include/clang/Basic/BuiltinsWebAssembly.def
  clang/lib/CodeGen/CGBuiltin.cpp
  lld/test/wasm/data-layout.ll
  lld/test/wasm/gc-sections.ll
  lld/test/wasm/tls.ll
  lld/wasm/Driver.cpp
  lld/wasm/Symbols.cpp
  lld/wasm/Symbols.h
  lld/wasm/Writer.cpp
  llvm/include/llvm/BinaryFormat/Wasm.h
  llvm/include/llvm/IR/IntrinsicsWebAssembly.td
  llvm/include/llvm/MC/MCSectionWasm.h
  llvm/lib/MC/WasmObjectWriter.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyISD.def
  llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.h
  llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
  llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
  llvm/test/CodeGen/WebAssembly/target-features-tls.ll
  llvm/test/CodeGen/WebAssembly/tls.ll

Index: llvm/test/CodeGen/WebAssembly/tls.ll
===
--- llvm/test/CodeGen/WebAssembly/tls.ll
+++ llvm/test/CodeGen/WebAssembly/tls.ll
@@ -1,17 +1,77 @@
-; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers | FileCheck --check-prefix=SINGLE %s
+; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals | FileCheck --check-prefixes=CHECK,O2 %s
+; RUN: llc -O0 < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals | FileCheck --check-prefixes=CHECK,O0 %s
 target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
 target triple = "wasm32-unknown-unknown"
 
-; SINGLE-LABEL: address_of_tls:
+; O0-LABEL: address_of_tls:
+; O2-LABEL: address_of_tls:
 define i32 @address_of_tls() {
-  ; SINGLE: i32.const $push0=, tls
-  ; SINGLE-NEXT: return $pop0
+  ; O0: i32.const tls
+  ; O0-NEXT: global.get __tls_base
+  ; O0-NEXT: i32.add
+  ; O0-NEXT: return
+
+  ; O2: global.get __tls_base
+  ; O2-NEXT: i32.const tls
+  ; O2-NEXT: i32.add
+  ; O2-NEXT: return
   ret i32 ptrtoint(i32* @tls to i32)
 }
 
-; SINGLE: .type	tls,@object
-; SINGLE-NEXT: .section	.bss.tls,"",@
-; SINGLE-NEXT: .p2align 2
-; SINGLE-NEXT: tls:
-; SINGLE-NEXT: .int32 0
+; O0-LABEL: ptr_to_tls
+; O2-LABEL: ptr_to_tls
+define i32* @ptr_to_tls() {
+  ; O0: i32.const tls
+  ; O0-NEXT: global.get __tls_base
+  ; O0-NEXT: i32.add
+  ; O0-NEXT: return
+
+  ; O2: global.get __tls_base
+  ; O2-NEXT: i32.const tls
+  ; O2-NEXT: i32.add
+  ; O2-NEXT: return
+  ret i32* @tls
+}
+
+; O0-LABEL: tls_load
+; O2-LABEL: tls_load
+define i32 @tls_load() {
+  ; O0: i32.const tls
+  ; O0-NEXT: global.get __tls_base
+  ; O0-NEXT: i32.add
+  ; O0-NEXT: i32.load 0
+  ; O0-NEXT: return
+
+  ; O2: global.get __tls_base
+  ; O2-NEXT: i32.const tls
+  ; O2-NEXT: i32.add
+  ; O2-NEXT: i32.load 0
+  ; O2-NEXT: return
+  %tmp = load i32, i32* @tls, align 4
+  ret i32 %tmp
+}
+
+; O0-LABEL: tls_store
+; O2-LABEL: tls_store
+define void @tls_store(i32 %x) {
+  ; O0: i32.const tls
+  ; O0-NEXT: global.get __tls_base
+  ; O0-NEXT: i32.add
+  ; O0-NEXT: i32.store 0
+  ; O0-NEXT: return
+
+  ; O2: global.get __tls_base
+  ; O2-NEXT: i32.const tls
+  ; O2-NEXT: i32.add
+  ; O2-NEXT: i32.store 0
+  ; O2-NEXT: return
+  store i32 %x, i32* @tls, align 4
+  ret void
+}
+
+; CHECK: .type tls,@object
+; CHECK-NEXT: 

[PATCH] D64454: [clang-tidy] Adding static analyzer check to list of clang-tidy checks

2019-07-10 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added a comment.

In D64454#1579466 , 
@Nathan-Huckleberry wrote:

> Docs exist for these checks on the analyzer side, they're just all on the 
> same page and hyperlinking to them individually is difficult because the 
> links have a nonstandard naming convention. Currently I'm just linking to 
> that page.


I think it'll be reasonable to standardize Static Analyzer documentation links 
first.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64454



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


[PATCH] D64454: [clang-tidy] Adding static analyzer check to list of clang-tidy checks

2019-07-10 Thread Nathan Huckleberry via Phabricator via cfe-commits
Nathan-Huckleberry added a comment.

In D64454#1579365 , @lebedev.ri wrote:

> In D64454#1579336 , @Eugene.Zelenko 
> wrote:
>
> > May be script should generate documentation during build, so files .rst 
> > files are not needed?
>
>
> I'd personally weakly advise against that, to be honest;
>  that would not be inherently bad though, i think.
>
> > Please also insert empty line between header (===) and text.
>
> Is there some docs for these checks on clang analyzer side? (will there be?)
>  Perhaps these can link to those main docs?


Docs exist for these checks on the analyzer side, they're just all on the same 
page and hyperlinking to them individually is difficult because the links have 
a nonstandard naming convention. Currently I'm just linking to that page.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64454



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


[PATCH] D64375: [OpenMP][Docs] Provide implementation status details

2019-07-10 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added inline comments.



Comment at: clang/docs/OpenMPSupport.rst:163
++--+--+--++
+| memory mangagement   | allocate directive and allocate clause
   | claimed  | r355614,r335952|
++--+--+--++

ABataev wrote:
> Done
Here and above, if there are more revisions, please feel free to add them.



Comment at: clang/docs/OpenMPSupport.rst:165
++--+--+--++
+| OMPD | OMPD interfaces   
   | mostly done  ||
++--+--+--++

Hahnfeld wrote:
> This is not correct, at least it's not yet upstream.
Is there anything upstreamed? What should I put for status and 
revisions/reviews?



Comment at: clang/docs/OpenMPSupport.rst:205
++--+--+--++
+| device extension | clause: device_type   
   | claimed  ||
++--+--+--++

ABataev wrote:
> kkwli0 wrote:
> > ABataev wrote:
> > > Can't find this in the standard.
> > Section 2.12.7
> Then it is unclaimed, I think.
The excel sheet did assign some of the claimed tasks to people/companies so I 
will keep them claimed for now and we should ask if they are actually being 
worked on or not.



Comment at: clang/docs/OpenMPSupport.rst:207
++--+--+--++
+| device extension | clause: in_reduction  
   | claimed  ||
++--+--+--++

ABataev wrote:
> Done.
I only found a 2017 patch which I added but is this completely done? The 
category suggest this is device related but I did not find device related code.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64375



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


[PATCH] D64525: [clang-scan-deps] Dependency directives source minimizer: single quotes are not digit separators after a valid character literal prefix

2019-07-10 Thread Alex Lorenz via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL365700: [clang-scan-deps] Dependency directives source 
minimizer: (authored by arphaman, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D64525?vs=209035=209074#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D64525

Files:
  cfe/trunk/lib/Lex/DependencyDirectivesSourceMinimizer.cpp
  cfe/trunk/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp


Index: cfe/trunk/lib/Lex/DependencyDirectivesSourceMinimizer.cpp
===
--- cfe/trunk/lib/Lex/DependencyDirectivesSourceMinimizer.cpp
+++ cfe/trunk/lib/Lex/DependencyDirectivesSourceMinimizer.cpp
@@ -262,7 +262,14 @@
   if (Start == Cur)
 return false;
   // The previous character must be a valid PP number character.
-  if (!isPreprocessingNumberBody(*(Cur - 1)))
+  // Make sure that the L, u, U, u8 prefixes don't get marked as a
+  // separator though.
+  char Prev = *(Cur - 1);
+  if (Prev == 'L' || Prev == 'U' || Prev == 'u')
+return false;
+  if (Prev == '8' && (Cur - 1 != Start) && *(Cur - 2) == 'u')
+return false;
+  if (!isPreprocessingNumberBody(Prev))
 return false;
   // The next character should be a valid identifier body character.
   return (Cur + 1) < End && isIdentifierBody(*(Cur + 1));
Index: cfe/trunk/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp
===
--- cfe/trunk/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp
+++ cfe/trunk/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp
@@ -507,4 +507,41 @@
   EXPECT_STREQ("#include \n#include \n", Out.data());
 }
 
+TEST(MinimizeSourceToDependencyDirectivesTest, CharacterLiteralPrefixL) {
+  SmallVector Out;
+
+  StringRef Source = R"(L'P'
+#if DEBUG
+// '
+#endif
+#include 
+)";
+  ASSERT_FALSE(minimizeSourceToDependencyDirectives(Source, Out));
+  EXPECT_STREQ("#include \n", Out.data());
+}
+
+TEST(MinimizeSourceToDependencyDirectivesTest, CharacterLiteralPrefixU) {
+  SmallVector Out;
+
+  StringRef Source = R"(int x = U'P';
+#include 
+// '
+)";
+  ASSERT_FALSE(minimizeSourceToDependencyDirectives(Source, Out));
+  EXPECT_STREQ("#include \n", Out.data());
+}
+
+TEST(MinimizeSourceToDependencyDirectivesTest, CharacterLiteralPrefixu) {
+  SmallVector Out;
+
+  StringRef Source = R"(int x = u'b';
+int y = u8'a';
+int z = 128'78;
+#include 
+// '
+)";
+  ASSERT_FALSE(minimizeSourceToDependencyDirectives(Source, Out));
+  EXPECT_STREQ("#include \n", Out.data());
+}
+
 } // end anonymous namespace


Index: cfe/trunk/lib/Lex/DependencyDirectivesSourceMinimizer.cpp
===
--- cfe/trunk/lib/Lex/DependencyDirectivesSourceMinimizer.cpp
+++ cfe/trunk/lib/Lex/DependencyDirectivesSourceMinimizer.cpp
@@ -262,7 +262,14 @@
   if (Start == Cur)
 return false;
   // The previous character must be a valid PP number character.
-  if (!isPreprocessingNumberBody(*(Cur - 1)))
+  // Make sure that the L, u, U, u8 prefixes don't get marked as a
+  // separator though.
+  char Prev = *(Cur - 1);
+  if (Prev == 'L' || Prev == 'U' || Prev == 'u')
+return false;
+  if (Prev == '8' && (Cur - 1 != Start) && *(Cur - 2) == 'u')
+return false;
+  if (!isPreprocessingNumberBody(Prev))
 return false;
   // The next character should be a valid identifier body character.
   return (Cur + 1) < End && isIdentifierBody(*(Cur + 1));
Index: cfe/trunk/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp
===
--- cfe/trunk/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp
+++ cfe/trunk/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp
@@ -507,4 +507,41 @@
   EXPECT_STREQ("#include \n#include \n", Out.data());
 }
 
+TEST(MinimizeSourceToDependencyDirectivesTest, CharacterLiteralPrefixL) {
+  SmallVector Out;
+
+  StringRef Source = R"(L'P'
+#if DEBUG
+// '
+#endif
+#include 
+)";
+  ASSERT_FALSE(minimizeSourceToDependencyDirectives(Source, Out));
+  EXPECT_STREQ("#include \n", Out.data());
+}
+
+TEST(MinimizeSourceToDependencyDirectivesTest, CharacterLiteralPrefixU) {
+  SmallVector Out;
+
+  StringRef Source = R"(int x = U'P';
+#include 
+// '
+)";
+  ASSERT_FALSE(minimizeSourceToDependencyDirectives(Source, Out));
+  EXPECT_STREQ("#include \n", Out.data());
+}
+
+TEST(MinimizeSourceToDependencyDirectivesTest, CharacterLiteralPrefixu) {
+  SmallVector Out;
+
+  StringRef Source = R"(int x = u'b';
+int y = u8'a';
+int z = 128'78;
+#include 
+// '
+)";
+  ASSERT_FALSE(minimizeSourceToDependencyDirectives(Source, Out));
+  EXPECT_STREQ("#include \n", Out.data());
+}
+
 } // end anonymous namespace
___
cfe-commits mailing 

[PATCH] D64375: [OpenMP][Docs] Provide implementation status details

2019-07-10 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert updated this revision to Diff 209073.
jdoerfert marked 29 inline comments as done.
jdoerfert added a comment.

Add colors, updates according to comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64375

Files:
  clang/docs/OpenMPSupport.rst

Index: clang/docs/OpenMPSupport.rst
===
--- clang/docs/OpenMPSupport.rst
+++ clang/docs/OpenMPSupport.rst
@@ -2,12 +2,12 @@
 
   
 .none { background-color: #FF }
-.partial { background-color: #99 }
+.part { background-color: #99 }
 .good { background-color: #CCFF99 }
   
 
 .. role:: none
-.. role:: partial
+.. role:: part
 .. role:: good
 
 .. contents::
@@ -17,7 +17,7 @@
 OpenMP Support
 ==
 
-Clang supports the following OpenMP 5.0 features
+Clang supports the following OpenMP 5.0 features (see also `OpenMP implementation details`_):
 
 * The `reduction`-based clauses in the `task` and `target`-based directives.
 
@@ -37,7 +37,7 @@
 Clang fully supports OpenMP 4.5. Clang supports offloading to X86_64, AArch64,
 PPC64[LE] and has `basic support for Cuda devices`_.
 
-* #pragma omp declare simd: :partial:`Partial`.  We support parsing/semantic
+* #pragma omp declare simd: :part:`Partial`.  We support parsing/semantic
   analysis + generation of special attributes for X86 target, but still
   missing the LLVM pass for vectorization.
 
@@ -129,3 +129,134 @@
   In some cases the local variables are actually allocated in the global memory,
   but the debug info may be not aware of it.
 
+
+.. _OpenMP implementation details:
+
+OpenMP 5.0 Implementation Details
+-
+
+The following table provides a quick overview over various OpenMP 5.0 features
+and their implementation status. Please contact *openmp-dev* at
+*lists.llvm.org* for more information or if you want to help with the
+implementation.
+
++--+--+--++
+|Category  | Feature  | Status   | Reviews|
++==+==+==++
+| loop extension   | support != in the canonical loop form| :good:`done` | D54441 |
++--+--+--++
+| loop extension   | #pragma omp loop (directive) | :none:`unclaimed`||
++--+--+--++
+| loop extension   | collapse imperfectly nested loop | :none:`unclaimed`||
++--+--+--++
+| loop extension   | collapse non-rectangular nested loop | :part:`worked on`||
++--+--+--++
+| loop extension   | C++ range-base for loop  | :none:`unclaimed`||
++--+--+--++
+| loop extension   | clause: nosimd for SIMD directives   | :none:`unclaimed`||
++--+--+--++
+| loop extension   | inclusive scan extension (matching C++17 PSTL)   | :none:`unclaimed`||
++--+--+--++
+| memory mangagement   | memory allocators| :good:`done` | r341687,r357929|

r365700 - [clang-scan-deps] Dependency directives source minimizer:

2019-07-10 Thread Alex Lorenz via cfe-commits
Author: arphaman
Date: Wed Jul 10 15:00:59 2019
New Revision: 365700

URL: http://llvm.org/viewvc/llvm-project?rev=365700=rev
Log:
[clang-scan-deps] Dependency directives source minimizer:
single quotes are not digit separators after a valid character literal prefix

The single quote character can act as a c++ digit separator.
However, the minimizer shouldn't treat it as such when it's actually following
a valid character literal prefix, like L, U, u, or u8.

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

Modified:
cfe/trunk/lib/Lex/DependencyDirectivesSourceMinimizer.cpp
cfe/trunk/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp

Modified: cfe/trunk/lib/Lex/DependencyDirectivesSourceMinimizer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/DependencyDirectivesSourceMinimizer.cpp?rev=365700=365699=365700=diff
==
--- cfe/trunk/lib/Lex/DependencyDirectivesSourceMinimizer.cpp (original)
+++ cfe/trunk/lib/Lex/DependencyDirectivesSourceMinimizer.cpp Wed Jul 10 
15:00:59 2019
@@ -262,7 +262,14 @@ static bool isQuoteCppDigitSeparator(con
   if (Start == Cur)
 return false;
   // The previous character must be a valid PP number character.
-  if (!isPreprocessingNumberBody(*(Cur - 1)))
+  // Make sure that the L, u, U, u8 prefixes don't get marked as a
+  // separator though.
+  char Prev = *(Cur - 1);
+  if (Prev == 'L' || Prev == 'U' || Prev == 'u')
+return false;
+  if (Prev == '8' && (Cur - 1 != Start) && *(Cur - 2) == 'u')
+return false;
+  if (!isPreprocessingNumberBody(Prev))
 return false;
   // The next character should be a valid identifier body character.
   return (Cur + 1) < End && isIdentifierBody(*(Cur + 1));

Modified: cfe/trunk/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp?rev=365700=365699=365700=diff
==
--- cfe/trunk/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp 
(original)
+++ cfe/trunk/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp Wed Jul 
10 15:00:59 2019
@@ -507,4 +507,41 @@ int c = 12 ' ';
   EXPECT_STREQ("#include \n#include \n", Out.data());
 }
 
+TEST(MinimizeSourceToDependencyDirectivesTest, CharacterLiteralPrefixL) {
+  SmallVector Out;
+
+  StringRef Source = R"(L'P'
+#if DEBUG
+// '
+#endif
+#include 
+)";
+  ASSERT_FALSE(minimizeSourceToDependencyDirectives(Source, Out));
+  EXPECT_STREQ("#include \n", Out.data());
+}
+
+TEST(MinimizeSourceToDependencyDirectivesTest, CharacterLiteralPrefixU) {
+  SmallVector Out;
+
+  StringRef Source = R"(int x = U'P';
+#include 
+// '
+)";
+  ASSERT_FALSE(minimizeSourceToDependencyDirectives(Source, Out));
+  EXPECT_STREQ("#include \n", Out.data());
+}
+
+TEST(MinimizeSourceToDependencyDirectivesTest, CharacterLiteralPrefixu) {
+  SmallVector Out;
+
+  StringRef Source = R"(int x = u'b';
+int y = u8'a';
+int z = 128'78;
+#include 
+// '
+)";
+  ASSERT_FALSE(minimizeSourceToDependencyDirectives(Source, Out));
+  EXPECT_STREQ("#include \n", Out.data());
+}
+
 } // end anonymous namespace


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


[PATCH] D61749: [clang-tidy] initial version of readability-const-method

2019-07-10 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri resigned from this revision.
lebedev.ri added a comment.

Sorry, it does not appear that i'm being useful in this review.




Comment at: 
clang-tools-extra/clang-tidy/readability/StaticMethodCheck.cpp:89-101
+  isDefinition(), isUserProvided(), 
unless(isExpansionInSystemHeader()),
+  unless(isVirtual()), unless(isStatic()), unless(hasTrivialBody()),
+  unless(isOverloadedOperator()), unless(isConstructor()),
+  unless(isDestructor()), unless(isConversionOperator()),
+  unless(isTemplate()), unless(isDependentContext()),
+  unless(ofClass(
+  anyOf(isLambda(),

I'm pretty sure you can do
```
unless(anyOf(isExpansionInSystemHeader(), isVirtual(), ...))
```



Comment at: clang-tools-extra/test/clang-tidy/readability-static-method.cpp:103
+}
+
+template 

Is there a test where a lambda (variant with and without capturing this, either 
explicitly, or implicitly)
is within a non-static class function?



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61749



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


[PATCH] D63638: [clang][NewPM] Add new pass manager RUN lines to avx512f-builtins.c

2019-07-10 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment.

*ping* Is it ok to proceed with only checking the new PM output for these 
tests? If so I could just edit my previous patch to remove the legacy PM run 
lines since they already include the bitcasts from the new PM.


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

https://reviews.llvm.org/D63638



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


[PATCH] D62829: [clang-tidy] Check for dynamically initialized statics in headers.

2019-07-10 Thread Charles Zhang via Phabricator via cfe-commits
czhang marked 4 inline comments as done.
czhang added inline comments.



Comment at: 
clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp:40
+return;
+  Finder->addMatcher(varDecl().bind("var"), this);
+}

aaron.ballman wrote:
> czhang wrote:
> > lebedev.ri wrote:
> > > Most of the matching should be done here, not in `check()`.
> > I believe that there is no way to use the AST matching language to express 
> > hasConstantDeclaration.
> You can write a local AST matcher to hoist this functionality into the 
> `check()` call, though. Some of it is already exposed for you, like 
> `hasInitializer()`, `isValueDependent()`, and `isConstexpr()`.
Perhaps not done in the most elegant way, but there is some amount of 
non-trivial side effecting caused by checkInitIsICE that makes me a little wary 
try to chain this more declaratively.



Comment at: 
clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp:55
+  SourceLocation Loc = Var->getLocation();
+  if (!Loc.isValid() || !utils::isPresumedLocInHeaderFile(Loc, 
*Result.SourceManager,
+  
HeaderFileExtensions))

aaron.ballman wrote:
> czhang wrote:
> > aaron.ballman wrote:
> > > We have an AST matcher for this (`isExpansionInSystemHeader()`).
> > Isn't this for system headers only, not just included 'user' headers?
> Ahh, good point! Still, this should be trivial to make a local AST matcher 
> for.
Seems like many of the google tidy checks choose to relegate this header 
checking (whence I copied this bit) in the checker, rather than match 
registration time. Not sure what the pros and cons are of hoisting, but I left 
it there to follow the convention of the other checks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62829



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


[PATCH] D64364: [HIP] Add GPU arch gfx1010, gfx1011, and gfx1012

2019-07-10 Thread Aaron Enye Shi via Phabricator via cfe-commits
ashi1 accepted this revision.
ashi1 added a comment.
This revision is now accepted and ready to land.

LGTM!


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

https://reviews.llvm.org/D64364



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


[PATCH] D62829: [clang-tidy] Check for dynamically initialized statics in headers.

2019-07-10 Thread Charles Zhang via Phabricator via cfe-commits
czhang updated this revision to Diff 209071.
czhang added a comment.

Hoist constant initializer check and rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62829

Files:
  clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
  clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
  clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp
  clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  
clang-tools-extra/docs/clang-tidy/checks/bugprone-dynamic-static-initializers.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/test/clang-tidy/bugprone-dynamic-static-initializers.hpp

Index: clang-tools-extra/test/clang-tidy/bugprone-dynamic-static-initializers.hpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/bugprone-dynamic-static-initializers.hpp
@@ -0,0 +1,44 @@
+// RUN: %check_clang_tidy %s bugprone-dynamic-static-initializers %t
+
+int fact(int n) {
+  return (n == 0) ? 1 : n * fact(n - 1);
+}
+
+int static_thing = fact(5);
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: static variable 'static_thing' may be dynamically initialized in this header file [bugprone-dynamic-static-initializers]
+
+int sample() {
+int x;
+return x;
+}
+
+int dynamic_thing = sample();
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: static variable 'dynamic_thing' may be dynamically initialized in this header file [bugprone-dynamic-static-initializers]
+
+int not_so_bad = 12 + 4942; // no warning
+
+extern int bar();
+
+int foo() {
+  static int k = bar();
+  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: static variable 'k' may be dynamically initialized in this header file [bugprone-dynamic-static-initializers]
+  return k;
+}
+
+int bar2() {
+  return 7;
+}
+
+int foo2() {
+  // This may work fine when optimization is enabled because bar() can
+  // be turned into a constant 7.  But without optimization, it can
+  // cause problems. Therefore, we must err on the side of conservatism.
+  static int x = bar2();
+  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: static variable 'x' may be dynamically initialized in this header file [bugprone-dynamic-static-initializers]
+  return x;
+}
+
+int foo3() {
+  static int p = 7 + 83; // no warning
+  return p;
+}
Index: clang-tools-extra/docs/clang-tidy/checks/list.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/list.rst
+++ clang-tools-extra/docs/clang-tidy/checks/list.rst
@@ -43,6 +43,7 @@
bugprone-branch-clone
bugprone-copy-constructor-init
bugprone-dangling-handle
+   bugprone-dynamic-static-initializers
bugprone-exception-escape
bugprone-fold-init-type
bugprone-forward-declaration-namespace
Index: clang-tools-extra/docs/clang-tidy/checks/bugprone-dynamic-static-initializers.rst
===
--- /dev/null
+++ clang-tools-extra/docs/clang-tidy/checks/bugprone-dynamic-static-initializers.rst
@@ -0,0 +1,16 @@
+.. title:: clang-tidy - bugprone-dynamic-static-initializers
+
+bugprone-dynamic-static-initializers
+
+
+Finds instances of static variables that are dynamically initialized
+in header files.
+
+This can pose problems in certain multithreaded contexts. For example,
+when disabling compiler generated synchronization instructions for
+static variables initialized at runtime, even if a particular project
+takes the necessary precautions to prevent race conditions during
+initialization, header files included from other projects may
+not. Therefore, such a check is helpful for ensuring that disabling
+synchronization for static variable initialization will not cause
+problems.
Index: clang-tools-extra/docs/ReleaseNotes.rst
===
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -111,6 +111,12 @@
 
   This checks ensures that ``pipe2()`` is called with the O_CLOEXEC flag.
 
+- New :doc:`bugprone-dynamic-static-initializers
+  ` check.
+
+  Finds instances where variables with static storage are initialized
+  dynamically in header files.
+
 - New :doc:`bugprone-unhandled-self-assignment
   ` check.
 
Index: clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.h
===
--- /dev/null
+++ clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.h
@@ -0,0 +1,43 @@
+//===--- DynamicStaticInitializersCheck.h - clang-tidy --*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//

[PATCH] D59859: [clang-tidy] FIXIT for implicit bool conversion now obeys upper case suffixes if enforced.

2019-07-10 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri requested changes to this revision.
lebedev.ri added inline comments.
This revision now requires changes to proceed.



Comment at: 
clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp:270
+  AllowPointerConditions(Options.get("AllowPointerConditions", false)),
+  
UseUppercaseLiteralSuffix(Context->isCheckEnabled("readability-uppercase-literal-suffix"))
 {}
 

alexfh wrote:
> Relying on enabled checks for this sort of a behavior is undesired. This sort 
> of an implicit dependency will lead to problems, if, for example, a user 
> wants to apply fixes check-by-check. A separate option (local for this check 
> or better a global one - like `StrictMode`) would be better.
Looks like this wasn't resolved - it should still be a config option, not 
hardcoded.


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

https://reviews.llvm.org/D59859



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


[PATCH] D44672: [CodeGen] Disable UBSan for coroutine functions

2019-07-10 Thread Vedant Kumar via Phabricator via cfe-commits
vsk requested changes to this revision.
vsk added a comment.
This revision now requires changes to proceed.
Herald added a project: clang.

(Marking this to reflect my comment from 3/20/18 to clear my review queue)


Repository:
  rC Clang

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

https://reviews.llvm.org/D44672



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


[PATCH] D64454: [clang-tidy] Adding static analyzer check to list of clang-tidy checks

2019-07-10 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment.

In D64454#1579336 , @Eugene.Zelenko 
wrote:

> May be script should generate documentation during build, so files .rst files 
> are not needed?


I'd personally weakly advise against that, to be honest;
that would not be inherently bad though, i think.

> Please also insert empty line between header (===) and text.

Is there some docs for these checks on clang analyzer side? (will there be?)
Perhaps these can link to those main docs?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64454



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


[PATCH] D40381: Parse concept definition

2019-07-10 Thread Saar Raz via Phabricator via cfe-commits
saar.raz updated this revision to Diff 209068.
saar.raz added a comment.

Final committed diff.


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

https://reviews.llvm.org/D40381

Files:
  include/clang/AST/ASTNodeTraverser.h
  include/clang/AST/DeclTemplate.h
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/AST/TextNodeDumper.h
  include/clang/Basic/DeclNodes.td
  include/clang/Basic/DiagnosticParseKinds.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/TemplateKinds.h
  include/clang/Parse/Parser.h
  include/clang/Sema/Sema.h
  include/clang/Serialization/ASTBitCodes.h
  lib/AST/ASTStructuralEquivalence.cpp
  lib/AST/DeclBase.cpp
  lib/AST/DeclPrinter.cpp
  lib/AST/DeclTemplate.cpp
  lib/AST/TextNodeDumper.cpp
  lib/CodeGen/CGDecl.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/Index/IndexDecl.cpp
  lib/Parse/ParseTemplate.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaLookup.cpp
  lib/Sema/SemaTemplate.cpp
  lib/Sema/SemaTemplateInstantiateDecl.cpp
  lib/Serialization/ASTCommon.cpp
  lib/Serialization/ASTReaderDecl.cpp
  lib/Serialization/ASTWriter.cpp
  lib/Serialization/ASTWriterDecl.cpp
  test/CXX/concepts-ts/expr/expr.prim/expr.prim.id/p3.cpp
  test/Parser/cxx-concept-declaration.cpp
  test/Parser/cxx-concepts-ambig-constraint-expr.cpp
  test/Parser/cxx-concepts-requires-clause.cpp
  test/Parser/cxx2a-concept-declaration.cpp
  test/Parser/cxx2a-concepts-ambig-constraint-expr.cpp
  test/Parser/cxx2a-concepts-requires-clause.cpp
  tools/libclang/CIndex.cpp

Index: tools/libclang/CIndex.cpp
===
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -6269,6 +6269,7 @@
   case Decl::PragmaComment:
   case Decl::PragmaDetectMismatch:
   case Decl::UsingPack:
+  case Decl::Concept:
 return C;
 
   // Declaration kinds that don't make any sense here, but are
Index: test/Parser/cxx2a-concept-declaration.cpp
===
--- /dev/null
+++ test/Parser/cxx2a-concept-declaration.cpp
@@ -0,0 +1,73 @@
+// Support parsing of concepts
+
+// RUN:  %clang_cc1 -std=c++2a -fconcepts-ts -verify %s
+template concept C1 = true; // expected-note 2{{previous}}
+
+template concept C1 = true; // expected-error{{redefinition}}
+
+template concept D1 = true;
+// expected-error@-1{{expected template parameter}}
+// expected-error@-2{{concept template parameter list must have at least one parameter; explicit specialization of concepts is not allowed}}
+
+template concept T> concept D2 = true;
+// expected-error@-1{{expected identifier}}
+// expected-error@-2{{template template parameter requires 'class' after the parameter list}}
+// expected-error@-3{{concept template parameter list must have at least one parameter; explicit specialization of concepts is not allowed}}
+
+template concept C2 = 0.f; // expected-error {{constraint expression must be of type 'bool' but is of type 'float'}}
+
+struct S1 {
+  template concept C1 = true; // expected-error {{concept declarations may only appear in global or namespace scope}}
+};
+
+extern "C++" {
+  template concept C1 = true; // expected-error{{redefinition}}
+}
+
+template
+template
+concept C4 = true; // expected-error {{extraneous template parameter list in concept definition}}
+
+template concept C5 = true; // expected-note {{previous}} expected-note {{previous}}
+int C5; // expected-error {{redefinition}}
+struct C5 {}; // expected-error {{redefinition}}
+
+struct C6 {}; // expected-note{{previous definition is here}}
+template concept C6 = true;
+// expected-error@-1{{redefinition of 'C6' as different kind of symbol}}
+
+// TODO: Add test to prevent explicit specialization, partial specialization
+// and explicit instantiation of concepts.
+
+template
+struct integral_constant { static constexpr T value = v; };
+
+namespace N {
+  template concept C7 = true;
+}
+using N::C7;
+
+template  concept C8 = integral_constant::value;
+// expected-error@-1{{use of undeclared identifier 'wor'; did you mean 'word'?}}
+// expected-note@-2{{'word' declared here}}
+
+template concept bool C9 = true;
+// expected-warning@-1{{ISO C++2a does not permit the 'bool' keyword after 'concept'}}
+
+template<> concept C10 = false;
+// expected-error@-1{{concept template parameter list must have at least one parameter; explicit specialization of concepts is not allowed}}
+
+template<> concept C9 = false;
+// expected-error@-1{{name defined in concept definition must be an identifier}}
+
+template concept N::C11 = false;
+// expected-error@-1{{name defined in concept definition must be an identifier}}
+
+class A { };
+// expected-note@-1{{'A' declared here}}
+
+template concept A::C12 = false;
+// expected-error@-1{{expected namespace name}}
+
+template concept operator int = false;
+// expected-error@-1{{name defined in concept definition must be an identifier}}
Index: test/Parser/cxx-concept-declaration.cpp

[PATCH] D53578: [CodeGen] Fix clang test for gcov profiling (follow-up of D51974)

2019-07-10 Thread Vedant Kumar via Phabricator via cfe-commits
vsk resigned from this revision.
vsk added a comment.
Herald added a project: clang.

(Clearing my review queue - I believe the parent revision D51974 
 has been accepted, perhaps @marco-c can take 
a look)


Repository:
  rC Clang

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

https://reviews.llvm.org/D53578



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


[PATCH] D64454: [clang-tidy] Adding static analyzer check to list of clang-tidy checks

2019-07-10 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added a comment.

May be script should generate documentation during build, so files .rst files 
are not needed?

Please also insert empty line between header (===) and text.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64454



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


[PATCH] D63940: [NFC] Pass DataLayout into isBytewiseValue

2019-07-10 Thread Evgenii Stepanov via Phabricator via cfe-commits
eugenis accepted this revision.
eugenis added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63940



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


r365699 - [Concepts] Concept definitions (D40381)

2019-07-10 Thread Saar Raz via cfe-commits
Author: saar.raz
Date: Wed Jul 10 14:25:49 2019
New Revision: 365699

URL: http://llvm.org/viewvc/llvm-project?rev=365699=rev
Log:
[Concepts] Concept definitions (D40381)

First in a series of patches to land C++2a Concepts support.
This patch adds AST and parsing support for concept-declarations.

Added:
cfe/trunk/test/CXX/concepts-ts/expr/
cfe/trunk/test/CXX/concepts-ts/expr/expr.prim/
cfe/trunk/test/CXX/concepts-ts/expr/expr.prim/expr.prim.id/
cfe/trunk/test/CXX/concepts-ts/expr/expr.prim/expr.prim.id/p3.cpp
cfe/trunk/test/Parser/cxx2a-concept-declaration.cpp
Modified:
cfe/trunk/include/clang/AST/ASTNodeTraverser.h
cfe/trunk/include/clang/AST/DeclTemplate.h
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/include/clang/AST/TextNodeDumper.h
cfe/trunk/include/clang/Basic/DeclNodes.td
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Basic/TemplateKinds.h
cfe/trunk/include/clang/Parse/Parser.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/include/clang/Serialization/ASTBitCodes.h
cfe/trunk/lib/AST/ASTStructuralEquivalence.cpp
cfe/trunk/lib/AST/DeclBase.cpp
cfe/trunk/lib/AST/DeclPrinter.cpp
cfe/trunk/lib/AST/DeclTemplate.cpp
cfe/trunk/lib/AST/TextNodeDumper.cpp
cfe/trunk/lib/CodeGen/CGDecl.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/Index/IndexDecl.cpp
cfe/trunk/lib/Parse/ParseTemplate.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaLookup.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/lib/Serialization/ASTCommon.cpp
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp
cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/include/clang/AST/ASTNodeTraverser.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTNodeTraverser.h?rev=365699=365698=365699=diff
==
--- cfe/trunk/include/clang/AST/ASTNodeTraverser.h (original)
+++ cfe/trunk/include/clang/AST/ASTNodeTraverser.h Wed Jul 10 14:25:49 2019
@@ -529,6 +529,11 @@ public:
   D->defaultArgumentWasInherited() ? "inherited from" : "previous");
   }
 
+  void VisitConceptDecl(const ConceptDecl *D) {
+dumpTemplateParameters(D->getTemplateParameters());
+Visit(D->getConstraintExpr());
+  }
+
   void VisitUsingShadowDecl(const UsingShadowDecl *D) {
 if (auto *TD = dyn_cast(D->getUnderlyingDecl()))
   Visit(TD->getTypeForDecl());

Modified: cfe/trunk/include/clang/AST/DeclTemplate.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclTemplate.h?rev=365699=365698=365699=diff
==
--- cfe/trunk/include/clang/AST/DeclTemplate.h (original)
+++ cfe/trunk/include/clang/AST/DeclTemplate.h Wed Jul 10 14:25:49 2019
@@ -3090,6 +3090,42 @@ public:
   static bool classofKind(Kind K) { return K == VarTemplate; }
 };
 
+// \brief Declaration of a C++2a concept.
+class ConceptDecl : public TemplateDecl, public Mergeable {
+protected:
+  Expr *ConstraintExpr;
+
+  ConceptDecl(DeclContext *DC,
+  SourceLocation L, DeclarationName Name,
+  TemplateParameterList *Params,
+  Expr *ConstraintExpr)
+  : TemplateDecl(nullptr, Concept, DC, L, Name, Params),
+ConstraintExpr(ConstraintExpr) {};
+public:
+  static ConceptDecl *Create(ASTContext , DeclContext *DC,
+ SourceLocation L, DeclarationName Name,
+ TemplateParameterList *Params,
+ Expr *ConstraintExpr);
+  static ConceptDecl *CreateDeserialized(ASTContext , unsigned ID);
+
+  Expr *getConstraintExpr() const {
+return ConstraintExpr;
+  }
+
+  SourceRange getSourceRange() const override LLVM_READONLY {
+return SourceRange(getTemplateParameters()->getTemplateLoc(),
+   ConstraintExpr->getEndLoc());
+  }
+
+  // Implement isa/cast/dyncast/etc.
+  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
+  static bool classofKind(Kind K) { return K == Concept; }
+
+  friend class ASTReader;
+  friend class ASTDeclReader;
+  friend class ASTDeclWriter;
+};
+
 inline NamedDecl *getAsNamedDecl(TemplateParameter P) {
   if (auto *PD = P.dyn_cast())
 return PD;

Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=365699=365698=365699=diff
==
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ 

Re: r365499 - [OpenCL][Sema] Fix builtin rewriting

2019-07-10 Thread Reid Kleckner via cfe-commits
NP, I forgot to follow up mentioning that I tweaked the test to fix the
failure in https://reviews.llvm.org/rC365557. It would be good to
eventually mangle whatever OpenCL thing is being mangled here in the MS
ABI, but that can be future work.

On Wed, Jul 10, 2019 at 2:45 AM Marco Antognini 
wrote:

> Hello Reid,
>
> Thanks for reporting it. I filed a bug to fix that (
> http://llvm.org/PR42560). However, I'm not sure I'll have time this week
> to look at it, especially given that we have no Windows builder around
> here. If you are critically blocked by this, could you check that adding
> '// UNSUPPORTED: system-windows' properly disables the test? And if so,
> feel free to commit for now.
>
> Marco
> --
> *From:* Reid Kleckner 
> *Sent:* 09 July 2019 21:47
> *To:* Marco Antognini
> *Cc:* cfe-commits
> *Subject:* Re: r365499 - [OpenCL][Sema] Fix builtin rewriting
>
> FYI, your test seems to fail on Windows:
> FAIL: Clang :: CodeGenOpenCL/pipe_builtin.cl (4679 of 15176)
>  TEST 'Clang :: CodeGenOpenCL/pipe_builtin.cl' FAILED
> 
> Script:
> --
> : 'RUN: at line 1';
> c:\b\slave\clang-x64-windows-msvc\build\build\stage1\bin\clang.exe -cc1
> -internal-isystem
> c:\b\slave\clang-x64-windows-msvc\build\build\stage1\lib\clang\9.0.0\include
> -nostdsysteminc -emit-llvm -cl-ext=+cl_khr_subgroups -O0 -cl-std=c++ -o -
> C:\b\slave\clang-x64-windows-msvc\build\llvm.src\tools\clang\test\CodeGenOpenCL\
> pipe_builtin.cl |
> c:\b\slave\clang-x64-windows-msvc\build\build\stage1\bin\filecheck.exe
> C:\b\slave\clang-x64-windows-msvc\build\llvm.src\tools\clang\test\CodeGenOpenCL\
> pipe_builtin.cl
> --
> Exit Code: 2
>
> Command Output (stdout):
> --
> $ ":" "RUN: at line 1"
> $ "c:\b\slave\clang-x64-windows-msvc\build\build\stage1\bin\clang.exe"
> "-cc1" "-internal-isystem"
> "c:\b\slave\clang-x64-windows-msvc\build\build\stage1\lib\clang\9.0.0\include"
> "-nostdsysteminc" "-emit-llvm" "-cl-ext=+cl_khr_subgroups" "-O0"
> "-cl-std=c++" "-o" "-"
> "C:\b\slave\clang-x64-windows-msvc\build\llvm.src\tools\clang\test\CodeGenOpenCL\
> pipe_builtin.cl"
> # command stderr:
>
> C:\b\slave\clang-x64-windows-msvc\build\llvm.src\tools\clang\test\CodeGenOpenCL\pipe_builtin.cl:9:1:
> error: cannot mangle this OpenCL pipe type yet
>
> void test1(read_only pipe int p, global int *ptr) {
>
> ^~~
>
> 1 error generated.
>
> On Tue, Jul 9, 2019 at 8:04 AM Marco Antognini via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
> Author: mantognini
> Date: Tue Jul  9 08:04:23 2019
> New Revision: 365499
>
> URL: http://llvm.org/viewvc/llvm-project?rev=365499=rev
> Log:
> [OpenCL][Sema] Fix builtin rewriting
>
> This patch ensures built-in functions are rewritten using the proper
> parent declaration.
>
> Existing tests are modified to run in C++ mode to ensure the
> functionality works also with C++ for OpenCL while not increasing the
> testing runtime.
>
> Modified:
> cfe/trunk/include/clang/Basic/Builtins.def
> cfe/trunk/lib/Sema/SemaExpr.cpp
> cfe/trunk/test/CodeGenOpenCL/builtins.cl
> cfe/trunk/test/CodeGenOpenCL/pipe_builtin.cl
> cfe/trunk/test/CodeGenOpenCL/to_addr_builtin.cl
>
> Modified: cfe/trunk/include/clang/Basic/Builtins.def
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.def?rev=365499=365498=365499=diff
>
> ==
> --- cfe/trunk/include/clang/Basic/Builtins.def (original)
> +++ cfe/trunk/include/clang/Basic/Builtins.def Tue Jul  9 08:04:23 2019
> @@ -1478,6 +1478,7 @@ BUILTIN(__builtin_coro_begin, "v*v*", "n
>  BUILTIN(__builtin_coro_end, "bv*Ib", "n")
>  BUILTIN(__builtin_coro_suspend, "cIb", "n")
>  BUILTIN(__builtin_coro_param, "bv*v*", "n")
> +
>  // OpenCL v2.0 s6.13.16, s9.17.3.5 - Pipe functions.
>  // We need the generic prototype, since the packet type could be anything.
>  LANGBUILTIN(read_pipe, "i.", "tn", OCLC20_LANG)
> @@ -1513,6 +1514,8 @@ LANGBUILTIN(get_kernel_max_sub_group_siz
>  LANGBUILTIN(get_kernel_sub_group_count_for_ndrange, "Ui.", "tn",
> OCLC20_LANG)
>
>  // OpenCL v2.0 s6.13.9 - Address space qualifier functions.
> +// FIXME: Pointer parameters of OpenCL builtins should have their address
> space
> +// requirement defined.
>  LANGBUILTIN(to_global, "v*v*", "tn", OCLC20_LANG)
>  LANGBUILTIN(to_local, "v*v*", "tn", OCLC20_LANG)
>  LANGBUILTIN(to_private, "v*v*", "tn", OCLC20_LANG)
>
> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=365499=365498=365499=diff
>
> ==
> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Jul  9 08:04:23 2019
> @@ -5360,7 +5360,7 @@ static bool checkArgsForPlaceholders(Sem
>  ///  FunctionDecl is returned.
>  /// TODO: Handle pointer 

[PATCH] D64454: [clang-tidy] Adding static analyzer check to list of clang-tidy checks

2019-07-10 Thread Nathan Huckleberry via Phabricator via cfe-commits
Nathan-Huckleberry marked an inline comment as done.
Nathan-Huckleberry added inline comments.



Comment at: 
clang-tools-extra/docs/clang-tidy/checks/clang-analyzer-apiModeling.StdCLibraryFunctions.rst:7
+The clang-analyzer-apiModeling.StdCLibraryFunctions check is an alias, please 
see
+`Clang Static Analyzer Available Checkers 
`_
+for more information.

Eugene.Zelenko wrote:
> Could documentation refer to specific checker? Same in other files.
The naming convention for links on the static analyzer documentation makes it 
difficult to properly generate hyperlinks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64454



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


[PATCH] D63139: [Diagnostics] Implement -Wswitch-unreachable

2019-07-10 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

I agree that we really shouldn't use most of those — we shouldn't have null 
types or null child expressions anywhere in the AST.  (Accessors might return 
null for *optional* children, of course, but that's different.)  And yeah, a 
big part of that would be having an error type that could be used in various 
places (instead of e.g. defaulting to `int`).


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

https://reviews.llvm.org/D63139



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


[PATCH] D63854: [NFC] Convert large lambda into method

2019-07-10 Thread Evgenii Stepanov via Phabricator via cfe-commits
eugenis accepted this revision.
eugenis added a comment.
This revision is now accepted and ready to land.

LGTM if it's really NFC


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63854



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


[PATCH] D64385: GodeGen, NFC: Add test to track emitStoresForConstant behavior

2019-07-10 Thread Evgenii Stepanov via Phabricator via cfe-commits
eugenis accepted this revision.
eugenis added a comment.
This revision is now accepted and ready to land.

LGTM




Comment at: clang/test/CodeGen/init-memset.c:36
+  int a[16] = {0, 0, 1};
+  // CHECK: call void @llvm.memset.{{.*}}
+  // CHECK: store i32 1

Would it be useful to check the range of the memset? I.e. does it overlap with 
the following store or not.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64385



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


[PATCH] D61446: Generalize the pass registration mechanism used by Polly to any third-party tool

2019-07-10 Thread Michael Kruse via Phabricator via cfe-commits
Meinersbur requested changes to this revision.
Meinersbur added a comment.
This revision now requires changes to proceed.

Windows seems to work. Good job!

Linux works with static libraries, but not with `BUILD_SHARED_LIBS=ON`:

  $ bin/opt
  : CommandLine Error: Option 'polly-dependences-computeout' registered more 
than once!
  LLVM ERROR: inconsistency in registered CommandLine options

This error is typical for having translation units (in this case: Polly's 
`DependenceInfo.cpp`) multiple times in the address space.

See https://groups.google.com/forum/#!topic/polly-dev/vxumPMhrSEs for the 
configurations I intend to test and which currently work.




Comment at: llvm/cmake/modules/AddLLVM.cmake:815
+function(add_llvm_pass_plugin name)
+cmake_parse_arguments(ARG "" "" "" ${ARGN})
+

Why use `cmake_parse_arguments` if there are no options to parse?



Comment at: llvm/cmake/modules/AddLLVM.cmake:825
+set_property(GLOBAL APPEND PROPERTY LLVM_COMPILE_EXTENSIONS ${name})
+get_property(llvm_plugin_targets GLOBAL PROPERTY LLVM_PLUGIN_TARGETS)
+foreach(llvm_plugin_target ${llvm_plugin_targets})

[concern] This requires that all plugin-able tool have been registered before. 
It might be confusing that not all plugins will be loaded into every tool if 
the relative order is not  .

Is it possible to error-out if a ENABLE_PLUGINS happens after a plugin has been 
added via add_llvm_pass_plugin?



Comment at: llvm/cmake/modules/AddLLVM.cmake:827
+foreach(llvm_plugin_target ${llvm_plugin_targets})
+  set_property(TARGET ${llvm_plugin_target} APPEND PROPERTY SOURCES 
$)
+  set_property(TARGET ${llvm_plugin_target} APPEND PROPERTY LINK_LIBRARIES 
${name})

This injects all plugin sources directly into tool executable (in addition to 
loading them as a library with `LINK_LIBRARIES`), probably the reason for the 
error I see with `BUILD_SHARED_LIBS`.

It ignores the library separation, which is not a nice solution for the same 
reasons why LLVM does not simply add all object files from all its libraries to 
each of the add_llvm_executables, but instead uses `target_link_libraries`.



Comment at: llvm/cmake/modules/LLVMProcessSources.cmake:112
   endif()
+  message(STATUS "${listed} gp:${gp}")
   message(SEND_ERROR "Found unknown source file ${fn_relative}

[nit] unrelated?



Comment at: llvm/docs/WritingAnLLVMPass.rst:1240
+
+Out-of-tree passes are compiled and link statically by default, but it's
+possible to set the following variables to change this behavior:

"Out-of-tree" still mentioned here.



Comment at: polly/lib/Support/RegisterPasses.cpp:727
+extern "C" ::llvm::PassPluginLibraryInfo LLVM_ATTRIBUTE_WEAK
+llvmGetPassPluginInfo() {
+  return getPassPluginInfo();

serge-sans-paille wrote:
> Meinersbur wrote:
> > serge-sans-paille wrote:
> > > Meinersbur wrote:
> > > > [serious] Unfortunately, the new pass manager's plugin system relies on 
> > > > the function name to be `llvmGetPassPluginInfo` in each plugin. This 
> > > > works with multiple dynamic libraries all declaring the same name using 
> > > > the `PassPlugin::Load` mechanism, but linking them all statically will 
> > > > violate the one-definition-rule.
> > > > 
> > > > IMHO, Polly.cpp would have been a better place for this function.
> > > > but linking them all statically will violate the one-definition-rule.
> > > 
> > > They are unused when liked statically, and flagged as weak to avoid 
> > > link-time conflict.
> > > 
> > > > IMHO, Polly.cpp would have been a better place for this function.
> > > I still agree it's more explicit if linked conditionaly.
> > You seem to have removed the weak attribute. Did you mean to put it into 
> > the `polly` namespace to avoid name clashing with other plugins?
> There are two entry points: `llvmGetPassPluginInfo`  for new PM (marked as 
> weak) and `get##name##PluginInfo` for legacy PM (name is supposed to be 
> unique, no need for weak linkage)
Unfortunately, the Windows platform has no concept of weak symbols.

`get##name##PluginInfo` is not related to the legacy pass manager. The legacy 
passe manager uses `llvm::PassRegistry` and `llvm::RegisterStandardPasses`. 
`polly::RegisterPollyPasses` is only used by the new pass manager.

Could you create a second plugin using `add_llvm_pass_plugin`, for instance 
convert `LLVMHello`? Then we could check whether this works.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61446



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


  1   2   3   >