[PATCH] D64089: [Driver] Introduce -stdlib++-isystem

2019-08-05 Thread Shoaib Meenai via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL367982: [Driver] Introduce -stdlib++-isystem (authored by 
smeenai, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D64089?vs=207593&id=213526#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D64089

Files:
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/include/clang/Driver/ToolChain.h
  cfe/trunk/lib/Driver/ToolChain.cpp
  cfe/trunk/lib/Driver/ToolChains/Clang.cpp
  cfe/trunk/test/Driver/stdlibxx-isystem.cpp

Index: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp
@@ -1235,6 +1235,9 @@
   // Do not claim the argument so that the use of the argument does not
   // silently go unnoticed on toolchains which do not honour the option.
   continue;
+} else if (A->getOption().matches(options::OPT_stdlibxx_isystem)) {
+  // Translated to -internal-isystem by the driver, no need to pass to cc1.
+  continue;
 }
 
 // Not translated, render as usual.
@@ -1289,11 +1292,15 @@
   // of an offloading programming model.
 
   // Add C++ include arguments, if needed.
-  if (types::isCXX(Inputs[0].getType()))
-forAllAssociatedToolChains(C, JA, getToolChain(),
-   [&Args, &CmdArgs](const ToolChain &TC) {
- TC.AddClangCXXStdlibIncludeArgs(Args, CmdArgs);
-   });
+  if (types::isCXX(Inputs[0].getType())) {
+bool HasStdlibxxIsystem = Args.hasArg(options::OPT_stdlibxx_isystem);
+forAllAssociatedToolChains(
+C, JA, getToolChain(),
+[&Args, &CmdArgs, HasStdlibxxIsystem](const ToolChain &TC) {
+  HasStdlibxxIsystem ? TC.AddClangCXXStdlibIsystemArgs(Args, CmdArgs)
+ : TC.AddClangCXXStdlibIncludeArgs(Args, CmdArgs);
+});
+  }
 
   // Add system include arguments for all targets but IAMCU.
   if (!IsIAMCU)
Index: cfe/trunk/lib/Driver/ToolChain.cpp
===
--- cfe/trunk/lib/Driver/ToolChain.cpp
+++ cfe/trunk/lib/Driver/ToolChain.cpp
@@ -832,6 +832,16 @@
   DriverArgs.AddAllArgs(CC1Args, options::OPT_stdlib_EQ);
 }
 
+void ToolChain::AddClangCXXStdlibIsystemArgs(
+const llvm::opt::ArgList &DriverArgs,
+llvm::opt::ArgStringList &CC1Args) const {
+  DriverArgs.ClaimAllArgs(options::OPT_stdlibxx_isystem);
+  if (!DriverArgs.hasArg(options::OPT_nostdincxx))
+for (const auto &P :
+ DriverArgs.getAllArgValues(options::OPT_stdlibxx_isystem))
+  addSystemInclude(DriverArgs, CC1Args, P);
+}
+
 bool ToolChain::ShouldLinkCXXStdlib(const llvm::opt::ArgList &Args) const {
   return getDriver().CCCIsCXX() &&
  !Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs,
Index: cfe/trunk/include/clang/Driver/ToolChain.h
===
--- cfe/trunk/include/clang/Driver/ToolChain.h
+++ cfe/trunk/include/clang/Driver/ToolChain.h
@@ -542,6 +542,11 @@
   AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const;
 
+  /// AddClangCXXStdlibIsystemArgs - Add the clang -cc1 level arguments to set
+  /// the specified include paths for the C++ standard library.
+  void AddClangCXXStdlibIsystemArgs(const llvm::opt::ArgList &DriverArgs,
+llvm::opt::ArgStringList &CC1Args) const;
+
   /// Returns if the C++ standard library should be linked in.
   /// Note that e.g. -lm should still be linked even if this returns false.
   bool ShouldLinkCXXStdlib(const llvm::opt::ArgList &Args) const;
Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -2642,6 +2642,10 @@
   }]>;
 def stdlib_EQ : Joined<["-", "--"], "stdlib=">, Flags<[CC1Option]>,
   HelpText<"C++ standard library to use">, Values<"libc++,libstdc++,platform">;
+def stdlibxx_isystem : JoinedOrSeparate<["-"], "stdlib++-isystem">,
+  Group,
+  HelpText<"Use directory as the C++ standard library include path">,
+  Flags<[DriverOption]>, MetaVarName<"">;
 def unwindlib_EQ : Joined<["-", "--"], "unwindlib=">, Flags<[CC1Option]>,
   HelpText<"Unwind library to use">, Values<"libgcc,unwindlib,platform">;
 def sub__library : JoinedOrSeparate<["-"], "sub_library">;
Index: cfe/trunk/test/Driver/stdlibxx-isystem.cpp
===
--- cfe/trunk/test/Driver/stdlibxx-isystem.cpp
+++ cfe/trunk/test/Driver/stdlibxx-isystem.cpp
@@ -0,0 +1,53 @@
+// Backslash esc

r367982 - [Driver] Introduce -stdlib++-isystem

2019-08-05 Thread Shoaib Meenai via cfe-commits
Author: smeenai
Date: Mon Aug  5 23:48:43 2019
New Revision: 367982

URL: http://llvm.org/viewvc/llvm-project?rev=367982&view=rev
Log:
[Driver] Introduce -stdlib++-isystem

There are times when we wish to explicitly control the C++ standard
library search paths used by the driver. For example, when we're
building against the Android NDK, we might want to use the NDK's C++
headers (which have a custom inline namespace) even if we have C++
headers installed next to the driver. We might also be building against
a non-standard directory layout and wanting to specify the C++ standard
library include directories explicitly.

We could accomplish this by passing -nostdinc++ and adding an explicit
-isystem for our custom search directories. However, users of our
toolchain may themselves want to use -nostdinc++ and a custom C++ search
path (libc++'s build does this, for example), and our added -isystem
won't respect the -nostdinc++, leading to multiple C++ header
directories on the search path, which causes build failures.

Add a new driver option -stdlib++-isystem to support this use case.
Passing this option suppresses adding the default C++ library include
paths in the driver, and it also respects -nostdinc++ to allow users to
still override the C++ library paths themselves.

It's a bit unfortunate that we end up with both -stdlib++-isystem and
-cxx-isystem, but their semantics differ significantly. -cxx-isystem is
unaffected by -nostdinc++ and is added to the end of the search path
(which is not appropriate for C++ standard library headers, since they
often #include_next into other system headers), while -stdlib++-isystem
respects -nostdinc++, is added to the beginning of the search path, and
suppresses the default C++ library include paths.

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

Added:
cfe/trunk/test/Driver/stdlibxx-isystem.cpp
Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=367982&r1=367981&r2=367982&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Mon Aug  5 23:48:43 2019
@@ -2642,6 +2642,10 @@ def std_EQ : Joined<["-", "--"], "std=">
   }]>;
 def stdlib_EQ : Joined<["-", "--"], "stdlib=">, Flags<[CC1Option]>,
   HelpText<"C++ standard library to use">, Values<"libc++,libstdc++,platform">;
+def stdlibxx_isystem : JoinedOrSeparate<["-"], "stdlib++-isystem">,
+  Group,
+  HelpText<"Use directory as the C++ standard library include path">,
+  Flags<[DriverOption]>, MetaVarName<"">;
 def unwindlib_EQ : Joined<["-", "--"], "unwindlib=">, Flags<[CC1Option]>,
   HelpText<"Unwind library to use">, Values<"libgcc,unwindlib,platform">;
 def sub__library : JoinedOrSeparate<["-"], "sub_library">;

Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=367982&r1=367981&r2=367982&view=diff
==
--- cfe/trunk/include/clang/Driver/ToolChain.h (original)
+++ cfe/trunk/include/clang/Driver/ToolChain.h Mon Aug  5 23:48:43 2019
@@ -542,6 +542,11 @@ public:
   AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const;
 
+  /// AddClangCXXStdlibIsystemArgs - Add the clang -cc1 level arguments to set
+  /// the specified include paths for the C++ standard library.
+  void AddClangCXXStdlibIsystemArgs(const llvm::opt::ArgList &DriverArgs,
+llvm::opt::ArgStringList &CC1Args) const;
+
   /// Returns if the C++ standard library should be linked in.
   /// Note that e.g. -lm should still be linked even if this returns false.
   bool ShouldLinkCXXStdlib(const llvm::opt::ArgList &Args) const;

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=367982&r1=367981&r2=367982&view=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Mon Aug  5 23:48:43 2019
@@ -832,6 +832,16 @@ void ToolChain::AddClangCXXStdlibInclude
   DriverArgs.AddAllArgs(CC1Args, options::OPT_stdlib_EQ);
 }
 
+void ToolChain::AddClangCXXStdlibIsystemArgs(
+const llvm::opt::ArgList &DriverArgs,
+llvm::opt::ArgStringList &CC1Args) const {
+  DriverArgs.ClaimAllArgs(options::OPT_stdlibxx_isystem);
+  if (!DriverArgs.hasArg(options::OPT_nostdincxx))
+for (const auto &P :
+ DriverArgs.getAllArgValues(options::OPT_stdlibxx_isystem))
+  addSystemInclude(

[PATCH] D62445: [test] Fix plugin tests

2019-08-05 Thread David Zarzycki via Phabricator via cfe-commits
davezarzycki added a comment.

In D62445#1616218 , @davezarzycki 
wrote:

> Just FYI – Having LLVM_ENABLE_PLUGINS_default depend on LLVM_ENABLE_PIC is a 
> hack that should go away someday. Doing so requires that plugin dependencies 
> either always build PIC (and therefore ignore LLVM_ENABLE_PIC), or are linked 
> into the executables that load them and the plugin knows how to find them in 
> the executable. In the case of the latter and on Mach-O platforms, this 
> requires passing `-bundle_loader $PATH_TO_EXECUTABLE` to the linker when 
> creating the plugin (a.k.a. "bundle"), but on ELF platforms, I'm not sure 
> what needs to be done.


It just occurred to me: option 3 is to statically link the plugins if PIC is 
disabled.

These are all just tradeoffs of course, and the worst among them is what we 
have today: conflating "enable plugins" with the default PIC behavior for the 
project.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62445



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


r367981 - [Driver] Prioritize SYSROOT/usr/include over RESOURCE_DIR/include on linux-musl

2019-08-05 Thread Fangrui Song via cfe-commits
Author: maskray
Date: Mon Aug  5 23:25:32 2019
New Revision: 367981

URL: http://llvm.org/viewvc/llvm-project?rev=367981&view=rev
Log:
[Driver] Prioritize SYSROOT/usr/include over RESOURCE_DIR/include on linux-musl

On a musl-based Linux distribution, stdalign.h stdarg.h stdbool.h stddef.h 
stdint.h stdnoreturn.h are expected to be provided by musl (/usr/include), 
instead of RESOURCE_DIR/include.
Reorder RESOURCE_DIR/include to fix the search order problem.
(Currently musl doesn't provide stdatomic.h. stdatomic.h is still found in 
RESOURCE_DIR/include.)

gcc on musl has a similar search order:

```
 /usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/../../../../include/c++/8.3.0
 
/usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/../../../../include/c++/8.3.0/x86_64-alpine-linux-musl
 
/usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/../../../../include/c++/8.3.0/backward
 /usr/local/include
 /usr/include/fortify
 /usr/include
 /usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/include
```

This is different from a glibc-based distribution where RESOURCE_DIR/include is 
placed before SYSROOT/usr/include.

According to the maintainer of musl:

> musl does not support use/mixing of compiler-provided std headers with its 
> headers, and intentionally has no mechanism for communicating with such 
> headers as to which types have already been defined or still need to be 
> defined. If the current include order, with clang's headers before the libc 
> ones, works in some situations, it's only by accident.

Reviewed by: phosek

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

Added:
cfe/trunk/test/Driver/linux-musl-header-search.cpp
Modified:
cfe/trunk/lib/Driver/ToolChains/Linux.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/Linux.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Linux.cpp?rev=367981&r1=367980&r2=367981&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Linux.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Linux.cpp Mon Aug  5 23:25:32 2019
@@ -658,11 +658,11 @@ void Linux::AddClangSystemIncludeArgs(co
   if (!DriverArgs.hasArg(options::OPT_nostdlibinc))
 addSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/local/include");
 
-  if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
-SmallString<128> P(D.ResourceDir);
-llvm::sys::path::append(P, "include");
-addSystemInclude(DriverArgs, CC1Args, P);
-  }
+  SmallString<128> ResourceDirInclude(D.ResourceDir);
+  llvm::sys::path::append(ResourceDirInclude, "include");
+  if (!DriverArgs.hasArg(options::OPT_nobuiltininc) &&
+  (!getTriple().isMusl() || DriverArgs.hasArg(options::OPT_nostdlibinc)))
+addSystemInclude(DriverArgs, CC1Args, ResourceDirInclude);
 
   if (DriverArgs.hasArg(options::OPT_nostdlibinc))
 return;
@@ -860,6 +860,9 @@ void Linux::AddClangSystemIncludeArgs(co
   addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/include");
 
   addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/include");
+
+  if (!DriverArgs.hasArg(options::OPT_nobuiltininc) && getTriple().isMusl())
+addSystemInclude(DriverArgs, CC1Args, ResourceDirInclude);
 }
 
 static std::string DetectLibcxxIncludePath(llvm::vfs::FileSystem &vfs,

Added: cfe/trunk/test/Driver/linux-musl-header-search.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/linux-musl-header-search.cpp?rev=367981&view=auto
==
--- cfe/trunk/test/Driver/linux-musl-header-search.cpp (added)
+++ cfe/trunk/test/Driver/linux-musl-header-search.cpp Mon Aug  5 23:25:32 2019
@@ -0,0 +1,39 @@
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-linux-musl -stdlib=libc++ \
+// RUN: -ccc-install-dir %S/Inputs/basic_linux_tree/usr/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree --gcc-toolchain= \
+// RUN:   | FileCheck --check-prefix=CHECK-X86-64-LIBCXX %s
+
+// RESOURCE_DIR/include comes after /usr/include on linux-musl.
+// This is different from a glibc-based distribution.
+// CHECK-X86-64-LIBCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// CHECK-X86-64-LIBCXX: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-X86-64-LIBCXX: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/v1"
+// CHECK-X86-64-LIBCXX: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
+// CHECK-X86-64-LIBCXX: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"
+// CHECK-X86-64-LIBCXX: "-internal-isystem" "[[RESOURCE_DIR]]{{/|}}include"
+
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only -nobuiltininc 2>&1 
\
+// RUN: -target x86_64-linux-musl \
+// RUN: -ccc-install-dir %S/Inputs/basic_linux_tree/usr/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree --gcc-toolchain= \
+// RUN:   | FileCheck --check-prefix=CHECK-NOB

[PATCH] D65699: [Driver] Prioritize SYSROOT/usr/include over RESOURCE_DIR/include on linux-musl

2019-08-05 Thread Fangrui Song via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL367981: [Driver] Prioritize SYSROOT/usr/include over 
RESOURCE_DIR/include on linux-musl (authored by MaskRay, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

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

https://reviews.llvm.org/D65699

Files:
  cfe/trunk/lib/Driver/ToolChains/Linux.cpp
  cfe/trunk/test/Driver/linux-musl-header-search.cpp


Index: cfe/trunk/lib/Driver/ToolChains/Linux.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/Linux.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Linux.cpp
@@ -658,11 +658,11 @@
   if (!DriverArgs.hasArg(options::OPT_nostdlibinc))
 addSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/local/include");
 
-  if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
-SmallString<128> P(D.ResourceDir);
-llvm::sys::path::append(P, "include");
-addSystemInclude(DriverArgs, CC1Args, P);
-  }
+  SmallString<128> ResourceDirInclude(D.ResourceDir);
+  llvm::sys::path::append(ResourceDirInclude, "include");
+  if (!DriverArgs.hasArg(options::OPT_nobuiltininc) &&
+  (!getTriple().isMusl() || DriverArgs.hasArg(options::OPT_nostdlibinc)))
+addSystemInclude(DriverArgs, CC1Args, ResourceDirInclude);
 
   if (DriverArgs.hasArg(options::OPT_nostdlibinc))
 return;
@@ -860,6 +860,9 @@
   addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/include");
 
   addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/include");
+
+  if (!DriverArgs.hasArg(options::OPT_nobuiltininc) && getTriple().isMusl())
+addSystemInclude(DriverArgs, CC1Args, ResourceDirInclude);
 }
 
 static std::string DetectLibcxxIncludePath(llvm::vfs::FileSystem &vfs,
Index: cfe/trunk/test/Driver/linux-musl-header-search.cpp
===
--- cfe/trunk/test/Driver/linux-musl-header-search.cpp
+++ cfe/trunk/test/Driver/linux-musl-header-search.cpp
@@ -0,0 +1,39 @@
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-linux-musl -stdlib=libc++ \
+// RUN: -ccc-install-dir %S/Inputs/basic_linux_tree/usr/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree --gcc-toolchain= \
+// RUN:   | FileCheck --check-prefix=CHECK-X86-64-LIBCXX %s
+
+// RESOURCE_DIR/include comes after /usr/include on linux-musl.
+// This is different from a glibc-based distribution.
+// CHECK-X86-64-LIBCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// CHECK-X86-64-LIBCXX: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-X86-64-LIBCXX: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/v1"
+// CHECK-X86-64-LIBCXX: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
+// CHECK-X86-64-LIBCXX: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"
+// CHECK-X86-64-LIBCXX: "-internal-isystem" "[[RESOURCE_DIR]]{{/|}}include"
+
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only -nobuiltininc 2>&1 
\
+// RUN: -target x86_64-linux-musl \
+// RUN: -ccc-install-dir %S/Inputs/basic_linux_tree/usr/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree --gcc-toolchain= \
+// RUN:   | FileCheck --check-prefix=CHECK-NOBUILTININC %s
+
+// CHECK-NOBUILTININC: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// CHECK-NOBUILTININC-NOT: "-internal-isystem" 
"[[RESOURCE_DIR]]{{/|}}include"
+
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only -nostdlibinc 2>&1 \
+// RUN: -target x86_64-linux-musl \
+// RUN: -ccc-install-dir %S/Inputs/basic_linux_tree/usr/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree --gcc-toolchain= \
+// RUN:   | FileCheck --check-prefix=CHECK-NOSTDLIBINC %s
+
+// CHECK-NOSTDLIBINC: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// CHECK-NOSTDLIBINC-NOT: "-internal-externc-isystem"
+// CHECK-NOSTDLIBINC-NOT: "-internal-isystem"
+// CHECK-NOSTDLIBINC: "-internal-isystem" "[[RESOURCE_DIR]]{{/|}}include"
+// CHECK-NOSTDLIBINC-NOT: "-internal-externc-isystem"
+// CHECK-NOSTDLIBINC-NOT: "-internal-isystem"


Index: cfe/trunk/lib/Driver/ToolChains/Linux.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/Linux.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Linux.cpp
@@ -658,11 +658,11 @@
   if (!DriverArgs.hasArg(options::OPT_nostdlibinc))
 addSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/local/include");
 
-  if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
-SmallString<128> P(D.ResourceDir);
-llvm::sys::path::append(P, "include");
-addSystemInclude(DriverArgs, CC1Args, P);
-  }
+  SmallString<128> ResourceDirInclude(D.ResourceDir);
+  llvm::sys::path::append(ResourceDirInclude, "include");
+  if (!DriverArgs.hasArg(options

[PATCH] D62445: [test] Fix plugin tests

2019-08-05 Thread David Zarzycki via Phabricator via cfe-commits
davezarzycki added a comment.

Just FYI – Having LLVM_ENABLE_PLUGINS_default depend on LLVM_ENABLE_PIC is a 
hack that should go away someday. Doing so requires that plugin dependencies 
either always build PIC (and therefore ignore LLVM_ENABLE_PIC), or are linked 
into the executables that load them and the plugin knows how to find them in 
the executable. In the case of the latter and on Mach-O platforms, this 
requires passing `-bundle_loader $PATH_TO_EXECUTABLE` to the linker when 
creating the plugin (a.k.a. "bundle"), but on ELF platforms, I'm not sure what 
needs to be done.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62445



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


[PATCH] D65545: Handle some fs::remove failures

2019-08-05 Thread JF Bastien via Phabricator via cfe-commits
jfb marked 2 inline comments as done.
jfb added inline comments.



Comment at: clang/lib/Frontend/PrecompiledPreamble.cpp:107-111
 TemporaryFiles::~TemporaryFiles() {
   llvm::MutexGuard Guard(Mutex);
   for (const auto &File : Files)
-llvm::sys::fs::remove(File.getKey());
+if (std::error_code EC = llvm::sys::fs::remove(File.getKey()))
+  llvm::report_fatal_error("failed removing file \"" + File.getKey() + 
"\": " + EC.message());

bruno wrote:
> jfb wrote:
> > jkorous wrote:
> > > vsapsai wrote:
> > > > Clangd uses `PrecompiledPreamble` but not `TemporaryFiles` as far as I 
> > > > can tell. `report_fatal_error` can be really disruptive for clangd, so 
> > > > it would be good to get an opinion from somebody working on it if this 
> > > > change would impact them.
> > > Since client code in general might have different error 
> > > handling/reporting strategy and can't do much about failure in destructor 
> > > here, I'd consider just some kind of logging or assert here. 
> > > 
> > I changed it to `dbgs()`.
> This probably means we won't see the message in a non-debug build, right?
Yeah, so it'll be diagnosable but won't affect release builds (which I 
understand to be the concern expressed w.r.t. clangd).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65545



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


[PATCH] D65699: [Driver] Prioritize SYSROOT/usr/include over RESOURCE_DIR/include on linux-musl

2019-08-05 Thread Petr Hosek via Phabricator via cfe-commits
phosek accepted this revision.
phosek added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rC Clang

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

https://reviews.llvm.org/D65699



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


[PATCH] D65776: [Clang] Pragma vectorize_predicate implies vectorize

2019-08-05 Thread Sjoerd Meijer via Phabricator via cfe-commits
SjoerdMeijer added a comment.

Thanks for pointing this all out!

I am not entirely sure yet what to think about all this as I am new to the loop 
pragma business, but I think it looks inconsistent to me!

I think I find `allowReordering()` a little bit ugly, because it is also 
checking `getWidth() > 1`, and I am probably expecting the allowReordering 
decision to be based on 1 thing (the Force). But in the current implementation 
that probably makes sense though if `vectorizer_width` doesn't set 
`vectorizer.enable` (again, which is not what I would expect). Thus, it makes 
sense to me that `LoopVectorizationCostModel::selectVectorizationFactor()` only 
checks `getForce()`

> Mmmh, I would have expected this to work the same way as `vectorize_width`.

So I don't see at this moment how it could work in the same way. And by working 
in the same way I think you mean adding `vectorize_predicate` checks to 
different places where `vectorize_width` is also checked, but that doesn't 
sound ideal to me.

Could a conclusion be that I was lucky? Lucky, because without all this 
knowledge that I have now, this patch looks to do what we would expect?


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

https://reviews.llvm.org/D65776



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


[PATCH] D64089: [Driver] Introduce -stdlib++-isystem

2019-08-05 Thread Petr Hosek via Phabricator via cfe-commits
phosek accepted this revision.
phosek added a comment.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64089



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


[PATCH] D65704: DirectoryWatcher::create: Adding better error handling.

2019-08-05 Thread Puyan Lotfi via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL367979: [clang][DirectoryWatcher] Adding llvm::Expected 
error handling to create. (authored by zer0, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D65704?vs=213520&id=213521#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D65704

Files:
  cfe/trunk/include/clang/DirectoryWatcher/DirectoryWatcher.h
  cfe/trunk/lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp
  cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
  cfe/trunk/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
  cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp

Index: cfe/trunk/include/clang/DirectoryWatcher/DirectoryWatcher.h
===
--- cfe/trunk/include/clang/DirectoryWatcher/DirectoryWatcher.h
+++ cfe/trunk/include/clang/DirectoryWatcher/DirectoryWatcher.h
@@ -11,6 +11,7 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Error.h"
 #include 
 #include 
 #include 
@@ -98,10 +99,11 @@
 : Kind(Kind), Filename(Filename) {}
   };
 
-  /// Returns nullptr if \param Path doesn't exist or isn't a directory.
-  /// Returns nullptr if OS kernel API told us we can't start watching. In such
-  /// case it's unclear whether just retrying has any chance to succeeed.
-  static std::unique_ptr
+  /// Asserts if \param Path doesn't exist or isn't a directory.
+  /// Returns llvm::Expected Error if OS kernel API told us we can't start
+  /// watching. In such case it's unclear whether just retrying has any chance
+  /// to succeeed.
+  static llvm::Expected>
   create(llvm::StringRef Path,
  std::function Events,
 bool IsInitial)>
Index: cfe/trunk/lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp
===
--- cfe/trunk/lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp
+++ cfe/trunk/lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp
@@ -11,9 +11,11 @@
 using namespace llvm;
 using namespace clang;
 
-std::unique_ptr clang::DirectoryWatcher::create(
+llvm::Expected> clang::DirectoryWatcher::create(
 StringRef Path,
 std::function, bool)> Receiver,
 bool WaitForInitialSync) {
-  return nullptr;
+  return llvm::make_error(
+  "DirectoryWatcher is not implemented for this platform!",
+  llvm::inconvertibleErrorCode());
 }
\ No newline at end of file
Index: cfe/trunk/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
===
--- cfe/trunk/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
+++ cfe/trunk/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
@@ -11,16 +11,13 @@
 
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Error.h"
 #include "llvm/Support/Path.h"
 #include 
 
 using namespace llvm;
 using namespace clang;
 
-static FSEventStreamRef createFSEventStream(
-StringRef Path,
-std::function, bool)>,
-dispatch_queue_t);
 static void stopFSEventStream(FSEventStreamRef);
 
 namespace {
@@ -153,8 +150,7 @@
 StringRef Path,
 std::function, bool)> Receiver,
 dispatch_queue_t Queue) {
-  if (Path.empty())
-return nullptr;
+  assert(!Path.empty() && "Path.empty()");
 
   CFMutableArrayRef PathsToWatch = [&]() {
 CFMutableArrayRef PathsToWatch =
@@ -205,20 +201,16 @@
   FSEventStreamRelease(EventStream);
 }
 
-std::unique_ptr clang::DirectoryWatcher::create(
+llvm::Expected> clang::DirectoryWatcher::create(
 StringRef Path,
 std::function, bool)> Receiver,
 bool WaitForInitialSync) {
   dispatch_queue_t Queue =
   dispatch_queue_create("DirectoryWatcher", DISPATCH_QUEUE_SERIAL);
 
-  if (Path.empty())
-return nullptr;
-
+  assert(!Path.empty() && "Path.empty()");
   auto EventStream = createFSEventStream(Path, Receiver, Queue);
-  if (!EventStream) {
-return nullptr;
-  }
+  assert(EventStream && "EventStream expected to be non-null.")
 
   std::unique_ptr Result =
   llvm::make_unique(EventStream, Receiver, Path);
Index: cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
===
--- cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
+++ cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
@@ -13,6 +13,7 @@
 #include "llvm/ADT/ScopeExit.h"
 #include "llvm/Support/AlignOf.h"
 #include "llvm/Support/Errno.h"
+#include "llvm/Support/Error.h"
 #include "llvm/Support/Mutex.h"
 #include "llvm/Support/Path.h"
 #include 
@@ -320,16 +321,17 @@
 
 } // namespace
 
-std::unique_ptr clang::DirectoryWatcher::create(
+llvm::Expected> clang::DirectoryWatch

r367979 - [clang][DirectoryWatcher] Adding llvm::Expected error handling to create.

2019-08-05 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Mon Aug  5 22:12:23 2019
New Revision: 367979

URL: http://llvm.org/viewvc/llvm-project?rev=367979&view=rev
Log:
[clang][DirectoryWatcher] Adding llvm::Expected error handling to create.

Prior to this patch Unix style errno error reporting from the inotify layer was
used by DirectoryWatcher::create to simply return a nullptr on error. This
would generally be ok, except that in LLVM we have much more robust error
reporting through the facilities of llvm::Expected.

The other critical thing I stumbled across was that the unit tests for
DirectoryWatcher were not failing abruptly when inotify_init() was reporting an
error, but would continue with the testing and eventually hit a deadlock in a
pathological machine state (ie in the unit test, the return nullptr on ::create
was ignored).

Generally this pathological state never happens on any build bot, so it is
totally understandable that it was overlooked, but on a Linux desktop running
a dubious desktop environment (which I will not name) there is a chance that
said desktop environment could use up enough inotify instances to exceed the
user's limit. These are the conditions that led me to hit the deadlock I am
addressing in this patch with more robust error handling.

With the new llvm::Expected error handling when your system runs out of inotify
instances for your user, the unit test will be forced to handle the error or
crash and report the issue to the user instead of weirdly deadlocking on a
condition variable wait.

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


Modified:
cfe/trunk/include/clang/DirectoryWatcher/DirectoryWatcher.h
cfe/trunk/lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp
cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
cfe/trunk/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp

Modified: cfe/trunk/include/clang/DirectoryWatcher/DirectoryWatcher.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/DirectoryWatcher/DirectoryWatcher.h?rev=367979&r1=367978&r2=367979&view=diff
==
--- cfe/trunk/include/clang/DirectoryWatcher/DirectoryWatcher.h (original)
+++ cfe/trunk/include/clang/DirectoryWatcher/DirectoryWatcher.h Mon Aug  5 
22:12:23 2019
@@ -11,6 +11,7 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Error.h"
 #include 
 #include 
 #include 
@@ -98,10 +99,11 @@ public:
 : Kind(Kind), Filename(Filename) {}
   };
 
-  /// Returns nullptr if \param Path doesn't exist or isn't a directory.
-  /// Returns nullptr if OS kernel API told us we can't start watching. In such
-  /// case it's unclear whether just retrying has any chance to succeeed.
-  static std::unique_ptr
+  /// Asserts if \param Path doesn't exist or isn't a directory.
+  /// Returns llvm::Expected Error if OS kernel API told us we can't start
+  /// watching. In such case it's unclear whether just retrying has any chance
+  /// to succeeed.
+  static llvm::Expected>
   create(llvm::StringRef Path,
  std::function Events,
 bool IsInitial)>

Modified: 
cfe/trunk/lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp?rev=367979&r1=367978&r2=367979&view=diff
==
--- cfe/trunk/lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp 
(original)
+++ cfe/trunk/lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp 
Mon Aug  5 22:12:23 2019
@@ -11,9 +11,11 @@
 using namespace llvm;
 using namespace clang;
 
-std::unique_ptr clang::DirectoryWatcher::create(
+llvm::Expected> 
clang::DirectoryWatcher::create(
 StringRef Path,
 std::function, bool)> 
Receiver,
 bool WaitForInitialSync) {
-  return nullptr;
+  return llvm::make_error(
+  "DirectoryWatcher is not implemented for this platform!",
+  llvm::inconvertibleErrorCode());
 }
\ No newline at end of file

Modified: cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp?rev=367979&r1=367978&r2=367979&view=diff
==
--- cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp (original)
+++ cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp Mon Aug  5 
22:12:23 2019
@@ -13,6 +13,7 @@
 #include "llvm/ADT/ScopeExit.h"
 #include "llvm/Support/AlignOf.h"
 #include "llvm/Support/Errno.h"
+#include "llvm/Support/Error.h"
 #include "llvm/Support/Mutex.h"
 #include "llvm/Support/Path.h"
 #include 
@@ -320,16 +321,17 @@ DirectoryWatcherLinux::DirectoryWatcherL
 
 } // namespace
 
-

[PATCH] D65704: DirectoryWatcher::create: Adding better error handling.

2019-08-05 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi updated this revision to Diff 213520.
plotfi added a comment.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

add another assert


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65704

Files:
  include/clang/DirectoryWatcher/DirectoryWatcher.h
  lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp
  lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
  lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
  unittests/DirectoryWatcher/DirectoryWatcherTest.cpp

Index: unittests/DirectoryWatcher/DirectoryWatcherTest.cpp
===
--- unittests/DirectoryWatcher/DirectoryWatcherTest.cpp
+++ unittests/DirectoryWatcher/DirectoryWatcherTest.cpp
@@ -284,6 +284,7 @@
 TestConsumer.consume(Events, IsInitial);
   },
   /*waitForInitialSync=*/true);
+  if (!DW) return;
 
   checkEventualResultWithTimeout(TestConsumer);
 }
@@ -315,6 +316,7 @@
 TestConsumer.consume(Events, IsInitial);
   },
   /*waitForInitialSync=*/false);
+  if (!DW) return;
 
   checkEventualResultWithTimeout(TestConsumer);
 }
@@ -335,6 +337,7 @@
 TestConsumer.consume(Events, IsInitial);
   },
   /*waitForInitialSync=*/true);
+  if (!DW) return;
 
   fixture.addFile("a");
   fixture.addFile("b");
@@ -360,6 +363,7 @@
 TestConsumer.consume(Events, IsInitial);
   },
   /*waitForInitialSync=*/true);
+  if (!DW) return;
 
   // modify the file
   {
@@ -390,6 +394,7 @@
 TestConsumer.consume(Events, IsInitial);
   },
   /*waitForInitialSync=*/true);
+  if (!DW) return;
 
   fixture.deleteFile("a");
 
@@ -411,6 +416,7 @@
 TestConsumer.consume(Events, IsInitial);
   },
   /*waitForInitialSync=*/true);
+  if (!DW) return;
 
   remove_directories(fixture.TestWatchedDir);
 
@@ -431,6 +437,7 @@
   TestConsumer.consume(Events, IsInitial);
 },
 /*waitForInitialSync=*/true);
+if (!DW) return;
   } // DW is destructed here.
 
   checkEventualResultWithTimeout(TestConsumer);
Index: lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
===
--- lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
+++ lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
@@ -11,6 +11,7 @@
 
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Error.h"
 #include "llvm/Support/Path.h"
 #include 
 
@@ -17,10 +18,6 @@
 using namespace llvm;
 using namespace clang;
 
-static FSEventStreamRef createFSEventStream(
-StringRef Path,
-std::function, bool)>,
-dispatch_queue_t);
 static void stopFSEventStream(FSEventStreamRef);
 
 namespace {
@@ -153,8 +150,7 @@
 StringRef Path,
 std::function, bool)> Receiver,
 dispatch_queue_t Queue) {
-  if (Path.empty())
-return nullptr;
+  assert(!Path.empty() && "Path.empty()");
 
   CFMutableArrayRef PathsToWatch = [&]() {
 CFMutableArrayRef PathsToWatch =
@@ -205,7 +201,7 @@
   FSEventStreamRelease(EventStream);
 }
 
-std::unique_ptr clang::DirectoryWatcher::create(
+llvm::Expected> clang::DirectoryWatcher::create(
 StringRef Path,
 std::function, bool)> Receiver,
 bool WaitForInitialSync) {
@@ -212,13 +208,9 @@
   dispatch_queue_t Queue =
   dispatch_queue_create("DirectoryWatcher", DISPATCH_QUEUE_SERIAL);
 
-  if (Path.empty())
-return nullptr;
-
+  assert(!Path.empty() && "Path.empty()");
   auto EventStream = createFSEventStream(Path, Receiver, Queue);
-  if (!EventStream) {
-return nullptr;
-  }
+  assert(EventStream && "EventStream expected to be non-null.")
 
   std::unique_ptr Result =
   llvm::make_unique(EventStream, Receiver, Path);
Index: lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
===
--- lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
+++ lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
@@ -13,6 +13,7 @@
 #include "llvm/ADT/ScopeExit.h"
 #include "llvm/Support/AlignOf.h"
 #include "llvm/Support/Errno.h"
+#include "llvm/Support/Error.h"
 #include "llvm/Support/Mutex.h"
 #include "llvm/Support/Path.h"
 #include 
@@ -320,16 +321,17 @@
 
 } // namespace
 
-std::unique_ptr clang::DirectoryWatcher::create(
+llvm::Expected> clang::DirectoryWatcher::create(
 StringRef Path,
 std::function, bool)> Receiver,
 bool WaitForInitialSync) {
-  if (Path.empty())
-return nullptr;
+  assert(!Path.empty() && "Path.empty()");
 
   const int InotifyFD = inotify_init1(IN_CLOEXEC);
   if (InotifyFD == -1)
-return nullptr;
+return llvm::make_error(
+std::string("inotify_init1() error: ") + strerror(errno),
+llvm::inconvertibleErrorCode());
 
   const int InotifyWD = inotify_add_watch(
   InotifyFD, Path.str().c_str(),
@@ -340,12 +342,16 @@
 #endif
   );
   if (InotifyWD == -1)
-return n

[PATCH] D65704: DirectoryWatcher::create: Adding better error handling.

2019-08-05 Thread Saleem Abdulrasool via Phabricator via cfe-commits
compnerd added inline comments.



Comment at: clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp:218
+return llvm::make_error(
+std::string("Path.empty() error: ") + strerror(errno),
+llvm::inconvertibleErrorCode());

compnerd wrote:
> Similar.
Should this just assert as well?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65704



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


[PATCH] D65597: WIP: Builtins: Start adding half versions of math builtins

2019-08-05 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm closed this revision.
arsenm added a comment.

r367973


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

https://reviews.llvm.org/D65597



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


r367973 - Builtins: Start adding half versions of math builtins

2019-08-05 Thread Matt Arsenault via cfe-commits
Author: arsenm
Date: Mon Aug  5 20:28:37 2019
New Revision: 367973

URL: http://llvm.org/viewvc/llvm-project?rev=367973&view=rev
Log:
Builtins: Start adding half versions of math builtins

The implementation of the OpenCL builtin currently library uses 2
different hacks to get to the corresponding IR intrinsics from the
source. This will allow removal of those.

This is the set that is currently used (minus a few vector ones).

Added:
cfe/trunk/test/CodeGenOpenCL/builtins-f16.cl
Modified:
cfe/trunk/include/clang/Basic/Builtins.def
cfe/trunk/lib/CodeGen/CGBuiltin.cpp

Modified: cfe/trunk/include/clang/Basic/Builtins.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.def?rev=367973&r1=367972&r2=367973&view=diff
==
--- cfe/trunk/include/clang/Basic/Builtins.def (original)
+++ cfe/trunk/include/clang/Basic/Builtins.def Mon Aug  5 20:28:37 2019
@@ -113,14 +113,17 @@ BUILTIN(__builtin_atan2l, "LdLdLd", "Fne
 BUILTIN(__builtin_abs  , "ii"  , "ncF")
 BUILTIN(__builtin_copysign, "ddd", "ncF")
 BUILTIN(__builtin_copysignf, "fff", "ncF")
+BUILTIN(__builtin_copysignf16, "hhh", "ncF")
 BUILTIN(__builtin_copysignl, "LdLdLd", "ncF")
 BUILTIN(__builtin_copysignf128, "LLdLLdLLd", "ncF")
 BUILTIN(__builtin_fabs , "dd"  , "ncF")
 BUILTIN(__builtin_fabsf, "ff"  , "ncF")
 BUILTIN(__builtin_fabsl, "LdLd", "ncF")
+BUILTIN(__builtin_fabsf16, "hh"  , "ncF")
 BUILTIN(__builtin_fabsf128, "LLdLLd", "ncF")
 BUILTIN(__builtin_fmod , "ddd"  , "Fne")
 BUILTIN(__builtin_fmodf, "fff"  , "Fne")
+BUILTIN(__builtin_fmodf16, "hhh"  , "Fne")
 BUILTIN(__builtin_fmodl, "LdLdLd", "Fne")
 BUILTIN(__builtin_frexp , "ddi*"  , "Fn")
 BUILTIN(__builtin_frexpf, "ffi*"  , "Fn")
@@ -154,6 +157,7 @@ BUILTIN(__builtin_powif, "ffi"  , "Fnc")
 BUILTIN(__builtin_powil, "LdLdi", "Fnc")
 BUILTIN(__builtin_pow , "ddd"  , "Fne")
 BUILTIN(__builtin_powf, "fff"  , "Fne")
+BUILTIN(__builtin_powf16, "hhh"  , "Fne")
 BUILTIN(__builtin_powl, "LdLdLd", "Fne")
 
 // Standard unary libc/libm functions with double/float/long double variants:
@@ -180,9 +184,11 @@ BUILTIN(__builtin_cbrtf, "ff", "Fnc")
 BUILTIN(__builtin_cbrtl, "LdLd", "Fnc")
 BUILTIN(__builtin_ceil , "dd"  , "Fnc")
 BUILTIN(__builtin_ceilf, "ff"  , "Fnc")
+BUILTIN(__builtin_ceilf16, "hh"  , "Fnc")
 BUILTIN(__builtin_ceill, "LdLd", "Fnc")
 BUILTIN(__builtin_cos , "dd"  , "Fne")
 BUILTIN(__builtin_cosf, "ff"  , "Fne")
+BUILTIN(__builtin_cosf16, "hh"  , "Fne")
 BUILTIN(__builtin_cosh , "dd"  , "Fne")
 BUILTIN(__builtin_coshf, "ff"  , "Fne")
 BUILTIN(__builtin_coshl, "LdLd", "Fne")
@@ -195,9 +201,11 @@ BUILTIN(__builtin_erfcf, "ff", "Fne")
 BUILTIN(__builtin_erfcl, "LdLd", "Fne")
 BUILTIN(__builtin_exp , "dd"  , "Fne")
 BUILTIN(__builtin_expf, "ff"  , "Fne")
+BUILTIN(__builtin_expf16, "hh"  , "Fne")
 BUILTIN(__builtin_expl, "LdLd", "Fne")
 BUILTIN(__builtin_exp2 , "dd"  , "Fne")
 BUILTIN(__builtin_exp2f, "ff"  , "Fne")
+BUILTIN(__builtin_exp2f16, "hh"  , "Fne")
 BUILTIN(__builtin_exp2l, "LdLd", "Fne")
 BUILTIN(__builtin_expm1 , "dd", "Fne")
 BUILTIN(__builtin_expm1f, "ff", "Fne")
@@ -207,15 +215,19 @@ BUILTIN(__builtin_fdimf, "fff", "Fne")
 BUILTIN(__builtin_fdiml, "LdLdLd", "Fne")
 BUILTIN(__builtin_floor , "dd"  , "Fnc")
 BUILTIN(__builtin_floorf, "ff"  , "Fnc")
+BUILTIN(__builtin_floorf16, "hh"  , "Fnc")
 BUILTIN(__builtin_floorl, "LdLd", "Fnc")
 BUILTIN(__builtin_fma, "", "Fne")
 BUILTIN(__builtin_fmaf, "", "Fne")
+BUILTIN(__builtin_fmaf16, "", "Fne")
 BUILTIN(__builtin_fmal, "LdLdLdLd", "Fne")
 BUILTIN(__builtin_fmax, "ddd", "Fnc")
 BUILTIN(__builtin_fmaxf, "fff", "Fnc")
+BUILTIN(__builtin_fmaxf16, "hhh", "Fnc")
 BUILTIN(__builtin_fmaxl, "LdLdLd", "Fnc")
 BUILTIN(__builtin_fmin, "ddd", "Fnc")
 BUILTIN(__builtin_fminf, "fff", "Fnc")
+BUILTIN(__builtin_fminf16, "hhh", "Fnc")
 BUILTIN(__builtin_fminl, "LdLdLd", "Fnc")
 BUILTIN(__builtin_hypot , "ddd"  , "Fne")
 BUILTIN(__builtin_hypotf, "fff"  , "Fne")
@@ -235,17 +247,20 @@ BUILTIN(__builtin_llroundl, "LLiLd", "Fn
 BUILTIN(__builtin_log , "dd"  , "Fne")
 BUILTIN(__builtin_log10 , "dd"  , "Fne")
 BUILTIN(__builtin_log10f, "ff"  , "Fne")
+BUILTIN(__builtin_log10f16, "hh"  , "Fne")
 BUILTIN(__builtin_log10l, "LdLd", "Fne")
 BUILTIN(__builtin_log1p , "dd"  , "Fne")
 BUILTIN(__builtin_log1pf, "ff"  , "Fne")
 BUILTIN(__builtin_log1pl, "LdLd", "Fne")
 BUILTIN(__builtin_log2, "dd"  , "Fne")
 BUILTIN(__builtin_log2f, "ff"  , "Fne")
+BUILTIN(__builtin_log2f16, "hh"  , "Fne")
 BUILTIN(__builtin_log2l, "LdLd"  , "Fne")
 BUILTIN(__builtin_logb , "dd", "Fne")
 BUILTIN(__builtin_logbf, "ff", "Fne")
 BUILTIN(__builtin_logbl, "LdLd", "Fne")
 BUILTIN(__builtin_logf, "ff"  , "Fne")
+BUILTIN(__builtin_logf16, "hh"  , "Fne")
 BUILTIN(__builtin_logl, "LdLd", "Fne")
 BUILTIN(__builtin_lrint , "Lid", "Fne")
 BUILTIN(__builtin_lrintf, "Lif", "Fne")
@@ -270,9 +285,11 @@ BUILTIN(__builtin_remquof, "fffi*", "Fn"
 BUILTIN(__builtin_remquol, "LdLdLdi*", "Fn")

[PATCH] D65545: Handle some fs::remove failures

2019-08-05 Thread Bruno Cardoso Lopes via Phabricator via cfe-commits
bruno added a comment.

Thanks for working on this JF!




Comment at: clang/lib/Frontend/PrecompiledPreamble.cpp:107-111
 TemporaryFiles::~TemporaryFiles() {
   llvm::MutexGuard Guard(Mutex);
   for (const auto &File : Files)
-llvm::sys::fs::remove(File.getKey());
+if (std::error_code EC = llvm::sys::fs::remove(File.getKey()))
+  llvm::report_fatal_error("failed removing file \"" + File.getKey() + 
"\": " + EC.message());

jfb wrote:
> jkorous wrote:
> > vsapsai wrote:
> > > Clangd uses `PrecompiledPreamble` but not `TemporaryFiles` as far as I 
> > > can tell. `report_fatal_error` can be really disruptive for clangd, so it 
> > > would be good to get an opinion from somebody working on it if this 
> > > change would impact them.
> > Since client code in general might have different error handling/reporting 
> > strategy and can't do much about failure in destructor here, I'd consider 
> > just some kind of logging or assert here. 
> > 
> I changed it to `dbgs()`.
This probably means we won't see the message in a non-debug build, right?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65545



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


[PATCH] D65704: DirectoryWatcher::create: Adding better error handling.

2019-08-05 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi updated this revision to Diff 213515.
plotfi added a comment.

Improve comments, change Path.empty() errors for asserts.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65704

Files:
  clang/include/clang/DirectoryWatcher/DirectoryWatcher.h
  clang/lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp
  clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
  clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
  clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp

Index: clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp
===
--- clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp
+++ clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp
@@ -280,6 +280,7 @@
 TestConsumer.consume(Events, IsInitial);
   },
   /*waitForInitialSync=*/true);
+  if (!DW) return;
 
   checkEventualResultWithTimeout(TestConsumer);
 }
@@ -311,6 +312,7 @@
 TestConsumer.consume(Events, IsInitial);
   },
   /*waitForInitialSync=*/false);
+  if (!DW) return;
 
   checkEventualResultWithTimeout(TestConsumer);
 }
@@ -331,6 +333,7 @@
 TestConsumer.consume(Events, IsInitial);
   },
   /*waitForInitialSync=*/true);
+  if (!DW) return;
 
   fixture.addFile("a");
   fixture.addFile("b");
@@ -356,6 +359,7 @@
 TestConsumer.consume(Events, IsInitial);
   },
   /*waitForInitialSync=*/true);
+  if (!DW) return;
 
   // modify the file
   {
@@ -386,6 +390,7 @@
 TestConsumer.consume(Events, IsInitial);
   },
   /*waitForInitialSync=*/true);
+  if (!DW) return;
 
   fixture.deleteFile("a");
 
@@ -407,6 +412,7 @@
 TestConsumer.consume(Events, IsInitial);
   },
   /*waitForInitialSync=*/true);
+  if (!DW) return;
 
   remove_directories(fixture.TestWatchedDir);
 
@@ -427,7 +433,8 @@
   TestConsumer.consume(Events, IsInitial);
 },
 /*waitForInitialSync=*/true);
+if (!DW) return;
   } // DW is destructed here.
 
   checkEventualResultWithTimeout(TestConsumer);
 }
\ No newline at end of file
Index: clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
===
--- clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
+++ clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
@@ -11,16 +11,13 @@
 
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Error.h"
 #include "llvm/Support/Path.h"
 #include 
 
 using namespace llvm;
 using namespace clang;
 
-static FSEventStreamRef createFSEventStream(
-StringRef Path,
-std::function, bool)>,
-dispatch_queue_t);
 static void stopFSEventStream(FSEventStreamRef);
 
 namespace {
@@ -153,8 +150,7 @@
 StringRef Path,
 std::function, bool)> Receiver,
 dispatch_queue_t Queue) {
-  if (Path.empty())
-return nullptr;
+  assert(!Path.empty() && "Path.empty()");
 
   CFMutableArrayRef PathsToWatch = [&]() {
 CFMutableArrayRef PathsToWatch =
@@ -205,7 +201,7 @@
   FSEventStreamRelease(EventStream);
 }
 
-std::unique_ptr clang::DirectoryWatcher::create(
+llvm::Expected> clang::DirectoryWatcher::create(
 StringRef Path,
 std::function, bool)> Receiver,
 bool WaitForInitialSync) {
@@ -213,12 +209,11 @@
   dispatch_queue_create("DirectoryWatcher", DISPATCH_QUEUE_SERIAL);
 
   if (Path.empty())
-return nullptr;
+return llvm::make_error(
+std::string("Path.empty() error: "), llvm::inconvertibleErrorCode());
 
   auto EventStream = createFSEventStream(Path, Receiver, Queue);
-  if (!EventStream) {
-return nullptr;
-  }
+  assert(EventStream && "EventStream expected to be non-null.")
 
   std::unique_ptr Result =
   llvm::make_unique(EventStream, Receiver, Path);
Index: clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
===
--- clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
+++ clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
@@ -13,6 +13,7 @@
 #include "llvm/ADT/ScopeExit.h"
 #include "llvm/Support/AlignOf.h"
 #include "llvm/Support/Errno.h"
+#include "llvm/Support/Error.h"
 #include "llvm/Support/Mutex.h"
 #include "llvm/Support/Path.h"
 #include 
@@ -320,16 +321,17 @@
 
 } // namespace
 
-std::unique_ptr clang::DirectoryWatcher::create(
+llvm::Expected> clang::DirectoryWatcher::create(
 StringRef Path,
 std::function, bool)> Receiver,
 bool WaitForInitialSync) {
-  if (Path.empty())
-return nullptr;
+  assert(!Path.empty() && "Path.empty()");
 
   const int InotifyFD = inotify_init1(IN_CLOEXEC);
   if (InotifyFD == -1)
-return nullptr;
+return llvm::make_error(
+std::string("inotify_init1() error: ") + strerror(errno),
+llvm::inconvertibleErrorCode());
 
   const int InotifyWD = inotify_add_watch(
   Inot

[PATCH] D65690: [clang-doc] Add index in each info html file

2019-08-05 Thread Diego Astiazarán via Phabricator via cfe-commits
DiegoAstiazaran added inline comments.



Comment at: clang-tools-extra/clang-doc/Generators.cpp:79
+
+bool Generator::createResources(ClangDocContext &CDCtx) {
+  std::error_code OK;

juliehockett wrote:
> Why is this implementation in the generic Generator? It's fairly 
> HTML-specific -- neither of the other generators are able to parse and 
> include Javascript (since this does include the `var JsonIndex` bit).
Moved to HTMLGenerator.cpp; it was there because I was first writing a JSON 
file which could be used for any generator.


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

https://reviews.llvm.org/D65690



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


[PATCH] D65030: [clang-doc] Add second index for sections within info's content

2019-08-05 Thread Diego Astiazarán via Phabricator via cfe-commits
DiegoAstiazaran added inline comments.



Comment at: clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp:47-52
+
+  Namespaces
+  Records
+  Functions
+  OneFunction
+

juliehockett wrote:
> DiegoAstiazaran wrote:
> > juliehockett wrote:
> > > Formatting is a bit weird for sublists
> > Fixed by D65005. It will be properly formatted after rebasing.
> This formatting is still a bit weird :( The inner `ul` didn't get its own 
> newline, so it's hard to tell which list each item is part of. Not a huge 
> problem, but if it's a reasonably small fix I'd love to see it cleaned up.
I had not rebased.
I rebased in the last version of this patch and the index is rendered as D65005.


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

https://reviews.llvm.org/D65030



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


[PATCH] D64089: [Driver] Introduce -stdlib++-isystem

2019-08-05 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added a reviewer: rnk.
smeenai added a subscriber: rnk.
smeenai added a comment.

Adding @rnk as someone familiar with the driver/frontend :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64089



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


[PATCH] D65690: [clang-doc] Add index in each info html file

2019-08-05 Thread Diego Astiazarán via Phabricator via cfe-commits
DiegoAstiazaran updated this revision to Diff 213513.
DiegoAstiazaran marked 3 inline comments as done.
DiegoAstiazaran added a comment.

Moved serialization of Index to HTML generator.


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

https://reviews.llvm.org/D65690

Files:
  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/YAMLGenerator.cpp
  clang-tools-extra/clang-doc/assets/clang-doc-default-stylesheet.css
  clang-tools-extra/clang-doc/assets/index.js
  clang-tools-extra/clang-doc/stylesheets/clang-doc-default-stylesheet.css
  clang-tools-extra/clang-doc/tool/CMakeLists.txt
  clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
  clang-tools-extra/unittests/clang-doc/CMakeLists.txt
  clang-tools-extra/unittests/clang-doc/ClangDocTest.cpp
  clang-tools-extra/unittests/clang-doc/ClangDocTest.h
  clang-tools-extra/unittests/clang-doc/GeneratorTest.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
@@ -28,6 +28,7 @@
   CDCtx.UserStylesheets.insert(
   CDCtx.UserStylesheets.begin(),
   "../share/clang/clang-doc-default-stylesheet.css");
+  CDCtx.JsScripts.emplace_back("index.js");
   return CDCtx;
 }
 
@@ -56,6 +57,8 @@
 namespace Namespace
 
 
+
+
 
   namespace Namespace
   Namespaces
@@ -114,6 +117,8 @@
 
 class r
 
+
+
 
   class r
   Defined at line 10 of test.cpp
@@ -175,6 +180,8 @@
 
 
 
+
+
 
   f
   
@@ -212,6 +219,8 @@
 
 
 
+
+
 
   enum class e
   
@@ -281,6 +290,8 @@
 
 
 
+
+
 
   f
   void f(int I, int J)
Index: clang-tools-extra/unittests/clang-doc/GeneratorTest.cpp
===
--- /dev/null
+++ clang-tools-extra/unittests/clang-doc/GeneratorTest.cpp
@@ -0,0 +1,74 @@
+//===-- clang-doc/GeneratorTest.cpp ---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "ClangDocTest.h"
+#include "Generators.h"
+#include "Representation.h"
+#include "Serialize.h"
+#include "gtest/gtest.h"
+
+namespace clang {
+namespace doc {
+
+TEST(GeneratorTest, emitIndex) {
+  Index Idx;
+  auto InfoA = llvm::make_unique();
+  InfoA->Name = "A";
+  InfoA->USR = serialize::hashUSR("1");
+  Generator::addInfoToIndex(Idx, InfoA.get());
+  auto InfoC = llvm::make_unique();
+  InfoC->Name = "C";
+  InfoC->USR = serialize::hashUSR("3");
+  Reference RefB = Reference("B");
+  RefB.USR = serialize::hashUSR("2");
+  InfoC->Namespace = {std::move(RefB)};
+  Generator::addInfoToIndex(Idx, InfoC.get());
+  auto InfoD = llvm::make_unique();
+  InfoD->Name = "D";
+  InfoD->USR = serialize::hashUSR("4");
+  auto InfoF = llvm::make_unique();
+  InfoF->Name = "F";
+  InfoF->USR = serialize::hashUSR("6");
+  Reference RefD = Reference("D");
+  RefD.USR = serialize::hashUSR("4");
+  Reference RefE = Reference("E");
+  RefE.USR = serialize::hashUSR("5");
+  InfoF->Namespace = {std::move(RefE), std::move(RefD)};
+  Generator::addInfoToIndex(Idx, InfoF.get());
+  auto InfoG = llvm::make_unique(InfoType::IT_namespace);
+  Generator::addInfoToIndex(Idx, InfoG.get());
+
+  Index ExpectedIdx;
+  Index IndexA;
+  IndexA.Name = "A";
+  ExpectedIdx.Children.emplace_back(std::move(IndexA));
+  Index IndexB;
+  IndexB.Name = "B";
+  Index IndexC;
+  IndexC.Name = "C";
+  IndexB.Children.emplace_back(std::move(IndexC));
+  ExpectedIdx.Children.emplace_back(std::move(IndexB));
+  Index IndexD;
+  IndexD.Name = "D";
+  Index IndexE;
+  IndexE.Name = "E";
+  Index IndexF;
+  IndexF.Name = "F";
+  IndexE.Children.emplace_back(std::move(IndexF));
+  IndexD.Children.emplace_back(std::move(IndexE));
+  ExpectedIdx.Children.emplace_back(std::move(IndexD));
+  Index IndexG;
+  IndexG.Name = "GlobalNamespace";
+  IndexG.RefType = InfoType::IT_namespace;
+  ExpectedIdx.Children.emplace_back(std::move(IndexG));
+
+  CheckIndex(ExpectedIdx, Idx);
+}
+
+} // namespace doc
+} // namespace clang
Index: clang-tools-extra/unittests/clang-doc/ClangDocTest.h
===
--- clang-tools-extra/unittests/clang-doc/ClangDocTest.h
+++ clang-tools-extra/unittests/clang-doc/ClangDocTest.h
@@ -44,6 +44,8 @@
 void CheckNamespaceInfo(NamespaceInfo *Expected, NamespaceInfo *Actual);
 void CheckRecordInfo(RecordInfo *Expected, Rec

[PATCH] D63907: [clang-scan-deps] Implementation of dependency scanner over minimized sources

2019-08-05 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added inline comments.



Comment at: 
clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp:156
+/// this subclass.
+class MinimizedVFSFile final : public llvm::vfs::File {
+public:

aganea wrote:
> This makes only a short-lived objects, is that right? Just during the call to 
> `CachedFileSystemEntry::createFileEntry`?
 Yes, these VFS buffer files are only alive for a particular invocation.



Comment at: 
clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp:148
+  RealFS = new ProxyFileSystemWithoutChdir(llvm::vfs::getRealFileSystem());
+  if (Service.getMode() == ScanningMode::MinimizedSourcePreprocessing)
+DepFS = new DependencyScanningFilesystem(Service.getSharedCache(), RealFS);

aganea wrote:
> arphaman wrote:
> > aganea wrote:
> > > Can we not use caching all the time?
> > We want to have a mode where it's as close to the regular `clang -E` 
> > invocation as possible for correctness CI and testing. We also haven't 
> > evaluated if the cost of keeping non-minimized sources in memory, so it 
> > might be too expensive for practical use? I can add a third option that 
> > caches but doesn't minimize though as a follow-up patch though 
> > 
> Yes that would be nice. As for the size taken in RAM, it would be only .H 
> files, right? For Clang+LLVM+LLD I'm counting about 40 MB. But indeed with a 
> large project, that would be about 1.5 GB of .H. Although I doubt all these 
> files will be loaded at once in memory (I'll check)
> 
> As for the usage: Fastbuild works like distcc (plain mode, not pump) so we 
> were also planning on extracting the fully preprocessed output, not only the 
> dependencies. There's one use-case where we need to preprocess locally, then 
> send the preprocessed output remotely for compilation. And another use-case 
> where we only want to extract the dependency list, compute a digest, to 
> retrieve the OBJ from a network cache.
Right now it doesn't differentiate between .H and other files, but we could 
teach it do have a header only filter for the cache.


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

https://reviews.llvm.org/D63907



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


[PATCH] D63907: [clang-scan-deps] Implementation of dependency scanner over minimized sources

2019-08-05 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman updated this revision to Diff 213511.
arphaman marked 3 inline comments as done.
arphaman added a comment.

Fix comment typo


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

https://reviews.llvm.org/D63907

Files:
  clang/include/clang/Basic/FileManager.h
  clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h
  clang/include/clang/Tooling/DependencyScanning/DependencyScanningService.h
  clang/include/clang/Tooling/DependencyScanning/DependencyScanningWorker.h
  clang/lib/Tooling/DependencyScanning/CMakeLists.txt
  clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp
  clang/lib/Tooling/DependencyScanning/DependencyScanningService.cpp
  clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
  
clang/test/ClangScanDeps/Inputs/frameworks/Framework.framework/Headers/Framework.h
  
clang/test/ClangScanDeps/Inputs/frameworks/Framework.framework/PrivateHeaders/PrivateHeader.h
  clang/test/ClangScanDeps/Inputs/header_stat_before_open_cdb.json
  clang/test/ClangScanDeps/Inputs/vfsoverlay.yaml
  clang/test/ClangScanDeps/Inputs/vfsoverlay_cdb.json
  clang/test/ClangScanDeps/header_stat_before_open.m
  clang/test/ClangScanDeps/regular_cdb.cpp
  clang/test/ClangScanDeps/vfsoverlay.cpp
  clang/tools/clang-scan-deps/ClangScanDeps.cpp

Index: clang/tools/clang-scan-deps/ClangScanDeps.cpp
===
--- clang/tools/clang-scan-deps/ClangScanDeps.cpp
+++ clang/tools/clang-scan-deps/ClangScanDeps.cpp
@@ -8,6 +8,7 @@
 
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Tooling/CommonOptionsParser.h"
+#include "clang/Tooling/DependencyScanning/DependencyScanningService.h"
 #include "clang/Tooling/DependencyScanning/DependencyScanningWorker.h"
 #include "clang/Tooling/JSONCompilationDatabase.h"
 #include "llvm/Support/InitLLVM.h"
@@ -45,9 +46,10 @@
   ///
   /// \param Compilations The reference to the compilation database that's
   /// used by the clang tool.
-  DependencyScanningTool(const tooling::CompilationDatabase &Compilations,
+  DependencyScanningTool(DependencyScanningService &Service,
+ const tooling::CompilationDatabase &Compilations,
  SharedStream &OS, SharedStream &Errs)
-  : Compilations(Compilations), OS(OS), Errs(Errs) {}
+  : Worker(Service), Compilations(Compilations), OS(OS), Errs(Errs) {}
 
   /// Computes the dependencies for the given file and prints them out.
   ///
@@ -80,6 +82,20 @@
 
 llvm::cl::OptionCategory DependencyScannerCategory("Tool options");
 
+static llvm::cl::opt ScanMode(
+"mode",
+llvm::cl::desc("The preprocessing mode used to compute the dependencies"),
+llvm::cl::values(
+clEnumValN(ScanningMode::MinimizedSourcePreprocessing,
+   "preprocess-minimized-sources",
+   "The set of dependencies is computed by preprocessing the "
+   "source files that were minimized to only include the "
+   "contents that might affect the dependencies"),
+clEnumValN(ScanningMode::CanonicalPreprocessing, "preprocess",
+   "The set of dependencies is computed by preprocessing the "
+   "unmodified source files")),
+llvm::cl::init(ScanningMode::MinimizedSourcePreprocessing));
+
 llvm::cl::opt
 NumThreads("j", llvm::cl::Optional,
llvm::cl::desc("Number of worker threads to use (default: use "
@@ -136,12 +152,14 @@
   SharedStream Errs(llvm::errs());
   // Print out the dependency results to STDOUT by default.
   SharedStream DependencyOS(llvm::outs());
+
+  DependencyScanningService Service(ScanMode);
   unsigned NumWorkers =
   NumThreads == 0 ? llvm::hardware_concurrency() : NumThreads;
   std::vector> WorkerTools;
   for (unsigned I = 0; I < NumWorkers; ++I)
 WorkerTools.push_back(llvm::make_unique(
-*AdjustingCompilations, DependencyOS, Errs));
+Service, *AdjustingCompilations, DependencyOS, Errs));
 
   std::vector WorkerThreads;
   std::atomic HadErrors(false);
Index: clang/test/ClangScanDeps/vfsoverlay.cpp
===
--- /dev/null
+++ clang/test/ClangScanDeps/vfsoverlay.cpp
@@ -0,0 +1,17 @@
+// RUN: rm -rf %t.dir
+// RUN: rm -rf %t.cdb
+// RUN: mkdir -p %t.dir
+// RUN: cp %s %t.dir/vfsoverlay.cpp
+// RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/vfsoverlay.yaml > %t.dir/vfsoverlay.yaml
+// RUN: mkdir %t.dir/Inputs
+// RUN: cp %S/Inputs/header.h %t.dir/Inputs/header.h
+// RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/vfsoverlay_cdb.json > %t.cdb
+//
+// RUN: clang-scan-deps -compilation-database %t.cdb -j 1 | \
+// RUN:   FileCheck %s
+
+#include "not_real.h"
+
+// CHECK: clang-scan-deps dependency
+// CHECK-NEXT: vfsoverlay.cpp
+// CHECK-NEXT: Inputs{{/|\\}}header.h
Index: clang/test/ClangScanDeps/regular_cdb.cpp
===
--- 

[PATCH] D65030: [clang-doc] Add second index for sections within info's content

2019-08-05 Thread Diego Astiazarán via Phabricator via cfe-commits
DiegoAstiazaran updated this revision to Diff 213509.
DiegoAstiazaran marked 2 inline comments as done.
DiegoAstiazaran edited the summary of this revision.
DiegoAstiazaran added a parent revision: D65690: [clang-doc] Add index in each 
info html file.
DiegoAstiazaran added a comment.

Changed dependency of commit, D65003  was 
abandoned and replaced by D65690 .
Rebased to latest commit so HTML is now rendered correctly.
`genHTML(const Index &Index, ...)` was originally implemented by D65003 
 but it is now part of this commit.


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

https://reviews.llvm.org/D65030

Files:
  clang-tools-extra/clang-doc/HTMLGenerator.cpp
  clang-tools-extra/clang-doc/Representation.h
  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
@@ -9,6 +9,7 @@
 #include "ClangDocTest.h"
 #include "Generators.h"
 #include "Representation.h"
+#include "Serialize.h"
 #include "gtest/gtest.h"
 
 namespace clang {
@@ -59,24 +60,60 @@
 
 
 
+
+  
+
+  Namespaces
+
+  
+  
+
+  Records
+
+  
+  
+
+  Functions
+
+
+  
+
+  OneFunction
+
+  
+
+  
+  
+
+  Enums
+
+
+  
+
+  OneEnum
+
+  
+
+  
+
 
   namespace Namespace
-  Namespaces
+  Namespaces
   
 ChildNamespace
   
-  Records
+  Records
   
 ChildStruct
   
-  Functions
+  Functions
   
-OneFunction
+OneFunction
 OneFunction()
   
-  Enums
+  Enums
   
-enum OneEnum
+enum OneEnum
   
 
 )raw";
@@ -119,6 +156,42 @@
 
 
 
+
+  
+
+  Members
+
+  
+  
+
+  Records
+
+  
+  
+
+  Functions
+
+
+  
+
+  OneFunction
+
+  
+
+  
+  
+
+  Enums
+
+
+  
+
+  OneEnum
+
+  
+
+  
+
 
   class r
   Defined at line 10 of test.cpp
@@ -127,7 +200,7 @@
 F
 , G
   
-  Members
+  Members
   
 
   private 
@@ -135,18 +208,18 @@
X
 
   
-  Records
+  Records
   
 ChildStruct
   
-  Functions
+  Functions
   
-OneFunction
+OneFunction
 OneFunction()
   
-  Enums
+  Enums
   
-enum OneEnum
+enum OneEnum
   
 
 )raw";
@@ -183,7 +256,7 @@
 
 
 
-  f
+  f
   
 float
  f(
@@ -222,7 +295,7 @@
 
 
 
-  enum class e
+  enum class e
   
 X
   
@@ -293,7 +366,7 @@
 
 
 
-  f
+  f
   void f(int I, int J)
   Defined at line 10 of test.cpp
   
Index: clang-tools-extra/clang-doc/Representation.h
===
--- clang-tools-extra/clang-doc/Representation.h
+++ clang-tools-extra/clang-doc/Representation.h
@@ -350,12 +350,15 @@
 
 struct Index : public Reference {
   Index() = default;
+  Index(StringRef Name, StringRef JumpToSection)
+  : Reference(Name), JumpToSection(JumpToSection) {}
   Index(SymbolID USR, StringRef Name, InfoType IT, StringRef Path)
   : Reference(USR, Name, IT, Path) {}
   // This is used to look for a USR in a vector of Indexes using std::find
   bool operator==(const SymbolID &Other) const { return USR == Other; }
   bool operator<(const Index &Other) const { return Name < Other.Name; }
 
+  SmallString<16> JumpToSection;
   std::vector Children;
 
   void sort();
Index: clang-tools-extra/clang-doc/HTMLGenerator.cpp
===
--- clang-tools-extra/clang-doc/HTMLGenerator.cpp
+++ clang-tools-extra/clang-doc/HTMLGenerator.cpp
@@ -266,15 +266,22 @@
   return LinkNode;
 }
 
-static std::unique_ptr genTypeReference(const Reference &Type,
-  StringRef CurrentDirectory) {
-  if (Type.Path.empty() && !Type.IsInGlobalNamespace)
-return llvm::make_unique(Type.Name);
+static std::unique_ptr
+genTypeReference(const Reference &Type, StringRef CurrentDirectory,
+ StringRef JumpToSection = "") {
+  if (Type.Path.empty() && !Type.IsInGlobalNamespace) {
+if (JumpToSection.empty())
+  return llvm::make_unique(Type.Name);
+else
+  return genLink(Type.Name, "#" + JumpToSection);
+  }
   llvm::SmallString<128> Path =
   computeRelativePath(Type.Path, CurrentDirectory);
   llvm::sys::path::append(Path, Type.Name + ".html");
   // Paths in HTML must be in posix-style
   llvm::sys::path::native(Path, llvm::sys::path::Style::posix);
+  if (!JumpToSection.empty())
+Path += ("#" + JumpToSection).str();
   return genLink(Type.Name, Path);
 }
 
@@ -301,6 +308,7 @@
 
   std::vector> Out;
   Out.emplace_back(llvm::make_unique(HTMLTag::TAG_H2, "Enums"

[PATCH] D65708: [NFC][DirectoryWatchedTests] Unlocking mutexes before signaling condition variable.

2019-08-05 Thread Puyan Lotfi via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL367968: [NFC][DirectoryWatchedTests] Unlocks mutexes before 
signaling condition variable (authored by zer0, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D65708?vs=213220&id=213510#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D65708

Files:
  cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp


Index: cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp
===
--- cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp
+++ cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp
@@ -132,8 +132,10 @@
 } else {
   ExpectedInitial.erase(It);
 }
-if (result())
+if (result()) {
+  L.unlock();
   ResultIsReady.notify_one();
+}
   }
 
   void consumeNonInitial(DirectoryWatcher::Event E) {
@@ -151,8 +153,10 @@
 } else {
   ExpectedNonInitial.erase(It);
 }
-if (result())
+if (result()) {
+  L.unlock();
   ResultIsReady.notify_one();
+}
   }
 
   // This method is used by DirectoryWatcher.


Index: cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp
===
--- cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp
+++ cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp
@@ -132,8 +132,10 @@
 } else {
   ExpectedInitial.erase(It);
 }
-if (result())
+if (result()) {
+  L.unlock();
   ResultIsReady.notify_one();
+}
   }
 
   void consumeNonInitial(DirectoryWatcher::Event E) {
@@ -151,8 +153,10 @@
 } else {
   ExpectedNonInitial.erase(It);
 }
-if (result())
+if (result()) {
+  L.unlock();
   ResultIsReady.notify_one();
+}
   }
 
   // This method is used by DirectoryWatcher.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r367968 - [NFC][DirectoryWatchedTests] Unlocks mutexes before signaling condition variable

2019-08-05 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Mon Aug  5 18:26:46 2019
New Revision: 367968

URL: http://llvm.org/viewvc/llvm-project?rev=367968&view=rev
Log:
[NFC][DirectoryWatchedTests] Unlocks mutexes before signaling condition variable

This should not affect actual behavior, but should pessimize the threading less
by avoiding the situation where:

  * mutex is still locked
  * T1 notifies on condition variable
  * T2 wakes to check mutex
  * T2 sees mutex is still locked
  * T2 waits
  * T1 unlocks mutex
  * T2 tries again, acquires mutex.

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


Modified:
cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp

Modified: cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp?rev=367968&r1=367967&r2=367968&view=diff
==
--- cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp (original)
+++ cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp Mon Aug  5 
18:26:46 2019
@@ -132,8 +132,10 @@ struct VerifyingConsumer {
 } else {
   ExpectedInitial.erase(It);
 }
-if (result())
+if (result()) {
+  L.unlock();
   ResultIsReady.notify_one();
+}
   }
 
   void consumeNonInitial(DirectoryWatcher::Event E) {
@@ -151,8 +153,10 @@ struct VerifyingConsumer {
 } else {
   ExpectedNonInitial.erase(It);
 }
-if (result())
+if (result()) {
+  L.unlock();
   ResultIsReady.notify_one();
+}
   }
 
   // This method is used by DirectoryWatcher.


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


Buildbot numbers for the week of 07/28/2019 - 08/03/2019

2019-08-05 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the last week of 07/28/2019 -
08/03/2019.

Please see the same data in attached csv files:

The longest time each builder was red during the week;
"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green);
Count of commits by project;
Number of completed builds, failed builds and average build time for
successful builds per active builder;
Average waiting time for a revision to get build result per active builder
(response time).

Thanks

Galina


The longest time each builder was red during the week:
   buildername| was_red
--+-
 netbsd-amd64 | 50:54:03
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast | 41:40:11
 clang-cmake-armv8-lld| 38:27:29
 clang-cmake-armv8-selfhost-neon  | 36:18:20
 clang-cmake-armv8-full   | 35:21:16
 clang-cmake-armv7-global-isel| 35:18:42
 clang-cmake-armv7-quick  | 35:07:52
 sanitizer-x86_64-linux-gn| 34:42:00
 clang-cmake-thumbv8-full-sh  | 34:39:00
 clang-cmake-armv7-full   | 34:16:06
 clang-cmake-armv8-global-isel| 34:15:00
 clang-cmake-armv8-quick  | 34:05:30
 llvm-clang-x86_64-expensive-checks-win   | 34:02:39
 clang-cmake-thumbv7-full-sh  | 33:42:43
 clang-x64-windows-msvc   | 33:11:22
 clang-cmake-armv7-selfhost   | 32:42:03
 clang-cmake-armv7-selfhost-neon  | 32:38:24
 clang-ppc64be-linux  | 32:13:54
 ppc64le-lld-multistage-test  | 30:12:23
 sanitizer-windows| 20:24:27
 clang-lld-x86_64-2stage  | 17:40:22
 libcxx-libcxxabi-x86_64-linux-ubuntu-msan| 16:51:40
 lldb-x64-windows-ninja   | 13:01:58
 clang-cmake-aarch64-full | 11:06:05
 sanitizer-ppc64le-linux  | 10:13:14
 clang-with-thin-lto-ubuntu   | 09:19:17
 clang-s390x-linux-multistage | 07:52:00
 clang-cmake-aarch64-lld  | 07:45:37
 clang-with-lto-ubuntu| 07:43:53
 clang-ppc64be-linux-multistage   | 07:05:44
 clang-ppc64le-linux  | 06:23:06
 sanitizer-x86_64-linux-autoconf  | 06:09:22
 clang-cuda-build | 05:59:47
 clang-s390x-linux-lnt| 05:37:38
 clang-ppc64le-linux-lnt  | 05:20:00
 sanitizer-x86_64-linux-bootstrap | 05:08:16
 sanitizer-x86_64-linux   | 05:04:00
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx2a   | 05:01:41
 clang-ppc64le-linux-multistage   | 04:37:11
 llvm-clang-x86_64-win-fast   | 04:21:02
 lld-x86_64-darwin13  | 04:11:50
 sanitizer-x86_64-linux-fuzzer| 04:06:41
 clang-cmake-aarch64-quick| 03:55:15
 sanitizer-ppc64be-linux  | 03:54:12
 clang-ppc64be-linux-lnt  | 03:50:29
 clang-s390x-linux| 03:32:35
 reverse-iteration| 02:54:44
 sanitizer-x86_64-linux-fast  | 02:46:51
 sanitizer-x86_64-linux-bootstrap-msan| 02:16:02
 lld-x86_64-win7  | 02:01:27
 clang-cmake-aarch64-global-isel  | 02:00:20
 sanitizer-x86_64-linux-bootstrap-ubsan   | 01:40:28
 clang-cmake-x86_64-avx2-linux| 01:39:13
 clang-cmake-armv8-lnt| 01:34:13
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast   | 01:34:03
 clang-atom-d525-fedora-rel   | 01:32:56
 clang-hexagon-elf| 01:16:41
 sanitizer-x86_64-linux-android   | 01:15:06
 clang-cmake-x86_64-avx2-linux-perf   | 00:52:56
 llvm-hexagon-elf | 00:51:55
 clang-cmake-x86_64-sde-avx512-linux  | 00:49:47
 lld-x86_64-ubuntu-fast   | 00:39:58
 clang-x86_64-debian-fast | 00:39:40
 lld-perf-testsuite   | 00:35:31
 clang-x86_64-linux-abi-test  | 00:24:54
 clang-aarch64-linux-build-cache  | 00:19:28
 lld-x86_64-freebsd   | 00:15:36
 clang-armv7-linux-build-cache| 00:12:18
(68 rows)


"Status change ratio" by active builder (percent of builds that changed the
builder s

Buildbot numbers for the week of 07/21/2019 - 07/27/2019

2019-08-05 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the week of 07/21/2019 - 07/27/2019.

Please see the same data in attached csv files:

The longest time each builder was red during the week;
"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green);
Count of commits by project;
Number of completed builds, failed builds and average build time for
successful builds per active builder;
Average waiting time for a revision to get build result per active builder
(response time).

Thanks

Galina


The longest time each builder was red during the week:
   buildername| was_red
--+-
 clang-cmake-x86_64-sde-avx512-linux  | 93:52:46
 aosp-O3-polly-before-vectorizer-unprofitable | 72:56:25
 clang-cmake-x86_64-avx2-linux| 50:30:09
 clang-cmake-aarch64-quick| 36:33:34
 clang-lld-x86_64-2stage  | 33:57:11
 clang-with-lto-ubuntu| 31:42:47
 clang-with-thin-lto-ubuntu   | 29:16:58
 clang-s390x-linux| 17:08:49
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx17   | 17:06:58
 llvm-clang-x86_64-expensive-checks-win   | 16:02:53
 clang-cmake-armv7-selfhost-neon  | 14:21:33
 clang-x64-windows-msvc   | 13:05:21
 llvm-clang-x86_64-win-fast   | 12:50:24
 clang-native-arm-lnt-perf| 12:28:18
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast | 12:14:35
 clang-cmake-armv7-selfhost   | 12:12:22
 sanitizer-ppc64le-linux  | 12:06:08
 clang-s390x-linux-lnt| 11:51:44
 clang-s390x-linux-multistage | 11:33:55
 clang-cmake-aarch64-full | 11:24:20
 sanitizer-x86_64-linux-bootstrap | 11:10:12
 clang-cmake-armv8-selfhost-neon  | 10:57:52
 sanitizer-x86_64-linux   | 10:15:54
 sanitizer-ppc64be-linux  | 10:13:25
 clang-ppc64be-linux-multistage   | 10:08:48
 clang-cmake-armv7-lnt| 09:44:42
 sanitizer-x86_64-linux-bootstrap-ubsan   | 09:28:50
 clang-cmake-aarch64-global-isel  | 09:25:34
 sanitizer-x86_64-linux-bootstrap-msan| 09:18:43
 clang-ppc64le-linux  | 09:18:14
 clang-cmake-aarch64-lld  | 09:18:07
 clang-cmake-thumbv8-full-sh  | 09:16:03
 clang-cmake-x86_64-avx2-linux-perf   | 09:12:57
 clang-ppc64le-linux-lnt  | 09:09:27
 polly-amd64-linux| 09:08:41
 clang-ppc64be-linux-lnt  | 09:08:34
 clang-cmake-armv8-lnt| 09:08:28
 clang-cmake-armv8-global-isel| 09:07:06
 clang-cmake-thumbv7-full-sh  | 09:05:57
 ppc64le-lld-multistage-test  | 09:03:21
 sanitizer-x86_64-linux-autoconf  | 08:58:38
 clang-ppc64be-linux  | 08:57:40
 lld-x86_64-ubuntu-fast   | 08:56:29
 sanitizer-x86_64-linux-fuzzer| 08:53:41
 clang-cmake-armv8-full   | 08:50:24
 clang-cmake-armv8-quick  | 08:19:29
 clang-cmake-armv8-lld| 08:09:34
 clang-ppc64le-linux-multistage   | 08:05:41
 clang-x86_64-linux-abi-test  | 07:35:44
 clang-cmake-armv7-global-isel| 07:32:06
 clang-cmake-armv7-full   | 06:17:47
 clang-hexagon-elf| 05:30:35
 libcxx-libcxxabi-x86_64-linux-ubuntu-msan| 05:24:59
 clang-cmake-armv7-quick  | 04:44:50
 sanitizer-x86_64-linux-fast  | 04:44:40
 sanitizer-x86_64-linux-android   | 04:19:19
 lld-x86_64-darwin13  | 03:44:38
 lldb-x64-windows-ninja   | 03:39:27
 lld-x86_64-freebsd   | 03:27:52
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast   | 03:19:42
 clang-cuda-build | 03:15:00
 reverse-iteration| 03:03:40
 clang-atom-d525-fedora-rel   | 02:57:38
 sanitizer-x86_64-linux-gn| 02:39:40
 polly-arm-linux  | 02:30:21
 clang-aarch64-linux-build-cache  | 02:00:54
 clang-armv7-linux-build-cache| 01:50:26
 lld-sphinx-docs  | 01:48:29
 lldb-sphinx-docs | 01:45:43
 clang-sphinx-docs   

[PATCH] D65003: [clang-doc] Add index in each info html file

2019-08-05 Thread Diego Astiazarán via Phabricator via cfe-commits
DiegoAstiazaran abandoned this revision.
DiegoAstiazaran added a comment.

D65690  replaces this revision.


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

https://reviews.llvm.org/D65003



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


[PATCH] D65410: [PassManager] First Pass implementation at -O1 pass pipeline

2019-08-05 Thread Chandler Carruth via Phabricator via cfe-commits
chandlerc added a comment.

One high level point that is at least worth clarifying, and maybe others will 
want to suggest a different approach:

The overall approach here is to have as small of a difference between the O1 
 and O2 
 pipelines as possible.

An alternative approach that we could take would be to design a focused O1 
 pipeline without regard to how 
much it diverges from the O2  
pipeline.

Which approach is used somewhat depends on the goals. I feel like the goal here 
is to get as close to the level of optimization at O2 
 as possible without losing compile 
time or coherent backtraces for test / assertion failures. For that goal, the 
approach taken makes sense. But it seems important to clarify that goal as 
otherwise I think we'd want to go in very different directions.

In D65410#1613555 , @hfinkel wrote:

> Thanks for starting on this. Can you go ahead and replace the sroa calls with 
> mem2reg calls for `O1` and then see what that does to the performance? That 
> strikes me as a major change, but certainly one that potentially makes sense, 
> so I'd rather we go ahead and test it now before we make decisions about 
> other adjustments.


I really think we need mem2reg at least at -O1... In fact, I really think we 
need SROA at O1 . If it is actually 
a compile time problem, I'd like to fix that in SROA. I don't really expect it 
to be though.

> FWIW, I thought that we might run InstCombine less often (or maybe replace it 
> with InstSimplify, in some places). Did you try that?

I think the biggest thing to do would be to avoid repeated runs of instcombine 
over the same code. I suspect we want at least one run after inliner and inside 
the CGSCC walk for canonicalization. But it'd be great to limit it to exactly 
one or mybe one before and one after the loop pipeline.




Comment at: llvm/lib/Passes/PassBuilder.cpp:407-414
   }
 
   // Speculative execution if the target has divergent branches; otherwise nop.
-  FPM.addPass(SpeculativeExecutionPass());
+  if (Level > O1)
+FPM.addPass(SpeculativeExecutionPass());
 
   // Optimize based on known information about branches, and cleanup afterward.

I think you can merge all of these?



Comment at: llvm/lib/Transforms/IPO/PassManagerBuilder.cpp:362
 
+  // TODO: Investigate the cost/benefit of tail call elimination on debugging.
   MPM.add(createTailCallEliminationPass()); // Eliminate tail calls

hfinkel wrote:
> By definition, this loses information from the call stack, no?
Yeah, I'd have really expected this to be skipped.



Comment at: llvm/lib/Transforms/IPO/PassManagerBuilder.cpp:432
 
+  // TODO: Investigate if this is too expensive at O1.
   MPM.add(createAggressiveDCEPass()); // Delete dead instructions

hfinkel wrote:
> Yes, I'd fall back to using regular DCE.
+1


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65410



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


[PATCH] D65708: [NFC][DirectoryWatchedTests] Unlocking mutexes before signaling condition variable.

2019-08-05 Thread Jan Korous via Phabricator via cfe-commits
jkorous added a comment.

LGTM. Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65708



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


[PATCH] D65704: DirectoryWatcher::create: Adding better error handling.

2019-08-05 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi marked 3 inline comments as done.
plotfi added inline comments.



Comment at: clang/include/clang/DirectoryWatcher/DirectoryWatcher.h:102
 
   /// Returns nullptr if \param Path doesn't exist or isn't a directory.
   /// Returns nullptr if OS kernel API told us we can't start watching. In such

jkorous wrote:
> Could you please update the comments?
Ahh, Yes. 



Comment at: clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp:283
   /*waitForInitialSync=*/true);
+  if (!DW) return;
 

jkorous wrote:
> jkorous wrote:
> > IIUC this is silently dropping errors. We should print the error here.
> Ah, my bad - I just took a better look at `Expected<>` and you're right.
Nah, the way llvm::Expected works is that if the error isn't consumed then it 
will blow up in the destructor. So if it is an error, returning will cause the 
destructor to crash the program and print the error implicitly. Very nice error 
handling mechanism you ask me :-) 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65704



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


[PATCH] D65704: DirectoryWatcher::create: Adding better error handling.

2019-08-05 Thread Jan Korous via Phabricator via cfe-commits
jkorous added a comment.

Please just update the comment, otherwise LGTM.




Comment at: clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp:283
   /*waitForInitialSync=*/true);
+  if (!DW) return;
 

jkorous wrote:
> IIUC this is silently dropping errors. We should print the error here.
Ah, my bad - I just took a better look at `Expected<>` and you're right.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65704



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


[PATCH] D65622: [clang-doc] Update documentation

2019-08-05 Thread Julie Hockett via Phabricator via cfe-commits
juliehockett added a comment.

Sorry for the delayed review, but a few things I caught :)

Also, please make sure to update the the release notes/flag documentation for 
the patches you have in progress that add features or flags.




Comment at: clang-tools-extra/trunk/docs/ReleaseNotes.rst:55
 
-The improvements are...
+- :doc:`clang-doc ` now generates documentation in HTML format.
 

This should also include new flags and new features like template handling.



Comment at: clang-tools-extra/trunk/docs/clang-doc.rst:40
+
+  $ clang-doc /path/to/file.cpp -p /path/to/build
+

For this to work, you'd also need to pass the `--executor=standalone` flag.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D65622



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


[PATCH] D65704: DirectoryWatcher::create: Adding better error handling.

2019-08-05 Thread Jan Korous via Phabricator via cfe-commits
jkorous added a comment.

Thanks for the patch!




Comment at: clang/include/clang/DirectoryWatcher/DirectoryWatcher.h:102
 
   /// Returns nullptr if \param Path doesn't exist or isn't a directory.
   /// Returns nullptr if OS kernel API told us we can't start watching. In such

Could you please update the comments?



Comment at: clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp:283
   /*waitForInitialSync=*/true);
+  if (!DW) return;
 

IIUC this is silently dropping errors. We should print the error here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65704



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


[clang-tools-extra] r367958 - [clang-doc] Fix link generation

2019-08-05 Thread Diego Astiazaran via cfe-commits
Author: diegoastiazaran
Date: Mon Aug  5 17:11:34 2019
New Revision: 367958

URL: http://llvm.org/viewvc/llvm-project?rev=367958&view=rev
Log:
[clang-doc] Fix link generation

Before making a link to a reference it is required to check that the
reference has a path (eg. primitives won't have paths).
This was done by checking if the path was empty; that worked because
when generating paths the outdirectory was included, so if the path was
assigned it had that outdirectory at least.
The path generation was changed, it's now only the composite of the
namespaces without the outdirectory. So if the info is in the global
namespace the path would be empty and the old check wouldn't work as expected.
A new attribute has been added to the Reference struct that indicates if
the info's parent is the global namespace.
Paths generation now fails if the path is empty and if the info
is not in the global namespace.

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

Modified:
clang-tools-extra/trunk/clang-doc/BitcodeReader.cpp
clang-tools-extra/trunk/clang-doc/BitcodeWriter.cpp
clang-tools-extra/trunk/clang-doc/BitcodeWriter.h
clang-tools-extra/trunk/clang-doc/HTMLGenerator.cpp
clang-tools-extra/trunk/clang-doc/Representation.h
clang-tools-extra/trunk/clang-doc/YAMLGenerator.cpp
clang-tools-extra/trunk/unittests/clang-doc/YAMLGeneratorTest.cpp

Modified: clang-tools-extra/trunk/clang-doc/BitcodeReader.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-doc/BitcodeReader.cpp?rev=367958&r1=367957&r2=367958&view=diff
==
--- clang-tools-extra/trunk/clang-doc/BitcodeReader.cpp (original)
+++ clang-tools-extra/trunk/clang-doc/BitcodeReader.cpp Mon Aug  5 17:11:34 2019
@@ -292,6 +292,8 @@ llvm::Error parseRecord(Record R, unsign
 return decodeRecord(R, I->RefType, Blob);
   case REFERENCE_PATH:
 return decodeRecord(R, I->Path, Blob);
+  case REFERENCE_IS_IN_GLOBAL_NAMESPACE:
+return decodeRecord(R, I->IsInGlobalNamespace, Blob);
   case REFERENCE_FIELD:
 return decodeRecord(R, F, Blob);
   default:

Modified: clang-tools-extra/trunk/clang-doc/BitcodeWriter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-doc/BitcodeWriter.cpp?rev=367958&r1=367957&r2=367958&view=diff
==
--- clang-tools-extra/trunk/clang-doc/BitcodeWriter.cpp (original)
+++ clang-tools-extra/trunk/clang-doc/BitcodeWriter.cpp Mon Aug  5 17:11:34 2019
@@ -172,6 +172,8 @@ static const llvm::IndexedMaphttp://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-doc/BitcodeWriter.h?rev=367958&r1=367957&r2=367958&view=diff
==
--- clang-tools-extra/trunk/clang-doc/BitcodeWriter.h (original)
+++ clang-tools-extra/trunk/clang-doc/BitcodeWriter.h Mon Aug  5 17:11:34 2019
@@ -109,6 +109,7 @@ enum RecordId {
   REFERENCE_NAME,
   REFERENCE_TYPE,
   REFERENCE_PATH,
+  REFERENCE_IS_IN_GLOBAL_NAMESPACE,
   REFERENCE_FIELD,
   RI_LAST,
   RI_FIRST = VERSION

Modified: clang-tools-extra/trunk/clang-doc/HTMLGenerator.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-doc/HTMLGenerator.cpp?rev=367958&r1=367957&r2=367958&view=diff
==
--- clang-tools-extra/trunk/clang-doc/HTMLGenerator.cpp (original)
+++ clang-tools-extra/trunk/clang-doc/HTMLGenerator.cpp Mon Aug  5 17:11:34 2019
@@ -247,7 +247,7 @@ static std::unique_ptr genLink(
 
 static std::unique_ptr genTypeReference(const Reference &Type,
   StringRef CurrentDirectory) {
-  if (Type.Path.empty())
+  if (Type.Path.empty() && !Type.IsInGlobalNamespace)
 return llvm::make_unique(Type.Name);
   llvm::SmallString<128> Path =
   computeRelativePath(Type.Path, CurrentDirectory);

Modified: clang-tools-extra/trunk/clang-doc/Representation.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-doc/Representation.h?rev=367958&r1=367957&r2=367958&view=diff
==
--- clang-tools-extra/trunk/clang-doc/Representation.h (original)
+++ clang-tools-extra/trunk/clang-doc/Representation.h Mon Aug  5 17:11:34 2019
@@ -114,11 +114,17 @@ struct CommentInfo {
 struct Reference {
   Reference() = default;
   Reference(llvm::StringRef Name) : Name(Name) {}
-  Reference(llvm::StringRef Name, StringRef Path) : Name(Name), Path(Path) {}
+  // An empty path means the info is in the global namespace because the path 
is
+  // a composite of the parent namespaces.
+  Reference(llvm::StringRef Name, StringRef Path)
+  : Name(Name), Path(Path), IsInGlobalNamespace(Path.empty()) {}
   Reference(SymbolID USR, StringRef Name, InfoType IT)
   : USR(USR), Name(Name), RefType(IT) {}
+  

[PATCH] D64958: [clang-doc] Fix link generation

2019-08-05 Thread Diego Astiazarán via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL367958: [clang-doc] Fix link generation (authored by 
DiegoAstiazaran, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D64958?vs=213498&id=213499#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D64958

Files:
  clang-tools-extra/trunk/clang-doc/BitcodeReader.cpp
  clang-tools-extra/trunk/clang-doc/BitcodeWriter.cpp
  clang-tools-extra/trunk/clang-doc/BitcodeWriter.h
  clang-tools-extra/trunk/clang-doc/HTMLGenerator.cpp
  clang-tools-extra/trunk/clang-doc/Representation.h
  clang-tools-extra/trunk/clang-doc/YAMLGenerator.cpp
  clang-tools-extra/trunk/unittests/clang-doc/YAMLGeneratorTest.cpp

Index: clang-tools-extra/trunk/clang-doc/BitcodeWriter.cpp
===
--- clang-tools-extra/trunk/clang-doc/BitcodeWriter.cpp
+++ clang-tools-extra/trunk/clang-doc/BitcodeWriter.cpp
@@ -172,6 +172,8 @@
   {REFERENCE_NAME, {"Name", &StringAbbrev}},
   {REFERENCE_TYPE, {"RefType", &IntAbbrev}},
   {REFERENCE_PATH, {"Path", &StringAbbrev}},
+  {REFERENCE_IS_IN_GLOBAL_NAMESPACE,
+   {"IsInGlobalNamespace", &BoolAbbrev}},
   {REFERENCE_FIELD, {"Field", &IntAbbrev}}};
   assert(Inits.size() == RecordIdCount);
   for (const auto &Init : Inits) {
@@ -215,7 +217,7 @@
 // Reference Block
 {BI_REFERENCE_BLOCK_ID,
  {REFERENCE_USR, REFERENCE_NAME, REFERENCE_TYPE, REFERENCE_PATH,
-  REFERENCE_FIELD}}};
+  REFERENCE_IS_IN_GLOBAL_NAMESPACE, REFERENCE_FIELD}}};
 
 // AbbreviationMap
 
@@ -387,6 +389,7 @@
   emitRecord(R.Name, REFERENCE_NAME);
   emitRecord((unsigned)R.RefType, REFERENCE_TYPE);
   emitRecord(R.Path, REFERENCE_PATH);
+  emitRecord(R.IsInGlobalNamespace, REFERENCE_IS_IN_GLOBAL_NAMESPACE);
   emitRecord((unsigned)Field, REFERENCE_FIELD);
 }
 
Index: clang-tools-extra/trunk/clang-doc/BitcodeReader.cpp
===
--- clang-tools-extra/trunk/clang-doc/BitcodeReader.cpp
+++ clang-tools-extra/trunk/clang-doc/BitcodeReader.cpp
@@ -292,6 +292,8 @@
 return decodeRecord(R, I->RefType, Blob);
   case REFERENCE_PATH:
 return decodeRecord(R, I->Path, Blob);
+  case REFERENCE_IS_IN_GLOBAL_NAMESPACE:
+return decodeRecord(R, I->IsInGlobalNamespace, Blob);
   case REFERENCE_FIELD:
 return decodeRecord(R, F, Blob);
   default:
Index: clang-tools-extra/trunk/clang-doc/BitcodeWriter.h
===
--- clang-tools-extra/trunk/clang-doc/BitcodeWriter.h
+++ clang-tools-extra/trunk/clang-doc/BitcodeWriter.h
@@ -109,6 +109,7 @@
   REFERENCE_NAME,
   REFERENCE_TYPE,
   REFERENCE_PATH,
+  REFERENCE_IS_IN_GLOBAL_NAMESPACE,
   REFERENCE_FIELD,
   RI_LAST,
   RI_FIRST = VERSION
Index: clang-tools-extra/trunk/clang-doc/HTMLGenerator.cpp
===
--- clang-tools-extra/trunk/clang-doc/HTMLGenerator.cpp
+++ clang-tools-extra/trunk/clang-doc/HTMLGenerator.cpp
@@ -247,7 +247,7 @@
 
 static std::unique_ptr genTypeReference(const Reference &Type,
   StringRef CurrentDirectory) {
-  if (Type.Path.empty())
+  if (Type.Path.empty() && !Type.IsInGlobalNamespace)
 return llvm::make_unique(Type.Name);
   llvm::SmallString<128> Path =
   computeRelativePath(Type.Path, CurrentDirectory);
Index: clang-tools-extra/trunk/clang-doc/YAMLGenerator.cpp
===
--- clang-tools-extra/trunk/clang-doc/YAMLGenerator.cpp
+++ clang-tools-extra/trunk/clang-doc/YAMLGenerator.cpp
@@ -156,6 +156,7 @@
 IO.mapOptional("Name", Ref.Name, SmallString<16>());
 IO.mapOptional("USR", Ref.USR, SymbolID());
 IO.mapOptional("Path", Ref.Path, SmallString<128>());
+IO.mapOptional("IsInGlobalNamespace", Ref.IsInGlobalNamespace, false);
   }
 };
 
Index: clang-tools-extra/trunk/clang-doc/Representation.h
===
--- clang-tools-extra/trunk/clang-doc/Representation.h
+++ clang-tools-extra/trunk/clang-doc/Representation.h
@@ -114,11 +114,17 @@
 struct Reference {
   Reference() = default;
   Reference(llvm::StringRef Name) : Name(Name) {}
-  Reference(llvm::StringRef Name, StringRef Path) : Name(Name), Path(Path) {}
+  // An empty path means the info is in the global namespace because the path is
+  // a composite of the parent namespaces.
+  Reference(llvm::StringRef Name, StringRef Path)
+  : Name(Name), Path(Path), IsInGlobalNamespace(Path.empty()) {}
   Reference(SymbolID USR, StringRef Name, InfoType IT)
   : USR(USR), Name(Name), RefType(IT) {}
+  // An empty path means the info is in the global namespace because 

[PATCH] D65690: [clang-doc] Add index in each info html file

2019-08-05 Thread Julie Hockett via Phabricator via cfe-commits
juliehockett added inline comments.



Comment at: clang-tools-extra/clang-doc/Generators.cpp:79
+
+bool Generator::createResources(ClangDocContext &CDCtx) {
+  std::error_code OK;

Why is this implementation in the generic Generator? It's fairly HTML-specific 
-- neither of the other generators are able to parse and include Javascript 
(since this does include the `var JsonIndex` bit).



Comment at: clang-tools-extra/clang-doc/HTMLGenerator.cpp:665
+return false;
+  llvm::outs() << "Generating assets for docs...\n";
+  for (const auto &FilePath : CDCtx.UserStylesheets)

Can we move this to `ClangDocMain.cpp` right above where the function is 
called? That's where most of these types of status updates are.


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

https://reviews.llvm.org/D65690



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


[PATCH] D64958: [clang-doc] Fix link generation

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

Fix comments.


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

https://reviews.llvm.org/D64958

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/HTMLGenerator.cpp
  clang-tools-extra/clang-doc/Representation.h
  clang-tools-extra/clang-doc/YAMLGenerator.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
@@ -80,7 +80,8 @@
   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, "path/to/F");
+  // F is in the global namespace
+  I.Parents.emplace_back(EmptySID, "F", InfoType::IT_record, "");
   I.VirtualParents.emplace_back(EmptySID, "G", InfoType::IT_record,
 "path/to/G");
 
@@ -120,7 +121,7 @@
 Parents:
   - Type:Record
 Name:'F'
-Path:'path/to/F'
+IsInGlobalNamespace: true
 VirtualParents:
   - Type:Record
 Name:'G'
Index: clang-tools-extra/clang-doc/YAMLGenerator.cpp
===
--- clang-tools-extra/clang-doc/YAMLGenerator.cpp
+++ clang-tools-extra/clang-doc/YAMLGenerator.cpp
@@ -156,6 +156,7 @@
 IO.mapOptional("Name", Ref.Name, SmallString<16>());
 IO.mapOptional("USR", Ref.USR, SymbolID());
 IO.mapOptional("Path", Ref.Path, SmallString<128>());
+IO.mapOptional("IsInGlobalNamespace", Ref.IsInGlobalNamespace, false);
   }
 };
 
Index: clang-tools-extra/clang-doc/Representation.h
===
--- clang-tools-extra/clang-doc/Representation.h
+++ clang-tools-extra/clang-doc/Representation.h
@@ -114,11 +114,17 @@
 struct Reference {
   Reference() = default;
   Reference(llvm::StringRef Name) : Name(Name) {}
-  Reference(llvm::StringRef Name, StringRef Path) : Name(Name), Path(Path) {}
+  // An empty path means the info is in the global namespace because the path is
+  // a composite of the parent namespaces.
+  Reference(llvm::StringRef Name, StringRef Path)
+  : Name(Name), Path(Path), IsInGlobalNamespace(Path.empty()) {}
   Reference(SymbolID USR, StringRef Name, InfoType IT)
   : USR(USR), Name(Name), RefType(IT) {}
+  // An empty path means the info is in the global namespace because the path is
+  // a composite of the parent namespaces.
   Reference(SymbolID USR, StringRef Name, InfoType IT, StringRef Path)
-  : USR(USR), Name(Name), RefType(IT), Path(Path) {}
+  : USR(USR), Name(Name), RefType(IT), Path(Path),
+IsInGlobalNamespace(Path.empty()) {}
 
   bool operator==(const Reference &Other) const {
 return std::tie(USR, Name, RefType) ==
@@ -130,8 +136,12 @@
   InfoType RefType = InfoType::IT_default; // Indicates the type of this
// Reference (namespace, record,
// function, enum, default).
-  llvm::SmallString<128> Path; // Path of directory where the clang-doc
-   // generated file will be saved
+  // Path of directory where the clang-doc generated file will be saved
+  // (possibly unresolved)
+  llvm::SmallString<128> Path;
+  // Indicates if the info's parent is the global namespace, or if the info is
+  // the global namespace
+  bool IsInGlobalNamespace = false;
 };
 
 // A base struct for TypeInfos
Index: clang-tools-extra/clang-doc/HTMLGenerator.cpp
===
--- clang-tools-extra/clang-doc/HTMLGenerator.cpp
+++ clang-tools-extra/clang-doc/HTMLGenerator.cpp
@@ -245,7 +245,7 @@
 
 static std::unique_ptr genTypeReference(const Reference &Type,
   StringRef CurrentDirectory) {
-  if (Type.Path.empty())
+  if (Type.Path.empty() && !Type.IsInGlobalNamespace)
 return llvm::make_unique(Type.Name);
   llvm::SmallString<128> Path =
   computeRelativePath(Type.Path, CurrentDirectory);
Index: clang-tools-extra/clang-doc/BitcodeWriter.h
===
--- clang-tools-extra/clang-doc/BitcodeWriter.h
+++ clang-tools-extra/clang-doc/BitcodeWriter.h
@@ -109,6 +109,7 @@
   REFERENCE_NAME,
   REFERENCE_TYPE,
   REFERENCE_PATH,
+  REFERENCE_IS_IN_GLOBAL_NAMESPACE,
   REFERENCE_FIELD,
   RI_LAST,
   RI_FIRST = VERSION
Index: clang-tools-extra/clang-doc/BitcodeWriter.

[PATCH] D65545: Handle some fs::remove failures

2019-08-05 Thread JF Bastien via Phabricator via cfe-commits
jfb updated this revision to Diff 213497.
jfb marked 8 inline comments as done.
jfb added a comment.

- Return llvm::Error from ASTUnit::Save
- Update per comments.
- Address Volodymyr's comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65545

Files:
  clang/include/clang/Basic/DiagnosticFrontendKinds.td
  clang/include/clang/Frontend/ASTUnit.h
  clang/include/clang/Frontend/PrecompiledPreamble.h
  clang/lib/Frontend/ASTUnit.cpp
  clang/lib/Frontend/CompilerInstance.cpp
  clang/lib/Frontend/DependencyFile.cpp
  clang/lib/Frontend/PrecompiledPreamble.cpp
  clang/lib/Rewrite/Rewriter.cpp
  clang/lib/Serialization/GlobalModuleIndex.cpp
  clang/tools/driver/cc1gen_reproducer_main.cpp
  clang/tools/libclang/CIndex.cpp
  clang/unittests/CrossTU/CrossTranslationUnitTest.cpp
  clang/unittests/Frontend/ASTUnitTest.cpp
  llvm/include/llvm/Support/FileUtilities.h
  llvm/lib/Support/GraphWriter.cpp
  llvm/lib/Support/LockFileManager.cpp
  llvm/lib/Support/Path.cpp
  llvm/lib/Support/ToolOutputFile.cpp

Index: llvm/lib/Support/ToolOutputFile.cpp
===
--- llvm/lib/Support/ToolOutputFile.cpp
+++ llvm/lib/Support/ToolOutputFile.cpp
@@ -25,7 +25,9 @@
 ToolOutputFile::CleanupInstaller::~CleanupInstaller() {
   // Delete the file if the client hasn't told us not to.
   if (!Keep && Filename != "-")
-sys::fs::remove(Filename);
+if (std::error_code EC = sys::fs::remove(Filename))
+  report_fatal_error("Failed removing file \"" + Filename +
+ "\": " + EC.message());
 
   // Ok, the file is successfully written and closed, or deleted. There's no
   // further need to clean it up on signals.
Index: llvm/lib/Support/Path.cpp
===
--- llvm/lib/Support/Path.cpp
+++ llvm/lib/Support/Path.cpp
@@ -1182,9 +1182,10 @@
   if (RenameEC) {
 // If we can't rename, try to copy to work around cross-device link issues.
 RenameEC = sys::fs::copy_file(TmpName, Name);
-// If we can't rename or copy, discard the temporary file.
+// If we can't rename or copy, discard the temporary file, ignoring any
+// further failure.
 if (RenameEC)
-  remove(TmpName);
+  (void)remove(TmpName);
   }
   sys::DontRemoveFileOnSignal(TmpName);
 #endif
Index: llvm/lib/Support/LockFileManager.cpp
===
--- llvm/lib/Support/LockFileManager.cpp
+++ llvm/lib/Support/LockFileManager.cpp
@@ -47,14 +47,16 @@
 /// \param LockFileName The name of the lock file to read.
 ///
 /// \returns The process ID of the process that owns this lock file
-Optional >
+Optional>
 LockFileManager::readLockFile(StringRef LockFileName) {
   // Read the owning host and PID out of the lock file. If it appears that the
   // owning process is dead, the lock file is invalid.
   ErrorOr> MBOrErr =
   MemoryBuffer::getFile(LockFileName);
   if (!MBOrErr) {
-sys::fs::remove(LockFileName);
+if (std::error_code EC = sys::fs::remove(LockFileName))
+  report_fatal_error("Unable to remove invalid lock file \"" +
+ LockFileName + "\": " + EC.message());
 return None;
   }
   MemoryBuffer &MB = *MBOrErr.get();
@@ -71,7 +73,9 @@
   }
 
   // Delete the lock file. It's invalid anyway.
-  sys::fs::remove(LockFileName);
+  if (std::error_code EC = sys::fs::remove(LockFileName))
+report_fatal_error("Unable to remove invalid lock file \"" + LockFileName +
+   "\": " + EC.message());
   return None;
 }
 
@@ -144,7 +148,9 @@
   // released.
   return;
 }
-sys::fs::remove(Filename);
+if (std::error_code EC = sys::fs::remove(Filename))
+  report_fatal_error("Unable to remove unique lock file on signal \"" +
+ Filename + "\": " + EC.message());
 sys::DontRemoveFileOnSignal(Filename);
   }
 
@@ -204,8 +210,9 @@
   // unique lock file, and fail.
   std::string S("failed to write to ");
   S.append(UniqueLockFileName.str());
+  if (std::error_code EC = sys::fs::remove(UniqueLockFileName))
+S.append(", also failed to remove the lockfile");
   setError(Out.error(), S);
-  sys::fs::remove(UniqueLockFileName);
   return;
 }
   }
@@ -234,8 +241,12 @@
 // Someone else managed to create the lock file first. Read the process ID
 // from the lock file.
 if ((Owner = readLockFile(LockFileName))) {
-  // Wipe out our unique lock file (it's useless now)
-  sys::fs::remove(UniqueLockFileName);
+  // Wipe out our unique lock file (it's useless now).
+  if ((EC = sys::fs::remove(UniqueLockFileName))) {
+std::string S("failed to remove useless lockfile ");
+S.append(UniqueLockFileName.str());
+setError(EC, S);
+  }
   return;
 }
 
@@ -283,8 +294,12 @@
 return;
 
   // Sin

[PATCH] D65545: Handle some fs::remove failures

2019-08-05 Thread JF Bastien via Phabricator via cfe-commits
jfb added inline comments.



Comment at: clang/lib/Frontend/CompilerInstance.cpp:1444-1445
   // Remove the file.
-  llvm::sys::fs::remove(File->path());
+  if ((EC = llvm::sys::fs::remove(File->path(
+break;
 

vsapsai wrote:
> jfb wrote:
> > vsapsai wrote:
> > > Why are you interrupting the loop when cannot remove a file? Don't know 
> > > which option is the right one, just want to know your reasons.
> > The loops already bail when `EC` is set, and here I figure if we can't 
> > remove the base file we shouldn't try to remove its corresponding timestamp.
> I was thinking about using `continue` instead of `break`. After some thinking 
> I believe `continue` is better because this way we'll try to remove all stale 
> module files that we can. Otherwise one bad file can prevent the module cache 
> pruning from working.
> 
> And I agree with your logic about not removing the timestamp when cannot 
> remove the base file.
`continue` will hit `File != FileEnd && !EC`, so it's equivalent to `break`. 
Your thinking makes sense, but I think we'd want to do it in a separate patch.



Comment at: clang/lib/Frontend/PrecompiledPreamble.cpp:107-111
 TemporaryFiles::~TemporaryFiles() {
   llvm::MutexGuard Guard(Mutex);
   for (const auto &File : Files)
-llvm::sys::fs::remove(File.getKey());
+if (std::error_code EC = llvm::sys::fs::remove(File.getKey()))
+  llvm::report_fatal_error("failed removing file \"" + File.getKey() + 
"\": " + EC.message());

jkorous wrote:
> vsapsai wrote:
> > Clangd uses `PrecompiledPreamble` but not `TemporaryFiles` as far as I can 
> > tell. `report_fatal_error` can be really disruptive for clangd, so it would 
> > be good to get an opinion from somebody working on it if this change would 
> > impact them.
> Since client code in general might have different error handling/reporting 
> strategy and can't do much about failure in destructor here, I'd consider 
> just some kind of logging or assert here. 
> 
I changed it to `dbgs()`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65545



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


[PATCH] D65030: [clang-doc] Add second index for sections within info's content

2019-08-05 Thread Julie Hockett via Phabricator via cfe-commits
juliehockett added inline comments.



Comment at: clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp:47-52
+
+  Namespaces
+  Records
+  Functions
+  OneFunction
+

DiegoAstiazaran wrote:
> juliehockett wrote:
> > Formatting is a bit weird for sublists
> Fixed by D65005. It will be properly formatted after rebasing.
This formatting is still a bit weird :( The inner `ul` didn't get its own 
newline, so it's hard to tell which list each item is part of. Not a huge 
problem, but if it's a reasonably small fix I'd love to see it cleaned up.


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

https://reviews.llvm.org/D65030



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


[PATCH] D64958: [clang-doc] Fix link generation

2019-08-05 Thread Julie Hockett via Phabricator via cfe-commits
juliehockett accepted this revision.
juliehockett added a comment.

LGTM with a comment correction




Comment at: clang-tools-extra/clang-doc/Representation.h:117
   Reference(llvm::StringRef Name) : Name(Name) {}
-  Reference(llvm::StringRef Name, StringRef Path) : Name(Name), Path(Path) {}
+  // An empty path means the info is in the globalnamespace because the path is
+  // a composite of the parent namespaces.

s/globalnamespace/global namespace



Comment at: clang-tools-extra/clang-doc/Representation.h:123
   : USR(USR), Name(Name), RefType(IT) {}
+  // An empty path means the info is in the globalnamespace because the path is
+  // a composite of the parent namespaces.

s/globalnamespace/global namespace


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

https://reviews.llvm.org/D64958



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


[PATCH] D65483: [clang-doc] Add link to source code in file definitions

2019-08-05 Thread Julie Hockett via Phabricator via cfe-commits
juliehockett added inline comments.



Comment at: clang-tools-extra/clang-doc/HTMLGenerator.cpp:377-378
+  "href", (FileURL + "#" + std::to_string(L.LineNumber)).str());
+  Node->Children.emplace_back(std::move(LocNumberNode));
+  Node->Children.emplace_back(llvm::make_unique(" of file "));
+  auto LocFileNode = llvm::make_unique(

DiegoAstiazaran wrote:
> jakehehrlich wrote:
> > Can you put these in the link so that the link is larger than a single 
> > number? e.g. "303 of file foo.c" should be linkified rather than just "303" 
> > which is how I read the code now.
> "303" is linkified to the specific line in the source code but also "foo.c" 
> is linkified to the top of the source code page.
> This is how it is done in Doxygen documentation.
> I think it would look weird to have " of file " linkified. But talking to 
> @phosek, we agreed that it would be better to remove the whole "Defined at 
> ..." and make the info name linkified to the definition, with a tooltip that 
> shows "foo.c:303".
> So I think we could leave it like this for now and later, in another patch 
> (this will require some CSS), do what I just mentioned. What do you think?
While the tooltip idea seems interesting, I'm inclined to keep the "Defined at" 
portion and an actual link with the text for now. I'd want to see an example of 
what the tooltip option would look like before going with it. 

For now, the separate line number and file linkification SGTM.



Comment at: clang-tools-extra/clang-doc/Mapper.cpp:103-104
+  llvm::SmallString<128> Prefix(RootDir);
+  if (!llvm::sys::path::is_separator(Prefix.back()))
+Prefix += llvm::sys::path::get_separator();
+  llvm::sys::path::replace_path_prefix(File, Prefix, "");

DiegoAstiazaran wrote:
> jakehehrlich wrote:
> > Do you actually need to do this? Feels like a bug in replace_path_prefix 
> > per its own documentation if you do.
> `replace_path_prefix` simply calls substr() on the path so if the prefix does 
> not include the separator at the end, the resulting path will have it at the 
> beginning.
Leave a comment to that effect, then.



Comment at: clang-tools-extra/clang-doc/Mapper.cpp:40
+  bool IsFileInRootDir;
+  auto File = getFile(D, D->getASTContext(), CDCtx.RootDir, IsFileInRootDir);
+  auto I = serialize::emitInfo(D, getComment(D, D->getASTContext()),

Don't use auto here, since it's not immediately obvious what the type is.



Comment at: clang-tools-extra/clang-doc/tool/ClangDocMain.cpp:228
+  RepositoryUrl.find("https://";) != 0)
+RepositoryUrl.insert(0, "http://";);
+

DiegoAstiazaran wrote:
> jakehehrlich wrote:
> > 1) Do we need to add this for the user?
> > 2) Can we use https by default if we need this?
> Not required but I consider it'd be nice to have it.
> You're right, https should be the default.
This is fine, but please add a test case for the when the user omits the prefix.



Comment at: clang-tools-extra/clang-doc/tool/ClangDocMain.cpp:76
+static llvm::cl::opt
+RootDirectory("root-directory", llvm::cl::desc(R"(
+Directory where processed files are stored.

Can we call this `--source-root`?



Comment at: clang-tools-extra/docs/clang-doc.rst:93
+--public- Document only public declarations.
+--repository=   -
+  URL of repository that hosts code.

Formatting here is a bit weird


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

https://reviews.llvm.org/D65483



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


[PATCH] D65628: [clang-doc] Parallelize reducing phase

2019-08-05 Thread Julie Hockett via Phabricator via cfe-commits
juliehockett added inline comments.



Comment at: clang-tools-extra/clang-doc/tool/ClangDocMain.cpp:72
 
+static llvm::cl::opt ThreadCount(
+"thread-count",

Can we use the pre-existing concurrency flag instead 
(https://github.com/llvm/llvm-project/blob/91e5cdfc93729c61c757db4efd4a82670ac7f929/clang/lib/Tooling/AllTUsExecution.cpp#L150)?
 It seems counterintuitive to have to set two different concurrency flags for 
one tool.

You'll have to put up a separate patch to expose that flag in the AllTUs 
header, so that you can access it (see rL344335, as an example). 


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

https://reviews.llvm.org/D65628



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


[PATCH] D63889: Check possible warnings on global initializers for reachability

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



Comment at: clang/lib/Sema/SemaDeclCXX.cpp:352
   SetParamDefaultArgument(Param, DefaultArg, EqualLoc);
+  CurContext->removeDecl(Param);
+  CurContext = Cur;

rsmith wrote:
> We may need to delay the diagnostics here until the default argument is 
> *used*: if a default argument references a template instantiation, the 
> instantiation is not performed until that point, which may mean that our 
> semantic checking can't complete correctly until use.
Currently this patch really only works with globals. There are many places 
where the following check is made instead of calling `ParseInitializer`. These 
should probably be rewritten into a single function and do something similar 
with pushing/popping declarations. Not sure if that change should be made in 
this patch or not.

```
if (getLangOpts().CPlusPlus11 && Tok.is(tok::l_brace)) {
Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
DefArgResult = ParseBraceInitializer();
  } else
DefArgResult = ParseAssignmentExpression();
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63889



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


[PATCH] D65770: hwasan: Instrument globals.

2019-08-05 Thread Peter Collingbourne via Phabricator via cfe-commits
pcc added a comment.

The AOSP side of this is 
https://android-review.googlesource.com/c/platform/bionic/+/1096613


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65770



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


[PATCH] D64943: [Clang][OpenMP offload] Eliminate use of OpenMP linker script

2019-08-05 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: clang/include/clang/Driver/Action.h:74
 OffloadUnbundlingJobClass,
+OffloadWrapperJobClass,
 

Do we really need this new kind of job here, can we use bundler instead?



Comment at: clang/lib/CodeGen/CGOpenMPRuntime.cpp:9748
+  // If we have offloading in the current module, we need to emit the entries.
   createOffloadEntriesAndInfoMetadata();
 }

Do not emit it for the devices and simd only mode. Also, would be good to 
assert if no devices triples were specified.



Comment at: clang/lib/CodeGen/CGOpenMPRuntime.h:1470
+  /// was emitted in the current module.
+  virtual void emitOffloadTables();
 

Ithink, you can drop `virtual` here and remove overridden version from the 
CGOpenMPRuntimeSimd. Instead, just check for OpenMP simd mode in the original 
function and just early exit in this case.


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

https://reviews.llvm.org/D64943



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


r367947 - [Sema] attempt to appease buildbots after r367940

2019-08-05 Thread George Burgess IV via cfe-commits
Author: gbiv
Date: Mon Aug  5 16:19:15 2019
New Revision: 367947

URL: http://llvm.org/viewvc/llvm-project?rev=367947&view=rev
Log:
[Sema] attempt to appease buildbots after r367940

A buildbot got angry about this new test, with error messages like:

warn-nullchar-nullptr.c Line 16: use of undeclared identifier 'u'

It looks like this `u'c'` syntax was introduced in C11; I'm guessing
some bots may default to something before that. Let's see if explicitly
specifying the standard version makes it happy...

Modified:
cfe/trunk/test/Sema/warn-nullchar-nullptr.c

Modified: cfe/trunk/test/Sema/warn-nullchar-nullptr.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-nullchar-nullptr.c?rev=367947&r1=367946&r2=367947&view=diff
==
--- cfe/trunk/test/Sema/warn-nullchar-nullptr.c (original)
+++ cfe/trunk/test/Sema/warn-nullchar-nullptr.c Mon Aug  5 16:19:15 2019
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -Wall %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wall %s -std=c11
 
 int test1(int *a) {
   return a == '\0'; // expected-warning {{comparing a pointer to a null 
character constant; did you mean to compare to (void *)0?}}


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


[PATCH] D65130: [clang][OpenMP] Add clang-offload-wrapper tool

2019-08-05 Thread Sergey Dmitriev via Phabricator via cfe-commits
sdmitriev updated this revision to Diff 213481.
sdmitriev added a comment.

Rebase.


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

https://reviews.llvm.org/D65130

Files:
  clang/test/Driver/clang-offload-wrapper.ll
  clang/tools/CMakeLists.txt
  clang/tools/clang-offload-wrapper/CMakeLists.txt
  clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp

Index: clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp
===
--- /dev/null
+++ clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp
@@ -0,0 +1,290 @@
+//===-- clang-offload-wrapper/ClangOffloadWrapper.cpp ---*- 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
+//
+//===--===//
+///
+/// \file
+/// Implememtation of the offload wrapper tool. It takes offload target binaries
+/// as input and creates wrapper bitcode from them which registers given
+/// binaries in offload runtime.
+///
+//===--===//
+
+#include "clang/Basic/Version.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/Triple.h"
+#include "llvm/Bitcode/BitcodeWriter.h"
+#include "llvm/IR/Constants.h"
+#include "llvm/IR/GlobalVariable.h"
+#include "llvm/IR/IRBuilder.h"
+#include "llvm/IR/LLVMContext.h"
+#include "llvm/IR/Module.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/ErrorOr.h"
+#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/Signals.h"
+#include "llvm/Support/raw_ostream.h"
+#include "llvm/Transforms/Utils/ModuleUtils.h"
+#include 
+#include 
+#include 
+
+using namespace llvm;
+
+static cl::opt Help("h", cl::desc("Alias for -help"), cl::Hidden);
+
+// Mark all our options with this category, everything else (except for -version
+// and -help) will be hidden.
+static cl::OptionCategory
+ClangOffloadWrapperCategory("clang-offload-wrapper options");
+
+static cl::opt Output("o", cl::Required,
+   cl::desc("Output filename"),
+   cl::value_desc("filename"),
+   cl::cat(ClangOffloadWrapperCategory));
+
+static cl::list Inputs(cl::Positional, cl::OneOrMore,
+cl::desc(""),
+cl::cat(ClangOffloadWrapperCategory));
+
+static cl::opt Target("target", cl::Required,
+   cl::desc("Target triple"),
+   cl::value_desc("triple"),
+   cl::cat(ClangOffloadWrapperCategory));
+
+namespace {
+
+class BinaryWrapper {
+  LLVMContext C;
+  Module M;
+
+  StructType *EntryTy = nullptr;
+  StructType *ImageTy = nullptr;
+  StructType *DescTy = nullptr;
+
+  using MemoryBuffersVector = SmallVectorImpl>;
+
+private:
+  IntegerType *getSizeTTy() {
+auto PtrSize = M.getDataLayout().getPointerTypeSize(Type::getInt8PtrTy(C));
+return PtrSize == 8 ? Type::getInt64Ty(C) : Type::getInt32Ty(C);
+  }
+
+  // struct __tgt_offload_entry {
+  //   void *addr;
+  //   char *name;
+  //   size_t size;
+  //   int32_t flags;
+  //   int32_t reserved;
+  // };
+  StructType *getEntryTy() {
+if (!EntryTy)
+  EntryTy = StructType::create("__tgt_offload_entry", Type::getInt8PtrTy(C),
+   Type::getInt8PtrTy(C), getSizeTTy(),
+   Type::getInt32Ty(C), Type::getInt32Ty(C));
+return EntryTy;
+  }
+
+  PointerType *getEntryPtrTy() { return PointerType::getUnqual(getEntryTy()); }
+
+  // struct __tgt_device_image {
+  //   void *ImageStart;
+  //   void *ImageEnd;
+  //   __tgt_offload_entry *EntriesBegin;
+  //   __tgt_offload_entry *EntriesEnd;
+  // };
+  StructType *getDeviceImageTy() {
+if (!ImageTy)
+  ImageTy = StructType::create("__tgt_device_image", Type::getInt8PtrTy(C),
+   Type::getInt8PtrTy(C), getEntryPtrTy(),
+   getEntryPtrTy());
+return ImageTy;
+  }
+
+  PointerType *getDeviceImagePtrTy() {
+return PointerType::getUnqual(getDeviceImageTy());
+  }
+
+  // struct __tgt_bin_desc {
+  //   int32_t NumDeviceImages;
+  //   __tgt_device_image *DeviceImages;
+  //   __tgt_offload_entry *HostEntriesBegin;
+  //   __tgt_offload_entry *HostEntriesEnd;
+  // };
+  StructType *getBinDescTy() {
+if (!DescTy)
+  DescTy = StructType::create("__tgt_bin_desc", Type::getInt32Ty(C),
+  getDeviceImagePtrTy(), getEntryPtrTy(),
+  getEntryPtrTy());
+return DescTy;
+  }
+
+  PointerType *getBinDescPtrTy() {
+return PointerType::getUnqual(getBinDescTy());
+  }
+
+  Glob

[PATCH] D65300: [clang] [CodeGen] clang-misexpect prototype for compiler warnings

2019-08-05 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added a comment.

In D65300#1608147 , @lebedev.ri wrote:

> Thank you for working on this!
>
> I'm guessing this doesn't have a `-Werror=` mode?
>
> I still believe this should output a remark.
>  It will still be visible in the compiler console output,
>  but won't get buried there but will actually be recorded in the remarks file.


“Clang supports -R flags for enabling remarks. These are diagnostic messages 
that provide information about the compilation process, but don’t suggest that 
a problem has been detected.”

I think this patch is okay.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65300



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


[PATCH] D65770: hwasan: Instrument globals.

2019-08-05 Thread Peter Collingbourne via Phabricator via cfe-commits
pcc updated this revision to Diff 213477.
pcc added a comment.

- Increment num_descriptions_printed in the right place


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65770

Files:
  clang/lib/Driver/SanitizerArgs.cpp
  clang/test/Driver/fsanitize.c
  compiler-rt/lib/hwasan/hwasan.cpp
  compiler-rt/lib/hwasan/hwasan.h
  compiler-rt/lib/hwasan/hwasan_interface_internal.h
  compiler-rt/lib/hwasan/hwasan_report.cpp
  compiler-rt/test/hwasan/TestCases/global.c
  compiler-rt/test/hwasan/lit.cfg.py
  llvm/include/llvm/BinaryFormat/ELF.h
  llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
  llvm/test/Instrumentation/HWAddressSanitizer/globals.ll

Index: llvm/test/Instrumentation/HWAddressSanitizer/globals.ll
===
--- /dev/null
+++ llvm/test/Instrumentation/HWAddressSanitizer/globals.ll
@@ -0,0 +1,37 @@
+; RUN: opt < %s -S -hwasan -mtriple=aarch64--linux-android29 | FileCheck --check-prefix=CHECK29 %s
+; RUN: opt < %s -S -hwasan -mtriple=aarch64--linux-android30 | FileCheck --check-prefix=CHECK30 %s
+
+; CHECK29-NOT: @hwasan.note
+; CHECK29: @four = global
+
+; CHECK30: @__start_hwasan_globals = external hidden constant [0 x i8]
+; CHECK30: @__stop_hwasan_globals = external hidden constant [0 x i8]
+
+; CHECK30: @hwasan.note = private constant { i32, i32, i32, [8 x i8], i32, i32 } { i32 8, i32 8, i32 3, [8 x i8] c"LLVM\00\00\00\00", i32 trunc (i64 sub (i64 ptrtoint ([0 x i8]* @__start_hwasan_globals to i64), i64 ptrtoint ({ i32, i32, i32, [8 x i8], i32, i32 }* @hwasan.note to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([0 x i8]* @__stop_hwasan_globals to i64), i64 ptrtoint ({ i32, i32, i32, [8 x i8], i32, i32 }* @hwasan.note to i64)) to i32) }, section ".note.hwasan.globals", comdat, align 4
+
+; CHECK30: @hwasan.dummy.global = private constant [0 x i8] zeroinitializer, section "hwasan_globals", comdat($hwasan.note), !associated [[NOTE:![0-9]+]]
+
+; CHECK30: @four.hwasan = private global { i32, [12 x i8] } { i32 1, [12 x i8] c"\00\00\00\00\00\00\00\00\00\00\00\AC" }, align 16
+; CHECK30: @four.hwasan.descriptor = private constant { i32, i32 } { i32 trunc (i64 sub (i64 ptrtoint ({ i32, [12 x i8] }* @four.hwasan to i64), i64 ptrtoint ({ i32, i32 }* @four.hwasan.descriptor to i64)) to i32), i32 -1409286140 }, section "hwasan_globals", !associated [[FOUR:![0-9]+]]
+
+; CHECK30: @sixteen.hwasan = private global [16 x i8] zeroinitializer, align 16
+; CHECK30: @sixteen.hwasan.descriptor = private constant { i32, i32 } { i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @sixteen.hwasan to i64), i64 ptrtoint ({ i32, i32 }* @sixteen.hwasan.descriptor to i64)) to i32), i32 -1392508912 }, section "hwasan_globals", !associated [[SIXTEEN:![0-9]+]]
+
+; CHECK30: @huge.hwasan = private global [16777232 x i8] zeroinitializer, align 16
+; CHECK30: @huge.hwasan.descriptor = private constant { i32, i32 } { i32 trunc (i64 sub (i64 ptrtoint ([16777232 x i8]* @huge.hwasan to i64), i64 ptrtoint ({ i32, i32 }* @huge.hwasan.descriptor to i64)) to i32), i32 -1358954512 }, section "hwasan_globals", !associated [[HUGE:![0-9]+]]
+; CHECK30: @huge.hwasan.descriptor.1 = private constant { i32, i32 } { i32 trunc (i64 add (i64 sub (i64 ptrtoint ([16777232 x i8]* @huge.hwasan to i64), i64 ptrtoint ({ i32, i32 }* @huge.hwasan.descriptor.1 to i64)), i64 16777200) to i32), i32 -1375731680 }, section "hwasan_globals", !associated [[HUGE]]
+
+; CHECK30: @four = alias i32, inttoptr (i64 add (i64 ptrtoint ({ i32, [12 x i8] }* @four.hwasan to i64), i64 -6052837899185946624) to i32*)
+; CHECK30: @sixteen = alias [16 x i8], inttoptr (i64 add (i64 ptrtoint ([16 x i8]* @sixteen.hwasan to i64), i64 -5980780305148018688) to [16 x i8]*)
+; CHECK30: @huge = alias [16777232 x i8], inttoptr (i64 add (i64 ptrtoint ([16777232 x i8]* @huge.hwasan to i64), i64 -590872270090752) to [16777232 x i8]*)
+
+; CHECK30: [[NOTE]] = !}} i32, i32, i32, [8 x i8], i32, i32 }* @hwasan.note}
+; CHECK30: [[FOUR]] = !}} i32, [12 x i8] }* @four.hwasan}
+; CHECK30: [[SIXTEEN]] = !{[16 x i8]* @sixteen.hwasan}
+; CHECK30: [[HUGE]] = !{[16777232 x i8]* @huge.hwasan}
+
+source_filename = "foo"
+
+@four = global i32 1
+@sixteen = global [16 x i8] zeroinitializer
+@huge = global [16777232 x i8] zeroinitializer
Index: llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
===
--- llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -16,6 +16,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Triple.h"
+#include "llvm/BinaryFormat/ELF.h"
 #include "llvm/IR/Attributes.h"
 #include "llvm/IR/BasicBlock.h"
 #include "llvm/IR/Constant.h"
@@ -52,6 +53,7 @@
 #define DEBUG_TYPE "hwasan"
 
 static const char *const kHwasanModuleCtorName = "hwasan.module_ctor

[PATCH] D65776: [Clang] Pragma vectorize_predicate implies vectorize

2019-08-05 Thread Michael Kruse via Phabricator via cfe-commits
Meinersbur added a comment.

Mmmh, I would have expected this to work the same way as `vectorize_width`. 
According to the docs:

> The following example implicitly enables vectorization and interleaving by 
> specifying a vector width and interleaving count:
>  `#pragma clang loop vectorize_width(2) interleave_count(2)`
>  `for(...) {`
>  ` ...`
>  `}`

However, `vectorize_width` does not automatically set 
`llvm.loop.vectorize.enable`. Neither does `llvm.loop.vectorize.width` > 1 
imply `LoopVectorizeHints::getForce()`. At some places they are checked 
together, such as `LoopVectorizeHints::allowReordering()`. Other places, 
notably `LoopVectorizationCostModel::selectVectorizationFactor()`, only queries 
`getForce()`. That is, `vectorize_width(2)` does not implicitly force 
vectorization in practice.


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

https://reviews.llvm.org/D65776



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


r367940 - [Sema] Add -Wpointer-compare

2019-08-05 Thread George Burgess IV via cfe-commits
Author: gbiv
Date: Mon Aug  5 15:15:40 2019
New Revision: 367940

URL: http://llvm.org/viewvc/llvm-project?rev=367940&view=rev
Log:
[Sema] Add -Wpointer-compare

This patch adds a warning that diagnoses comparisons of pointers to
'\0'. This is often indicative of a bug (e.g. the user might've
forgotten to dereference the pointer).

Patch by Elaina Guan!

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

Added:
cfe/trunk/test/Sema/warn-nullchar-nullptr.c
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=367940&r1=367939&r2=367940&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Aug  5 15:15:40 
2019
@@ -3296,6 +3296,10 @@ def warn_impcast_bool_to_null_pointer :
 def warn_non_literal_null_pointer : Warning<
 "expression which evaluates to zero treated as a null pointer constant of "
 "type %0">, InGroup;
+def warn_pointer_compare : Warning<
+"comparing a pointer to a null character constant; did you mean "
+"to compare to %select{NULL|(void *)0}0?">,
+InGroup>;
 def warn_impcast_null_pointer_to_integer : Warning<
 "implicit conversion of %select{NULL|nullptr}0 constant to %1">,
 InGroup;

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=367940&r1=367939&r2=367940&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Mon Aug  5 15:15:40 2019
@@ -10022,6 +10022,7 @@ public:
   QualType CheckShiftOperands( // C99 6.5.7
 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
 BinaryOperatorKind Opc, bool IsCompAssign = false);
+  void CheckPtrComparisonWithNullChar(ExprResult &E, ExprResult &NullE);
   QualType CheckCompareOperands( // C99 6.5.8/9
   ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
   BinaryOperatorKind Opc);

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=367940&r1=367939&r2=367940&view=diff
==
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Aug  5 15:15:40 2019
@@ -10443,6 +10443,32 @@ static QualType checkArithmeticOrEnumera
   return S.Context.getLogicalOperationType();
 }
 
+void Sema::CheckPtrComparisonWithNullChar(ExprResult &E, ExprResult &NullE) {
+  if (!NullE.get()->getType()->isAnyPointerType())
+return;
+  int NullValue = PP.isMacroDefined("NULL") ? 0 : 1;
+  if (!E.get()->getType()->isAnyPointerType() &&
+  E.get()->isNullPointerConstant(Context,
+ Expr::NPC_ValueDependentIsNotNull) ==
+Expr::NPCK_ZeroExpression) {
+if (const auto *CL = dyn_cast(E.get())) {
+  if (CL->getValue() == 0)
+Diag(E.get()->getExprLoc(), diag::warn_pointer_compare)
+<< NullValue
+<< FixItHint::CreateReplacement(E.get()->getExprLoc(),
+NullValue ? "NULL" : "(void *)0");
+} else if (const auto *CE = dyn_cast(E.get())) {
+TypeSourceInfo *TI = CE->getTypeInfoAsWritten();
+QualType T = 
Context.getCanonicalType(TI->getType()).getUnqualifiedType();
+if (T == Context.CharTy)
+  Diag(E.get()->getExprLoc(), diag::warn_pointer_compare)
+  << NullValue
+  << FixItHint::CreateReplacement(E.get()->getExprLoc(),
+  NullValue ? "NULL" : "(void 
*)0");
+  }
+  }
+}
+
 // C99 6.5.8, C++ [expr.rel]
 QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS,
 SourceLocation Loc,
@@ -10476,6 +10502,10 @@ QualType Sema::CheckCompareOperands(Expr
   }
 
   checkArithmeticNull(*this, LHS, RHS, Loc, /*IsCompare=*/true);
+  if (!getLangOpts().CPlusPlus && BinaryOperator::isEqualityOp(Opc)) {
+CheckPtrComparisonWithNullChar(LHS, RHS);
+CheckPtrComparisonWithNullChar(RHS, LHS);
+  }
 
   // Handle vector comparisons separately.
   if (LHS.get()->getType()->isVectorType() ||

Added: cfe/trunk/test/Sema/warn-nullchar-nullptr.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-nullchar-nullptr.c?rev=367940&view=auto
==
--- cfe/trunk/test/Sema/warn-nullchar-nullptr.c (added)
+++ cfe/trunk/test/Sema/warn-nullchar-nullptr.c Mon Aug  5 15:15:40 2019
@@ -0,0 +1,49 @@
+// RUN: %clang_cc1 -fsyntax-o

[PATCH] D60943: Delay diagnosing asm constraints that require immediates until after inlining

2019-08-05 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment.

In D60943#1612083 , @joerg wrote:

> The combination of D60942 , D06943 and 
> D65280  solves the problems for me on all 
> targets I have.


Excellent! I submitted D60942 . Go ahead and 
LGTM please. :-) Thanks!


Repository:
  rC Clang

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

https://reviews.llvm.org/D60943



___
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-08-05 Thread Galina Kistanova via cfe-commits
 Hello everyone,

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

Thanks

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


[PATCH] D65699: [Driver] Prioritize SYSROOT/usr/include over RESOURCE_DIR/include on linux-musl

2019-08-05 Thread Rich Felker via Phabricator via cfe-commits
dalias added a comment.

It's not just infeasible; it's impossible by design. musl's headers do not 
support any contract with compiler-provided versions of the std headers, and 
won't. Attempting to use them in place of the libc ones is unsupported usage 
and will periodically break.


Repository:
  rC Clang

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

https://reviews.llvm.org/D65699



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


[PATCH] D65770: hwasan: Instrument globals.

2019-08-05 Thread Peter Collingbourne via Phabricator via cfe-commits
pcc updated this revision to Diff 213472.
pcc added a comment.

- Switch to an enum


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65770

Files:
  clang/lib/Driver/SanitizerArgs.cpp
  clang/test/Driver/fsanitize.c
  compiler-rt/lib/hwasan/hwasan.cpp
  compiler-rt/lib/hwasan/hwasan.h
  compiler-rt/lib/hwasan/hwasan_interface_internal.h
  compiler-rt/lib/hwasan/hwasan_report.cpp
  compiler-rt/test/hwasan/TestCases/global.c
  compiler-rt/test/hwasan/lit.cfg.py
  llvm/include/llvm/BinaryFormat/ELF.h
  llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
  llvm/test/Instrumentation/HWAddressSanitizer/globals.ll

Index: llvm/test/Instrumentation/HWAddressSanitizer/globals.ll
===
--- /dev/null
+++ llvm/test/Instrumentation/HWAddressSanitizer/globals.ll
@@ -0,0 +1,37 @@
+; RUN: opt < %s -S -hwasan -mtriple=aarch64--linux-android29 | FileCheck --check-prefix=CHECK29 %s
+; RUN: opt < %s -S -hwasan -mtriple=aarch64--linux-android30 | FileCheck --check-prefix=CHECK30 %s
+
+; CHECK29-NOT: @hwasan.note
+; CHECK29: @four = global
+
+; CHECK30: @__start_hwasan_globals = external hidden constant [0 x i8]
+; CHECK30: @__stop_hwasan_globals = external hidden constant [0 x i8]
+
+; CHECK30: @hwasan.note = private constant { i32, i32, i32, [8 x i8], i32, i32 } { i32 8, i32 8, i32 3, [8 x i8] c"LLVM\00\00\00\00", i32 trunc (i64 sub (i64 ptrtoint ([0 x i8]* @__start_hwasan_globals to i64), i64 ptrtoint ({ i32, i32, i32, [8 x i8], i32, i32 }* @hwasan.note to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([0 x i8]* @__stop_hwasan_globals to i64), i64 ptrtoint ({ i32, i32, i32, [8 x i8], i32, i32 }* @hwasan.note to i64)) to i32) }, section ".note.hwasan.globals", comdat, align 4
+
+; CHECK30: @hwasan.dummy.global = private constant [0 x i8] zeroinitializer, section "hwasan_globals", comdat($hwasan.note), !associated [[NOTE:![0-9]+]]
+
+; CHECK30: @four.hwasan = private global { i32, [12 x i8] } { i32 1, [12 x i8] c"\00\00\00\00\00\00\00\00\00\00\00\AC" }, align 16
+; CHECK30: @four.hwasan.descriptor = private constant { i32, i32 } { i32 trunc (i64 sub (i64 ptrtoint ({ i32, [12 x i8] }* @four.hwasan to i64), i64 ptrtoint ({ i32, i32 }* @four.hwasan.descriptor to i64)) to i32), i32 -1409286140 }, section "hwasan_globals", !associated [[FOUR:![0-9]+]]
+
+; CHECK30: @sixteen.hwasan = private global [16 x i8] zeroinitializer, align 16
+; CHECK30: @sixteen.hwasan.descriptor = private constant { i32, i32 } { i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @sixteen.hwasan to i64), i64 ptrtoint ({ i32, i32 }* @sixteen.hwasan.descriptor to i64)) to i32), i32 -1392508912 }, section "hwasan_globals", !associated [[SIXTEEN:![0-9]+]]
+
+; CHECK30: @huge.hwasan = private global [16777232 x i8] zeroinitializer, align 16
+; CHECK30: @huge.hwasan.descriptor = private constant { i32, i32 } { i32 trunc (i64 sub (i64 ptrtoint ([16777232 x i8]* @huge.hwasan to i64), i64 ptrtoint ({ i32, i32 }* @huge.hwasan.descriptor to i64)) to i32), i32 -1358954512 }, section "hwasan_globals", !associated [[HUGE:![0-9]+]]
+; CHECK30: @huge.hwasan.descriptor.1 = private constant { i32, i32 } { i32 trunc (i64 add (i64 sub (i64 ptrtoint ([16777232 x i8]* @huge.hwasan to i64), i64 ptrtoint ({ i32, i32 }* @huge.hwasan.descriptor.1 to i64)), i64 16777200) to i32), i32 -1375731680 }, section "hwasan_globals", !associated [[HUGE]]
+
+; CHECK30: @four = alias i32, inttoptr (i64 add (i64 ptrtoint ({ i32, [12 x i8] }* @four.hwasan to i64), i64 -6052837899185946624) to i32*)
+; CHECK30: @sixteen = alias [16 x i8], inttoptr (i64 add (i64 ptrtoint ([16 x i8]* @sixteen.hwasan to i64), i64 -5980780305148018688) to [16 x i8]*)
+; CHECK30: @huge = alias [16777232 x i8], inttoptr (i64 add (i64 ptrtoint ([16777232 x i8]* @huge.hwasan to i64), i64 -590872270090752) to [16777232 x i8]*)
+
+; CHECK30: [[NOTE]] = !}} i32, i32, i32, [8 x i8], i32, i32 }* @hwasan.note}
+; CHECK30: [[FOUR]] = !}} i32, [12 x i8] }* @four.hwasan}
+; CHECK30: [[SIXTEEN]] = !{[16 x i8]* @sixteen.hwasan}
+; CHECK30: [[HUGE]] = !{[16777232 x i8]* @huge.hwasan}
+
+source_filename = "foo"
+
+@four = global i32 1
+@sixteen = global [16 x i8] zeroinitializer
+@huge = global [16777232 x i8] zeroinitializer
Index: llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
===
--- llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -16,6 +16,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Triple.h"
+#include "llvm/BinaryFormat/ELF.h"
 #include "llvm/IR/Attributes.h"
 #include "llvm/IR/BasicBlock.h"
 #include "llvm/IR/Constant.h"
@@ -52,6 +53,7 @@
 #define DEBUG_TYPE "hwasan"
 
 static const char *const kHwasanModuleCtorName = "hwasan.module_ctor";
+static const char *const kHwasan

[PATCH] D65180: [analyzer] VirtualCallChecker: Improve warning messages.

2019-08-05 Thread Aleksei Sidorin via Phabricator via cfe-commits
a_sidorin accepted this revision.
a_sidorin added a comment.

Hi Artem,
The patch looks good to me. I prefer a fully qualified name, however, but it is 
a matter of taste.


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

https://reviews.llvm.org/D65180



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


[PATCH] D65770: hwasan: Instrument globals.

2019-08-05 Thread Peter Collingbourne via Phabricator via cfe-commits
pcc marked 3 inline comments as done.
pcc added inline comments.



Comment at: compiler-rt/lib/hwasan/hwasan.cpp:221
+  s32 gv_relptr;
+  u32 info;
+};

vitalybuka wrote:
> Can this be just following?
>   u32 size:24;
>   u8 tag;
It could, but since these structs are created by the pass I didn't want to make 
any assumptions about bitfield layout (even though I think we should always end 
up with the layout we expect on the platforms we care about), and the way I've 
written it the code is more "obviously" correct when comparing it against the 
pass.



Comment at: compiler-rt/lib/hwasan/hwasan.cpp:236
 
-using namespace __hwasan;
+#define NT_LLVM_HWASAN_GLOBALS 3
+

vitalybuka wrote:
> could this be a normal constant?
You mean like an enum? Sure.



Comment at: llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp:1203
+  Constant *Initializer = GV->getInitializer();
+  uint64_t SizeInBytes =
+  M.getDataLayout().getTypeAllocSize(Initializer->getType());

vitalybuka wrote:
> what is going to happen with size > 2^24?
We create multiple descriptors, see the loop on lines 1242-1262.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65770



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


[PATCH] D65776: [Clang] Pragma vectorize_predicate implies vectorize

2019-08-05 Thread Sjoerd Meijer via Phabricator via cfe-commits
SjoerdMeijer added a comment.

Forgot that this requires a doc change too. Will add that once we're happy with 
the proposed behaviour.


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

https://reviews.llvm.org/D65776



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


[PATCH] D65770: hwasan: Instrument globals.

2019-08-05 Thread Vitaly Buka via Phabricator via cfe-commits
vitalybuka added inline comments.



Comment at: llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp:1203
+  Constant *Initializer = GV->getInitializer();
+  uint64_t SizeInBytes =
+  M.getDataLayout().getTypeAllocSize(Initializer->getType());

what is going to happen with size > 2^24?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65770



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


[PATCH] D65776: [Clang] Pragma vectorize_predicate implies vectorize

2019-08-05 Thread Sjoerd Meijer via Phabricator via cfe-commits
SjoerdMeijer created this revision.
SjoerdMeijer added reviewers: Meinersbur, hsaito, fhahn.

New pragma "vectorize_predicate(enable)" now implies "vectorize(enable)",
and it is ignored when vectorization is disabled with e.g.
"vectorize(disable) vectorize_predicate(enable)".


https://reviews.llvm.org/D65776

Files:
  clang/lib/CodeGen/CGLoopInfo.cpp
  clang/test/CodeGenCXX/pragma-loop-predicate.cpp


Index: clang/test/CodeGenCXX/pragma-loop-predicate.cpp
===
--- clang/test/CodeGenCXX/pragma-loop-predicate.cpp
+++ clang/test/CodeGenCXX/pragma-loop-predicate.cpp
@@ -27,9 +27,50 @@
 List[i] = i * 2;
 }
 
+// vectorize_predicate(enable) implies vectorize(enable)
+void test3(int *List, int Length) {
+// CHECK-LABEL: @{{.*}}test3{{.*}}(
+// CHECK:   br label {{.*}}, !llvm.loop ![[LOOP3:.*]]
+
+  #pragma clang loop vectorize_predicate(enable)
+  for (int i = 0; i < Length; i++)
+List[i] = i * 2;
+}
+
+// Check that disabling vectorization means a vectorization width of 1, and
+// also that vectorization_predicate isn't enabled.
+void test4(int *List, int Length) {
+// CHECK-LABEL: @{{.*}}test4{{.*}}(
+// CHECK: br label {{.*}}, !llvm.loop ![[LOOP4:.*]]
+
+  #pragma clang loop vectorize(disable)
+  for (int i = 0; i < Length; i++)
+List[i] = i * 2;
+}
+
+// Check that vectorize and vectorize_predicate are disabled.
+void test5(int *List, int Length) {
+// CHECK-LABEL: @{{.*}}test5{{.*}}(
+// CHECK: br label {{.*}}, !llvm.loop ![[LOOP5:.*]]
+
+  #pragma clang loop vectorize(disable) vectorize_predicate(enable)
+  for (int i = 0; i < Length; i++)
+List[i] = i * 2;
+}
+
+
 // CHECK:  ![[LOOP0]] = distinct !{![[LOOP0]], !3}
 // CHECK-NEXT: !3 = !{!"llvm.loop.vectorize.enable", i1 true}
+
 // CHECK-NEXT: ![[LOOP1]] = distinct !{![[LOOP1]], !5, !3}
 // CHECK-NEXT: !5 = !{!"llvm.loop.vectorize.predicate.enable", i1 true}
+
 // CHECK-NEXT: ![[LOOP2]] = distinct !{![[LOOP2]], !7, !3}
 // CHECK-NEXT: !7 = !{!"llvm.loop.vectorize.predicate.enable", i1 false}
+
+// CHECK-NEXT: ![[LOOP3]] = distinct !{![[LOOP3]], !5, !3}
+
+// CHECK-NEXT: ![[LOOP4]] = distinct !{![[LOOP4]], !10}
+// CHECK-NEXT: !10 = !{!"llvm.loop.vectorize.width", i32 1}
+
+// CHECK-NEXT: ![[LOOP5]] = distinct !{![[LOOP5]], !10}
Index: clang/lib/CodeGen/CGLoopInfo.cpp
===
--- clang/lib/CodeGen/CGLoopInfo.cpp
+++ clang/lib/CodeGen/CGLoopInfo.cpp
@@ -253,12 +253,18 @@
   Args.append(LoopProperties.begin(), LoopProperties.end());
 
   // Setting vectorize.predicate
-  if (Attrs.VectorizePredicateEnable != LoopAttributes::Unspecified) {
+  bool IsVectorPredicateEnabled = false;
+  if (Attrs.VectorizePredicateEnable != LoopAttributes::Unspecified &&
+  Attrs.VectorizeEnable != LoopAttributes::Disable &&
+  Attrs.VectorizeWidth < 1) {
+
+IsVectorPredicateEnabled =
+(Attrs.VectorizePredicateEnable == LoopAttributes::Enable);
+
 Metadata *Vals[] = {
 MDString::get(Ctx, "llvm.loop.vectorize.predicate.enable"),
-ConstantAsMetadata::get(ConstantInt::get(
-llvm::Type::getInt1Ty(Ctx),
-(Attrs.VectorizePredicateEnable == LoopAttributes::Enable)))};
+ConstantAsMetadata::get(ConstantInt::get(llvm::Type::getInt1Ty(Ctx),
+ IsVectorPredicateEnabled))};
 Args.push_back(MDNode::get(Ctx, Vals));
   }
 
@@ -281,12 +287,15 @@
   }
 
   // Setting vectorize.enable
-  if (Attrs.VectorizeEnable != LoopAttributes::Unspecified) {
+  if (Attrs.VectorizeEnable != LoopAttributes::Unspecified ||
+  IsVectorPredicateEnabled) {
 Metadata *Vals[] = {
 MDString::get(Ctx, "llvm.loop.vectorize.enable"),
 ConstantAsMetadata::get(ConstantInt::get(
 llvm::Type::getInt1Ty(Ctx),
-(Attrs.VectorizeEnable == LoopAttributes::Enable)))};
+IsVectorPredicateEnabled
+? true
+: (Attrs.VectorizeEnable == LoopAttributes::Enable)))};
 Args.push_back(MDNode::get(Ctx, Vals));
   }
 


Index: clang/test/CodeGenCXX/pragma-loop-predicate.cpp
===
--- clang/test/CodeGenCXX/pragma-loop-predicate.cpp
+++ clang/test/CodeGenCXX/pragma-loop-predicate.cpp
@@ -27,9 +27,50 @@
 List[i] = i * 2;
 }
 
+// vectorize_predicate(enable) implies vectorize(enable)
+void test3(int *List, int Length) {
+// CHECK-LABEL: @{{.*}}test3{{.*}}(
+// CHECK:   br label {{.*}}, !llvm.loop ![[LOOP3:.*]]
+
+  #pragma clang loop vectorize_predicate(enable)
+  for (int i = 0; i < Length; i++)
+List[i] = i * 2;
+}
+
+// Check that disabling vectorization means a vectorization width of 1, and
+// also that vectorization_predicate isn't enabled.
+void test4(int *List, int Length) {
+// CHECK-LABEL: @{{.*}}test4{{.*}}(
+// CHECK: br label {{.*}}, !llvm.loop ![[LOOP4:.*]]
+
+  #pragma clang loop vectorize(disable)
+ 

[PATCH] D65770: hwasan: Instrument globals.

2019-08-05 Thread Vitaly Buka via Phabricator via cfe-commits
vitalybuka added inline comments.



Comment at: compiler-rt/lib/hwasan/hwasan.cpp:221
+  s32 gv_relptr;
+  u32 info;
+};

Can this be just following?
  u32 size:24;
  u8 tag;



Comment at: compiler-rt/lib/hwasan/hwasan.cpp:236
 
-using namespace __hwasan;
+#define NT_LLVM_HWASAN_GLOBALS 3
+

could this be a normal constant?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65770



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


[PATCH] D65699: [Driver] Prioritize SYSROOT/usr/include over RESOURCE_DIR/include on linux-musl

2019-08-05 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

This looks reasonable to me; I'd prefer to clean up Clang's internal headers to 
be compatible with both FreeBSD's and musl's standard headers as suggested in 
http://lists.llvm.org/pipermail/llvm-dev/2019-August/134353.html, but I'm not 
sure how feasible or doable that is.


Repository:
  rC Clang

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

https://reviews.llvm.org/D65699



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


[PATCH] D62445: [test] Fix plugin tests

2019-08-05 Thread Don Hinton via Phabricator via cfe-commits
hintonda added a comment.

In D62445#1613268 , @NoQ wrote:

> Ugh, there seems to be one more forgotten buildbot with plugins problems: 
> http://green.lab.llvm.org/green/job/clang-stage2-cmake-RgSan/6406/consoleText




> It got suddenly fixed in 
> http://green.lab.llvm.org/green/job/clang-stage2-cmake-RgSan/6409/ but then 
> immediately failed again later and it's still failing in a similar manner, 
> and nobody noticed for two months =/

The fix was accidental and fortuitous.

r362399 tried to set LLVM_ENABLE_PLUGINS_default to the value of 
LLVM_ENABLE_PIC, but had a typo that actually turn off LLVM_ENABLE_PLUGINS, so 
the test was marked unsupported in build #6409.  That typo was fixed in r362492 
which caused the next build, #6411 and all subsequent builds, to fail.

Will now look into cause/fix.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62445



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


[PATCH] D65234: [CodeGen]: don't treat structures returned in registers as memory inputs

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

For the "=x" thing I was talking about, try the following testcase:

  void a() { struct S { unsigned x[4]; } z; asm volatile("%0":"=x"(z)); }
  void a2() { struct S { unsigned x[8]; } z; asm volatile("%0":"=x"(z)); }

clang trunk gives "error: couldn't allocate output register for constraint 'x'" 
in the backend for both functions.  gcc prints "%xmm0" for the first, and 
rejects the second; not exactly sure why it's rejecting the second, though.  It 
would be nice if both worked, although I guess it's okay if we print a 
reasonable error message.  Please add a testcase, at least.




Comment at: clang/test/CodeGen/x86_64-PR42672.c:3
+// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -USTRUCT -emit-llvm %s -o 
- | FileCheck %s --check-prefix=CHECK-NOSTRUCT
+// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -DIMPOSSIBLE_ODD 
-emit-llvm %s -o - 2> %t || true
+// RUN: grep "impossible constraint in asm" %t

You can prefix a command in a RUN line with "not" if you expect it to return a 
non-zero error code.  So you can write `not %clang_cc1 [...] 2>&1 | FileCheck 
%s` or something like that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65234



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


[PATCH] D65753: Builtins: Add some v2f16 variants

2019-08-05 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

Hmm, sorry, that's a C++ spec, and it looks like the (abandoned) C attempt at 
data parallelism (http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2081.htm) 
doesn't introduce vector types.

Talking about it internally, I think there are two reasonable approaches:

- Add an OpenCL prefix to the builtin, e.g. `__builtin_cl_floorv216`.  This 
isn't great because it feels like it's heading towards a world with a million 
builtins for different element types and vector sizes.
- Make the builtin type-generic, e.g. `__builtin_generic_floor` (or 
`__builtin_tgmath_floor`), where the builtin allows an arbitrary floating-point 
argument (or vector thereof).


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

https://reviews.llvm.org/D65753



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


Re: r367889 - [docs] document -Weveything more betterer

2019-08-05 Thread JF Bastien via cfe-commits
Ugh this is silly… fixed again.

> On Aug 5, 2019, at 12:55 PM, Nico Weber  wrote:
> 
> Still sad, now with a different message: 
> http://lab.llvm.org:8011/builders/clang-sphinx-docs/builds/45220 
> 
> 
> /home/buildbot/llvm-build-dir/clang-sphinx-docs/llvm/src/tools/clang/docs/UsersManual.rst:1002:
>  WARNING: unknown option: -Wall
> 
> On Mon, Aug 5, 2019 at 3:46 PM JF Bastien  > wrote:
> Fixed. I guess we should document those...
> 
>> On Aug 5, 2019, at 10:51 AM, Nico Weber > > wrote:
>> 
>> This breaks the sphinx bot:
>> 
>> http://lab.llvm.org:8011/builders/clang-sphinx-docs/builds/45204/steps/docs-clang-html/logs/stdio
>>  
>> 
>> 
>> Warning, treated as error:
>> /home/buildbot/llvm-build-dir/clang-sphinx-docs/llvm/src/tools/clang/docs/UsersManual.rst:995:
>>  WARNING: unknown option: -Wno-c++98-compat
>> 
>> On Mon, Aug 5, 2019 at 12:52 PM JF Bastien via cfe-commits 
>> mailto:cfe-commits@lists.llvm.org>> wrote:
>> Author: jfb
>> Date: Mon Aug  5 09:53:45 2019
>> New Revision: 367889
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=367889&view=rev 
>> 
>> Log:
>> [docs] document -Weveything more betterer
>> 
>> Reviewers: aaron.ballman
>> 
>> Subscribers: jkorous, dexonsmith, cfe-commits
>> 
>> Tags: #clang
>> 
>> Differential Revision: https://reviews.llvm.org/D65706 
>> 
>> 
>> Modified:
>> cfe/trunk/docs/UsersManual.rst
>> 
>> Modified: cfe/trunk/docs/UsersManual.rst
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.rst?rev=367889&r1=367888&r2=367889&view=diff
>>  
>> 
>> ==
>> --- cfe/trunk/docs/UsersManual.rst (original)
>> +++ cfe/trunk/docs/UsersManual.rst Mon Aug  5 09:53:45 2019
>> @@ -992,13 +992,24 @@ is treated as a system header.
>>  Enabling All Diagnostics
>>  ^
>> 
>> -In addition to the traditional ``-W`` flags, one can enable **all**
>> -diagnostics by passing :option:`-Weverything`. This works as expected
>> -with
>> -:option:`-Werror`, and also includes the warnings from :option:`-pedantic`.
>> +In addition to the traditional ``-W`` flags, one can enable **all** 
>> diagnostics
>> +by passing :option:`-Weverything`. This works as expected with
>> +:option:`-Werror`, and also includes the warnings from :option:`-pedantic`. 
>> Some
>> +diagnostics contradict each other, therefore, users of 
>> :option:`-Weverything`
>> +often disable many diagnostics such as :option:`-Wno-c++98-compat`
>> +:option:`-Wno-c++-compat` because they contradict recent C++ standards.
>> 
>> -Note that when combined with :option:`-w` (which disables all warnings), 
>> that
>> -flag wins.
>> +Since :option:`-Weverything` enables every diagnostic, we generally don't
>> +recommend using it. :option:`-Wall` :option:`-Wextra` are a better choice 
>> for
>> +most projects. Using :option:`-Weverything` means that updating your 
>> compiler is
>> +more difficult because you're exposed to experimental diagnostics which 
>> might be
>> +of lower quality than the default ones. If you do use :option:`-Weverything`
>> +then we advise that you address all new compiler diagnostics as they get 
>> added
>> +to Clang, either by fixing everything they find or explicitly disabling that
>> +diagnostic with its corresponding `Wno-` option.
>> +
>> +Note that when combined with :option:`-w` (which disables all warnings),
>> +disabling all warnings wins.
>> 
>>  Controlling Static Analyzer Diagnostics
>>  ^^^
>> 
>> 
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org 
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits 
>> 
> 

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


r367918 - [docs] don't use :option: for Wall Wextra

2019-08-05 Thread JF Bastien via cfe-commits
Author: jfb
Date: Mon Aug  5 12:59:07 2019
New Revision: 367918

URL: http://llvm.org/viewvc/llvm-project?rev=367918&view=rev
Log:
[docs] don't use :option: for Wall Wextra

The bots are sad that they're not documented.

Modified:
cfe/trunk/docs/UsersManual.rst

Modified: cfe/trunk/docs/UsersManual.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.rst?rev=367918&r1=367917&r2=367918&view=diff
==
--- cfe/trunk/docs/UsersManual.rst (original)
+++ cfe/trunk/docs/UsersManual.rst Mon Aug  5 12:59:07 2019
@@ -1000,13 +1000,13 @@ often disable many diagnostics such as `
 because they contradict recent C++ standards.
 
 Since :option:`-Weverything` enables every diagnostic, we generally don't
-recommend using it. :option:`-Wall` :option:`-Wextra` are a better choice for
-most projects. Using :option:`-Weverything` means that updating your compiler 
is
-more difficult because you're exposed to experimental diagnostics which might 
be
-of lower quality than the default ones. If you do use :option:`-Weverything`
-then we advise that you address all new compiler diagnostics as they get added
-to Clang, either by fixing everything they find or explicitly disabling that
-diagnostic with its corresponding `Wno-` option.
+recommend using it. `-Wall` `-Wextra` are a better choice for most projects.
+Using :option:`-Weverything` means that updating your compiler is more 
difficult
+because you're exposed to experimental diagnostics which might be of lower
+quality than the default ones. If you do use :option:`-Weverything` then we
+advise that you address all new compiler diagnostics as they get added to 
Clang,
+either by fixing everything they find or explicitly disabling that diagnostic
+with its corresponding `Wno-` option.
 
 Note that when combined with :option:`-w` (which disables all warnings),
 disabling all warnings wins.


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


Re: r367889 - [docs] document -Weveything more betterer

2019-08-05 Thread Nico Weber via cfe-commits
Still sad, now with a different message:
http://lab.llvm.org:8011/builders/clang-sphinx-docs/builds/45220

/home/buildbot/llvm-build-dir/clang-sphinx-docs/llvm/src/tools/clang/docs/UsersManual.rst:1002:
WARNING: unknown option: -Wall

On Mon, Aug 5, 2019 at 3:46 PM JF Bastien  wrote:

> Fixed. I guess we should document those...
>
> On Aug 5, 2019, at 10:51 AM, Nico Weber  wrote:
>
> This breaks the sphinx bot:
>
>
> http://lab.llvm.org:8011/builders/clang-sphinx-docs/builds/45204/steps/docs-clang-html/logs/stdio
>
> Warning, treated as error:
> /home/buildbot/llvm-build-dir/clang-sphinx-docs/llvm/src/tools/clang/docs/UsersManual.rst:995:
> WARNING: unknown option: -Wno-c++98-compat
>
> On Mon, Aug 5, 2019 at 12:52 PM JF Bastien via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: jfb
>> Date: Mon Aug  5 09:53:45 2019
>> New Revision: 367889
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=367889&view=rev
>> Log:
>> [docs] document -Weveything more betterer
>>
>> Reviewers: aaron.ballman
>>
>> Subscribers: jkorous, dexonsmith, cfe-commits
>>
>> Tags: #clang
>>
>> Differential Revision: https://reviews.llvm.org/D65706
>>
>> Modified:
>> cfe/trunk/docs/UsersManual.rst
>>
>> Modified: cfe/trunk/docs/UsersManual.rst
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.rst?rev=367889&r1=367888&r2=367889&view=diff
>>
>> ==
>> --- cfe/trunk/docs/UsersManual.rst (original)
>> +++ cfe/trunk/docs/UsersManual.rst Mon Aug  5 09:53:45 2019
>> @@ -992,13 +992,24 @@ is treated as a system header.
>>  Enabling All Diagnostics
>>  ^
>>
>> -In addition to the traditional ``-W`` flags, one can enable **all**
>> -diagnostics by passing :option:`-Weverything`. This works as expected
>> -with
>> -:option:`-Werror`, and also includes the warnings from
>> :option:`-pedantic`.
>> +In addition to the traditional ``-W`` flags, one can enable **all**
>> diagnostics
>> +by passing :option:`-Weverything`. This works as expected with
>> +:option:`-Werror`, and also includes the warnings from
>> :option:`-pedantic`. Some
>> +diagnostics contradict each other, therefore, users of
>> :option:`-Weverything`
>> +often disable many diagnostics such as :option:`-Wno-c++98-compat`
>> +:option:`-Wno-c++-compat` because they contradict recent C++ standards.
>>
>> -Note that when combined with :option:`-w` (which disables all warnings),
>> that
>> -flag wins.
>> +Since :option:`-Weverything` enables every diagnostic, we generally don't
>> +recommend using it. :option:`-Wall` :option:`-Wextra` are a better
>> choice for
>> +most projects. Using :option:`-Weverything` means that updating your
>> compiler is
>> +more difficult because you're exposed to experimental diagnostics which
>> might be
>> +of lower quality than the default ones. If you do use
>> :option:`-Weverything`
>> +then we advise that you address all new compiler diagnostics as they get
>> added
>> +to Clang, either by fixing everything they find or explicitly disabling
>> that
>> +diagnostic with its corresponding `Wno-` option.
>> +
>> +Note that when combined with :option:`-w` (which disables all warnings),
>> +disabling all warnings wins.
>>
>>  Controlling Static Analyzer Diagnostics
>>  ^^^
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D65753: Builtins: Add some v2f16 variants

2019-08-05 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

You might want to look into ISO/IEC TS 19570 - 2018 to see what they're 
thinking.  If it looks like there's a potential conflict, then maybe these 
should have an OpenCL-specific prefix on them.


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

https://reviews.llvm.org/D65753



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


[PATCH] D62648: [Sema][Typo] Fix assertion failure for expressions with multiple typos

2019-08-05 Thread David Goldman via Phabricator via cfe-commits
dgoldman updated this revision to Diff 213438.
dgoldman added a comment.

- remove extra newline


Repository:
  rC Clang

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

https://reviews.llvm.org/D62648

Files:
  include/clang/Sema/Sema.h
  lib/Sema/SemaExprCXX.cpp
  lib/Sema/SemaLookup.cpp
  test/Sema/typo-correction-recursive.cpp

Index: test/Sema/typo-correction-recursive.cpp
===
--- /dev/null
+++ test/Sema/typo-correction-recursive.cpp
@@ -0,0 +1,120 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// Check the following typo correction behavior:
+// - multiple typos in a single member call chain are all diagnosed
+// - no typos are diagnosed for multiple typos in an expression when not all
+//   typos can be corrected
+
+class DeepClass
+{
+public:
+  void trigger() const;  // expected-note {{'trigger' declared here}}
+};
+
+class Y
+{
+public:
+  const DeepClass& getX() const { return m_deepInstance; }  // expected-note {{'getX' declared here}}
+private:
+  DeepClass m_deepInstance;
+  int m_n;
+};
+
+class Z
+{
+public:
+  const Y& getY0() const { return m_y0; }  // expected-note {{'getY0' declared here}}
+  const Y& getActiveY() const { return m_y0; }
+
+private:
+  Y m_y0;
+  Y m_y1;
+};
+
+Z z_obj;
+
+void testMultipleCorrections()
+{
+  z_obj.getY2().  // expected-error {{no member named 'getY2' in 'Z'; did you mean 'getY0'}}
+  getM(). // expected-error {{no member named 'getM' in 'Y'; did you mean 'getX'}}
+  triggee();  // expected-error {{no member named 'triggee' in 'DeepClass'; did you mean 'trigger'}}
+}
+
+void testNoCorrections()
+{
+  z_obj.getY2().  // expected-error {{no member named 'getY2' in 'Z'}}
+  getM().
+  thisDoesntSeemToMakeSense();
+}
+
+struct C {};
+struct D { int value; };
+struct A {
+  C get_me_a_C();
+};
+struct B {
+  D get_me_a_D();  // expected-note {{'get_me_a_D' declared here}}
+};
+class Scope {
+public:
+  A make_an_A();
+  B make_a_B();  // expected-note {{'make_a_B' declared here}}
+};
+
+Scope scope_obj;
+
+int testDiscardedCorrections() {
+  return scope_obj.make_an_E().  // expected-error {{no member named 'make_an_E' in 'Scope'; did you mean 'make_a_B'}}
+  get_me_a_Z().value;// expected-error {{no member named 'get_me_a_Z' in 'B'; did you mean 'get_me_a_D'}}
+}
+
+class AmbiguousHelper {
+public:
+  int helpMe();
+  int helpBe();
+};
+class Ambiguous {
+public:
+  int calculateA();
+  int calculateB();
+
+  AmbiguousHelper getHelp1();
+  AmbiguousHelper getHelp2();
+};
+
+Ambiguous ambiguous_obj;
+
+int testDirectAmbiguousCorrection() {
+  return ambiguous_obj.calculateZ();  // expected-error {{no member named 'calculateZ' in 'Ambiguous'}}
+}
+
+int testRecursiveAmbiguousCorrection() {
+  return ambiguous_obj.getHelp3().// expected-error {{no member named 'getHelp3' in 'Ambiguous'}}
+  helpCe();
+}
+
+
+class DeepAmbiguityHelper {
+public:
+  DeepAmbiguityHelper& help1();
+  DeepAmbiguityHelper& help2();
+
+  DeepAmbiguityHelper& methodA();
+  DeepAmbiguityHelper& somethingMethodB();
+  DeepAmbiguityHelper& functionC();
+  DeepAmbiguityHelper& deepMethodD();
+  DeepAmbiguityHelper& asDeepAsItGets();
+};
+
+DeepAmbiguityHelper deep_obj;
+
+int testDeepAmbiguity() {
+  deep_obj.
+  methodB(). // expected-error {{no member named 'methodB' in 'DeepAmbiguityHelper'}}
+  somethingMethodC().
+  functionD().
+  deepMethodD().
+  help3().
+  asDeepASItGet().
+  functionE();
+}
Index: lib/Sema/SemaLookup.cpp
===
--- lib/Sema/SemaLookup.cpp
+++ lib/Sema/SemaLookup.cpp
@@ -5361,6 +5361,8 @@
   State.Consumer = std::move(TCC);
   State.DiagHandler = std::move(TDG);
   State.RecoveryHandler = std::move(TRC);
+  if (TE)
+TypoExprs.push_back(TE);
   return TE;
 }
 
Index: lib/Sema/SemaExprCXX.cpp
===
--- lib/Sema/SemaExprCXX.cpp
+++ lib/Sema/SemaExprCXX.cpp
@@ -7584,15 +7584,22 @@
   llvm::SmallDenseMap OverloadResolution;
 
   /// Emit diagnostics for all of the TypoExprs encountered.
+  ///
   /// If the TypoExprs were successfully corrected, then the diagnostics should
   /// suggest the corrections. Otherwise the diagnostics will not suggest
   /// anything (having been passed an empty TypoCorrection).
-  void EmitAllDiagnostics() {
+  ///
+  /// If we've failed to correct due to ambiguous corrections, we need to
+  /// be sure to pass empty corrections and replacements. Otherwise it's
+  /// possible that the Consumer has a TypoCorrection that failed to ambiguity
+  /// and we don't want to report those diagnostics.
+  void EmitAllDiagnostics(bool IsAmbiguous) {
 for (TypoExpr *TE : TypoExprs) {
   auto &State = SemaRef.getTypoExprState(TE);
   if (State.DiagHandler) {
-TypoCorrection TC = State.Consumer->getCurrentCorrection();
-ExprResult Replacement = Tra

[PATCH] D62648: [Sema][Typo] Fix assertion failure for expressions with multiple typos

2019-08-05 Thread David Goldman via Phabricator via cfe-commits
dgoldman updated this revision to Diff 213437.
dgoldman added a comment.

Fix test failure via `TransformTypos`

- Add a new property on Sema to track newly created Typos and use this from 
within TransformTypos in order to delete any Typos that are unreachable (tested 
in typo-correction-cxx11.cpp)


Repository:
  rC Clang

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

https://reviews.llvm.org/D62648

Files:
  include/clang/Sema/Sema.h
  lib/Sema/SemaExprCXX.cpp
  lib/Sema/SemaLookup.cpp
  test/Sema/typo-correction-recursive.cpp

Index: test/Sema/typo-correction-recursive.cpp
===
--- /dev/null
+++ test/Sema/typo-correction-recursive.cpp
@@ -0,0 +1,120 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// Check the following typo correction behavior:
+// - multiple typos in a single member call chain are all diagnosed
+// - no typos are diagnosed for multiple typos in an expression when not all
+//   typos can be corrected
+
+class DeepClass
+{
+public:
+  void trigger() const;  // expected-note {{'trigger' declared here}}
+};
+
+class Y
+{
+public:
+  const DeepClass& getX() const { return m_deepInstance; }  // expected-note {{'getX' declared here}}
+private:
+  DeepClass m_deepInstance;
+  int m_n;
+};
+
+class Z
+{
+public:
+  const Y& getY0() const { return m_y0; }  // expected-note {{'getY0' declared here}}
+  const Y& getActiveY() const { return m_y0; }
+
+private:
+  Y m_y0;
+  Y m_y1;
+};
+
+Z z_obj;
+
+void testMultipleCorrections()
+{
+  z_obj.getY2().  // expected-error {{no member named 'getY2' in 'Z'; did you mean 'getY0'}}
+  getM(). // expected-error {{no member named 'getM' in 'Y'; did you mean 'getX'}}
+  triggee();  // expected-error {{no member named 'triggee' in 'DeepClass'; did you mean 'trigger'}}
+}
+
+void testNoCorrections()
+{
+  z_obj.getY2().  // expected-error {{no member named 'getY2' in 'Z'}}
+  getM().
+  thisDoesntSeemToMakeSense();
+}
+
+struct C {};
+struct D { int value; };
+struct A {
+  C get_me_a_C();
+};
+struct B {
+  D get_me_a_D();  // expected-note {{'get_me_a_D' declared here}}
+};
+class Scope {
+public:
+  A make_an_A();
+  B make_a_B();  // expected-note {{'make_a_B' declared here}}
+};
+
+Scope scope_obj;
+
+int testDiscardedCorrections() {
+  return scope_obj.make_an_E().  // expected-error {{no member named 'make_an_E' in 'Scope'; did you mean 'make_a_B'}}
+  get_me_a_Z().value;// expected-error {{no member named 'get_me_a_Z' in 'B'; did you mean 'get_me_a_D'}}
+}
+
+class AmbiguousHelper {
+public:
+  int helpMe();
+  int helpBe();
+};
+class Ambiguous {
+public:
+  int calculateA();
+  int calculateB();
+
+  AmbiguousHelper getHelp1();
+  AmbiguousHelper getHelp2();
+};
+
+Ambiguous ambiguous_obj;
+
+int testDirectAmbiguousCorrection() {
+  return ambiguous_obj.calculateZ();  // expected-error {{no member named 'calculateZ' in 'Ambiguous'}}
+}
+
+int testRecursiveAmbiguousCorrection() {
+  return ambiguous_obj.getHelp3().// expected-error {{no member named 'getHelp3' in 'Ambiguous'}}
+  helpCe();
+}
+
+
+class DeepAmbiguityHelper {
+public:
+  DeepAmbiguityHelper& help1();
+  DeepAmbiguityHelper& help2();
+
+  DeepAmbiguityHelper& methodA();
+  DeepAmbiguityHelper& somethingMethodB();
+  DeepAmbiguityHelper& functionC();
+  DeepAmbiguityHelper& deepMethodD();
+  DeepAmbiguityHelper& asDeepAsItGets();
+};
+
+DeepAmbiguityHelper deep_obj;
+
+int testDeepAmbiguity() {
+  deep_obj.
+  methodB(). // expected-error {{no member named 'methodB' in 'DeepAmbiguityHelper'}}
+  somethingMethodC().
+  functionD().
+  deepMethodD().
+  help3().
+  asDeepASItGet().
+  functionE();
+}
Index: lib/Sema/SemaLookup.cpp
===
--- lib/Sema/SemaLookup.cpp
+++ lib/Sema/SemaLookup.cpp
@@ -5361,6 +5361,8 @@
   State.Consumer = std::move(TCC);
   State.DiagHandler = std::move(TDG);
   State.RecoveryHandler = std::move(TRC);
+  if (TE)
+TypoExprs.push_back(TE);
   return TE;
 }
 
Index: lib/Sema/SemaExprCXX.cpp
===
--- lib/Sema/SemaExprCXX.cpp
+++ lib/Sema/SemaExprCXX.cpp
@@ -7584,15 +7584,22 @@
   llvm::SmallDenseMap OverloadResolution;
 
   /// Emit diagnostics for all of the TypoExprs encountered.
+  ///
   /// If the TypoExprs were successfully corrected, then the diagnostics should
   /// suggest the corrections. Otherwise the diagnostics will not suggest
   /// anything (having been passed an empty TypoCorrection).
-  void EmitAllDiagnostics() {
+  ///
+  /// If we've failed to correct due to ambiguous corrections, we need to
+  /// be sure to pass empty corrections and replacements. Otherwise it's
+  /// possible that the Consumer has a TypoCorrection that failed to ambiguity
+  /// and we don't want to report those diagnostics.
+  void EmitAllDiagnostics(bool IsAmbiguous) {
 for (TypoExpr *TE 

[PATCH] D65753: Builtins: Add some v2f16 variants

2019-08-05 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

Hmm.  I think there are two reasonable concerns here, both arising from the 
fact that these names occupy (the builtin namespace parallel to) a namespace 
that the committee might want to occupy in the future:

- Is a `v2fN` suffix sufficiently likely to avoid interfering with this 
namespace?  If there's an *exact* collision, that might be okay if the builtin 
actually matches the standard behavior; my concern is that they might conflict. 
 (Different orderings of element count and element type?  Unrelated functions 
ending in `v`?)
- Is it a good idea to introduce builtins in this namespace that traffic in our 
current vector types instead of a potential future standard-blessed vector type?


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

https://reviews.llvm.org/D65753



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


Re: r367889 - [docs] document -Weveything more betterer

2019-08-05 Thread JF Bastien via cfe-commits
Fixed. I guess we should document those...

> On Aug 5, 2019, at 10:51 AM, Nico Weber  wrote:
> 
> This breaks the sphinx bot:
> 
> http://lab.llvm.org:8011/builders/clang-sphinx-docs/builds/45204/steps/docs-clang-html/logs/stdio
>  
> 
> 
> Warning, treated as error:
> /home/buildbot/llvm-build-dir/clang-sphinx-docs/llvm/src/tools/clang/docs/UsersManual.rst:995:
>  WARNING: unknown option: -Wno-c++98-compat
> 
> On Mon, Aug 5, 2019 at 12:52 PM JF Bastien via cfe-commits 
> mailto:cfe-commits@lists.llvm.org>> wrote:
> Author: jfb
> Date: Mon Aug  5 09:53:45 2019
> New Revision: 367889
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=367889&view=rev 
> 
> Log:
> [docs] document -Weveything more betterer
> 
> Reviewers: aaron.ballman
> 
> Subscribers: jkorous, dexonsmith, cfe-commits
> 
> Tags: #clang
> 
> Differential Revision: https://reviews.llvm.org/D65706 
> 
> 
> Modified:
> cfe/trunk/docs/UsersManual.rst
> 
> Modified: cfe/trunk/docs/UsersManual.rst
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.rst?rev=367889&r1=367888&r2=367889&view=diff
>  
> 
> ==
> --- cfe/trunk/docs/UsersManual.rst (original)
> +++ cfe/trunk/docs/UsersManual.rst Mon Aug  5 09:53:45 2019
> @@ -992,13 +992,24 @@ is treated as a system header.
>  Enabling All Diagnostics
>  ^
> 
> -In addition to the traditional ``-W`` flags, one can enable **all**
> -diagnostics by passing :option:`-Weverything`. This works as expected
> -with
> -:option:`-Werror`, and also includes the warnings from :option:`-pedantic`.
> +In addition to the traditional ``-W`` flags, one can enable **all** 
> diagnostics
> +by passing :option:`-Weverything`. This works as expected with
> +:option:`-Werror`, and also includes the warnings from :option:`-pedantic`. 
> Some
> +diagnostics contradict each other, therefore, users of :option:`-Weverything`
> +often disable many diagnostics such as :option:`-Wno-c++98-compat`
> +:option:`-Wno-c++-compat` because they contradict recent C++ standards.
> 
> -Note that when combined with :option:`-w` (which disables all warnings), that
> -flag wins.
> +Since :option:`-Weverything` enables every diagnostic, we generally don't
> +recommend using it. :option:`-Wall` :option:`-Wextra` are a better choice for
> +most projects. Using :option:`-Weverything` means that updating your 
> compiler is
> +more difficult because you're exposed to experimental diagnostics which 
> might be
> +of lower quality than the default ones. If you do use :option:`-Weverything`
> +then we advise that you address all new compiler diagnostics as they get 
> added
> +to Clang, either by fixing everything they find or explicitly disabling that
> +diagnostic with its corresponding `Wno-` option.
> +
> +Note that when combined with :option:`-w` (which disables all warnings),
> +disabling all warnings wins.
> 
>  Controlling Static Analyzer Diagnostics
>  ^^^
> 
> 
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org 
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits 
> 

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


r367914 - [docs] don't use :option: for C++ compat

2019-08-05 Thread JF Bastien via cfe-commits
Author: jfb
Date: Mon Aug  5 12:45:23 2019
New Revision: 367914

URL: http://llvm.org/viewvc/llvm-project?rev=367914&view=rev
Log:
[docs] don't use :option: for C++ compat

The bots are sad that they're not documented.

Modified:
cfe/trunk/docs/UsersManual.rst

Modified: cfe/trunk/docs/UsersManual.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.rst?rev=367914&r1=367913&r2=367914&view=diff
==
--- cfe/trunk/docs/UsersManual.rst (original)
+++ cfe/trunk/docs/UsersManual.rst Mon Aug  5 12:45:23 2019
@@ -996,8 +996,8 @@ In addition to the traditional ``-W`` fl
 by passing :option:`-Weverything`. This works as expected with
 :option:`-Werror`, and also includes the warnings from :option:`-pedantic`. 
Some
 diagnostics contradict each other, therefore, users of :option:`-Weverything`
-often disable many diagnostics such as :option:`-Wno-c++98-compat`
-:option:`-Wno-c++-compat` because they contradict recent C++ standards.
+often disable many diagnostics such as `-Wno-c++98-compat` and 
`-Wno-c++-compat`
+because they contradict recent C++ standards.
 
 Since :option:`-Weverything` enables every diagnostic, we generally don't
 recommend using it. :option:`-Wall` :option:`-Wextra` are a better choice for


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


[PATCH] D65770: hwasan: Instrument globals.

2019-08-05 Thread Peter Collingbourne via Phabricator via cfe-commits
pcc created this revision.
pcc added reviewers: hctim, vitalybuka.
Herald added subscribers: Sanitizers, cfe-commits, hiraditya, kubamracek, 
srhines.
Herald added projects: clang, Sanitizers, LLVM.

Globals are instrumented by adding a pointer tag to their symbol values
and emitting metadata into a special section that allows the runtime to tag
their memory when the library is loaded.

Due to order of initialization issues explained in more detail in the comments,
shadow initialization cannot happen during regular global initialization.
Instead, the location of the global section is marked using an ELF note,
and we require libc support for calling a function provided by the HWASAN
runtime when libraries are loaded and unloaded.

Based on ideas discussed with @evgeny777 in D56672 
.

Depends on D65686 

Depends on D65768 

Depends on D65769 


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65770

Files:
  clang/lib/Driver/SanitizerArgs.cpp
  clang/test/Driver/fsanitize.c
  compiler-rt/lib/hwasan/hwasan.cpp
  compiler-rt/lib/hwasan/hwasan.h
  compiler-rt/lib/hwasan/hwasan_interface_internal.h
  compiler-rt/lib/hwasan/hwasan_report.cpp
  compiler-rt/test/hwasan/TestCases/global.c
  compiler-rt/test/hwasan/lit.cfg.py
  llvm/include/llvm/BinaryFormat/ELF.h
  llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
  llvm/test/Instrumentation/HWAddressSanitizer/globals.ll

Index: llvm/test/Instrumentation/HWAddressSanitizer/globals.ll
===
--- /dev/null
+++ llvm/test/Instrumentation/HWAddressSanitizer/globals.ll
@@ -0,0 +1,37 @@
+; RUN: opt < %s -S -hwasan -mtriple=aarch64--linux-android29 | FileCheck --check-prefix=CHECK29 %s
+; RUN: opt < %s -S -hwasan -mtriple=aarch64--linux-android30 | FileCheck --check-prefix=CHECK30 %s
+
+; CHECK29-NOT: @hwasan.note
+; CHECK29: @four = global
+
+; CHECK30: @__start_hwasan_globals = external hidden constant [0 x i8]
+; CHECK30: @__stop_hwasan_globals = external hidden constant [0 x i8]
+
+; CHECK30: @hwasan.note = private constant { i32, i32, i32, [8 x i8], i32, i32 } { i32 8, i32 8, i32 3, [8 x i8] c"LLVM\00\00\00\00", i32 trunc (i64 sub (i64 ptrtoint ([0 x i8]* @__start_hwasan_globals to i64), i64 ptrtoint ({ i32, i32, i32, [8 x i8], i32, i32 }* @hwasan.note to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([0 x i8]* @__stop_hwasan_globals to i64), i64 ptrtoint ({ i32, i32, i32, [8 x i8], i32, i32 }* @hwasan.note to i64)) to i32) }, section ".note.hwasan.globals", comdat, align 4
+
+; CHECK30: @hwasan.dummy.global = private constant [0 x i8] zeroinitializer, section "hwasan_globals", comdat($hwasan.note), !associated [[NOTE:![0-9]+]]
+
+; CHECK30: @four.hwasan = private global { i32, [12 x i8] } { i32 1, [12 x i8] c"\00\00\00\00\00\00\00\00\00\00\00\AC" }, align 16
+; CHECK30: @four.hwasan.descriptor = private constant { i32, i32 } { i32 trunc (i64 sub (i64 ptrtoint ({ i32, [12 x i8] }* @four.hwasan to i64), i64 ptrtoint ({ i32, i32 }* @four.hwasan.descriptor to i64)) to i32), i32 -1409286140 }, section "hwasan_globals", !associated [[FOUR:![0-9]+]]
+
+; CHECK30: @sixteen.hwasan = private global [16 x i8] zeroinitializer, align 16
+; CHECK30: @sixteen.hwasan.descriptor = private constant { i32, i32 } { i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @sixteen.hwasan to i64), i64 ptrtoint ({ i32, i32 }* @sixteen.hwasan.descriptor to i64)) to i32), i32 -1392508912 }, section "hwasan_globals", !associated [[SIXTEEN:![0-9]+]]
+
+; CHECK30: @huge.hwasan = private global [16777232 x i8] zeroinitializer, align 16
+; CHECK30: @huge.hwasan.descriptor = private constant { i32, i32 } { i32 trunc (i64 sub (i64 ptrtoint ([16777232 x i8]* @huge.hwasan to i64), i64 ptrtoint ({ i32, i32 }* @huge.hwasan.descriptor to i64)) to i32), i32 -1358954512 }, section "hwasan_globals", !associated [[HUGE:![0-9]+]]
+; CHECK30: @huge.hwasan.descriptor.1 = private constant { i32, i32 } { i32 trunc (i64 add (i64 sub (i64 ptrtoint ([16777232 x i8]* @huge.hwasan to i64), i64 ptrtoint ({ i32, i32 }* @huge.hwasan.descriptor.1 to i64)), i64 16777200) to i32), i32 -1375731680 }, section "hwasan_globals", !associated [[HUGE]]
+
+; CHECK30: @four = alias i32, inttoptr (i64 add (i64 ptrtoint ({ i32, [12 x i8] }* @four.hwasan to i64), i64 -6052837899185946624) to i32*)
+; CHECK30: @sixteen = alias [16 x i8], inttoptr (i64 add (i64 ptrtoint ([16 x i8]* @sixteen.hwasan to i64), i64 -5980780305148018688) to [16 x i8]*)
+; CHECK30: @huge = alias [16777232 x i8], inttoptr (i64 add (i64 ptrtoint ([16777232 x i8]* @huge.hwasan to i64), i64 -590872270090752) to [16777232 x i8]*)
+
+; CHECK30: [[NOTE]] = !}} i32, i32, i32, [8 x i8], i32, i32 }* @hwasan.note}
+; CHECK30: [[FOUR]] = !}} i32, [12 x i8] }* @four.hwasan}
+; CHECK30: [[SIXTEEN]] = !{[16 x i8]* @sixteen.hwasan}
+; CHECK30: [[HUGE]] = !{[16

[PATCH] D64838: [Attr] Support _attribute__ ((fallthrough))

2019-08-05 Thread Nathan Huckleberry via Phabricator via cfe-commits
Nathan-Huckleberry updated this revision to Diff 213435.
Nathan-Huckleberry added a comment.

- Remove 'maybe', remove boolean and fix other call to ParseSimpleDeclaration


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64838

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Parse/Parser.h
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Parse/ParseStmt.cpp
  clang/lib/Sema/AnalysisBasedWarnings.cpp
  clang/test/Sema/fallthrough-attr.c
  clang/test/SemaCXX/switch-implicit-fallthrough.cpp
  clang/test/SemaCXX/warn-unused-label-error.cpp

Index: clang/test/SemaCXX/warn-unused-label-error.cpp
===
--- clang/test/SemaCXX/warn-unused-label-error.cpp
+++ clang/test/SemaCXX/warn-unused-label-error.cpp
@@ -18,9 +18,9 @@
   }
 
   void h() {
-D: // expected-warning {{unused label 'D'}}
-  #pragma weak unused_local_static
-  __attribute__((unused))  // expected-warning {{declaration does not declare anything}}
-  ;
+  D:
+#pragma weak unused_local_static
+__attribute__((unused)) // expected-error {{'unused' attribute cannot be applied to a statement}}
+;
   }
 }
Index: clang/test/SemaCXX/switch-implicit-fallthrough.cpp
===
--- clang/test/SemaCXX/switch-implicit-fallthrough.cpp
+++ clang/test/SemaCXX/switch-implicit-fallthrough.cpp
@@ -329,3 +329,15 @@
   }
   return n;
 }
+
+int fallthrough_attribute_spelling(int n) {
+  switch (n) {
+  case 0:
+n++;
+__attribute__((fallthrough));
+  case 1:
+n++;
+break;
+  }
+  return n;
+}
Index: clang/test/Sema/fallthrough-attr.c
===
--- /dev/null
+++ clang/test/Sema/fallthrough-attr.c
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -fsyntax-only -std=gnu89 -verify -Wimplicit-fallthrough %s
+// RUN: %clang_cc1 -fsyntax-only -std=gnu99 -verify -Wimplicit-fallthrough %s
+// RUN: %clang_cc1 -fsyntax-only -std=c99 -verify -Wimplicit-fallthrough %s
+// RUN: %clang_cc1 -fsyntax-only -std=c11 -verify -Wimplicit-fallthrough %s
+// RUN: %clang_cc1 -fsyntax-only -std=c2x -DC2X -verify -Wimplicit-fallthrough %s
+
+int fallthrough_attribute_spelling(int n) {
+  switch (n) {
+  case 0:
+n++;
+  case 1:
+#if defined(C2X)
+// expected-warning@-2{{unannotated fall-through between switch labels}} expected-note@-2{{insert '[[fallthrough]];' to silence this warning}} expected-note@-2{{insert 'break;' to avoid fall-through}}
+#else
+// expected-warning@-4{{unannotated fall-through between switch labels}} expected-note@-4{{insert '__attribute__((fallthrough));' to silence this warning}} expected-note@-4{{insert 'break;' to avoid fall-through}}
+#endif
+n++;
+__attribute__((fallthrough));
+  case 2:
+n++;
+break;
+  }
+  return n;
+}
Index: clang/lib/Sema/AnalysisBasedWarnings.cpp
===
--- clang/lib/Sema/AnalysisBasedWarnings.cpp
+++ clang/lib/Sema/AnalysisBasedWarnings.cpp
@@ -1215,7 +1215,7 @@
 tok::r_square, tok::r_square
   };
 
-  bool PreferClangAttr = !PP.getLangOpts().CPlusPlus17;
+  bool PreferClangAttr = !PP.getLangOpts().CPlusPlus17 && !PP.getLangOpts().C2x;
 
   StringRef MacroName;
   if (PreferClangAttr)
@@ -1224,24 +1224,19 @@
 MacroName = PP.getLastMacroWithSpelling(Loc, FallthroughTokens);
   if (MacroName.empty() && !PreferClangAttr)
 MacroName = PP.getLastMacroWithSpelling(Loc, ClangFallthroughTokens);
-  if (MacroName.empty())
-MacroName = PreferClangAttr ? "[[clang::fallthrough]]" : "[[fallthrough]]";
+  if (MacroName.empty()) {
+if (!PreferClangAttr)
+  MacroName = "[[fallthrough]]";
+else if (PP.getLangOpts().CPlusPlus)
+  MacroName = "[[clang::fallthrough]]";
+else
+  MacroName = "__attribute__((fallthrough))";
+  }
   return MacroName;
 }
 
 static void DiagnoseSwitchLabelsFallthrough(Sema &S, AnalysisDeclContext &AC,
 bool PerFunction) {
-  // Only perform this analysis when using [[]] attributes. There is no good
-  // workflow for this warning when not using C++11. There is no good way to
-  // silence the warning (no attribute is available) unless we are using
-  // [[]] attributes. One could use pragmas to silence the warning, but as a
-  // general solution that is gross and not in the spirit of this warning.
-  //
-  // NOTE: This an intermediate solution. There are on-going discussions on
-  // how to properly support this warning outside of C++11 with an annotation.
-  if (!AC.getASTContext().getLangOpts().DoubleSquareBracketAttributes)
-return;
-
   FallthroughMapper FM(S);
   FM.TraverseStmt(AC.getBody());
 
@@ -1281,25 +1276,24 @@
   SourceLocation L = Label->getBeginLoc();
   if (L.isMacroID())
 continue;
-  if (S.getLangOpts().CPlusPlus11) {
-const Stmt *Te

Re: r367829 - [CrossTU][NFCI] Refactor loadExternalAST function

2019-08-05 Thread Nico Weber via cfe-commits
There was yet another uninit read:


Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80..
FAIL: Clang-Unit ::
CrossTU/./CrossTUTests/CrossTranslationUnit.RespectsLoadThreshold (13891 of
15323)
 TEST 'Clang-Unit ::
CrossTU/./CrossTUTests/CrossTranslationUnit.RespectsLoadThreshold' FAILED

Note: Google Test filter = CrossTranslationUnit.RespectsLoadThreshold
[==] Running 1 test from 1 test case.
[--] Global test environment set-up.
[--] 1 test from CrossTranslationUnit
[ RUN  ] CrossTranslationUnit.RespectsLoadThreshold
==8561==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x1010708 in ~LoadGuard
/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm/tools/clang/include/clang/CrossTU/CrossTranslationUnit.h:288:11
#1 0x1010708 in
clang::cross_tu::CrossTranslationUnitContext::loadExternalAST(llvm::StringRef,
llvm::StringRef, llvm::StringRef, bool)
/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm/tools/clang/lib/CrossTU/CrossTranslationUnit.cpp:499:1
#2 0x100babc in llvm::Expected
clang::cross_tu::CrossTranslationUnitContext::getCrossTUDefinitionImpl(clang::FunctionDecl
const*, llvm::StringRef, llvm::StringRef, bool)
/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm/tools/clang/lib/CrossTU/CrossTranslationUnit.cpp:241:7
#3 0x100b476 in
clang::cross_tu::CrossTranslationUnitContext::getCrossTUDefinition(clang::FunctionDecl
const*, llvm::StringRef, llvm::StringRef, bool)
/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm/tools/clang/lib/CrossTU/CrossTranslationUnit.cpp:307:10


I tried fixing that one in r367912. Please verify that that's what you
meant as well.

On Mon, Aug 5, 2019 at 11:22 AM Nico Weber  wrote:

> The problem is probably this part from the diff:
>
> -  unsigned NumASTLoaded{0u};
> +
> +  /// The number successfully loaded ASTs. Used to indicate, and  - with
> the
> +  /// appropriate threshold value - limit the  memory usage of the
> +  /// CrossTranslationUnitContext.
> +  unsigned NumASTLoaded;
>
>
> i.e. you removed the initialization of NumASTLoaded. Was there a reason
> for that? I've put it back for now in r367875, but please verify that the
> code now does what you intended it to do – maybe you were planning to
> initialize this somewhere else.
>
> On Mon, Aug 5, 2019 at 10:03 AM Nico Weber  wrote:
>
>> The msan bot doesn't like this, it reports an uninitialized read a
>> t clang/lib/CrossTU/CrossTranslationUnit.cpp :
>>
>>
>> http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/34087/steps/check-clang%20msan/logs/stdio
>>
>> 
>> Testing: 0
>> FAIL: Clang :: Analysis/ctu-unknown-parts-in-triples.cpp (492 of 15321)
>>  TEST 'Clang ::
>> Analysis/ctu-unknown-parts-in-triples.cpp' FAILED 
>> Script:
>> --
>> : 'RUN: at line 4';   rm -rf
>> /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/tools/clang/test/Analysis/Output/ctu-unknown-parts-in-triples.cpp.tmp
>> && mkdir
>> /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/tools/clang/test/Analysis/Output/ctu-unknown-parts-in-triples.cpp.tmp
>> : 'RUN: at line 5';   mkdir -p
>> /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/tools/clang/test/Analysis/Output/ctu-unknown-parts-in-triples.cpp.tmp/ctudir
>> : 'RUN: at line 6';
>> /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/clang -cc1
>> -internal-isystem
>> /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/lib/clang/10.0.0/include
>> -nostdsysteminc -triple x86_64-pc-linux-gnu-emit-pch -o
>> /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/tools/clang/test/Analysis/Output/ctu-unknown-parts-in-triples.cpp.tmp/ctudir/ctu-other.cpp.ast
>> /b/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/test/Analysis/Inputs/ctu-other.cpp
>> : 'RUN: at line 8';   cp
>> /b/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/test/Analysis/Inputs/ctu-other.cpp.externalDefMap.txt
>> /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/tools/clang/test/Analysis/Output/ctu-unknown-parts-in-triples.cpp.tmp/ctudir/externalDefMap.txt
>> : 'RUN: at line 9';
>> /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/clang -cc1
>> -internal-isystem
>> /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/lib/clang/10.0.0/include
>> -nostdsysteminc -analyze -analyzer-constraints=range -triple
>> x86_64-unknown-linux-gnu-analyzer-checker=core,debug.ExprInspection
>>  -analyzer-config experimental-enable-naive-ctu-analysis=true
>>  -analyzer-config
>> ctu-dir=/b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/tools/clang/test/Analysis/Output/ctu-unknown-parts-in-triples.cpp.tmp/ctudir
>>-Werror=ctu-verify
>> /b/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/test/Analysis/ctu-unknown-parts-in-triples.cpp
>> --
>> Exit Code: 77
>>
>> Command Output (stderr):
>> --
>> ==5072==WARNING: MemorySanitizer: use-of-uninitialized-value
>> #0 0xb05c3c4 in
>> clang::cross_tu::CrossTranslationUni

r367912 - Fix another uninit read found by msan after r367829

2019-08-05 Thread Nico Weber via cfe-commits
Author: nico
Date: Mon Aug  5 12:35:59 2019
New Revision: 367912

URL: http://llvm.org/viewvc/llvm-project?rev=367912&view=rev
Log:
Fix another uninit read found by msan after r367829

Modified:
cfe/trunk/include/clang/CrossTU/CrossTranslationUnit.h

Modified: cfe/trunk/include/clang/CrossTU/CrossTranslationUnit.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/CrossTU/CrossTranslationUnit.h?rev=367912&r1=367911&r2=367912&view=diff
==
--- cfe/trunk/include/clang/CrossTU/CrossTranslationUnit.h (original)
+++ cfe/trunk/include/clang/CrossTU/CrossTranslationUnit.h Mon Aug  5 12:35:59 
2019
@@ -283,7 +283,7 @@ private:
   class LoadGuard {
   public:
 LoadGuard(unsigned Limit, unsigned &Counter)
-: Counter(Counter), Enabled(Counter < Limit) {}
+: Counter(Counter), Enabled(Counter < Limit), StoreSuccess(false) {}
 ~LoadGuard() {
   if (StoreSuccess)
 ++Counter;


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


[PATCH] D65628: [clang-doc] Parallelize reducing phase

2019-08-05 Thread Diego Astiazarán via Phabricator via cfe-commits
DiegoAstiazaran updated this revision to Diff 213425.
DiegoAstiazaran marked 2 inline comments as done.
DiegoAstiazaran added a comment.
Herald added a subscriber: jfb.

Fix atomicity issues.


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

https://reviews.llvm.org/D65628

Files:
  clang-tools-extra/clang-doc/tool/ClangDocMain.cpp

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
@@ -38,7 +38,9 @@
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Support/Signals.h"
+#include "llvm/Support/ThreadPool.h"
 #include "llvm/Support/raw_ostream.h"
+#include 
 #include 
 
 using namespace clang::ast_matchers;
@@ -67,6 +69,12 @@
 llvm::cl::desc("CSS stylesheets to extend the default styles."),
 llvm::cl::cat(ClangDocCategory));
 
+static llvm::cl::opt ThreadCount(
+"thread-count",
+llvm::cl::desc("Threads to use for collecting and reducing infos."),
+llvm::cl::init(llvm::hardware_concurrency()),
+llvm::cl::cat(ClangDocCategory));
+
 enum OutputFormatTy {
   md,
   yaml,
@@ -153,30 +161,6 @@
   return Path;
 }
 
-// Iterate through tool results and build string map of info vectors from the
-// encoded bitstreams.
-bool bitcodeResultsToInfos(
-tooling::ToolResults &Results,
-llvm::StringMap>> &Output) {
-  bool Err = false;
-  Results.forEachResult([&](StringRef Key, StringRef Value) {
-llvm::BitstreamCursor Stream(Value);
-doc::ClangDocBitcodeReader Reader(Stream);
-auto Infos = Reader.readBitcode();
-if (!Infos) {
-  llvm::errs() << toString(Infos.takeError()) << "\n";
-  Err = true;
-  return;
-}
-for (auto &I : Infos.get()) {
-  auto R =
-  Output.try_emplace(Key, std::vector>());
-  R.first->second.emplace_back(std::move(I));
-}
-  });
-  return Err;
-}
-
 int main(int argc, const char **argv) {
   llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
   std::error_code OK;
@@ -237,37 +221,68 @@
   // In ToolResults, the Key is the hashed USR and the value is the
   // bitcode-encoded representation of the Info object.
   llvm::outs() << "Collecting infos...\n";
-  llvm::StringMap>> USRToInfos;
-  if (bitcodeResultsToInfos(*Exec->get()->getToolResults(), USRToInfos))
-return 1;
+  llvm::StringMap> USRToBitcode;
+  Exec->get()->getToolResults()->forEachResult(
+  [&](StringRef Key, StringRef Value) {
+auto R = USRToBitcode.try_emplace(Key, std::vector());
+R.first->second.emplace_back(Value);
+  });
 
   // First reducing phase (reduce all decls into one info per decl).
-  llvm::outs() << "Reducing " << USRToInfos.size() << " infos...\n";
-  for (auto &Group : USRToInfos) {
-auto Reduced = doc::mergeInfos(Group.getValue());
-if (!Reduced) {
-  llvm::errs() << llvm::toString(Reduced.takeError());
-  continue;
-}
+  llvm::outs() << "Reducing " << USRToBitcode.size() << " infos...\n";
+  std::atomic Error;
+  Error = false;
+  llvm::ThreadPool Pool(ThreadCount);
+  for (auto &Group : USRToBitcode) {
+Pool.async([&]() {
+  std::vector> Infos;
 
-doc::Info *I = Reduced.get().get();
-auto InfoPath = getInfoOutputFile(OutDirectory, I->Path, I->extractName(),
-  "." + Format);
-if (!InfoPath) {
-  llvm::errs() << toString(InfoPath.takeError()) << "\n";
-  return 1;
-}
-std::error_code FileErr;
-llvm::raw_fd_ostream InfoOS(InfoPath.get(), FileErr, llvm::sys::fs::F_None);
-if (FileErr != OK) {
-  llvm::errs() << "Error opening info file: " << FileErr.message() << "\n";
-  continue;
-}
+  for (auto &Bitcode : Group.getValue()) {
+llvm::BitstreamCursor Stream(Bitcode);
+doc::ClangDocBitcodeReader Reader(Stream);
+auto ReadInfos = Reader.readBitcode();
+if (!ReadInfos) {
+  llvm::errs() << toString(ReadInfos.takeError()) << "\n";
+  Error = true;
+  return;
+}
+std::move(ReadInfos->begin(), ReadInfos->end(),
+  std::back_inserter(Infos));
+  }
+
+  auto Reduced = doc::mergeInfos(Infos);
+  if (!Reduced) {
+llvm::errs() << llvm::toString(Reduced.takeError());
+return;
+  }
+
+  doc::Info *I = Reduced.get().get();
+  auto InfoPath = getInfoOutputFile(OutDirectory, I->Path, I->extractName(),
+"." + Format);
+  if (!InfoPath) {
+llvm::errs() << toString(InfoPath.takeError()) << "\n";
+Error = true;
+return;
+  }
+  std::error_code FileErr;
+  llvm::raw_fd_ostream InfoOS(InfoPath.get(), FileErr,
+  llvm::sys::fs::F_None);
+  if (FileErr != OK) {
+llvm::errs() << "Error opening info file: " << FileErr.message()
+ 

[PATCH] D65597: WIP: Builtins: Start adding half versions of math builtins

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

LGTM


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

https://reviews.llvm.org/D65597



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


r367906 - [DirectoryWatcher][linux] Fix build for older kernels

2019-08-05 Thread Jan Korous via cfe-commits
Author: jkorous
Date: Mon Aug  5 11:44:07 2019
New Revision: 367906

URL: http://llvm.org/viewvc/llvm-project?rev=367906&view=rev
Log:
[DirectoryWatcher][linux] Fix build for older kernels

Apparently kernel support for IN_EXCL_UNLINK in inotify_add_watch() doesn't 
imply it's defined in sys/inotify.h.

https://bugs.llvm.org/show_bug.cgi?id=42824

Modified:
cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp

Modified: cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp?rev=367906&r1=367905&r2=367906&view=diff
==
--- cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp (original)
+++ cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp Mon Aug  5 
11:44:07 2019
@@ -24,7 +24,6 @@
 #include 
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -336,7 +335,7 @@ std::unique_ptr clang:
   InotifyFD, Path.str().c_str(),
   IN_CREATE | IN_DELETE | IN_DELETE_SELF | IN_MODIFY |
   IN_MOVED_FROM | IN_MOVE_SELF | IN_MOVED_TO | IN_ONLYDIR | IN_IGNORED
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
+#ifdef IN_EXCL_UNLINK
   | IN_EXCL_UNLINK
 #endif
   );


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


r367905 - [OpenMP 5.0] Codegen support for user-defined mappers.

2019-08-05 Thread Michael Kruse via cfe-commits
Author: meinersbur
Date: Mon Aug  5 11:43:21 2019
New Revision: 367905

URL: http://llvm.org/viewvc/llvm-project?rev=367905&view=rev
Log:
[OpenMP 5.0] Codegen support for user-defined mappers.

This patch implements the code generation for OpenMP 5.0 declare mapper
(user-defined mapper) constructs. For each declare mapper, a mapper
function is generated. These mapper functions will be called by the
runtime and/or other mapper functions to achieve user defined mapping.

The design slides can be found at
https://github.com/lingda-li/public-sharing/blob/master/mapper_runtime_design.pptx

Re-commit after revert in r367773 because r367755 changed the LLVM-IR
output such that a CHECK line failed.

Patch by Lingda Li 

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

Modified:
cfe/trunk/include/clang/AST/GlobalDecl.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/CodeGen/CGDecl.cpp
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h
cfe/trunk/lib/CodeGen/ModuleBuilder.cpp
cfe/trunk/test/OpenMP/declare_mapper_codegen.cpp

Modified: cfe/trunk/include/clang/AST/GlobalDecl.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/GlobalDecl.h?rev=367905&r1=367904&r2=367905&view=diff
==
--- cfe/trunk/include/clang/AST/GlobalDecl.h (original)
+++ cfe/trunk/include/clang/AST/GlobalDecl.h Mon Aug  5 11:43:21 2019
@@ -59,6 +59,7 @@ public:
   GlobalDecl(const CapturedDecl *D) { Init(D); }
   GlobalDecl(const ObjCMethodDecl *D) { Init(D); }
   GlobalDecl(const OMPDeclareReductionDecl *D) { Init(D); }
+  GlobalDecl(const OMPDeclareMapperDecl *D) { Init(D); }
   GlobalDecl(const CXXConstructorDecl *D, CXXCtorType Type) : Value(D, Type) {}
   GlobalDecl(const CXXDestructorDecl *D, CXXDtorType Type) : Value(D, Type) {}
   GlobalDecl(const VarDecl *D, DynamicInitKind StubKind)

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=367905&r1=367904&r2=367905&view=diff
==
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Mon Aug  5 11:43:21 2019
@@ -9860,7 +9860,7 @@ bool ASTContext::DeclMustBeEmitted(const
 return !D->getDeclContext()->isDependentContext();
   else if (isa(D))
 return !D->getDeclContext()->isDependentContext();
-  else if (isa(D))
+  else if (isa(D) || isa(D))
 return !D->getDeclContext()->isDependentContext();
   else if (isa(D))
 return true;

Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=367905&r1=367904&r2=367905&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Mon Aug  5 11:43:21 2019
@@ -2530,10 +2530,11 @@ void CodeGenModule::EmitOMPDeclareReduct
 }
 
 void CodeGenModule::EmitOMPDeclareMapper(const OMPDeclareMapperDecl *D,
-CodeGenFunction *CGF) {
-  if (!LangOpts.OpenMP || (!LangOpts.EmitAllDecls && !D->isUsed()))
+ CodeGenFunction *CGF) {
+  if (!LangOpts.OpenMP || LangOpts.OpenMPSimd ||
+  (!LangOpts.EmitAllDecls && !D->isUsed()))
 return;
-  // FIXME: need to implement mapper code generation
+  getOpenMPRuntime().emitUserDefinedMapper(D, CGF);
 }
 
 void CodeGenModule::EmitOMPRequiresDecl(const OMPRequiresDecl *D) {

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=367905&r1=367904&r2=367905&view=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Mon Aug  5 11:43:21 2019
@@ -752,6 +752,11 @@ enum OpenMPRTLFunction {
   // arg_num, void** args_base, void **args, int64_t *arg_sizes, int64_t
   // *arg_types);
   OMPRTL__tgt_target_data_update_nowait,
+  // Call to int64_t __tgt_mapper_num_components(void *rt_mapper_handle);
+  OMPRTL__tgt_mapper_num_components,
+  // Call to void __tgt_push_mapper_component(void *rt_mapper_handle, void
+  // *base, void *begin, int64_t size, int64_t type);
+  OMPRTL__tgt_push_mapper_component,
 };
 
 /// A basic class for pre|post-action for advanced codegen sequence for OpenMP
@@ -1686,6 +1691,12 @@ void CGOpenMPRuntime::functionFinished(C
   UDRMap.erase(D);
 FunctionUDRMap.erase(CGF.CurFn);
   }
+  auto I = FunctionUDMMap.find(CGF.CurFn);
+  if (I != FunctionUDMMap.end()) {
+for(auto *D : I->second)
+  UDMMap.erase(D);
+FunctionUDMMap.erase(I);
+  }
 }
 
 llvm::Type *CGOpenMPRuntime::getIdentTyPointerTy() {
@@ -2459,6 +2470,24 @@ llvm::FunctionCallee CGOpenMPRuntime::cr
 RTLFn = CGM.CreateR

[PATCH] D64838: [Attr] Support _attribute__ ((fallthrough))

2019-08-05 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang/lib/Parse/ParseDecl.cpp:1767
 }
 return ParseSimpleDeclaration(Context, DeclEnd, attrs,
   true);

Should this also be passed `DeclSpecStart`?



Comment at: clang/lib/Parse/ParseStmt.cpp:233
+GNUAttributeLoc = Tok.getLocation();
+MaybeParseGNUAttributes(Attrs);
+goto Retry;

xbolva00 wrote:
> Since you know that tok is kw_attr, I think you can use 'ParseGNUAttributes'.
Agreed, you don't need to use the Maybe check here.



Comment at: clang/lib/Parse/ParseStmt.cpp:156
   StmtResult Res;
+  bool SeenGNUAttributes = false;
+  SourceLocation GNUAttributeLoc;

I think you can use `GNUAttributeLoc.isValid()` instead of using the extra 
local variable.



Comment at: clang/test/SemaCXX/warn-unused-label-error.cpp:23
+#pragma weak unused_local_static
+__attribute__((unused)) // expected-error {{'unused' attribute cannot be 
applied to a statement}}
+;

This change in diagnostics makes me very happy!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64838



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


[PATCH] D65761: Add Windows Control Flow Guard checks (/guard:cf).

2019-08-05 Thread Andrew Paverd via Phabricator via cfe-commits
ajpaverd created this revision.
Herald added subscribers: llvm-commits, cfe-commits, dexonsmith, steven_wu, 
hiraditya, kristof.beyls, javed.absar, mgorny, mehdi_amini.
Herald added projects: clang, LLVM.

A new module pass (Transforms/CFGuard/CFGuard.cpp) inserts CFGuard checks on
indirect function calls, using either the check or dispatch mechanism. These
checks require new calling conventions for the supported targets (currently
x86, ARM, and AArch64). An additional pass (Target/X86/X86FixupCFGuard.cpp) is
used on x86 to prevent stack spills between loading and calling the check, which
could be exploited. Another pass (CodeGen/CFGuardLongjmp.cpp) is used to
identify and emit valid longjmp targets, as required by /guard:cf.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65761

Files:
  clang/docs/ClangCommandLineReference.rst
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/MSVC.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/cfguardtable.c
  clang/test/Driver/cl-options.c
  llvm/docs/LangRef.rst
  llvm/include/llvm/CodeGen/MachineBasicBlock.h
  llvm/include/llvm/CodeGen/MachineFunction.h
  llvm/include/llvm/CodeGen/Passes.h
  llvm/include/llvm/IR/CallingConv.h
  llvm/include/llvm/InitializePasses.h
  llvm/include/llvm/MC/MCObjectFileInfo.h
  llvm/include/llvm/Transforms/CFGuard.h
  llvm/lib/AsmParser/LLLexer.cpp
  llvm/lib/AsmParser/LLParser.cpp
  llvm/lib/AsmParser/LLToken.h
  llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  llvm/lib/CodeGen/AsmPrinter/WinCFGuard.cpp
  llvm/lib/CodeGen/AsmPrinter/WinCFGuard.h
  llvm/lib/CodeGen/CFGuardLongjmp.cpp
  llvm/lib/CodeGen/CMakeLists.txt
  llvm/lib/CodeGen/CodeGen.cpp
  llvm/lib/CodeGen/MachineBasicBlock.cpp
  llvm/lib/IR/AsmWriter.cpp
  llvm/lib/MC/MCObjectFileInfo.cpp
  llvm/lib/Target/AArch64/AArch64CallingConvention.h
  llvm/lib/Target/AArch64/AArch64CallingConvention.td
  llvm/lib/Target/AArch64/AArch64FastISel.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp
  llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
  llvm/lib/Target/AArch64/LLVMBuild.txt
  llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp
  llvm/lib/Target/ARM/ARMCallingConv.h
  llvm/lib/Target/ARM/ARMCallingConv.td
  llvm/lib/Target/ARM/ARMFastISel.cpp
  llvm/lib/Target/ARM/ARMISelLowering.cpp
  llvm/lib/Target/ARM/ARMTargetMachine.cpp
  llvm/lib/Target/ARM/LLVMBuild.txt
  llvm/lib/Target/X86/CMakeLists.txt
  llvm/lib/Target/X86/LLVMBuild.txt
  llvm/lib/Target/X86/X86.h
  llvm/lib/Target/X86/X86AsmPrinter.cpp
  llvm/lib/Target/X86/X86CallingConv.td
  llvm/lib/Target/X86/X86FastISel.cpp
  llvm/lib/Target/X86/X86FixupCFGuard.cpp
  llvm/lib/Target/X86/X86RegisterInfo.cpp
  llvm/lib/Target/X86/X86Subtarget.h
  llvm/lib/Target/X86/X86TargetMachine.cpp
  llvm/lib/Transforms/CFGuard/CFGuard.cpp
  llvm/lib/Transforms/CFGuard/CMakeLists.txt
  llvm/lib/Transforms/CFGuard/LLVMBuild.txt
  llvm/lib/Transforms/CMakeLists.txt
  llvm/lib/Transforms/LLVMBuild.txt
  llvm/test/Bitcode/calling-conventions.3.2.ll
  llvm/test/Bitcode/calling-conventions.3.2.ll.bc
  llvm/test/CodeGen/AArch64/cfguard-checks.ll
  llvm/test/CodeGen/AArch64/cfguard-module-flag.ll
  llvm/test/CodeGen/ARM/cfguard-checks.ll
  llvm/test/CodeGen/ARM/cfguard-module-flag.ll
  llvm/test/CodeGen/WinCFGuard/cfguard-setjmp.ll
  llvm/test/CodeGen/WinCFGuard/cfguard.ll
  llvm/test/CodeGen/X86/cfguard-checks.ll
  llvm/test/CodeGen/X86/cfguard-module-flag.ll

Index: llvm/test/CodeGen/X86/cfguard-module-flag.ll
===
--- /dev/null
+++ llvm/test/CodeGen/X86/cfguard-module-flag.ll
@@ -0,0 +1,28 @@
+
+; RUN: llc < %s -mtriple=i686-pc-windows-msvc | FileCheck %s -check-prefix=X32
+; RUN: llc < %s -mtriple=x86_64-pc-windows-msvc | FileCheck %s -check-prefix=X64
+
+; This test is disabled on Linux
+; UNSUPPORTED: linux
+
+; Test that Control Flow Guard checks are not added in modules with the 
+; cfguard=1 flag (emit tables but no checks).
+
+
+declare void @target_func()
+
+define void @func_in_module_without_cfguard() #0 {
+entry:
+  %func_ptr = alloca void ()*, align 8
+  store void ()* @target_func, void ()** %func_ptr, align 8
+  %0 = load void ()*, void ()** %func_ptr, align 8
+
+  call void %0()
+  ret void
+
+  ; X32-NOT: __guard_check_icall_fptr
+  ; X64-NOT: __guard_dispatch_icall_fptr
+}
+
+!llvm.module.flags = !{!0}
+!0 = !{i32 2, !"cfguard", i32 1}
\ No newline at end of file
Index: llvm/test/CodeGen/X86/cfguard-checks.ll
===
--- /dev/null
+++ llvm/test/CodeGen/X86/cfguard-checks.ll
@@ -0,0 +1,124 @@
+; RUN: llc < %s -mtriple=i686-pc-windows-msvc | FileCheck %s -check-prefix=X32
+; RUN: llc < %s -mtriple=x86_64-pc-windows-msvc | FileCheck %s -check-prefix=X64
+
+; This test is disabled on Linux

[PATCH] D64838: [Attr] Support _attribute__ ((fallthrough))

2019-08-05 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added a comment.

+1, looks good


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64838



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


[PATCH] D64838: [Attr] Support _attribute__ ((fallthrough))

2019-08-05 Thread Nathan Huckleberry via Phabricator via cfe-commits
Nathan-Huckleberry updated this revision to Diff 213407.
Nathan-Huckleberry added a comment.

- Remove changes from accidentally formatted files


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64838

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Parse/Parser.h
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Parse/ParseStmt.cpp
  clang/lib/Sema/AnalysisBasedWarnings.cpp
  clang/test/Sema/fallthrough-attr.c
  clang/test/SemaCXX/switch-implicit-fallthrough.cpp
  clang/test/SemaCXX/warn-unused-label-error.cpp

Index: clang/test/SemaCXX/warn-unused-label-error.cpp
===
--- clang/test/SemaCXX/warn-unused-label-error.cpp
+++ clang/test/SemaCXX/warn-unused-label-error.cpp
@@ -18,9 +18,9 @@
   }
 
   void h() {
-D: // expected-warning {{unused label 'D'}}
-  #pragma weak unused_local_static
-  __attribute__((unused))  // expected-warning {{declaration does not declare anything}}
-  ;
+  D:
+#pragma weak unused_local_static
+__attribute__((unused)) // expected-error {{'unused' attribute cannot be applied to a statement}}
+;
   }
 }
Index: clang/test/SemaCXX/switch-implicit-fallthrough.cpp
===
--- clang/test/SemaCXX/switch-implicit-fallthrough.cpp
+++ clang/test/SemaCXX/switch-implicit-fallthrough.cpp
@@ -329,3 +329,15 @@
   }
   return n;
 }
+
+int fallthrough_attribute_spelling(int n) {
+  switch (n) {
+  case 0:
+n++;
+__attribute__((fallthrough));
+  case 1:
+n++;
+break;
+  }
+  return n;
+}
Index: clang/test/Sema/fallthrough-attr.c
===
--- /dev/null
+++ clang/test/Sema/fallthrough-attr.c
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -fsyntax-only -std=gnu89 -verify -Wimplicit-fallthrough %s
+// RUN: %clang_cc1 -fsyntax-only -std=gnu99 -verify -Wimplicit-fallthrough %s
+// RUN: %clang_cc1 -fsyntax-only -std=c99 -verify -Wimplicit-fallthrough %s
+// RUN: %clang_cc1 -fsyntax-only -std=c11 -verify -Wimplicit-fallthrough %s
+// RUN: %clang_cc1 -fsyntax-only -std=c2x -DC2X -verify -Wimplicit-fallthrough %s
+
+int fallthrough_attribute_spelling(int n) {
+  switch (n) {
+  case 0:
+n++;
+  case 1:
+#if defined(C2X)
+// expected-warning@-2{{unannotated fall-through between switch labels}} expected-note@-2{{insert '[[fallthrough]];' to silence this warning}} expected-note@-2{{insert 'break;' to avoid fall-through}}
+#else
+// expected-warning@-4{{unannotated fall-through between switch labels}} expected-note@-4{{insert '__attribute__((fallthrough));' to silence this warning}} expected-note@-4{{insert 'break;' to avoid fall-through}}
+#endif
+n++;
+__attribute__((fallthrough));
+  case 2:
+n++;
+break;
+  }
+  return n;
+}
Index: clang/lib/Sema/AnalysisBasedWarnings.cpp
===
--- clang/lib/Sema/AnalysisBasedWarnings.cpp
+++ clang/lib/Sema/AnalysisBasedWarnings.cpp
@@ -1215,7 +1215,7 @@
 tok::r_square, tok::r_square
   };
 
-  bool PreferClangAttr = !PP.getLangOpts().CPlusPlus17;
+  bool PreferClangAttr = !PP.getLangOpts().CPlusPlus17 && !PP.getLangOpts().C2x;
 
   StringRef MacroName;
   if (PreferClangAttr)
@@ -1224,24 +1224,19 @@
 MacroName = PP.getLastMacroWithSpelling(Loc, FallthroughTokens);
   if (MacroName.empty() && !PreferClangAttr)
 MacroName = PP.getLastMacroWithSpelling(Loc, ClangFallthroughTokens);
-  if (MacroName.empty())
-MacroName = PreferClangAttr ? "[[clang::fallthrough]]" : "[[fallthrough]]";
+  if (MacroName.empty()) {
+if (!PreferClangAttr)
+  MacroName = "[[fallthrough]]";
+else if (PP.getLangOpts().CPlusPlus)
+  MacroName = "[[clang::fallthrough]]";
+else
+  MacroName = "__attribute__((fallthrough))";
+  }
   return MacroName;
 }
 
 static void DiagnoseSwitchLabelsFallthrough(Sema &S, AnalysisDeclContext &AC,
 bool PerFunction) {
-  // Only perform this analysis when using [[]] attributes. There is no good
-  // workflow for this warning when not using C++11. There is no good way to
-  // silence the warning (no attribute is available) unless we are using
-  // [[]] attributes. One could use pragmas to silence the warning, but as a
-  // general solution that is gross and not in the spirit of this warning.
-  //
-  // NOTE: This an intermediate solution. There are on-going discussions on
-  // how to properly support this warning outside of C++11 with an annotation.
-  if (!AC.getASTContext().getLangOpts().DoubleSquareBracketAttributes)
-return;
-
   FallthroughMapper FM(S);
   FM.TraverseStmt(AC.getBody());
 
@@ -1281,25 +1276,24 @@
   SourceLocation L = Label->getBeginLoc();
   if (L.isMacroID())
 continue;
-  if (S.getLangOpts().CPlusPlus11) {
-const Stmt *Term = B->getTerminatorStmt()

[PATCH] D64838: [Attr] Support _attribute__ ((fallthrough))

2019-08-05 Thread Nathan Huckleberry via Phabricator via cfe-commits
Nathan-Huckleberry updated this revision to Diff 213406.
Nathan-Huckleberry added a comment.

- Allow decl-specifier source location to propagate to decl parsing


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64838

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Parse/Parser.h
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Parse/ParseStmt.cpp
  clang/lib/Sema/AnalysisBasedWarnings.cpp
  clang/test/Index/blocks.c
  clang/test/Index/load-exprs.c
  clang/test/Sema/fallthrough-attr.c
  clang/test/SemaCXX/switch-implicit-fallthrough.cpp
  clang/test/SemaCXX/warn-unused-label-error.cpp

Index: clang/test/SemaCXX/warn-unused-label-error.cpp
===
--- clang/test/SemaCXX/warn-unused-label-error.cpp
+++ clang/test/SemaCXX/warn-unused-label-error.cpp
@@ -18,9 +18,9 @@
   }
 
   void h() {
-D: // expected-warning {{unused label 'D'}}
-  #pragma weak unused_local_static
-  __attribute__((unused))  // expected-warning {{declaration does not declare anything}}
-  ;
+  D:
+#pragma weak unused_local_static
+__attribute__((unused)) // expected-error {{'unused' attribute cannot be applied to a statement}}
+;
   }
 }
Index: clang/test/SemaCXX/switch-implicit-fallthrough.cpp
===
--- clang/test/SemaCXX/switch-implicit-fallthrough.cpp
+++ clang/test/SemaCXX/switch-implicit-fallthrough.cpp
@@ -329,3 +329,15 @@
   }
   return n;
 }
+
+int fallthrough_attribute_spelling(int n) {
+  switch (n) {
+  case 0:
+n++;
+__attribute__((fallthrough));
+  case 1:
+n++;
+break;
+  }
+  return n;
+}
Index: clang/test/Sema/fallthrough-attr.c
===
--- /dev/null
+++ clang/test/Sema/fallthrough-attr.c
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -fsyntax-only -std=gnu89 -verify -Wimplicit-fallthrough %s
+// RUN: %clang_cc1 -fsyntax-only -std=gnu99 -verify -Wimplicit-fallthrough %s
+// RUN: %clang_cc1 -fsyntax-only -std=c99 -verify -Wimplicit-fallthrough %s
+// RUN: %clang_cc1 -fsyntax-only -std=c11 -verify -Wimplicit-fallthrough %s
+// RUN: %clang_cc1 -fsyntax-only -std=c2x -DC2X -verify -Wimplicit-fallthrough %s
+
+int fallthrough_attribute_spelling(int n) {
+  switch (n) {
+  case 0:
+n++;
+  case 1:
+#if defined(C2X)
+// expected-warning@-2{{unannotated fall-through between switch labels}} expected-note@-2{{insert '[[fallthrough]];' to silence this warning}} expected-note@-2{{insert 'break;' to avoid fall-through}}
+#else
+// expected-warning@-4{{unannotated fall-through between switch labels}} expected-note@-4{{insert '__attribute__((fallthrough));' to silence this warning}} expected-note@-4{{insert 'break;' to avoid fall-through}}
+#endif
+n++;
+__attribute__((fallthrough));
+  case 2:
+n++;
+break;
+  }
+  return n;
+}
Index: clang/test/Index/load-exprs.c
===
--- clang/test/Index/load-exprs.c
+++ clang/test/Index/load-exprs.c
@@ -78,4 +78,3 @@
 // CHECK: load-exprs.c:31:32: MemberRef=array:24:12 Extent=[31:32 - 31:37]
 // CHECK: load-exprs.c:31:38: DeclRefExpr=StartIndex:27:8 Extent=[31:38 - 31:48]
 // CHECK: load-exprs.c:31:50: MemberRef=b:2:19 Extent=[31:50 - 31:51]
-
Index: clang/test/Index/blocks.c
===
--- clang/test/Index/blocks.c
+++ clang/test/Index/blocks.c
@@ -31,4 +31,3 @@
 // CHECK: blocks.c:9:54: DeclRefExpr=i:8:11 Extent=[9:54 - 9:55]
 // CHECK: blocks.c:9:59: UnaryOperator= Extent=[9:59 - 9:64]
 // CHECK: blocks.c:9:60: DeclRefExpr=_foo:7:21 Extent=[9:60 - 9:64]
-
Index: clang/lib/Sema/AnalysisBasedWarnings.cpp
===
--- clang/lib/Sema/AnalysisBasedWarnings.cpp
+++ clang/lib/Sema/AnalysisBasedWarnings.cpp
@@ -1215,7 +1215,7 @@
 tok::r_square, tok::r_square
   };
 
-  bool PreferClangAttr = !PP.getLangOpts().CPlusPlus17;
+  bool PreferClangAttr = !PP.getLangOpts().CPlusPlus17 && !PP.getLangOpts().C2x;
 
   StringRef MacroName;
   if (PreferClangAttr)
@@ -1224,24 +1224,19 @@
 MacroName = PP.getLastMacroWithSpelling(Loc, FallthroughTokens);
   if (MacroName.empty() && !PreferClangAttr)
 MacroName = PP.getLastMacroWithSpelling(Loc, ClangFallthroughTokens);
-  if (MacroName.empty())
-MacroName = PreferClangAttr ? "[[clang::fallthrough]]" : "[[fallthrough]]";
+  if (MacroName.empty()) {
+if (!PreferClangAttr)
+  MacroName = "[[fallthrough]]";
+else if (PP.getLangOpts().CPlusPlus)
+  MacroName = "[[clang::fallthrough]]";
+else
+  MacroName = "__attribute__((fallthrough))";
+  }
   return MacroName;
 }
 
 static void DiagnoseSwitchLabelsFallthrough(Sema &S, AnalysisDeclContext &AC,
 bool PerFunction) {
-  // Only perform this analys

Re: r367889 - [docs] document -Weveything more betterer

2019-08-05 Thread Nico Weber via cfe-commits
This breaks the sphinx bot:

http://lab.llvm.org:8011/builders/clang-sphinx-docs/builds/45204/steps/docs-clang-html/logs/stdio

Warning, treated as error:
/home/buildbot/llvm-build-dir/clang-sphinx-docs/llvm/src/tools/clang/docs/UsersManual.rst:995:
WARNING: unknown option: -Wno-c++98-compat

On Mon, Aug 5, 2019 at 12:52 PM JF Bastien via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: jfb
> Date: Mon Aug  5 09:53:45 2019
> New Revision: 367889
>
> URL: http://llvm.org/viewvc/llvm-project?rev=367889&view=rev
> Log:
> [docs] document -Weveything more betterer
>
> Reviewers: aaron.ballman
>
> Subscribers: jkorous, dexonsmith, cfe-commits
>
> Tags: #clang
>
> Differential Revision: https://reviews.llvm.org/D65706
>
> Modified:
> cfe/trunk/docs/UsersManual.rst
>
> Modified: cfe/trunk/docs/UsersManual.rst
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.rst?rev=367889&r1=367888&r2=367889&view=diff
>
> ==
> --- cfe/trunk/docs/UsersManual.rst (original)
> +++ cfe/trunk/docs/UsersManual.rst Mon Aug  5 09:53:45 2019
> @@ -992,13 +992,24 @@ is treated as a system header.
>  Enabling All Diagnostics
>  ^
>
> -In addition to the traditional ``-W`` flags, one can enable **all**
> -diagnostics by passing :option:`-Weverything`. This works as expected
> -with
> -:option:`-Werror`, and also includes the warnings from
> :option:`-pedantic`.
> +In addition to the traditional ``-W`` flags, one can enable **all**
> diagnostics
> +by passing :option:`-Weverything`. This works as expected with
> +:option:`-Werror`, and also includes the warnings from
> :option:`-pedantic`. Some
> +diagnostics contradict each other, therefore, users of
> :option:`-Weverything`
> +often disable many diagnostics such as :option:`-Wno-c++98-compat`
> +:option:`-Wno-c++-compat` because they contradict recent C++ standards.
>
> -Note that when combined with :option:`-w` (which disables all warnings),
> that
> -flag wins.
> +Since :option:`-Weverything` enables every diagnostic, we generally don't
> +recommend using it. :option:`-Wall` :option:`-Wextra` are a better choice
> for
> +most projects. Using :option:`-Weverything` means that updating your
> compiler is
> +more difficult because you're exposed to experimental diagnostics which
> might be
> +of lower quality than the default ones. If you do use
> :option:`-Weverything`
> +then we advise that you address all new compiler diagnostics as they get
> added
> +to Clang, either by fixing everything they find or explicitly disabling
> that
> +diagnostic with its corresponding `Wno-` option.
> +
> +Note that when combined with :option:`-w` (which disables all warnings),
> +disabling all warnings wins.
>
>  Controlling Static Analyzer Diagnostics
>  ^^^
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2019-08-05 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: 
clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp:47
+void DynamicStaticInitializersCheck::registerMatchers(MatchFinder *Finder) {
+  if (!getLangOpts().CPlusPlus || getLangOpts().ThreadsafeStatics)
+return;

czhang wrote:
> lebedev.ri wrote:
> > czhang wrote:
> > > aaron.ballman wrote:
> > > > Why is this check disabled for C++? I would expect dynamic init of a 
> > > > static in a C++ header file would be flagged by this check.
> > > I'm confused now. If the language is not C++, we do an early return; that 
> > > is, the check is run if we are on C++. Perhaps the early return is too 
> > > confusing?
> > Then the question is opposite, is this meaningless for C?
> C can only initialize statics with constants, right?
Oye, my eyes saw one thing and my brain saw another. :-P You're right, @czhang, 
this code is correct as-is (C only initializes statics with a constant).


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


Re: [libclc] r367800 - Rename F_{None, Text, Append} to OF_{None, Text, Append}. NFC

2019-08-05 Thread Jan Vesely via cfe-commits
I've reverted this change.
It breaks libclc build using older LLVM version (which is still supported)
and it was committed without review on phabricator or libclc mailing list.
Please don't do that.

Jan

On Mon, Aug 5, 2019 at 1:43 AM Fangrui Song via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: maskray
> Date: Sun Aug  4 22:43:48 2019
> New Revision: 367800
>
> URL: http://llvm.org/viewvc/llvm-project?rev=367800&view=rev
> Log:
> Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFC
>
> F_{None,Text,Append} are kept for compatibility since r334221.
>
> Modified:
> libclc/trunk/utils/prepare-builtins.cpp
>
> Modified: libclc/trunk/utils/prepare-builtins.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/libclc/trunk/utils/prepare-builtins.cpp?rev=367800&r1=367799&r2=367800&view=diff
>
> ==
> --- libclc/trunk/utils/prepare-builtins.cpp (original)
> +++ libclc/trunk/utils/prepare-builtins.cpp Sun Aug  4 22:43:48 2019
> @@ -95,10 +95,10 @@ int main(int argc, char **argv) {
>std::error_code EC;
>  #if HAVE_LLVM >= 0x0600
>std::unique_ptr Out(
> -  new ToolOutputFile(OutputFilename, EC, sys::fs::F_None));
> +  new ToolOutputFile(OutputFilename, EC, sys::fs::OF_None));
>  #else
>std::unique_ptr Out(
> -  new tool_output_file(OutputFilename, EC, sys::fs::F_None));
> +  new tool_output_file(OutputFilename, EC, sys::fs::OF_None));
>  #endif
>if (EC) {
>  errs() << EC.message() << '\n';
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libclc] r367893 - Revert "Rename F_{None, Text, Append} to OF_{None, Text, Append}. NFC"

2019-08-05 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Mon Aug  5 10:23:23 2019
New Revision: 367893

URL: http://llvm.org/viewvc/llvm-project?rev=367893&view=rev
Log:
Revert "Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFC"

This reverts commit 58c814614d2ac69bcf79b09543505fac80ada4e6.
Fixes build breakage using LLVM<7.

Modified:
libclc/trunk/utils/prepare-builtins.cpp

Modified: libclc/trunk/utils/prepare-builtins.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/utils/prepare-builtins.cpp?rev=367893&r1=367892&r2=367893&view=diff
==
--- libclc/trunk/utils/prepare-builtins.cpp (original)
+++ libclc/trunk/utils/prepare-builtins.cpp Mon Aug  5 10:23:23 2019
@@ -95,10 +95,10 @@ int main(int argc, char **argv) {
   std::error_code EC;
 #if HAVE_LLVM >= 0x0600
   std::unique_ptr Out(
-  new ToolOutputFile(OutputFilename, EC, sys::fs::OF_None));
+  new ToolOutputFile(OutputFilename, EC, sys::fs::F_None));
 #else
   std::unique_ptr Out(
-  new tool_output_file(OutputFilename, EC, sys::fs::OF_None));
+  new tool_output_file(OutputFilename, EC, sys::fs::F_None));
 #endif
   if (EC) {
 errs() << EC.message() << '\n';


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


r367892 - [AST] Fix buildbot failure because of raw string inside macro from 367839.

2019-08-05 Thread Johan Vikstrom via cfe-commits
Author: jvikstrom
Date: Mon Aug  5 10:14:46 2019
New Revision: 367892

URL: http://llvm.org/viewvc/llvm-project?rev=367892&view=rev
Log:
[AST] Fix buildbot failure because of raw string inside macro from 367839.

Modified:

cfe/trunk/unittests/Tooling/RecursiveASTVisitorTests/ImplicitCtorInitializer.cpp

Modified: 
cfe/trunk/unittests/Tooling/RecursiveASTVisitorTests/ImplicitCtorInitializer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/RecursiveASTVisitorTests/ImplicitCtorInitializer.cpp?rev=367892&r1=367891&r2=367892&view=diff
==
--- 
cfe/trunk/unittests/Tooling/RecursiveASTVisitorTests/ImplicitCtorInitializer.cpp
 (original)
+++ 
cfe/trunk/unittests/Tooling/RecursiveASTVisitorTests/ImplicitCtorInitializer.cpp
 Mon Aug  5 10:14:46 2019
@@ -41,7 +41,7 @@ TEST(RecursiveASTVisitor, CXXCtorInitial
   for (bool VisitImplCode : {true, false}) {
 CXXCtorInitializerVisitor Visitor(VisitImplCode);
 Visitor.ExpectMatch("initializer", 7, 17);
-auto Code = R"cpp(
+llvm::StringRef Code = R"cpp(
 class A {};
 class B : public A {
   B() {};


___
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-08-05 Thread Charles Zhang via Phabricator via cfe-commits
czhang marked an inline comment as done.
czhang added inline comments.



Comment at: 
clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp:47
+void DynamicStaticInitializersCheck::registerMatchers(MatchFinder *Finder) {
+  if (!getLangOpts().CPlusPlus || getLangOpts().ThreadsafeStatics)
+return;

lebedev.ri wrote:
> czhang wrote:
> > aaron.ballman wrote:
> > > Why is this check disabled for C++? I would expect dynamic init of a 
> > > static in a C++ header file would be flagged by this check.
> > I'm confused now. If the language is not C++, we do an early return; that 
> > is, the check is run if we are on C++. Perhaps the early return is too 
> > confusing?
> Then the question is opposite, is this meaningless for C?
C can only initialize statics with constants, right?


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] D65706: [docs] Better documentation for -Weverything

2019-08-05 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added a comment.

Repository:
  rL LLVM

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

https://reviews.llvm.org/D65706



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


r367889 - [docs] document -Weveything more betterer

2019-08-05 Thread JF Bastien via cfe-commits
Author: jfb
Date: Mon Aug  5 09:53:45 2019
New Revision: 367889

URL: http://llvm.org/viewvc/llvm-project?rev=367889&view=rev
Log:
[docs] document -Weveything more betterer

Reviewers: aaron.ballman

Subscribers: jkorous, dexonsmith, cfe-commits

Tags: #clang

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

Modified:
cfe/trunk/docs/UsersManual.rst

Modified: cfe/trunk/docs/UsersManual.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.rst?rev=367889&r1=367888&r2=367889&view=diff
==
--- cfe/trunk/docs/UsersManual.rst (original)
+++ cfe/trunk/docs/UsersManual.rst Mon Aug  5 09:53:45 2019
@@ -992,13 +992,24 @@ is treated as a system header.
 Enabling All Diagnostics
 ^
 
-In addition to the traditional ``-W`` flags, one can enable **all**
-diagnostics by passing :option:`-Weverything`. This works as expected
-with
-:option:`-Werror`, and also includes the warnings from :option:`-pedantic`.
+In addition to the traditional ``-W`` flags, one can enable **all** diagnostics
+by passing :option:`-Weverything`. This works as expected with
+:option:`-Werror`, and also includes the warnings from :option:`-pedantic`. 
Some
+diagnostics contradict each other, therefore, users of :option:`-Weverything`
+often disable many diagnostics such as :option:`-Wno-c++98-compat`
+:option:`-Wno-c++-compat` because they contradict recent C++ standards.
 
-Note that when combined with :option:`-w` (which disables all warnings), that
-flag wins.
+Since :option:`-Weverything` enables every diagnostic, we generally don't
+recommend using it. :option:`-Wall` :option:`-Wextra` are a better choice for
+most projects. Using :option:`-Weverything` means that updating your compiler 
is
+more difficult because you're exposed to experimental diagnostics which might 
be
+of lower quality than the default ones. If you do use :option:`-Weverything`
+then we advise that you address all new compiler diagnostics as they get added
+to Clang, either by fixing everything they find or explicitly disabling that
+diagnostic with its corresponding `Wno-` option.
+
+Note that when combined with :option:`-w` (which disables all warnings),
+disabling all warnings wins.
 
 Controlling Static Analyzer Diagnostics
 ^^^


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


[PATCH] D65706: [docs] Better documentation for -Weverything

2019-08-05 Thread JF Bastien via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL367889: [docs] document -Weveything more betterer (authored 
by jfb, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D65706?vs=213278&id=213390#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D65706

Files:
  cfe/trunk/docs/UsersManual.rst


Index: cfe/trunk/docs/UsersManual.rst
===
--- cfe/trunk/docs/UsersManual.rst
+++ cfe/trunk/docs/UsersManual.rst
@@ -992,13 +992,24 @@
 Enabling All Diagnostics
 ^
 
-In addition to the traditional ``-W`` flags, one can enable **all**
-diagnostics by passing :option:`-Weverything`. This works as expected
-with
-:option:`-Werror`, and also includes the warnings from :option:`-pedantic`.
+In addition to the traditional ``-W`` flags, one can enable **all** diagnostics
+by passing :option:`-Weverything`. This works as expected with
+:option:`-Werror`, and also includes the warnings from :option:`-pedantic`. 
Some
+diagnostics contradict each other, therefore, users of :option:`-Weverything`
+often disable many diagnostics such as :option:`-Wno-c++98-compat`
+:option:`-Wno-c++-compat` because they contradict recent C++ standards.
+
+Since :option:`-Weverything` enables every diagnostic, we generally don't
+recommend using it. :option:`-Wall` :option:`-Wextra` are a better choice for
+most projects. Using :option:`-Weverything` means that updating your compiler 
is
+more difficult because you're exposed to experimental diagnostics which might 
be
+of lower quality than the default ones. If you do use :option:`-Weverything`
+then we advise that you address all new compiler diagnostics as they get added
+to Clang, either by fixing everything they find or explicitly disabling that
+diagnostic with its corresponding `Wno-` option.
 
-Note that when combined with :option:`-w` (which disables all warnings), that
-flag wins.
+Note that when combined with :option:`-w` (which disables all warnings),
+disabling all warnings wins.
 
 Controlling Static Analyzer Diagnostics
 ^^^


Index: cfe/trunk/docs/UsersManual.rst
===
--- cfe/trunk/docs/UsersManual.rst
+++ cfe/trunk/docs/UsersManual.rst
@@ -992,13 +992,24 @@
 Enabling All Diagnostics
 ^
 
-In addition to the traditional ``-W`` flags, one can enable **all**
-diagnostics by passing :option:`-Weverything`. This works as expected
-with
-:option:`-Werror`, and also includes the warnings from :option:`-pedantic`.
+In addition to the traditional ``-W`` flags, one can enable **all** diagnostics
+by passing :option:`-Weverything`. This works as expected with
+:option:`-Werror`, and also includes the warnings from :option:`-pedantic`. Some
+diagnostics contradict each other, therefore, users of :option:`-Weverything`
+often disable many diagnostics such as :option:`-Wno-c++98-compat`
+:option:`-Wno-c++-compat` because they contradict recent C++ standards.
+
+Since :option:`-Weverything` enables every diagnostic, we generally don't
+recommend using it. :option:`-Wall` :option:`-Wextra` are a better choice for
+most projects. Using :option:`-Weverything` means that updating your compiler is
+more difficult because you're exposed to experimental diagnostics which might be
+of lower quality than the default ones. If you do use :option:`-Weverything`
+then we advise that you address all new compiler diagnostics as they get added
+to Clang, either by fixing everything they find or explicitly disabling that
+diagnostic with its corresponding `Wno-` option.
 
-Note that when combined with :option:`-w` (which disables all warnings), that
-flag wins.
+Note that when combined with :option:`-w` (which disables all warnings),
+disabling all warnings wins.
 
 Controlling Static Analyzer Diagnostics
 ^^^
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


  1   2   >