[PATCH] D56990: Bugfix for Replacement of tied operand of inline asm

2019-03-08 Thread Xiang Zhang via Phabricator via cfe-commits
xiangzhangllvm updated this revision to Diff 189979.

Repository:
  rC Clang

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

https://reviews.llvm.org/D56990

Files:
  lib/CodeGen/CGStmt.cpp
  test/CodeGen/asm-inout.c


Index: test/CodeGen/asm-inout.c
===
--- test/CodeGen/asm-inout.c
+++ test/CodeGen/asm-inout.c
@@ -46,3 +46,12 @@
   asm ("pmulhuw %1, %0\n\t" : "+y" (__A) : "y" (__B));
   return __A;
 }
+
+// CHECK: @test6
+int test6(void) {
+  typedef unsigned char __attribute__((vector_size(8))) _m64u8;
+  _m64u8 __attribute__((aligned(16))) Mu8_0, __attribute__((aligned(16))) 
Mu8_1;
+  // CHECK: call x86_mmx asm "nop", "=y,0,~{dirflag},~{fpsr},~{flags}"(x86_mmx 
%1)
+  asm ("nop" : "=y"(Mu8_1 ) : "0"(Mu8_0 ));
+  return 0;
+}
Index: lib/CodeGen/CGStmt.cpp
===
--- lib/CodeGen/CGStmt.cpp
+++ lib/CodeGen/CGStmt.cpp
@@ -1932,6 +1932,9 @@
   std::vector InOutArgs;
   std::vector InOutArgTypes;
 
+  // Keep track of out constraints for tied input operand.
+  std::vector OutputConstraints;
+
   // An inline asm can be marked readonly if it meets the following conditions:
   //  - it doesn't have any sideeffects
   //  - it doesn't clobber memory
@@ -1954,7 +1957,7 @@
 OutputConstraint = AddVariableConstraints(OutputConstraint, *OutExpr,
   getTarget(), CGM, S,
   Info.earlyClobber());
-
+OutputConstraints.push_back(OutputConstraint);
 LValue Dest = EmitLValue(OutExpr);
 if (!Constraints.empty())
   Constraints += ',';
@@ -2072,6 +2075,7 @@
 InputConstraint, *InputExpr->IgnoreParenNoopCasts(getContext()),
 getTarget(), CGM, S, false /* No EarlyClobber */);
 
+std::string ReplaceConstraint (InputConstraint);
 llvm::Value *Arg = EmitAsmInput(Info, InputExpr, Constraints);
 
 // If this input argument is tied to a larger output result, extend the
@@ -2099,9 +2103,11 @@
   Arg = Builder.CreateFPExt(Arg, OutputTy);
 }
   }
+  // Deal with the tied operands' constraint code in adjustInlineAsmType.
+  ReplaceConstraint = OutputConstraints[Output];
 }
 if (llvm::Type* AdjTy =
-  getTargetHooks().adjustInlineAsmType(*this, InputConstraint,
+  getTargetHooks().adjustInlineAsmType(*this, ReplaceConstraint,
Arg->getType()))
   Arg = Builder.CreateBitCast(Arg, AdjTy);
 else


Index: test/CodeGen/asm-inout.c
===
--- test/CodeGen/asm-inout.c
+++ test/CodeGen/asm-inout.c
@@ -46,3 +46,12 @@
   asm ("pmulhuw %1, %0\n\t" : "+y" (__A) : "y" (__B));
   return __A;
 }
+
+// CHECK: @test6
+int test6(void) {
+  typedef unsigned char __attribute__((vector_size(8))) _m64u8;
+  _m64u8 __attribute__((aligned(16))) Mu8_0, __attribute__((aligned(16))) Mu8_1;
+  // CHECK: call x86_mmx asm "nop", "=y,0,~{dirflag},~{fpsr},~{flags}"(x86_mmx %1)
+  asm ("nop" : "=y"(Mu8_1 ) : "0"(Mu8_0 ));
+  return 0;
+}
Index: lib/CodeGen/CGStmt.cpp
===
--- lib/CodeGen/CGStmt.cpp
+++ lib/CodeGen/CGStmt.cpp
@@ -1932,6 +1932,9 @@
   std::vector InOutArgs;
   std::vector InOutArgTypes;
 
+  // Keep track of out constraints for tied input operand.
+  std::vector OutputConstraints;
+
   // An inline asm can be marked readonly if it meets the following conditions:
   //  - it doesn't have any sideeffects
   //  - it doesn't clobber memory
@@ -1954,7 +1957,7 @@
 OutputConstraint = AddVariableConstraints(OutputConstraint, *OutExpr,
   getTarget(), CGM, S,
   Info.earlyClobber());
-
+OutputConstraints.push_back(OutputConstraint);
 LValue Dest = EmitLValue(OutExpr);
 if (!Constraints.empty())
   Constraints += ',';
@@ -2072,6 +2075,7 @@
 InputConstraint, *InputExpr->IgnoreParenNoopCasts(getContext()),
 getTarget(), CGM, S, false /* No EarlyClobber */);
 
+std::string ReplaceConstraint (InputConstraint);
 llvm::Value *Arg = EmitAsmInput(Info, InputExpr, Constraints);
 
 // If this input argument is tied to a larger output result, extend the
@@ -2099,9 +2103,11 @@
   Arg = Builder.CreateFPExt(Arg, OutputTy);
 }
   }
+  // Deal with the tied operands' constraint code in adjustInlineAsmType.
+  ReplaceConstraint = OutputConstraints[Output];
 }
 if (llvm::Type* AdjTy =
-  getTargetHooks().adjustInlineAsmType(*this, InputConstraint,
+  getTargetHooks().adjustInlineAsmType(*this, ReplaceConstraint,
Arg->getType()))
   Arg = Builder.CreateBitCast(Arg, AdjTy);
 else
___

[PATCH] D56990: Bugfix for Replacement of tied operand of inline asm

2019-03-08 Thread Xiang Zhang via Phabricator via cfe-commits
xiangzhangllvm added a comment.

Thank you, efriedma
But but the LLVM and Clang are different projects, I can commit the change at 
one time.
I 'll update the patch for clang first.


Repository:
  rC Clang

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

https://reviews.llvm.org/D56990



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


[PATCH] D59127: [CMake] Support stripping and linking output to .build-id directory

2019-03-08 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC355765: [CMake] Support stripping and linking output to 
.build-id directory (authored by phosek, committed by ).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Changed prior to commit:
  https://reviews.llvm.org/D59127?vs=189949=189973#toc

Repository:
  rC Clang

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

https://reviews.llvm.org/D59127

Files:
  cmake/caches/Fuchsia-stage2.cmake


Index: cmake/caches/Fuchsia-stage2.cmake
===
--- cmake/caches/Fuchsia-stage2.cmake
+++ cmake/caches/Fuchsia-stage2.cmake
@@ -74,6 +74,9 @@
 set(RUNTIMES_${target}_SANITIZER_CXX_ABI "libc++" CACHE STRING "")
 set(RUNTIMES_${target}_SANITIZER_CXX_ABI_INTREE ON CACHE BOOL "")
 set(RUNTIMES_${target}_COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
+
+# Use .build-id link.
+list(APPEND RUNTIME_BUILD_ID_LINK "${target}")
   endif()
 endforeach()
 
@@ -126,6 +129,9 @@
 set(RUNTIMES_${target}-fuchsia_LIBCXX_HERMETIC_STATIC_LIBRARY ON CACHE 
BOOL "")
 
set(RUNTIMES_${target}-fuchsia_LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY OFF 
CACHE BOOL "")
 set(RUNTIMES_${target}-fuchsia_LIBCXX_ABI_VERSION 2 CACHE STRING "")
+
+# Use .build-id link.
+list(APPEND RUNTIME_BUILD_ID_LINK "${target}-fuchsia")
   endforeach()
 
   set(LLVM_RUNTIME_SANITIZERS "Address" CACHE STRING "")
@@ -134,6 +140,7 @@
 
 set(LLVM_BUILTIN_TARGETS "${BUILTIN_TARGETS}" CACHE STRING "")
 set(LLVM_RUNTIME_TARGETS "${RUNTIME_TARGETS}" CACHE STRING "")
+set(LLVM_RUNTIME_BUILD_ID_LINK_TARGETS "${RUNTIME_BUILD_ID_LINK}" CACHE STRING 
"")
 
 # Setup toolchain.
 set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")


Index: cmake/caches/Fuchsia-stage2.cmake
===
--- cmake/caches/Fuchsia-stage2.cmake
+++ cmake/caches/Fuchsia-stage2.cmake
@@ -74,6 +74,9 @@
 set(RUNTIMES_${target}_SANITIZER_CXX_ABI "libc++" CACHE STRING "")
 set(RUNTIMES_${target}_SANITIZER_CXX_ABI_INTREE ON CACHE BOOL "")
 set(RUNTIMES_${target}_COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
+
+# Use .build-id link.
+list(APPEND RUNTIME_BUILD_ID_LINK "${target}")
   endif()
 endforeach()
 
@@ -126,6 +129,9 @@
 set(RUNTIMES_${target}-fuchsia_LIBCXX_HERMETIC_STATIC_LIBRARY ON CACHE BOOL "")
 set(RUNTIMES_${target}-fuchsia_LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY OFF CACHE BOOL "")
 set(RUNTIMES_${target}-fuchsia_LIBCXX_ABI_VERSION 2 CACHE STRING "")
+
+# Use .build-id link.
+list(APPEND RUNTIME_BUILD_ID_LINK "${target}-fuchsia")
   endforeach()
 
   set(LLVM_RUNTIME_SANITIZERS "Address" CACHE STRING "")
@@ -134,6 +140,7 @@
 
 set(LLVM_BUILTIN_TARGETS "${BUILTIN_TARGETS}" CACHE STRING "")
 set(LLVM_RUNTIME_TARGETS "${RUNTIME_TARGETS}" CACHE STRING "")
+set(LLVM_RUNTIME_BUILD_ID_LINK_TARGETS "${RUNTIME_BUILD_ID_LINK}" CACHE STRING "")
 
 # Setup toolchain.
 set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D59168: [runtimes] Move libunwind, libc++abi and libc++ to lib/clang/ and include/

2019-03-08 Thread Petr Hosek via Phabricator via cfe-commits
phosek added inline comments.



Comment at: clang/test/Driver/linux-per-target-runtime-dir.c:15
 // CHECK-PER-TARGET-RUNTIME: "--sysroot=[[SYSROOT]]"
+// CHECK-PER-TARGET-RUNTIME: 
"-L{{.*}}{{/|}}..{{/|}}lib{{/|}}x86_64-linux-gnu"
 // CHECK-PER-TARGET-RUNTIME: 
"-L[[RESDIR]]{{/|}}x86_64-linux-gnu{{/|}}lib"

smeenai wrote:
> phosek wrote:
> > smeenai wrote:
> > > Shouldn't this have the `clang` component now?
> > I haven't changed the location of headers, only libraries. Do you think we 
> > should move libc++ headers into `clang` subdirectory inside `include` as 
> > well?
> This is `-L`, so it's the search path for the libraries, right?
Sorry about that, I was looking at a wrong line, you're right.


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

https://reviews.llvm.org/D59168



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


[PATCH] D59168: [runtimes] Move libunwind, libc++abi and libc++ to lib/clang/ and include/

2019-03-08 Thread Petr Hosek via Phabricator via cfe-commits
phosek updated this revision to Diff 189972.
phosek marked 2 inline comments as done.

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

https://reviews.llvm.org/D59168

Files:
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/Fuchsia.cpp
  clang/lib/Driver/ToolChains/Linux.cpp
  
clang/test/Driver/Inputs/basic_linux_libcxx_tree/usr/lib/clang/x86_64-linux-gnu/.keep
  
clang/test/Driver/Inputs/basic_linux_libcxx_tree/usr/lib/x86_64-linux-gnu/.keep
  clang/test/Driver/linux-per-target-runtime-dir.c
  libcxx/CMakeLists.txt
  libcxx/lib/CMakeLists.txt
  libcxxabi/CMakeLists.txt
  libcxxabi/src/CMakeLists.txt
  libunwind/CMakeLists.txt
  libunwind/src/CMakeLists.txt
  llvm/runtimes/CMakeLists.txt

Index: llvm/runtimes/CMakeLists.txt
===
--- llvm/runtimes/CMakeLists.txt
+++ llvm/runtimes/CMakeLists.txt
@@ -124,8 +124,8 @@
 string(REPLACE "-" "_" canon_name ${projName})
 string(TOUPPER ${canon_name} canon_name)
 
-if(LLVM_RUNTIMES_LIBDIR_SUFFIX)
-  set(${canon_name}_LIBDIR_SUFFIX "${LLVM_RUNTIMES_LIBDIR_SUFFIX}" CACHE STRING "" FORCE)
+if(LLVM_RUNTIMES_LIBDIR_SUBDIR)
+  set(${canon_name}_LIBDIR_SUBDIR "${LLVM_RUNTIMES_LIBDIR_SUBDIR}" CACHE STRING "" FORCE)
 endif()
 
 # Setting a variable to let sub-projects detect which other projects
@@ -349,6 +349,7 @@
  # Builtins were built separately above
  CMAKE_ARGS -DCOMPILER_RT_BUILD_BUILTINS=Off
 -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+-DLLVM_BINARY_DIR=${LLVM_BINARY_DIR}
 -DLLVM_LIBRARY_DIR=${LLVM_LIBRARY_DIR}
 -DLLVM_DEFAULT_TARGET_TRIPLE=${TARGET_TRIPLE}
 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
@@ -432,6 +433,7 @@
  # Builtins were built separately above
  CMAKE_ARGS -DCOMPILER_RT_BUILD_BUILTINS=Off
 -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+-DLLVM_BINARY_DIR=${LLVM_BINARY_DIR}
 -DLLVM_LIBRARY_DIR=${LLVM_LIBRARY_DIR}
 -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
@@ -514,8 +516,7 @@
   runtime_register_target(${name}-${sanitizer_name} ${name}
 DEPENDS runtimes-${name}
 CMAKE_ARGS -DLLVM_USE_SANITIZER=${sanitizer}
-   -DLLVM_RUNTIMES_PREFIX=${name}/
-   -DLLVM_RUNTIMES_LIBDIR_SUFFIX=/${sanitizer_name})
+   -DLLVM_RUNTIMES_LIBDIR_SUBDIR=${sanitizer_name})
   add_dependencies(runtimes runtimes-${name}-${sanitizer_name})
   add_dependencies(runtimes-configure runtimes-${name}-${sanitizer_name}-configure)
   add_dependencies(install-runtimes install-runtimes-${name}-${sanitizer_name})
Index: libunwind/src/CMakeLists.txt
===
--- libunwind/src/CMakeLists.txt
+++ libunwind/src/CMakeLists.txt
@@ -178,8 +178,8 @@
 
 if (LIBUNWIND_INSTALL_LIBRARY)
   install(TARGETS ${LIBUNWIND_INSTALL_TARGETS}
-LIBRARY DESTINATION ${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind
-ARCHIVE DESTINATION ${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind)
+LIBRARY DESTINATION ${LIBUNWIND_INSTALL_PREFIX}${LIBUNWIND_INSTALL_LIBRARY_DIR} COMPONENT unwind
+ARCHIVE DESTINATION ${LIBUNWIND_INSTALL_PREFIX}${LIBUNWIND_INSTALL_LIBRARY_DIR} COMPONENT unwind)
 endif()
 
 if (NOT CMAKE_CONFIGURATION_TYPES AND LIBUNWIND_INSTALL_LIBRARY)
Index: libunwind/CMakeLists.txt
===
--- libunwind/CMakeLists.txt
+++ libunwind/CMakeLists.txt
@@ -187,20 +187,25 @@
${PACKAGE_VERSION})
 
 if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
-  set(DEFAULT_INSTALL_PREFIX lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/${LLVM_DEFAULT_TARGET_TRIPLE}/)
-  set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/${LLVM_DEFAULT_TARGET_TRIPLE}/lib${LIBUNWIND_LIBDIR_SUFFIX})
+  set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${LLVM_DEFAULT_TARGET_TRIPLE}${LIBUNWIND_LIBDIR_SUBDIR})
+  set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/clang/${LLVM_DEFAULT_TARGET_TRIPLE})
+  if(LIBCXX_LIBDIR_SUBDIR)
+string(APPEND LIBUNWIND_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
+string(APPEND LIBUNWIND_INSTALL_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
+  endif()
 elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
   set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
+  set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX})
 

r355765 - [CMake] Support stripping and linking output to .build-id directory

2019-03-08 Thread Petr Hosek via cfe-commits
Author: phosek
Date: Fri Mar  8 17:26:55 2019
New Revision: 355765

URL: http://llvm.org/viewvc/llvm-project?rev=355765=rev
Log:
[CMake] Support stripping and linking output to .build-id directory

When installing runtimes with install-runtimes-stripped, we don't want
to just strip them, we also want to preserve the debugging information
for potential debugging. To make it possible to later find the stripped
debugging information, we want to use the .build-id layout:

https://fedoraproject.org/wiki/RolandMcGrath/BuildID#Find_files_by_build_ID

That is, for libfoo.so with build ID abcdef1234, the debugging information
will be installed into lib/debug/.build-id/ab/cdef1234. llvm-objcopy
already has support for stripping files and linking the debugging
stripped output into the right location. However, CMake doesn't support
customizing strip invocation for the *-stripped targets. So instead, we
replace CMAKE_STRIP with a custom script that invokes llvm-objcopy with
the right command line flags.

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

Modified:
cfe/trunk/cmake/caches/Fuchsia-stage2.cmake

Modified: cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/caches/Fuchsia-stage2.cmake?rev=355765=355764=355765=diff
==
--- cfe/trunk/cmake/caches/Fuchsia-stage2.cmake (original)
+++ cfe/trunk/cmake/caches/Fuchsia-stage2.cmake Fri Mar  8 17:26:55 2019
@@ -74,6 +74,9 @@ foreach(target aarch64-linux-gnu;armv7-l
 set(RUNTIMES_${target}_SANITIZER_CXX_ABI "libc++" CACHE STRING "")
 set(RUNTIMES_${target}_SANITIZER_CXX_ABI_INTREE ON CACHE BOOL "")
 set(RUNTIMES_${target}_COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
+
+# Use .build-id link.
+list(APPEND RUNTIME_BUILD_ID_LINK "${target}")
   endif()
 endforeach()
 
@@ -126,6 +129,9 @@ if(FUCHSIA_SDK)
 set(RUNTIMES_${target}-fuchsia_LIBCXX_HERMETIC_STATIC_LIBRARY ON CACHE 
BOOL "")
 
set(RUNTIMES_${target}-fuchsia_LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY OFF 
CACHE BOOL "")
 set(RUNTIMES_${target}-fuchsia_LIBCXX_ABI_VERSION 2 CACHE STRING "")
+
+# Use .build-id link.
+list(APPEND RUNTIME_BUILD_ID_LINK "${target}-fuchsia")
   endforeach()
 
   set(LLVM_RUNTIME_SANITIZERS "Address" CACHE STRING "")
@@ -134,6 +140,7 @@ endif()
 
 set(LLVM_BUILTIN_TARGETS "${BUILTIN_TARGETS}" CACHE STRING "")
 set(LLVM_RUNTIME_TARGETS "${RUNTIME_TARGETS}" CACHE STRING "")
+set(LLVM_RUNTIME_BUILD_ID_LINK_TARGETS "${RUNTIME_BUILD_ID_LINK}" CACHE STRING 
"")
 
 # Setup toolchain.
 set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")


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


[PATCH] D59168: [runtimes] Move libunwind, libc++abi and libc++ to lib/clang/ and include/

2019-03-08 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added inline comments.



Comment at: clang/test/Driver/linux-per-target-runtime-dir.c:15
 // CHECK-PER-TARGET-RUNTIME: "--sysroot=[[SYSROOT]]"
+// CHECK-PER-TARGET-RUNTIME: 
"-L{{.*}}{{/|}}..{{/|}}lib{{/|}}x86_64-linux-gnu"
 // CHECK-PER-TARGET-RUNTIME: 
"-L[[RESDIR]]{{/|}}x86_64-linux-gnu{{/|}}lib"

phosek wrote:
> smeenai wrote:
> > Shouldn't this have the `clang` component now?
> I haven't changed the location of headers, only libraries. Do you think we 
> should move libc++ headers into `clang` subdirectory inside `include` as well?
This is `-L`, so it's the search path for the libraries, right?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59168



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


[PATCH] D59168: [runtimes] Move libunwind, libc++abi and libc++ to lib/clang/ and include/

2019-03-08 Thread Petr Hosek via Phabricator via cfe-commits
phosek marked an inline comment as done.
phosek added inline comments.



Comment at: clang/test/Driver/linux-per-target-runtime-dir.c:15
 // CHECK-PER-TARGET-RUNTIME: "--sysroot=[[SYSROOT]]"
+// CHECK-PER-TARGET-RUNTIME: 
"-L{{.*}}{{/|}}..{{/|}}lib{{/|}}x86_64-linux-gnu"
 // CHECK-PER-TARGET-RUNTIME: 
"-L[[RESDIR]]{{/|}}x86_64-linux-gnu{{/|}}lib"

smeenai wrote:
> Shouldn't this have the `clang` component now?
I haven't changed the location of headers, only libraries. Do you think we 
should move libc++ headers into `clang` subdirectory inside `include` as well?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59168



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


[PATCH] D59168: [runtimes] Move libunwind, libc++abi and libc++ to lib/clang/ and include/

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

The layout currently looks as follows:

  compiler-rt:
headers: $prefix/lib/clang/$version/include
libraries: $prefix/lib/clang/$version/$triple/lib/$name.$ext
  
  libc++, libc++abi, libunwind:
headers: $prefix/include/c++/v1
libraries: $prefix/lib/clang/$triple/$name.$ext

So if we take `x86_64-linux-gnu` as an example target, it'd be:

  include/c++/v1
  lib/clang/x86_64-linux-gnu/{libc++.so,libc++abi.so,libunwind.so}
  lib/clang/9.0.0/x86_64-linux-gnu/lib/libclang_rt.builtins.a

I'm not super enthusiastic about the duplicated triple, but the only way to 
eliminate it would be to move the Clang resource directory inside of 
`lib/clang/x86_64-linux-gnu`, i.e. we'd have 
`lib/clang/x86_64-linux-gnu/9.0.0/{include,lib}`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59168



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


[PATCH] D59168: [runtimes] Move libunwind, libc++abi and libc++ to lib/clang/ and include/

2019-03-08 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added inline comments.



Comment at: clang/test/Driver/linux-per-target-runtime-dir.c:15
 // CHECK-PER-TARGET-RUNTIME: "--sysroot=[[SYSROOT]]"
+// CHECK-PER-TARGET-RUNTIME: 
"-L{{.*}}{{/|}}..{{/|}}lib{{/|}}x86_64-linux-gnu"
 // CHECK-PER-TARGET-RUNTIME: 
"-L[[RESDIR]]{{/|}}x86_64-linux-gnu{{/|}}lib"

Shouldn't this have the `clang` component now?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59168



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


[PATCH] D59168: [runtimes] Move libunwind, libc++abi and libc++ to lib/clang/ and include/

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

This is a reland of D59013 , apart from fixing 
the failing test on Windows, it also changes one thing where libraries are 
installed in `lib/clang/` rather than `lib/` based on the 
discussion in "RFC: Place libs in Clang-dedicated directories (affects openmp, 
libcxx, libunwind, compiler-rt)".
"


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59168



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


[PATCH] D59168: [runtimes] Move libunwind, libc++abi and libc++ to lib/clang/ and include/

2019-03-08 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added reviewers: smeenai, beanz, jdenny.
Herald added subscribers: llvm-commits, libcxx-commits, cfe-commits, jdoerfert, 
kadircet, christof, ioeric, ilya-biryukov, mgorny.
Herald added a reviewer: EricWF.
Herald added projects: clang, libc++, LLVM.

This change is a consequence of the discussion in "RFC: Place libs in
Clang-dedicated directories", specifically the suggestion that
libunwind, libc++abi and libc++ shouldn't be using Clang resource
directory.  Tools like clangd make this assumption, but this is
currently not true for the LLVM_ENABLE_PER_TARGET_RUNTIME_DIR build.
This change addresses that by moving the output of these libraries to
lib/clang/ and include/ directories, leaving resource directory only
for compiler-rt runtimes and Clang builtin headers.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D59168

Files:
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/Fuchsia.cpp
  clang/lib/Driver/ToolChains/Linux.cpp
  
clang/test/Driver/Inputs/basic_linux_libcxx_tree/usr/lib/clang/x86_64-linux-gnu/.keep
  
clang/test/Driver/Inputs/basic_linux_libcxx_tree/usr/lib/x86_64-linux-gnu/.keep
  clang/test/Driver/linux-per-target-runtime-dir.c
  libcxx/CMakeLists.txt
  libcxx/lib/CMakeLists.txt
  libcxxabi/CMakeLists.txt
  libcxxabi/src/CMakeLists.txt
  libunwind/CMakeLists.txt
  libunwind/src/CMakeLists.txt
  llvm/runtimes/CMakeLists.txt

Index: llvm/runtimes/CMakeLists.txt
===
--- llvm/runtimes/CMakeLists.txt
+++ llvm/runtimes/CMakeLists.txt
@@ -124,8 +124,8 @@
 string(REPLACE "-" "_" canon_name ${projName})
 string(TOUPPER ${canon_name} canon_name)
 
-if(LLVM_RUNTIMES_LIBDIR_SUFFIX)
-  set(${canon_name}_LIBDIR_SUFFIX "${LLVM_RUNTIMES_LIBDIR_SUFFIX}" CACHE STRING "" FORCE)
+if(LLVM_RUNTIMES_LIBDIR_SUBDIR)
+  set(${canon_name}_LIBDIR_SUBDIR "${LLVM_RUNTIMES_LIBDIR_SUBDIR}" CACHE STRING "" FORCE)
 endif()
 
 # Setting a variable to let sub-projects detect which other projects
@@ -349,6 +349,7 @@
  # Builtins were built separately above
  CMAKE_ARGS -DCOMPILER_RT_BUILD_BUILTINS=Off
 -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+-DLLVM_BINARY_DIR=${LLVM_BINARY_DIR}
 -DLLVM_LIBRARY_DIR=${LLVM_LIBRARY_DIR}
 -DLLVM_DEFAULT_TARGET_TRIPLE=${TARGET_TRIPLE}
 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
@@ -432,6 +433,7 @@
  # Builtins were built separately above
  CMAKE_ARGS -DCOMPILER_RT_BUILD_BUILTINS=Off
 -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+-DLLVM_BINARY_DIR=${LLVM_BINARY_DIR}
 -DLLVM_LIBRARY_DIR=${LLVM_LIBRARY_DIR}
 -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
@@ -514,8 +516,7 @@
   runtime_register_target(${name}-${sanitizer_name} ${name}
 DEPENDS runtimes-${name}
 CMAKE_ARGS -DLLVM_USE_SANITIZER=${sanitizer}
-   -DLLVM_RUNTIMES_PREFIX=${name}/
-   -DLLVM_RUNTIMES_LIBDIR_SUFFIX=/${sanitizer_name})
+   -DLLVM_RUNTIMES_LIBDIR_SUBDIR=${sanitizer_name})
   add_dependencies(runtimes runtimes-${name}-${sanitizer_name})
   add_dependencies(runtimes-configure runtimes-${name}-${sanitizer_name}-configure)
   add_dependencies(install-runtimes install-runtimes-${name}-${sanitizer_name})
Index: libunwind/src/CMakeLists.txt
===
--- libunwind/src/CMakeLists.txt
+++ libunwind/src/CMakeLists.txt
@@ -178,8 +178,8 @@
 
 if (LIBUNWIND_INSTALL_LIBRARY)
   install(TARGETS ${LIBUNWIND_INSTALL_TARGETS}
-LIBRARY DESTINATION ${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind
-ARCHIVE DESTINATION ${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind)
+LIBRARY DESTINATION ${LIBUNWIND_INSTALL_PREFIX}${LIBUNWIND_INSTALL_LIBRARY_DIR} COMPONENT unwind
+ARCHIVE DESTINATION ${LIBUNWIND_INSTALL_PREFIX}${LIBUNWIND_INSTALL_LIBRARY_DIR} COMPONENT unwind)
 endif()
 
 if (NOT CMAKE_CONFIGURATION_TYPES AND LIBUNWIND_INSTALL_LIBRARY)
Index: libunwind/CMakeLists.txt
===
--- libunwind/CMakeLists.txt
+++ libunwind/CMakeLists.txt
@@ -187,20 +187,25 @@
${PACKAGE_VERSION})
 
 if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
-  set(DEFAULT_INSTALL_PREFIX lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/${LLVM_DEFAULT_TARGET_TRIPLE}/)
-  

[PATCH] D47344: LWG 2843 "Unclear behavior of std::pmr::memory_resource::do_allocate()"

2019-03-08 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF closed this revision.
EricWF added a comment.

Committed as rr355763


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

https://reviews.llvm.org/D47344



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


[PATCH] D58367: [analyzer] NFC: Improve upon the concept of BugReporterVisitor.

2019-03-08 Thread Csaba Dabis via Phabricator via cfe-commits
Charusso added a comment.

In D58367#1423451 , @NoQ wrote:

> Found a bug! The lambda has to manually make sure that the bug report 
> actually does have something to do with the checker.


I think message-semantic is better than storing some data in two places. 
BugReport has `getCheckName()` and may if the `NoteTag` knows the name of its 
author then it is comparable.
I am not sure but may you could hack the lifetime of that `StringRef` from 
`CheckName` to not to report on something purged out (/not exists?).


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

https://reviews.llvm.org/D58367



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


[PATCH] D47344: LWG 2843 "Unclear behavior of std::pmr::memory_resource::do_allocate()"

2019-03-08 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone added a comment.

In D47344#1423466 , @EricWF wrote:

> @Quuxplusone Since the LLVM license has changed since you created this, I 
> need you to confirm that you accept LLVM's new license.


Yes, I accept LLVM's new license.


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

https://reviews.llvm.org/D47344



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


[PATCH] D47344: LWG 2843 "Unclear behavior of std::pmr::memory_resource::do_allocate()"

2019-03-08 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

@Quuxplusone Since the LLVM license has changed since you created this, I need 
you to confirm that you accept LLVM's new license.


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

https://reviews.llvm.org/D47344



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


[PATCH] D58317: [clang] Add install targets for API headers

2019-03-08 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:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D58317



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


[PATCH] D58317: [clang] Add install targets for API headers

2019-03-08 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added a comment.

Ping (although I'm not planning to land this until Monday).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D58317



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


[PATCH] D58367: [analyzer] NFC: Improve upon the concept of BugReporterVisitor.

2019-03-08 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ updated this revision to Diff 189948.
NoQ added a comment.

Found a bug! The lambda has to manually make sure that the bug report actually 
does have something to do with the checker. The attached testcase shows that we 
definitely need to avoid attaching a MIG checker note to a core.DivideZero bug 
report. I stuffed a check into the lambda to demonstrate what sort of logic do 
we need to avoid this problem:

  if (() != )
return "";

But of course i'd much rather automate that because most checkers will need 
this sort of logic and because it looks really ugly and is very easy to forget. 
My best idea so far, for the next patch, is to store a pointer to the `Checker` 
object in both the note and the bug report and automatically compare them in 
`TagVisitor` before even trying to emit a note. Such check should probably be 
optional, because otherwise only checkers would be able to use note tags, while 
i still want the Core to be able to use it as well.


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

https://reviews.llvm.org/D58367

Files:
  clang/include/clang/Analysis/ProgramPoint.h
  clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
  clang/lib/StaticAnalyzer/Checkers/MIGChecker.cpp
  clang/lib/StaticAnalyzer/Core/BugReporter.cpp
  clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
  clang/test/Analysis/mig.mm

Index: clang/test/Analysis/mig.mm
===
--- clang/test/Analysis/mig.mm
+++ clang/test/Analysis/mig.mm
@@ -91,6 +91,14 @@
  // expected-note@-1{{MIG callback fails with error after deallocating argument value. This is a use-after-free vulnerability because the caller will try to deallocate it again}}
 }
 
+MIG_SERVER_ROUTINE
+kern_return_t no_unrelated_notes(mach_port_name_t port, vm_address_t address, vm_size_t size) {
+  vm_deallocate(port, address, size); // no-note
+  1 / 0; // expected-warning{{Division by zero}}
+ // expected-note@-1{{Division by zero}}
+  return KERN_SUCCESS;
+}
+
 // Make sure we find the bug when the object is destroyed within an
 // automatic destructor.
 MIG_SERVER_ROUTINE
Index: clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
===
--- clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -2496,6 +2496,30 @@
   return nullptr;
 }
 
+int NoteTag::Kind = 0;
+
+void TagVisitor::Profile(llvm::FoldingSetNodeID ) const {
+  static int Tag = 0;
+  ID.AddPointer();
+}
+
+std::shared_ptr
+TagVisitor::VisitNode(const ExplodedNode *N, BugReporterContext ,
+  BugReport ) {
+  ProgramPoint PP = N->getLocation();
+  const NoteTag *T = dyn_cast_or_null(PP.getTag());
+  if (!T)
+return nullptr;
+
+  if (Optional Msg = T->generateMessage(BRC, R)) {
+PathDiagnosticLocation Loc =
+PathDiagnosticLocation::create(PP, BRC.getSourceManager());
+return std::make_shared(Loc, *Msg);
+  }
+
+  return nullptr;
+}
+
 void FalsePositiveRefutationBRVisitor::Profile(
 llvm::FoldingSetNodeID ) const {
   static int Tag = 0;
Index: clang/lib/StaticAnalyzer/Core/BugReporter.cpp
===
--- clang/lib/StaticAnalyzer/Core/BugReporter.cpp
+++ clang/lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -2612,6 +2612,7 @@
 R->addVisitor(llvm::make_unique());
 R->addVisitor(llvm::make_unique());
 R->addVisitor(llvm::make_unique());
+R->addVisitor(llvm::make_unique());
 
 BugReporterContext BRC(Reporter, ErrorGraph.BackMap);
 
Index: clang/lib/StaticAnalyzer/Checkers/MIGChecker.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/MIGChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/MIGChecker.cpp
@@ -80,43 +80,10 @@
 checkReturnAux(RS, C);
   }
 
-  class Visitor : public BugReporterVisitor {
-  public:
-void Profile(llvm::FoldingSetNodeID ) const {
-  static int X = 0;
-  ID.AddPointer();
-}
-
-std::shared_ptr VisitNode(const ExplodedNode *N,
-BugReporterContext , BugReport );
-  };
 };
 } // end anonymous namespace
 
-// FIXME: It's a 'const ParmVarDecl *' but there's no ready-made GDM traits
-// specialization for this sort of types.
-REGISTER_TRAIT_WITH_PROGRAMSTATE(ReleasedParameter, const void *)
-
-std::shared_ptr
-MIGChecker::Visitor::VisitNode(const ExplodedNode *N, BugReporterContext ,
-   BugReport ) {
-  const auto *NewPVD = static_cast(
-  N->getState()->get());
-  const auto *OldPVD = static_cast(
-  N->getFirstPred()->getState()->get());
-  if (OldPVD == NewPVD)
-return nullptr;
-
-  assert(NewPVD && "What is deallocated cannot be un-deallocated!");

[PATCH] D59038: [8.0 Regression] Fix handling of `__builtin_constant_p` inside template arguments, enumerators, case statements, and the enable_if attribute.

2019-03-08 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment.

In D59038#1422905 , @hans wrote:

> In D59038#1422890 , @rsmith wrote:
>
> > LGTM, and I think this is safe enough to take for Clang 8.
>
>
> Do you think the severity is high enough to spin another release candidate?


Given that the regression breaks both libstdc++ >=7 and abseil, I'm inclined to 
say yes. (Either that or we should aim to release a fixed 7.0.1 as soon as 
feasible after 7).


Repository:
  rC Clang

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

https://reviews.llvm.org/D59038



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


[PATCH] D59048: Add AIX Target Info

2019-03-08 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added inline comments.



Comment at: clang/lib/Basic/Targets/OSTargets.h:640
+
+// Define _WCHAR_T when it is a fundamental type (i.e., for C++ without 
-fno-wchar).
+if (Opts.CPlusPlus && Opts.WChar) {

Line is longer than 80 characters. Please split it.



Comment at: clang/test/CodeGen/arm-aapcs-zerolength-bitfield.c:1
 // REQUIRES: arm-registered-target
 // RUN: %clang_cc1 -target-abi aapcs -triple armv7-apple-darwin10 %s -verify

Given the requirement for `arm-registered-target`, is the file actually run 
whenever we intend it to be? Also, a note re: the existing test: This does not 
seem to be a CodeGen test; indeed, it is effective even with `-fsyntax-only`. 
It seems this should be moved to `clang/test/Sema`.

However, not all of the cases are common anyway. We will later need to post 
changes that implement AIX's 4-byte storage units for bit-fields. I think we 
should leave this file alone for the purposes of this patch.



Comment at: clang/test/Preprocessor/init.c:7027
+// PPC-AIX:#define _IBMR2 1
+// PPC-AIX:#define _LONG_LONG 1
+// PPC-AIX:#define _POWER 1

Add a check that `_LP64` is not defined under the 32-bit mode. Similarly for 
`__LP64__` and `__64BIT__`. Other targets also check for the presence or 
absence of `_ILP32` and `__ILP32__`, so we probably should do the same.


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

https://reviews.llvm.org/D59048



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


[PATCH] D55170: [clang-format]: Add NonEmptyParentheses spacing option

2019-03-08 Thread Reuben Thomas via Phabricator via cfe-commits
reuk updated this revision to Diff 189942.
reuk added a comment.

I've rebased onto master, and removed unrelated formatting changes. I've also 
tried to remove some of the duplicate parens-related expressions.

I agree that the heavy nested boolean expressions are a bit painful to read, 
but I'm not sure whether a more general tidy-up falls within the scope of this 
PR.


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

https://reviews.llvm.org/D55170

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

Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -9296,6 +9296,60 @@
   verifyFormat("T A::operator() ();", Space);
   verifyFormat("X A::operator++ (T);", Space);
   verifyFormat("auto lambda = [] () { return 0; };", Space);
+  verifyFormat("int x = int (y);", Space);
+
+  FormatStyle SomeSpace = getLLVMStyle();
+  SomeSpace.SpaceBeforeParens = FormatStyle::SBPO_NonEmptyParentheses;
+
+  verifyFormat("[]() -> float {}", SomeSpace);
+  verifyFormat("[] (auto foo) {}", SomeSpace);
+  verifyFormat("[foo]() -> int {}", SomeSpace);
+  verifyFormat("int f();", SomeSpace);
+  verifyFormat("void f (int a, T b) {\n"
+   "  while (true)\n"
+   "continue;\n"
+   "}",
+   SomeSpace);
+  verifyFormat("if (true)\n"
+   "  f();\n"
+   "else if (true)\n"
+   "  f();",
+   SomeSpace);
+  verifyFormat("do {\n"
+   "  do_something();\n"
+   "} while (something());",
+   SomeSpace);
+  verifyFormat("switch (x) {\n"
+   "default:\n"
+   "  break;\n"
+   "}",
+   SomeSpace);
+  verifyFormat("A::A() : a (1) {}", SomeSpace);
+  verifyFormat("void f() __attribute__ ((asdf));", SomeSpace);
+  verifyFormat("*( + 1);\n"
+   "&(()[1]);\n"
+   "a[(b + c) * d];\n"
+   "(((a + 1) * 2) + 3) * 4;",
+   SomeSpace);
+  verifyFormat("#define A(x) x", SomeSpace);
+  verifyFormat("#define A (x) x", SomeSpace);
+  verifyFormat("#if defined(x)\n"
+   "#endif",
+   SomeSpace);
+  verifyFormat("auto i = std::make_unique (5);", SomeSpace);
+  verifyFormat("size_t x = sizeof (x);", SomeSpace);
+  verifyFormat("auto f (int x) -> decltype (x);", SomeSpace);
+  verifyFormat("int f (T x) noexcept (x.create());", SomeSpace);
+  verifyFormat("alignas (128) char a[128];", SomeSpace);
+  verifyFormat("size_t x = alignof (MyType);", SomeSpace);
+  verifyFormat("static_assert (sizeof (char) == 1, \"Impossible!\");",
+   SomeSpace);
+  verifyFormat("int f() throw (Deprecated);", SomeSpace);
+  verifyFormat("typedef void (*cb) (int);", SomeSpace);
+  verifyFormat("T A::operator()();", SomeSpace);
+  verifyFormat("X A::operator++ (T);", SomeSpace);
+  verifyFormat("int x = int (y);", SomeSpace);
+  verifyFormat("auto lambda = []() { return 0; };", SomeSpace);
 }
 
 TEST_F(FormatTest, ConfigurableSpacesInParentheses) {
@@ -11080,6 +11134,8 @@
   FormatStyle::SBPO_Always);
   CHECK_PARSE("SpaceBeforeParens: ControlStatements", SpaceBeforeParens,
   FormatStyle::SBPO_ControlStatements);
+  CHECK_PARSE("SpaceBeforeParens: NonEmptyParentheses", SpaceBeforeParens,
+  FormatStyle::SBPO_NonEmptyParentheses);
   // For backward compatibility:
   CHECK_PARSE("SpaceAfterControlStatementKeyword: false", SpaceBeforeParens,
   FormatStyle::SBPO_Never);
Index: lib/Format/TokenAnnotator.h
===
--- lib/Format/TokenAnnotator.h
+++ lib/Format/TokenAnnotator.h
@@ -164,6 +164,8 @@
   unsigned splitPenalty(const AnnotatedLine , const FormatToken ,
 bool InFunctionDecl);
 
+  bool spaceRequiredBeforeParens(const FormatToken ) const;
+
   bool spaceRequiredBetween(const AnnotatedLine , const FormatToken ,
 const FormatToken );
 
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -2400,6 +2400,12 @@
   return 3;
 }
 
+bool TokenAnnotator::spaceRequiredBeforeParens(const FormatToken ) const {
+  return Style.SpaceBeforeParens == FormatStyle::SBPO_Always ||
+ (Style.SpaceBeforeParens == FormatStyle::SBPO_NonEmptyParentheses &&
+  Right.ParameterCount > 0);
+}
+
 bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine ,
   const FormatToken ,
   const FormatToken ) {
@@ -2539,19 +2545,19 @@
   return true;
 return Line.Type == LT_ObjCDecl || Left.is(tok::semi) ||

[RFC 09/12] Implement record field randomization algorithms

2019-03-08 Thread Connor Kuehl via cfe-commits
Co-authored-by: Cole Nixon 
Co-authored-by: Connor Kuehl 
Co-authored-by: James Foster 
Co-authored-by: Jeff Takahashi 
Co-authored-by: Jordan Cantrell 
Co-authored-by: Nikk Forbus 
Co-authored-by: Tim Pugh 
---
 clang/include/clang/AST/DeclBase.h|   2 +
 .../clang/AST/RecordFieldReorganizer.h|  59 +
 clang/lib/AST/RecordFieldReorganizer.cpp  | 238 ++
 3 files changed, 299 insertions(+)
 create mode 100644 clang/include/clang/AST/RecordFieldReorganizer.h

diff --git a/clang/include/clang/AST/DeclBase.h 
b/clang/include/clang/AST/DeclBase.h
index 4b63e540d5d..b08acadc9ff 100644
--- a/clang/include/clang/AST/DeclBase.h
+++ b/clang/include/clang/AST/DeclBase.h
@@ -1270,6 +1270,8 @@ class DeclContext {
   friend class ExternalASTSource;
   /// For CreateStoredDeclsMap
   friend class DependentDiagnostic;
+  /// For fine-grained control of field order
+  friend class RecordFieldReorganizer;
   /// For hasNeedToReconcileExternalVisibleStorage,
   /// hasLazyLocalLexicalLookups, hasLazyExternalLexicalLookups
   friend class ASTWriter;
diff --git a/clang/include/clang/AST/RecordFieldReorganizer.h 
b/clang/include/clang/AST/RecordFieldReorganizer.h
new file mode 100644
index 000..fa29014348f
--- /dev/null
+++ b/clang/include/clang/AST/RecordFieldReorganizer.h
@@ -0,0 +1,59 @@
+//===-- RecordFieldReorganizer.h - Interface for manipulating field order --*-
+// 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
+//
+//===--===//
+//
+// This header file contains the base class that defines an interface for
+// manipulating a RecordDecl's field layouts.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_LIB_AST_RECORDFIELDREORGANIZER_H
+#define LLVM_CLANG_LIB_AST_RECORDFIELDREORGANIZER_H
+
+#include "Decl.h"
+#include 
+
+namespace clang {
+
+// FIXME: Find a better alternative to SmallVector with hardcoded size!
+
+class RecordFieldReorganizer {
+public:
+  virtual ~RecordFieldReorganizer() = default;
+  void reorganizeFields(const ASTContext , const RecordDecl *D);
+
+protected:
+  virtual void reorganize(const ASTContext , const RecordDecl *D,
+  SmallVector ) = 0;
+
+private:
+  void commit(const RecordDecl *D,
+  SmallVectorImpl ) const;
+};
+
+class Randstruct : public RecordFieldReorganizer {
+public:
+  Randstruct(std::string seed) : Seq(seed.begin(), seed.end()), rng(Seq) {}
+
+  /// Determines if the Record can be safely and easily randomized based on 
certain criteria (see implementation).
+  static bool isTriviallyRandomizable(const RecordDecl *D);
+protected:
+  SmallVector randomize(SmallVector fields);
+  SmallVector perfrandomize(const ASTContext ,
+  SmallVector fields);
+  virtual void reorganize(const ASTContext , const RecordDecl *D,
+  SmallVector ) override;
+private:
+  std::seed_seq Seq;
+  std::default_random_engine rng;
+};
+
+} // namespace clang
+
+#endif
diff --git a/clang/lib/AST/RecordFieldReorganizer.cpp 
b/clang/lib/AST/RecordFieldReorganizer.cpp
index c7ab9cd16d4..a37490d5784 100644
--- a/clang/lib/AST/RecordFieldReorganizer.cpp
+++ b/clang/lib/AST/RecordFieldReorganizer.cpp
@@ -11,9 +11,247 @@
 //
 
//===--===//
 
+#include "clang/AST/RecordFieldReorganizer.h"
+#include "clang/AST/ASTContext.h"
 #include "clang/AST/RandstructSeed.h"
 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+// FIXME: Find a better alternative to SmallVector with hardcoded size!
+
 namespace clang {
 std::string RandstructSeed = "";
 bool RandstructAutoSelect = false;
+
+void RecordFieldReorganizer::reorganizeFields(const ASTContext ,
+  const RecordDecl *D) {
+  // Save original fields for asserting later that a subclass hasn't
+  // sabotaged the RecordDecl by removing or adding fields
+  std::set mutateGuard;
+
+  SmallVector fields;
+  for (auto f : D->fields()) {
+mutateGuard.insert(f);
+fields.push_back(f);
+  }
+  // Now allow subclass implementations to reorder the fields
+  reorganize(C, D, fields);
+
+  // Assert all fields are still present
+  assert(mutateGuard.size() == fields.size() &&
+ "Field count altered after reorganization");
+  for (auto f : fields) {
+auto found = std::find(std::begin(mutateGuard), std::end(mutateGuard), f);
+assert(found != std::end(mutateGuard) &&
+   "Unknown field encountered after reorganization");
+  }
+
+  commit(D, fields);
+}
+void RecordFieldReorganizer::commit(
+const RecordDecl *D, SmallVectorImpl ) const {
+  Decl *First, *Last;
+  std::tie(First, Last) = 

[RFC 10/12] Fix: Set tail pointer to null in field list

2019-03-08 Thread Connor Kuehl via cfe-commits
Co-authored-by: Cole Nixon 
Co-authored-by: Connor Kuehl 
Co-authored-by: James Foster 
Co-authored-by: Jeff Takahashi 
Co-authored-by: Jordan Cantrell 
Co-authored-by: Nikk Forbus 
Co-authored-by: Tim Pugh 
---
 clang/lib/AST/DeclBase.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp
index e1b5161b027..2694d596755 100644
--- a/clang/lib/AST/DeclBase.cpp
+++ b/clang/lib/AST/DeclBase.cpp
@@ -1258,6 +1258,9 @@ DeclContext::BuildDeclChain(ArrayRef Decls,
 PrevDecl = D;
   }
 
+  // The last one in the chain should have a null next!
+  PrevDecl->NextInContextAndBits.setPointer(nullptr);
+
   return std::make_pair(FirstNewDecl, PrevDecl);
 }
 
-- 
2.17.1

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


[RFC 12/12] Wire up Randstruct; intercept and randomize

2019-03-08 Thread Connor Kuehl via cfe-commits
Co-authored-by: Cole Nixon 
Co-authored-by: Connor Kuehl 
Co-authored-by: James Foster 
Co-authored-by: Jeff Takahashi 
Co-authored-by: Jordan Cantrell 
Co-authored-by: Nikk Forbus 
Co-authored-by: Tim Pugh 
---
 clang/lib/AST/RecordLayoutBuilder.cpp | 20 
 1 file changed, 20 insertions(+)

diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp 
b/clang/lib/AST/RecordLayoutBuilder.cpp
index 99b7cbd0224..4bdf467db4d 100644
--- a/clang/lib/AST/RecordLayoutBuilder.cpp
+++ b/clang/lib/AST/RecordLayoutBuilder.cpp
@@ -6,6 +6,7 @@
 //
 
//===--===//
 
+#include "clang/AST/RandstructSeed.h"
 #include "clang/AST/RecordLayout.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/ASTDiagnostic.h"
@@ -15,6 +16,7 @@
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclObjC.h"
 #include "clang/AST/Expr.h"
+#include "clang/AST/RecordFieldReorganizer.h"
 #include "clang/Basic/TargetInfo.h"
 #include "llvm/ADT/SmallSet.h"
 #include "llvm/Support/Format.h"
@@ -2984,6 +2986,24 @@ ASTContext::getASTRecordLayout(const RecordDecl *D) 
const {
 
   const ASTRecordLayout *NewEntry = nullptr;
 
+  bool ShouldBeRandomized = D->getAttr() != nullptr;
+  bool NotToBeRandomized = D->getAttr() != nullptr;
+  bool AutoSelectable = RandstructAutoSelect && 
Randstruct::isTriviallyRandomizable(D);
+
+  if (ShouldBeRandomized && NotToBeRandomized) {
+getDiagnostics().Report(D->getLocation(), 
diag::warn_randomize_attr_conflict);
+  }
+
+  if (ShouldBeRandomized && D->isUnion()) {
+  getDiagnostics().Report(D->getLocation(), 
diag::warn_randomize_attr_union);
+  NotToBeRandomized = true;
+  }
+
+  if (!NotToBeRandomized && (ShouldBeRandomized || AutoSelectable)) {
+Randstruct randstruct(RandstructSeed);
+randstruct.reorganizeFields(*this,D);
+  }
+
   if (isMsLayout(*this)) {
 MicrosoftRecordLayoutBuilder Builder(*this);
 if (const auto *RD = dyn_cast(D)) {
-- 
2.17.1

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


[RFC 08/12] Add automatic structure selection compiler switch

2019-03-08 Thread Connor Kuehl via cfe-commits
This compiler switch allows the Randstruct feature to automatically
select structures to randomize even if they're not decorated with
the randomize_layout attribute. Structures can "opt out" of selection
by using the no_randomize_layout attribute while this feature is
active.

Co-authored-by: Cole Nixon 
Co-authored-by: Connor Kuehl 
Co-authored-by: James Foster 
Co-authored-by: Jeff Takahashi 
Co-authored-by: Jordan Cantrell 
Co-authored-by: Nikk Forbus 
Co-authored-by: Tim Pugh 
---
 clang/include/clang/Driver/Options.td | 3 +++
 clang/lib/Driver/ToolChains/Clang.cpp | 4 
 clang/lib/Frontend/CompilerInvocation.cpp | 3 +++
 3 files changed, 10 insertions(+)

diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 735ec11e221..33bc2e1bb58 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1760,6 +1760,9 @@ def freroll_loops : Flag<["-"], "freroll-loops">, 
Group,
   HelpText<"Turn on loop reroller">, Flags<[CC1Option]>;
 def fno_reroll_loops : Flag<["-"], "fno-reroll-loops">, Group,
   HelpText<"Turn off loop reroller">;
+def randstruct_auto : Flag<["-"], "randstruct-auto">,
+  HelpText<"Enable automatic structure selection for field randomization; "
+   "Disable for specific structures with attribute 
no_randomize_layout">, Flags<[CC1Option]>;
 def ftrigraphs : Flag<["-"], "ftrigraphs">, Group,
   HelpText<"Process trigraph sequences">, Flags<[CC1Option]>;
 def fno_trigraphs : Flag<["-"], "fno-trigraphs">, Group,
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 52daed9fe36..bfc383b8d78 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -4433,6 +4433,10 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
 CmdArgs.push_back(A->getValue(0));
   }
 
+  if (Arg *A = Args.getLastArg(options::OPT_randstruct_auto)) {
+CmdArgs.push_back( "-randstruct-auto" );
+  }
+
   // -fvisibility= and -fvisibility-ms-compat are of a piece.
   if (const Arg *A = Args.getLastArg(options::OPT_fvisibility_EQ,
  options::OPT_fvisibility_ms_compat)) {
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index b4423dabbe7..c3f4ea83d6c 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1678,6 +1678,9 @@ static InputKind ParseFrontendArgs(FrontendOptions , 
ArgList ,
   if (const Arg* A = Args.getLastArg(OPT_randstruct_seed)) {
 RandstructSeed = A->getValue(0);
   }
+  if (const Arg* A = Args.getLastArg(OPT_randstruct_auto)) {
+RandstructAutoSelect = true;
+  }
   Opts.AddPluginActions = Args.getAllArgValues(OPT_add_plugin);
   for (const auto *AA : Args.filtered(OPT_plugin_arg))
 Opts.PluginArgs[AA->getValue(0)].emplace_back(AA->getValue(1));
-- 
2.17.1

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


[RFC 11/12] Forward declare RecordFieldReorganizer

2019-03-08 Thread Connor Kuehl via cfe-commits
Co-authored-by: Cole Nixon 
Co-authored-by: Connor Kuehl 
Co-authored-by: James Foster 
Co-authored-by: Jeff Takahashi 
Co-authored-by: Jordan Cantrell 
Co-authored-by: Nikk Forbus 
Co-authored-by: Tim Pugh 
---
 clang/include/clang/AST/Decl.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h
index 2499efb8499..adf52c22283 100644
--- a/clang/include/clang/AST/Decl.h
+++ b/clang/include/clang/AST/Decl.h
@@ -65,6 +65,7 @@ class Module;
 class NamespaceDecl;
 class ParmVarDecl;
 class RecordDecl;
+class RecordFieldReorganizer;
 class Stmt;
 class StringLiteral;
 class TagDecl;
-- 
2.17.1

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


[RFC 05/12] Add warning for mutually exclusive attributes

2019-03-08 Thread Connor Kuehl via cfe-commits
Co-authored-by: Cole Nixon 
Co-authored-by: Connor Kuehl 
Co-authored-by: James Foster 
Co-authored-by: Jeff Takahashi 
Co-authored-by: Jordan Cantrell 
Co-authored-by: Nikk Forbus 
Co-authored-by: Tim Pugh 
---
 clang/include/clang/Basic/DiagnosticASTKinds.td | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/clang/include/clang/Basic/DiagnosticASTKinds.td 
b/clang/include/clang/Basic/DiagnosticASTKinds.td
index 406325d3677..e0970a7b145 100644
--- a/clang/include/clang/Basic/DiagnosticASTKinds.td
+++ b/clang/include/clang/Basic/DiagnosticASTKinds.td
@@ -345,4 +345,7 @@ def warn_unnecessary_packed : Warning<
   "packed attribute is unnecessary for %0">, InGroup, DefaultIgnore;
 def warn_randomize_attr_union : Warning<
   "union declared with 'randomize_layout' attribute">, 
InGroup>;
+def warn_randomize_attr_conflict : Warning<
+  "struct declared with 'randomize_layout' and 'no_randomize_layout' 
attributes; "
+  "attribute 'no_randomize_layout' takes precedence">, 
InGroup>;
 }
-- 
2.17.1

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


[RFC 04/12] Add randomize_layout warning for unions

2019-03-08 Thread Connor Kuehl via cfe-commits
There is no technical advantage to randomizing the order
fields within unions as they all share the same offset.

Co-authored-by: Cole Nixon 
Co-authored-by: Connor Kuehl 
Co-authored-by: James Foster 
Co-authored-by: Jeff Takahashi 
Co-authored-by: Jordan Cantrell 
Co-authored-by: Nikk Forbus 
Co-authored-by: Tim Pugh 
---
 clang/include/clang/Basic/DiagnosticASTKinds.td | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/clang/include/clang/Basic/DiagnosticASTKinds.td 
b/clang/include/clang/Basic/DiagnosticASTKinds.td
index c2a390fa465..406325d3677 100644
--- a/clang/include/clang/Basic/DiagnosticASTKinds.td
+++ b/clang/include/clang/Basic/DiagnosticASTKinds.td
@@ -343,4 +343,6 @@ def warn_padded_struct_size : Warning<
   InGroup, DefaultIgnore;
 def warn_unnecessary_packed : Warning<
   "packed attribute is unnecessary for %0">, InGroup, DefaultIgnore;
+def warn_randomize_attr_union : Warning<
+  "union declared with 'randomize_layout' attribute">, 
InGroup>;
 }
-- 
2.17.1

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


[RFC 07/12] Add randstruct-seed compiler argument

2019-03-08 Thread Connor Kuehl via cfe-commits
To create reproducible builds, the randstruct feature
can (and should) operate on a seed provided at compile
time.

Co-authored-by: Cole Nixon 
Co-authored-by: Connor Kuehl 
Co-authored-by: James Foster 
Co-authored-by: Jeff Takahashi 
Co-authored-by: Jordan Cantrell 
Co-authored-by: Nikk Forbus 
Co-authored-by: Tim Pugh 
---
 clang/include/clang/Driver/CC1Options.td  | 2 ++
 clang/include/clang/Driver/Options.td | 1 +
 clang/lib/Driver/ToolChains/Clang.cpp | 6 ++
 clang/lib/Frontend/CompilerInvocation.cpp | 5 +
 4 files changed, 14 insertions(+)

diff --git a/clang/include/clang/Driver/CC1Options.td 
b/clang/include/clang/Driver/CC1Options.td
index f4f8fae39e3..541a8e74a0c 100644
--- a/clang/include/clang/Driver/CC1Options.td
+++ b/clang/include/clang/Driver/CC1Options.td
@@ -422,6 +422,8 @@ def fcaret_diagnostics_max_lines :
   HelpText<"Set the maximum number of source lines to show in a caret 
diagnostic">;
 def fmessage_length : Separate<["-"], "fmessage-length">, MetaVarName<"">,
   HelpText<"Format message diagnostics so that they fit within N columns or 
fewer, when possible.">;
+def randstruct_seed : Separate<["-"], "randstruct-seed">, MetaVarName<"">,
+  HelpText<"Randomization seed for random struct layouts">;
 def verify_EQ : CommaJoined<["-"], "verify=">,
   MetaVarName<"">,
   HelpText<"Verify diagnostic output using comment directives that start with"
diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 81e4ce75b02..735ec11e221 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1267,6 +1267,7 @@ def fmacro_backtrace_limit_EQ : Joined<["-"], 
"fmacro-backtrace-limit=">,
 def fmerge_all_constants : Flag<["-"], "fmerge-all-constants">, Group,
   Flags<[CC1Option, CoreOption]>, HelpText<"Allow merging of constants">;
 def fmessage_length_EQ : Joined<["-"], "fmessage-length=">, Group;
+def randstruct_seed_EQ : Joined<["-"], "randstruct-seed=">, Group;
 def fms_extensions : Flag<["-"], "fms-extensions">, Group, 
Flags<[CC1Option, CoreOption]>,
   HelpText<"Accept some non-standard constructs supported by the Microsoft 
compiler">;
 def fms_compatibility : Flag<["-"], "fms-compatibility">, Group, 
Flags<[CC1Option, CoreOption]>,
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 3bc7412911b..52daed9fe36 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -4427,6 +4427,12 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
 CmdArgs.push_back(Args.MakeArgString(Twine(N)));
   }
 
+  // -randstruct-seed parent process
+  if (Arg *A = Args.getLastArg(options::OPT_randstruct_seed_EQ)) {
+CmdArgs.push_back( "-randstruct-seed" );
+CmdArgs.push_back(A->getValue(0));
+  }
+
   // -fvisibility= and -fvisibility-ms-compat are of a piece.
   if (const Arg *A = Args.getLastArg(options::OPT_fvisibility_EQ,
  options::OPT_fvisibility_ms_compat)) {
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index 1cd1cb1ff47..b4423dabbe7 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -6,6 +6,7 @@
 //
 
//===--===//
 
+#include "clang/AST/RandstructSeed.h"
 #include "clang/Frontend/CompilerInvocation.h"
 #include "TestModuleFileExtension.h"
 #include "clang/Basic/Builtins.h"
@@ -1673,6 +1674,10 @@ static InputKind ParseFrontendArgs(FrontendOptions 
, ArgList ,
 Opts.ProgramAction = frontend::PluginAction;
 Opts.ActionName = A->getValue();
   }
+  // child process handle arguments
+  if (const Arg* A = Args.getLastArg(OPT_randstruct_seed)) {
+RandstructSeed = A->getValue(0);
+  }
   Opts.AddPluginActions = Args.getAllArgValues(OPT_add_plugin);
   for (const auto *AA : Args.filtered(OPT_plugin_arg))
 Opts.PluginArgs[AA->getValue(0)].emplace_back(AA->getValue(1));
-- 
2.17.1

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


[RFC 06/12] Add globals to store command line arguments in

2019-03-08 Thread Connor Kuehl via cfe-commits
Co-authored-by: Cole Nixon 
Co-authored-by: Connor Kuehl 
Co-authored-by: James Foster 
Co-authored-by: Jeff Takahashi 
Co-authored-by: Jordan Cantrell 
Co-authored-by: Nikk Forbus 
Co-authored-by: Tim Pugh 
---
 clang/include/clang/AST/RandstructSeed.h |  8 
 clang/lib/AST/CMakeLists.txt |  1 +
 clang/lib/AST/RecordFieldReorganizer.cpp | 19 +++
 3 files changed, 28 insertions(+)
 create mode 100644 clang/include/clang/AST/RandstructSeed.h
 create mode 100644 clang/lib/AST/RecordFieldReorganizer.cpp

diff --git a/clang/include/clang/AST/RandstructSeed.h 
b/clang/include/clang/AST/RandstructSeed.h
new file mode 100644
index 000..eefdd8916f4
--- /dev/null
+++ b/clang/include/clang/AST/RandstructSeed.h
@@ -0,0 +1,8 @@
+#ifndef RANDSTRUCTSEED_H
+#define RANDSTRUCTSEED_H
+#include 
+namespace clang {
+extern std::string RandstructSeed;
+extern bool RandstructAutoSelect;
+}
+#endif
diff --git a/clang/lib/AST/CMakeLists.txt b/clang/lib/AST/CMakeLists.txt
index 570ca718acf..08acf687971 100644
--- a/clang/lib/AST/CMakeLists.txt
+++ b/clang/lib/AST/CMakeLists.txt
@@ -44,6 +44,7 @@ add_clang_library(clangAST
   InheritViz.cpp
   ItaniumCXXABI.cpp
   ItaniumMangle.cpp
+  RecordFieldReorganizer.cpp
   Mangle.cpp
   MicrosoftCXXABI.cpp
   MicrosoftMangle.cpp
diff --git a/clang/lib/AST/RecordFieldReorganizer.cpp 
b/clang/lib/AST/RecordFieldReorganizer.cpp
new file mode 100644
index 000..c7ab9cd16d4
--- /dev/null
+++ b/clang/lib/AST/RecordFieldReorganizer.cpp
@@ -0,0 +1,19 @@
+//===- RecordFieldReorganizer.cpp - Implementation for field reorder -*- 
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
+//
+//===--===//
+//
+// Contains the implementation for RecordDecl field reordering.
+//
+//===--===//
+
+#include "clang/AST/RandstructSeed.h"
+
+namespace clang {
+std::string RandstructSeed = "";
+bool RandstructAutoSelect = false;
+} // namespace clang
-- 
2.17.1

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


[RFC 00/12] Introduce struct layout randomization feature

2019-03-08 Thread Connor Kuehl via cfe-commits
This patch set introduces structure field layout randomization into the Clang
compiler. The Randstruct feature is a compile-time hardening technique that 
randomizes the field layout for designated structures of a code base. 
Admittedly, this is mostly useful for closed-source releases of code (since 
the randomization seed would be available for public and open source application
s). However, this patch set also enhances Clang’s feature parity with that 
of GCC which already has the Randstruct feature.

This patch set is a from-scratch reimplementation of the Randstruct feature 
that was originally ported to GCC. The patches for this implementation in GCC 
can be found here: 

https://www.openwall.com/lists/kernel-hardening/2017/04/06/14.

This feature identifies structures for randomization in two ways. The first 
method targets structures that are manually marked with the new 
“randomize_layout” attribute. The second is an optional feature that will 
automatically select and randomize structures that are found to consist entirely
of function pointers. This automatic selection feature can be extended to 
include other vulnerable structure types that are safe to randomize as they are
identified. You can also opt a specific structure out of this feature with the 
“no_randomize_layout” attribute. Automatic structure selection is enabled with 
the “-randstruct-auto” compiler flag. By default, Randstruct seeds on the empty
string, but a seed can be supplied with the “-randstruct-seed=” command line 
argument.

This entire patch set is the sum total of an undergraduate computer science 
capstone team’s effort.

Portland State University Clang Randstruct Capstone Team (Fall 2018-Winter 
2019):

Co-authored-by: Cole Nixon 
Co-authored-by: Connor Kuehl 
Co-authored-by: James Foster 
Co-authored-by: Jeff Takahashi 
Co-authored-by: Jordan Cantrell 
Co-authored-by: Nikk Forbus 
Co-authored-by: Tim Pugh 

Connor Kuehl (12):
  Add documentation for randstruct attributes
  Add randomize_layout attribute and handler
  Add no_randomize_layout attribute and handler
  Add randomize_layout warning for unions
  Add warning for mutually exclusive attributes
  Add globals to store command line arguments in
  Add randstruct-seed compiler argument
  Add automatic structure selection compiler switch
  Implement record field randomization algorithms
  Fix: Set tail pointer to null in field list
  Forward declare RecordFieldReorganizer
  Wire up Randstruct; intercept and randomize

 clang/include/clang/AST/Decl.h|   1 +
 clang/include/clang/AST/DeclBase.h|   2 +
 clang/include/clang/AST/RandstructSeed.h  |   8 +
 .../clang/AST/RecordFieldReorganizer.h|  59 
 clang/include/clang/Basic/Attr.td |  14 +
 clang/include/clang/Basic/AttrDocs.td |  45 +++
 .../include/clang/Basic/DiagnosticASTKinds.td |   5 +
 clang/include/clang/Driver/CC1Options.td  |   2 +
 clang/include/clang/Driver/Options.td |   4 +
 clang/lib/AST/CMakeLists.txt  |   1 +
 clang/lib/AST/DeclBase.cpp|   3 +
 clang/lib/AST/RecordFieldReorganizer.cpp  | 257 ++
 clang/lib/AST/RecordLayoutBuilder.cpp |  20 ++
 clang/lib/Driver/ToolChains/Clang.cpp |  10 +
 clang/lib/Frontend/CompilerInvocation.cpp |   8 +
 clang/lib/Sema/SemaDeclAttr.cpp   |   6 +
 ...a-attribute-supported-attributes-list.test |   2 +
 17 files changed, 447 insertions(+)
 create mode 100644 clang/include/clang/AST/RandstructSeed.h
 create mode 100644 clang/include/clang/AST/RecordFieldReorganizer.h
 create mode 100644 clang/lib/AST/RecordFieldReorganizer.cpp

-- 
2.17.1

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


[RFC 03/12] Add no_randomize_layout attribute and handler

2019-03-08 Thread Connor Kuehl via cfe-commits
Co-authored-by: Cole Nixon 
Co-authored-by: Connor Kuehl 
Co-authored-by: James Foster 
Co-authored-by: Jeff Takahashi 
Co-authored-by: Jordan Cantrell 
Co-authored-by: Nikk Forbus 
Co-authored-by: Tim Pugh 
---
 clang/include/clang/Basic/Attr.td  | 7 +++
 clang/lib/Sema/SemaDeclAttr.cpp| 3 +++
 .../Misc/pragma-attribute-supported-attributes-list.test   | 1 +
 3 files changed, 11 insertions(+)

diff --git a/clang/include/clang/Basic/Attr.td 
b/clang/include/clang/Basic/Attr.td
index 2d44d14ad6d..be1000c2067 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -3221,3 +3221,10 @@ def RandomizeLayout : InheritableAttr {
   let Subjects = SubjectList<[Record]>;
   let Documentation = [ClangRandstructDocs];
 }
+
+def NoRandomizeLayout : InheritableAttr {
+  let Spellings = [GCC<"no_randomize_layout">, Declspec<"no_randomize_layout">,
+Keyword<"no_randomize_layout">];
+  let Subjects = SubjectList<[Record]>;
+  let Documentation = [ClangRandstructDocs];
+}
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 5de9125b44f..8e533e13a03 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -6969,6 +6969,9 @@ static void ProcessDeclAttribute(Sema , Scope *scope, 
Decl *D,
   case ParsedAttr::AT_RandomizeLayout:
 handleSimpleAttribute(S, D, AL);
 break;
+  case ParsedAttr::AT_NoRandomizeLayout:
+handleSimpleAttribute(S, D, AL);
+break;
   case ParsedAttr::AT_CodeSeg:
 handleCodeSegAttr(S, D, AL);
 break;
diff --git a/clang/test/Misc/pragma-attribute-supported-attributes-list.test 
b/clang/test/Misc/pragma-attribute-supported-attributes-list.test
index b4bc1b3112f..6bf4dd74a04 100644
--- a/clang/test/Misc/pragma-attribute-supported-attributes-list.test
+++ b/clang/test/Misc/pragma-attribute-supported-attributes-list.test
@@ -81,6 +81,7 @@
 // CHECK-NEXT: NoInstrumentFunction (SubjectMatchRule_function)
 // CHECK-NEXT: NoMicroMips (SubjectMatchRule_function)
 // CHECK-NEXT: NoMips16 (SubjectMatchRule_function)
+// CHECK-NEXT: NoRandomizeLayout (SubjectMatchRule_record)
 // CHECK-NEXT: NoSanitize (SubjectMatchRule_function, 
SubjectMatchRule_objc_method, SubjectMatchRule_variable_is_global)
 // CHECK-NEXT: NoSanitizeSpecific (SubjectMatchRule_function, 
SubjectMatchRule_variable_is_global)
 // CHECK-NEXT: NoSpeculativeLoadHardening (SubjectMatchRule_function, 
SubjectMatchRule_objc_method)
-- 
2.17.1

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


[RFC 01/12] Add documentation for randstruct attributes

2019-03-08 Thread Connor Kuehl via cfe-commits
Co-authored-by: Cole Nixon 
Co-authored-by: Connor Kuehl 
Co-authored-by: James Foster 
Co-authored-by: Jeff Takahashi 
Co-authored-by: Jordan Cantrell 
Co-authored-by: Nikk Forbus 
Co-authored-by: Tim Pugh 
---
 clang/include/clang/Basic/AttrDocs.td | 45 +++
 1 file changed, 45 insertions(+)

diff --git a/clang/include/clang/Basic/AttrDocs.td 
b/clang/include/clang/Basic/AttrDocs.td
index a9835cbeeed..a94e995ac14 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -4116,3 +4116,48 @@ it will be automatically applied to overrides if the 
method is virtual. The
 attribute can also be written using C++11 syntax: ``[[mig::server_routine]]``.
 }];
 }
+
+def ClangRandstructDocs : Documentation {
+  let Category = DocCatVariable;
+  let Heading = "randomize_layout, no_randomize_layout";
+  let Content = [{
+The attributes ``randomize_layout`` and ``no_randomize_layout`` can be applied
+to a record.
+
+``randomize_layout`` instructs the compiler to randomize the memory layout
+of the member variables of the record.
+
+Conversely, ``no_randomize_layout`` is used to indicate that if using the
+automatic strucuture selection feature of the Randstruct implementation, the
+compiler should not shuffle the members of the record.
+
+In the event that a record is labeled with both attributes, the compiler will
+emit a warning indicating that these two cannot be used on the same record.
+The default behavior in this case is to not randomize the struct, as the
+attribute ``no_randomize_layout`` takes precedence over ``randomize_layout``.
+This is implementation defined behavior.
+
+.. code-block:: c
+
+  // Indicates that this struct should be randomized by Randstruct 
implementation.
+  struct s {
+char *a;
+char *b;
+char *c;
+  }__attribute__((randomize_layout));
+
+  // Indicates that this struct should NOT be randomized by Randstruct 
implementation.
+  struct s {
+char *a;
+char *b;
+char *c;
+  }__attribute__((no_randomize_layout));
+
+  // Emits compiler warning. Struct is NOT randomized by Randstruct 
implementation.
+  struct s {
+char *a;
+char *b;
+char *c;
+  }__attribute__((randomize_layout)) __attribute__((no_randomize_layout));
+}];
+}
-- 
2.17.1

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


[RFC 02/12] Add randomize_layout attribute and handler

2019-03-08 Thread Connor Kuehl via cfe-commits
Co-authored-by: Cole Nixon 
Co-authored-by: Connor Kuehl 
Co-authored-by: James Foster 
Co-authored-by: Jeff Takahashi 
Co-authored-by: Jordan Cantrell 
Co-authored-by: Nikk Forbus 
Co-authored-by: Tim Pugh 
---
 clang/include/clang/Basic/Attr.td  | 7 +++
 clang/lib/Sema/SemaDeclAttr.cpp| 3 +++
 .../Misc/pragma-attribute-supported-attributes-list.test   | 1 +
 3 files changed, 11 insertions(+)

diff --git a/clang/include/clang/Basic/Attr.td 
b/clang/include/clang/Basic/Attr.td
index 523b89d0fcc..2d44d14ad6d 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -3214,3 +3214,10 @@ def ObjCExternallyRetained : InheritableAttr {
   let Subjects = SubjectList<[NonParmVar, Function, Block, ObjCMethod]>;
   let Documentation = [ObjCExternallyRetainedDocs];
 }
+
+def RandomizeLayout : InheritableAttr {
+  let Spellings = [GCC<"randomize_layout">, Declspec<"randomize_layout">,
+Keyword<"randomize_layout">];
+  let Subjects = SubjectList<[Record]>;
+  let Documentation = [ClangRandstructDocs];
+}
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index c97d0bc819f..5de9125b44f 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -6966,6 +6966,9 @@ static void ProcessDeclAttribute(Sema , Scope *scope, 
Decl *D,
 handleSimpleAttributeWithExclusions(S, D, 
AL);
 break;
+  case ParsedAttr::AT_RandomizeLayout:
+handleSimpleAttribute(S, D, AL);
+break;
   case ParsedAttr::AT_CodeSeg:
 handleCodeSegAttr(S, D, AL);
 break;
diff --git a/clang/test/Misc/pragma-attribute-supported-attributes-list.test 
b/clang/test/Misc/pragma-attribute-supported-attributes-list.test
index 9a7e65d2b24..b4bc1b3112f 100644
--- a/clang/test/Misc/pragma-attribute-supported-attributes-list.test
+++ b/clang/test/Misc/pragma-attribute-supported-attributes-list.test
@@ -118,6 +118,7 @@
 // CHECK-NEXT: Overloadable (SubjectMatchRule_function)
 // CHECK-NEXT: ParamTypestate (SubjectMatchRule_variable_is_parameter)
 // CHECK-NEXT: PassObjectSize (SubjectMatchRule_variable_is_parameter)
+// CHECK-NEXT: RandomizeLayout (SubjectMatchRule_record)
 // CHECK-NEXT: RenderScriptKernel (SubjectMatchRule_function)
 // CHECK-NEXT: ReqdWorkGroupSize (SubjectMatchRule_function)
 // CHECK-NEXT: RequireConstantInit (SubjectMatchRule_variable_is_global)
-- 
2.17.1

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


[PATCH] D58921: [CMake] Tell libc++ that we're using compiler-rt on Apple platforms

2019-03-08 Thread Louis Dionne via Phabricator via cfe-commits
ldionne added a comment.

In D58921#1423294 , @smeenai wrote:

> Is this to work around 
> https://github.com/llvm/llvm-project/blob/f84083b4dbb1ddb6d2783400f11121f490cdb5a8/libcxx/lib/CMakeLists.txt#L312?


Yes, precisely. Note that I think this option should be `ON` by default, but 
specifying this explicitly doesn't hurt regardless.


Repository:
  rC Clang

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

https://reviews.llvm.org/D58921



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


[PATCH] D59038: [8.0 Regression] Fix handling of `__builtin_constant_p` inside template arguments, enumerators, case statements, and the enable_if attribute.

2019-03-08 Thread Eric Fiselier via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC355743: [8.0 Regression] Fix handling of 
`__builtin_constant_p` inside template… (authored by EricWF, committed by ).

Repository:
  rC Clang

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

https://reviews.llvm.org/D59038

Files:
  lib/AST/ExprConstant.cpp
  test/SemaCXX/constant-expression-cxx1y.cpp
  test/SemaCXX/enable_if.cpp


Index: test/SemaCXX/enable_if.cpp
===
--- test/SemaCXX/enable_if.cpp
+++ test/SemaCXX/enable_if.cpp
@@ -514,3 +514,11 @@
 
   static_assert(is_same<__typeof__(foo)*, decltype()>::value, "");
 }
+
+namespace InConstantContext {
+void foo(const char *s) 
__attribute__((enable_if(((void)__builtin_constant_p(*s), true), "trap"))) {}
+
+void test() {
+  InConstantContext::foo("abc");
+}
+} // namespace InConstantContext
Index: test/SemaCXX/constant-expression-cxx1y.cpp
===
--- test/SemaCXX/constant-expression-cxx1y.cpp
+++ test/SemaCXX/constant-expression-cxx1y.cpp
@@ -1135,3 +1135,27 @@
   return __builtin_constant_p(*__s);
 }
 constexpr bool n = indirect_builtin_constant_p("a");
+
+__attribute__((enable_if(indirect_builtin_constant_p("a") == n, "OK")))
+int test_in_enable_if() { return 0; }
+int n2 = test_in_enable_if();
+
+template 
+int test_in_template_param() { return 0; }
+int n3 = test_in_template_param();
+
+void test_in_case(int n) {
+  switch (n) {
+case indirect_builtin_constant_p("abc"):
+break;
+  }
+}
+enum InEnum1 {
+  ONE = indirect_builtin_constant_p("abc")
+};
+enum InEnum2 : int {
+  TWO = indirect_builtin_constant_p("abc")
+};
+enum class InEnum3 {
+  THREE = indirect_builtin_constant_p("abc")
+};
Index: lib/AST/ExprConstant.cpp
===
--- lib/AST/ExprConstant.cpp
+++ lib/AST/ExprConstant.cpp
@@ -11131,6 +11131,7 @@
   const ASTContext ) const {
   EvalInfo::EvaluationMode EM = EvalInfo::EM_ConstantExpression;
   EvalInfo Info(Ctx, Result, EM);
+  Info.InConstantContext = true;
   if (!::Evaluate(Result.Val, Info, this))
 return false;
 
@@ -11771,6 +11772,7 @@
 const Expr *This) const {
   Expr::EvalStatus Status;
   EvalInfo Info(Ctx, Status, EvalInfo::EM_ConstantExpressionUnevaluated);
+  Info.InConstantContext = true;
 
   LValue ThisVal;
   const LValue *ThisPtr = nullptr;
@@ -11854,6 +11856,7 @@
 
   EvalInfo Info(FD->getASTContext(), Status,
 EvalInfo::EM_PotentialConstantExpressionUnevaluated);
+  Info.InConstantContext = true;
 
   // Fabricate a call stack frame to give the arguments a plausible cover 
story.
   ArrayRef Args;


Index: test/SemaCXX/enable_if.cpp
===
--- test/SemaCXX/enable_if.cpp
+++ test/SemaCXX/enable_if.cpp
@@ -514,3 +514,11 @@
 
   static_assert(is_same<__typeof__(foo)*, decltype()>::value, "");
 }
+
+namespace InConstantContext {
+void foo(const char *s) __attribute__((enable_if(((void)__builtin_constant_p(*s), true), "trap"))) {}
+
+void test() {
+  InConstantContext::foo("abc");
+}
+} // namespace InConstantContext
Index: test/SemaCXX/constant-expression-cxx1y.cpp
===
--- test/SemaCXX/constant-expression-cxx1y.cpp
+++ test/SemaCXX/constant-expression-cxx1y.cpp
@@ -1135,3 +1135,27 @@
   return __builtin_constant_p(*__s);
 }
 constexpr bool n = indirect_builtin_constant_p("a");
+
+__attribute__((enable_if(indirect_builtin_constant_p("a") == n, "OK")))
+int test_in_enable_if() { return 0; }
+int n2 = test_in_enable_if();
+
+template 
+int test_in_template_param() { return 0; }
+int n3 = test_in_template_param();
+
+void test_in_case(int n) {
+  switch (n) {
+case indirect_builtin_constant_p("abc"):
+break;
+  }
+}
+enum InEnum1 {
+  ONE = indirect_builtin_constant_p("abc")
+};
+enum InEnum2 : int {
+  TWO = indirect_builtin_constant_p("abc")
+};
+enum class InEnum3 {
+  THREE = indirect_builtin_constant_p("abc")
+};
Index: lib/AST/ExprConstant.cpp
===
--- lib/AST/ExprConstant.cpp
+++ lib/AST/ExprConstant.cpp
@@ -11131,6 +11131,7 @@
   const ASTContext ) const {
   EvalInfo::EvaluationMode EM = EvalInfo::EM_ConstantExpression;
   EvalInfo Info(Ctx, Result, EM);
+  Info.InConstantContext = true;
   if (!::Evaluate(Result.Val, Info, this))
 return false;
 
@@ -11771,6 +11772,7 @@
 const Expr *This) const {
   Expr::EvalStatus Status;
   EvalInfo Info(Ctx, Status, EvalInfo::EM_ConstantExpressionUnevaluated);
+  Info.InConstantContext = true;
 
   LValue ThisVal;
   const LValue *ThisPtr = nullptr;
@@ -11854,6 +11856,7 @@
 
   EvalInfo Info(FD->getASTContext(), Status,

Re: r352930 - [WebAssembly] Add an import_field function attribute

2019-03-08 Thread Aaron Ballman via cfe-commits
On Wed, Feb 6, 2019 at 12:43 AM Dan Gohman  wrote:
>
>
>
> On Tue, Feb 5, 2019 at 11:20 AM Aaron Ballman  wrote:
>>
>> On Fri, Feb 1, 2019 at 8:27 PM Dan Gohman  wrote:
>> >
>> >
>> >  Indeed, and the existing import_module attribute needs these tests as 
>> > well. I'll write some and add them in a follow-up patch.
>> >
>> > Thanks for the review!
>>
>> Any time! I haven't seen that follow-up patch yet though; did it fall
>> off your radar?
>
>
> Yes, it's still on my radar.

It's been a month and it still seems like this hasn't been taken care
of. The usual expectation is to handle post-commit feedback
"immediately". Can you please address these concerns?

~Aaron

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


r355743 - [8.0 Regression] Fix handling of `__builtin_constant_p` inside template arguments, enumerators, case statements, and the enable_if attribute.

2019-03-08 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Mar  8 14:06:48 2019
New Revision: 355743

URL: http://llvm.org/viewvc/llvm-project?rev=355743=rev
Log:
[8.0 Regression] Fix handling of `__builtin_constant_p` inside template 
arguments, enumerators, case statements, and the enable_if attribute.

Summary:
The following code is accepted by Clang 7 and prior but rejected by the 
upcoming 8 release and in trunk [1]

```
// error {{never produces a constant expression}}
void foo(const char* s) __attribute__((enable_if(__builtin_constant_p(*s) == 
false, "trap"))) {}
void test() { foo("abc"); }
```

Prior to Clang 8, the call to `__builtin_constant_p` was a constant expression 
returning false. Currently, it's not a valid constant expression.

The bug is caused because we failed to set `InConstantContext` when attempting 
to evaluate unevaluated constant expressions.

[1]  https://godbolt.org/z/ksAjmq

Reviewers: rsmith, hans, sbenza

Reviewed By: rsmith

Subscribers: kristina, cfe-commits

Tags: #clang

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

Modified:
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/test/SemaCXX/constant-expression-cxx1y.cpp
cfe/trunk/test/SemaCXX/enable_if.cpp

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=355743=355742=355743=diff
==
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Fri Mar  8 14:06:48 2019
@@ -11131,6 +11131,7 @@ bool Expr::EvaluateAsConstantExpr(EvalRe
   const ASTContext ) const {
   EvalInfo::EvaluationMode EM = EvalInfo::EM_ConstantExpression;
   EvalInfo Info(Ctx, Result, EM);
+  Info.InConstantContext = true;
   if (!::Evaluate(Result.Val, Info, this))
 return false;
 
@@ -11771,6 +11772,7 @@ bool Expr::EvaluateWithSubstitution(APVa
 const Expr *This) const {
   Expr::EvalStatus Status;
   EvalInfo Info(Ctx, Status, EvalInfo::EM_ConstantExpressionUnevaluated);
+  Info.InConstantContext = true;
 
   LValue ThisVal;
   const LValue *ThisPtr = nullptr;
@@ -11854,6 +11856,7 @@ bool Expr::isPotentialConstantExprUneval
 
   EvalInfo Info(FD->getASTContext(), Status,
 EvalInfo::EM_PotentialConstantExpressionUnevaluated);
+  Info.InConstantContext = true;
 
   // Fabricate a call stack frame to give the arguments a plausible cover 
story.
   ArrayRef Args;

Modified: cfe/trunk/test/SemaCXX/constant-expression-cxx1y.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/constant-expression-cxx1y.cpp?rev=355743=355742=355743=diff
==
--- cfe/trunk/test/SemaCXX/constant-expression-cxx1y.cpp (original)
+++ cfe/trunk/test/SemaCXX/constant-expression-cxx1y.cpp Fri Mar  8 14:06:48 
2019
@@ -1135,3 +1135,27 @@ constexpr bool indirect_builtin_constant
   return __builtin_constant_p(*__s);
 }
 constexpr bool n = indirect_builtin_constant_p("a");
+
+__attribute__((enable_if(indirect_builtin_constant_p("a") == n, "OK")))
+int test_in_enable_if() { return 0; }
+int n2 = test_in_enable_if();
+
+template 
+int test_in_template_param() { return 0; }
+int n3 = test_in_template_param();
+
+void test_in_case(int n) {
+  switch (n) {
+case indirect_builtin_constant_p("abc"):
+break;
+  }
+}
+enum InEnum1 {
+  ONE = indirect_builtin_constant_p("abc")
+};
+enum InEnum2 : int {
+  TWO = indirect_builtin_constant_p("abc")
+};
+enum class InEnum3 {
+  THREE = indirect_builtin_constant_p("abc")
+};

Modified: cfe/trunk/test/SemaCXX/enable_if.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/enable_if.cpp?rev=355743=355742=355743=diff
==
--- cfe/trunk/test/SemaCXX/enable_if.cpp (original)
+++ cfe/trunk/test/SemaCXX/enable_if.cpp Fri Mar  8 14:06:48 2019
@@ -514,3 +514,11 @@ namespace TypeOfFn {
 
   static_assert(is_same<__typeof__(foo)*, decltype()>::value, "");
 }
+
+namespace InConstantContext {
+void foo(const char *s) 
__attribute__((enable_if(((void)__builtin_constant_p(*s), true), "trap"))) {}
+
+void test() {
+  InConstantContext::foo("abc");
+}
+} // namespace InConstantContext


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


[PATCH] D59038: [8.0 Regression] Fix handling of `__builtin_constant_p` inside template arguments, enumerators, case statements, and the enable_if attribute.

2019-03-08 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 189930.
EricWF retitled this revision from "[8.0 Regression] Fix handling of 
`__builtin_constant_p` inside the enable_if attribute." to "[8.0 Regression] 
Fix handling of `__builtin_constant_p` inside template arguments, enumerators, 
case statements, and the enable_if attribute.".
EricWF added a comment.

- Correct tests for unscoped enums.


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

https://reviews.llvm.org/D59038

Files:
  lib/AST/ExprConstant.cpp
  test/SemaCXX/constant-expression-cxx1y.cpp
  test/SemaCXX/enable_if.cpp


Index: test/SemaCXX/enable_if.cpp
===
--- test/SemaCXX/enable_if.cpp
+++ test/SemaCXX/enable_if.cpp
@@ -514,3 +514,11 @@
 
   static_assert(is_same<__typeof__(foo)*, decltype()>::value, "");
 }
+
+namespace InConstantContext {
+void foo(const char *s) 
__attribute__((enable_if(((void)__builtin_constant_p(*s), true), "trap"))) {}
+
+void test() {
+  InConstantContext::foo("abc");
+}
+} // namespace InConstantContext
Index: test/SemaCXX/constant-expression-cxx1y.cpp
===
--- test/SemaCXX/constant-expression-cxx1y.cpp
+++ test/SemaCXX/constant-expression-cxx1y.cpp
@@ -1135,3 +1135,27 @@
   return __builtin_constant_p(*__s);
 }
 constexpr bool n = indirect_builtin_constant_p("a");
+
+__attribute__((enable_if(indirect_builtin_constant_p("a") == n, "OK")))
+int test_in_enable_if() { return 0; }
+int n2 = test_in_enable_if();
+
+template 
+int test_in_template_param() { return 0; }
+int n3 = test_in_template_param();
+
+void test_in_case(int n) {
+  switch (n) {
+case indirect_builtin_constant_p("abc"):
+break;
+  }
+}
+enum InEnum1 {
+  ONE = indirect_builtin_constant_p("abc")
+};
+enum InEnum2 : int {
+  TWO = indirect_builtin_constant_p("abc")
+};
+enum class InEnum3 {
+  THREE = indirect_builtin_constant_p("abc")
+};
Index: lib/AST/ExprConstant.cpp
===
--- lib/AST/ExprConstant.cpp
+++ lib/AST/ExprConstant.cpp
@@ -11131,6 +11131,7 @@
   const ASTContext ) const {
   EvalInfo::EvaluationMode EM = EvalInfo::EM_ConstantExpression;
   EvalInfo Info(Ctx, Result, EM);
+  Info.InConstantContext = true;
   if (!::Evaluate(Result.Val, Info, this))
 return false;
 
@@ -11771,6 +11772,7 @@
 const Expr *This) const {
   Expr::EvalStatus Status;
   EvalInfo Info(Ctx, Status, EvalInfo::EM_ConstantExpressionUnevaluated);
+  Info.InConstantContext = true;
 
   LValue ThisVal;
   const LValue *ThisPtr = nullptr;
@@ -11854,6 +11856,7 @@
 
   EvalInfo Info(FD->getASTContext(), Status,
 EvalInfo::EM_PotentialConstantExpressionUnevaluated);
+  Info.InConstantContext = true;
 
   // Fabricate a call stack frame to give the arguments a plausible cover 
story.
   ArrayRef Args;


Index: test/SemaCXX/enable_if.cpp
===
--- test/SemaCXX/enable_if.cpp
+++ test/SemaCXX/enable_if.cpp
@@ -514,3 +514,11 @@
 
   static_assert(is_same<__typeof__(foo)*, decltype()>::value, "");
 }
+
+namespace InConstantContext {
+void foo(const char *s) __attribute__((enable_if(((void)__builtin_constant_p(*s), true), "trap"))) {}
+
+void test() {
+  InConstantContext::foo("abc");
+}
+} // namespace InConstantContext
Index: test/SemaCXX/constant-expression-cxx1y.cpp
===
--- test/SemaCXX/constant-expression-cxx1y.cpp
+++ test/SemaCXX/constant-expression-cxx1y.cpp
@@ -1135,3 +1135,27 @@
   return __builtin_constant_p(*__s);
 }
 constexpr bool n = indirect_builtin_constant_p("a");
+
+__attribute__((enable_if(indirect_builtin_constant_p("a") == n, "OK")))
+int test_in_enable_if() { return 0; }
+int n2 = test_in_enable_if();
+
+template 
+int test_in_template_param() { return 0; }
+int n3 = test_in_template_param();
+
+void test_in_case(int n) {
+  switch (n) {
+case indirect_builtin_constant_p("abc"):
+break;
+  }
+}
+enum InEnum1 {
+  ONE = indirect_builtin_constant_p("abc")
+};
+enum InEnum2 : int {
+  TWO = indirect_builtin_constant_p("abc")
+};
+enum class InEnum3 {
+  THREE = indirect_builtin_constant_p("abc")
+};
Index: lib/AST/ExprConstant.cpp
===
--- lib/AST/ExprConstant.cpp
+++ lib/AST/ExprConstant.cpp
@@ -11131,6 +11131,7 @@
   const ASTContext ) const {
   EvalInfo::EvaluationMode EM = EvalInfo::EM_ConstantExpression;
   EvalInfo Info(Ctx, Result, EM);
+  Info.InConstantContext = true;
   if (!::Evaluate(Result.Val, Info, this))
 return false;
 
@@ -11771,6 +11772,7 @@
 const Expr *This) const {
   Expr::EvalStatus Status;
   EvalInfo Info(Ctx, Status, EvalInfo::EM_ConstantExpressionUnevaluated);
+  Info.InConstantContext = 

[PATCH] D59103: [clang-tidy] New checker bugprone-incomplete-comparison-operator

2019-03-08 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D59103#1422775 , @kallehuttunen 
wrote:

> Another idea that came to my mind would be to enable this check only for 
> annotated types. So warning for missing field access would be only given for 
> types that have for example `[[clang::annotate("value type")]]` annotation. 
> Possibly other kinds of checks could be also developed for types that have 
> the given annotation.


I don't think `annotate` would be a good choice because the primary purpose of 
that one is to pass that attribute information down to the backend and using it 
for this purpose feels a bit hackish. However, we could always add a new 
attribute if needed, but I'm not convinced an attribute is the right approach 
either (but then again, I'm also lacking information I'm sure).

What other kinds of checks do you have in mind and what are the semantics of 
the attribute you're thinking of?


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D59103



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


[PATCH] D59038: [8.0 Regression] Fix handling of `__builtin_constant_p` inside the enable_if attribute.

2019-03-08 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 189927.
EricWF added a comment.

Add more tests.


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

https://reviews.llvm.org/D59038

Files:
  lib/AST/ExprConstant.cpp
  test/SemaCXX/constant-expression-cxx1y.cpp
  test/SemaCXX/enable_if.cpp


Index: test/SemaCXX/enable_if.cpp
===
--- test/SemaCXX/enable_if.cpp
+++ test/SemaCXX/enable_if.cpp
@@ -514,3 +514,11 @@
 
   static_assert(is_same<__typeof__(foo)*, decltype()>::value, "");
 }
+
+namespace InConstantContext {
+void foo(const char *s) 
__attribute__((enable_if(((void)__builtin_constant_p(*s), true), "trap"))) {}
+
+void test() {
+  InConstantContext::foo("abc");
+}
+} // namespace InConstantContext
Index: test/SemaCXX/constant-expression-cxx1y.cpp
===
--- test/SemaCXX/constant-expression-cxx1y.cpp
+++ test/SemaCXX/constant-expression-cxx1y.cpp
@@ -1135,3 +1135,27 @@
   return __builtin_constant_p(*__s);
 }
 constexpr bool n = indirect_builtin_constant_p("a");
+
+__attribute__((enable_if(indirect_builtin_constant_p("a") == n, "OK")))
+int test_in_enable_if() { return 0; }
+int n2 = test_in_enable_if();
+
+template 
+int test_in_template_param() { return 0; }
+int n3 = test_in_template_param();
+
+void test_in_case(int n) {
+  switch (n) {
+case indirect_builtin_constant_p("abc"):
+break;
+  }
+}
+enum InEnum1 {
+  ONE = indirect_builtin_constant_p("abc")
+};
+enum InEnum2 : int {
+  ONE = indirect_builtin_constant_p("abc")
+};
+enum class InEnum3 {
+  ONE = indirect_builtin_constant_p("abc")
+};
Index: lib/AST/ExprConstant.cpp
===
--- lib/AST/ExprConstant.cpp
+++ lib/AST/ExprConstant.cpp
@@ -11131,6 +11131,7 @@
   const ASTContext ) const {
   EvalInfo::EvaluationMode EM = EvalInfo::EM_ConstantExpression;
   EvalInfo Info(Ctx, Result, EM);
+  Info.InConstantContext = true;
   if (!::Evaluate(Result.Val, Info, this))
 return false;
 
@@ -11771,6 +11772,7 @@
 const Expr *This) const {
   Expr::EvalStatus Status;
   EvalInfo Info(Ctx, Status, EvalInfo::EM_ConstantExpressionUnevaluated);
+  Info.InConstantContext = true;
 
   LValue ThisVal;
   const LValue *ThisPtr = nullptr;
@@ -11854,6 +11856,7 @@
 
   EvalInfo Info(FD->getASTContext(), Status,
 EvalInfo::EM_PotentialConstantExpressionUnevaluated);
+  Info.InConstantContext = true;
 
   // Fabricate a call stack frame to give the arguments a plausible cover 
story.
   ArrayRef Args;


Index: test/SemaCXX/enable_if.cpp
===
--- test/SemaCXX/enable_if.cpp
+++ test/SemaCXX/enable_if.cpp
@@ -514,3 +514,11 @@
 
   static_assert(is_same<__typeof__(foo)*, decltype()>::value, "");
 }
+
+namespace InConstantContext {
+void foo(const char *s) __attribute__((enable_if(((void)__builtin_constant_p(*s), true), "trap"))) {}
+
+void test() {
+  InConstantContext::foo("abc");
+}
+} // namespace InConstantContext
Index: test/SemaCXX/constant-expression-cxx1y.cpp
===
--- test/SemaCXX/constant-expression-cxx1y.cpp
+++ test/SemaCXX/constant-expression-cxx1y.cpp
@@ -1135,3 +1135,27 @@
   return __builtin_constant_p(*__s);
 }
 constexpr bool n = indirect_builtin_constant_p("a");
+
+__attribute__((enable_if(indirect_builtin_constant_p("a") == n, "OK")))
+int test_in_enable_if() { return 0; }
+int n2 = test_in_enable_if();
+
+template 
+int test_in_template_param() { return 0; }
+int n3 = test_in_template_param();
+
+void test_in_case(int n) {
+  switch (n) {
+case indirect_builtin_constant_p("abc"):
+break;
+  }
+}
+enum InEnum1 {
+  ONE = indirect_builtin_constant_p("abc")
+};
+enum InEnum2 : int {
+  ONE = indirect_builtin_constant_p("abc")
+};
+enum class InEnum3 {
+  ONE = indirect_builtin_constant_p("abc")
+};
Index: lib/AST/ExprConstant.cpp
===
--- lib/AST/ExprConstant.cpp
+++ lib/AST/ExprConstant.cpp
@@ -11131,6 +11131,7 @@
   const ASTContext ) const {
   EvalInfo::EvaluationMode EM = EvalInfo::EM_ConstantExpression;
   EvalInfo Info(Ctx, Result, EM);
+  Info.InConstantContext = true;
   if (!::Evaluate(Result.Val, Info, this))
 return false;
 
@@ -11771,6 +11772,7 @@
 const Expr *This) const {
   Expr::EvalStatus Status;
   EvalInfo Info(Ctx, Status, EvalInfo::EM_ConstantExpressionUnevaluated);
+  Info.InConstantContext = true;
 
   LValue ThisVal;
   const LValue *ThisPtr = nullptr;
@@ -11854,6 +11856,7 @@
 
   EvalInfo Info(FD->getASTContext(), Status,
 EvalInfo::EM_PotentialConstantExpressionUnevaluated);
+  Info.InConstantContext = true;
 
   // Fabricate a call stack frame to give the arguments 

[PATCH] D58921: [CMake] Tell libc++ that we're using compiler-rt on Apple platforms

2019-03-08 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added a comment.

Is this to work around 
https://github.com/llvm/llvm-project/blob/f84083b4dbb1ddb6d2783400f11121f490cdb5a8/libcxx/lib/CMakeLists.txt#L312?


Repository:
  rC Clang

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

https://reviews.llvm.org/D58921



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


[PATCH] D45978: dllexport const variables must have external linkage.

2019-03-08 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

I think we're pretty close! Some of the testing code can be cleaned up, but I 
could also use some help verifying that we're correctly matching the behavior 
of GCC as well.




Comment at: test/Sema/dllexport-2.cpp:11
+// expected-warning@+3 {{__declspec attribute 'dllexport' is not supported}}
+// expected-error@+2 {{default initialization of an object of const type}}
+#endif

I think the pattern to be used here is:
```
#ifdef MSVC
// expected-error@+4 {{'j' must have external linkage when declared 
'dllexport'}}
#else
// expected-warning@+2 {{__declspec attribute 'dllexport' is not supported}}
#endif
__declspec(dllexport) int const j; // expected-error {{default initialization 
of an object of const type 'const int'}}
```



Comment at: test/Sema/dllexport-2.cpp:25
+#endif
+__declspec(dllexport) CInt j2;
+

Same here as above.



Comment at: test/SemaCXX/dllexport.cpp:72-74
+#ifndef MS
 namespace{ __declspec(dllexport) int InternalGlobal; } // 
expected-error{{'(anonymous namespace)::InternalGlobal' must have external 
linkage when declared 'dllexport'}}
+#endif

I don't have a copy of mingw handy -- can you test that this behavior matches 
the behavior when targeting mingw32 with GCC? Might also be a good idea to test 
cygwin as a target as well. I would have thought that they would behave the 
same as MSVC, but I can't easily test it myself.



Comment at: test/SemaCXX/dllexport.cpp:129
 template __declspec(dllexport) Internal InternalTypeVarTmpl; // 
expected-error{{'InternalTypeVarTmpl' must have external linkage when declared 
'dllexport'}}
+#ifndef MS
 namespace{ template __declspec(dllexport) int InternalVarTmpl; 
} // expected-error{{'(anonymous namespace)::InternalVarTmpl' must have 
external linkage when declared 'dllexport'}}

Same question here as above.



Comment at: test/SemaCXX/dllimport.cpp:124
 __declspec(dllimport) Internal InternalTypeGlobal; // 
expected-error{{'InternalTypeGlobal' must have external linkage when declared 
'dllimport'}}
+#ifndef MS
 namespace{ __declspec(dllimport) int InternalGlobal; } // 
expected-error{{'(anonymous namespace)::InternalGlobal' must have external 
linkage when declared 'dllimport'}}

Likewise here.



Comment at: test/SemaCXX/dllimport.cpp:218
 template __declspec(dllimport) Internal InternalTypeVarTmpl; // 
expected-error{{'InternalTypeVarTmpl' must have external linkage when declared 
'dllimport'}}
+#ifndef MS
 namespace{ template __declspec(dllimport) int InternalVarTmpl; 
} // expected-error{{'(anonymous namespace)::InternalVarTmpl' must have 
external linkage when declared 'dllimport'}}

and here


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

https://reviews.llvm.org/D45978



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


[PATCH] D58797: [Sema] Add some compile time _FORTIFY_SOURCE diagnostics

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



Comment at: clang/lib/AST/Decl.cpp:2994
+///
+/// \param ConsiderWrapperFunctions If we should consider wrapper functions as
+/// their wrapped builtins. This shouldn't be done in general, but its useful 
in

If we should -> If true, we should



Comment at: clang/lib/AST/Decl.cpp:2995
+/// \param ConsiderWrapperFunctions If we should consider wrapper functions as
+/// their wrapped builtins. This shouldn't be done in general, but its useful 
in
+/// Sema to diagnose calls to wrappers based on their semantics.

its -> it's



Comment at: clang/lib/Sema/SemaChecking.cpp:319
+// If the parameter has a pass_object_size attribute, then we should use
+// it's (potentially) more strict checking mode. Otherwise, conservatively
+// assume type 0.

it's -> its



Comment at: clang/lib/Sema/SemaChecking.cpp:367
+DiagID = diag::warn_memcpy_chk_overflow;
+if (!evaluateObjectSize(TheCall->getNumArgs()-1) ||
+!evaluateSizeArg(TheCall->getNumArgs()-2))

george.burgess.iv wrote:
> nit: All of these cases (and the two lambdas above) look super similar. Might 
> it be clearer to just set `SizeIndex` and `ObjectIndex` variables from here, 
> and actually `evaluate` them before `UsedSize.ule(ComputedSize)`?
> 
> If not, I'm OK with this as-is.
Formatting looks off here -- run the patch through clang-format?



Comment at: clang/lib/Sema/SemaChecking.cpp:388
+  return;
+// Whether these functions overflow depend on the runtime strlen of the
+// string, not just the buffer size, so emitting the "always overflow"

depend -> depends



Comment at: clang/lib/Sema/SemaChecking.cpp:423
+  StringRef FunctionName = getASTContext().BuiltinInfo.getName(BuiltinID);
+  if (DiagID == diag::warn_memcpy_chk_overflow) {
+// __builtin___memcpy_chk -> memcpy

Why don't we want to do this for the new fortify diagnostics?


Repository:
  rC Clang

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

https://reviews.llvm.org/D58797



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


[PATCH] D58346: [Sema] Change addr space diagnostics in casts to follow C++ style

2019-03-08 Thread David Salinas via Phabricator via cfe-commits
david-salinas added a comment.

This change has caused a regression for generic C++.  Should this affect OpenCL 
only?

The following simple test causes the diagnostic to be emitted:

#define ATTR_GLOBAL __attribute__((address_space(1)))

int calc(int ATTR_GLOBAL *ip) {

  int i = *ip;
  return i+1;

}

int main() {

  int i = 99;
  int *ip = 
  
  auto *g_i_ptr = reinterpret_cast(ip);
  return calc(g_i_ptr);

}


Repository:
  rL LLVM

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

https://reviews.llvm.org/D58346



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


Re: r355182 - [clang-format] [NFC] clang-format the Format library

2019-03-08 Thread Michael Kruse via cfe-commits
Isn't this kind of commit discouraged?, as by
https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access

> Avoid committing formatting- or whitespace-only changes outside of code you 
> plan to make subsequent changes to.

and the discussion after which this has been added:
https://lists.llvm.org/pipermail/llvm-dev/2018-July/124941.html


Michael

Am Fr., 1. März 2019 um 03:09 Uhr schrieb Paul Hoad via cfe-commits
:
>
> Author: paulhoad
> Date: Fri Mar  1 01:09:54 2019
> New Revision: 355182
>
> URL: http://llvm.org/viewvc/llvm-project?rev=355182=rev
> Log:
> [clang-format] [NFC] clang-format the Format library
>
> Previously revisions commited non-clang-formatted changes to the Format 
> library, this means submitting any revision e.g. {D55170} can cause 
> additional whitespace changes to potentially be included in a revision.
>
> Commit a non functional change using latest build Windows clang-format 
> r351376 with no other changes, to remove these differences
>
> All FormatTests
> pass [==] 652 tests from 20 test cases ran.
>
> Modified:
> cfe/trunk/lib/Format/BreakableToken.cpp
> cfe/trunk/lib/Format/BreakableToken.h
> cfe/trunk/lib/Format/ContinuationIndenter.cpp
> cfe/trunk/lib/Format/Format.cpp
> cfe/trunk/lib/Format/FormatToken.h
> cfe/trunk/lib/Format/FormatTokenLexer.h
> cfe/trunk/lib/Format/TokenAnnotator.cpp
> cfe/trunk/lib/Format/UnwrappedLineFormatter.cpp
> cfe/trunk/lib/Format/UnwrappedLineFormatter.h
> cfe/trunk/lib/Format/UnwrappedLineParser.cpp
> cfe/trunk/lib/Format/UnwrappedLineParser.h
> cfe/trunk/lib/Format/WhitespaceManager.cpp
>
> Modified: cfe/trunk/lib/Format/BreakableToken.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/BreakableToken.cpp?rev=355182=355181=355182=diff
> ==
> --- cfe/trunk/lib/Format/BreakableToken.cpp (original)
> +++ cfe/trunk/lib/Format/BreakableToken.cpp Fri Mar  1 01:09:54 2019
> @@ -62,12 +62,10 @@ static StringRef getLineCommentIndentPre
>return LongestPrefix;
>  }
>
> -static BreakableToken::Split getCommentSplit(StringRef Text,
> - unsigned ContentStartColumn,
> - unsigned ColumnLimit,
> - unsigned TabWidth,
> - encoding::Encoding Encoding,
> - const FormatStyle ) {
> +static BreakableToken::Split
> +getCommentSplit(StringRef Text, unsigned ContentStartColumn,
> +unsigned ColumnLimit, unsigned TabWidth,
> +encoding::Encoding Encoding, const FormatStyle ) {
>LLVM_DEBUG(llvm::dbgs() << "Comment split: \"" << Text
><< "\", Column limit: " << ColumnLimit
><< ", Content start: " << ContentStartColumn << 
> "\n");
> @@ -191,7 +189,7 @@ bool switchesFormatting(const FormatToke
>
>  unsigned
>  BreakableToken::getLengthAfterCompression(unsigned RemainingTokenColumns,
> -  Split Split) const {
> +  Split Split) const {
>// Example: consider the content
>// lala  lala
>// - RemainingTokenColumns is the original number of columns, 10;
> @@ -870,23 +868,20 @@ void BreakableLineCommentSection::reflow
>  // the next line.
>  unsigned WhitespaceLength =
>  Lines[LineIndex].data() - tokenAt(LineIndex).TokenText.data() - 
> Offset;
> -Whitespaces.replaceWhitespaceInToken(*Tokens[LineIndex],
> - Offset,
> +Whitespaces.replaceWhitespaceInToken(*Tokens[LineIndex], Offset,
>   /*ReplaceChars=*/WhitespaceLength,
>   /*PreviousPostfix=*/"",
>   /*CurrentPrefix=*/"",
>   /*InPPDirective=*/false,
>   /*Newlines=*/0,
>   /*Spaces=*/0);
> -
>}
>// Replace the indent and prefix of the token with the reflow prefix.
>unsigned Offset =
>Lines[LineIndex].data() - tokenAt(LineIndex).TokenText.data();
>unsigned WhitespaceLength =
>Content[LineIndex].data() - Lines[LineIndex].data();
> -  Whitespaces.replaceWhitespaceInToken(*Tokens[LineIndex],
> -   Offset,
> +  Whitespaces.replaceWhitespaceInToken(*Tokens[LineIndex], Offset,
> /*ReplaceChars=*/WhitespaceLength,
> /*PreviousPostfix=*/"",
> /*CurrentPrefix=*/ReflowPrefix,
>
> Modified: cfe/trunk/lib/Format/BreakableToken.h
> URL: 
> 

r355729 - [OPENMP]Remove debug service variable.

2019-03-08 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Fri Mar  8 12:48:54 2019
New Revision: 355729

URL: http://llvm.org/viewvc/llvm-project?rev=355729=rev
Log:
[OPENMP]Remove debug service variable.

Removed not required service variable for the debug info.

Modified:
cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
cfe/trunk/test/OpenMP/nvptx_target_firstprivate_codegen.cpp

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp?rev=355729=355728=355729=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp Fri Mar  8 12:48:54 2019
@@ -4958,20 +4958,6 @@ static std::pair get
 }
 
 void CGOpenMPRuntimeNVPTX::clear() {
-  if (CGDebugInfo *DI = CGM.getModuleDebugInfo())
-if (CGM.getCodeGenOpts().getDebugInfo() >=
-codegenoptions::LimitedDebugInfo) {
-  ASTContext  = CGM.getContext();
-  auto *VD = VarDecl::Create(
-  C, C.getTranslationUnitDecl(), SourceLocation(), SourceLocation(),
-  ("_$_"), C.IntTy, /*TInfo=*/nullptr, SC_Static);
-  auto *Var = cast(
-  CGM.CreateRuntimeVariable(CGM.IntTy, "_$_"));
-  Var->setInitializer(llvm::ConstantInt::getNullValue(CGM.IntTy));
-  Var->setLinkage(llvm::GlobalVariable::CommonLinkage);
-  CGM.addCompilerUsedGlobal(Var);
-  DI->EmitGlobalVariable(Var, VD);
-}
   if (!GlobalizedRecords.empty()) {
 ASTContext  = CGM.getContext();
 llvm::SmallVector GlobalRecs;

Modified: cfe/trunk/test/OpenMP/nvptx_target_firstprivate_codegen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/nvptx_target_firstprivate_codegen.cpp?rev=355729=355728=355729=diff
==
--- cfe/trunk/test/OpenMP/nvptx_target_firstprivate_codegen.cpp (original)
+++ cfe/trunk/test/OpenMP/nvptx_target_firstprivate_codegen.cpp Fri Mar  8 
12:48:54 2019
@@ -17,8 +17,7 @@ struct TT {
 // TCHECK-DAG:  [[TTII:%.+]] = type { i32, i32 }
 // TCHECK-DAG:  [[S1:%.+]] = type { double }
 
-// TCHECK: @__omp_offloading_firstprivate__{{.+}}_e_l28 = internal 
addrspace(4) global [[TTII]] zeroinitializer
-// TCHECK: @{{.*}}_$_{{.*}} = common global i32 0, !dbg !{{[0-9]+}}
+// TCHECK: @__omp_offloading_firstprivate__{{.+}}_e_l27 = internal 
addrspace(4) global [[TTII]] zeroinitializer
 int foo(int n, double *ptr) {
   int a = 0;
   short aa = 0;


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


[PATCH] D56990: Bugfix for Replacement of tied operand of inline asm

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

We expect that tests for clang IR generation should look something like 
clang/test/CodeGen/asm-inout.c.

Even though a test like that isn't directly testing the overall behavior, we 
try to separate tests of clang's behavior from tests of LLVM's behavior.  It 
gives better test coverage by ensuring that clang behaves the way we expect, 
and the LLVM backend behaves the way we expect.  This is important because 
clang isn't the only frontend that uses LLVM code generation.  Also, test 
written like that tend to be easier to read.

If you want to ensure the IR is eventually lowered correctly, you can add a 
second test to llvm/test/CodeGen/X86/, which essentially take the IR generated 
by clang, runs it through llc, and checks we get the expected result.  Maybe 
that test is worth adding here; we don't have very much test coverage for 
inline asm using MMX.


Repository:
  rC Clang

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

https://reviews.llvm.org/D56990



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


r355726 - [docs] Fix checkers.rst doc for PointerSorting checker

2019-03-08 Thread Mandeep Singh Grang via cfe-commits
Author: mgrang
Date: Fri Mar  8 12:35:25 2019
New Revision: 355726

URL: http://llvm.org/viewvc/llvm-project?rev=355726=rev
Log:
[docs] Fix checkers.rst doc for PointerSorting checker

Modified:
cfe/trunk/docs/analyzer/checkers.rst

Modified: cfe/trunk/docs/analyzer/checkers.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/analyzer/checkers.rst?rev=355726=355725=355726=diff
==
--- cfe/trunk/docs/analyzer/checkers.rst (original)
+++ cfe/trunk/docs/analyzer/checkers.rst Fri Mar  8 12:35:25 2019
@@ -1944,7 +1944,7 @@ Check for out-of-bounds access in string
  }
 
 alpha.nondeterminism.PointerSorting (C++)
-"
+"
 Check for non-determinism caused by sorting of pointers.
 
 .. code-block:: c


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


[PATCH] D58921: [CMake] Tell libc++ that we're using compiler-rt on Apple platforms

2019-03-08 Thread Louis Dionne via Phabricator via cfe-commits
ldionne added a comment.

Ping.


Repository:
  rC Clang

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

https://reviews.llvm.org/D58921



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


[libunwind] r355725 - Revert "[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/"

2019-03-08 Thread Matthew Voss via cfe-commits
Author: ormris
Date: Fri Mar  8 12:33:55 2019
New Revision: 355725

URL: http://llvm.org/viewvc/llvm-project?rev=355725=rev
Log:
Revert "[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/"

This broke the windows bots.

This reverts commit 28302c66d2586074f77497d5dc4eac7182b679e0.

Modified:
libunwind/trunk/CMakeLists.txt
libunwind/trunk/src/CMakeLists.txt

Modified: libunwind/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=355725=355724=355725=diff
==
--- libunwind/trunk/CMakeLists.txt (original)
+++ libunwind/trunk/CMakeLists.txt Fri Mar  8 12:33:55 2019
@@ -187,25 +187,20 @@ string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[
${PACKAGE_VERSION})
 
 if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
-  set(LIBUNWIND_LIBRARY_DIR 
${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}${LIBUNWIND_LIBDIR_SUBDIR})
-  set(LIBUNWIND_INSTALL_LIBRARY_DIR 
lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE})
-  if(LIBCXX_LIBDIR_SUBDIR)
-string(APPEND LIBUNWIND_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
-string(APPEND LIBUNWIND_INSTALL_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
-  endif()
+  set(DEFAULT_INSTALL_PREFIX 
lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/${LLVM_DEFAULT_TARGET_TRIPLE}/)
+  set(LIBUNWIND_LIBRARY_DIR 
${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/${LLVM_DEFAULT_TARGET_TRIPLE}/lib${LIBUNWIND_LIBDIR_SUFFIX})
 elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
   set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
-  set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX})
 else()
   set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX})
-  set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX})
 endif()
 
 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR})
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR})
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR})
 
-set(LIBUNWIND_INSTALL_PREFIX "" CACHE STRING "Define libunwind destination 
prefix.")
+set(LIBUNWIND_INSTALL_PREFIX ${DEFAULT_INSTALL_PREFIX} CACHE STRING
+"Define libunwind destination prefix.")
 
 set(LIBUNWIND_C_FLAGS "")
 set(LIBUNWIND_CXX_FLAGS "")

Modified: libunwind/trunk/src/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/CMakeLists.txt?rev=355725=355724=355725=diff
==
--- libunwind/trunk/src/CMakeLists.txt (original)
+++ libunwind/trunk/src/CMakeLists.txt Fri Mar  8 12:33:55 2019
@@ -178,8 +178,8 @@ add_custom_target(unwind DEPENDS ${LIBUN
 
 if (LIBUNWIND_INSTALL_LIBRARY)
   install(TARGETS ${LIBUNWIND_INSTALL_TARGETS}
-LIBRARY DESTINATION 
${LIBUNWIND_INSTALL_PREFIX}${LIBUNWIND_INSTALL_LIBRARY_DIR} COMPONENT unwind
-ARCHIVE DESTINATION 
${LIBUNWIND_INSTALL_PREFIX}${LIBUNWIND_INSTALL_LIBRARY_DIR} COMPONENT unwind)
+LIBRARY DESTINATION 
${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind
+ARCHIVE DESTINATION 
${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind)
 endif()
 
 if (NOT CMAKE_CONFIGURATION_TYPES AND LIBUNWIND_INSTALL_LIBRARY)


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


r355725 - Revert "[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/"

2019-03-08 Thread Matthew Voss via cfe-commits
Author: ormris
Date: Fri Mar  8 12:33:55 2019
New Revision: 355725

URL: http://llvm.org/viewvc/llvm-project?rev=355725=rev
Log:
Revert "[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/"

This broke the windows bots.

This reverts commit 28302c66d2586074f77497d5dc4eac7182b679e0.

Modified:
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains/Fuchsia.cpp
cfe/trunk/lib/Driver/ToolChains/Linux.cpp
cfe/trunk/test/Driver/linux-per-target-runtime-dir.c

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=355725=355724=355725=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Fri Mar  8 12:33:55 2019
@@ -75,11 +75,6 @@ ToolChain::ToolChain(const Driver , co
   CachedRTTIMode(CalculateRTTIMode(Args, Triple, CachedRTTIArg)) {
   SmallString<128> P;
 
-  P.assign(D.Dir);
-  llvm::sys::path::append(P, "..", "lib", D.getTargetTriple());
-  if (getVFS().exists(P))
-getLibraryPaths().push_back(P.str());
-
   P.assign(D.ResourceDir);
   llvm::sys::path::append(P, D.getTargetTriple(), "lib");
   if (getVFS().exists(P))

Modified: cfe/trunk/lib/Driver/ToolChains/Fuchsia.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Fuchsia.cpp?rev=355725=355724=355725=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Fuchsia.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Fuchsia.cpp Fri Mar  8 12:33:55 2019
@@ -257,8 +257,8 @@ void Fuchsia::AddClangCXXStdlibIncludeAr
 
   switch (GetCXXStdlibType(DriverArgs)) {
   case ToolChain::CST_Libcxx: {
-SmallString<128> P(getDriver().Dir);
-llvm::sys::path::append(P, "..", "include", "c++", "v1");
+SmallString<128> P(getDriver().ResourceDir);
+llvm::sys::path::append(P, "include", "c++", "v1");
 addSystemInclude(DriverArgs, CC1Args, P.str());
 break;
   }

Modified: cfe/trunk/lib/Driver/ToolChains/Linux.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Linux.cpp?rev=355725=355724=355725=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Linux.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Linux.cpp Fri Mar  8 12:33:55 2019
@@ -880,6 +880,7 @@ void Linux::addLibCxxIncludePaths(const
   llvm::opt::ArgStringList ) const {
   const std::string& SysRoot = computeSysRoot();
   const std::string LibCXXIncludePathCandidates[] = {
+  DetectLibcxxIncludePath(getDriver().ResourceDir + "/include/c++"),
   DetectLibcxxIncludePath(getDriver().Dir + "/../include/c++"),
   // If this is a development, non-installed, clang, libcxx will
   // not be found at ../include/c++ but it likely to be found at

Modified: cfe/trunk/test/Driver/linux-per-target-runtime-dir.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/linux-per-target-runtime-dir.c?rev=355725=355724=355725=diff
==
--- cfe/trunk/test/Driver/linux-per-target-runtime-dir.c (original)
+++ cfe/trunk/test/Driver/linux-per-target-runtime-dir.c Fri Mar  8 12:33:55 
2019
@@ -6,14 +6,12 @@
 // RUN: --gcc-toolchain="" \
 // RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-PER-TARGET-RUNTIME %s
-// CHECK-PER-TARGET-RUNTIME: InstalledDir: [[INSTDIR:.*]]
 // CHECK-PER-TARGET-RUNTIME: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
 // CHECK-PER-TARGET-RUNTIME: "-resource-dir" "[[RESDIR:[^"]*]]"
 // CHECK-PER-TARGET-RUNTIME: "-isysroot" "[[SYSROOT:[^"]+]]"
-// CHECK-PER-TARGET-RUNTIME: "-internal-isystem" 
"[[INSTDIR]]/../include/c++/v1"
+// CHECK-PER-TARGET-RUNTIME: "-internal-isystem" "[[RESDIR]]/include/c++/v1"
 // CHECK-PER-TARGET-RUNTIME: "-internal-isystem" 
"[[SYSROOT]]/usr/local/include"
 // CHECK-PER-TARGET-RUNTIME: "--sysroot=[[SYSROOT]]"
-// CHECK-PER-TARGET-RUNTIME: 
"-L[[INSTDIR]]{{/|}}..{{/|}}lib{{/|}}x86_64-linux-gnu"
 // CHECK-PER-TARGET-RUNTIME: 
"-L[[RESDIR]]{{/|}}x86_64-linux-gnu{{/|}}lib"
 
 // RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \


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


r355721 - Revert "Recommit "Support attribute used in member funcs of class templates""

2019-03-08 Thread Rafael Auler via cfe-commits
Author: rafauler
Date: Fri Mar  8 12:23:57 2019
New Revision: 355721

URL: http://llvm.org/viewvc/llvm-project?rev=355721=rev
Log:
Revert "Recommit "Support attribute used in member funcs of class templates""

There is nontrivial bug caused in lld that I need to further
investigate. Meanwhile, I'll revert this.

This reverts commit 8297e93480c636dc90fd14653c5a66406193363f.

Removed:

cfe/trunk/test/CodeGenCXX/attr-used-member-function-implicit-instantiation.cpp
Modified:
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=355721=355720=355721=diff
==
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Fri Mar  8 12:23:57 2019
@@ -2232,20 +2232,6 @@ TemplateDeclInstantiator::VisitCXXMethod
 Owner->addDecl(Method);
   }
 
-  // PR17480: Honor the used attribute to instantiate member function
-  // definitions
-  if (Method->hasAttr()) {
-if (const auto *A = dyn_cast(Owner)) {
-  SourceLocation Loc;
-  if (const MemberSpecializationInfo *MSInfo =
-  A->getMemberSpecializationInfo())
-Loc = MSInfo->getPointOfInstantiation();
-  else if (const auto *Spec = dyn_cast(A))
-Loc = Spec->getPointOfInstantiation();
-  SemaRef.MarkFunctionReferenced(Loc, Method);
-}
-  }
-
   return Method;
 }
 

Removed: 
cfe/trunk/test/CodeGenCXX/attr-used-member-function-implicit-instantiation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/attr-used-member-function-implicit-instantiation.cpp?rev=355720=auto
==
--- 
cfe/trunk/test/CodeGenCXX/attr-used-member-function-implicit-instantiation.cpp 
(original)
+++ 
cfe/trunk/test/CodeGenCXX/attr-used-member-function-implicit-instantiation.cpp 
(removed)
@@ -1,19 +0,0 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | 
FileCheck %s
-
-// Check that PR17480 is fixed: __attribute__((used)) ignored in templated
-// classes
-namespace InstantiateUsedMemberDefinition {
-template 
-struct S {
-  int __attribute__((used)) f() {
-return 0;
-  }
-};
-
-void test() {
-  // Check that InstantiateUsedMemberDefinition::S::f() is defined
-  // as a result of the S class template implicit instantiation
-  // CHECK: define linkonce_odr i32 
@_ZN31InstantiateUsedMemberDefinition1SIiE1fEv
-  S inst;
-}
-} // namespace InstantiateUsedMemberDefinition


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


[PATCH] D58530: Add PragmaHandler for MSVC pragma execution_character_set

2019-03-08 Thread Nico Weber via Phabricator via cfe-commits
thakis accepted this revision.
thakis added a comment.

Ah ok, then I agree this doesn't need serialization yet :)

It'd be nice to at least diag that the stack use is valid (also for the warning 
stack), but it doesn't have to be in this change.


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

https://reviews.llvm.org/D58530



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


r355720 - [Analyzer] Checker for non-determinism caused by sorting of pointer-like elements

2019-03-08 Thread Mandeep Singh Grang via cfe-commits
Author: mgrang
Date: Fri Mar  8 12:13:53 2019
New Revision: 355720

URL: http://llvm.org/viewvc/llvm-project?rev=355720=rev
Log:
[Analyzer] Checker for non-determinism caused by sorting of pointer-like 
elements

Summary:
Added a new category of checkers for non-determinism. Added a checker for 
non-determinism
caused due to sorting containers with pointer-like elements.

Reviewers: NoQ, george.karpenkov, whisperity, Szelethus

Reviewed By: NoQ, Szelethus

Subscribers: Charusso, baloghadamsoftware, jdoerfert, donat.nagy, dkrupp, 
martong, dblaikie, MTC, Szelethus, mgorny, xazax.hun, szepet, rnkovacs, 
a.sidorin, mikhail.ramalho, cfe-commits

Tags: #clang

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

Added:
cfe/trunk/lib/StaticAnalyzer/Checkers/PointerSortingChecker.cpp
cfe/trunk/test/Analysis/ptr-sort.cpp
Modified:
cfe/trunk/docs/analyzer/checkers.rst
cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt
cfe/trunk/test/Analysis/Inputs/system-header-simulator-cxx.h
cfe/trunk/www/analyzer/alpha_checks.html

Modified: cfe/trunk/docs/analyzer/checkers.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/analyzer/checkers.rst?rev=355720=355719=355720=diff
==
--- cfe/trunk/docs/analyzer/checkers.rst (original)
+++ cfe/trunk/docs/analyzer/checkers.rst Fri Mar  8 12:13:53 2019
@@ -1943,6 +1943,18 @@ Check for out-of-bounds access in string
int y = strlen((char *)); // warn
  }
 
+alpha.nondeterminism.PointerSorting (C++)
+"
+Check for non-determinism caused by sorting of pointers.
+
+.. code-block:: c
+
+ void test() {
+  int a = 1, b = 2;
+  std::vector V = {, };
+  std::sort(V.begin(), V.end()); // warn
+ }
+
 
 Debug Checkers
 ---

Modified: cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td?rev=355720=355719=355720=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td Fri Mar  8 
12:13:53 2019
@@ -94,6 +94,8 @@ def Debug : Package<"debug">;
 
 def CloneDetectionAlpha : Package<"clone">, ParentPackage;
 
+def NonDeterminismAlpha : Package<"nondeterminism">, ParentPackage;
+
 
//===--===//
 // Core Checkers.
 
//===--===//
@@ -1043,3 +1045,15 @@ def UnixAPIPortabilityChecker : Checker<
   Documentation;
 
 } // end optin.portability
+
+//===--===//
+// NonDeterminism checkers.
+//===--===//
+
+let ParentPackage = NonDeterminismAlpha in {
+
+def PointerSortingChecker : Checker<"PointerSorting">,
+  HelpText<"Check for non-determinism caused by sorting of pointers">,
+  Documentation;
+
+} // end alpha.nondeterminism

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt?rev=355720=355719=355720=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt Fri Mar  8 12:13:53 
2019
@@ -75,6 +75,7 @@ add_clang_library(clangStaticAnalyzerChe
   OSObjectCStyleCast.cpp
   PaddingChecker.cpp
   PointerArithChecker.cpp
+  PointerSortingChecker.cpp
   PointerSubChecker.cpp
   PthreadLockChecker.cpp
   RetainCountChecker/RetainCountChecker.cpp

Added: cfe/trunk/lib/StaticAnalyzer/Checkers/PointerSortingChecker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/PointerSortingChecker.cpp?rev=355720=auto
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/PointerSortingChecker.cpp (added)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/PointerSortingChecker.cpp Fri Mar  8 
12:13:53 2019
@@ -0,0 +1,114 @@
+//=== PointerSortingChecker.cpp - Pointer sorting checker --*- C++ 
-*--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// This file defines PointerSortingChecker which checks for non-determinism
+// caused due to sorting containers with pointer-like elements.
+//
+//===--===//
+
+#include "clang/ASTMatchers/ASTMatchFinder.h"

[PATCH] D50488: [Analyzer] Checker for non-determinism caused by sorting of pointer-like elements

2019-03-08 Thread Mandeep Singh Grang via Phabricator via cfe-commits
mgrang updated this revision to Diff 189905.

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

https://reviews.llvm.org/D50488

Files:
  docs/analyzer/checkers.rst
  include/clang/StaticAnalyzer/Checkers/Checkers.td
  lib/StaticAnalyzer/Checkers/CMakeLists.txt
  lib/StaticAnalyzer/Checkers/PointerSortingChecker.cpp
  test/Analysis/Inputs/system-header-simulator-cxx.h
  test/Analysis/ptr-sort.cpp
  www/analyzer/alpha_checks.html

Index: www/analyzer/alpha_checks.html
===
--- www/analyzer/alpha_checks.html
+++ www/analyzer/alpha_checks.html
@@ -33,6 +33,7 @@
 OS X Alpha Checkers
 Security Alpha Checkers
 Unix Alpha Checkers
+Non-determinism Alpha Checkers
 
 
 
@@ -1174,6 +1175,28 @@
 
 
 
+
+Non-determinism Alpha Checkers
+
+
+Name, DescriptionExample
+
+
+
+alpha.nondeterminism.PointerSorting
+(C++)
+Check for non-determinism caused by sorting of pointers.
+
+
+// C++
+void test() {
+ int a = 1, b = 2;
+ std::vector V = {, };
+ std::sort(V.begin(), V.end()); // warn
+}
+
+
+
  
  
 
Index: test/Analysis/ptr-sort.cpp
===
--- /dev/null
+++ test/Analysis/ptr-sort.cpp
@@ -0,0 +1,35 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.nondeterminism.PointerSorting %s -analyzer-output=text -verify
+
+#include "Inputs/system-header-simulator-cxx.h"
+
+bool f (int x) { return true; }
+bool g (int *x) { return true; }
+
+void PointerSorting() {
+  int a = 1, b = 2, c = 3;
+  std::vector V1 = {a, b};
+  std::vector V2 = {, };
+
+  std::is_sorted(V1.begin(), V1.end());// no-warning
+  std::nth_element(V1.begin(), V1.begin() + 1, V1.end());  // no-warning
+  std::partial_sort(V1.begin(), V1.begin() + 1, V1.end()); // no-warning
+  std::sort(V1.begin(), V1.end()); // no-warning
+  std::stable_sort(V1.begin(), V1.end());  // no-warning
+  std::partition(V1.begin(), V1.end(), f); // no-warning
+  std::stable_partition(V1.begin(), V1.end(), g);  // no-warning
+
+  std::is_sorted(V2.begin(), V2.end()); // expected-warning {{Sorting pointer-like elements can result in non-deterministic ordering}} [alpha.nondeterminism.PointerSorting]
+  // expected-note@-1 {{Sorting pointer-like elements can result in non-deterministic ordering}} [alpha.nondeterminism.PointerSorting]
+  std::nth_element(V2.begin(), V2.begin() + 1, V2.end()); // expected-warning {{Sorting pointer-like elements can result in non-deterministic ordering}} [alpha.nondeterminism.PointerSorting]
+  // expected-note@-1 {{Sorting pointer-like elements can result in non-deterministic ordering}} [alpha.nondeterminism.PointerSorting]
+  std::partial_sort(V2.begin(), V2.begin() + 1, V2.end()); // expected-warning {{Sorting pointer-like elements can result in non-deterministic ordering}} [alpha.nondeterminism.PointerSorting]
+  // expected-note@-1 {{Sorting pointer-like elements can result in non-deterministic ordering}} [alpha.nondeterminism.PointerSorting]
+  std::sort(V2.begin(), V2.end()); // expected-warning {{Sorting pointer-like elements can result in non-deterministic ordering}} [alpha.nondeterminism.PointerSorting]
+  // expected-note@-1 {{Sorting pointer-like elements can result in non-deterministic ordering}} [alpha.nondeterminism.PointerSorting]
+  std::stable_sort(V2.begin(), V2.end()); // expected-warning {{Sorting pointer-like elements can result in non-deterministic ordering}} [alpha.nondeterminism.PointerSorting]
+  // expected-note@-1 {{Sorting pointer-like elements can result in non-deterministic ordering}} [alpha.nondeterminism.PointerSorting]
+  std::partition(V2.begin(), V2.end(), f); // expected-warning {{Sorting pointer-like elements can result in non-deterministic ordering}} [alpha.nondeterminism.PointerSorting]
+  // expected-note@-1 {{Sorting pointer-like elements can result in non-deterministic ordering}} [alpha.nondeterminism.PointerSorting]
+  std::stable_partition(V2.begin(), V2.end(), g); // expected-warning {{Sorting pointer-like elements can result in non-deterministic ordering}} [alpha.nondeterminism.PointerSorting]
+  // expected-note@-1 {{Sorting pointer-like elements can result in non-deterministic ordering}} [alpha.nondeterminism.PointerSorting]
+}
Index: test/Analysis/Inputs/system-header-simulator-cxx.h
===
--- test/Analysis/Inputs/system-header-simulator-cxx.h
+++ test/Analysis/Inputs/system-header-simulator-cxx.h
@@ -822,3 +822,26 @@
 int *status);
 }}
 namespace abi = __cxxabiv1;
+
+namespace std {
+  template
+  bool is_sorted(ForwardIt first, ForwardIt last);
+
+  template 
+  void nth_element(RandomIt first, RandomIt nth, RandomIt last);
+
+  template
+  void partial_sort(RandomIt first, RandomIt middle, RandomIt last);
+
+  template
+  void sort (RandomIt first, RandomIt last);
+
+  template
+  void 

[PATCH] D50488: [Analyzer] Checker for non-determinism caused by sorting of pointer-like elements

2019-03-08 Thread Mandeep Singh Grang 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 rL355720: [Analyzer] Checker for non-determinism caused by 
sorting of pointer-like… (authored by mgrang, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D50488?vs=189905=189906#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D50488

Files:
  cfe/trunk/docs/analyzer/checkers.rst
  cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
  cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt
  cfe/trunk/lib/StaticAnalyzer/Checkers/PointerSortingChecker.cpp
  cfe/trunk/test/Analysis/Inputs/system-header-simulator-cxx.h
  cfe/trunk/test/Analysis/ptr-sort.cpp
  cfe/trunk/www/analyzer/alpha_checks.html

Index: cfe/trunk/docs/analyzer/checkers.rst
===
--- cfe/trunk/docs/analyzer/checkers.rst
+++ cfe/trunk/docs/analyzer/checkers.rst
@@ -1943,6 +1943,18 @@
int y = strlen((char *)); // warn
  }
 
+alpha.nondeterminism.PointerSorting (C++)
+"
+Check for non-determinism caused by sorting of pointers.
+
+.. code-block:: c
+
+ void test() {
+  int a = 1, b = 2;
+  std::vector V = {, };
+  std::sort(V.begin(), V.end()); // warn
+ }
+
 
 Debug Checkers
 ---
Index: cfe/trunk/www/analyzer/alpha_checks.html
===
--- cfe/trunk/www/analyzer/alpha_checks.html
+++ cfe/trunk/www/analyzer/alpha_checks.html
@@ -33,6 +33,7 @@
 OS X Alpha Checkers
 Security Alpha Checkers
 Unix Alpha Checkers
+Non-determinism Alpha Checkers
 
 
 
@@ -1174,6 +1175,28 @@
 
 
 
+
+Non-determinism Alpha Checkers
+
+
+Name, DescriptionExample
+
+
+
+alpha.nondeterminism.PointerSorting
+(C++)
+Check for non-determinism caused by sorting of pointers.
+
+
+// C++
+void test() {
+ int a = 1, b = 2;
+ std::vector V = {, };
+ std::sort(V.begin(), V.end()); // warn
+}
+
+
+
  
  
 
Index: cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
===
--- cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
+++ cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
@@ -94,6 +94,8 @@
 
 def CloneDetectionAlpha : Package<"clone">, ParentPackage;
 
+def NonDeterminismAlpha : Package<"nondeterminism">, ParentPackage;
+
 //===--===//
 // Core Checkers.
 //===--===//
@@ -1043,3 +1045,15 @@
   Documentation;
 
 } // end optin.portability
+
+//===--===//
+// NonDeterminism checkers.
+//===--===//
+
+let ParentPackage = NonDeterminismAlpha in {
+
+def PointerSortingChecker : Checker<"PointerSorting">,
+  HelpText<"Check for non-determinism caused by sorting of pointers">,
+  Documentation;
+
+} // end alpha.nondeterminism
Index: cfe/trunk/test/Analysis/Inputs/system-header-simulator-cxx.h
===
--- cfe/trunk/test/Analysis/Inputs/system-header-simulator-cxx.h
+++ cfe/trunk/test/Analysis/Inputs/system-header-simulator-cxx.h
@@ -822,3 +822,26 @@
 int *status);
 }}
 namespace abi = __cxxabiv1;
+
+namespace std {
+  template
+  bool is_sorted(ForwardIt first, ForwardIt last);
+
+  template 
+  void nth_element(RandomIt first, RandomIt nth, RandomIt last);
+
+  template
+  void partial_sort(RandomIt first, RandomIt middle, RandomIt last);
+
+  template
+  void sort (RandomIt first, RandomIt last);
+
+  template
+  void stable_sort(RandomIt first, RandomIt last);
+
+  template
+  BidirIt partition(BidirIt first, BidirIt last, UnaryPredicate p);
+
+  template
+  BidirIt stable_partition(BidirIt first, BidirIt last, UnaryPredicate p);
+}
Index: cfe/trunk/test/Analysis/ptr-sort.cpp
===
--- cfe/trunk/test/Analysis/ptr-sort.cpp
+++ cfe/trunk/test/Analysis/ptr-sort.cpp
@@ -0,0 +1,35 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.nondeterminism.PointerSorting %s -analyzer-output=text -verify
+
+#include "Inputs/system-header-simulator-cxx.h"
+
+bool f (int x) { return true; }
+bool g (int *x) { return true; }
+
+void PointerSorting() {
+  int a = 1, b = 2, c = 3;
+  std::vector V1 = {a, b};
+  std::vector V2 = {, };
+
+  std::is_sorted(V1.begin(), V1.end());// no-warning
+  std::nth_element(V1.begin(), V1.begin() + 1, V1.end());  // no-warning
+  std::partial_sort(V1.begin(), V1.begin() + 1, V1.end()); // no-warning
+  std::sort(V1.begin(), V1.end());   

Re: r355627 - Recommit "Support attribute used in member funcs of class templates"

2019-03-08 Thread Petr Hosek via cfe-commits
This seems to have broke the 2-stage LTO build of LLVM, the error is:

ld.lld:
/usr/local/google/home/phosek/clang-llvm/llvm-project/llvm/lib/IR/Constants.cpp:995:
static llvm::Constant *llvm::ConstantArray::getImpl(llvm::ArrayType *,
ArrayRef): Assertion `V[i]->getType() ==
Ty->getElementType() && "Wrong type in array element initializer"' failed.

The invocation this came from is:

/usr/local/google/home/phosek/clang-llvm/llvm-project/llvm-build/fuchsia/./bin/clang++
-fPIC -fvisibility-inlines-hidden -Werror=date-time
-Werror=unguarded-availability-new -std=c++11 -Wall -Wextra
-Wno-unused-parameter -Wwrite-strings -Wcast-qual
-Wmissing-field-initializers -pedantic -Wno-long-long
-Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type
-Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion
-fdiagnostics-color -ffunction-sections -fdata-sections -flto -O3
-gline-tables-only  -ldl -lpthread -fuse-ld=lld -Wl,--color-diagnostics
-Wl,-allow-shlib-undefined-Wl,-O3 -Wl,--gc-sections
tools/llvm-cov/CMakeFiles/llvm-cov.dir/llvm-cov.cpp.o
tools/llvm-cov/CMakeFiles/llvm-cov.dir/gcov.cpp.o
tools/llvm-cov/CMakeFiles/llvm-cov.dir/CodeCoverage.cpp.o
tools/llvm-cov/CMakeFiles/llvm-cov.dir/CoverageExporterJson.cpp.o
tools/llvm-cov/CMakeFiles/llvm-cov.dir/CoverageExporterLcov.cpp.o
tools/llvm-cov/CMakeFiles/llvm-cov.dir/CoverageFilters.cpp.o
tools/llvm-cov/CMakeFiles/llvm-cov.dir/CoverageReport.cpp.o
tools/llvm-cov/CMakeFiles/llvm-cov.dir/CoverageSummaryInfo.cpp.o
tools/llvm-cov/CMakeFiles/llvm-cov.dir/SourceCoverageView.cpp.o
tools/llvm-cov/CMakeFiles/llvm-cov.dir/SourceCoverageViewHTML.cpp.o
tools/llvm-cov/CMakeFiles/llvm-cov.dir/SourceCoverageViewText.cpp.o
tools/llvm-cov/CMakeFiles/llvm-cov.dir/TestingSupport.cpp.o  -o
bin/llvm-cov  -Wl,-rpath,"\$ORIGIN/../lib" lib/libLLVMCore.a
lib/libLLVMSupport.a lib/libLLVMObject.a lib/libLLVMCoverage.a
lib/libLLVMProfileData.a lib/libLLVMObject.a lib/libLLVMBitReader.a
lib/libLLVMMCParser.a lib/libLLVMMC.a lib/libLLVMDebugInfoCodeView.a
lib/libLLVMDebugInfoMSF.a lib/libLLVMCore.a lib/libLLVMBinaryFormat.a
lib/libLLVMSupport.a -lz -lrt -ldl -lm lib/libLLVMDemangle.a

On Thu, Mar 7, 2019 at 11:13 AM Rafael Auler via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: rafauler
> Date: Thu Mar  7 11:14:30 2019
> New Revision: 355627
>
> URL: http://llvm.org/viewvc/llvm-project?rev=355627=rev
> Log:
> Recommit "Support attribute used in member funcs of class templates"
>
> The patch originally broke code that was incompatible with GCC, but
> we want to follow GCC behavior here according to the discussion in
> https://reviews.llvm.org/D58216
>
> Original commit message:
> As PR17480 describes, clang does not support the used attribute
> for member functions of class templates. This means that if the member
> function is not used, its definition is never instantiated. This patch
> changes clang to emit the definition if it has the used attribute.
>
> Test Plan: Added a testcase
>
> Reviewed By: aaron.ballman
>
> Differential Revision: https://reviews.llvm.org/D56928
>
> Added:
>
> cfe/trunk/test/CodeGenCXX/attr-used-member-function-implicit-instantiation.cpp
> Modified:
> cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=355627=355626=355627=diff
>
> ==
> --- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Thu Mar  7 11:14:30
> 2019
> @@ -2232,6 +2232,20 @@ TemplateDeclInstantiator::VisitCXXMethod
>  Owner->addDecl(Method);
>}
>
> +  // PR17480: Honor the used attribute to instantiate member function
> +  // definitions
> +  if (Method->hasAttr()) {
> +if (const auto *A = dyn_cast(Owner)) {
> +  SourceLocation Loc;
> +  if (const MemberSpecializationInfo *MSInfo =
> +  A->getMemberSpecializationInfo())
> +Loc = MSInfo->getPointOfInstantiation();
> +  else if (const auto *Spec =
> dyn_cast(A))
> +Loc = Spec->getPointOfInstantiation();
> +  SemaRef.MarkFunctionReferenced(Loc, Method);
> +}
> +  }
> +
>return Method;
>  }
>
>
> Added:
> cfe/trunk/test/CodeGenCXX/attr-used-member-function-implicit-instantiation.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/attr-used-member-function-implicit-instantiation.cpp?rev=355627=auto
>
> ==
> ---
> cfe/trunk/test/CodeGenCXX/attr-used-member-function-implicit-instantiation.cpp
> (added)
> +++
> cfe/trunk/test/CodeGenCXX/attr-used-member-function-implicit-instantiation.cpp
> Thu Mar  7 11:14:30 2019
> @@ -0,0 +1,19 @@
> +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s |
> FileCheck %s
> +
> +// Check that PR17480 is fixed: 

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

2019-03-08 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.
Herald added a project: clang.

This broke the 2-stage LTO build of LLVM, the error is:

  ld.lld: 
/usr/local/google/home/phosek/clang-llvm/llvm-project/llvm/lib/IR/Constants.cpp:995:
 static llvm::Constant *llvm::ConstantArray::getImpl(llvm::ArrayType *, 
ArrayRef): Assertion `V[i]->getType() == Ty->getElementType() 
&& "Wrong type in array element initializer"' failed.

The invocation this came from is:

  
/usr/local/google/home/phosek/clang-llvm/llvm-project/llvm-build/fuchsia-xyz/./bin/clang++
  -fPIC -fvisibility-inlines-hidden -Werror=date-time 
-Werror=unguarded-availability-new -std=c++11 -Wall -Wextra 
-Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers 
-pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default 
-Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor 
-Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections 
-flto -O3 -gline-tables-only  -ldl -lpthread -fuse-ld=lld 
-Wl,--color-diagnostics -Wl,-allow-shlib-undefined-Wl,-O3 -Wl,--gc-sections 
tools/llvm-cov/CMakeFiles/llvm-cov.dir/llvm-cov.cpp.o 
tools/llvm-cov/CMakeFiles/llvm-cov.dir/gcov.cpp.o 
tools/llvm-cov/CMakeFiles/llvm-cov.dir/CodeCoverage.cpp.o 
tools/llvm-cov/CMakeFiles/llvm-cov.dir/CoverageExporterJson.cpp.o 
tools/llvm-cov/CMakeFiles/llvm-cov.dir/CoverageExporterLcov.cpp.o 
tools/llvm-cov/CMakeFiles/llvm-cov.dir/CoverageFilters.cpp.o 
tools/llvm-cov/CMakeFiles/llvm-cov.dir/CoverageReport.cpp.o 
tools/llvm-cov/CMakeFiles/llvm-cov.dir/CoverageSummaryInfo.cpp.o 
tools/llvm-cov/CMakeFiles/llvm-cov.dir/SourceCoverageView.cpp.o 
tools/llvm-cov/CMakeFiles/llvm-cov.dir/SourceCoverageViewHTML.cpp.o 
tools/llvm-cov/CMakeFiles/llvm-cov.dir/SourceCoverageViewText.cpp.o 
tools/llvm-cov/CMakeFiles/llvm-cov.dir/TestingSupport.cpp.o  -o bin/llvm-cov  
-Wl,-rpath,"\$ORIGIN/../lib" lib/libLLVMCore.a lib/libLLVMSupport.a 
lib/libLLVMObject.a lib/libLLVMCoverage.a lib/libLLVMProfileData.a 
lib/libLLVMObject.a lib/libLLVMBitReader.a lib/libLLVMMCParser.a 
lib/libLLVMMC.a lib/libLLVMDebugInfoCodeView.a lib/libLLVMDebugInfoMSF.a 
lib/libLLVMCore.a lib/libLLVMBinaryFormat.a lib/libLLVMSupport.a -lz -lrt -ldl 
-lm lib/libLLVMDemangle.a


Repository:
  rC Clang

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

https://reviews.llvm.org/D56928



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


[PATCH] D58930: Add XCOFF triple object format type for AIX

2019-03-08 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added a comment.

@jasonliu, you have had a number of patches committed into the project already 
(D22698 , D22702 
, D34649 ). 
Please go ahead with requesting commit access, and commit this patch with the 
additional fix when you are ready.




Comment at: llvm/lib/MC/MCObjectFileInfo.cpp:806
+Env = IsXCOFF;
+// TODO: Initialize MCObjectFileInfo for XCOFF format when MCSectionXCOFF 
is ready.
+break;

This line is over 80 characters.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D58930



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


[PATCH] D59048: Add AIX Target Info

2019-03-08 Thread Andus Yu via Phabricator via cfe-commits
andusy marked 2 inline comments as done.
andusy added inline comments.



Comment at: clang/test/CodeGen/arm-aapcs-zerolength-bitfield.c:5
+// RUN: %clang_cc1 -triple powerpc-ibm-aix7.1.0.0 %s -verify
+// expected-no-diagnostics
 

This file is pending a name change.


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

https://reviews.llvm.org/D59048



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


[PATCH] D59048: Add AIX Target Info

2019-03-08 Thread Andus Yu via Phabricator via cfe-commits
andusy marked 7 inline comments as done.
andusy added inline comments.



Comment at: clang/lib/Basic/Targets/OSTargets.h:641
+}
+  }
+

hubert.reinterpretcast wrote:
> D18360 sets `_THREAD_SAFE` to `1` when `-pthread` is specified. I believe 
> that to be correct. I believe whether or not `-pthread` is taken to be the 
> default on the platform is a separate consideration.
I've added a test in `clang/test/Preprocessor/init.c` to check if the macro is 
defined when `-pthread` is enabled. 


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

https://reviews.llvm.org/D59048



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


[PATCH] D59048: Add AIX Target Info

2019-03-08 Thread Andus Yu via Phabricator via cfe-commits
andusy updated this revision to Diff 189890.
andusy added a comment.
Herald added a subscriber: javed.absar.

- Updated comments
- Added testing for `UseZeroLengthBitfieldAlignment`
- Defined `_THREAD_SAFE ` when `-pthread` is enabled
- Check for definition of `__LP64__ ` and `_LP64 ` macros




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

https://reviews.llvm.org/D59048

Files:
  clang/lib/Basic/Targets.cpp
  clang/lib/Basic/Targets/OSTargets.h
  clang/lib/Basic/Targets/PPC.cpp
  clang/lib/Basic/Targets/PPC.h
  clang/test/CodeGen/arm-aapcs-zerolength-bitfield.c
  clang/test/Driver/types.c
  clang/test/Headers/max_align.c
  clang/test/Preprocessor/init.c
  clang/test/Sema/varargs-aix.c

Index: clang/test/Sema/varargs-aix.c
===
--- /dev/null
+++ clang/test/Sema/varargs-aix.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -triple powerpc-ibm-aix
+// RUN: %clang_cc1 -fsyntax-only -verify %s -triple powerpc64-ibm-aix
+// expected-no-diagnostics
+
+extern __builtin_va_list ap;
+extern char *ap;
Index: clang/test/Preprocessor/init.c
===
--- clang/test/Preprocessor/init.c
+++ clang/test/Preprocessor/init.c
@@ -6409,6 +6409,207 @@
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -target-feature +float128 -target-cpu power9 -fno-signed-char < /dev/null | FileCheck -check-prefix PPC-FLOAT128 %s
 // PPC-FLOAT128:#define __FLOAT128__ 1
 //
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-ibm-aix7.1.0.0 -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPC64-AIX %s
+//
+// PPC64-AIX:#define _AIX 1
+// PPC64-AIX:#define _ARCH_PPC 1
+// PPC64-AIX:#define _ARCH_PPC64 1
+// PPC64-AIX:#define _BIG_ENDIAN 1
+// PPC64-AIX:#define _IBMR2 1
+// PPC64-AIX:#define _LONG_LONG 1
+// PPC64-AIX:#define _LP64 1
+// PPC64-AIX:#define _POWER 1
+// PPC64-AIX:#define __64BIT__ 1
+// PPC64-AIX:#define __BIGGEST_ALIGNMENT__ 8 
+// PPC64-AIX:#define __BIG_ENDIAN__ 1
+// PPC64-AIX:#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__
+// PPC64-AIX:#define __CHAR16_TYPE__ unsigned short
+// PPC64-AIX:#define __CHAR32_TYPE__ unsigned int
+// PPC64-AIX:#define __CHAR_BIT__ 8
+// PPC64-AIX:#define __CHAR_UNSIGNED__ 1
+// PPC64-AIX:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324
+// PPC64-AIX:#define __DBL_DIG__ 15
+// PPC64-AIX:#define __DBL_EPSILON__ 2.2204460492503131e-16
+// PPC64-AIX:#define __DBL_HAS_DENORM__ 1
+// PPC64-AIX:#define __DBL_HAS_INFINITY__ 1
+// PPC64-AIX:#define __DBL_HAS_QUIET_NAN__ 1
+// PPC64-AIX:#define __DBL_MANT_DIG__ 53
+// PPC64-AIX:#define __DBL_MAX_10_EXP__ 308
+// PPC64-AIX:#define __DBL_MAX_EXP__ 1024
+// PPC64-AIX:#define __DBL_MAX__ 1.7976931348623157e+308
+// PPC64-AIX:#define __DBL_MIN_10_EXP__ (-307)
+// PPC64-AIX:#define __DBL_MIN_EXP__ (-1021)
+// PPC64-AIX:#define __DBL_MIN__ 2.2250738585072014e-308
+// PPC64-AIX:#define __DECIMAL_DIG__ __LDBL_DECIMAL_DIG__
+// PPC64-AIX:#define __FLT_DENORM_MIN__ 1.40129846e-45F
+// PPC64-AIX:#define __FLT_DIG__ 6
+// PPC64-AIX:#define __FLT_EPSILON__ 1.19209290e-7F
+// PPC64-AIX:#define __FLT_EVAL_METHOD__ 1  
+// PPC64-AIX:#define __FLT_HAS_DENORM__ 1
+// PPC64-AIX:#define __FLT_HAS_INFINITY__ 1
+// PPC64-AIX:#define __FLT_HAS_QUIET_NAN__ 1
+// PPC64-AIX:#define __FLT_MANT_DIG__ 24
+// PPC64-AIX:#define __FLT_MAX_10_EXP__ 38
+// PPC64-AIX:#define __FLT_MAX_EXP__ 128
+// PPC64-AIX:#define __FLT_MAX__ 3.40282347e+38F
+// PPC64-AIX:#define __FLT_MIN_10_EXP__ (-37)
+// PPC64-AIX:#define __FLT_MIN_EXP__ (-125)
+// PPC64-AIX:#define __FLT_MIN__ 1.17549435e-38F
+// PPC64-AIX:#define __FLT_RADIX__ 2
+// PPC64-AIX:#define __INT16_C_SUFFIX__
+// PPC64-AIX:#define __INT16_FMTd__ "hd"
+// PPC64-AIX:#define __INT16_FMTi__ "hi"
+// PPC64-AIX:#define __INT16_MAX__ 32767
+// PPC64-AIX:#define __INT16_TYPE__ short
+// PPC64-AIX:#define __INT32_C_SUFFIX__
+// PPC64-AIX:#define __INT32_FMTd__ "d"
+// PPC64-AIX:#define __INT32_FMTi__ "i"
+// PPC64-AIX:#define __INT32_MAX__ 2147483647
+// PPC64-AIX:#define __INT32_TYPE__ int
+// PPC64-AIX:#define __INT64_C_SUFFIX__ L
+// PPC64-AIX:#define __INT64_FMTd__ "ld"
+// PPC64-AIX:#define __INT64_FMTi__ "li"
+// PPC64-AIX:#define __INT64_MAX__ 9223372036854775807L
+// PPC64-AIX:#define __INT64_TYPE__ long int
+// PPC64-AIX:#define __INT8_C_SUFFIX__
+// PPC64-AIX:#define __INT8_FMTd__ "hhd"
+// PPC64-AIX:#define __INT8_FMTi__ "hhi"
+// PPC64-AIX:#define __INT8_MAX__ 127
+// PPC64-AIX:#define __INT8_TYPE__ signed char
+// PPC64-AIX:#define __INTMAX_C_SUFFIX__ L
+// PPC64-AIX:#define __INTMAX_FMTd__ "ld"
+// PPC64-AIX:#define __INTMAX_FMTi__ "li"
+// PPC64-AIX:#define __INTMAX_MAX__ 9223372036854775807L
+// PPC64-AIX:#define __INTMAX_TYPE__ long int
+// PPC64-AIX:#define __INTMAX_WIDTH__ 64
+// PPC64-AIX:#define __INTPTR_FMTd__ "ld"
+// PPC64-AIX:#define __INTPTR_FMTi__ "li"
+// PPC64-AIX:#define __INTPTR_MAX__ 9223372036854775807L
+// 

[PATCH] D59038: [8.0 Regression] Fix handling of `__builtin_constant_p` inside the enable_if attribute.

2019-03-08 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

In D59038#1422905 , @hans wrote:

> In D59038#1422890 , @rsmith wrote:
>
> > LGTM, and I think this is safe enough to take for Clang 8.
>
>
> Do you think the severity is high enough to spin another release candidate?


Yes. Very much so. It also effect template arguments, case statements, 
enumerators, and probably more.

> My concern is that since this didn't show up in testing until now, which I 
> guess is quite a while after it regressed, maybe it's not important enough to 
> delay the already late release?

The common case for hitting this bug requires using libstdc++ 7.0 or newer and 
C++17. This may be relatively rare for our release testers, who are probably 
either using libc++, targeting the system libstdc++, or not turning on C++17.
As libstdc++ 7.0 becomes more common and as more users move to C++17 people are 
going to run into this a lot.

> Also it sounds like it isn't completely fixed yet..

It is now.


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

https://reviews.llvm.org/D59038



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


[PATCH] D58530: Add PragmaHandler for MSVC pragma execution_character_set

2019-03-08 Thread Matt Gardner via Phabricator via cfe-commits
sigatrev added a comment.

This implementation doesn't track the push/pop stack, it just verifies the 
synax is valid and moves on. I modeled it after the PragmaWarningHandler which 
does the same, and thought it would be fine in this case since the only 
accepted value is a no-op.


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

https://reviews.llvm.org/D58530



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


[PATCH] D59038: [8.0 Regression] Fix handling of `__builtin_constant_p` inside the enable_if attribute.

2019-03-08 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 189888.
EricWF added a comment.

- Fix regressions inside template parameters, case statements, and enumerators.


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

https://reviews.llvm.org/D59038

Files:
  lib/AST/ExprConstant.cpp
  test/SemaCXX/constant-expression-cxx1y.cpp
  test/SemaCXX/enable_if.cpp


Index: test/SemaCXX/enable_if.cpp
===
--- test/SemaCXX/enable_if.cpp
+++ test/SemaCXX/enable_if.cpp
@@ -514,3 +514,11 @@
 
   static_assert(is_same<__typeof__(foo)*, decltype()>::value, "");
 }
+
+namespace InConstantContext {
+void foo(const char *s) 
__attribute__((enable_if(((void)__builtin_constant_p(*s), true), "trap"))) {}
+
+void test() {
+  InConstantContext::foo("abc");
+}
+} // namespace InConstantContext
Index: test/SemaCXX/constant-expression-cxx1y.cpp
===
--- test/SemaCXX/constant-expression-cxx1y.cpp
+++ test/SemaCXX/constant-expression-cxx1y.cpp
@@ -1135,3 +1135,22 @@
   return __builtin_constant_p(*__s);
 }
 constexpr bool n = indirect_builtin_constant_p("a");
+
+__attribute__((enable_if(indirect_builtin_constant_p("a") == n, "OK")))
+int test_in_enable_if() { return 0; }
+int n2 = test_in_enable_if();
+
+template 
+int test_in_template_param() { return 0; }
+int n3 = test_in_template_param();
+
+void test_in_case(int n) {
+  switch (n) {
+case indirect_builtin_constant_p("abc"):
+break;
+  }
+}
+
+enum InEnum {
+  ONE = indirect_builtin_constant_p("abc")
+};
Index: lib/AST/ExprConstant.cpp
===
--- lib/AST/ExprConstant.cpp
+++ lib/AST/ExprConstant.cpp
@@ -11131,6 +11131,7 @@
   const ASTContext ) const {
   EvalInfo::EvaluationMode EM = EvalInfo::EM_ConstantExpression;
   EvalInfo Info(Ctx, Result, EM);
+  Info.InConstantContext = true;
   if (!::Evaluate(Result.Val, Info, this))
 return false;
 
@@ -11771,6 +11772,7 @@
 const Expr *This) const {
   Expr::EvalStatus Status;
   EvalInfo Info(Ctx, Status, EvalInfo::EM_ConstantExpressionUnevaluated);
+  Info.InConstantContext = true;
 
   LValue ThisVal;
   const LValue *ThisPtr = nullptr;
@@ -11854,6 +11856,7 @@
 
   EvalInfo Info(FD->getASTContext(), Status,
 EvalInfo::EM_PotentialConstantExpressionUnevaluated);
+  Info.InConstantContext = true;
 
   // Fabricate a call stack frame to give the arguments a plausible cover 
story.
   ArrayRef Args;


Index: test/SemaCXX/enable_if.cpp
===
--- test/SemaCXX/enable_if.cpp
+++ test/SemaCXX/enable_if.cpp
@@ -514,3 +514,11 @@
 
   static_assert(is_same<__typeof__(foo)*, decltype()>::value, "");
 }
+
+namespace InConstantContext {
+void foo(const char *s) __attribute__((enable_if(((void)__builtin_constant_p(*s), true), "trap"))) {}
+
+void test() {
+  InConstantContext::foo("abc");
+}
+} // namespace InConstantContext
Index: test/SemaCXX/constant-expression-cxx1y.cpp
===
--- test/SemaCXX/constant-expression-cxx1y.cpp
+++ test/SemaCXX/constant-expression-cxx1y.cpp
@@ -1135,3 +1135,22 @@
   return __builtin_constant_p(*__s);
 }
 constexpr bool n = indirect_builtin_constant_p("a");
+
+__attribute__((enable_if(indirect_builtin_constant_p("a") == n, "OK")))
+int test_in_enable_if() { return 0; }
+int n2 = test_in_enable_if();
+
+template 
+int test_in_template_param() { return 0; }
+int n3 = test_in_template_param();
+
+void test_in_case(int n) {
+  switch (n) {
+case indirect_builtin_constant_p("abc"):
+break;
+  }
+}
+
+enum InEnum {
+  ONE = indirect_builtin_constant_p("abc")
+};
Index: lib/AST/ExprConstant.cpp
===
--- lib/AST/ExprConstant.cpp
+++ lib/AST/ExprConstant.cpp
@@ -11131,6 +11131,7 @@
   const ASTContext ) const {
   EvalInfo::EvaluationMode EM = EvalInfo::EM_ConstantExpression;
   EvalInfo Info(Ctx, Result, EM);
+  Info.InConstantContext = true;
   if (!::Evaluate(Result.Val, Info, this))
 return false;
 
@@ -11771,6 +11772,7 @@
 const Expr *This) const {
   Expr::EvalStatus Status;
   EvalInfo Info(Ctx, Status, EvalInfo::EM_ConstantExpressionUnevaluated);
+  Info.InConstantContext = true;
 
   LValue ThisVal;
   const LValue *ThisPtr = nullptr;
@@ -11854,6 +11856,7 @@
 
   EvalInfo Info(FD->getASTContext(), Status,
 EvalInfo::EM_PotentialConstantExpressionUnevaluated);
+  Info.InConstantContext = true;
 
   // Fabricate a call stack frame to give the arguments a plausible cover story.
   ArrayRef Args;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

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

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


Repository:
  rC Clang

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

https://reviews.llvm.org/D58216



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


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

2019-03-08 Thread Rafael Auler via Phabricator via cfe-commits
rafauler added a comment.

I definitely understand how the diagnostic can be confusing. However, it's the 
same diagnostic gcc provides too, so gcc users wouldn't be surprised. But 
you're right this can be improved by at least mentioning the attribute used in 
the diagnostic message. There's no bug report to this yet, it would be nice to 
file it.


Repository:
  rC Clang

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

https://reviews.llvm.org/D58216



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


[PATCH] D59038: [8.0 Regression] Fix handling of `__builtin_constant_p` inside the enable_if attribute.

2019-03-08 Thread Hans Wennborg via Phabricator via cfe-commits
hans added a comment.

In D59038#1422890 , @rsmith wrote:

> LGTM, and I think this is safe enough to take for Clang 8.


Do you think the severity is high enough to spin another release candidate?

My concern is that since this didn't show up in testing until now, which I 
guess is quite a while after it regressed, maybe it's not important enough to 
delay the already late release? Also it sounds like it isn't completely fixed 
yet..


Repository:
  rC Clang

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

https://reviews.llvm.org/D59038



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


[PATCH] D59038: [8.0 Regression] Fix handling of `__builtin_constant_p` inside the enable_if attribute.

2019-03-08 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

LGTM, and I think this is safe enough to take for Clang 8.


Repository:
  rC Clang

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

https://reviews.llvm.org/D59038



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


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

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

I've got a patch pending for Swift. That being said, the clang diagnostics 
leave something to be desired. If `__attribute__((used))` on definitions is 
sloppy at best or wrong at worst, then that should have a warning/error. Want a 
bug report? Or does one exist already?


Repository:
  rC Clang

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

https://reviews.llvm.org/D58216



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


[PATCH] D59135: Add check for matching HeaderFilter before emitting Diagnostic

2019-03-08 Thread Thorsten via Phabricator via cfe-commits
thorsten-klein added a comment.

Sorry for delay. I am currently not able to build master (Error: "sort" is not 
a member of "llvm").
And if I try to build 6.0.1-rc3 I can build clang-tidy but I am not able to 
build corresponding unittests "ClangTidyTests".
I will try to solve as soon as possible.


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

https://reviews.llvm.org/D59135



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


[PATCH] D57662: [clang-tidy] Parallelize clang-tidy-diff.py

2019-03-08 Thread Zinovy Nis via Phabricator via cfe-commits
zinovy.nis added a comment.

Gentle ping.


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

https://reviews.llvm.org/D57662



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


[PATCH] D57891: [analyzer] Fix infinite recursion in printing macros

2019-03-08 Thread Kristóf Umann via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL355705: [analyzer] Fix infinite recursion in printing macros 
(authored by Szelethus, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D57891?vs=189670=189863#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D57891

Files:
  cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
  
cfe/trunk/test/Analysis/Inputs/expected-plists/plist-macros-with-expansion.cpp.plist
  cfe/trunk/test/Analysis/plist-macros-with-expansion.cpp

Index: cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
@@ -22,6 +22,7 @@
 #include "clang/StaticAnalyzer/Core/IssueHash.h"
 #include "clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h"
 #include "llvm/ADT/Statistic.h"
+#include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/Casting.h"
 
@@ -776,10 +777,20 @@
 /// As we expand the last line, we'll immediately replace PRINT(str) with
 /// print(x). The information that both 'str' and 'x' refers to the same string
 /// is an information we have to forward, hence the argument \p PrevArgs.
-static std::string getMacroNameAndPrintExpansion(TokenPrinter ,
- SourceLocation MacroLoc,
- const Preprocessor ,
- const MacroArgMap );
+///
+/// To avoid infinite recursion we maintain the already processed tokens in
+/// a set. This is carried as a parameter through the recursive calls. The set
+/// is extended with the currently processed token and after processing it, the
+/// token is removed. If the token is already in the set, then recursion stops:
+///
+/// #define f(y) x
+/// #define x f(x)
+static std::string getMacroNameAndPrintExpansion(
+TokenPrinter ,
+SourceLocation MacroLoc,
+const Preprocessor ,
+const MacroArgMap ,
+llvm::SmallPtrSet );
 
 /// Retrieves the name of the macro and what it's arguments expand into
 /// at \p ExpanLoc.
@@ -828,19 +839,35 @@
   llvm::SmallString<200> ExpansionBuf;
   llvm::raw_svector_ostream OS(ExpansionBuf);
   TokenPrinter Printer(OS, PP);
+  llvm::SmallPtrSet AlreadyProcessedTokens;
+
   std::string MacroName =
-getMacroNameAndPrintExpansion(Printer, MacroLoc, PP, MacroArgMap{});
+getMacroNameAndPrintExpansion(Printer, MacroLoc, PP, MacroArgMap{},
+ AlreadyProcessedTokens);
   return { MacroName, OS.str() };
 }
 
-static std::string getMacroNameAndPrintExpansion(TokenPrinter ,
- SourceLocation MacroLoc,
- const Preprocessor ,
- const MacroArgMap ) {
+static std::string getMacroNameAndPrintExpansion(
+TokenPrinter ,
+SourceLocation MacroLoc,
+const Preprocessor ,
+const MacroArgMap ,
+llvm::SmallPtrSet ) {
 
   const SourceManager  = PP.getSourceManager();
 
   MacroNameAndArgs Info = getMacroNameAndArgs(SM.getExpansionLoc(MacroLoc), PP);
+  IdentifierInfo* IDInfo = PP.getIdentifierInfo(Info.Name);
+
+  // TODO: If the macro definition contains another symbol then this function is
+  // called recursively. In case this symbol is the one being defined, it will
+  // be an infinite recursion which is stopped by this "if" statement. However,
+  // in this case we don't get the full expansion text in the Plist file. See
+  // the test file where "value" is expanded to "garbage_" instead of
+  // "garbage_value".
+  if (AlreadyProcessedTokens.find(IDInfo) != AlreadyProcessedTokens.end())
+return Info.Name;
+  AlreadyProcessedTokens.insert(IDInfo);
 
   if (!Info.MI)
 return Info.Name;
@@ -867,7 +894,8 @@
 // macro.
 if (const MacroInfo *MI =
  getMacroInfoForLocation(PP, SM, II, T.getLocation())) {
-  getMacroNameAndPrintExpansion(Printer, T.getLocation(), PP, Info.Args);
+  getMacroNameAndPrintExpansion(Printer, T.getLocation(), PP, Info.Args,
+AlreadyProcessedTokens);
 
   // If this is a function-like macro, skip its arguments, as
   // getExpandedMacro() already printed them. If this is the case, let's
@@ -899,7 +927,7 @@
 }
 
 getMacroNameAndPrintExpansion(Printer, ArgIt->getLocation(), PP,
-  Info.Args);
+  Info.Args, AlreadyProcessedTokens);
 if (MI->getNumParams() != 0)
   ArgIt = getMatchingRParen(++ArgIt, ArgEnd);
   }
@@ -911,6 +939,8 @@
 

r355705 - [analyzer] Fix infinite recursion in printing macros

2019-03-08 Thread Kristof Umann via cfe-commits
Author: szelethus
Date: Fri Mar  8 08:26:29 2019
New Revision: 355705

URL: http://llvm.org/viewvc/llvm-project?rev=355705=rev
Log:
[analyzer] Fix infinite recursion in printing macros

In the commited testfile, macro expansion (the one implemented for the plist
output) runs into an infinite recursion. The issue originates from the algorithm
being faulty, as in

#define value REC_MACRO_FUNC(value)

the "value" is being (or at least attempted) expanded from the same macro.

The solved this issue by gathering already visited macros in a set, which does
resolve the crash, but will result in an incorrect macro expansion, that would
preferably be fixed down the line.

Patch by Tibor Brunner!

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


Modified:
cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp

cfe/trunk/test/Analysis/Inputs/expected-plists/plist-macros-with-expansion.cpp.plist
cfe/trunk/test/Analysis/plist-macros-with-expansion.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp?rev=355705=355704=355705=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp Fri Mar  8 08:26:29 
2019
@@ -22,6 +22,7 @@
 #include "clang/StaticAnalyzer/Core/IssueHash.h"
 #include "clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h"
 #include "llvm/ADT/Statistic.h"
+#include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/Casting.h"
 
@@ -776,10 +777,20 @@ public:
 /// As we expand the last line, we'll immediately replace PRINT(str) with
 /// print(x). The information that both 'str' and 'x' refers to the same string
 /// is an information we have to forward, hence the argument \p PrevArgs.
-static std::string getMacroNameAndPrintExpansion(TokenPrinter ,
- SourceLocation MacroLoc,
- const Preprocessor ,
- const MacroArgMap );
+///
+/// To avoid infinite recursion we maintain the already processed tokens in
+/// a set. This is carried as a parameter through the recursive calls. The set
+/// is extended with the currently processed token and after processing it, the
+/// token is removed. If the token is already in the set, then recursion stops:
+///
+/// #define f(y) x
+/// #define x f(x)
+static std::string getMacroNameAndPrintExpansion(
+TokenPrinter ,
+SourceLocation MacroLoc,
+const Preprocessor ,
+const MacroArgMap ,
+llvm::SmallPtrSet );
 
 /// Retrieves the name of the macro and what it's arguments expand into
 /// at \p ExpanLoc.
@@ -828,19 +839,35 @@ static ExpansionInfo getExpandedMacro(So
   llvm::SmallString<200> ExpansionBuf;
   llvm::raw_svector_ostream OS(ExpansionBuf);
   TokenPrinter Printer(OS, PP);
+  llvm::SmallPtrSet AlreadyProcessedTokens;
+
   std::string MacroName =
-getMacroNameAndPrintExpansion(Printer, MacroLoc, PP, 
MacroArgMap{});
+getMacroNameAndPrintExpansion(Printer, MacroLoc, PP, MacroArgMap{},
+ AlreadyProcessedTokens);
   return { MacroName, OS.str() };
 }
 
-static std::string getMacroNameAndPrintExpansion(TokenPrinter ,
- SourceLocation MacroLoc,
- const Preprocessor ,
- const MacroArgMap ) {
+static std::string getMacroNameAndPrintExpansion(
+TokenPrinter ,
+SourceLocation MacroLoc,
+const Preprocessor ,
+const MacroArgMap ,
+llvm::SmallPtrSet ) {
 
   const SourceManager  = PP.getSourceManager();
 
   MacroNameAndArgs Info = getMacroNameAndArgs(SM.getExpansionLoc(MacroLoc), 
PP);
+  IdentifierInfo* IDInfo = PP.getIdentifierInfo(Info.Name);
+
+  // TODO: If the macro definition contains another symbol then this function 
is
+  // called recursively. In case this symbol is the one being defined, it will
+  // be an infinite recursion which is stopped by this "if" statement. However,
+  // in this case we don't get the full expansion text in the Plist file. See
+  // the test file where "value" is expanded to "garbage_" instead of
+  // "garbage_value".
+  if (AlreadyProcessedTokens.find(IDInfo) != AlreadyProcessedTokens.end())
+return Info.Name;
+  AlreadyProcessedTokens.insert(IDInfo);
 
   if (!Info.MI)
 return Info.Name;
@@ -867,7 +894,8 @@ static std::string getMacroNameAndPrintE
 // macro.
 if (const MacroInfo *MI =
  getMacroInfoForLocation(PP, SM, II, T.getLocation())) 
{
-  getMacroNameAndPrintExpansion(Printer, T.getLocation(), PP, Info.Args);
+  getMacroNameAndPrintExpansion(Printer, T.getLocation(), PP, Info.Args,
+

[PATCH] D58977: [clang-tidy] Add the abseil-time-comparison check

2019-03-08 Thread Hyrum Wright via Phabricator via cfe-commits
hwright updated this revision to Diff 189862.
hwright marked 6 inline comments as done.

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

https://reviews.llvm.org/D58977

Files:
  clang-tidy/abseil/AbseilTidyModule.cpp
  clang-tidy/abseil/CMakeLists.txt
  clang-tidy/abseil/TimeComparisonCheck.cpp
  clang-tidy/abseil/TimeComparisonCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/abseil-time-comparison.rst
  docs/clang-tidy/checks/list.rst
  test/clang-tidy/abseil-time-comparison.cpp

Index: test/clang-tidy/abseil-time-comparison.cpp
===
--- /dev/null
+++ test/clang-tidy/abseil-time-comparison.cpp
@@ -0,0 +1,129 @@
+// RUN: %check_clang_tidy %s abseil-time-comparison %t -- -- -I%S/Inputs
+
+#include "absl/time/time.h"
+
+void f() {
+  double x;
+  absl::Duration d1, d2;
+  bool b;
+  absl::Time t1, t2;
+
+  // Check against the RHS
+  b = x > absl::ToUnixSeconds(t1);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+  // CHECK-FIXES: absl::FromUnixSeconds(x) > t1;
+  b = x >= absl::ToUnixSeconds(t1);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+  // CHECK-FIXES: absl::FromUnixSeconds(x) >= t1;
+  b = x == absl::ToUnixSeconds(t1);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+  // CHECK-FIXES: absl::FromUnixSeconds(x) == t1;
+  b = x <= absl::ToUnixSeconds(t1);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+  // CHECK-FIXES: absl::FromUnixSeconds(x) <= t1;
+  b = x < absl::ToUnixSeconds(t1);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+  // CHECK-FIXES: absl::FromUnixSeconds(x) < t1;
+  b = x == absl::ToUnixSeconds(t1 - d2);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+  // CHECK-FIXES: absl::FromUnixSeconds(x) == t1 - d2;
+  b = absl::ToUnixSeconds(t1) > absl::ToUnixSeconds(t2);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+  // CHECK-FIXES: t1 > t2;
+
+  // Check against the LHS
+  b = absl::ToUnixSeconds(t1) < x;
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+  // CHECK-FIXES: t1 < absl::FromUnixSeconds(x);
+  b = absl::ToUnixSeconds(t1) <= x;
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+  // CHECK-FIXES: t1 <= absl::FromUnixSeconds(x);
+  b = absl::ToUnixSeconds(t1) == x;
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+  // CHECK-FIXES: t1 == absl::FromUnixSeconds(x);
+  b = absl::ToUnixSeconds(t1) >= x;
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+  // CHECK-FIXES: t1 >= absl::FromUnixSeconds(x);
+  b = absl::ToUnixSeconds(t1) > x;
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+  // CHECK-FIXES: t1 > absl::FromUnixSeconds(x);
+
+  // Comparison against zero
+  b = absl::ToUnixSeconds(t1) < 0.0;
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+  // CHECK-FIXES: t1 < absl::UnixEpoch();
+  b = absl::ToUnixSeconds(t1) < 0;
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+  // CHECK-FIXES: t1 < absl::UnixEpoch();
+
+  // Scales other than Seconds
+  b = x > absl::ToUnixMicros(t1);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+  // CHECK-FIXES: absl::FromUnixMicros(x) > t1;
+  b = x >= absl::ToUnixMillis(t1);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+  // CHECK-FIXES: absl::FromUnixMillis(x) >= t1;
+  b = x == absl::ToUnixNanos(t1);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+  // CHECK-FIXES: absl::FromUnixNanos(x) == t1;
+  b = x <= absl::ToUnixMinutes(t1);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+  // CHECK-FIXES: absl::FromUnixMinutes(x) <= t1;
+  b = x < absl::ToUnixHours(t1);
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+  // CHECK-FIXES: absl::FromUnixHours(x) < t1;
+
+  // A long expression
+  bool some_condition;
+  int very_very_very_very_long_variable_name;
+  absl::Time SomeTime;
+  if (some_condition && very_very_very_very_long_variable_name
+ < absl::ToUnixSeconds(SomeTime)) {
+  // CHECK-MESSAGES: 

[PATCH] D58977: [clang-tidy] Add the abseil-time-comparison check

2019-03-08 Thread Hyrum Wright via Phabricator via cfe-commits
hwright added inline comments.



Comment at: clang-tidy/abseil/TimeComparisonCheck.cpp:23
+  auto Matcher =
+  binaryOperator(anyOf(hasOperatorName(">"), hasOperatorName(">="),
+   hasOperatorName("=="), hasOperatorName("<="),

ioeric wrote:
> `DurationComparisonCheck.cpp` has a very similar matcher pattern.
> 
> Maybe pull out a common matcher for this? E.g. 
> `comparisonOperatorWithCallee(...)`?
> 
My one concern about doing so is that it would move the name bindings into a 
separate location away from the callback consuming those bindings.

Since this is only the second instance of this pattern, would it be reasonable 
to wait until there's a third to combine them?


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

https://reviews.llvm.org/D58977



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


[PATCH] D59048: Add AIX Target Info

2019-03-08 Thread Sean Fertile via Phabricator via cfe-commits
sfertile added inline comments.



Comment at: clang/test/Preprocessor/init.c:6420
+// PPC64-AIX:#define _LONG_LONG 1
+// PPC64-AIX:#define _POWER 1
+// PPC64-AIX:#define __64BIT__ 1

hubert.reinterpretcast wrote:
> hubert.reinterpretcast wrote:
> > apaprocki wrote:
> > > XL on AIX emits `#define _LP64 1` in 64-bit mode and `#define _ILP32 1` 
> > > in 32-bit mode in the pre-defined macros. Is that important to capture?
> > I think so. The v16.1 XL compiler's `xlclang` also produces these.
> > 
> > ```
> > #define __LP64__ 1
> > #define _LP64 1
> > ```
> > 
> > ```
> > #define __ILP32__ 1
> > #define _ILP32 1
> > ```
> It seems GCC on AIX only defines the macros for 64-bit, and not the 32-bit 
> versions. The system headers do not appear to depend on the 32-bit versions. 
> It makes sense to start with the common intersection between the GCC and XL 
> predefined macros first. We can add `__LP64__` and `_LP64` with this patch. I 
> think we can leave more macros for later.
>It makes sense to start with the common intersection between the GCC and XL 
>predefined macros first
Agreed




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59048



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


[PATCH] D57850: [analyzer] Emit an error rather than assert on invalid checker option input

2019-03-08 Thread Kristóf Umann via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC355704: [analyzer] Emit an error rather than assert on 
invalid checker option input (authored by Szelethus, committed by ).

Repository:
  rC Clang

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

https://reviews.llvm.org/D57850

Files:
  include/clang/Basic/DiagnosticDriverKinds.td
  include/clang/StaticAnalyzer/Core/CheckerManager.h
  lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
  lib/StaticAnalyzer/Checkers/CloneChecker.cpp
  lib/StaticAnalyzer/Checkers/MoveChecker.cpp
  lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
  lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObjectChecker.cpp
  lib/StaticAnalyzer/Core/CheckerManager.cpp
  test/Analysis/copypaste/suspicious-clones.cpp
  test/Analysis/cxx-uninitialized-object-unionlike-constructs.cpp
  test/Analysis/outofbound.c
  test/Analysis/padding_c.c
  test/Analysis/undef-buffers.c
  test/Analysis/use-after-move.cpp

Index: include/clang/StaticAnalyzer/Core/CheckerManager.h
===
--- include/clang/StaticAnalyzer/Core/CheckerManager.h
+++ include/clang/StaticAnalyzer/Core/CheckerManager.h
@@ -136,6 +136,12 @@
   AnalyzerOptions () { return AOptions; }
   ASTContext () { return Context; }
 
+  /// Emits an error through a DiagnosticsEngine about an invalid user supplied
+  /// checker option value.
+  void reportInvalidCheckerOptionValue(const CheckerBase *C,
+   StringRef OptionName,
+   StringRef ExpectedValueDesc);
+
   using CheckerRef = CheckerBase *;
   using CheckerTag = const void *;
   using CheckerDtor = CheckerFn;
Index: include/clang/Basic/DiagnosticDriverKinds.td
===
--- include/clang/Basic/DiagnosticDriverKinds.td
+++ include/clang/Basic/DiagnosticDriverKinds.td
@@ -303,6 +303,8 @@
 def err_analyzer_config_invalid_input : Error<
   "invalid input for analyzer-config option '%0', that expects %1 value">;
 def err_analyzer_config_unknown : Error<"unknown analyzer-config '%0'">;
+def err_analyzer_checker_option_invalid_input : Error<
+  "invalid input for checker option '%0', that expects %1">;
 
 def err_drv_invalid_hvx_length : Error<
   "-mhvx-length is not supported without a -mhvx/-mhvx= flag">;
Index: test/Analysis/undef-buffers.c
===
--- test/Analysis/undef-buffers.c
+++ test/Analysis/undef-buffers.c
@@ -2,7 +2,7 @@
 // RUN:   -analyzer-checker=core \
 // RUN:   -analyzer-checker=unix \
 // RUN:   -analyzer-checker=core.uninitialized \
-// RUN:   -analyzer-config unix:Optimistic=true
+// RUN:   -analyzer-config unix.DynamicMemoryModeling:Optimistic=true
 
 typedef __typeof(sizeof(int)) size_t;
 void *malloc(size_t);
Index: test/Analysis/padding_c.c
===
--- test/Analysis/padding_c.c
+++ test/Analysis/padding_c.c
@@ -1,4 +1,16 @@
-// RUN: %clang_analyze_cc1 -analyzer-checker=optin.performance -analyzer-config optin.performance.Padding:AllowedPad=2 -verify %s
+// RUN: %clang_analyze_cc1 -verify %s \
+// RUN:   -analyzer-checker=optin.performance \
+// RUN:   -analyzer-config optin.performance.Padding:AllowedPad=2
+
+// RUN: not %clang_analyze_cc1 -verify %s \
+// RUN:   -analyzer-checker=core \
+// RUN:   -analyzer-checker=optin.performance.Padding \
+// RUN:   -analyzer-config optin.performance.Padding:AllowedPad=-10 \
+// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-PAD-NEGATIVE-VALUE
+
+// CHECK-PAD-NEGATIVE-VALUE: (frontend): invalid input for checker option
+// CHECK-PAD-NEGATIVE-VALUE-SAME: 'optin.performance.Padding:AllowedPad', that
+// CHECK-PAD-NEGATIVE-VALUE-SAME: expects a non-negative value
 
 #if __has_include()
 #include 
Index: test/Analysis/outofbound.c
===
--- test/Analysis/outofbound.c
+++ test/Analysis/outofbound.c
@@ -2,7 +2,7 @@
 // RUN:   -analyzer-checker=core \
 // RUN:   -analyzer-checker=unix \
 // RUN:   -analyzer-checker=alpha.security.ArrayBound \
-// RUN:   -analyzer-config unix:Optimistic=true
+// RUN:   -analyzer-config unix.DynamicMemoryModeling:Optimistic=true
 
 typedef __typeof(sizeof(int)) size_t;
 void *malloc(size_t);
Index: test/Analysis/copypaste/suspicious-clones.cpp
===
--- test/Analysis/copypaste/suspicious-clones.cpp
+++ test/Analysis/copypaste/suspicious-clones.cpp
@@ -1,4 +1,7 @@
-// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.clone.CloneChecker -analyzer-config alpha.clone.CloneChecker:ReportSuspiciousClones=true  -analyzer-config alpha.clone.CloneChecker:ReportNormalClones=false -analyzer-config alpha.clone.CloneChecker:MinimumCloneComplexity=10 -verify %s
+// RUN: %clang_analyze_cc1 -verify %s \
+// RUN:   

r355704 - [analyzer] Emit an error rather than assert on invalid checker option input

2019-03-08 Thread Kristof Umann via cfe-commits
Author: szelethus
Date: Fri Mar  8 08:00:42 2019
New Revision: 355704

URL: http://llvm.org/viewvc/llvm-project?rev=355704=rev
Log:
[analyzer] Emit an error rather than assert on invalid checker option input

Asserting on invalid input isn't very nice, hence the patch to emit an error
instead.

This is the first of many patches to overhaul the way we handle checker options.

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

Modified:
cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
cfe/trunk/include/clang/StaticAnalyzer/Core/CheckerManager.h
cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/CloneChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/MoveChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp

cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObjectChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Core/CheckerManager.cpp
cfe/trunk/test/Analysis/copypaste/suspicious-clones.cpp
cfe/trunk/test/Analysis/cxx-uninitialized-object-unionlike-constructs.cpp
cfe/trunk/test/Analysis/outofbound.c
cfe/trunk/test/Analysis/padding_c.c
cfe/trunk/test/Analysis/undef-buffers.c
cfe/trunk/test/Analysis/use-after-move.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=355704=355703=355704=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Fri Mar  8 08:00:42 
2019
@@ -303,6 +303,8 @@ def err_analyzer_config_multiple_values
 def err_analyzer_config_invalid_input : Error<
   "invalid input for analyzer-config option '%0', that expects %1 value">;
 def err_analyzer_config_unknown : Error<"unknown analyzer-config '%0'">;
+def err_analyzer_checker_option_invalid_input : Error<
+  "invalid input for checker option '%0', that expects %1">;
 
 def err_drv_invalid_hvx_length : Error<
   "-mhvx-length is not supported without a -mhvx/-mhvx= flag">;

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/CheckerManager.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/CheckerManager.h?rev=355704=355703=355704=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/CheckerManager.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/CheckerManager.h Fri Mar  8 
08:00:42 2019
@@ -136,6 +136,12 @@ public:
   AnalyzerOptions () { return AOptions; }
   ASTContext () { return Context; }
 
+  /// Emits an error through a DiagnosticsEngine about an invalid user supplied
+  /// checker option value.
+  void reportInvalidCheckerOptionValue(const CheckerBase *C,
+   StringRef OptionName,
+   StringRef ExpectedValueDesc);
+
   using CheckerRef = CheckerBase *;
   using CheckerTag = const void *;
   using CheckerDtor = CheckerFn;

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp?rev=355704=355703=355704=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp Fri Mar  8 
08:00:42 2019
@@ -1086,14 +1086,10 @@ bool ObjCDeallocChecker::isNibLoadedIvar
 }
 
 void ento::registerObjCDeallocChecker(CheckerManager ) {
-  const LangOptions  = Mgr.getLangOpts();
-  // These checker only makes sense under MRR.
-  if (LangOpts.getGC() == LangOptions::GCOnly || LangOpts.ObjCAutoRefCount)
-return;
-
   Mgr.registerChecker();
 }
 
 bool ento::shouldRegisterObjCDeallocChecker(const LangOptions ) {
-  return true;
+  // These checker only makes sense under MRR.
+  return LO.getGC() != LangOptions::GCOnly && !LO.ObjCAutoRefCount;
 }

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CloneChecker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CloneChecker.cpp?rev=355704=355703=355704=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CloneChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CloneChecker.cpp Fri Mar  8 08:00:42 
2019
@@ -27,6 +27,13 @@ using namespace ento;
 namespace {
 class CloneChecker
 : public Checker {
+public:
+  // Checker options.
+  int MinComplexity;
+  bool ReportNormalClones;
+  StringRef IgnoredFilesPattern;
+
+private:
   mutable CloneDetector Detector;
   mutable std::unique_ptr BT_Exact, BT_Suspicious;
 
@@ -62,19 +69,6 @@ void CloneChecker::checkEndOfTranslation
   // At this point, every statement in the 

[PATCH] D59121: [analyzer] Fix macro names in diagnostics within bigger macros.

2019-03-08 Thread Csaba Dabis via Phabricator via cfe-commits
Charusso requested changes to this revision.
Charusso added inline comments.



Comment at: clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp:1985
 bool partOfParentMacro = false;
+StringRef PName = "";
 if (ParentEx->getBeginLoc().isMacroID()) {

`ParentName`?



Comment at: clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp:1996
+  StringRef MacroName = StartName;
+  while (true) {
 LocStart = BRC.getSourceManager().getImmediateMacroCallerLoc(LocStart);

I was never cool in algorithms, but I think it is over-complicated. In Hungary 
we are about to build a new nuclear power plant so here it is really 
emphasized: never-ever create an infinite loop.
What about the following?:
```
  while (LocStart.isMacroID()) {
 
StringRef CurrentMacroName = 
Lexer::getImmediateMacroNameForDiagnostics( 
LocStart, BRC.getSourceManager(),   
 
BRC.getASTContext().getLangOpts()); 
 
LocStart = BRC.getSourceManager().getImmediateMacroCallerLoc(LocStart); 
 
if (CurrentMacroName != ParentName) 
  
  MacroName = CurrentMacroName; 
 
  }
```



Comment at: clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp:2003
+LocStart, BRC.getSourceManager(),
+BRC.getASTContext().getLangOpts());
+if (NextMacroName == PName)

There is too much duplication and it is difficult to understand what is going 
on. May here is the time for deduplicating?
Please note that, there is a function called `getMacroName(SourceLocation, 
BugReporterContext &)`, may you would put your own helper-function above that.


Repository:
  rC Clang

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

https://reviews.llvm.org/D59121



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


[PATCH] D59055: [analyzer] Prepare generic taint checker for new sources

2019-03-08 Thread Kristóf Umann via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC355703: [analyzer] Use the new infrastructure of expressing 
taint propagation, NFC (authored by Szelethus, committed by ).

Repository:
  rC Clang

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

https://reviews.llvm.org/D59055

Files:
  lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp

Index: lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
+++ lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
@@ -62,9 +62,6 @@
   /// Propagate taint generated at pre-visit.
   bool propagateFromPre(const CallExpr *CE, CheckerContext ) const;
 
-  /// Add taint sources on a post visit.
-  void addSourcesPost(const CallExpr *CE, CheckerContext ) const;
-
   /// Check if the region the expression evaluates to is the standard input,
   /// and thus, is tainted.
   static bool isStdin(const Expr *E, CheckerContext );
@@ -72,16 +69,6 @@
   /// Given a pointer argument, return the value it points to.
   static Optional getPointedToSVal(CheckerContext , const Expr *Arg);
 
-  /// Functions defining the attack surface.
-  using FnCheck = ProgramStateRef (GenericTaintChecker::*)(
-  const CallExpr *, CheckerContext ) const;
-  ProgramStateRef postScanf(const CallExpr *CE, CheckerContext ) const;
-  ProgramStateRef postSocket(const CallExpr *CE, CheckerContext ) const;
-  ProgramStateRef postRetTaint(const CallExpr *CE, CheckerContext ) const;
-
-  /// Taint the scanned input if the file is tainted.
-  ProgramStateRef preFscanf(const CallExpr *CE, CheckerContext ) const;
-
   /// Check for CWE-134: Uncontrolled Format String.
   static const char MsgUncontrolledFormatString[];
   bool checkUncontrolledFormatString(const CallExpr *CE,
@@ -118,6 +105,9 @@
   struct TaintPropagationRule {
 enum class VariadicType { None, Src, Dst };
 
+using PropagationFuncType = bool (*)(bool IsTainted, const CallExpr *,
+ CheckerContext );
+
 /// List of arguments which can be taint sources and should be checked.
 ArgVector SrcArgs;
 /// List of arguments which should be tainted on function return.
@@ -127,16 +117,21 @@
 /// Show when a function has variadic parameters. If it has, it marks all
 /// of them as source or destination.
 VariadicType VarType;
+/// Special function for tainted source determination. If defined, it can
+/// override the default behavior.
+PropagationFuncType PropagationFunc;
 
 TaintPropagationRule()
-: VariadicIndex(InvalidArgIndex), VarType(VariadicType::None) {}
+: VariadicIndex(InvalidArgIndex), VarType(VariadicType::None),
+  PropagationFunc(nullptr) {}
 
 TaintPropagationRule(std::initializer_list &,
  std::initializer_list &,
  VariadicType Var = VariadicType::None,
- unsigned VarIndex = InvalidArgIndex)
+ unsigned VarIndex = InvalidArgIndex,
+ PropagationFuncType Func = nullptr)
 : SrcArgs(std::move(Src)), DstArgs(std::move(Dst)),
-  VariadicIndex(VarIndex), VarType(Var) {}
+  VariadicIndex(VarIndex), VarType(Var), PropagationFunc(Func) {}
 
 /// Get the propagation rule for a given function.
 static TaintPropagationRule
@@ -170,6 +165,10 @@
 /// Pre-process a function which propagates taint according to the
 /// taint rule.
 ProgramStateRef process(const CallExpr *CE, CheckerContext ) const;
+
+// Functions for custom taintedness propagation.
+static bool postSocket(bool IsTainted, const CallExpr *CE,
+   CheckerContext );
   };
 };
 
@@ -206,25 +205,42 @@
   // Check for exact name match for functions without builtin substitutes.
   TaintPropagationRule Rule =
   llvm::StringSwitch(Name)
+  // Source functions
+  // TODO: Add support for vfscanf & family.
+  .Case("fdopen", TaintPropagationRule({}, {ReturnValueIndex}))
+  .Case("fopen", TaintPropagationRule({}, {ReturnValueIndex}))
+  .Case("freopen", TaintPropagationRule({}, {ReturnValueIndex}))
+  .Case("getch", TaintPropagationRule({}, {ReturnValueIndex}))
+  .Case("getchar", TaintPropagationRule({}, {ReturnValueIndex}))
+  .Case("getchar_unlocked", TaintPropagationRule({}, {ReturnValueIndex}))
+  .Case("getenv", TaintPropagationRule({}, {ReturnValueIndex}))
+  .Case("gets", TaintPropagationRule({}, {0, ReturnValueIndex}))
+  .Case("scanf", TaintPropagationRule({}, {}, VariadicType::Dst, 1))
+  .Case("socket",
+TaintPropagationRule({}, {ReturnValueIndex}, VariadicType::None,
+ InvalidArgIndex,
+ ::postSocket))
+  

r355703 - [analyzer] Use the new infrastructure of expressing taint propagation, NFC

2019-03-08 Thread Kristof Umann via cfe-commits
Author: szelethus
Date: Fri Mar  8 07:47:56 2019
New Revision: 355703

URL: http://llvm.org/viewvc/llvm-project?rev=355703=rev
Log:
[analyzer] Use the new infrastructure of expressing taint propagation, NFC

In D55734, we implemented a far more general way of describing taint propagation
rules for functions, like being able to specify an unlimited amount of
source and destination parameters. Previously, we didn't have a particularly
elegant way of expressing the propagation rules for functions that always return
(either through an out-param or return value) a tainted value. In this patch,
we model these functions similarly to other ones, by assigning them a
TaintPropagationRule that describes that they "create a tainted value out of
nothing".

The socket C function is somewhat special, because for certain parameters (for
example, if we supply localhost as parameter), none of the out-params should
be tainted. For this, we added a general solution of being able to specify
custom taint propagation rules through function pointers.

Patch by Gábor Borsik!

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

Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp?rev=355703=355702=355703=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp Fri Mar  8 
07:47:56 2019
@@ -62,9 +62,6 @@ private:
   /// Propagate taint generated at pre-visit.
   bool propagateFromPre(const CallExpr *CE, CheckerContext ) const;
 
-  /// Add taint sources on a post visit.
-  void addSourcesPost(const CallExpr *CE, CheckerContext ) const;
-
   /// Check if the region the expression evaluates to is the standard input,
   /// and thus, is tainted.
   static bool isStdin(const Expr *E, CheckerContext );
@@ -72,16 +69,6 @@ private:
   /// Given a pointer argument, return the value it points to.
   static Optional getPointedToSVal(CheckerContext , const Expr *Arg);
 
-  /// Functions defining the attack surface.
-  using FnCheck = ProgramStateRef (GenericTaintChecker::*)(
-  const CallExpr *, CheckerContext ) const;
-  ProgramStateRef postScanf(const CallExpr *CE, CheckerContext ) const;
-  ProgramStateRef postSocket(const CallExpr *CE, CheckerContext ) const;
-  ProgramStateRef postRetTaint(const CallExpr *CE, CheckerContext ) const;
-
-  /// Taint the scanned input if the file is tainted.
-  ProgramStateRef preFscanf(const CallExpr *CE, CheckerContext ) const;
-
   /// Check for CWE-134: Uncontrolled Format String.
   static const char MsgUncontrolledFormatString[];
   bool checkUncontrolledFormatString(const CallExpr *CE,
@@ -118,6 +105,9 @@ private:
   struct TaintPropagationRule {
 enum class VariadicType { None, Src, Dst };
 
+using PropagationFuncType = bool (*)(bool IsTainted, const CallExpr *,
+ CheckerContext );
+
 /// List of arguments which can be taint sources and should be checked.
 ArgVector SrcArgs;
 /// List of arguments which should be tainted on function return.
@@ -127,16 +117,21 @@ private:
 /// Show when a function has variadic parameters. If it has, it marks all
 /// of them as source or destination.
 VariadicType VarType;
+/// Special function for tainted source determination. If defined, it can
+/// override the default behavior.
+PropagationFuncType PropagationFunc;
 
 TaintPropagationRule()
-: VariadicIndex(InvalidArgIndex), VarType(VariadicType::None) {}
+: VariadicIndex(InvalidArgIndex), VarType(VariadicType::None),
+  PropagationFunc(nullptr) {}
 
 TaintPropagationRule(std::initializer_list &,
  std::initializer_list &,
  VariadicType Var = VariadicType::None,
- unsigned VarIndex = InvalidArgIndex)
+ unsigned VarIndex = InvalidArgIndex,
+ PropagationFuncType Func = nullptr)
 : SrcArgs(std::move(Src)), DstArgs(std::move(Dst)),
-  VariadicIndex(VarIndex), VarType(Var) {}
+  VariadicIndex(VarIndex), VarType(Var), PropagationFunc(Func) {}
 
 /// Get the propagation rule for a given function.
 static TaintPropagationRule
@@ -170,6 +165,10 @@ private:
 /// Pre-process a function which propagates taint according to the
 /// taint rule.
 ProgramStateRef process(const CallExpr *CE, CheckerContext ) const;
+
+// Functions for custom taintedness propagation.
+static bool postSocket(bool IsTainted, const CallExpr *CE,
+   CheckerContext );
   };
 };
 
@@ -206,25 +205,42 @@ GenericTaintChecker::TaintPropagationRul
   // Check for exact name match 

[PATCH] D58930: Add XCOFF triple object format type for AIX

2019-03-08 Thread Sean Fertile via Phabricator via cfe-commits
sfertile accepted this revision.
sfertile added a comment.

LGTM.




Comment at: llvm/lib/MC/MCContext.cpp:165
+case MCObjectFileInfo::IsXCOFF:
+  // TODO: Need to implement class MCSymbolXCOFF.
+  break;

jasonliu wrote:
> sfertile wrote:
> > jasonliu wrote:
> > > JDevlieghere wrote:
> > > > See previous comment.
> > > It is certain that we will need MCSymbolXCOFF. But before we run into 
> > > cases where we actually need a MCSymbolXCOFF, we could use the generic 
> > > MCSymbol first for XCOFF platform. So I don't want to put a 
> > > llvm_unreachable here. 
> > Would it make sense to add an llvm_unreachable now, and the first patch 
> > that actually uses an MCSymbol stubs out the class and removes the 
> > unreachable?
> The first patch that uses MCSymbol do not necessarily need to stub out 
> MCSymbolXCOFF, as MCSymbol seems to be generic and usable until we are doing 
> some XCOFF specific things that needs to be represented by MCSymbolXCOFF. If 
> the intention is MCSymbol should never get used, and different object file 
> should have their own MCSymbolXXX class from the start, then I could add in 
> the llvm_unreachable here, and I would also propose to replace the "return 
> new (Name, *this) MCSymbol(MCSymbol::SymbolKindUnset, Name, IsTemporary);" 
> with an llvm_unreachable as well. 
> 
Ok I think falling through to create the generic MCSymbol in this patch is 
reasonable. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D58930



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


[clang-tools-extra] r355702 - [clang-tidy] NFC: Negate the name and semantics of the isNotInMacro function.

2019-03-08 Thread Hyrum Wright via cfe-commits
Author: hwright
Date: Fri Mar  8 07:37:15 2019
New Revision: 355702

URL: http://llvm.org/viewvc/llvm-project?rev=355702=rev
Log:
[clang-tidy] NFC: Negate the name and semantics of the isNotInMacro function.

This function is always used in a context where its result was also
negated, which made for confusing naming and code.

Modified:
clang-tools-extra/trunk/clang-tidy/abseil/DurationComparisonCheck.cpp
clang-tools-extra/trunk/clang-tidy/abseil/DurationConversionCastCheck.cpp
clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.cpp
clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.h

clang-tools-extra/trunk/clang-tidy/abseil/DurationUnnecessaryConversionCheck.cpp

Modified: clang-tools-extra/trunk/clang-tidy/abseil/DurationComparisonCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/abseil/DurationComparisonCheck.cpp?rev=355702=355701=355702=diff
==
--- clang-tools-extra/trunk/clang-tidy/abseil/DurationComparisonCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/abseil/DurationComparisonCheck.cpp Fri 
Mar  8 07:37:15 2019
@@ -43,8 +43,7 @@ void DurationComparisonCheck::check(cons
   // want to handle the case of rewriting both sides. This is much simpler if
   // we unconditionally try and rewrite both, and let the rewriter determine
   // if nothing needs to be done.
-  if (!isNotInMacro(Result, Binop->getLHS()) ||
-  !isNotInMacro(Result, Binop->getRHS()))
+  if (isInMacro(Result, Binop->getLHS()) || isInMacro(Result, Binop->getRHS()))
 return;
   std::string LhsReplacement =
   rewriteExprFromNumberToDuration(Result, *Scale, Binop->getLHS());

Modified: 
clang-tools-extra/trunk/clang-tidy/abseil/DurationConversionCastCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/abseil/DurationConversionCastCheck.cpp?rev=355702=355701=355702=diff
==
--- clang-tools-extra/trunk/clang-tidy/abseil/DurationConversionCastCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/abseil/DurationConversionCastCheck.cpp 
Fri Mar  8 07:37:15 2019
@@ -37,7 +37,7 @@ void DurationConversionCastCheck::check(
   const auto *MatchedCast =
   Result.Nodes.getNodeAs("cast_expr");
 
-  if (!isNotInMacro(Result, MatchedCast))
+  if (isInMacro(Result, MatchedCast))
 return;
 
   const auto *FuncDecl = Result.Nodes.getNodeAs("func_decl");

Modified: clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.cpp?rev=355702=355701=355702=diff
==
--- clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.cpp Fri Mar  8 
07:37:15 2019
@@ -302,9 +302,9 @@ std::string rewriteExprFromNumberToTime(
   .str();
 }
 
-bool isNotInMacro(const MatchFinder::MatchResult , const Expr *E) {
+bool isInMacro(const MatchFinder::MatchResult , const Expr *E) {
   if (!E->getBeginLoc().isMacroID())
-return true;
+return false;
 
   SourceLocation Loc = E->getBeginLoc();
   // We want to get closer towards the initial macro typed into the source only
@@ -316,7 +316,7 @@ bool isNotInMacro(const MatchFinder::Mat
 // because Clang comment says it "should not generally be used by clients."
 Loc = Result.SourceManager->getImmediateMacroCallerLoc(Loc);
   }
-  return !Loc.isMacroID();
+  return Loc.isMacroID();
 }
 
 } // namespace abseil

Modified: clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.h?rev=355702=355701=355702=diff
==
--- clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.h (original)
+++ clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.h Fri Mar  8 
07:37:15 2019
@@ -91,10 +91,10 @@ std::string rewriteExprFromNumberToTime(
 const ast_matchers::MatchFinder::MatchResult , DurationScale Scale,
 const Expr *Node);
 
-/// Return `true` if `E` is a either: not a macro at all; or an argument to
+/// Return `false` if `E` is a either: not a macro at all; or an argument to
 /// one.  In the both cases, we often want to do the transformation.
-bool isNotInMacro(const ast_matchers::MatchFinder::MatchResult ,
-  const Expr *E);
+bool isInMacro(const ast_matchers::MatchFinder::MatchResult ,
+   const Expr *E);
 
 AST_MATCHER_FUNCTION(ast_matchers::internal::Matcher,
  DurationConversionFunction) {

Modified: 
clang-tools-extra/trunk/clang-tidy/abseil/DurationUnnecessaryConversionCheck.cpp
URL: 

[PATCH] D59135: Add check for matching HeaderFilter before emitting Diagnostic

2019-03-08 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D59135#1422781 , @thorsten-klein 
wrote:

> Hello,
>  Can you please support how to do that? :-)


All of the tests live in extra\test\clang-tidy\, so you'd add a file in there. 
I believe `file-filter.cpp` does stuff with header filters, as an example of 
how the files are structured. The basic goal is: make a test that fails without 
your patch and succeeds with it.


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

https://reviews.llvm.org/D59135



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


[PATCH] D59135: Add check for matching HeaderFilter before emitting Diagnostic

2019-03-08 Thread Thorsten via Phabricator via cfe-commits
thorsten-klein added a comment.

Hello,
Can you please support how to do that? :-)


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

https://reviews.llvm.org/D59135



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


[PATCH] D59135: Add check for matching HeaderFilter before emitting Diagnostic

2019-03-08 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

Can you add test coverage that demonstrates the fix behaves as expected?




Comment at: clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp:454-455
+  StringRef FileName(Loc.printToString(Loc.getManager()));
+  if(getHeaderFilter()->match(FileName))
+  {
+Converter.emitDiagnostic(Loc, DiagLevel, Message, Info.getRanges(),

Formatting is incorrect here -- you should run the patch through clang-format 
(https://clang.llvm.org/docs/ClangFormat.html#script-for-patch-reformatting), 
and elide the braces.


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

https://reviews.llvm.org/D59135



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


r355700 - Use {{.*}} in test case to match the type of wide string literals.

2019-03-08 Thread Akira Hatanaka via cfe-commits
Author: ahatanak
Date: Fri Mar  8 07:20:12 2019
New Revision: 355700

URL: http://llvm.org/viewvc/llvm-project?rev=355700=rev
Log:
Use {{.*}} in test case to match the type of wide string literals.

The type of wide string literals varies depending on the target.

Modified:
cfe/trunk/test/SemaObjC/boxing-illegal.m

Modified: cfe/trunk/test/SemaObjC/boxing-illegal.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/boxing-illegal.m?rev=355700=355699=355700=diff
==
--- cfe/trunk/test/SemaObjC/boxing-illegal.m (original)
+++ cfe/trunk/test/SemaObjC/boxing-illegal.m Fri Mar  8 07:20:12 2019
@@ -66,7 +66,7 @@ void testStringLiteral() {
   s = @(u8"abc");
   s = @(u"abc"); // expected-error {{illegal type 'unsigned short *' used in a 
boxed expression}}
   s = @(U"abc"); // expected-error {{illegal type 'unsigned int *' used in a 
boxed expression}}
-  s = @(L"abc"); // expected-error-re {{illegal type {{'int \*'|'unsigned 
short \*'}} used in a boxed expression}}
+  s = @(L"abc"); // expected-error-re {{illegal type {{.*}} used in a boxed 
expression}}
   s = @("\pabc"); // expected-error {{illegal type 'unsigned char *' used in a 
boxed expression}}
 }
 


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


[PATCH] D59103: [clang-tidy] New checker bugprone-incomplete-comparison-operator

2019-03-08 Thread Kalle Huttunen via Phabricator via cfe-commits
kallehuttunen added a comment.

Another idea that came to my mind would be to enable this check only for 
annotated types. So warning for missing field access would be only given for 
types that have for example `[[clang::annotate("value type")]]` annotation. 
Possibly other kinds of checks could be also developed for types that have the 
given annotation.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D59103



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


[PATCH] D59135: Add check for matching HeaderFilter before emitting Diagnostic

2019-03-08 Thread Thorsten via Phabricator via cfe-commits
thorsten-klein updated this revision to Diff 189859.

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

https://reviews.llvm.org/D59135

Files:
  clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp


Index: clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
===
--- clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
+++ clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
@@ -449,8 +449,13 @@
   FullSourceLoc Loc;
   if (Info.getLocation().isValid() && Info.hasSourceManager())
 Loc = FullSourceLoc(Info.getLocation(), Info.getSourceManager());
-  Converter.emitDiagnostic(Loc, DiagLevel, Message, Info.getRanges(),
+
+  StringRef FileName(Loc.printToString(Loc.getManager()));
+  if(getHeaderFilter()->match(FileName))
+  {
+Converter.emitDiagnostic(Loc, DiagLevel, Message, Info.getRanges(),
Info.getFixItHints());
+  }
 
   if (Info.hasSourceManager())
 checkFilters(Info.getLocation(), Info.getSourceManager());


Index: clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
===
--- clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
+++ clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
@@ -449,8 +449,13 @@
   FullSourceLoc Loc;
   if (Info.getLocation().isValid() && Info.hasSourceManager())
 Loc = FullSourceLoc(Info.getLocation(), Info.getSourceManager());
-  Converter.emitDiagnostic(Loc, DiagLevel, Message, Info.getRanges(),
+
+  StringRef FileName(Loc.printToString(Loc.getManager()));
+  if(getHeaderFilter()->match(FileName))
+  {
+Converter.emitDiagnostic(Loc, DiagLevel, Message, Info.getRanges(),
Info.getFixItHints());
+  }
 
   if (Info.hasSourceManager())
 checkFilters(Info.getLocation(), Info.getSourceManager());
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D59135: Add check for matching HeaderFilter before emitting Diagnostic

2019-03-08 Thread Thorsten via Phabricator via cfe-commits
thorsten-klein created this revision.
thorsten-klein added reviewers: aaron.ballman, klimek, alexfh.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Fixed issue of not considering HeaderFilter which resulted in findings although 
they should be filtered out.
Patch by Thorsten Klein.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D59135

Files:
  clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp


Index: clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
===
--- clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
+++ clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
@@ -449,8 +449,13 @@
   FullSourceLoc Loc;
   if (Info.getLocation().isValid() && Info.hasSourceManager())
 Loc = FullSourceLoc(Info.getLocation(), Info.getSourceManager());
-  Converter.emitDiagnostic(Loc, DiagLevel, Message, Info.getRanges(),
+
+  StringRef FileName(Loc.printToString(Loc.getManager()));
+  if(getHeaderFilter()->match(FileName)) // only emit if FileName is matching
+  {
+Converter.emitDiagnostic(Loc, DiagLevel, Message, Info.getRanges(),
Info.getFixItHints());
+  }
 
   if (Info.hasSourceManager())
 checkFilters(Info.getLocation(), Info.getSourceManager());


Index: clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
===
--- clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
+++ clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
@@ -449,8 +449,13 @@
   FullSourceLoc Loc;
   if (Info.getLocation().isValid() && Info.hasSourceManager())
 Loc = FullSourceLoc(Info.getLocation(), Info.getSourceManager());
-  Converter.emitDiagnostic(Loc, DiagLevel, Message, Info.getRanges(),
+
+  StringRef FileName(Loc.printToString(Loc.getManager()));
+  if(getHeaderFilter()->match(FileName)) // only emit if FileName is matching
+  {
+Converter.emitDiagnostic(Loc, DiagLevel, Message, Info.getRanges(),
Info.getFixItHints());
+  }
 
   if (Info.hasSourceManager())
 checkFilters(Info.getLocation(), Info.getSourceManager());
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r355698 - Re-fix _lrotl/_lrotr to always take Long, no matter the platform.

2019-03-08 Thread Erich Keane via cfe-commits
Author: erichkeane
Date: Fri Mar  8 07:10:07 2019
New Revision: 355698

URL: http://llvm.org/viewvc/llvm-project?rev=355698=rev
Log:
Re-fix _lrotl/_lrotr to always take Long, no matter the platform.

r355322 fixed this, however is being reverted due to concerns with
enabling it in other modes.

Change-Id: I6a939b7469b8fa196d5871a627eb2330dbd30f29

Modified:
cfe/trunk/include/clang/Basic/Builtins.def
cfe/trunk/test/CodeGen/ms-intrinsics-rotations.c

Modified: cfe/trunk/include/clang/Basic/Builtins.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.def?rev=355698=355697=355698=diff
==
--- cfe/trunk/include/clang/Basic/Builtins.def (original)
+++ cfe/trunk/include/clang/Basic/Builtins.def Fri Mar  8 07:10:07 2019
@@ -831,12 +831,12 @@ LANGBUILTIN(_ReturnAddress, "v*", "n", A
 LANGBUILTIN(_rotl8,  "UcUcUc","n", ALL_MS_LANGUAGES)
 LANGBUILTIN(_rotl16, "UsUsUc","n", ALL_MS_LANGUAGES)
 LANGBUILTIN(_rotl,   "UiUii", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_lrotl,  "UNiUNii",   "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(_lrotl,  "ULiULii",   "n", ALL_MS_LANGUAGES)
 LANGBUILTIN(_rotl64, "UWiUWii",   "n", ALL_MS_LANGUAGES)
 LANGBUILTIN(_rotr8,  "UcUcUc","n", ALL_MS_LANGUAGES)
 LANGBUILTIN(_rotr16, "UsUsUc","n", ALL_MS_LANGUAGES)
 LANGBUILTIN(_rotr,   "UiUii", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_lrotr,  "UNiUNii",   "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(_lrotr,  "ULiULii",   "n", ALL_MS_LANGUAGES)
 LANGBUILTIN(_rotr64, "UWiUWii",   "n", ALL_MS_LANGUAGES)
 LANGBUILTIN(__va_start,   "vc**.", "nt", ALL_MS_LANGUAGES)
 LANGBUILTIN(__fastfail, "vUi","nr", ALL_MS_LANGUAGES)

Modified: cfe/trunk/test/CodeGen/ms-intrinsics-rotations.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-intrinsics-rotations.c?rev=355698=355697=355698=diff
==
--- cfe/trunk/test/CodeGen/ms-intrinsics-rotations.c (original)
+++ cfe/trunk/test/CodeGen/ms-intrinsics-rotations.c Fri Mar  8 07:10:07 2019
@@ -12,17 +12,10 @@
 // RUN: | FileCheck %s --check-prefixes CHECK,CHECK-32BIT-LONG
 // RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility 
-fms-compatibility-version=17.00 \
 // RUN: -triple x86_64--linux -emit-llvm %s -o - \
-// RUN: | FileCheck %s --check-prefixes CHECK,CHECK-32BIT-LONG
+// RUN: | FileCheck %s --check-prefixes CHECK,CHECK-64BIT-LONG
 // RUN: %clang_cc1 -ffreestanding -fms-extensions \
 // RUN: -triple x86_64--darwin -emit-llvm %s -o - \
-// RUN: | FileCheck %s --check-prefixes CHECK,CHECK-32BIT-LONG
-
-// LP64 targets use 'long' as 'int' for MS intrinsics (-fms-extensions)
-#ifdef __LP64__
-#define LONG int
-#else
-#define LONG long
-#endif
+// RUN: | FileCheck %s --check-prefixes CHECK,CHECK-64BIT-LONG
 
 // rotate left
 
@@ -47,12 +40,15 @@ unsigned int test_rotl(unsigned int valu
 // CHECK:   [[R:%.*]] = call i32 @llvm.fshl.i32(i32 [[X:%.*]], i32 [[X]], i32 
[[Y:%.*]])
 // CHECK:   ret i32 [[R]]
 
-unsigned LONG test_lrotl(unsigned LONG value, int shift) {
+unsigned long test_lrotl(unsigned long value, int shift) {
   return _lrotl(value, shift);
 }
 // CHECK-32BIT-LONG: i32 @test_lrotl
 // CHECK-32BIT-LONG:   [[R:%.*]] = call i32 @llvm.fshl.i32(i32 [[X:%.*]], i32 
[[X]], i32 [[Y:%.*]])
 // CHECK-32BIT-LONG:   ret i32 [[R]]
+// CHECK-64BIT-LONG: i64 @test_lrotl
+// CHECK-64BIT-LONG:   [[R:%.*]] = call i64 @llvm.fshl.i64(i64 [[X:%.*]], i64 
[[X]], i64 [[Y:%.*]])
+// CHECK-64BIT-LONG:   ret i64 [[R]]
 
 unsigned __int64 test_rotl64(unsigned __int64 value, int shift) {
   return _rotl64(value, shift);
@@ -84,12 +80,15 @@ unsigned int test_rotr(unsigned int valu
 // CHECK:   [[R:%.*]] = call i32 @llvm.fshr.i32(i32 [[X:%.*]], i32 [[X]], i32 
[[Y:%.*]])
 // CHECK:   ret i32 [[R]]
 
-unsigned LONG test_lrotr(unsigned LONG value, int shift) {
+unsigned long test_lrotr(unsigned long value, int shift) {
   return _lrotr(value, shift);
 }
 // CHECK-32BIT-LONG: i32 @test_lrotr
 // CHECK-32BIT-LONG:   [[R:%.*]] = call i32 @llvm.fshr.i32(i32 [[X:%.*]], i32 
[[X]], i32 [[Y:%.*]])
 // CHECK-32BIT-LONG:   ret i32 [[R]]
+// CHECK-64BIT-LONG: i64 @test_lrotr
+// CHECK-64BIT-LONG:   [[R:%.*]] = call i64 @llvm.fshr.i64(i64 [[X:%.*]], i64 
[[X]], i64 [[Y:%.*]])
+// CHECK-64BIT-LONG:   ret i64 [[R]]
 
 unsigned __int64 test_rotr64(unsigned __int64 value, int shift) {
   return _rotr64(value, shift);


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


r355697 - Revert "Enable _rotl, _lrotl, _rotr, _lrotr on all platforms."

2019-03-08 Thread Erich Keane via cfe-commits
Author: erichkeane
Date: Fri Mar  8 07:10:05 2019
New Revision: 355697

URL: http://llvm.org/viewvc/llvm-project?rev=355697=rev
Log:
Revert "Enable _rotl, _lrotl, _rotr, _lrotr on all platforms."

This reverts commit 24400dafe16716f28cd0e7e5fa6e004c0e50686a.

Removed:
cfe/trunk/test/CodeGen/rot-intrinsics.c
Modified:
cfe/trunk/include/clang/Basic/Builtins.def
cfe/trunk/test/CodeGen/ms-intrinsics-rotations.c

Modified: cfe/trunk/include/clang/Basic/Builtins.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.def?rev=355697=355696=355697=diff
==
--- cfe/trunk/include/clang/Basic/Builtins.def (original)
+++ cfe/trunk/include/clang/Basic/Builtins.def Fri Mar  8 07:10:05 2019
@@ -830,13 +830,13 @@ LANGBUILTIN(__popcnt64, "UWiUWi", "nc",
 LANGBUILTIN(_ReturnAddress, "v*", "n", ALL_MS_LANGUAGES)
 LANGBUILTIN(_rotl8,  "UcUcUc","n", ALL_MS_LANGUAGES)
 LANGBUILTIN(_rotl16, "UsUsUc","n", ALL_MS_LANGUAGES)
-BUILTIN(_rotl,   "UiUii", "n")
-BUILTIN(_lrotl,  "ULiULii",   "n")
+LANGBUILTIN(_rotl,   "UiUii", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(_lrotl,  "UNiUNii",   "n", ALL_MS_LANGUAGES)
 LANGBUILTIN(_rotl64, "UWiUWii",   "n", ALL_MS_LANGUAGES)
 LANGBUILTIN(_rotr8,  "UcUcUc","n", ALL_MS_LANGUAGES)
 LANGBUILTIN(_rotr16, "UsUsUc","n", ALL_MS_LANGUAGES)
-BUILTIN(_rotr,   "UiUii", "n")
-BUILTIN(_lrotr,  "ULiULii",   "n")
+LANGBUILTIN(_rotr,   "UiUii", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(_lrotr,  "UNiUNii",   "n", ALL_MS_LANGUAGES)
 LANGBUILTIN(_rotr64, "UWiUWii",   "n", ALL_MS_LANGUAGES)
 LANGBUILTIN(__va_start,   "vc**.", "nt", ALL_MS_LANGUAGES)
 LANGBUILTIN(__fastfail, "vUi","nr", ALL_MS_LANGUAGES)

Modified: cfe/trunk/test/CodeGen/ms-intrinsics-rotations.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-intrinsics-rotations.c?rev=355697=355696=355697=diff
==
--- cfe/trunk/test/CodeGen/ms-intrinsics-rotations.c (original)
+++ cfe/trunk/test/CodeGen/ms-intrinsics-rotations.c Fri Mar  8 07:10:05 2019
@@ -12,10 +12,17 @@
 // RUN: | FileCheck %s --check-prefixes CHECK,CHECK-32BIT-LONG
 // RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility 
-fms-compatibility-version=17.00 \
 // RUN: -triple x86_64--linux -emit-llvm %s -o - \
-// RUN: | FileCheck %s --check-prefixes CHECK,CHECK-64BIT-LONG
+// RUN: | FileCheck %s --check-prefixes CHECK,CHECK-32BIT-LONG
 // RUN: %clang_cc1 -ffreestanding -fms-extensions \
 // RUN: -triple x86_64--darwin -emit-llvm %s -o - \
-// RUN: | FileCheck %s --check-prefixes CHECK,CHECK-64BIT-LONG
+// RUN: | FileCheck %s --check-prefixes CHECK,CHECK-32BIT-LONG
+
+// LP64 targets use 'long' as 'int' for MS intrinsics (-fms-extensions)
+#ifdef __LP64__
+#define LONG int
+#else
+#define LONG long
+#endif
 
 // rotate left
 
@@ -40,15 +47,12 @@ unsigned int test_rotl(unsigned int valu
 // CHECK:   [[R:%.*]] = call i32 @llvm.fshl.i32(i32 [[X:%.*]], i32 [[X]], i32 
[[Y:%.*]])
 // CHECK:   ret i32 [[R]]
 
-unsigned long test_lrotl(unsigned long value, int shift) {
+unsigned LONG test_lrotl(unsigned LONG value, int shift) {
   return _lrotl(value, shift);
 }
 // CHECK-32BIT-LONG: i32 @test_lrotl
 // CHECK-32BIT-LONG:   [[R:%.*]] = call i32 @llvm.fshl.i32(i32 [[X:%.*]], i32 
[[X]], i32 [[Y:%.*]])
 // CHECK-32BIT-LONG:   ret i32 [[R]]
-// CHECK-64BIT-LONG: i64 @test_lrotl
-// CHECK-64BIT-LONG:   [[R:%.*]] = call i64 @llvm.fshl.i64(i64 [[X:%.*]], i64 
[[X]], i64 [[Y:%.*]])
-// CHECK-64BIT-LONG:   ret i64 [[R]]
 
 unsigned __int64 test_rotl64(unsigned __int64 value, int shift) {
   return _rotl64(value, shift);
@@ -80,15 +84,12 @@ unsigned int test_rotr(unsigned int valu
 // CHECK:   [[R:%.*]] = call i32 @llvm.fshr.i32(i32 [[X:%.*]], i32 [[X]], i32 
[[Y:%.*]])
 // CHECK:   ret i32 [[R]]
 
-unsigned long test_lrotr(unsigned long value, int shift) {
+unsigned LONG test_lrotr(unsigned LONG value, int shift) {
   return _lrotr(value, shift);
 }
 // CHECK-32BIT-LONG: i32 @test_lrotr
 // CHECK-32BIT-LONG:   [[R:%.*]] = call i32 @llvm.fshr.i32(i32 [[X:%.*]], i32 
[[X]], i32 [[Y:%.*]])
 // CHECK-32BIT-LONG:   ret i32 [[R]]
-// CHECK-64BIT-LONG: i64 @test_lrotr
-// CHECK-64BIT-LONG:   [[R:%.*]] = call i64 @llvm.fshr.i64(i64 [[X:%.*]], i64 
[[X]], i64 [[Y:%.*]])
-// CHECK-64BIT-LONG:   ret i64 [[R]]
 
 unsigned __int64 test_rotr64(unsigned __int64 value, int shift) {
   return _rotr64(value, shift);

Removed: cfe/trunk/test/CodeGen/rot-intrinsics.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/rot-intrinsics.c?rev=355696=auto
==
--- cfe/trunk/test/CodeGen/rot-intrinsics.c (original)
+++ cfe/trunk/test/CodeGen/rot-intrinsics.c (removed)
@@ -1,43 +0,0 @@
-// RUN: %clang_cc1 -ffreestanding \
-// RUN: -triple 

[PATCH] D59134: [ASTImporter] Remove obsolete function ImportTemplateParameterList.

2019-03-08 Thread Balázs Kéri via Phabricator via cfe-commits
balazske created this revision.
Herald added subscribers: cfe-commits, gamesh411, Szelethus, dkrupp.
Herald added a reviewer: martong.
Herald added a reviewer: a.sidorin.
Herald added a reviewer: shafik.
Herald added a project: clang.

The ASTNodeImporter::ImportTemplateParameterList is replaced by a
template specialization of 'import' that already exists and does
(almost) the same thing.


Repository:
  rC Clang

https://reviews.llvm.org/D59134

Files:
  lib/AST/ASTImporter.cpp

Index: lib/AST/ASTImporter.cpp
===
--- lib/AST/ASTImporter.cpp
+++ lib/AST/ASTImporter.cpp
@@ -392,8 +392,6 @@
 Error ImportDefinition(
 ObjCProtocolDecl *From, ObjCProtocolDecl *To,
 ImportDefinitionKind Kind = IDK_Default);
-Expected ImportTemplateParameterList(
-TemplateParameterList *Params);
 Error ImportTemplateArguments(
 const TemplateArgument *FromArgs, unsigned NumFromArgs,
 SmallVectorImpl );
@@ -1889,40 +1887,6 @@
   return Error::success();
 }
 
-// FIXME: Remove this, use `import` instead.
-Expected ASTNodeImporter::ImportTemplateParameterList(
-TemplateParameterList *Params) {
-  SmallVector ToParams(Params->size());
-  if (Error Err = ImportContainerChecked(*Params, ToParams))
-return std::move(Err);
-
-  Expr *ToRequiresClause;
-  if (Expr *const R = Params->getRequiresClause()) {
-if (Error Err = importInto(ToRequiresClause, R))
-  return std::move(Err);
-  } else {
-ToRequiresClause = nullptr;
-  }
-
-  auto ToTemplateLocOrErr = import(Params->getTemplateLoc());
-  if (!ToTemplateLocOrErr)
-return ToTemplateLocOrErr.takeError();
-  auto ToLAngleLocOrErr = import(Params->getLAngleLoc());
-  if (!ToLAngleLocOrErr)
-return ToLAngleLocOrErr.takeError();
-  auto ToRAngleLocOrErr = import(Params->getRAngleLoc());
-  if (!ToRAngleLocOrErr)
-return ToRAngleLocOrErr.takeError();
-
-  return TemplateParameterList::Create(
-  Importer.getToContext(),
-  *ToTemplateLocOrErr,
-  *ToLAngleLocOrErr,
-  ToParams,
-  *ToRAngleLocOrErr,
-  ToRequiresClause);
-}
-
 Error ASTNodeImporter::ImportTemplateArguments(
 const TemplateArgument *FromArgs, unsigned NumFromArgs,
 SmallVectorImpl ) {
@@ -3472,7 +3436,7 @@
   SmallVector ToTPLists(D->NumTPLists);
   auto **FromTPLists = D->getTrailingObjects();
   for (unsigned I = 0; I < D->NumTPLists; I++) {
-if (auto ListOrErr = ImportTemplateParameterList(FromTPLists[I]))
+if (auto ListOrErr = import(FromTPLists[I]))
   ToTPLists[I] = *ListOrErr;
 else
   return ListOrErr.takeError();
@@ -4907,8 +4871,7 @@
 return LocationOrErr.takeError();
 
   // Import template parameters.
-  auto TemplateParamsOrErr = ImportTemplateParameterList(
-  D->getTemplateParameters());
+  auto TemplateParamsOrErr = import(D->getTemplateParameters());
   if (!TemplateParamsOrErr)
 return TemplateParamsOrErr.takeError();
 
@@ -4995,8 +4958,7 @@
 return std::move(Err);
 
   // Create the class template declaration itself.
-  auto TemplateParamsOrErr = ImportTemplateParameterList(
-  D->getTemplateParameters());
+  auto TemplateParamsOrErr = import(D->getTemplateParameters());
   if (!TemplateParamsOrErr)
 return TemplateParamsOrErr.takeError();
 
@@ -5152,8 +5114,7 @@
 return std::move(Err);
   CanonInjType = CanonInjType.getCanonicalType();
 
-  auto ToTPListOrErr = ImportTemplateParameterList(
-  PartialSpec->getTemplateParameters());
+  auto ToTPListOrErr = import(PartialSpec->getTemplateParameters());
   if (!ToTPListOrErr)
 return ToTPListOrErr.takeError();
 
@@ -5307,8 +5268,7 @@
 return std::move(Err);
 
   // Create the variable template declaration itself.
-  auto TemplateParamsOrErr = ImportTemplateParameterList(
-  D->getTemplateParameters());
+  auto TemplateParamsOrErr = import(D->getTemplateParameters());
   if (!TemplateParamsOrErr)
 return TemplateParamsOrErr.takeError();
 
@@ -5413,8 +5373,7 @@
   *FromTAArgsAsWritten, ArgInfos))
 return std::move(Err);
 
-  auto ToTPListOrErr = ImportTemplateParameterList(
-  FromPartial->getTemplateParameters());
+  auto ToTPListOrErr = import(FromPartial->getTemplateParameters());
   if (!ToTPListOrErr)
 return ToTPListOrErr.takeError();
 
@@ -5522,8 +5481,7 @@
 }
   }
 
-  auto ParamsOrErr = ImportTemplateParameterList(
-  D->getTemplateParameters());
+  auto ParamsOrErr = import(D->getTemplateParameters());
   if (!ParamsOrErr)
 return ParamsOrErr.takeError();
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D59087: [clang-format] [PR25010] AllowShortIfStatementsOnASingleLine not working if an "else" statement is present

2019-03-08 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay updated this revision to Diff 189854.
MyDeveloperDay added a comment.

Fix spelling typo in documentation and comment


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

https://reviews.llvm.org/D59087

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/include/clang/Format/Format.h
  clang/lib/Format/Format.cpp
  clang/lib/Format/UnwrappedLineFormatter.cpp
  clang/unittests/Format/FormatTest.cpp

Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -487,6 +487,34 @@
   verifyFormat("if (a)\n  return;", AllowsMergedIf);
 }
 
+TEST_F(FormatTest, FormatIfWithoutCompoundStatementButElseWith) {
+  FormatStyle AllowsMergedIf = getLLVMStyle();
+  AllowsMergedIf.AlignEscapedNewlines = FormatStyle::ENAS_Left;
+  AllowsMergedIf.AllowShortIfStatementsOnASingleLine = true;
+  verifyFormat("if (a)\n"
+   "  f();\n"
+   "else {\n"
+   "  g();\n"
+   "}",
+   AllowsMergedIf);
+
+  AllowsMergedIf.AllowShortIfElseStatementsOnASingleLine = true;
+  verifyFormat("if (a) f();\n"
+   "else {\n"
+   "  g();\n"
+   "}",
+   AllowsMergedIf);
+  verifyFormat("if (a) f();\n"
+   "else {\n"
+   "  if (a) f();\n"
+   "  else {\n"
+   "g();\n"
+   "  }\n"
+   "  g();\n"
+   "}",
+   AllowsMergedIf);
+}
+
 TEST_F(FormatTest, FormatLoopsWithoutCompoundStatement) {
   FormatStyle AllowsMergedLoops = getLLVMStyle();
   AllowsMergedLoops.AllowShortLoopsOnASingleLine = true;
Index: clang/lib/Format/UnwrappedLineFormatter.cpp
===
--- clang/lib/Format/UnwrappedLineFormatter.cpp
+++ clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -413,10 +413,12 @@
 if (I[1]->First->isOneOf(tok::semi, tok::kw_if, tok::kw_for, tok::kw_while,
  TT_LineComment))
   return 0;
-// Only inline simple if's (no nested if or else).
-if (I + 2 != E && Line.startsWith(tok::kw_if) &&
-I[2]->First->is(tok::kw_else))
-  return 0;
+// Only inline simple if's (no nested if or else), unless specified
+if (!Style.AllowShortIfElseStatementsOnASingleLine) {
+  if (I + 2 != E && Line.startsWith(tok::kw_if) &&
+  I[2]->First->is(tok::kw_else))
+return 0;
+}
 return 1;
   }
 
Index: clang/lib/Format/Format.cpp
===
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -331,6 +331,8 @@
Style.AllowShortFunctionsOnASingleLine);
 IO.mapOptional("AllowShortIfStatementsOnASingleLine",
Style.AllowShortIfStatementsOnASingleLine);
+IO.mapOptional("AllowShortIfElseStatementsOnASingleLine",
+   Style.AllowShortIfElseStatementsOnASingleLine);
 IO.mapOptional("AllowShortLoopsOnASingleLine",
Style.AllowShortLoopsOnASingleLine);
 IO.mapOptional("AlwaysBreakAfterDefinitionReturnType",
@@ -632,6 +634,7 @@
   LLVMStyle.AllowShortBlocksOnASingleLine = false;
   LLVMStyle.AllowShortCaseLabelsOnASingleLine = false;
   LLVMStyle.AllowShortIfStatementsOnASingleLine = false;
+  LLVMStyle.AllowShortIfElseStatementsOnASingleLine = false;
   LLVMStyle.AllowShortLoopsOnASingleLine = false;
   LLVMStyle.AlwaysBreakAfterReturnType = FormatStyle::RTBS_None;
   LLVMStyle.AlwaysBreakAfterDefinitionReturnType = FormatStyle::DRTBS_None;
Index: clang/include/clang/Format/Format.h
===
--- clang/include/clang/Format/Format.h
+++ clang/include/clang/Format/Format.h
@@ -244,6 +244,19 @@
   /// If ``true``, ``if (a) return;`` can be put on a single line.
   bool AllowShortIfStatementsOnASingleLine;
 
+  /// When used in conjuction with ``AllowShortIfStatementsOnASingleLine``
+  /// then when ``true``, ``if (a) return;`` can be put on a single line even 
+  /// when the else clause is a compound statement.
+  /// \code
+  ///   true:   false:
+  ///   if (a) return;  vs. if (a)
+  ///   else {return;
+  /// return;   else {
+  ///   } return;
+  ///   }
+  /// \endcode
+  bool AllowShortIfElseStatementsOnASingleLine;
+
   /// If ``true``, ``while (true) continue;`` can be put on a single
   /// line.
   bool AllowShortLoopsOnASingleLine;
@@ -1728,6 +1741,8 @@
R.AllowShortFunctionsOnASingleLine &&
AllowShortIfStatementsOnASingleLine ==
R.AllowShortIfStatementsOnASingleLine &&
+   

[PATCH] D59105: [RFC] Create an Arbitrary Precision Integer Type.

2019-03-08 Thread Erich Keane via Phabricator via cfe-commits
erichkeane marked 7 inline comments as done.
erichkeane added a comment.

Thank you @rsmith for the quick review!  I really appreciate it.

In D59105#1422088 , @rsmith wrote:

> In principle, I think an extension in this space seems reasonable and useful. 
> Considering the points in http://clang.llvm.org/get_involved.html, I'm happy 
> to assume you meet points 2, 5, and 6, but I'd like to see a written-up 
> rationale for the other points. (In particular, you do not yet meet the bar 
> for points 3 and 7, and if you're not proposing this to WG14 or WG21 or 
> similar, some amount of rationale justifying that is necessary.)


I can definitely work on the test suite, and I'll attempt to improve the 
specification.  At the moment I don't believe we have an effort to get this 
into WG14/WG21, however I'll see if it is possible to figure out our interest 
here.

> I don't like the name `ArbPrecIntType`; this is not an arbitrary-precision 
> integer type, it's a fixed-width integer type. Something like 
> `ExtIntegerType` might fit better.
> 
> Defining new types via attributed `typedef`s is a horrible hack, and I would 
> not like to extend its scope any further. Have you considered alternative 
> interfaces for specifying the type? For instance, we could support an 
> `__int(N)` //type-specifier//. (I would expect such a specifier to behave 
> like a normal integer width //type-specifier// (eg, like `short` or `long` or 
> `__int128`), so we would allow things like `unsigned __int(54)`.)

I'd considered a type specifier, though I'd convinced myself that doing this 
more akin to the vector types would be more acceptable.

> Have you considered whether `__int(128)` (however you spell it) should be the 
> same type as the existing `__int128`? (I think it makes sense for the 
> `__int(N)` types to be distinct from all the standard types, even if `N` 
> matches, unlike the behavior of the GNU `mode` attribute. But the 
> relationship to `__int128` is less clear.)

In our opinion, __int(64) should be different than long/long long/etc, and 
__int(16) shouldn't be short.  That is because these types are useful when they 
don't follow common promotion rules, which force it to promote at in-opportune 
times (though, moreso with short, the rest were due to creating new rules 
anyway).  Additionally, the ability to overload on these types has been useful 
to our customers.  I'm not sure I understand enough of __int128 to determine 
whether there is sufficient motivation to make these separate types.

> How do integral promotions behave on these types? Are these types intended to 
> follow the rules for extended integer types? If not, in what ways, and why 
> not?

This question feels like a trap :)   While I wouldn't dare to claim 
understanding of the rules, I believe the only difference is exclusion from 
integral promotion rules.

> I'd like to see some tests for use of these types in these contexts:
> 
> - bit-fields
> - enum-bases
> - non-type template arguments (incl. mangling thereof)
> - UBSan, and in particular `-fsanitize=signed-integer-overflow` (this will 
> break; UBSan's static data representation assumes that integer types have 
> power-of-two sizes)
> - overload resolution with these types as parameters / arguments, 
> particularly involving overload sets also including standard integer types
> - TBAA metadata (I assume there is no aliasing relationship between these and 
> standard integer types)






Comment at: lib/AST/ASTContext.cpp:1788
"Overflow in array type bit size evaluation");
-Width = EltInfo.Width * Size;
+Width = llvm::alignTo(EltInfo.Width, EltInfo.Align) * Size;
 Align = EltInfo.Align;

rsmith wrote:
> Isn't this wrong for arrays of `__attribute__((aligned(N)))` types? Eg: 
> https://godbolt.org/z/jOW_B5
> 
> (GCC changed this and broke ABI in version 5 onwards, but if/when we follow 
> suit it should be an intentional decision, likely with a 
> `-fclang-abi-compat=` flag, not a side-effect of an unrelated change such as 
> this one.)
Oh dear... I was unaware of aligned.  Thats... special.



Comment at: lib/AST/ASTContext.cpp:2132
+const ArbPrecIntType *AT = cast(T);
+Width = AT->getNumBits();
+Align = std::min(std::max(getCharWidth(), llvm::PowerOf2Ceil(Width)),

rsmith wrote:
> Please do not add another case where a type's size is not a multiple of its 
> alignment. This behavior of `__attribute__((aligned(N)))` is a mistake that 
> we should not repeat. (Remember that `sizeof(T)` is supposed to be the size 
> of `T` as an array element.) `Width` should include the padding necessary to 
> reach a multiple of the alignment.
I think you're right here of course.  I believe you've likely noticed I end up 
doing an 'align-to' all over the place.  I think I should have just done it 
here.



Comment at: lib/AST/ASTContext.cpp:2133-2134

[PATCH] D59103: [clang-tidy] New checker bugprone-incomplete-comparison-operator

2019-03-08 Thread Kalle Huttunen via Phabricator via cfe-commits
kallehuttunen added a comment.

I found this checker to be useful in the code base I initially developed it 
for, but the usage of comparison operators there is pretty much limited to 
comparing simple aggregate types. It's true that this checker can produce lots 
of false positives, maybe too much to be included to clang-tidy proper.

@JonasToth 's proposal is interesting. Overall I think the 
"modernize-use-defaulted-spaceship-op" check would be much more complex than 
this one, but I guess the `FieldAccessVisitor` could be used as a building 
block.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D59103



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


[PATCH] D55358: [ASTImporter] Fix import of NestedNameSpecifierLoc.

2019-03-08 Thread Gabor Marton via Phabricator via cfe-commits
martong added a reviewer: a_sidorin.
martong added a comment.
Herald added a reviewer: martong.
Herald added a subscriber: jdoerfert.
Herald added a project: clang.

Ping


Repository:
  rC Clang

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

https://reviews.llvm.org/D55358



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


  1   2   >