[PATCH] D45544: [AAch64] Add the __ARM_FEATURE_DOTPROD macro definition

2018-04-12 Thread Junmo Park via Phabricator via cfe-commits
flyingforyou updated this revision to Diff 142265.
flyingforyou added a comment.

Addressed SjoerdMeijer' new comments. Thanks.

> Also wanted to confirm that macro __ARM_FEATURE_DOTPROD will defined/included 
> in the next release of the ACLE.

Could you check it, please? I saw several codes that use above definition which 
are written by ARM engineers.


https://reviews.llvm.org/D45544

Files:
  lib/Basic/Targets/AArch64.cpp
  lib/Basic/Targets/AArch64.h
  test/Preprocessor/aarch64-target-features.c


Index: test/Preprocessor/aarch64-target-features.c
===
--- test/Preprocessor/aarch64-target-features.c
+++ test/Preprocessor/aarch64-target-features.c
@@ -38,6 +38,7 @@
 // CHECK-NOT: __ARM_SIZEOF_MINIMAL_ENUM 1
 // CHECK-NOT: __ARM_SIZEOF_WCHAR_T 2
 // CHECK-NOT: __ARM_FEATURE_SVE
+// CHECK-NOT: __ARM_FEATURE_DOTPROD
 
 // RUN: %clang -target aarch64_be-eabi -x c -E -dM %s -o - | FileCheck %s 
-check-prefix CHECK-BIGENDIAN
 // CHECK-BIGENDIAN: __ARM_BIG_ENDIAN 1
@@ -89,6 +90,9 @@
 // RUN: %clang -target aarch64-none-linux-gnu -march=armv8-a+sve -x c -E -dM 
%s -o - | FileCheck --check-prefix=CHECK-SVE %s
 // CHECK-SVE: __ARM_FEATURE_SVE 1
 
+// RUN: %clang -target aarch64-none-linux-gnu -march=armv8.2a+dotprod -x c -E 
-dM %s -o - | FileCheck --check-prefix=CHECK-DOTPROD %s
+// CHECK-DOTPROD: __ARM_FEATURE_DOTPROD 1
+
 // RUN: %clang -target aarch64-none-linux-gnueabi -march=armv8.2a+fp16 -x c -E 
-dM %s -o - | FileCheck -match-full-lines 
--check-prefix=CHECK-FULLFP16-VECTOR-SCALAR %s
 // CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC 1
 // CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 1
Index: lib/Basic/Targets/AArch64.h
===
--- lib/Basic/Targets/AArch64.h
+++ lib/Basic/Targets/AArch64.h
@@ -33,6 +33,7 @@
   unsigned Crypto;
   unsigned Unaligned;
   unsigned HasFullFP16;
+  unsigned HasDotProd;
   llvm::AArch64::ArchKind ArchKind;
 
   static const Builtin::Info BuiltinInfo[];
Index: lib/Basic/Targets/AArch64.cpp
===
--- lib/Basic/Targets/AArch64.cpp
+++ lib/Basic/Targets/AArch64.cpp
@@ -193,6 +193,9 @@
   if (HasFullFP16)
Builder.defineMacro("__ARM_FEATURE_FP16_SCALAR_ARITHMETIC", "1");
 
+  if (HasDotProd)
+Builder.defineMacro("__ARM_FEATURE_DOTPROD", "1");
+
   switch (ArchKind) {
   default:
 break;
@@ -229,6 +232,7 @@
   Crypto = 0;
   Unaligned = 1;
   HasFullFP16 = 0;
+  HasDotProd = 0;
   ArchKind = llvm::AArch64::ArchKind::ARMV8A;
 
   for (const auto  : Features) {
@@ -248,6 +252,8 @@
   ArchKind = llvm::AArch64::ArchKind::ARMV8_2A;
 if (Feature == "+fullfp16")
   HasFullFP16 = 1;
+if (Feature == "+dotprod")
+  HasDotProd = 1;
   }
 
   setDataLayout();


Index: test/Preprocessor/aarch64-target-features.c
===
--- test/Preprocessor/aarch64-target-features.c
+++ test/Preprocessor/aarch64-target-features.c
@@ -38,6 +38,7 @@
 // CHECK-NOT: __ARM_SIZEOF_MINIMAL_ENUM 1
 // CHECK-NOT: __ARM_SIZEOF_WCHAR_T 2
 // CHECK-NOT: __ARM_FEATURE_SVE
+// CHECK-NOT: __ARM_FEATURE_DOTPROD
 
 // RUN: %clang -target aarch64_be-eabi -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-BIGENDIAN
 // CHECK-BIGENDIAN: __ARM_BIG_ENDIAN 1
@@ -89,6 +90,9 @@
 // RUN: %clang -target aarch64-none-linux-gnu -march=armv8-a+sve -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SVE %s
 // CHECK-SVE: __ARM_FEATURE_SVE 1
 
+// RUN: %clang -target aarch64-none-linux-gnu -march=armv8.2a+dotprod -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-DOTPROD %s
+// CHECK-DOTPROD: __ARM_FEATURE_DOTPROD 1
+
 // RUN: %clang -target aarch64-none-linux-gnueabi -march=armv8.2a+fp16 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-FULLFP16-VECTOR-SCALAR %s
 // CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC 1
 // CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 1
Index: lib/Basic/Targets/AArch64.h
===
--- lib/Basic/Targets/AArch64.h
+++ lib/Basic/Targets/AArch64.h
@@ -33,6 +33,7 @@
   unsigned Crypto;
   unsigned Unaligned;
   unsigned HasFullFP16;
+  unsigned HasDotProd;
   llvm::AArch64::ArchKind ArchKind;
 
   static const Builtin::Info BuiltinInfo[];
Index: lib/Basic/Targets/AArch64.cpp
===
--- lib/Basic/Targets/AArch64.cpp
+++ lib/Basic/Targets/AArch64.cpp
@@ -193,6 +193,9 @@
   if (HasFullFP16)
Builder.defineMacro("__ARM_FEATURE_FP16_SCALAR_ARITHMETIC", "1");
 
+  if (HasDotProd)
+Builder.defineMacro("__ARM_FEATURE_DOTPROD", "1");
+
   switch (ArchKind) {
   default:
 break;
@@ -229,6 +232,7 @@
   Crypto = 0;
   Unaligned = 1;
   HasFullFP16 = 0;
+  HasDotProd = 0;
   ArchKind = 

[PATCH] D45596: [libcxx] [test] Avoid unary_function.

2018-04-12 Thread Stephan T. Lavavej via Phabricator via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.

[libcxx] [test] Avoid unary_function.

Replace unary_function inheritance (which was never required,
even in C++98) with argument_type and result_type typedefs.
This increases portability, as unary_function was removed in C++17
and MSVC has implemented that removal.


https://reviews.llvm.org/D45596

Files:
  test/support/Counter.h


Index: test/support/Counter.h
===
--- test/support/Counter.h
+++ test/support/Counter.h
@@ -45,8 +45,10 @@
 
 template 
 struct hash
-: public std::unary_function
 {
+typedef Counter argument_type;
+typedef std::size_t result_type;
+
 std::size_t operator()(const Counter& x) const {return 
std::hash(x.get());}
 };
 }


Index: test/support/Counter.h
===
--- test/support/Counter.h
+++ test/support/Counter.h
@@ -45,8 +45,10 @@
 
 template 
 struct hash
-: public std::unary_function
 {
+typedef Counter argument_type;
+typedef std::size_t result_type;
+
 std::size_t operator()(const Counter& x) const {return std::hash(x.get());}
 };
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45594: [libcxx] [test] Silence MSVC warning C4146.

2018-04-12 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

This would have been fine for post-commit review.


https://reviews.llvm.org/D45594



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


r329932 - NFC - Indentation fixes in predefined-arch-macros.c

2018-04-12 Thread Gabor Buella via cfe-commits
Author: gbuella
Date: Thu Apr 12 11:15:39 2018
New Revision: 329932

URL: http://llvm.org/viewvc/llvm-project?rev=329932=rev
Log:
NFC - Indentation fixes in predefined-arch-macros.c

Consistently separating tests with empty lines.
Helps while navigating this file.

Reviewers: craig.topper

Reviewed By: craig.topper

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

Modified:
cfe/trunk/test/Preprocessor/predefined-arch-macros.c

Modified: cfe/trunk/test/Preprocessor/predefined-arch-macros.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/predefined-arch-macros.c?rev=329932=329931=329932=diff
==
--- cfe/trunk/test/Preprocessor/predefined-arch-macros.c (original)
+++ cfe/trunk/test/Preprocessor/predefined-arch-macros.c Thu Apr 12 11:15:39 
2018
@@ -1,5 +1,5 @@
 // Begin X86/GCC/Linux tests 
-//
+
 // RUN: %clang -march=i386 -m32 -E -dM %s -o - 2>&1 \
 // RUN: -target i386-unknown-linux \
 // RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_I386_M32
@@ -11,7 +11,7 @@
 // RUN: -target i386-unknown-linux \
 // RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_I386_M64
 // CHECK_I386_M64: error: {{.*}}
-//
+
 // RUN: %clang -march=i486 -m32 -E -dM %s -o - 2>&1 \
 // RUN: -target i386-unknown-linux \
 // RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_I486_M32
@@ -25,7 +25,7 @@
 // RUN: -target i386-unknown-linux \
 // RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_I486_M64
 // CHECK_I486_M64: error: {{.*}}
-//
+
 // RUN: %clang -march=i586 -m32 -E -dM %s -o - 2>&1 \
 // RUN: -target i386-unknown-linux \
 // RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_I586_M32
@@ -42,7 +42,7 @@
 // RUN: -target i386-unknown-linux \
 // RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_I586_M64
 // CHECK_I586_M64: error: {{.*}}
-//
+
 // RUN: %clang -march=pentium -m32 -E -dM %s -o - 2>&1 \
 // RUN: -target i386-unknown-linux \
 // RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_PENTIUM_M32
@@ -59,7 +59,7 @@
 // RUN: -target i386-unknown-linux \
 // RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_PENTIUM_M64
 // CHECK_PENTIUM_M64: error: {{.*}}
-//
+
 // RUN: %clang -march=pentium-mmx -m32 -E -dM %s -o - 2>&1 \
 // RUN: -target i386-unknown-linux \
 // RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_PENTIUM_MMX_M32
@@ -79,7 +79,7 @@
 // RUN: -target i386-unknown-linux \
 // RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_PENTIUM_MMX_M64
 // CHECK_PENTIUM_MMX_M64: error: {{.*}}
-//
+
 // RUN: %clang -march=winchip-c6 -m32 -E -dM %s -o - 2>&1 \
 // RUN: -target i386-unknown-linux \
 // RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_WINCHIP_C6_M32
@@ -94,7 +94,7 @@
 // RUN: -target i386-unknown-linux \
 // RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_WINCHIP_C6_M64
 // CHECK_WINCHIP_C6_M64: error: {{.*}}
-//
+
 // RUN: %clang -march=winchip2 -m32 -E -dM %s -o - 2>&1 \
 // RUN: -target i386-unknown-linux \
 // RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_WINCHIP2_M32
@@ -110,7 +110,7 @@
 // RUN: -target i386-unknown-linux \
 // RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_WINCHIP2_M64
 // CHECK_WINCHIP2_M64: error: {{.*}}
-//
+
 // RUN: %clang -march=c3 -m32 -E -dM %s -o - 2>&1 \
 // RUN: -target i386-unknown-linux \
 // RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_C3_M32
@@ -126,7 +126,7 @@
 // RUN: -target i386-unknown-linux \
 // RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_C3_M64
 // CHECK_C3_M64: error: {{.*}}
-//
+
 // RUN: %clang -march=c3-2 -m32 -E -dM %s -o - 2>&1 \
 // RUN: -target i386-unknown-linux \
 // RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_C3_2_M32
@@ -146,7 +146,7 @@
 // RUN: -target i386-unknown-linux \
 // RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_C3_2_M64
 // CHECK_C3_2_M64: error: {{.*}}
-//
+
 // RUN: %clang -march=i686 -m32 -E -dM %s -o - 2>&1 \
 // RUN: -target i386-unknown-linux \
 // RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_I686_M32
@@ -163,7 +163,7 @@
 // RUN: -target i386-unknown-linux \
 // RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_I686_M64
 // CHECK_I686_M64: error: {{.*}}
-//
+
 // RUN: %clang -march=pentiumpro -m32 -E -dM %s -o - 2>&1 \
 // RUN: -target i386-unknown-linux \
 // RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_PENTIUMPRO_M32
@@ -180,7 +180,7 @@
 // RUN: -target i386-unknown-linux \
 // RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_PENTIUMPRO_M64
 // CHECK_PENTIUMPRO_M64: error: {{.*}}
-//
+
 // RUN: %clang -march=pentium2 -m32 -E -dM %s -o - 2>&1 \
 // RUN: -target i386-unknown-linux \
 // RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK_PENTIUM2_M32
@@ -199,7 

r329937 - [X86] Introduce wbinvd intrinsic

2018-04-12 Thread Gabor Buella via cfe-commits
Author: gbuella
Date: Thu Apr 12 11:42:02 2018
New Revision: 329937

URL: http://llvm.org/viewvc/llvm-project?rev=329937=rev
Log:
[X86] Introduce wbinvd intrinsic

A previously missing intrinsic for an old instruction.

Reviewers: craig.topper, echristo

Reviewed By: craig.topper

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

Added:
cfe/trunk/test/CodeGen/builtin-wbinvd.c   (with props)
Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/ia32intrin.h

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=329937=329936=329937=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Thu Apr 12 11:42:02 2018
@@ -679,7 +679,8 @@ TARGET_BUILTIN(__builtin_ia32_clflushopt
 //CLWB
 TARGET_BUILTIN(__builtin_ia32_clwb, "vvC*", "", "clwb")
 
-//WBNOINVD
+//WB[NO]INVD
+TARGET_BUILTIN(__builtin_ia32_wbinvd, "v", "", "")
 TARGET_BUILTIN(__builtin_ia32_wbnoinvd, "v", "", "wbnoinvd")
 
 // ADX

Modified: cfe/trunk/lib/Headers/ia32intrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/ia32intrin.h?rev=329937=329936=329937=diff
==
--- cfe/trunk/lib/Headers/ia32intrin.h (original)
+++ cfe/trunk/lib/Headers/ia32intrin.h Thu Apr 12 11:42:02 2018
@@ -70,4 +70,9 @@ __rdtscp(unsigned int *__A) {
 
 #define _rdpmc(A) __rdpmc(A)
 
+static __inline__ void __attribute__((__always_inline__, __nodebug__))
+_wbinvd(void) {
+  return __builtin_ia32_wbinvd();
+}
+
 #endif /* __IA32INTRIN_H */

Added: cfe/trunk/test/CodeGen/builtin-wbinvd.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtin-wbinvd.c?rev=329937=auto
==
--- cfe/trunk/test/CodeGen/builtin-wbinvd.c (added)
+++ cfe/trunk/test/CodeGen/builtin-wbinvd.c Thu Apr 12 11:42:02 2018
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 %s -ffreestanding -triple=x86_64-unknown-unknown -emit-llvm 
-o - -Wall -Werror | FileCheck %s
+// RUN: %clang_cc1 %s -ffreestanding -triple=i386-unknown-unknown -emit-llvm 
-o - -Wall -Werror | FileCheck %s
+
+#include 
+
+void test_wbinvd(void) {
+  //CHECK-LABEL: @test_wbinvd
+  //CHECK: call void @llvm.x86.wbinvd()
+  _wbinvd();
+}

Propchange: cfe/trunk/test/CodeGen/builtin-wbinvd.c
--
svn:eol-style = native

Propchange: cfe/trunk/test/CodeGen/builtin-wbinvd.c
--
svn:keywords = Author Date Id Rev URL

Propchange: cfe/trunk/test/CodeGen/builtin-wbinvd.c
--
svn:mime-type = text/plain


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


Improve non-void no return warning

2018-04-12 Thread Devin Hussey via cfe-commits
I changed the messages like "control may reach end of non-void function" to 
"non-void function may not return a value"

I think this is a lot more understandable.



better-nonvoid-no-return-message.patch
Description: Binary data
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45217: [ThinLTO] Pass -save-temps to LTO backend for distributed ThinLTO builds

2018-04-12 Thread Teresa Johnson via Phabricator via cfe-commits
tejohnson added a comment.

ping


Repository:
  rC Clang

https://reviews.llvm.org/D45217



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


[PATCH] D45109: Remove -cc1 option "-backend-option"

2018-04-12 Thread Eli Friedman via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL329965: Remove -cc1 option -backend-option. 
(authored by efriedma, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D45109?vs=140484=142277#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D45109

Files:
  cfe/trunk/include/clang/Driver/CC1Options.td
  cfe/trunk/include/clang/Frontend/CodeGenOptions.h
  cfe/trunk/lib/CodeGen/BackendUtil.cpp
  cfe/trunk/lib/Driver/ToolChains/Clang.cpp
  cfe/trunk/lib/Frontend/CompilerInvocation.cpp
  cfe/trunk/test/CodeGen/thinlto-backend-option.ll
  cfe/trunk/test/CodeGenCUDA/link-device-bitcode.cu
  cfe/trunk/test/Driver/aarch64-fix-cortex-a53-835769.c
  cfe/trunk/test/Driver/apple-kext-mkernel.c
  cfe/trunk/test/Driver/arm-restrict-it.c
  cfe/trunk/test/Driver/debug-options.c
  cfe/trunk/test/Driver/mglobal-merge.c
  cfe/trunk/test/Driver/woa-restrict-it.c
  cfe/trunk/test/Frontend/backend-option.c

Index: cfe/trunk/test/Driver/arm-restrict-it.c
===
--- cfe/trunk/test/Driver/arm-restrict-it.c
+++ cfe/trunk/test/Driver/arm-restrict-it.c
@@ -4,12 +4,12 @@
 // RUN: %clang -target armv8a-none-gnueabi -mrestrict-it -### %s 2> %t
 // RUN: FileCheck --check-prefix=CHECK-RESTRICTED < %t %s
 
-// CHECK-RESTRICTED: "-backend-option" "-arm-restrict-it"
+// CHECK-RESTRICTED: "-mllvm" "-arm-restrict-it"
 
 // RUN: %clang -target arm-none-gnueabi -mno-restrict-it -### %s 2> %t
 // RUN: FileCheck --check-prefix=CHECK-NO-RESTRICTED < %t %s
 
 // RUN: %clang -target armv8a-none-gnueabi -mno-restrict-it -### %s 2> %t
 // RUN: FileCheck --check-prefix=CHECK-NO-RESTRICTED < %t %s
 
-// CHECK-NO-RESTRICTED: "-backend-option" "-arm-no-restrict-it"
+// CHECK-NO-RESTRICTED: "-mllvm" "-arm-no-restrict-it"
Index: cfe/trunk/test/Driver/mglobal-merge.c
===
--- cfe/trunk/test/Driver/mglobal-merge.c
+++ cfe/trunk/test/Driver/mglobal-merge.c
@@ -10,8 +10,8 @@
 // RUN:   -mno-global-merge
 // RUN: FileCheck --check-prefix=CHECK-NONE < %t %s
 
-// CHECK-NGM-ARM: "-backend-option" "-arm-global-merge=false"
-// CHECK-NGM-AARCH64: "-backend-option" "-aarch64-enable-global-merge=false"
+// CHECK-NGM-ARM: "-mllvm" "-arm-global-merge=false"
+// CHECK-NGM-AARCH64: "-mllvm" "-aarch64-enable-global-merge=false"
 
 // RUN: %clang -target armv7-unknown-unknown -### -fsyntax-only %s 2> %t \
 // RUN:   -mglobal-merge
@@ -25,8 +25,8 @@
 // RUN:   -mglobal-merge
 // RUN: FileCheck --check-prefix=CHECK-NONE < %t %s
 
-// CHECK-GM-ARM: "-backend-option" "-arm-global-merge=true"
-// CHECK-GM-AARCH64: "-backend-option" "-aarch64-enable-global-merge=true"
+// CHECK-GM-ARM: "-mllvm" "-arm-global-merge=true"
+// CHECK-GM-AARCH64: "-mllvm" "-aarch64-enable-global-merge=true"
 
 // RUN: %clang -target armv7-unknown-unknown -### -fsyntax-only %s 2> %t
 // RUN: FileCheck --check-prefix=CHECK-NONE < %t %s
Index: cfe/trunk/test/Driver/aarch64-fix-cortex-a53-835769.c
===
--- cfe/trunk/test/Driver/aarch64-fix-cortex-a53-835769.c
+++ cfe/trunk/test/Driver/aarch64-fix-cortex-a53-835769.c
@@ -8,6 +8,6 @@
 // RUN: %clang -target aarch64-android-eabi %s -### 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-YES %s
 
-// CHECK-DEF-NOT: "-backend-option" "-aarch64-fix-cortex-a53-835769"
-// CHECK-YES: "-backend-option" "-aarch64-fix-cortex-a53-835769=1"
-// CHECK-NO: "-backend-option" "-aarch64-fix-cortex-a53-835769=0"
+// CHECK-DEF-NOT: "-mllvm" "-aarch64-fix-cortex-a53-835769"
+// CHECK-YES: "-mllvm" "-aarch64-fix-cortex-a53-835769=1"
+// CHECK-NO: "-mllvm" "-aarch64-fix-cortex-a53-835769=0"
Index: cfe/trunk/test/Driver/woa-restrict-it.c
===
--- cfe/trunk/test/Driver/woa-restrict-it.c
+++ cfe/trunk/test/Driver/woa-restrict-it.c
@@ -1,4 +1,4 @@
 // RUN: %clang -target armv7-windows -### %s 2>&1 | FileCheck %s
 
-// CHECK: "-backend-option" "-arm-restrict-it"
+// CHECK: "-mllvm" "-arm-restrict-it"
 
Index: cfe/trunk/test/Driver/apple-kext-mkernel.c
===
--- cfe/trunk/test/Driver/apple-kext-mkernel.c
+++ cfe/trunk/test/Driver/apple-kext-mkernel.c
@@ -26,7 +26,3 @@
 // RUN: %clang -target x86_64-apple-darwin10 \
 // RUN:   -Werror -fno-builtin -fno-exceptions -fno-common -fno-rtti \
 // RUN:   -mkernel -fsyntax-only %s
-
-// RUN: %clang -c %s -target armv7k-apple-watchos -fapple-kext -mwatchos-version-min=1.0.0 -### 2>&1 \
-// RUN:   | FileCheck %s --check-prefix=CHECK-WATCH
-// CHECK-WATCH-NOT: "-backend-option" "-arm-long-calls"
Index: cfe/trunk/test/Driver/debug-options.c
===
--- cfe/trunk/test/Driver/debug-options.c
+++ cfe/trunk/test/Driver/debug-options.c
@@ -225,9 +225,9 @@
 //
 // GARANGE: 

[PATCH] D45597: [Driver] Android triples are not aliases for other triples.

2018-04-12 Thread Dan Albert via Phabricator via cfe-commits
danalbert created this revision.
danalbert added a reviewer: srhines.

Android targets should never use tools/libraries for non-Android
targets or vice versa.


Repository:
  rC Clang

https://reviews.llvm.org/D45597

Files:
  lib/Driver/ToolChains/Gnu.cpp
  test/Driver/android-ndk-standalone.cpp

Index: test/Driver/android-ndk-standalone.cpp
===
--- test/Driver/android-ndk-standalone.cpp
+++ test/Driver/android-ndk-standalone.cpp
@@ -352,3 +352,38 @@
 // CHECK-X86_64: "-L{{.*}}/lib/gcc/x86_64-linux-android/4.9"
 // CHECK-X86_64: "-L{{.*}}/lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/lib"
 // CHECK-X86_64: "-L{{.*}}/sysroot/usr/lib"
+
+// We need two sets of tests to verify that we both don't find non-Android
+// toolchains installations and that we *do* find Android toolchains. We can't
+// do both at the same time in this environment because we need to pass
+// --sysroot to find the toolchains which would override searching in /usr. In a
+// production environment --sysroot is not used and the toolchains are instead
+// found relative to the clang binary, so both would be considered.
+
+// RUN: %clang -v --target=i686-linux-android \
+// RUN: 2>&1 | FileCheck --check-prefix=CHECK-I686-GCC-NOSYS %s
+//
+// CHECK-I686-GCC-NOSYS-NOT: Found candidate GCC installation: /usr{{.*}}
+//
+// RUN: %clang -v --target=i686-linux-android \
+// RUN: --sysroot=%S/Inputs/basic_android_ndk_tree \
+// RUN: 2>&1 | FileCheck --check-prefix=CHECK-I686-GCC %s
+//
+// CHECK-I686-GCC-NOT: Found candidate GCC installation: /usr{{.*}}
+// CHECK-I686-GCC: Found candidate GCC installation: {{.*}}i686-linux-android/4.9
+// CHECK-I686-GCC-NEXT: Found candidate GCC installation: {{.*}}x86_64-linux-android/4.9
+// CHECK-I686-GCC-NEXT: Selected GCC installation: {{.*}}i686-linux-android/4.9
+
+// RUN: %clang -v --target=x86_64-linux-android \
+// RUN: 2>&1 | FileCheck --check-prefix=CHECK-X86_64-GCC-NOSYS %s
+//
+// CHECK-X86_64-GCC-NOSYS-NOT: Found candidate GCC installation: /usr{{.*}}
+
+// RUN: %clang -v --target=x86_64-linux-android \
+// RUN: --sysroot=%S/Inputs/basic_android_ndk_tree \
+// RUN: 2>&1 | FileCheck --check-prefix=CHECK-X86_64-GCC %s
+//
+// CHECK-X86_64-GCC-NOT: Found candidate GCC installation: /usr{{.*}}
+// CHECK-X86_64-GCC: Found candidate GCC installation: {{.*}}i686-linux-android/4.9
+// CHECK-X86_64-GCC-NEXT: Found candidate GCC installation: {{.*}}x86_64-linux-android/4.9
+// CHECK-X86_64-GCC-NEXT: Selected GCC installation: {{.*}}x86_64-linux-android/4.9
Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -1805,22 +1805,20 @@
   // lifetime or initialization issues.
   static const char *const AArch64LibDirs[] = {"/lib64", "/lib"};
   static const char *const AArch64Triples[] = {
-  "aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-linux-android",
-  "aarch64-redhat-linux", "aarch64-suse-linux"};
+  "aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-redhat-linux",
+  "aarch64-suse-linux"};
   static const char *const AArch64beLibDirs[] = {"/lib"};
   static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu",
  "aarch64_be-linux-gnu"};
 
   static const char *const ARMLibDirs[] = {"/lib"};
-  static const char *const ARMTriples[] = {"arm-linux-gnueabi",
-   "arm-linux-androideabi"};
+  static const char *const ARMTriples[] = {"arm-linux-gnueabi"};
   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
  "armv7hl-redhat-linux-gnueabi",
  "armv6hl-suse-linux-gnueabi",
  "armv7hl-suse-linux-gnueabi"};
   static const char *const ARMebLibDirs[] = {"/lib"};
-  static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
- "armeb-linux-androideabi"};
+  static const char *const ARMebTriples[] = {"armeb-linux-gnueabi"};
   static const char *const ARMebHFTriples[] = {
   "armeb-linux-gnueabihf", "armebv7hl-redhat-linux-gnueabi"};
 
@@ -1830,16 +1828,14 @@
   "x86_64-pc-linux-gnu","x86_64-redhat-linux6E",
   "x86_64-redhat-linux","x86_64-suse-linux",
   "x86_64-manbo-linux-gnu", "x86_64-linux-gnu",
-  "x86_64-slackware-linux", "x86_64-linux-android",
-  "x86_64-unknown-linux"};
+  "x86_64-slackware-linux", "x86_64-unknown-linux"};
   static const char *const X32LibDirs[] = {"/libx32"};
   static const char *const X86LibDirs[] = {"/lib32", "/lib"};
   static const char *const X86Triples[] = {
   "i686-linux-gnu",   "i686-pc-linux-gnu", "i486-linux-gnu",
   "i386-linux-gnu",   "i386-redhat-linux6E",   

[PATCH] D45557: [Analyzer] Fix for SValBuilder expressions rearrangement

2018-04-12 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments.



Comment at: lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:443
   return Sym->getType() == Ty &&
+APSIntType(Int) == BV.getAPSIntType(Sym->getType()) &&
 (!BinaryOperator::isComparisonOp(Op) ||

6. Therefore i conclude that this check should be moved to the branch around 
comment 3., and it'd become redundant here.



Comment at: lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:455-456
 
   // We expect everything to be of the same type - this type.
   QualType SingleTy;
 

1. We have expected `LSym` to be of this type.



Comment at: lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:469
   Opts.shouldAggressivelySimplifyRelationalComparison()) {
 SingleTy = LSym->getType();
 if (ResultTy != SVB.getConditionType())

2. It holds on this branch.



Comment at: lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:474
   } else if (BinaryOperator::isAdditiveOp(Op)) {
 SingleTy = ResultTy;
 // Substracting unsigned integers is a nightmare.

3. But not necessarily on that branch.



Comment at: lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:486
   SymbolRef RSym = Rhs.getAsSymbol();
   if (!RSym || RSym->getType() != SingleTy)
 return None;

4. We check that `RSym` is of the correct type, but `LSym` remains unchecked.



Comment at: lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:491
   llvm::APSInt LInt, RInt;
   std::tie(LSym, LInt) = decomposeSymbol(LSym, BV);
   std::tie(RSym, RInt) = decomposeSymbol(RSym, BV);

5. Type of `LInt` here is guaranteed to be equal to the type of `LSym`, because 
that's how we construct symbols. Which was supposed to also be equal to 
`SingleTy`, but we didn't check for that.


https://reviews.llvm.org/D45557



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


Re: [clang-tools-extra] r329873 - [clang-tidy] [modernize-use-auto] Get only a length of token, not the token itself

2018-04-12 Thread Zinovy Nis via cfe-commits
I composed a test and you are right - for multi-token type names new code
returns wrong result. So this new code was a premature optimization. Sorry.
I'll see how to fix it in a better way and create a review on it. Thanks
for poiting.

чт, 12 апр. 2018 г. в 20:01, Alexander Kornienko :

> On Thu, Apr 12, 2018 at 7:44 AM Zinovy Nis via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: zinovy.nis
>> Date: Wed Apr 11 22:41:24 2018
>> New Revision: 329873
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=329873=rev
>> Log:
>> [clang-tidy] [modernize-use-auto] Get only a length of token, not the
>> token itself
>>
>>
>> Modified:
>> clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp
>>
>> Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp?rev=329873=329872=329873=diff
>>
>> ==
>> --- clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp
>> (original)
>> +++ clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp Wed Apr
>> 11 22:41:24 2018
>> @@ -11,6 +11,7 @@
>>  #include "clang/AST/ASTContext.h"
>>  #include "clang/ASTMatchers/ASTMatchFinder.h"
>>  #include "clang/ASTMatchers/ASTMatchers.h"
>> +#include "clang/Lex/Lexer.h"
>>  #include "clang/Tooling/FixIt.h"
>>
>>  using namespace clang;
>> @@ -419,8 +420,8 @@ void UseAutoCheck::replaceExpr(
>>SourceRange Range(Loc.getSourceRange());
>>
>>if (MinTypeNameLength != 0 &&
>> -  tooling::fixit::getText(Loc.getSourceRange(),
>> FirstDecl->getASTContext())
>> -  .size() < MinTypeNameLength)
>> +  Lexer::MeasureTokenLength(Loc.getLocStart(),
>> Context->getSourceManager(),
>> +getLangOpts()) < MinTypeNameLength)
>>
>
> What about type names consisting of multiple tokens (`unsigned long long`,
> `struct VeryLongStructName`, etc.)?
>
>
>>  return;
>>
>>auto Diag = diag(Range.getBegin(), Message);
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [clang-tools-extra] r329873 - [clang-tidy] [modernize-use-auto] Get only a length of token, not the token itself

2018-04-12 Thread Roman Lebedev via cfe-commits
On Thu, Apr 12, 2018 at 10:47 PM, Zinovy Nis via cfe-commits
 wrote:
> I composed a test and you are right - for multi-token type names new code
> returns wrong result. So this new code was a premature optimization. Sorry.
> I'll see how to fix it in a better way and create a review on it. Thanks for
> poiting.
I think you want to revert that change in the mean time.

> чт, 12 апр. 2018 г. в 20:01, Alexander Kornienko :
>>
>> On Thu, Apr 12, 2018 at 7:44 AM Zinovy Nis via cfe-commits
>>  wrote:
>>>
>>> Author: zinovy.nis
>>> Date: Wed Apr 11 22:41:24 2018
>>> New Revision: 329873
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=329873=rev
>>> Log:
>>> [clang-tidy] [modernize-use-auto] Get only a length of token, not the
>>> token itself
>>>
>>>
>>> Modified:
>>> clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp
>>>
>>> Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp?rev=329873=329872=329873=diff
>>>
>>> ==
>>> --- clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp
>>> (original)
>>> +++ clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp Wed Apr
>>> 11 22:41:24 2018
>>> @@ -11,6 +11,7 @@
>>>  #include "clang/AST/ASTContext.h"
>>>  #include "clang/ASTMatchers/ASTMatchFinder.h"
>>>  #include "clang/ASTMatchers/ASTMatchers.h"
>>> +#include "clang/Lex/Lexer.h"
>>>  #include "clang/Tooling/FixIt.h"
>>>
>>>  using namespace clang;
>>> @@ -419,8 +420,8 @@ void UseAutoCheck::replaceExpr(
>>>SourceRange Range(Loc.getSourceRange());
>>>
>>>if (MinTypeNameLength != 0 &&
>>> -  tooling::fixit::getText(Loc.getSourceRange(),
>>> FirstDecl->getASTContext())
>>> -  .size() < MinTypeNameLength)
>>> +  Lexer::MeasureTokenLength(Loc.getLocStart(),
>>> Context->getSourceManager(),
>>> +getLangOpts()) < MinTypeNameLength)
>>
>>
>> What about type names consisting of multiple tokens (`unsigned long long`,
>> `struct VeryLongStructName`, etc.)?
>>
>>>
>>>  return;
>>>
>>>auto Diag = diag(Range.getBegin(), Message);
>>>
>>>
>>> ___
>>> cfe-commits mailing list
>>> cfe-commits@lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45513: [clangd] Add line and column number to the index symbol.

2018-04-12 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added inline comments.



Comment at: clangd/index/Index.h:32
+// Character offset on a line in a document (zero-based).
+int Character = 0;
+  };

hokein wrote:
> sammccall wrote:
> > sammccall wrote:
> > > Column?
> > > 
> > > LSP calls this "character" but this is nonstandard and I find it very 
> > > confusing with offset. 
> > We should document what this is an offset into: bytes, utf-16 code units, 
> > or unicode codepoints. (Or even grid offsets - glyphs and doublewidth are a 
> > thing)
> > 
> > Given that we intend to send it over LSP without reading the source, only 
> > utf-16 code units is really correct. Unicode codepoints is "nicer" and will 
> > give correct results in the BMP, while bytes will be correct for ASCII only.
> > 
> > I'd vote for making this utf-16 code units.
> > 
> > It's OK if the code populating it doesn't get this right (confuses bytes 
> > and code units) but add a fixme.
> Done. Added FIXME.
I'd vote for Unicode code points.

I haven't looked into this closely. But UTF-8 vs UTF-16 vs Unicode code points 
should not be a big issue here. Unless you use emojis or some uncommon 
characters, the usage of UTF-16 code units in LSP does not have a lot of harm.

//   anything weird hidden in line comments can be ignored because they 
don't affect offset calculation

And Microsoft might change the spec one day 
https://github.com/Microsoft/language-server-protocol/issues/376


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D45513



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


[PATCH] D45529: [CMake] Set the default ABI version for Fuchsia in CMake as well

2018-04-12 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

In https://reviews.llvm.org/D45529#1066394, @EricWF wrote:

> OK, so we need to bump the SO version -- However I don't want to generate a 
> __site_config header because of that if the __config header is sufficient. I 
> would like to see a solution that takes that into account.


There shouldn't be any `__site_config` generated now since we compare 
`LIBCXX_ABI_VERSION` to the default version so it'll only be generated if the 
change the default value (2 on Fuchsia, 1 everywhere else).


Repository:
  rCXX libc++

https://reviews.llvm.org/D45529



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


Re: [PATCH] D45109: Remove -cc1 option "-backend-option"

2018-04-12 Thread George Karpenkov via cfe-commits
Hi Eli,

The commit makes sense, but I’m not sure about your change to the 
`test/Driver/apple-kext-mkernel.c 
` 
file:
instead of changing the run lines to use -mllvm you have removed them.
Was there a reason for the removal?

Regards,
George

> On Apr 12, 2018, at 3:25 PM, Eli Friedman via Phabricator via llvm-commits 
>  wrote:
> 
> This revision was automatically updated to reflect the committed changes.
> Closed by commit rL329965: Remove -cc1 option -backend-option. 
> (authored by efriedma, committed by ).
> Herald added a subscriber: llvm-commits.
> 
> Changed prior to commit:
>  https://reviews.llvm.org/D45109?vs=140484=142277#toc
> 
> Repository:
>  rL LLVM
> 
> https://reviews.llvm.org/D45109
> 
> Files:
>  cfe/trunk/include/clang/Driver/CC1Options.td
>  cfe/trunk/include/clang/Frontend/CodeGenOptions.h
>  cfe/trunk/lib/CodeGen/BackendUtil.cpp
>  cfe/trunk/lib/Driver/ToolChains/Clang.cpp
>  cfe/trunk/lib/Frontend/CompilerInvocation.cpp
>  cfe/trunk/test/CodeGen/thinlto-backend-option.ll
>  cfe/trunk/test/CodeGenCUDA/link-device-bitcode.cu
>  cfe/trunk/test/Driver/aarch64-fix-cortex-a53-835769.c
>  cfe/trunk/test/Driver/apple-kext-mkernel.c
>  cfe/trunk/test/Driver/arm-restrict-it.c
>  cfe/trunk/test/Driver/debug-options.c
>  cfe/trunk/test/Driver/mglobal-merge.c
>  cfe/trunk/test/Driver/woa-restrict-it.c
>  cfe/trunk/test/Frontend/backend-option.c
> 
> ___
> llvm-commits mailing list
> llvm-comm...@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits

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


[PATCH] D45109: Remove -cc1 option "-backend-option"

2018-04-12 Thread George Karpenkov via Phabricator via cfe-commits
george.karpenkov added subscribers: efriedma, george.karpenkov.
george.karpenkov added a comment.

Hi Eli,

The commit makes sense, but I’m not sure about your change to the 
`test/Driver/apple-kext-mkernel.c 
` 
file:
instead of changing the run lines to use -mllvm you have removed them.
Was there a reason for the removal?

Regards,
George


Repository:
  rL LLVM

https://reviews.llvm.org/D45109



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


[PATCH] D45601: Warn on bool* to bool conversion

2018-04-12 Thread Aditya Kumar via Phabricator via cfe-commits
hiraditya created this revision.
hiraditya added reviewers: Eugene.Zelenko, rsmith.

We found conversion from bool* to bool to be a common source of bug, so we have 
implemented this warning. Sample use case:

  int bar(bool b) {
return b;
  }
  
  int baz() {
bool *b; 
bar(b);
return 0;
  }

Typically, there would be a function which takes a bool, which gets a pointer 
to boolean at the call site. The compiler currently does not warn which results
in a difficult to debug runtime failure.


https://reviews.llvm.org/D45601

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaChecking.cpp
  test/CXX/expr/expr.unary/expr.unary.op/p6.cpp
  test/Sema/static-init.c
  test/SemaCXX/warn-bool-ptr-to-bool.cpp


Index: test/SemaCXX/warn-bool-ptr-to-bool.cpp
===
--- /dev/null
+++ test/SemaCXX/warn-bool-ptr-to-bool.cpp
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+int foo(bool *b) {
+  if (b)
+// expected-warning@-1 {{comparing 'bool *' as a boolean}}
+return 10;
+  return 0;
+}
+
+
+int bar(bool b) {
+  return b;
+}
+
+int baz() {
+  bool *b;
+  bar(b);
+  // expected-warning@-1 {{comparing 'bool *' as a boolean}}
+  return 0;
+}
+
+
+
Index: test/Sema/static-init.c
===
--- test/Sema/static-init.c
+++ test/Sema/static-init.c
@@ -7,7 +7,7 @@
 
 float r  = (float) (intptr_t)  // expected-error {{initializer element is 
not a compile-time constant}}
 intptr_t s = (intptr_t) 
-_Bool t = 
+_Bool t =  // expected-warning {{comparing '_Bool *' as a boolean}}
 
 
 union bar {
Index: test/CXX/expr/expr.unary/expr.unary.op/p6.cpp
===
--- test/CXX/expr/expr.unary/expr.unary.op/p6.cpp
+++ test/CXX/expr/expr.unary/expr.unary.op/p6.cpp
@@ -16,6 +16,7 @@
 
 // --  pointer, 
 bool b6 = ! // expected-warning{{address of 'b4' will always evaluate to 
'true'}}
+// expected-warning@-1 {{comparing 'bool *' as a boolean}}
 void f();
 bool b61 = !
 
Index: lib/Sema/SemaChecking.cpp
===
--- lib/Sema/SemaChecking.cpp
+++ lib/Sema/SemaChecking.cpp
@@ -9610,6 +9610,12 @@
   S.DiagnoseAlwaysNonNullPointer(E, Expr::NPCK_NotNull, /*IsEqual*/ false,
  SourceRange(CC));
 }
+if (Source->isPointerType() || Source->canDecayToPointerType()) {
+  QualType PointeeType = Source->getPointeeType();
+  // Warn on bool* to bool conversion.
+  if (!PointeeType.isNull() && PointeeType->isBooleanType())
+return DiagnoseImpCast(S, E, T, CC, diag::warn_pointer_to_bool);
+}
   }
 
   // Check implicit casts from Objective-C collection literals to specialized
Index: include/clang/Basic/DiagnosticSemaKinds.td
===
--- include/clang/Basic/DiagnosticSemaKinds.td
+++ include/clang/Basic/DiagnosticSemaKinds.td
@@ -7801,6 +7801,9 @@
   "format specifies type %0 but the argument has "
   "%select{type|underlying type}2 %1">,
   InGroup;
+def warn_pointer_to_bool : Warning<
+  "comparing %0 as a boolean">,
+  InGroup;
 def warn_format_argument_needs_cast : Warning<
   "%select{values of type|enum values with underlying type}2 '%0' should not "
   "be used as format arguments; add an explicit cast to %1 instead">,


Index: test/SemaCXX/warn-bool-ptr-to-bool.cpp
===
--- /dev/null
+++ test/SemaCXX/warn-bool-ptr-to-bool.cpp
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+int foo(bool *b) {
+  if (b)
+// expected-warning@-1 {{comparing 'bool *' as a boolean}}
+return 10;
+  return 0;
+}
+
+
+int bar(bool b) {
+  return b;
+}
+
+int baz() {
+  bool *b;
+  bar(b);
+  // expected-warning@-1 {{comparing 'bool *' as a boolean}}
+  return 0;
+}
+
+
+
Index: test/Sema/static-init.c
===
--- test/Sema/static-init.c
+++ test/Sema/static-init.c
@@ -7,7 +7,7 @@
 
 float r  = (float) (intptr_t)  // expected-error {{initializer element is not a compile-time constant}}
 intptr_t s = (intptr_t) 
-_Bool t = 
+_Bool t =  // expected-warning {{comparing '_Bool *' as a boolean}}
 
 
 union bar {
Index: test/CXX/expr/expr.unary/expr.unary.op/p6.cpp
===
--- test/CXX/expr/expr.unary/expr.unary.op/p6.cpp
+++ test/CXX/expr/expr.unary/expr.unary.op/p6.cpp
@@ -16,6 +16,7 @@
 
 // --  pointer, 
 bool b6 = ! // expected-warning{{address of 'b4' will always evaluate to 'true'}}
+// expected-warning@-1 {{comparing 'bool *' as a boolean}}
 void f();
 bool b61 = !
 
Index: lib/Sema/SemaChecking.cpp
===
--- lib/Sema/SemaChecking.cpp
+++ lib/Sema/SemaChecking.cpp
@@ -9610,6 +9610,12 @@
   

[clang-tools-extra] r329949 - Revert "[clang-tidy] [modernize-use-auto] Get only a length of token, not the token itself"

2018-04-12 Thread Zinovy Nis via cfe-commits
Author: zinovy.nis
Date: Thu Apr 12 13:33:24 2018
New Revision: 329949

URL: http://llvm.org/viewvc/llvm-project?rev=329949=rev
Log:
Revert "[clang-tidy] [modernize-use-auto] Get only a length of token, not the 
token itself"

This reverts r329873 as getting only a single token length is wrong for 
multi-token type names,
like 'unsigned long int'.


Modified:
clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp

Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp?rev=329949=329948=329949=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp Thu Apr 12 
13:33:24 2018
@@ -11,7 +11,6 @@
 #include "clang/AST/ASTContext.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "clang/ASTMatchers/ASTMatchers.h"
-#include "clang/Lex/Lexer.h"
 #include "clang/Tooling/FixIt.h"
 
 using namespace clang;
@@ -420,8 +419,8 @@ void UseAutoCheck::replaceExpr(
   SourceRange Range(Loc.getSourceRange());
 
   if (MinTypeNameLength != 0 &&
-  Lexer::MeasureTokenLength(Loc.getLocStart(), Context->getSourceManager(),
-getLangOpts()) < MinTypeNameLength)
+  tooling::fixit::getText(Loc.getSourceRange(), FirstDecl->getASTContext())
+  .size() < MinTypeNameLength)
 return;
 
   auto Diag = diag(Range.getBegin(), Message);


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


[PATCH] D45591: Clean carriage returns from lib/ and include/. NFC.

2018-04-12 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone created this revision.
Herald added subscribers: cfe-commits, krytarowski, emaste.

Clean carriage returns from lib/ and include/. NFC.
(I have to make this change locally in order for `git diff` to show sane output 
after I edit a file, so I might as well ask for it to be committed. I don't 
have commit privs myself.)

Here's the command I used to reformat things. (Requires bash and OSX/FreeBSD 
sed.)

  git grep -l $'\r' lib include | xargs sed -i -e $'s/\r//'


Repository:
  rC Clang

https://reviews.llvm.org/D45591

Files:
  lib/AST/ASTDumper.cpp
  lib/AST/ExprConstant.cpp
  lib/CodeGen/CGExprScalar.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaPseudoObject.cpp
  lib/Sema/SemaTemplate.cpp
  lib/Serialization/ASTWriterStmt.cpp
  lib/StaticAnalyzer/Checkers/PaddingChecker.cpp

Index: lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
+++ lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
@@ -1,330 +1,330 @@
-//===- PaddingChecker.cpp *- 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 a checker that checks for padding that could be
-//  removed by re-ordering members.
-//
-//===--===//
-
-#include "ClangSACheckers.h"
-#include "clang/AST/CharUnits.h"
-#include "clang/AST/DeclTemplate.h"
-#include "clang/AST/RecordLayout.h"
-#include "clang/AST/RecursiveASTVisitor.h"
-#include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h"
-#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
-#include "clang/StaticAnalyzer/Core/Checker.h"
-#include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h"
-#include "llvm/ADT/SmallString.h"
-#include "llvm/Support/MathExtras.h"
-#include "llvm/Support/raw_ostream.h"
-#include 
-
-using namespace clang;
-using namespace ento;
-
-namespace {
-class PaddingChecker : public Checker {
-private:
-  mutable std::unique_ptr PaddingBug;
-  mutable int64_t AllowedPad;
-  mutable BugReporter *BR;
-
-public:
-  void checkASTDecl(const TranslationUnitDecl *TUD, AnalysisManager ,
-BugReporter ) const {
-BR = 
-AllowedPad =
-MGR.getAnalyzerOptions().getOptionAsInteger("AllowedPad", 24, this);
-assert(AllowedPad >= 0 && "AllowedPad option should be non-negative");
-
-// The calls to checkAST* from AnalysisConsumer don't
-// visit template instantiations or lambda classes. We
-// want to visit those, so we make our own RecursiveASTVisitor.
-struct LocalVisitor : public RecursiveASTVisitor {
-  const PaddingChecker *Checker;
-  bool shouldVisitTemplateInstantiations() const { return true; }
-  bool shouldVisitImplicitCode() const { return true; }
-  explicit LocalVisitor(const PaddingChecker *Checker) : Checker(Checker) {}
-  bool VisitRecordDecl(const RecordDecl *RD) {
-Checker->visitRecord(RD);
-return true;
-  }
-  bool VisitVarDecl(const VarDecl *VD) {
-Checker->visitVariable(VD);
-return true;
-  }
-  // TODO: Visit array new and mallocs for arrays.
-};
-
-LocalVisitor visitor(this);
-visitor.TraverseDecl(const_cast(TUD));
-  }
-
-  /// \brief Look for records of overly padded types. If padding *
-  /// PadMultiplier exceeds AllowedPad, then generate a report.
-  /// PadMultiplier is used to share code with the array padding
-  /// checker.
-  void visitRecord(const RecordDecl *RD, uint64_t PadMultiplier = 1) const {
-if (shouldSkipDecl(RD))
-  return;
-
-auto  = RD->getASTContext();
-const ASTRecordLayout  = ASTContext.getASTRecordLayout(RD);
-assert(llvm::isPowerOf2_64(RL.getAlignment().getQuantity()));
-
-CharUnits BaselinePad = calculateBaselinePad(RD, ASTContext, RL);
-if (BaselinePad.isZero())
-  return;
-
-CharUnits OptimalPad;
-SmallVector OptimalFieldsOrder;
-std::tie(OptimalPad, OptimalFieldsOrder) =
-calculateOptimalPad(RD, ASTContext, RL);
-
-CharUnits DiffPad = PadMultiplier * (BaselinePad - OptimalPad);
-if (DiffPad.getQuantity() <= AllowedPad) {
-  assert(!DiffPad.isNegative() && "DiffPad should not be negative");
-  // There is not enough excess padding to trigger a warning.
-  return;
-}
-reportRecord(RD, BaselinePad, OptimalPad, OptimalFieldsOrder);
-  }
-
-  /// \brief Look for arrays of overly padded types. If the padding of the
-  /// array type exceeds AllowedPad, then generate a report.
-  void visitVariable(const VarDecl *VD) const {
-const ArrayType *ArrTy = VD->getType()->getAsArrayTypeUnsafe();
-if (ArrTy == nullptr)
-  

[PATCH] D45595: [libcxx] [test] Fix nodiscard warnings.

2018-04-12 Thread Stephan T. Lavavej via Phabricator via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.

[libcxx] [test] Fix nodiscard warnings.

MSVC's STL has marked to_bytes/from_bytes as nodiscard.


https://reviews.llvm.org/D45595

Files:
  
test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp


Index: 
test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp
===
--- 
test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp
+++ 
test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp
@@ -33,15 +33,15 @@
 Myconv myconv;
 try
 {
-myconv.to_bytes(L"\xDA83");
+(void)myconv.to_bytes(L"\xDA83");
 assert(false);
 }
 catch (const std::range_error&)
 {
 }
 try
 {
-myconv.from_bytes('\xA5');
+(void)myconv.from_bytes('\xA5');
 assert(false);
 }
 catch (const std::range_error&)
@@ -56,7 +56,7 @@
 #ifndef TEST_HAS_NO_EXCEPTIONS
 try
 {
-myconv.from_bytes('\xA5');
+(void)myconv.from_bytes('\xA5');
 assert(false);
 }
 catch (const std::range_error&)


Index: test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp
===
--- test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp
+++ test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp
@@ -33,15 +33,15 @@
 Myconv myconv;
 try
 {
-myconv.to_bytes(L"\xDA83");
+(void)myconv.to_bytes(L"\xDA83");
 assert(false);
 }
 catch (const std::range_error&)
 {
 }
 try
 {
-myconv.from_bytes('\xA5');
+(void)myconv.from_bytes('\xA5');
 assert(false);
 }
 catch (const std::range_error&)
@@ -56,7 +56,7 @@
 #ifndef TEST_HAS_NO_EXCEPTIONS
 try
 {
-myconv.from_bytes('\xA5');
+(void)myconv.from_bytes('\xA5');
 assert(false);
 }
 catch (const std::range_error&)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r329942 - Fix doc typo

2018-04-12 Thread Vlad Tsyrklevich via cfe-commits
Author: vlad.tsyrklevich
Date: Thu Apr 12 12:35:39 2018
New Revision: 329942

URL: http://llvm.org/viewvc/llvm-project?rev=329942=rev
Log:
Fix doc typo

Modified:
cfe/trunk/docs/ControlFlowIntegrity.rst

Modified: cfe/trunk/docs/ControlFlowIntegrity.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ControlFlowIntegrity.rst?rev=329942=329941=329942=diff
==
--- cfe/trunk/docs/ControlFlowIntegrity.rst (original)
+++ cfe/trunk/docs/ControlFlowIntegrity.rst Thu Apr 12 12:35:39 2018
@@ -224,8 +224,8 @@ flag relax pointer type checking for cal
 applied across all functions compiled with ``-fsanitize=cfi-icall``.
 
 Specifically, pointers in return and argument types are treated as equivalent 
as
-long as the qualifiers for the type they point to match. For example, ``char*``
-``char**`, and ``int*`` are considered equivalent types. However, ``char*`` and
+long as the qualifiers for the type they point to match. For example, 
``char*``,
+``char**``, and ``int*`` are considered equivalent types. However, ``char*`` 
and
 ``const char*`` are considered separate types.
 
 ``-fsanitize-cfi-icall-generalize-pointers`` is not compatible with


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


[PATCH] D45529: [CMake] Set the default ABI version for Fuchsia in CMake as well

2018-04-12 Thread Petr Hosek via Phabricator via cfe-commits
phosek updated this revision to Diff 142261.
phosek marked an inline comment as done.
phosek added a comment.

I had something similar in https://reviews.llvm.org/D45304 but Eric suggested 
removing it. What I haven't realized is that this value is also used to set the 
SOVERSION so it's indeed needed.


Repository:
  rCXX libc++

https://reviews.llvm.org/D45529

Files:
  libcxx/CMakeLists.txt


Index: libcxx/CMakeLists.txt
===
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -97,7 +97,12 @@
 cmake_dependent_option(LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY
 "Install libc++experimental.a" ON
 "LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY;LIBCXX_INSTALL_LIBRARY" OFF)
-set(LIBCXX_ABI_VERSION 1 CACHE STRING "ABI version of libc++.")
+if (FUCHSIA)
+  set(DEFAULT_ABI_VERSION 2)
+else()
+  set(DEFAULT_ABI_VERSION 1)
+endif()
+set(LIBCXX_ABI_VERSION ${DEFAULT_ABI_VERSION} CACHE STRING "ABI version of 
libc++.")
 option(LIBCXX_ABI_UNSTABLE "Unstable ABI of libc++." OFF)
 option(LIBCXX_ABI_FORCE_ITANIUM "Ignore auto-detection and force use of the 
Itanium ABI.")
 option(LIBCXX_ABI_FORCE_MICROSOFT "Ignore auto-detection and force use of the 
Microsoft ABI.")
@@ -619,7 +624,7 @@
 endif()
 
 # Configuration file flags 
=
-if (NOT LIBCXX_ABI_VERSION EQUAL "1")
+if (NOT LIBCXX_ABI_VERSION EQUAL DEFAULT_ABI_VERSION)
   config_define(${LIBCXX_ABI_VERSION} _LIBCPP_ABI_VERSION)
 endif()
 config_define_if(LIBCXX_ABI_UNSTABLE _LIBCPP_ABI_UNSTABLE)


Index: libcxx/CMakeLists.txt
===
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -97,7 +97,12 @@
 cmake_dependent_option(LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY
 "Install libc++experimental.a" ON
 "LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY;LIBCXX_INSTALL_LIBRARY" OFF)
-set(LIBCXX_ABI_VERSION 1 CACHE STRING "ABI version of libc++.")
+if (FUCHSIA)
+  set(DEFAULT_ABI_VERSION 2)
+else()
+  set(DEFAULT_ABI_VERSION 1)
+endif()
+set(LIBCXX_ABI_VERSION ${DEFAULT_ABI_VERSION} CACHE STRING "ABI version of libc++.")
 option(LIBCXX_ABI_UNSTABLE "Unstable ABI of libc++." OFF)
 option(LIBCXX_ABI_FORCE_ITANIUM "Ignore auto-detection and force use of the Itanium ABI.")
 option(LIBCXX_ABI_FORCE_MICROSOFT "Ignore auto-detection and force use of the Microsoft ABI.")
@@ -619,7 +624,7 @@
 endif()
 
 # Configuration file flags =
-if (NOT LIBCXX_ABI_VERSION EQUAL "1")
+if (NOT LIBCXX_ABI_VERSION EQUAL DEFAULT_ABI_VERSION)
   config_define(${LIBCXX_ABI_VERSION} _LIBCPP_ABI_VERSION)
 endif()
 config_define_if(LIBCXX_ABI_UNSTABLE _LIBCPP_ABI_UNSTABLE)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45529: [CMake] Set the default ABI version for Fuchsia in CMake as well

2018-04-12 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

OK, so we need to bump the SO version -- However I don't want to generate a 
__site_config header because of that if the __config header is sufficient. I 
would like to see a solution that takes that into account.


Repository:
  rCXX libc++

https://reviews.llvm.org/D45529



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


[PATCH] D45594: [libcxx] [test] Silence MSVC warning C4146.

2018-04-12 Thread Stephan T. Lavavej via Phabricator via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.

[libcxx] [test] Silence MSVC warning C4146.

This test code triggers the MSVC warning:

"unary minus operator applied to unsigned type, result still unsigned"

Although it would be possible to change the test code to avoid
this warning, I have chosen to simply silence it.


https://reviews.llvm.org/D45594

Files:
  
test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp


Index: 
test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp
===
--- 
test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp
+++ 
test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp
@@ -22,6 +22,10 @@
 #include 
 #include "test_iterators.h"
 
+#ifdef _MSC_VER
+#pragma warning(disable: 4146) // unary minus operator applied to unsigned 
type, result still unsigned
+#endif
+
 typedef std::num_get F;
 
 class my_facet


Index: test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp
===
--- test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp
+++ test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp
@@ -22,6 +22,10 @@
 #include 
 #include "test_iterators.h"
 
+#ifdef _MSC_VER
+#pragma warning(disable: 4146) // unary minus operator applied to unsigned type, result still unsigned
+#endif
+
 typedef std::num_get F;
 
 class my_facet
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D45109: Remove -cc1 option "-backend-option"

2018-04-12 Thread Friedman, Eli via cfe-commits
The test wasn't checking anything useful; the clang driver never passes 
"-arm-long-calls" to clang -cc1.  See https://reviews.llvm.org/rL241565 .


-Eli

On 4/12/2018 3:55 PM, George Karpenkov wrote:

Hi Eli,

The commit makes sense, but I’m not sure about your change to the 
`test/Driver/apple-kext-mkernel.c 
` 
file:

instead of changing the run lines to use -mllvm you have removed them.
Was there a reason for the removal?

Regards,
George

On Apr 12, 2018, at 3:25 PM, Eli Friedman via Phabricator via 
llvm-commits > wrote:


This revision was automatically updated to reflect the committed changes.
Closed by commit rL329965: Remove -cc1 option 
-backend-option. (authored by efriedma, committed by ).

Herald added a subscriber: llvm-commits.

Changed prior to commit:
https://reviews.llvm.org/D45109?vs=140484=142277#toc

Repository:
 rL LLVM

https://reviews.llvm.org/D45109

Files:
 cfe/trunk/include/clang/Driver/CC1Options.td
 cfe/trunk/include/clang/Frontend/CodeGenOptions.h
 cfe/trunk/lib/CodeGen/BackendUtil.cpp
 cfe/trunk/lib/Driver/ToolChains/Clang.cpp
 cfe/trunk/lib/Frontend/CompilerInvocation.cpp
 cfe/trunk/test/CodeGen/thinlto-backend-option.ll
 cfe/trunk/test/CodeGenCUDA/link-device-bitcode.cu
 cfe/trunk/test/Driver/aarch64-fix-cortex-a53-835769.c
 cfe/trunk/test/Driver/apple-kext-mkernel.c
 cfe/trunk/test/Driver/arm-restrict-it.c
 cfe/trunk/test/Driver/debug-options.c
 cfe/trunk/test/Driver/mglobal-merge.c
 cfe/trunk/test/Driver/woa-restrict-it.c
 cfe/trunk/test/Frontend/backend-option.c

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




--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux 
Foundation Collaborative Project

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


[PATCH] D45109: Remove -cc1 option "-backend-option"

2018-04-12 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a subscriber: pcc.
efriedma added a comment.

The test wasn't checking anything useful; the clang driver never passes 
"-arm-long-calls" to clang -cc1.  See https://reviews.llvm.org/rL241565 .

-Eli


Repository:
  rL LLVM

https://reviews.llvm.org/D45109



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


[PATCH] D45237: [RISCV] Fix logic to check if frame pointer should be used

2018-04-12 Thread Mandeep Singh Grang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL329941: [RISCV] Fix logic to check if frame pointer should 
be used (authored by mgrang, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D45237?vs=141584=142234#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D45237

Files:
  cfe/trunk/lib/Driver/ToolChains/Clang.cpp
  cfe/trunk/test/Driver/frame-pointer.c


Index: cfe/trunk/test/Driver/frame-pointer.c
===
--- cfe/trunk/test/Driver/frame-pointer.c
+++ cfe/trunk/test/Driver/frame-pointer.c
@@ -45,6 +45,18 @@
 // RUN: %clang -target riscv64-unknown-elf -### -S -O3 %s -o %t.s 2>&1 | 
FileCheck -check-prefix=CHECK3-64 %s
 // RUN: %clang -target riscv64-unknown-elf -### -S -Os %s -o %t.s 2>&1 | 
FileCheck -check-prefix=CHECKs-64 %s
 
+// RUN: %clang -target riscv32-unknown-linux-gnu -### -S -O0 %s -o %t.s 2>&1 | 
FileCheck -check-prefix=CHECK0-32 %s
+// RUN: %clang -target riscv32-unknown-linux-gnu -### -S -O1 %s -o %t.s 2>&1 | 
FileCheck -check-prefix=CHECK1-32 %s
+// RUN: %clang -target riscv32-unknown-linux-gnu -### -S -O2 %s -o %t.s 2>&1 | 
FileCheck -check-prefix=CHECK2-32 %s
+// RUN: %clang -target riscv32-unknown-linux-gnu -### -S -O3 %s -o %t.s 2>&1 | 
FileCheck -check-prefix=CHECK3-32 %s
+// RUN: %clang -target riscv32-unknown-linux-gnu -### -S -Os %s -o %t.s 2>&1 | 
FileCheck -check-prefix=CHECKs-32 %s
+
+// RUN: %clang -target riscv64-unknown-linux-gnu -### -S -O0 %s -o %t.s 2>&1 | 
FileCheck -check-prefix=CHECK0-64 %s
+// RUN: %clang -target riscv64-unknown-linux-gnu -### -S -O1 %s -o %t.s 2>&1 | 
FileCheck -check-prefix=CHECK1-64 %s
+// RUN: %clang -target riscv64-unknown-linux-gnu -### -S -O2 %s -o %t.s 2>&1 | 
FileCheck -check-prefix=CHECK2-64 %s
+// RUN: %clang -target riscv64-unknown-linux-gnu -### -S -O3 %s -o %t.s 2>&1 | 
FileCheck -check-prefix=CHECK3-64 %s
+// RUN: %clang -target riscv64-unknown-linux-gnu -### -S -Os %s -o %t.s 2>&1 | 
FileCheck -check-prefix=CHECKs-64 %s
+
 // CHECK0-32: -mdisable-fp-elim
 // CHECK1-32-NOT: -mdisable-fp-elim
 // CHECK2-32-NOT: -mdisable-fp-elim
Index: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp
@@ -529,6 +529,9 @@
 // XCore never wants frame pointers, regardless of OS.
 // WebAssembly never wants frame pointers.
 return false;
+  case llvm::Triple::riscv32:
+  case llvm::Triple::riscv64:
+return !areOptimizationsEnabled(Args);
   default:
 break;
   }
@@ -552,14 +555,6 @@
 }
   }
 
-  switch (Triple.getArch()) {
-case llvm::Triple::riscv32:
-case llvm::Triple::riscv64:
-  return !areOptimizationsEnabled(Args);
-default:
-  break;
-  }
-
   if (Triple.isOSWindows()) {
 switch (Triple.getArch()) {
 case llvm::Triple::x86:


Index: cfe/trunk/test/Driver/frame-pointer.c
===
--- cfe/trunk/test/Driver/frame-pointer.c
+++ cfe/trunk/test/Driver/frame-pointer.c
@@ -45,6 +45,18 @@
 // RUN: %clang -target riscv64-unknown-elf -### -S -O3 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK3-64 %s
 // RUN: %clang -target riscv64-unknown-elf -### -S -Os %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECKs-64 %s
 
+// RUN: %clang -target riscv32-unknown-linux-gnu -### -S -O0 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK0-32 %s
+// RUN: %clang -target riscv32-unknown-linux-gnu -### -S -O1 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK1-32 %s
+// RUN: %clang -target riscv32-unknown-linux-gnu -### -S -O2 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK2-32 %s
+// RUN: %clang -target riscv32-unknown-linux-gnu -### -S -O3 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK3-32 %s
+// RUN: %clang -target riscv32-unknown-linux-gnu -### -S -Os %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECKs-32 %s
+
+// RUN: %clang -target riscv64-unknown-linux-gnu -### -S -O0 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK0-64 %s
+// RUN: %clang -target riscv64-unknown-linux-gnu -### -S -O1 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK1-64 %s
+// RUN: %clang -target riscv64-unknown-linux-gnu -### -S -O2 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK2-64 %s
+// RUN: %clang -target riscv64-unknown-linux-gnu -### -S -O3 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK3-64 %s
+// RUN: %clang -target riscv64-unknown-linux-gnu -### -S -Os %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECKs-64 %s
+
 // CHECK0-32: -mdisable-fp-elim
 // CHECK1-32-NOT: -mdisable-fp-elim
 // CHECK2-32-NOT: -mdisable-fp-elim
Index: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp
@@ -529,6 +529,9 @@
 // XCore never wants frame pointers, 

[PATCH] D45500: [MinGW] Look for libc++ headers in a triplet prefixed path as well

2018-04-12 Thread Martin Storsjö via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC329946: [MinGW] Look for libc++ headers in a triplet 
prefixed path as well (authored by mstorsjo, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D45500?vs=141894=142243#toc

Repository:
  rC Clang

https://reviews.llvm.org/D45500

Files:
  lib/Driver/ToolChains/MinGW.cpp
  test/Driver/mingw.cpp


Index: test/Driver/mingw.cpp
===
--- test/Driver/mingw.cpp
+++ test/Driver/mingw.cpp
@@ -3,6 +3,10 @@
 // CHECK_MINGW_CLANG_TREE: 
"{{.*}}/Inputs/mingw_clang_tree/mingw32{{/|}}include"
 
 
+// RUN: %clang -target i686-windows-gnu -rtlib=platform -stdlib=libc++ -c -### 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck 
-check-prefix=CHECK_MINGW_CLANG_TREE_LIBCXX %s
+// CHECK_MINGW_CLANG_TREE_LIBCXX: 
"{{.*}}/Inputs/mingw_clang_tree/mingw32{{/|}}i686-w64-mingw32{{/|}}include{{/|}}c++{{/|}}v1"
+
+
 // RUN: %clang -target i686-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ 
-c -### --sysroot=%S/Inputs/mingw_mingw_org_tree/mingw %s 2>&1 | FileCheck 
-check-prefix=CHECK_MINGW_ORG_TREE %s
 // CHECK_MINGW_ORG_TREE: 
"{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include{{/|}}c++"
 // CHECK_MINGW_ORG_TREE: 
"{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include{{/|}}c++{{/|}}mingw32"
Index: lib/Driver/ToolChains/MinGW.cpp
===
--- lib/Driver/ToolChains/MinGW.cpp
+++ lib/Driver/ToolChains/MinGW.cpp
@@ -453,11 +453,14 @@
   DriverArgs.hasArg(options::OPT_nostdincxx))
 return;
 
+  StringRef Slash = llvm::sys::path::get_separator();
+
   switch (GetCXXStdlibType(DriverArgs)) {
   case ToolChain::CST_Libcxx:
+addSystemInclude(DriverArgs, CC1Args, Base + Arch + Slash + "include" +
+  Slash + "c++" + Slash + "v1");
 addSystemInclude(DriverArgs, CC1Args,
- Base + "include" + llvm::sys::path::get_separator() +
- "c++" + llvm::sys::path::get_separator() + "v1");
+ Base + "include" + Slash + "c++" + Slash + "v1");
 break;
 
   case ToolChain::CST_Libstdcxx:
@@ -472,7 +475,7 @@
 llvm::sys::path::append(CppIncludeBases[3], "include", "c++");
 for (auto  : CppIncludeBases) {
   addSystemInclude(DriverArgs, CC1Args, CppIncludeBase);
-  CppIncludeBase += llvm::sys::path::get_separator();
+  CppIncludeBase += Slash;
   addSystemInclude(DriverArgs, CC1Args, CppIncludeBase + Arch);
   addSystemInclude(DriverArgs, CC1Args, CppIncludeBase + "backward");
 }


Index: test/Driver/mingw.cpp
===
--- test/Driver/mingw.cpp
+++ test/Driver/mingw.cpp
@@ -3,6 +3,10 @@
 // CHECK_MINGW_CLANG_TREE: "{{.*}}/Inputs/mingw_clang_tree/mingw32{{/|}}include"
 
 
+// RUN: %clang -target i686-windows-gnu -rtlib=platform -stdlib=libc++ -c -### --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_CLANG_TREE_LIBCXX %s
+// CHECK_MINGW_CLANG_TREE_LIBCXX: "{{.*}}/Inputs/mingw_clang_tree/mingw32{{/|}}i686-w64-mingw32{{/|}}include{{/|}}c++{{/|}}v1"
+
+
 // RUN: %clang -target i686-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ -c -### --sysroot=%S/Inputs/mingw_mingw_org_tree/mingw %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_ORG_TREE %s
 // CHECK_MINGW_ORG_TREE: "{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include{{/|}}c++"
 // CHECK_MINGW_ORG_TREE: "{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include{{/|}}c++{{/|}}mingw32"
Index: lib/Driver/ToolChains/MinGW.cpp
===
--- lib/Driver/ToolChains/MinGW.cpp
+++ lib/Driver/ToolChains/MinGW.cpp
@@ -453,11 +453,14 @@
   DriverArgs.hasArg(options::OPT_nostdincxx))
 return;
 
+  StringRef Slash = llvm::sys::path::get_separator();
+
   switch (GetCXXStdlibType(DriverArgs)) {
   case ToolChain::CST_Libcxx:
+addSystemInclude(DriverArgs, CC1Args, Base + Arch + Slash + "include" +
+  Slash + "c++" + Slash + "v1");
 addSystemInclude(DriverArgs, CC1Args,
- Base + "include" + llvm::sys::path::get_separator() +
- "c++" + llvm::sys::path::get_separator() + "v1");
+ Base + "include" + Slash + "c++" + Slash + "v1");
 break;
 
   case ToolChain::CST_Libstdcxx:
@@ -472,7 +475,7 @@
 llvm::sys::path::append(CppIncludeBases[3], "include", "c++");
 for (auto  : CppIncludeBases) {
   addSystemInclude(DriverArgs, CC1Args, 

[PATCH] D45500: [MinGW] Look for libc++ headers in a triplet prefixed path as well

2018-04-12 Thread Martin Storsjö via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL329946: [MinGW] Look for libc++ headers in a triplet 
prefixed path as well (authored by mstorsjo, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D45500?vs=141894=142244#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D45500

Files:
  cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
  cfe/trunk/test/Driver/mingw.cpp


Index: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
@@ -453,11 +453,14 @@
   DriverArgs.hasArg(options::OPT_nostdincxx))
 return;
 
+  StringRef Slash = llvm::sys::path::get_separator();
+
   switch (GetCXXStdlibType(DriverArgs)) {
   case ToolChain::CST_Libcxx:
+addSystemInclude(DriverArgs, CC1Args, Base + Arch + Slash + "include" +
+  Slash + "c++" + Slash + "v1");
 addSystemInclude(DriverArgs, CC1Args,
- Base + "include" + llvm::sys::path::get_separator() +
- "c++" + llvm::sys::path::get_separator() + "v1");
+ Base + "include" + Slash + "c++" + Slash + "v1");
 break;
 
   case ToolChain::CST_Libstdcxx:
@@ -472,7 +475,7 @@
 llvm::sys::path::append(CppIncludeBases[3], "include", "c++");
 for (auto  : CppIncludeBases) {
   addSystemInclude(DriverArgs, CC1Args, CppIncludeBase);
-  CppIncludeBase += llvm::sys::path::get_separator();
+  CppIncludeBase += Slash;
   addSystemInclude(DriverArgs, CC1Args, CppIncludeBase + Arch);
   addSystemInclude(DriverArgs, CC1Args, CppIncludeBase + "backward");
 }
Index: cfe/trunk/test/Driver/mingw.cpp
===
--- cfe/trunk/test/Driver/mingw.cpp
+++ cfe/trunk/test/Driver/mingw.cpp
@@ -3,6 +3,10 @@
 // CHECK_MINGW_CLANG_TREE: 
"{{.*}}/Inputs/mingw_clang_tree/mingw32{{/|}}include"
 
 
+// RUN: %clang -target i686-windows-gnu -rtlib=platform -stdlib=libc++ -c -### 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck 
-check-prefix=CHECK_MINGW_CLANG_TREE_LIBCXX %s
+// CHECK_MINGW_CLANG_TREE_LIBCXX: 
"{{.*}}/Inputs/mingw_clang_tree/mingw32{{/|}}i686-w64-mingw32{{/|}}include{{/|}}c++{{/|}}v1"
+
+
 // RUN: %clang -target i686-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ 
-c -### --sysroot=%S/Inputs/mingw_mingw_org_tree/mingw %s 2>&1 | FileCheck 
-check-prefix=CHECK_MINGW_ORG_TREE %s
 // CHECK_MINGW_ORG_TREE: 
"{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include{{/|}}c++"
 // CHECK_MINGW_ORG_TREE: 
"{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include{{/|}}c++{{/|}}mingw32"


Index: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
@@ -453,11 +453,14 @@
   DriverArgs.hasArg(options::OPT_nostdincxx))
 return;
 
+  StringRef Slash = llvm::sys::path::get_separator();
+
   switch (GetCXXStdlibType(DriverArgs)) {
   case ToolChain::CST_Libcxx:
+addSystemInclude(DriverArgs, CC1Args, Base + Arch + Slash + "include" +
+  Slash + "c++" + Slash + "v1");
 addSystemInclude(DriverArgs, CC1Args,
- Base + "include" + llvm::sys::path::get_separator() +
- "c++" + llvm::sys::path::get_separator() + "v1");
+ Base + "include" + Slash + "c++" + Slash + "v1");
 break;
 
   case ToolChain::CST_Libstdcxx:
@@ -472,7 +475,7 @@
 llvm::sys::path::append(CppIncludeBases[3], "include", "c++");
 for (auto  : CppIncludeBases) {
   addSystemInclude(DriverArgs, CC1Args, CppIncludeBase);
-  CppIncludeBase += llvm::sys::path::get_separator();
+  CppIncludeBase += Slash;
   addSystemInclude(DriverArgs, CC1Args, CppIncludeBase + Arch);
   addSystemInclude(DriverArgs, CC1Args, CppIncludeBase + "backward");
 }
Index: cfe/trunk/test/Driver/mingw.cpp
===
--- cfe/trunk/test/Driver/mingw.cpp
+++ cfe/trunk/test/Driver/mingw.cpp
@@ -3,6 +3,10 @@
 // CHECK_MINGW_CLANG_TREE: "{{.*}}/Inputs/mingw_clang_tree/mingw32{{/|}}include"
 
 
+// RUN: %clang -target i686-windows-gnu -rtlib=platform -stdlib=libc++ -c -### --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_CLANG_TREE_LIBCXX %s
+// CHECK_MINGW_CLANG_TREE_LIBCXX: "{{.*}}/Inputs/mingw_clang_tree/mingw32{{/|}}i686-w64-mingw32{{/|}}include{{/|}}c++{{/|}}v1"
+
+
 // RUN: %clang -target i686-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ -c -### 

r329946 - [MinGW] Look for libc++ headers in a triplet prefixed path as well

2018-04-12 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Thu Apr 12 13:07:38 2018
New Revision: 329946

URL: http://llvm.org/viewvc/llvm-project?rev=329946=rev
Log:
[MinGW] Look for libc++ headers in a triplet prefixed path as well

This makes it consistent with libstdc++ and the other default
include directories.

If these headers are found in both locations and one isn't a
symlink to the other, this will cause errors due to libc++ headers
having wrapper headers for some standard C headers, wrappers that
do #include_next the actual one.

If the same libc++ standard C wrapper header exists in more than one
include directory before the real system one, the header include
guard will stop it from doing another #include_next to pick up the
real one, breaking things.

As this is a rather uncommon situation, this should be acceptable
and toolchain maintainers can adapt accordingly if necessary.

Also simplify some of the existing code with a local variable.

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

Modified:
cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
cfe/trunk/test/Driver/mingw.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=329946=329945=329946=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Thu Apr 12 13:07:38 2018
@@ -453,11 +453,14 @@ void toolchains::MinGW::AddClangCXXStdli
   DriverArgs.hasArg(options::OPT_nostdincxx))
 return;
 
+  StringRef Slash = llvm::sys::path::get_separator();
+
   switch (GetCXXStdlibType(DriverArgs)) {
   case ToolChain::CST_Libcxx:
+addSystemInclude(DriverArgs, CC1Args, Base + Arch + Slash + "include" +
+  Slash + "c++" + Slash + "v1");
 addSystemInclude(DriverArgs, CC1Args,
- Base + "include" + llvm::sys::path::get_separator() +
- "c++" + llvm::sys::path::get_separator() + "v1");
+ Base + "include" + Slash + "c++" + Slash + "v1");
 break;
 
   case ToolChain::CST_Libstdcxx:
@@ -472,7 +475,7 @@ void toolchains::MinGW::AddClangCXXStdli
 llvm::sys::path::append(CppIncludeBases[3], "include", "c++");
 for (auto  : CppIncludeBases) {
   addSystemInclude(DriverArgs, CC1Args, CppIncludeBase);
-  CppIncludeBase += llvm::sys::path::get_separator();
+  CppIncludeBase += Slash;
   addSystemInclude(DriverArgs, CC1Args, CppIncludeBase + Arch);
   addSystemInclude(DriverArgs, CC1Args, CppIncludeBase + "backward");
 }

Modified: cfe/trunk/test/Driver/mingw.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw.cpp?rev=329946=329945=329946=diff
==
--- cfe/trunk/test/Driver/mingw.cpp (original)
+++ cfe/trunk/test/Driver/mingw.cpp Thu Apr 12 13:07:38 2018
@@ -3,6 +3,10 @@
 // CHECK_MINGW_CLANG_TREE: 
"{{.*}}/Inputs/mingw_clang_tree/mingw32{{/|}}include"
 
 
+// RUN: %clang -target i686-windows-gnu -rtlib=platform -stdlib=libc++ -c -### 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck 
-check-prefix=CHECK_MINGW_CLANG_TREE_LIBCXX %s
+// CHECK_MINGW_CLANG_TREE_LIBCXX: 
"{{.*}}/Inputs/mingw_clang_tree/mingw32{{/|}}i686-w64-mingw32{{/|}}include{{/|}}c++{{/|}}v1"
+
+
 // RUN: %clang -target i686-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ 
-c -### --sysroot=%S/Inputs/mingw_mingw_org_tree/mingw %s 2>&1 | FileCheck 
-check-prefix=CHECK_MINGW_ORG_TREE %s
 // CHECK_MINGW_ORG_TREE: 
"{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include{{/|}}c++"
 // CHECK_MINGW_ORG_TREE: 
"{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include{{/|}}c++{{/|}}mingw32"


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


r329952 - [NFC] Fix terrible formatting of CGRecordLower constructor.

2018-04-12 Thread Erich Keane via cfe-commits
Author: erichkeane
Date: Thu Apr 12 13:46:31 2018
New Revision: 329952

URL: http://llvm.org/viewvc/llvm-project?rev=329952=rev
Log:
[NFC] Fix terrible formatting of CGRecordLower constructor.

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

Modified: cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp?rev=329952=329951=329952=diff
==
--- cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp Thu Apr 12 13:46:31 2018
@@ -214,12 +214,13 @@ private:
 };
 } // namespace {
 
-CGRecordLowering::CGRecordLowering(CodeGenTypes , const RecordDecl *D,   
  bool Packed)
-  : Types(Types), Context(Types.getContext()), D(D),
-RD(dyn_cast(D)),
-Layout(Types.getContext().getASTRecordLayout(D)),
-DataLayout(Types.getDataLayout()), IsZeroInitializable(true),
-IsZeroInitializableAsBase(true), Packed(Packed) {}
+CGRecordLowering::CGRecordLowering(CodeGenTypes , const RecordDecl *D,
+   bool Packed)
+: Types(Types), Context(Types.getContext()), D(D),
+  RD(dyn_cast(D)),
+  Layout(Types.getContext().getASTRecordLayout(D)),
+  DataLayout(Types.getDataLayout()), IsZeroInitializable(true),
+  IsZeroInitializableAsBase(true), Packed(Packed) {}
 
 void CGRecordLowering::setBitFieldInfo(
 const FieldDecl *FD, CharUnits StartOffset, llvm::Type *StorageType) {


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


r329965 - Remove -cc1 option "-backend-option".

2018-04-12 Thread Eli Friedman via cfe-commits
Author: efriedma
Date: Thu Apr 12 15:21:36 2018
New Revision: 329965

URL: http://llvm.org/viewvc/llvm-project?rev=329965=rev
Log:
Remove -cc1 option "-backend-option".

It means the same thing as -mllvm; there isn't any reason to have two
options which do the same thing.

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


Removed:
cfe/trunk/test/Frontend/backend-option.c
Modified:
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Frontend/CodeGenOptions.h
cfe/trunk/lib/CodeGen/BackendUtil.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/CodeGen/thinlto-backend-option.ll
cfe/trunk/test/CodeGenCUDA/link-device-bitcode.cu
cfe/trunk/test/Driver/aarch64-fix-cortex-a53-835769.c
cfe/trunk/test/Driver/apple-kext-mkernel.c
cfe/trunk/test/Driver/arm-restrict-it.c
cfe/trunk/test/Driver/debug-options.c
cfe/trunk/test/Driver/mglobal-merge.c
cfe/trunk/test/Driver/woa-restrict-it.c

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=329965=329964=329965=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Thu Apr 12 15:21:36 2018
@@ -275,8 +275,6 @@ def split_stacks : Flag<["-"], "split-st
   HelpText<"Try to use a split stack if possible.">;
 def mno_zero_initialized_in_bss : Flag<["-"], "mno-zero-initialized-in-bss">,
   HelpText<"Do not put zero initialized data in the BSS">;
-def backend_option : Separate<["-"], "backend-option">,
-  HelpText<"Additional arguments to forward to LLVM backend (during code 
gen)">;
 def mregparm : Separate<["-"], "mregparm">,
   HelpText<"Limit the number of registers available for integer arguments">;
 def munwind_tables : Flag<["-"], "munwind-tables">,

Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.h?rev=329965=329964=329965=diff
==
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.h Thu Apr 12 15:21:36 2018
@@ -177,9 +177,6 @@ public:
   /// function instead of to trap instructions.
   std::string TrapFuncName;
 
-  /// A list of command-line options to forward to the LLVM backend.
-  std::vector BackendOptions;
-
   /// A list of dependent libraries.
   std::vector DependentLibraries;
 

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=329965=329964=329965=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Thu Apr 12 15:21:36 2018
@@ -658,8 +658,6 @@ static void setCommandLineOpts(const Cod
 BackendArgs.push_back("-limit-float-precision");
 BackendArgs.push_back(CodeGenOpts.LimitFloatPrecision.c_str());
   }
-  for (const std::string  : CodeGenOpts.BackendOptions)
-BackendArgs.push_back(BackendOption.c_str());
   BackendArgs.push_back(nullptr);
   llvm::cl::ParseCommandLineOptions(BackendArgs.size() - 1,
 BackendArgs.data());

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=329965=329964=329965=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Thu Apr 12 15:21:36 2018
@@ -1350,7 +1350,7 @@ void Clang::AddARMTargetArgs(const llvm:
   // Forward the -mglobal-merge option for explicit control over the pass.
   if (Arg *A = Args.getLastArg(options::OPT_mglobal_merge,
options::OPT_mno_global_merge)) {
-CmdArgs.push_back("-backend-option");
+CmdArgs.push_back("-mllvm");
 if (A->getOption().matches(options::OPT_mno_global_merge))
   CmdArgs.push_back("-arm-global-merge=false");
 else
@@ -1464,21 +1464,21 @@ void Clang::AddAArch64TargetArgs(const A
 
   if (Arg *A = Args.getLastArg(options::OPT_mfix_cortex_a53_835769,
options::OPT_mno_fix_cortex_a53_835769)) {
-CmdArgs.push_back("-backend-option");
+CmdArgs.push_back("-mllvm");
 if (A->getOption().matches(options::OPT_mfix_cortex_a53_835769))
   CmdArgs.push_back("-aarch64-fix-cortex-a53-835769=1");
 else
   CmdArgs.push_back("-aarch64-fix-cortex-a53-835769=0");
   } else if (Triple.isAndroid()) {
 // Enabled A53 errata (835769) workaround by default on android
-CmdArgs.push_back("-backend-option");
+CmdArgs.push_back("-mllvm");
 

[PATCH] D45476: [C++2a] Implement operator<=> CodeGen and ExprConstant

2018-04-12 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF marked 4 inline comments as done.
EricWF added inline comments.



Comment at: include/clang/AST/Expr.h:3097-3106
+  bool isRelationalOp() const {
+return isRelationalOp(getOpcode()) ||
+   (getOpcode() == BO_Cmp && IsCmpOrdered);
+  }
 
   static bool isEqualityOp(Opcode Opc) { return Opc == BO_EQ || Opc == BO_NE; }
+  bool isEqualityOp() const {

rsmith wrote:
> These seem wrong to me. Relational operators are `<`, `<=`, `>`, and `>=`. 
> `<=>` is not a relational operator even if it's an ordered comparison. 
> Likewise, `<=>` is not an equality operator even if we don't have an ordered 
> comparison.
> 
> If you undo this, you can also drop the `IsCmpOrdered` member entirely.
OK. I'll find another way to do this.

The intention was to facilitate identification of three-way comparisons which 
require equality/relational comparisons, which may or may not be legal in 
certain contexts. For example, comparing member pointers of different bases is 
OK, but only so long as we're evaluating them for strong/weak equality. 


https://reviews.llvm.org/D45476



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


[PATCH] D45068: [NVPTX, CUDA] Added support for m8n32k16 and m32n8k16 variants of wmma instructions.

2018-04-12 Thread Artem Belevich via Phabricator via cfe-commits
tra updated this revision to Diff 142262.
tra added a comment.

Updated BuiltinsNVPTX.def and tests to deal with changes in the way we deal 
with required features in TARGET_BUILTIN.


https://reviews.llvm.org/D45068

Files:
  clang/include/clang/Basic/BuiltinsNVPTX.def
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Driver/ToolChains/Cuda.cpp
  clang/test/CodeGen/builtins-nvptx-sm_70.cu
  llvm/include/llvm/IR/IntrinsicsNVVM.td
  llvm/lib/Target/NVPTX/NVPTX.td
  llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
  llvm/lib/Target/NVPTX/NVPTXInstrInfo.td
  llvm/lib/Target/NVPTX/NVPTXIntrinsics.td
  llvm/test/CodeGen/NVPTX/wmma.py

Index: llvm/test/CodeGen/NVPTX/wmma.py
===
--- llvm/test/CodeGen/NVPTX/wmma.py
+++ llvm/test/CodeGen/NVPTX/wmma.py
@@ -2,7 +2,7 @@
 # generates correct instructions for them.
 
 # RUN: python %s > %t.ll
-# RUN: llc < %t.ll -march=nvptx64 -mcpu=sm_70 -mattr=+ptx60 | FileCheck %t.ll
+# RUN: llc < %t.ll -march=nvptx64 -mcpu=sm_70 -mattr=+ptx61 | FileCheck %t.ll
 
 from itertools import product
 from string import Template
@@ -36,33 +36,36 @@
 check_f16_4 = "{{%s}}" % ", *".join(["%hh[0-9]+"] * 4)
 check_f32_8 = "{{%s}}" % ", *".join(["%f[0-9]+"] * 8)
 
+known_geoms = ["m16n16k16", "m8n32k16", "m32n8k16"]
+
 def gen_wmma_load_tests():
   load_template = """
 declare ${ret_ty} @${intrinsic}(i8 ${as}* %src ${extra_args});
 
 ; CHECK-LABEL: .func {{.*}}test_${function}(
 define ${ret_ty} @test_${function}(i8 ${as}* %src ${extra_args}) {
-; CHECK ${instruction}
+; CHECK: ${instruction}
 ; CHECK: {${check_result}}
 ; CHECK: [%rd{{[0-9]+}}]${stride_pattern}
   %v0 = call ${ret_ty} @${intrinsic}(i8 ${as}* %src ${extra_args});
   ret ${ret_ty} %v0;
 }
 
 ; CHECK-LABEL: .func{{.*}}test_${function}_o(
 define ${ret_ty} @test_${function}_o(i8 ${as}* %src ${extra_args}) {
-; CHECK ${instruction}
+; CHECK: ${instruction}
 ; CHECK: {${check_result}}
 ; CHECK: [%rd{{[0-9]+}}+128]${stride_pattern}
   %src1 = getelementptr i8, i8 ${as}* %src, i32 128;
   %v0 = call ${ret_ty} @${intrinsic}(i8 ${as}* %src1 ${extra_args});
   ret ${ret_ty} %v0;
 }
 """
   intrinsic_template = "llvm.nvvm.wmma.${geom}.load.${abc}.${layout}${stride}.${itype}.${pspace}"
-  instruction_template = "wmma.load.${abc}.sync.${geom}.${layout}${space}.${itype}"
+  instruction_template = "wmma.load.${abc}.sync.${layout}.${geom}${space}.${itype}"
 
-  for abc, layout, space, stride, itype in product(
+  for geom, abc, layout, space, stride, itype in product(
+  known_geoms,
   "abc",
   ["row","col"],
   ["",".shared",".global"],
@@ -77,7 +80,7 @@
 "itype" : itype,
 "pspace" : get_pspace(space),
 "as" : "addrspace(%d)" % get_aspace(space),
-"geom"   : "m16n16k16",
+"geom"   : geom,
 }
 
 if itype == "f32" and abc != "c":
@@ -112,27 +115,28 @@
 
 ; CHECK-LABEL: .func {{.*}}test_${function}(
 define void @test_${function}(i8 ${as}* %src, ${args}${extra_args}) {
-; CHECK ${instruction} {{.*}}[%rd{{[0-9+]}}
+; CHECK: ${instruction} {{.*}}[%rd{{[0-9+]}}
 ; CHECK: {${check_args}}
 ; CHECK: ${stride_pattern}
   call void @${intrinsic}(i8 ${as}* %src, ${args} ${extra_args});
   ret void
 }
 
 ; CHECK-LABEL: .func{{.*}}test_${function}_o(
 define void @test_${function}_o(i8 ${as}* %src, ${args}${extra_args}) {
-; CHECK ${instruction} {{.*}}[%rd{{[0-9+]}}+128]
+; CHECK: ${instruction} {{.*}}[%rd{{[0-9+]}}+128]
 ; CHECK: ${check_args}
 ; CHECK: ${stride_pattern}
   %src1 = getelementptr i8, i8 ${as}* %src, i32 128;
   call void @${intrinsic}(i8 ${as}* %src1, ${args}${extra_args});
   ret void
 }
 """
   intrinsic_template = "llvm.nvvm.wmma.${geom}.store.${abc}.${layout}${stride}.${itype}.${pspace}"
-  instruction_template = "wmma.store.${abc}.sync.${geom}.${layout}${space}.${itype}"
+  instruction_template = "wmma.store.${abc}.sync.${layout}.${geom}${space}.${itype}"
 
-  for abc, layout, space, stride, itype in product(
+  for geom, abc, layout, space, stride, itype in product(
+  known_geoms,
   "d",
   ["row","col"],
   ["",".shared",".global"],
@@ -147,7 +151,7 @@
 "itype" : itype,
 "pspace" : get_pspace(space),
 "as" : "addrspace(%d)" % get_aspace(space),
-"geom"   : "m16n16k16",
+"geom"   : geom,
 }
 
 test_params = params
@@ -174,20 +178,21 @@
 ; CHECK-LABEL: .func {{.*}}test_${function}(
 define ${ret_ty} @test_${function}(
 ${args}) {
-; CHECK ${instruction} {{.*}}[%rd{{[0-9+]}}
-; CHECK ${check_d}
-; CHECK ${check_ab}
-; CHECK ${check_ab}
-; CHECK ${check_c}
+; CHECK: ${instruction}
+; CHECK-NEXT: ${check_d}
+; CHECK-NEXT: ${check_ab}
+; CHECK-NEXT: ${check_ab}
+; CHECK-NEXT: ${check_c}
   %r = call ${ret_ty} @${intrinsic}(
 ${args});
   ret ${ret_ty} %r;
 }
 """
   intrinsic_template = "llvm.nvvm.wmma.${geom}.mma.${alayout}.${blayout}.${dtype}.${ctype}${satf}"
   instruction_template = 

[PATCH] D45217: [ThinLTO] Pass -save-temps to LTO backend for distributed ThinLTO builds

2018-04-12 Thread Peter Collingbourne via Phabricator via cfe-commits
pcc added inline comments.



Comment at: include/clang/Driver/Options.td:2255
   HelpText<"Save intermediate compilation results.">;
-def save_temps : Flag<["-", "--"], "save-temps">, Flags<[DriverOption]>,
+def save_temps : Flag<["-", "--"], "save-temps">, Flags<[CC1Option, 
DriverOption]>,
   Alias, AliasArgs<["cwd"]>,

This is still just a DriverOption, right?



Comment at: lib/Frontend/CompilerInvocation.cpp:747
+.Case("obj", FrontendOpts.OutputFile)
+.Default("./" +
+ llvm::sys::path::filename(FrontendOpts.OutputFile).str());

Why do you need the `"./"` part?



Comment at: test/CodeGen/thinlto_backend.ll:30
 ; Ensure f2 was imported
-; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t3.o -x ir %t1.o -c 
-fthinlto-index=%t.thinlto.bc
+; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t3.o -x ir %t1.o -c 
-fthinlto-index=%t.thinlto.bc -save-temps=obj
 ; RUN: llvm-nm %t3.o | FileCheck --check-prefix=CHECK-OBJ %s

Should there be another test for `-save-temps=cwd`?


Repository:
  rC Clang

https://reviews.llvm.org/D45217



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


[PATCH] D45284: [RISCV] More validations on the input value of -march=

2018-04-12 Thread Ana Pazos via Phabricator via cfe-commits
apazos updated this revision to Diff 142279.
apazos added a comment.

Updated error messages and fixed getExtensionVersion


https://reviews.llvm.org/D45284

Files:
  include/clang/Basic/DiagnosticDriverKinds.td
  lib/Driver/ToolChains/Arch/RISCV.cpp
  test/Driver/riscv-arch.c

Index: test/Driver/riscv-arch.c
===
--- test/Driver/riscv-arch.c
+++ test/Driver/riscv-arch.c
@@ -1,89 +1,245 @@
-// RUN: %clang -target riscv32-unknown-elf -march=rv32i -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv32-unknown-elf -march=rv32im -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv32-unknown-elf -march=rv32ima -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv32-unknown-elf -march=rv32imaf -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv32-unknown-elf -march=rv32imafd -### %s -fsyntax-only 2>&1 | FileCheck %s
-
-// RUN: %clang -target riscv32-unknown-elf -march=rv32ic -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv32-unknown-elf -march=rv32imc -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv32-unknown-elf -march=rv32imac -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv32-unknown-elf -march=rv32imafc -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv32-unknown-elf -march=rv32imafdc -### %s -fsyntax-only 2>&1 | FileCheck %s
-
-// RUN: %clang -target riscv32-unknown-elf -march=rv32ia -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv32-unknown-elf -march=rv32iaf -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv32-unknown-elf -march=rv32iafd -### %s -fsyntax-only 2>&1 | FileCheck %s
-
-// RUN: %clang -target riscv32-unknown-elf -march=rv32iac -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv32-unknown-elf -march=rv32iafc -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv32-unknown-elf -march=rv32iafdc -### %s -fsyntax-only 2>&1 | FileCheck %s
-
-// RUN: %clang -target riscv32-unknown-elf -march=rv32g -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv32-unknown-elf -march=rv32gc -### %s -fsyntax-only 2>&1 | FileCheck %s
-
-// RUN: %clang -target riscv64-unknown-elf -march=rv64i -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv64-unknown-elf -march=rv64im -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv64-unknown-elf -march=rv64ima -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv64-unknown-elf -march=rv64imaf -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv64-unknown-elf -march=rv64imafd -### %s -fsyntax-only 2>&1 | FileCheck %s
-
-// RUN: %clang -target riscv64-unknown-elf -march=rv64ic -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv64-unknown-elf -march=rv64imc -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv64-unknown-elf -march=rv64imac -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv64-unknown-elf -march=rv64imafc -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv64-unknown-elf -march=rv64imafdc -### %s -fsyntax-only 2>&1 | FileCheck %s
-
-// RUN: %clang -target riscv64-unknown-elf -march=rv64ia -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv64-unknown-elf -march=rv64iaf -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv64-unknown-elf -march=rv64iafd -### %s -fsyntax-only 2>&1 | FileCheck %s
-
-// RUN: %clang -target riscv64-unknown-elf -march=rv64iac -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv64-unknown-elf -march=rv64iafc -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv64-unknown-elf -march=rv64iafdc -### %s -fsyntax-only 2>&1 | FileCheck %s
-
-// RUN: %clang -target riscv64-unknown-elf -march=rv64g -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv64-unknown-elf -march=rv64gc -### %s -fsyntax-only 2>&1 | FileCheck %s
+// RUN: %clang -target riscv32-unknown-elf -march=rv32i -### %s \
+// RUN: -fsyntax-only 2>&1 | FileCheck %s
+// RUN: %clang -target riscv32-unknown-elf -march=rv32im -### %s \
+// RUN: -fsyntax-only 2>&1 | FileCheck %s
+// RUN: %clang -target riscv32-unknown-elf -march=rv32ima -### %s \
+// RUN: -fsyntax-only 2>&1 | FileCheck %s
+// RUN: %clang -target riscv32-unknown-elf -march=rv32imaf -### %s \
+// RUN: -fsyntax-only 2>&1 | FileCheck %s
+// RUN: %clang -target riscv32-unknown-elf -march=rv32imafd -### %s \
+// RUN: -fsyntax-only 2>&1 | FileCheck %s
+
+// RUN: %clang -target riscv32-unknown-elf -march=rv32ic -### %s \
+// RUN: -fsyntax-only 2>&1 | FileCheck %s
+// RUN: %clang -target riscv32-unknown-elf -march=rv32imc -### %s \
+// RUN: -fsyntax-only 2>&1 | FileCheck %s
+// RUN: %clang -target riscv32-unknown-elf -march=rv32imac -### %s \
+// RUN: -fsyntax-only 

[PATCH] D45596: [libcxx] [test] Avoid unary_function.

2018-04-12 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

I think this would have been a good candidate for post-commit review.


https://reviews.llvm.org/D45596



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


[PATCH] D45595: [libcxx] [test] Fix nodiscard warnings.

2018-04-12 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

There's a macro for this in test_macros.h to make it easier to search for. 
please use that


https://reviews.llvm.org/D45595



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


r329968 - Fix test failure caused by r329965.

2018-04-12 Thread Eli Friedman via cfe-commits
Author: efriedma
Date: Thu Apr 12 15:50:50 2018
New Revision: 329968

URL: http://llvm.org/viewvc/llvm-project?rev=329968=rev
Log:
Fix test failure caused by r329965.

"-mllvm" options get parsed slightly earlier, and -arm-restrict-it is
only available if the ARM target is compiled in. Invoke "clang -cc1"
directly to avoid the issue.


Modified:
cfe/trunk/test/Preprocessor/init.c

Modified: cfe/trunk/test/Preprocessor/init.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=329968=329967=329968=diff
==
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Thu Apr 12 15:50:50 2018
@@ -2652,7 +2652,7 @@
 // Thumbebv7: #define __THUMB_INTERWORK__ 1
 // Thumbebv7: #define __thumb2__ 1
 
-// RUN: %clang -E -dM -ffreestanding -target thumbv7-pc-mingw32 %s -o - | 
FileCheck -match-full-lines -check-prefix THUMB-MINGW %s
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=thumbv7-pc-windows-gnu 
-fdwarf-exceptions %s -o - | FileCheck -match-full-lines -check-prefix 
THUMB-MINGW %s
 
 // THUMB-MINGW:#define __ARM_DWARF_EH__ 1
 


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


[PATCH] D45603: Fix evaluation of `__has_include_next` during -frewrite-includes.

2018-04-12 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai created this revision.
vsapsai added a reviewer: bkramer.
Herald added a subscriber: jkorous-apple.

`__has_include_next` requires correct DirectoryLookup for being
evaluated correctly. We were using Preprocessor::GetCurDirLookup() but
we were calling it after the preprocessor finished its work. And in this
case CurDirLookup is always nullptr which makes `__has_include_next`
behave as `__has_include`.

Fix by storing and using CurDirLookup when preprocessor enters a file,
not when we rewrite the includes.

rdar://problem/36305026


https://reviews.llvm.org/D45603

Files:
  clang/lib/Frontend/Rewrite/InclusionRewriter.cpp
  clang/test/Frontend/Inputs/NextIncludes/rewrite-includes9.h
  clang/test/Frontend/Inputs/rewrite-includes9.h
  clang/test/Frontend/rewrite-includes.c

Index: clang/test/Frontend/rewrite-includes.c
===
--- clang/test/Frontend/rewrite-includes.c
+++ clang/test/Frontend/rewrite-includes.c
@@ -1,5 +1,5 @@
-// RUN: not %clang_cc1 -verify -E -frewrite-includes -DFIRST -I %S/Inputs %s -o - | FileCheck -strict-whitespace %s
-// RUN: not %clang_cc1 -verify -E -frewrite-includes -P -DFIRST -I %S/Inputs %s -o - | FileCheck -check-prefix=CHECKNL -strict-whitespace %s
+// RUN: not %clang_cc1 -verify -E -frewrite-includes -DFIRST -I %S/Inputs -I %S/Inputs/NextIncludes %s -o - | FileCheck -strict-whitespace %s
+// RUN: not %clang_cc1 -verify -E -frewrite-includes -P -DFIRST -I %S/Inputs -I %S/Inputs/NextIncludes %s -o - | FileCheck -check-prefix=CHECKNL -strict-whitespace %s
 // STARTCOMPARE
 #define A(a,b) a ## b
 A(1,2)
@@ -20,6 +20,7 @@
 #include "rewrite-includes7.h"
 #include "rewrite-includes7.h"
 #include "rewrite-includes8.h"
+#include "rewrite-includes9.h"
 // ENDCOMPARE
 // CHECK: {{^}}# 1 "{{.*}}rewrite-includes.c"{{$}}
 // CHECK: {{^}}// STARTCOMPARE{{$}}
@@ -109,15 +110,31 @@
 // CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}}
 // CHECK-NEXT: {{^}}# 22 "{{.*}}rewrite-includes.c"{{$}}
 // CHECK-NEXT: {{^}}# 1 "{{.*[/\\]Inputs(/|)}}rewrite-includes8.h" 1{{$}}
-// CHECK-NEXT: {{^}}#if (1)/*__has_include_next()*/{{$}}
+// CHECK-NEXT: {{^}}#if (0)/*__has_include_next()*/{{$}}
 // CHECK-NEXT: {{^}}#elif (0)/*__has_include()*/{{$}}
 // CHECK-NEXT: {{^}}# 3 "{{.*[/\\]Inputs(/|)}}rewrite-includes8.h"{{$}}
 // CHECK-NEXT: {{^}}#endif{{$}}
 // CHECK-NEXT: {{^}}# 4 "{{.*[/\\]Inputs(/|)}}rewrite-includes8.h"{{$}}
 // CHECK-NEXT: {{^}}#if !(1)/*__has_include("rewrite-includes8.h")*/{{$}}
 // CHECK-NEXT: {{^}}#endif{{$}}
 // CHECK-NEXT: {{^}}# 6 "{{.*[/\\]Inputs(/|)}}rewrite-includes8.h"{{$}}
 // CHECK-NEXT: {{^}}# 23 "{{.*}}rewrite-includes.c" 2{{$}}
+// CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}}
+// CHECK-NEXT: {{^}}#include "rewrite-includes9.h"{{$}}
+// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}}
+// CHECK-NEXT: {{^}}# 23 "{{.*}}rewrite-includes.c"{{$}}
+// CHECK-NEXT: {{^}}# 1 "{{.*[/\\]Inputs(/|)}}rewrite-includes9.h" 1{{$}}
+// CHECK-NEXT: {{^}}#if (1)/*__has_include_next()*/{{$}}
+// CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}}
+// CHECK-NEXT: {{^}}#include_next {{$}}
+// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}}
+// CHECK-NEXT: {{^}}# 2 "{{.*[/\\]Inputs(/|)}}rewrite-includes9.h"{{$}}
+// CHECK-NEXT: {{^}}# 1 "{{.*[/\\]Inputs(/|)NextIncludes(/|)}}rewrite-includes9.h" 1{{$}}
+// CHECK-NEXT: {{^}}included_line9{{$}}
+// CHECK-NEXT: {{^}}# 3 "{{.*[/\\]Inputs(/|)}}rewrite-includes9.h" 2{{$}}
+// CHECK-NEXT: {{^}}#endif{{$}}
+// CHECK-NEXT: {{^}}# 4 "{{.*[/\\]Inputs(/|)}}rewrite-includes9.h"{{$}}
+// CHECK-NEXT: {{^}}# 24 "{{.*}}rewrite-includes.c" 2{{$}}
 // CHECK-NEXT: {{^}}// ENDCOMPARE{{$}}
 
 // CHECKNL: {{^}}// STARTCOMPARE{{$}}
@@ -176,9 +193,18 @@
 // CHECKNL-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}}
 // CHECKNL-NEXT: {{^}}#include "rewrite-includes8.h"{{$}}
 // CHECKNL-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}}
-// CHECKNL-NEXT: {{^}}#if (1)/*__has_include_next()*/{{$}}
+// CHECKNL-NEXT: {{^}}#if (0)/*__has_include_next()*/{{$}}
 // CHECKNL-NEXT: {{^}}#elif (0)/*__has_include()*/{{$}}
 // CHECKNL-NEXT: {{^}}#endif{{$}}
 // CHECKNL-NEXT: {{^}}#if !(1)/*__has_include("rewrite-includes8.h")*/{{$}}
 // CHECKNL-NEXT: {{^}}#endif{{$}}
+// CHECKNL-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}}
+// CHECKNL-NEXT: {{^}}#include "rewrite-includes9.h"{{$}}
+// CHECKNL-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}}
+// CHECKNL-NEXT: {{^}}#if (1)/*__has_include_next()*/{{$}}
+// CHECKNL-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}}
+// CHECKNL-NEXT: {{^}}#include_next {{$}}
+// CHECKNL-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}}
+// CHECKNL-NEXT: {{^}}included_line9{{$}}
+// CHECKNL-NEXT: {{^}}#endif{{$}}
 // CHECKNL-NEXT: {{^}}// ENDCOMPARE{{$}}
Index: clang/test/Frontend/Inputs/rewrite-includes9.h

[PATCH] D45595: [libcxx] [test] Fix nodiscard warnings.

2018-04-12 Thread Stephan T. Lavavej via Phabricator via cfe-commits
STL_MSFT closed this revision.
STL_MSFT added a comment.

Committed with a follow-up to use the requested macro.


https://reviews.llvm.org/D45595



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


Buildbot numbers for the week of 3/25/2018 - 3/31/2018

2018-04-12 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the week of 3/25/2018 - 3/31/2018.

Please see the same data in attached csv files:

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

Thanks

Galina


The longest time each builder was red during the week:
  buildername  | was_red
---+-
 clang-bpf-build   | 58:52:44
 lldb-x86_64-ubuntu-14.04-android  | 46:16:11
 clang-s390x-linux-multistage  | 36:26:08
 clang-s390x-linux | 31:59:12
 clang-s390x-linux-lnt | 31:32:08
 llvm-clang-x86_64-expensive-checks-win| 31:22:22
 clang-cmake-thumbv7-full-sh   | 30:07:23
 lldb-windows7-android | 28:50:17
 clang-x86-windows-msvc2015| 27:17:37
 clang-x64-ninja-win7  | 26:56:16
 sanitizer-x86_64-linux-fast   | 26:31:05
 sanitizer-x86_64-linux-bootstrap  | 24:57:59
 clang-cmake-armv8-selfhost-neon   | 18:23:36
 clang-cmake-armv7-selfhost| 16:41:52
 clang-cmake-armv7-selfhost-neon   | 16:39:51
 clang-cuda-build  | 14:20:08
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast  | 13:36:22
 clang-cmake-armv7-quick   | 12:40:34
 clang-cmake-armv7-global-isel | 12:38:44
 clang-cmake-armv8-full| 12:23:01
 clang-cmake-armv8-quick   | 12:22:21
 clang-cmake-armv7-full| 11:34:32
 sanitizer-x86_64-linux-bootstrap-msan | 10:20:35
 sanitizer-ppc64le-linux   | 08:45:45
 clang-ppc64be-linux-multistage| 08:44:30
 clang-ppc64be-linux   | 08:26:23
 clang-cmake-aarch64-lld   | 08:17:21
 clang-ppc64le-linux   | 08:10:50
 clang-ppc64le-linux-multistage| 07:55:05
 sanitizer-ppc64be-linux   | 07:37:26
 sanitizer-x86_64-linux-android| 03:44:00
 polly-amd64-linux | 03:31:10
 reverse-iteration | 02:55:03
 clang-with-lto-ubuntu | 02:44:38
 sanitizer-x86_64-linux-fuzzer | 02:40:48
 perf-x86_64-penryn-O3-polly-parallel-fast | 02:38:38
 polly-arm-linux   | 02:32:48
 clang-with-thin-lto-ubuntu| 02:08:06
 lldb-x86_64-darwin-13.4   | 01:57:51
 clang-atom-d525-fedora-rel| 01:54:43
 libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11  | 01:46:47
 sanitizer-x86_64-linux-bootstrap-ubsan| 01:37:50
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx11| 01:37:12
 clang-hexagon-elf | 01:29:13
 libcxx-libcxxabi-x86_64-linux-ubuntu-asan | 01:20:48
 sanitizer-windows | 01:20:11
 libcxx-libcxxabi-x86_64-linux-ubuntu-msan | 01:18:32
 clang-cmake-aarch64-full  | 01:17:06
 lld-perf-testsuite| 01:05:05
 sanitizer-x86_64-linux| 00:56:13
 clang-cmake-x86_64-avx2-linux | 00:49:53
 lldb-x86-windows-msvc2015 | 00:49:35
 clang-cmake-aarch64-quick | 00:46:39
 lldb-x86_64-ubuntu-14.04-buildserver  | 00:46:32
 clang-cmake-aarch64-global-isel   | 00:46:11
 lldb-x86_64-ubuntu-14.04-cmake| 00:32:19
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast| 00:30:16
 clang-cmake-x86_64-sde-avx512-linux   | 00:29:41
 libcxx-libcxxabi-libunwind-armv7-linux| 00:27:59
 lld-x86_64-win7   | 00:23:39
 llvm-hexagon-elf  | 00:21:46
 lld-x86_64-freebsd| 00:19:39
 lld-x86_64-darwin13   | 00:19:14
 libcxx-libcxxabi-libunwind-aarch64-linux-noexceptions | 00:15:08
 

[PATCH] D45476: [C++2a] Implement operator<=> CodeGen and ExprConstant

2018-04-12 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF marked 7 inline comments as done.
EricWF added inline comments.



Comment at: lib/AST/ExprConstant.cpp:6238-6263
+bool VisitBinCmp(const BinaryOperator *E) {
+  using CCR = ComparisonCategoryResult;
+  const ComparisonCategoryInfo  =
+  Info.Ctx.CompCategories.getInfoForType(E->getType());
+
+  // Build a new version of the binary operator which returns an integer
+  // representing the ComparisonCategoryResult. Then defer to

rsmith wrote:
> I don't like this approach (inventing an expression that is invalid so that 
> we can call into some other code to compute this result). If this is really 
> materially better than implementing `<=>` directly here, this should be 
> justified by comments here. But I would suspect that factoring out the common 
> code for dealing with the various kinds of comparison from `IntExprEvaluator` 
> and calling it from both here and there would lead to an overall better 
> design.
Ack.

I tried to split the code out, but it wasn't easy and the result wasn't pretty. 
I'll go ahead and give this another go.
The problems I ran into were:
* de-duplicating error checking and argument evaluation across comparison and 
non-comparison operations.
* three-way and non-three-way comparison operations still return a 
fundamentally different type, so reporting the results still requires either 
representing Cmp results as an integer, or having different mechanism to report 
the result.

Any advice or input you have would be appreciated.


https://reviews.llvm.org/D45476



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


[PATCH] D45610: [XRay][clang] Make -fxray-modes= additive

2018-04-12 Thread Dean Michael Berris via Phabricator via cfe-commits
dberris created this revision.
dberris added reviewers: eizan, kpw, pelikan.

This allows us to do the following:

  clang -fxray-modes=none ... -fxray-modes=xray-basic

It's important to be able to do this in cases where we'd like to
specialise the configuration for the invocation of the compiler, in
various scripting environments.

This is related to llvm.org/PR37066, a follow-up to 
https://reviews.llvm.org/D45474.


https://reviews.llvm.org/D45610

Files:
  clang/lib/Driver/XRayArgs.cpp
  clang/test/Driver/XRay/xray-mode-flags.cpp


Index: clang/test/Driver/XRay/xray-mode-flags.cpp
===
--- clang/test/Driver/XRay/xray-mode-flags.cpp
+++ clang/test/Driver/XRay/xray-mode-flags.cpp
@@ -14,6 +14,18 @@
 // RUN: 2>&1 | FileCheck --check-prefixes FDR,BASIC %s
 // RUN: %clang -v -o /dev/null -fxray-instrument -fxray-modes=none -### %s \
 // RUN: 2>&1 | FileCheck --check-prefixes NONE %s
+//
+// We also should support overriding the modes in an additive manner.
+//
+// RUN: %clang -v -o /dev/null -fxray-instrument -fxray-modes=none,xray-fdr \
+// RUN: -### %s \
+// RUN: 2>&1 | FileCheck --check-prefixes FDR %s
+// RUN: %clang -v -o /dev/null -fxray-instrument -fxray-modes=xray-fdr,none \
+// RUN: -### %s \
+// RUN: 2>&1 | FileCheck --check-prefixes NONE %s
+// RUN: %clang -v -o /dev/null -fxray-instrument -fxray-modes=none,all \
+// RUN: -### %s \
+// RUN: 2>&1 | FileCheck --check-prefixes FDR,BASIC %s
 
 // BASIC: libclang_rt.xray-basic
 // FDR: libclang_rt.xray-fdr
Index: clang/lib/Driver/XRayArgs.cpp
===
--- clang/lib/Driver/XRayArgs.cpp
+++ clang/lib/Driver/XRayArgs.cpp
@@ -146,21 +146,16 @@
   llvm::copy(XRaySupportedModes, std::back_inserter(Modes));
 else
   for (const auto  : SpecifiedModes) {
-if (Arg == "none") {
-  Modes.clear();
-  break;
-}
-if (Arg == "all") {
-  Modes.clear();
-  llvm::copy(XRaySupportedModes, std::back_inserter(Modes));
-  break;
-}
-
 // Parse CSV values for -fxray-modes=...
 llvm::SmallVector ModeParts;
 llvm::SplitString(Arg, ModeParts, ",");
 for (const auto  : ModeParts)
-  Modes.push_back(M);
+  if (M == "none")
+Modes.clear();
+  else if (M == "all")
+llvm::copy(XRaySupportedModes, std::back_inserter(Modes));
+  else
+Modes.push_back(M);
   }
 
 // Then we want to sort and unique the modes we've collected.
@@ -205,4 +200,10 @@
 ExtraDepOpt += Dep;
 CmdArgs.push_back(Args.MakeArgString(ExtraDepOpt));
   }
+
+  for (const auto  : Modes) {
+SmallString<64> ModeOpt("-fxray-modes=");
+ModeOpt += Mode;
+CmdArgs.push_back(Args.MakeArgString(ModeOpt));
+  }
 }


Index: clang/test/Driver/XRay/xray-mode-flags.cpp
===
--- clang/test/Driver/XRay/xray-mode-flags.cpp
+++ clang/test/Driver/XRay/xray-mode-flags.cpp
@@ -14,6 +14,18 @@
 // RUN: 2>&1 | FileCheck --check-prefixes FDR,BASIC %s
 // RUN: %clang -v -o /dev/null -fxray-instrument -fxray-modes=none -### %s \
 // RUN: 2>&1 | FileCheck --check-prefixes NONE %s
+//
+// We also should support overriding the modes in an additive manner.
+//
+// RUN: %clang -v -o /dev/null -fxray-instrument -fxray-modes=none,xray-fdr \
+// RUN: -### %s \
+// RUN: 2>&1 | FileCheck --check-prefixes FDR %s
+// RUN: %clang -v -o /dev/null -fxray-instrument -fxray-modes=xray-fdr,none \
+// RUN: -### %s \
+// RUN: 2>&1 | FileCheck --check-prefixes NONE %s
+// RUN: %clang -v -o /dev/null -fxray-instrument -fxray-modes=none,all \
+// RUN: -### %s \
+// RUN: 2>&1 | FileCheck --check-prefixes FDR,BASIC %s
 
 // BASIC: libclang_rt.xray-basic
 // FDR: libclang_rt.xray-fdr
Index: clang/lib/Driver/XRayArgs.cpp
===
--- clang/lib/Driver/XRayArgs.cpp
+++ clang/lib/Driver/XRayArgs.cpp
@@ -146,21 +146,16 @@
   llvm::copy(XRaySupportedModes, std::back_inserter(Modes));
 else
   for (const auto  : SpecifiedModes) {
-if (Arg == "none") {
-  Modes.clear();
-  break;
-}
-if (Arg == "all") {
-  Modes.clear();
-  llvm::copy(XRaySupportedModes, std::back_inserter(Modes));
-  break;
-}
-
 // Parse CSV values for -fxray-modes=...
 llvm::SmallVector ModeParts;
 llvm::SplitString(Arg, ModeParts, ",");
 for (const auto  : ModeParts)
-  Modes.push_back(M);
+  if (M == "none")
+Modes.clear();
+  else if (M == "all")
+llvm::copy(XRaySupportedModes, std::back_inserter(Modes));
+  else
+Modes.push_back(M);
   }
 
 // Then we want to sort and unique the 

[PATCH] D45511: [CMake][Fuchsia] Don't specify libc++ ABI version for Fuchsia

2018-04-12 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL329984: [CMake][Fuchsia] Dont specify libc++ ABI 
version for Fuchsia (authored by phosek, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D45511?vs=141949=142314#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D45511

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


Index: cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
===
--- cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
+++ cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
@@ -73,7 +73,6 @@
   set(RUNTIMES_${target}-fuchsia_LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
   set(RUNTIMES_${target}-fuchsia_LIBCXXABI_ENABLE_STATIC OFF CACHE BOOL "")
   set(RUNTIMES_${target}-fuchsia_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
-  set(RUNTIMES_${target}-fuchsia_LIBCXX_ABI_VERSION 2 CACHE STRING "")
   set(RUNTIMES_${target}-fuchsia_LIBCXX_ENABLE_STATIC OFF CACHE BOOL "")
   set(RUNTIMES_${target}-fuchsia_SANITIZER_USE_COMPILER_RT ON CACHE BOOL "")
 


Index: cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
===
--- cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
+++ cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
@@ -73,7 +73,6 @@
   set(RUNTIMES_${target}-fuchsia_LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
   set(RUNTIMES_${target}-fuchsia_LIBCXXABI_ENABLE_STATIC OFF CACHE BOOL "")
   set(RUNTIMES_${target}-fuchsia_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
-  set(RUNTIMES_${target}-fuchsia_LIBCXX_ABI_VERSION 2 CACHE STRING "")
   set(RUNTIMES_${target}-fuchsia_LIBCXX_ENABLE_STATIC OFF CACHE BOOL "")
   set(RUNTIMES_${target}-fuchsia_SANITIZER_USE_COMPILER_RT ON CACHE BOOL "")
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45603: Fix evaluation of `__has_include_next` during -frewrite-includes.

2018-04-12 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai added a comment.

To simplify reviewing additions to the test, here is the corresponding output

  # 23 
"/Users/vsapsai/Projects/llvm/llvm-project/clang/test/Frontend/rewrite-includes.c"
 2
  #if 0 /* expanded by -frewrite-includes */
  #include "rewrite-includes9.h"
  #endif /* expanded by -frewrite-includes */
  # 23 
"/Users/vsapsai/Projects/llvm/llvm-project/clang/test/Frontend/rewrite-includes.c"
  # 1 
"/Users/vsapsai/Projects/llvm/llvm-project/clang/test/Frontend/Inputs/rewrite-includes9.h"
 1
  #if (1)/*__has_include_next()*/
  #if 0 /* expanded by -frewrite-includes */
  #include_next 
  #endif /* expanded by -frewrite-includes */
  # 2 
"/Users/vsapsai/Projects/llvm/llvm-project/clang/test/Frontend/Inputs/rewrite-includes9.h"
  # 1 
"/Users/vsapsai/Projects/llvm/llvm-project/clang/test/Frontend/Inputs/NextIncludes/rewrite-includes9.h"
 1
  included_line9
  # 3 
"/Users/vsapsai/Projects/llvm/llvm-project/clang/test/Frontend/Inputs/rewrite-includes9.h"
 2
  #endif
  # 4 
"/Users/vsapsai/Projects/llvm/llvm-project/clang/test/Frontend/Inputs/rewrite-includes9.h"
  # 24 
"/Users/vsapsai/Projects/llvm/llvm-project/clang/test/Frontend/rewrite-includes.c"
 2



  #if 0 /* expanded by -frewrite-includes */
  #include "rewrite-includes9.h"
  #endif /* expanded by -frewrite-includes */
  #if (1)/*__has_include_next()*/
  #if 0 /* expanded by -frewrite-includes */
  #include_next 
  #endif /* expanded by -frewrite-includes */
  included_line9
  #endif


https://reviews.llvm.org/D45603



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


[libcxx] r329978 - [libcxx] [test] Fix whitespace, NFC.

2018-04-12 Thread Stephan T. Lavavej via cfe-commits
Author: stl_msft
Date: Thu Apr 12 16:56:22 2018
New Revision: 329978

URL: http://llvm.org/viewvc/llvm-project?rev=329978=rev
Log:
[libcxx] [test] Fix whitespace, NFC.

test/std almost always uses spaces; now it is entirely tab-free.

Modified:

libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.copy/copy.pass.cpp

libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.copy/copy_backward.pass.cpp

libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.copy/copy_if.pass.cpp

libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.copy/copy_n.pass.cpp

libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.unique/unique.pass.cpp

libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.unique/unique_pred.pass.cpp

libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp
libcxx/trunk/test/std/containers/test_compare.h

libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_array_ptr.fail.cpp

libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_ptr.fail.cpp

libcxx/trunk/test/std/language.support/support.dynamic/ptr.launder/launder.pass.cpp
libcxx/trunk/test/std/strings/string.view/types.pass.cpp
libcxx/trunk/test/std/thread/futures/futures.async/async.fail.cpp

libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/remove_cvref.pass.cpp

Modified: 
libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.copy/copy.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.copy/copy.pass.cpp?rev=329978=329977=329978=diff
==
--- 
libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.copy/copy.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.copy/copy.pass.cpp
 Thu Apr 12 16:56:22 2018
@@ -24,10 +24,10 @@
 // int ia[] = {1, 2, 3, 4, 5};
 // int ic[] = {6, 6, 6, 6, 6, 6, 6};
 //
-// auto p = std::copy(std::begin(ia), std::end(ia), std::begin(ic));
-// return std::equal(std::begin(ia), std::end(ia), std::begin(ic), p)
-// && std::all_of(p, std::end(ic), [](int a){return a == 6;})
-// ;
+// auto p = std::copy(std::begin(ia), std::end(ia), std::begin(ic));
+// return std::equal(std::begin(ia), std::end(ia), std::begin(ic), p)
+// && std::all_of(p, std::end(ic), [](int a){return a == 6;})
+// ;
 // }
 // #endif
 

Modified: 
libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.copy/copy_backward.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.copy/copy_backward.pass.cpp?rev=329978=329977=329978=diff
==
--- 
libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.copy/copy_backward.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.copy/copy_backward.pass.cpp
 Thu Apr 12 16:56:22 2018
@@ -26,11 +26,11 @@
 // int ia[] = {1, 2, 3, 4, 5};
 // int ic[] = {6, 6, 6, 6, 6, 6, 6};
 //
-// size_t N = std::size(ia);
-// auto p = std::copy_backward(std::begin(ia), std::end(ia), 
std::begin(ic) + N);
-// return std::equal(std::begin(ic), p, std::begin(ia))
-// && std::all_of(p, std::end(ic), [](int a){return a == 6;})
-// ;
+// size_t N = std::size(ia);
+// auto p = std::copy_backward(std::begin(ia), std::end(ia), 
std::begin(ic) + N);
+// return std::equal(std::begin(ic), p, std::begin(ia))
+// && std::all_of(p, std::end(ic), [](int a){return a == 6;})
+// ;
 // }
 // #endif
 

Modified: 
libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.copy/copy_if.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.copy/copy_if.pass.cpp?rev=329978=329977=329978=diff
==
--- 
libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.copy/copy_if.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.copy/copy_if.pass.cpp
 Thu Apr 12 16:56:22 2018
@@ -26,10 +26,10 @@
 // int ia[] = {2, 4, 6, 8, 6};
 // int ic[] = {0, 0, 0, 0, 0, 0};
 //
-// auto p = std::copy_if(std::begin(ia), std::end(ia), std::begin(ic), 
is6);
-// return std::all_of(std::begin(ic), p, [](int a){return a == 6;})
-// && std::all_of(p, std::end(ic),   [](int a){return a == 0;})
-// ;
+// auto p = std::copy_if(std::begin(ia), std::end(ia), std::begin(ic), 
is6);
+// return std::all_of(std::begin(ic), p, [](int a){return a == 6;})
+// && std::all_of(p, std::end(ic),   [](int a){return a == 0;})
+// ;
 // }
 // #endif
 

Modified: 

[libcxx] r329976 - [libcxx] [test] Silence MSVC warning C4146.

2018-04-12 Thread Stephan T. Lavavej via cfe-commits
Author: stl_msft
Date: Thu Apr 12 16:56:14 2018
New Revision: 329976

URL: http://llvm.org/viewvc/llvm-project?rev=329976=rev
Log:
[libcxx] [test] Silence MSVC warning C4146.

This test code triggers the MSVC warning:

"unary minus operator applied to unsigned type, result still unsigned"

Although it would be possible to change the test code to avoid
this warning, I have chosen to simply silence it.

Fixes D45594.

Modified:

libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp

Modified: 
libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp?rev=329976=329975=329976=diff
==
--- 
libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp
 Thu Apr 12 16:56:14 2018
@@ -22,6 +22,10 @@
 #include 
 #include "test_iterators.h"
 
+#ifdef _MSC_VER
+#pragma warning(disable: 4146) // unary minus operator applied to unsigned 
type, result still unsigned
+#endif
+
 typedef std::num_get F;
 
 class my_facet


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


[libcxx] r329975 - [libcxx] [test] Fix nodiscard warnings.

2018-04-12 Thread Stephan T. Lavavej via cfe-commits
Author: stl_msft
Date: Thu Apr 12 16:56:12 2018
New Revision: 329975

URL: http://llvm.org/viewvc/llvm-project?rev=329975=rev
Log:
[libcxx] [test] Fix nodiscard warnings.

MSVC's STL has marked to_bytes/from_bytes as nodiscard.

Fixes D45595.

Modified:

libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp

Modified: 
libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp?rev=329975=329974=329975=diff
==
--- 
libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp
 Thu Apr 12 16:56:12 2018
@@ -33,7 +33,7 @@ int main()
 Myconv myconv;
 try
 {
-myconv.to_bytes(L"\xDA83");
+(void)myconv.to_bytes(L"\xDA83");
 assert(false);
 }
 catch (const std::range_error&)
@@ -41,7 +41,7 @@ int main()
 }
 try
 {
-myconv.from_bytes('\xA5');
+(void)myconv.from_bytes('\xA5');
 assert(false);
 }
 catch (const std::range_error&)
@@ -56,7 +56,7 @@ int main()
 #ifndef TEST_HAS_NO_EXCEPTIONS
 try
 {
-myconv.from_bytes('\xA5');
+(void)myconv.from_bytes('\xA5');
 assert(false);
 }
 catch (const std::range_error&)


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


[PATCH] D45476: [C++2a] Implement operator<=> CodeGen and ExprConstant

2018-04-12 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF marked 5 inline comments as done.
EricWF added inline comments.



Comment at: include/clang/Basic/DiagnosticSemaKinds.td:9377-9378
+def err_implied_comparison_category_type_not_found : Error<
+  "%0 type was not found; include  before defining "
+  "or using 'operator<=>'">;
+def err_spaceship_argument_narrowing : Error<

rsmith wrote:
> This doesn't sound quite right. You can define your own `operator<=>` without 
> including `` so long as you don't try to default it or use one of 
> the standard comparison category kinds. Also, instead of saying "before doing 
> X or Y", say which one the user actually did.
Ah, right. I guess this should say "cannot deduce return type of operator<=> 
because type %0 was not found; include "



Comment at: include/clang/Basic/DiagnosticSemaKinds.td:9384-9385
+def err_spaceship_comparison_of_void_ptr : Error<
+  "three-way comparison with void pointer %select{operand type|operand types}0 
"
+  "(%1 and %2)">;
+def err_spaceship_comparison_of_invalid_comp_type : Error<

rsmith wrote:
> Why are you diagnosing this case as an error?
[expr.spaceship]p9 seems to require it. The composite pointer type is not a 
function/member/null pointer type, neither is it a object pointer type, so the 
program is ill-formed.

Unless I'm missing something.



Comment at: include/clang/Basic/DiagnosticSemaKinds.td:9391
+def err_std_compare_type_invalid_member : Error<
+  "member '%1' of %0 is ill-formed">;
+def note_spaceship_operand_not_cce : Note<

rsmith wrote:
> What do you mean by "ill-formed" here?
> 
> I think what you really mean is "we don't understand how to deal with this 
> definition of that member", so maybe we should just fold this and the prior 
> diagnostic into something like "sorry, this standard library implementation 
> of std::whatever is not supported"?
That's exactly what I'm trying to say. 'll clean the diagnostic up. Thanks!



Comment at: include/clang/Basic/DiagnosticSemaKinds.td:9393
+def note_spaceship_operand_not_cce : Note<
+  "argument is not a constant expression">;
 } // end of sema component.

rsmith wrote:
> Is this really useful? I would think almost all the cases where you'd hit the 
> "cannot be narrowed" error, this diagnostic and the explanation of why the 
> operand is not constant would be meaningless noise, because it was never 
> meant to be constant, and the problem is simply that you are trying to 
> three-way compare integers of mixed signedness.
I'm struggling to answer that question myself. The case I was thinking of that 
I wanted to help the user out with is:

```
auto cmp_sentinal(long val) {
  int SENTINAL = 0;
  return SENTINAL <=> val; // error, would be OK if SENTINAL were const.
}
```

I'll remove these diagnostics for now, and hopefully improve them in a follow 
up patch, if that's OK with you?


https://reviews.llvm.org/D45476



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


[libcxx] r329983 - [CMake] Set the default ABI version for Fuchsia in CMake as well

2018-04-12 Thread Petr Hosek via cfe-commits
Author: phosek
Date: Thu Apr 12 18:59:15 2018
New Revision: 329983

URL: http://llvm.org/viewvc/llvm-project?rev=329983=rev
Log:
[CMake] Set the default ABI version for Fuchsia in CMake as well

This is neeeded since the CMake value is used for the SOVERSION.

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

Modified:
libcxx/trunk/CMakeLists.txt

Modified: libcxx/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=329983=329982=329983=diff
==
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Thu Apr 12 18:59:15 2018
@@ -97,7 +97,12 @@ option(LIBCXX_INSTALL_SUPPORT_HEADERS "I
 cmake_dependent_option(LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY
 "Install libc++experimental.a" ON
 "LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY;LIBCXX_INSTALL_LIBRARY" OFF)
-set(LIBCXX_ABI_VERSION 1 CACHE STRING "ABI version of libc++.")
+if (FUCHSIA)
+  set(DEFAULT_ABI_VERSION 2)
+else()
+  set(DEFAULT_ABI_VERSION 1)
+endif()
+set(LIBCXX_ABI_VERSION ${DEFAULT_ABI_VERSION} CACHE STRING "ABI version of 
libc++.")
 option(LIBCXX_ABI_UNSTABLE "Unstable ABI of libc++." OFF)
 option(LIBCXX_ABI_FORCE_ITANIUM "Ignore auto-detection and force use of the 
Itanium ABI.")
 option(LIBCXX_ABI_FORCE_MICROSOFT "Ignore auto-detection and force use of the 
Microsoft ABI.")
@@ -619,7 +624,7 @@ if (LIBCXX_STANDALONE_BUILD)
 endif()
 
 # Configuration file flags 
=
-if (NOT LIBCXX_ABI_VERSION EQUAL "1")
+if (NOT LIBCXX_ABI_VERSION EQUAL DEFAULT_ABI_VERSION)
   config_define(${LIBCXX_ABI_VERSION} _LIBCPP_ABI_VERSION)
 endif()
 config_define_if(LIBCXX_ABI_UNSTABLE _LIBCPP_ABI_UNSTABLE)


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


[PATCH] D44970: [XRay][clang] Add flag to choose instrumentation bundles

2018-04-12 Thread Dean Michael Berris via Phabricator via cfe-commits
dberris updated this revision to Diff 142315.
dberris marked 5 inline comments as done.
dberris added a comment.

- fixup: Address comments


https://reviews.llvm.org/D44970

Files:
  clang/include/clang/Basic/XRayInstr.h
  clang/include/clang/Driver/Options.td
  clang/include/clang/Driver/XRayArgs.h
  clang/include/clang/Frontend/CodeGenOptions.h
  clang/lib/Basic/CMakeLists.txt
  clang/lib/Basic/XRayInstr.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Driver/XRayArgs.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/xray-instrumentation-bundles.cpp

Index: clang/test/CodeGen/xray-instrumentation-bundles.cpp
===
--- /dev/null
+++ clang/test/CodeGen/xray-instrumentation-bundles.cpp
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -fxray-instrument -fxray-instrumentation-bundle=none -x c++ \
+// RUN: -std=c++11 -triple x86_64-unknown-unknown -emit-llvm -o - %s \
+// RUN: | FileCheck --check-prefixes CHECK,NOFUNCTION,NOCUSTOM %s
+// RUN: %clang_cc1 -fxray-instrument \
+// RUN: -fxray-instrumentation-bundle=function -x c++ \
+// RUN: -std=c++11 -triple x86_64-unknown-unknown -emit-llvm -o - %s \
+// RUN: | FileCheck --check-prefixes CHECK,FUNCTION,NOCUSTOM %s
+// RUN: %clang_cc1 -fxray-instrument \
+// RUN: -fxray-instrumentation-bundle=custom -x c++ \
+// RUN: -std=c++11 -triple x86_64-unknown-unknown -emit-llvm -o - %s \
+// RUN: | FileCheck --check-prefixes CHECK,NOFUNCTION,CUSTOM %s
+// RUN: %clang_cc1 -fxray-instrument \
+// RUN: -fxray-instrumentation-bundle=function,custom -x c++ \
+// RUN: -std=c++11 -triple x86_64-unknown-unknown -emit-llvm -o - %s \
+// RUN: | FileCheck --check-prefixes CHECK,FUNCTION,CUSTOM %s
+// RUN: %clang_cc1 -fxray-instrument \
+// RUN: -fxray-instrumentation-bundle=function \
+// RUN: -fxray-instrumentation-bundle=custom -x c++ \
+// RUN: -std=c++11 -triple x86_64-unknown-unknown -emit-llvm -o - %s \
+// RUN: | FileCheck --check-prefixes CHECK,FUNCTION,CUSTOM %s
+
+// CHECK: define void @_Z16alwaysInstrumentv() #[[ALWAYSATTR:[0-9]+]] {
+[[clang::xray_always_instrument]] void alwaysInstrument() {
+  static constexpr char kPhase[] = "always";
+  __xray_customevent(kPhase, 6);
+  // CUSTOM: call void @llvm.xray.customevent(i8*{{.*}}, i32 6)
+  // NOCUSTOM-NOT: call void @llvm.xray.customevent(i8*{{.*}}, i32 6)
+}
+
+// FUNCTION: attributes #[[ALWAYSATTR]] = {{.*}} "function-instrument"="xray-always" {{.*}}
+// NOFUNCTION-NOT: attributes #[[ALWAYSATTR]] = {{.*}} "function-instrument"="xray-always" {{.*}}
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -26,6 +26,7 @@
 #include "clang/Basic/VersionTuple.h"
 #include "clang/Basic/VirtualFileSystem.h"
 #include "clang/Basic/Visibility.h"
+#include "clang/Basic/XRayInstr.h"
 #include "clang/Config/config.h"
 #include "clang/Driver/DriverDiagnostic.h"
 #include "clang/Driver/Options.h"
@@ -75,9 +76,9 @@
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Support/Regex.h"
+#include "llvm/Support/ScopedPrinter.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetOptions.h"
-#include "llvm/Support/ScopedPrinter.h"
 #include 
 #include 
 #include 
@@ -446,6 +447,25 @@
   }
 }
 
+static void parseXRayInstrumentationBundle(StringRef FlagName, StringRef Bundle,
+   ArgList , DiagnosticsEngine ,
+   XRayInstrSet ) {
+  llvm::SmallVector BundleParts;
+  llvm::SplitString(Bundle, BundleParts, ",");
+  for (const auto B : BundleParts) {
+auto Mask = parseXRayInstrValue(B);
+if (Mask == XRayInstrKind::None)
+  if (B != "none")
+D.Report(diag::err_drv_invalid_value) << FlagName << Bundle;
+  else
+S.Mask = Mask;
+else if (Mask == XRayInstrKind::All)
+  S.Mask = Mask;
+else
+  S.set(Mask, true);
+  }
+}
+
 // Set the profile kind for fprofile-instrument.
 static void setPGOInstrumentor(CodeGenOptions , ArgList ,
DiagnosticsEngine ) {
@@ -820,11 +840,23 @@
   Args.hasArg(OPT_finstrument_functions_after_inlining);
   Opts.InstrumentFunctionEntryBare =
   Args.hasArg(OPT_finstrument_function_entry_bare);
-  Opts.XRayInstrumentFunctions = Args.hasArg(OPT_fxray_instrument);
+
+  Opts.XRayInstrumentFunctions =
+  Args.hasArg(OPT_fxray_instrument);
   Opts.XRayAlwaysEmitCustomEvents =
   Args.hasArg(OPT_fxray_always_emit_customevents);
   Opts.XRayInstructionThreshold =
   getLastArgIntValue(Args, OPT_fxray_instruction_threshold_EQ, 200, Diags);
+
+  auto XRayInstrBundles =
+  Args.getAllArgValues(OPT_fxray_instrumentation_bundle);
+  if 

[PATCH] D44970: [XRay][clang] Add flag to choose instrumentation bundles

2018-04-12 Thread Dean Michael Berris via Phabricator via cfe-commits
dberris added a comment.

Thanks, Martin! Landing now, after suggested changes.




Comment at: clang/lib/CodeGen/CodeGenFunction.cpp:471
 bool CodeGenFunction::AlwaysEmitXRayCustomEvents() const {
-  return CGM.getCodeGenOpts().XRayAlwaysEmitCustomEvents;
+  return CGM.getCodeGenOpts().XRayInstrumentFunctions &&
+ (CGM.getCodeGenOpts().XRayAlwaysEmitCustomEvents ||

pelikan wrote:
> I kind of don't like how the "-fxray-instrument" variable is called 
> "XRayInstrumentFunctions" because that's not what it means any more.  I think 
> in a later diff, we should clean this up.  Or maybe even clean up some of the 
> old flags whose functionality has been superseded by this.  But the logic 
> here is fine.
> 
> Same with the misleading "ShouldXRayInstrumentFunction()" which controls 
> custom events too, and not just functions.
Good point. Yes, we could make this cleaner.


https://reviews.llvm.org/D44970



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


[PATCH] D44970: [XRay][clang] Add flag to choose instrumentation bundles

2018-04-12 Thread Dean Michael Berris via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC329985: [XRay][clang] Add flag to choose instrumentation 
bundles (authored by dberris, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D44970?vs=142315=142317#toc

Repository:
  rC Clang

https://reviews.llvm.org/D44970

Files:
  include/clang/Basic/XRayInstr.h
  include/clang/Driver/Options.td
  include/clang/Driver/XRayArgs.h
  include/clang/Frontend/CodeGenOptions.h
  lib/Basic/CMakeLists.txt
  lib/Basic/XRayInstr.cpp
  lib/CodeGen/CGBuiltin.cpp
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/Driver/XRayArgs.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/xray-instrumentation-bundles.cpp

Index: lib/CodeGen/CodeGenModule.cpp
===
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -1846,9 +1846,10 @@
StringRef Category) const {
   if (!LangOpts.XRayInstrument)
 return false;
+
   const auto  = getContext().getXRayFilter();
   using ImbueAttr = XRayFunctionFilter::ImbueAttribute;
-  auto Attr = XRayFunctionFilter::ImbueAttribute::NONE;
+  auto Attr = ImbueAttr::NONE;
   if (Loc.isValid())
 Attr = XRayFilter.shouldImbueLocation(Loc, Category);
   if (Attr == ImbueAttr::NONE)
Index: lib/CodeGen/CGBuiltin.cpp
===
--- lib/CodeGen/CGBuiltin.cpp
+++ lib/CodeGen/CGBuiltin.cpp
@@ -3341,6 +3341,11 @@
   case Builtin::BI__xray_customevent: {
 if (!ShouldXRayInstrumentFunction())
   return RValue::getIgnored();
+
+if (!CGM.getCodeGenOpts().XRayInstrumentationBundle.has(
+XRayInstrKind::Custom))
+  return RValue::getIgnored();
+
 if (const auto *XRayAttr = CurFuncDecl->getAttr())
   if (XRayAttr->neverXRayInstrument() && !AlwaysEmitXRayCustomEvents())
 return RValue::getIgnored();
Index: lib/CodeGen/CodeGenFunction.cpp
===
--- lib/CodeGen/CodeGenFunction.cpp
+++ lib/CodeGen/CodeGenFunction.cpp
@@ -468,7 +468,10 @@
 /// AlwaysEmitXRayCustomEvents - Return true if we should emit IR for calls to
 /// the __xray_customevent(...) builin calls, when doing XRay instrumentation.
 bool CodeGenFunction::AlwaysEmitXRayCustomEvents() const {
-  return CGM.getCodeGenOpts().XRayAlwaysEmitCustomEvents;
+  return CGM.getCodeGenOpts().XRayInstrumentFunctions &&
+ (CGM.getCodeGenOpts().XRayAlwaysEmitCustomEvents ||
+  CGM.getCodeGenOpts().XRayInstrumentationBundle.Mask ==
+  XRayInstrKind::Custom);
 }
 
 llvm::Constant *
@@ -900,7 +903,9 @@
   }
 
   // Apply xray attributes to the function (as a string, for now)
-  bool InstrumentXray = ShouldXRayInstrumentFunction();
+  bool InstrumentXray = ShouldXRayInstrumentFunction() &&
+CGM.getCodeGenOpts().XRayInstrumentationBundle.has(
+XRayInstrKind::Function);
   if (D && InstrumentXray) {
 if (const auto *XRayAttr = D->getAttr()) {
   if (XRayAttr->alwaysXRayInstrument())
Index: lib/Driver/XRayArgs.cpp
===
--- lib/Driver/XRayArgs.cpp
+++ lib/Driver/XRayArgs.cpp
@@ -58,8 +58,7 @@
   }
 } else {
   D.Diag(diag::err_drv_clang_unsupported)
-  << (std::string(XRayInstrumentOption) +
-  " on non-supported target OS");
+  << (std::string(XRayInstrumentOption) + " on " + Triple.str());
 }
 XRayInstrument = true;
 if (const Arg *A =
@@ -82,6 +81,36 @@
   options::OPT_fnoxray_link_deps, true))
   XRayRT = false;
 
+auto Bundles =
+Args.getAllArgValues(options::OPT_fxray_instrumentation_bundle);
+if (Bundles.empty())
+  InstrumentationBundle.Mask = XRayInstrKind::All;
+else
+  for (const auto  : Bundles) {
+llvm::SmallVector BundleParts;
+llvm::SplitString(B, BundleParts, ",");
+for (const auto  : BundleParts) {
+  // TODO: Automate the generation of the string case table.
+  auto Valid = llvm::StringSwitch(P)
+   .Cases("none", "all", "function", "custom", true)
+   .Default(false);
+
+  if (!Valid) {
+D.Diag(clang::diag::err_drv_invalid_value)
+<< "-fxray-instrumentation-bundle=" << P;
+continue;
+  }
+
+  auto Mask = parseXRayInstrValue(P);
+  if (Mask == XRayInstrKind::None) {
+InstrumentationBundle.clear();
+break;
+  }
+
+  InstrumentationBundle.Mask |= Mask;
+}
+  }
+
 // Validate the always/never attribute files. We also make sure that they
 // are treated as actual dependencies.
 for (const auto  :
@@ -165,7 +194,7 @@
 

r329985 - [XRay][clang] Add flag to choose instrumentation bundles

2018-04-12 Thread Dean Michael Berris via cfe-commits
Author: dberris
Date: Thu Apr 12 19:31:58 2018
New Revision: 329985

URL: http://llvm.org/viewvc/llvm-project?rev=329985=rev
Log:
[XRay][clang] Add flag to choose instrumentation bundles

Summary:
This change addresses http://llvm.org/PR36926 by allowing users to pick
which instrumentation bundles to use, when instrumenting with XRay. In
particular, the flag `-fxray-instrumentation-bundle=` has four valid
values:

- `all`: the default, emits all instrumentation kinds
- `none`: equivalent to -fnoxray-instrument
- `function`: emits the entry/exit instrumentation
- `custom`: emits the custom event instrumentation

These can be combined either as comma-separated values, or as
repeated flag values.

Reviewers: echristo, kpw, eizan, pelikan

Reviewed By: pelikan

Subscribers: mgorny, cfe-commits

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

Added:
cfe/trunk/include/clang/Basic/XRayInstr.h
cfe/trunk/lib/Basic/XRayInstr.cpp
cfe/trunk/test/CodeGen/xray-instrumentation-bundles.cpp
Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Driver/XRayArgs.h
cfe/trunk/include/clang/Frontend/CodeGenOptions.h
cfe/trunk/lib/Basic/CMakeLists.txt
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/Driver/XRayArgs.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Added: cfe/trunk/include/clang/Basic/XRayInstr.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/XRayInstr.h?rev=329985=auto
==
--- cfe/trunk/include/clang/Basic/XRayInstr.h (added)
+++ cfe/trunk/include/clang/Basic/XRayInstr.h Thu Apr 12 19:31:58 2018
@@ -0,0 +1,68 @@
+//===--- XRayInstr.h *- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+/// \file
+/// \brief Defines the clang::XRayInstrKind enum.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_BASIC_XRAYINSTR_H
+#define LLVM_CLANG_BASIC_XRAYINSTR_H
+
+#include "clang/Basic/LLVM.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/MathExtras.h"
+#include 
+#include 
+
+namespace clang {
+
+using XRayInstrMask = uint32_t;
+
+namespace XRayInstrKind {
+
+// TODO: Auto-generate these as we add more instrumentation kinds.
+enum XRayInstrOrdinal : XRayInstrMask {
+  XRIO_Function,
+  XRIO_Custom,
+  XRIO_Count
+};
+
+constexpr XRayInstrMask None = 0;
+constexpr XRayInstrMask Function = 1U << XRIO_Function;
+constexpr XRayInstrMask Custom = 1U << XRIO_Custom;
+constexpr XRayInstrMask All = Function | Custom;
+
+} // namespace XRayInstrKind
+
+struct XRayInstrSet {
+  bool has(XRayInstrMask K) const {
+assert(llvm::isPowerOf2_32(K));
+return Mask & K;
+  }
+
+  bool hasOneOf(XRayInstrMask K) const { return Mask & K; }
+
+  void set(XRayInstrMask K, bool Value) {
+assert(llvm::isPowerOf2_32(K));
+Mask = Value ? (Mask | K) : (Mask & ~K);
+  }
+
+  void clear(XRayInstrMask K = XRayInstrKind::All) { Mask &= ~K; }
+
+  bool empty() const { return Mask == 0; }
+
+  XRayInstrMask Mask = 0;
+};
+
+XRayInstrMask parseXRayInstrValue(StringRef Value);
+
+} // namespace clang
+
+#endif // LLVM_CLANG_BASIC_XRAYINSTR_H

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=329985=329984=329985=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Thu Apr 12 19:31:58 2018
@@ -1125,6 +1125,11 @@ def fxray_link_deps : Flag<["-"], "fxray
 def fnoxray_link_deps : Flag<["-"], "fnoxray-link-deps">, Group,
   Flags<[CC1Option]>;
 
+def fxray_instrumentation_bundle :
+  JoinedOrSeparate<["-"], "fxray-instrumentation-bundle=">,
+  Group, Flags<[CC1Option]>,
+  HelpText<"Select which XRay instrumentation points to emit. Options: all, 
none, function, custom. Default is 'all'.">;
+
 def ffine_grained_bitfield_accesses : Flag<["-"],
   "ffine-grained-bitfield-accesses">, Group, Flags<[CC1Option]>,
   HelpText<"Use separate accesses for bitfields with legal widths and 
alignments.">;

Modified: cfe/trunk/include/clang/Driver/XRayArgs.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/XRayArgs.h?rev=329985=329984=329985=diff
==
--- cfe/trunk/include/clang/Driver/XRayArgs.h (original)
+++ cfe/trunk/include/clang/Driver/XRayArgs.h Thu Apr 12 19:31:58 2018
@@ -9,6 +9,7 @@
 #ifndef LLVM_CLANG_DRIVER_XRAYARGS_H
 #define 

[PATCH] D44882: [clangd] Implementation of workspace/symbol request

2018-04-12 Thread Marc-Andre Laperle via Phabricator via cfe-commits
malaperle updated this revision to Diff 142328.
malaperle marked an inline comment as done.
malaperle added a comment.

Address comments.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D44882

Files:
  clangd/CMakeLists.txt
  clangd/ClangdLSPServer.cpp
  clangd/ClangdLSPServer.h
  clangd/ClangdServer.cpp
  clangd/ClangdServer.h
  clangd/FindSymbols.cpp
  clangd/FindSymbols.h
  clangd/Protocol.cpp
  clangd/Protocol.h
  clangd/ProtocolHandlers.cpp
  clangd/ProtocolHandlers.h
  clangd/SourceCode.cpp
  clangd/SourceCode.h
  clangd/XRefs.cpp
  clangd/index/SymbolCollector.cpp
  clangd/tool/ClangdMain.cpp
  test/clangd/initialize-params-invalid.test
  test/clangd/initialize-params.test
  test/clangd/symbols.test
  unittests/clangd/CMakeLists.txt
  unittests/clangd/FindSymbolsTests.cpp
  unittests/clangd/SyncAPI.cpp
  unittests/clangd/SyncAPI.h

Index: unittests/clangd/SyncAPI.h
===
--- unittests/clangd/SyncAPI.h
+++ unittests/clangd/SyncAPI.h
@@ -41,6 +41,10 @@
 
 std::string runDumpAST(ClangdServer , PathRef File);
 
+llvm::Expected
+runWorkspaceSymbols(ClangdServer , StringRef Query, int Limit,
+const DraftStore );
+
 } // namespace clangd
 } // namespace clang
 
Index: unittests/clangd/SyncAPI.cpp
===
--- unittests/clangd/SyncAPI.cpp
+++ unittests/clangd/SyncAPI.cpp
@@ -110,5 +110,13 @@
   return std::move(*Result);
 }
 
+llvm::Expected
+runWorkspaceSymbols(ClangdServer , StringRef Query, int Limit,
+const DraftStore ) {
+  llvm::Optional> Result;
+  Server.workspaceSymbols(Query, Limit, DS, capture(Result));
+  return std::move(*Result);
+}
+
 } // namespace clangd
 } // namespace clang
Index: unittests/clangd/FindSymbolsTests.cpp
===
--- /dev/null
+++ unittests/clangd/FindSymbolsTests.cpp
@@ -0,0 +1,249 @@
+//===-- FindSymbolsTests.cpp -*- C++ -*===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+#include "Annotations.h"
+#include "ClangdServer.h"
+#include "DraftStore.h"
+#include "FindSymbols.h"
+#include "SyncAPI.h"
+#include "TestFS.h"
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+namespace clang {
+namespace clangd {
+
+namespace {
+
+using ::testing::AllOf;
+using ::testing::AnyOf;
+using ::testing::ElementsAre;
+using ::testing::IsEmpty;
+using ::testing::UnorderedElementsAre;
+
+class IgnoreDiagnostics : public DiagnosticsConsumer {
+  void onDiagnosticsReady(PathRef File,
+  std::vector Diagnostics) override {}
+};
+
+// GMock helpers for matching SymbolInfos items.
+MATCHER_P(Named, Name, "") { return arg.name == Name; }
+MATCHER_P(InContainer, ContainerName, "") {
+  return arg.containerName == ContainerName;
+}
+MATCHER_P(WithKind, Kind, "") { return arg.kind == Kind; }
+
+ClangdServer::Options optsForTests() {
+  auto ServerOpts = ClangdServer::optsForTest();
+  ServerOpts.BuildDynamicSymbolIndex = true;
+  return ServerOpts;
+}
+
+class WorkspaceSymbolsTest : public ::testing::Test {
+public:
+  WorkspaceSymbolsTest()
+  : Server(CDB, FSProvider, DiagConsumer, optsForTests()) {}
+
+protected:
+  MockFSProvider FSProvider;
+  MockCompilationDatabase CDB;
+  IgnoreDiagnostics DiagConsumer;
+  ClangdServer Server;
+  int Limit;
+  DraftStore DS;
+
+  std::vector getSymbols(StringRef Query) {
+EXPECT_TRUE(Server.blockUntilIdleForTest()) << "Waiting for preamble";
+auto SymbolInfos = runWorkspaceSymbols(Server, Query, Limit, DS);
+EXPECT_TRUE(bool(SymbolInfos)) << "workspaceSymbols returned an error";
+return *SymbolInfos;
+  }
+
+  void addFile(StringRef FileName, StringRef Contents) {
+auto Path = testPath(FileName);
+FSProvider.Files[Path] = Contents;
+Server.addDocument(Path, Contents);
+  }
+};
+
+} // namespace
+
+TEST_F(WorkspaceSymbolsTest, NoMacro) {
+  addFile("foo.cpp", R"cpp(
+  #define MACRO X
+  )cpp");
+
+  // Macros are not in the index.
+  EXPECT_THAT(getSymbols("macro"), IsEmpty());
+}
+
+TEST_F(WorkspaceSymbolsTest, NoLocals) {
+  addFile("foo.cpp", R"cpp(
+  void test(int FirstParam, int SecondParam) {
+struct LocalClass {};
+int local_var;
+  })cpp");
+  EXPECT_THAT(getSymbols("l"), IsEmpty());
+  EXPECT_THAT(getSymbols("p"), IsEmpty());
+}
+
+TEST_F(WorkspaceSymbolsTest, Globals) {
+  addFile("foo.h", R"cpp(
+  int global_var;
+
+  int global_func();
+
+  struct GlobalStruct {};)cpp");
+  addFile("foo.cpp", R"cpp(
+  #include "foo.h"
+  )cpp");
+  EXPECT_THAT(getSymbols("global"),
+  

[PATCH] D44882: [clangd] Implementation of workspace/symbol request

2018-04-12 Thread Marc-Andre Laperle via Phabricator via cfe-commits
malaperle marked an inline comment as done.
malaperle added inline comments.



Comment at: clangd/ClangdLSPServer.cpp:113
+  auto KindVal = static_cast(Kind);
+  if (KindVal >= SymbolKindMin && KindVal <= SymbolKindMax)
+SupportedSymbolKinds.set(KindVal);

sammccall wrote:
> nit: the bounds checks at usage types, with explicit underlying type for the 
> enum are inconsistent with what we do in other protocol enums, and seem to 
> clutter the code.
> 
> All else equal, I'd prefer to have an enum/enum class with implicit type, and 
> not have values that are out of the enum's range. It's a simpler model that 
> matches the code we have, and doesn't need tricky casts to 
> SymKindUnderlyingType. If we want to support clients that send higher numbers 
> than we know about, we could either:
>  - overload fromJSON(vector)&
>  - just express the capabilities as vector and convert them to the enum 
> (and check bounds) at this point.
> WDYT?
I think it's better to keep vector in Protocol.h, it is clearer and 
more in line with the protocol. I overloaded fromJSON, which simplifies the 
code here, but it still needs a static_cast to size_t for the bitset.set(). 
Other places there still needs a static_cast, like in defaultSymbolKinds for 
the loop, I can static_cast to size_t everywhere (or int?) but having 
SymKindUnderlyingType seems more correct. I changed it to size_t, let me know 
if it was something like that you had in mind.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D44882



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


[libcxx] r329973 - [libcxx] [test] Avoid MSVC truncation warnings.

2018-04-12 Thread Stephan T. Lavavej via cfe-commits
Author: stl_msft
Date: Thu Apr 12 16:56:07 2018
New Revision: 329973

URL: http://llvm.org/viewvc/llvm-project?rev=329973=rev
Log:
[libcxx] [test] Avoid MSVC truncation warnings.

MSVC emits "warning C4244: 'initializing': conversion from 'int'
to 'short', possible loss of data" when it sees pair
constructed from (whatever, 4), because int is being truncated to
short within pair's constructor. (The compiler doesn't take into
account the fact that 4 is a literal at the callsite; it generates
this warning when the constructor is instantiated, because it might
be called with a runtime-valued int that would actually truncate.)

Instead of static_cast, we can simply change short to int
in these tests, without affecting the pair operations that they're
trying to test: move assignment, convert copy construction, and
convert move construction.

Fixes D45016.

Modified:

libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair.pass.cpp

libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp

libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair.pass.cpp?rev=329973=329972=329973=diff
==
--- 
libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair.pass.cpp
 Thu Apr 12 16:56:07 2018
@@ -49,7 +49,7 @@ int CountAssign::moved = 0;
 int main()
 {
 {
-typedef std::pair P;
+typedef std::pair P;
 P p1(std::unique_ptr(new int(3)), 4);
 P p2;
 p2 = std::move(p1);

Modified: 
libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp?rev=329973=329972=329973=diff
==
--- 
libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp
 Thu Apr 12 16:56:07 2018
@@ -57,7 +57,7 @@ struct ImplicitT {
 int main()
 {
 {
-typedef std::pair P1;
+typedef std::pair P1;
 typedef std::pair P2;
 const P1 p1(3, 4);
 const P2 p2 = p1;
@@ -154,7 +154,7 @@ int main()
 }
 #if TEST_STD_VER > 11
 {
-typedef std::pair P1;
+typedef std::pair P1;
 typedef std::pair P2;
 constexpr P1 p1(3, 4);
 constexpr P2 p2 = p1;

Modified: 
libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp?rev=329973=329972=329973=diff
==
--- 
libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp 
Thu Apr 12 16:56:07 2018
@@ -67,7 +67,7 @@ struct ImplicitT {
 int main()
 {
 {
-typedef std::pair P1;
+typedef std::pair P1;
 typedef std::pair P2;
 P1 p1(std::unique_ptr(), 4);
 P2 p2 = std::move(p1);


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


[libcxx] r329977 - [libcxx] [test] Use TEST_COMPILER_C1XX.

2018-04-12 Thread Stephan T. Lavavej via cfe-commits
Author: stl_msft
Date: Thu Apr 12 16:56:17 2018
New Revision: 329977

URL: http://llvm.org/viewvc/llvm-project?rev=329977=rev
Log:
[libcxx] [test] Use TEST_COMPILER_C1XX.

Also TEST_COMPILER_CLANG in one place. (More could be changed.)

Modified:

libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.generate/generate_n.pass.cpp

libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp

libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp
libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp

Modified: 
libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.generate/generate_n.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.generate/generate_n.pass.cpp?rev=329977=329976=329977=diff
==
--- 
libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.generate/generate_n.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.generate/generate_n.pass.cpp
 Thu Apr 12 16:56:17 2018
@@ -15,14 +15,15 @@
 //   constexpr void  // constexpr after c++17
 //   generate_n(Iter first, Size n, Generator gen);
 
-#ifdef _MSC_VER
+#include "test_macros.h"
+
+#ifdef TEST_COMPILER_C1XX
 #pragma warning(disable: 4244) // conversion from 'const double' to 'int', 
possible loss of data
 #endif
 
 #include 
 #include 
 
-#include "test_macros.h"
 #include "test_iterators.h"
 #include "user_defined_integral.hpp"
 

Modified: 
libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp?rev=329977=329976=329977=diff
==
--- 
libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp
 Thu Apr 12 16:56:17 2018
@@ -17,11 +17,13 @@
 #include 
 #include 
 
-#if defined(__clang__)
+#include "test_macros.h"
+
+#if defined(TEST_COMPILER_CLANG)
 #pragma clang diagnostic ignored "-Wliteral-conversion"
 #endif
 
-#ifdef _MSC_VER
+#ifdef TEST_COMPILER_C1XX
 #pragma warning(disable: 4244) // conversion from 'X' to 'Y', possible loss of 
data
 #endif
 

Modified: 
libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp?rev=329977=329976=329977=diff
==
--- 
libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp
 Thu Apr 12 16:56:17 2018
@@ -21,8 +21,9 @@
 #include 
 #include 
 #include "test_iterators.h"
+#include "test_macros.h"
 
-#ifdef _MSC_VER
+#ifdef TEST_COMPILER_C1XX
 #pragma warning(disable: 4146) // unary minus operator applied to unsigned 
type, result still unsigned
 #endif
 

Modified: 
libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp?rev=329977=329976=329977=diff
==
--- libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp 
(original)
+++ libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp 
Thu Apr 12 16:56:17 2018
@@ -45,10 +45,10 @@ test1()
 assert((LCE::min() == (c == 0u ? 1u: 0u)));
 #endif
 
-#ifdef _MSC_VER
+#ifdef TEST_COMPILER_C1XX
 #pragma warning(push)
 #pragma warning(disable: 4310) // cast truncates constant value
-#endif // _MSC_VER
+#endif // TEST_COMPILER_C1XX
 
 #if TEST_STD_VER >= 11
 static_assert((LCE::max() == result_type(m - 1u)), "");
@@ -56,9 +56,9 @@ test1()
 assert((LCE::max() == result_type(m - 1u)));
 #endif
 
-#ifdef _MSC_VER
+#ifdef TEST_COMPILER_C1XX
 #pragma warning(pop)
-#endif // _MSC_VER
+#endif // TEST_COMPILER_C1XX
 
 static_assert((LCE::default_seed == 1), "");
 where(LCE::multiplier);


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


[libcxx] r329974 - [libcxx] [test] Avoid unary_function.

2018-04-12 Thread Stephan T. Lavavej via cfe-commits
Author: stl_msft
Date: Thu Apr 12 16:56:10 2018
New Revision: 329974

URL: http://llvm.org/viewvc/llvm-project?rev=329974=rev
Log:
[libcxx] [test] Avoid unary_function.

Replace unary_function inheritance (which was never required,
even in C++98) with argument_type and result_type typedefs.
This increases portability, as unary_function was removed in C++17
and MSVC has implemented that removal.

Fixes D45596.

Modified:
libcxx/trunk/test/support/Counter.h

Modified: libcxx/trunk/test/support/Counter.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/Counter.h?rev=329974=329973=329974=diff
==
--- libcxx/trunk/test/support/Counter.h (original)
+++ libcxx/trunk/test/support/Counter.h Thu Apr 12 16:56:10 2018
@@ -45,8 +45,10 @@ namespace std {
 
 template 
 struct hash
-: public std::unary_function
 {
+typedef Counter argument_type;
+typedef std::size_t result_type;
+
 std::size_t operator()(const Counter& x) const {return 
std::hash(x.get());}
 };
 }


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


[PATCH] D45594: [libcxx] [test] Silence MSVC warning C4146.

2018-04-12 Thread Stephan T. Lavavej via Phabricator via cfe-commits
STL_MSFT closed this revision.
STL_MSFT added a comment.

Committed, with a follow-up to use the C1XX macro.


https://reviews.llvm.org/D45594



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


[PATCH] D45016: [libcxx] [test] Avoid MSVC truncation warnings.

2018-04-12 Thread Stephan T. Lavavej via Phabricator via cfe-commits
STL_MSFT accepted this revision.
STL_MSFT added a comment.
This revision is now accepted and ready to land.

Approved by Eric.


https://reviews.llvm.org/D45016



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


[PATCH] D45601: Warn on bool* to bool conversion

2018-04-12 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added a comment.

There is Clang-tidy's readability-implicit-bool-conversion 

 check.

It may be reasonable to check pointers to integers too, since integers are 
often implicitly converted to bools.

Please mention new warning in Release Notes.


https://reviews.llvm.org/D45601



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


[PATCH] D45290: [Driver] Use the per-API level Android library directories.

2018-04-12 Thread Evgenii Stepanov via Phabricator via cfe-commits
eugenis accepted this revision.
eugenis added a comment.
This revision is now accepted and ready to land.

LGTM (did not check the tests).




Comment at: lib/Driver/ToolChains/Linux.cpp:25
 #include "llvm/Support/Path.h"
+#include "llvm/Support/ScopedPrinter.h"
 #include 

I don't see why this include is necessary.


Repository:
  rC Clang

https://reviews.llvm.org/D45290



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


[PATCH] D45601: Warn on bool* to bool conversion

2018-04-12 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone added inline comments.



Comment at: test/CXX/expr/expr.unary/expr.unary.op/p6.cpp:18
 // --  pointer, 
 bool b6 = ! // expected-warning{{address of 'b4' will always evaluate to 
'true'}}
+// expected-warning@-1 {{comparing 'bool *' as a boolean}}

This is not "comparing" anything, so the warning seems inappropriate here. 
Maybe "implicitly converting 'bool *' to 'bool' in operand of '!'` would be 
more appropriate?

Please add test cases for `operator!`, `operator&&`, `operator||`, and 
`operator?`.



Comment at: test/Sema/static-init.c:10
 intptr_t s = (intptr_t) 
-_Bool t = 
+_Bool t =  // expected-warning {{comparing '_Bool *' as a boolean}}
 

Again, not "comparing" anything.
Incidentally, do you know why this line fails to produce an "address of 't' 
will always evaluate to 'true'" warning?



Comment at: test/SemaCXX/warn-bool-ptr-to-bool.cpp:5
+  if (b)
+// expected-warning@-1 {{comparing 'bool *' as a boolean}}
+return 10;

Please add a test case

```
template
T foo(T *ptr) {
return ptr ? *ptr : T{};
}
bool bar(bool *ptr) { return foo(ptr); }
```

and make sure the warning does not trigger in this case. (It would be OK to 
trigger a clang-tidy check in this case, but IMHO not a `-W -Wall -Wextra` 
warning.)


https://reviews.llvm.org/D45601



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


r329984 - [CMake][Fuchsia] Don't specify libc++ ABI version for Fuchsia

2018-04-12 Thread Petr Hosek via cfe-commits
Author: phosek
Date: Thu Apr 12 19:02:13 2018
New Revision: 329984

URL: http://llvm.org/viewvc/llvm-project?rev=329984=rev
Log:
[CMake][Fuchsia] Don't specify libc++ ABI version for Fuchsia

This is now set automatically in libc++ config header.

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

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=329984=329983=329984=diff
==
--- cfe/trunk/cmake/caches/Fuchsia-stage2.cmake (original)
+++ cfe/trunk/cmake/caches/Fuchsia-stage2.cmake Thu Apr 12 19:02:13 2018
@@ -73,7 +73,6 @@ foreach(target x86_64;aarch64)
   set(RUNTIMES_${target}-fuchsia_LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
   set(RUNTIMES_${target}-fuchsia_LIBCXXABI_ENABLE_STATIC OFF CACHE BOOL "")
   set(RUNTIMES_${target}-fuchsia_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
-  set(RUNTIMES_${target}-fuchsia_LIBCXX_ABI_VERSION 2 CACHE STRING "")
   set(RUNTIMES_${target}-fuchsia_LIBCXX_ENABLE_STATIC OFF CACHE BOOL "")
   set(RUNTIMES_${target}-fuchsia_SANITIZER_USE_COMPILER_RT ON CACHE BOOL "")
 


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


[PATCH] D45529: [CMake] Set the default ABI version for Fuchsia in CMake as well

2018-04-12 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL329983: [CMake] Set the default ABI version for Fuchsia in 
CMake as well (authored by phosek, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D45529?vs=142261=142313#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D45529

Files:
  libcxx/trunk/CMakeLists.txt


Index: libcxx/trunk/CMakeLists.txt
===
--- libcxx/trunk/CMakeLists.txt
+++ libcxx/trunk/CMakeLists.txt
@@ -97,7 +97,12 @@
 cmake_dependent_option(LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY
 "Install libc++experimental.a" ON
 "LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY;LIBCXX_INSTALL_LIBRARY" OFF)
-set(LIBCXX_ABI_VERSION 1 CACHE STRING "ABI version of libc++.")
+if (FUCHSIA)
+  set(DEFAULT_ABI_VERSION 2)
+else()
+  set(DEFAULT_ABI_VERSION 1)
+endif()
+set(LIBCXX_ABI_VERSION ${DEFAULT_ABI_VERSION} CACHE STRING "ABI version of 
libc++.")
 option(LIBCXX_ABI_UNSTABLE "Unstable ABI of libc++." OFF)
 option(LIBCXX_ABI_FORCE_ITANIUM "Ignore auto-detection and force use of the 
Itanium ABI.")
 option(LIBCXX_ABI_FORCE_MICROSOFT "Ignore auto-detection and force use of the 
Microsoft ABI.")
@@ -619,7 +624,7 @@
 endif()
 
 # Configuration file flags 
=
-if (NOT LIBCXX_ABI_VERSION EQUAL "1")
+if (NOT LIBCXX_ABI_VERSION EQUAL DEFAULT_ABI_VERSION)
   config_define(${LIBCXX_ABI_VERSION} _LIBCPP_ABI_VERSION)
 endif()
 config_define_if(LIBCXX_ABI_UNSTABLE _LIBCPP_ABI_UNSTABLE)


Index: libcxx/trunk/CMakeLists.txt
===
--- libcxx/trunk/CMakeLists.txt
+++ libcxx/trunk/CMakeLists.txt
@@ -97,7 +97,12 @@
 cmake_dependent_option(LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY
 "Install libc++experimental.a" ON
 "LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY;LIBCXX_INSTALL_LIBRARY" OFF)
-set(LIBCXX_ABI_VERSION 1 CACHE STRING "ABI version of libc++.")
+if (FUCHSIA)
+  set(DEFAULT_ABI_VERSION 2)
+else()
+  set(DEFAULT_ABI_VERSION 1)
+endif()
+set(LIBCXX_ABI_VERSION ${DEFAULT_ABI_VERSION} CACHE STRING "ABI version of libc++.")
 option(LIBCXX_ABI_UNSTABLE "Unstable ABI of libc++." OFF)
 option(LIBCXX_ABI_FORCE_ITANIUM "Ignore auto-detection and force use of the Itanium ABI.")
 option(LIBCXX_ABI_FORCE_MICROSOFT "Ignore auto-detection and force use of the Microsoft ABI.")
@@ -619,7 +624,7 @@
 endif()
 
 # Configuration file flags =
-if (NOT LIBCXX_ABI_VERSION EQUAL "1")
+if (NOT LIBCXX_ABI_VERSION EQUAL DEFAULT_ABI_VERSION)
   config_define(${LIBCXX_ABI_VERSION} _LIBCPP_ABI_VERSION)
 endif()
 config_define_if(LIBCXX_ABI_UNSTABLE _LIBCPP_ABI_UNSTABLE)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45526: [clang-format] Do not break after ObjC category open paren

2018-04-12 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 142182.
benhamilton marked an inline comment as done.
benhamilton added a comment.

- Update comment.


Repository:
  rC Clang

https://reviews.llvm.org/D45526

Files:
  lib/Format/TokenAnnotator.cpp
  unittests/Format/FormatTestObjC.cpp


Index: unittests/Format/FormatTestObjC.cpp
===
--- unittests/Format/FormatTestObjC.cpp
+++ unittests/Format/FormatTestObjC.cpp
@@ -334,6 +334,9 @@
"c, c,\n"
"c, c> {\n"
"}");
+  verifyFormat("@interface c (ccc) <\n"
+   "c> {\n"
+   "}");
   Style.ObjCBinPackProtocolList = FormatStyle::BPS_Never;
   verifyFormat("@interface d () <\n"
"d,\n"
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -2272,6 +2272,13 @@
   if (Left.is(tok::colon) && Left.is(TT_ObjCMethodExpr))
 return Line.MightBeFunctionDecl ? 50 : 500;
 
+  // In Objective-C type declarations, avoid breaking after the category's
+  // open paren (we'll prefer breaking after the protocol list's opening
+  // angle bracket, if present).
+  if (Line.Type == LT_ObjCDecl && Left.is(tok::l_paren) && Left.Previous &&
+  Left.Previous->isOneOf(tok::identifier, tok::greater))
+return 500;
+
   if (Left.is(tok::l_paren) && InFunctionDecl &&
   Style.AlignAfterOpenBracket != FormatStyle::BAS_DontAlign)
 return 100;


Index: unittests/Format/FormatTestObjC.cpp
===
--- unittests/Format/FormatTestObjC.cpp
+++ unittests/Format/FormatTestObjC.cpp
@@ -334,6 +334,9 @@
"c, c,\n"
"c, c> {\n"
"}");
+  verifyFormat("@interface c (ccc) <\n"
+   "c> {\n"
+   "}");
   Style.ObjCBinPackProtocolList = FormatStyle::BPS_Never;
   verifyFormat("@interface d () <\n"
"d,\n"
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -2272,6 +2272,13 @@
   if (Left.is(tok::colon) && Left.is(TT_ObjCMethodExpr))
 return Line.MightBeFunctionDecl ? 50 : 500;
 
+  // In Objective-C type declarations, avoid breaking after the category's
+  // open paren (we'll prefer breaking after the protocol list's opening
+  // angle bracket, if present).
+  if (Line.Type == LT_ObjCDecl && Left.is(tok::l_paren) && Left.Previous &&
+  Left.Previous->isOneOf(tok::identifier, tok::greater))
+return 500;
+
   if (Left.is(tok::l_paren) && InFunctionDecl &&
   Style.AlignAfterOpenBracket != FormatStyle::BAS_DontAlign)
 return 100;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45526: [clang-format] Do not break after ObjC category open paren

2018-04-12 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments.



Comment at: lib/Format/TokenAnnotator.cpp:2276
+  // In Objective-C type declarations, prefer breaking after the category's
+  // close paren instead of after the open paren.
+  if (Line.Type == LT_ObjCDecl && Left.is(tok::l_paren) && Left.Previous &&

djasper wrote:
> This is still using the old wording.
Fixed, thanks.


Repository:
  rC Clang

https://reviews.llvm.org/D45526



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


[PATCH] D45004: [clang-format] Always indent wrapped Objective-C selector names

2018-04-12 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 142183.
benhamilton marked an inline comment as done.
benhamilton added a comment.

Update comment.


Repository:
  rC Clang

https://reviews.llvm.org/D45004

Files:
  lib/Format/ContinuationIndenter.cpp
  unittests/Format/FormatTest.cpp
  unittests/Format/FormatTestObjC.cpp

Index: unittests/Format/FormatTestObjC.cpp
===
--- unittests/Format/FormatTestObjC.cpp
+++ unittests/Format/FormatTestObjC.cpp
@@ -536,28 +536,25 @@
"ofSize:(size_t)height\n"
"  :(size_t)width;");
   Style.ColumnLimit = 40;
-  // Make sure selectors with 0, 1, or more arguments are not indented
-  // when IndentWrappedFunctionNames is false.
-  Style.IndentWrappedFunctionNames = false;
+  // Make sure selectors with 0, 1, or more arguments are indented when wrapped.
   verifyFormat("- (a)\n"
-   ";\n");
+   ";\n");
   verifyFormat("- (a)\n"
-   ":(int)a;\n");
+   ":(int)a;\n");
   verifyFormat("- (a)\n"
-   ":(int)a\n"
-   ":(int)a;\n");
+   ":(int)a\n"
+   ":(int)a;\n");
   verifyFormat("- (a)\n"
-   " aaa:(int)a\n"
-   ":(int)a;\n");
+   " aaa:(int)a\n"
+   ":(int)a;\n");
   verifyFormat("- (a)\n"
-   ":(int)a\n"
-   " aaa:(int)a;\n");
+   ":(int)a\n"
+   " aaa:(int)a;\n");
 
   // Continuation indent width should win over aligning colons if the function
   // name is long.
   Style = getGoogleStyle(FormatStyle::LK_ObjC);
   Style.ColumnLimit = 40;
-  Style.IndentWrappedFunctionNames = true;
   verifyFormat("- (void)shortf:(GTMFoo *)theFoo\n"
"dontAlignNamef:(NSRect)theRect {\n"
"}");
@@ -567,22 +564,6 @@
"   aShortf:(NSRect)theRect {\n"
"}");
 
-  // Make sure selectors with 0, 1, or more arguments are indented
-  // when IndentWrappedFunctionNames is true.
-  verifyFormat("- (a)\n"
-   ";\n");
-  verifyFormat("- (a)\n"
-   ":(int)a;\n");
-  verifyFormat("- (a)\n"
-   ":(int)a\n"
-   ":(int)a;\n");
-  verifyFormat("- (a)\n"
-   " aaa:(int)a\n"
-   ":(int)a;\n");
-  verifyFormat("- (a)\n"
-   ":(int)a\n"
-   " aaa:(int)a;\n");
-
   // Format pairs correctly.
   Style.ColumnLimit = 80;
   verifyFormat("- (void)drawRectOn:(id)surface\n"
Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -7663,16 +7663,18 @@
 
   // When the function name has to be wrapped.
   FormatStyle Style = getLLVMStyle();
+  // ObjC ignores IndentWrappedFunctionNames when wrapping methods
+  // and always indents instead.
   Style.IndentWrappedFunctionNames = false;
   verifyFormat("- (SomeLongType *)\n"
-   "veryLooongName:(NSString)aa\n"
-   "   anotherName:(NSString)bb {\n"
+   "veryLooongName:(NSString)aa\n"
+   "   anotherName:(NSString)bb {\n"
"}",
Style);
   Style.IndentWrappedFunctionNames = true;
   verifyFormat("- (SomeLongType *)\n"
-   "veryLooongName:(NSString)aa\n"
-   "   anotherName:(NSString)bb {\n"
+   "veryLooongName:(NSString)cc\n"
+   "   anotherName:(NSString)dd {\n"
"}",
Style);
 
Index: lib/Format/ContinuationIndenter.cpp
===
--- lib/Format/ContinuationIndenter.cpp
+++ 

[PATCH] D41168: [X86] Lowering X86 avx512 sqrt intrinsics to IR

2018-04-12 Thread Tomasz Krupa via Phabricator via cfe-commits
tkrupa added a comment.

I'll wait with upstreaming this patch until there's an agreement on mask scalar 
approach.


Repository:
  rC Clang

https://reviews.llvm.org/D41168



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


[PATCH] D45004: [clang-format] Always indent wrapped Objective-C selector names

2018-04-12 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments.



Comment at: unittests/Format/FormatTest.cpp:7666
   FormatStyle Style = getLLVMStyle();
+  // ObjC ignores IndentWrappedFunctionNames when wrapping methods.
   Style.IndentWrappedFunctionNames = false;

djasper wrote:
> maybe: .. and always indents. ?
Sure, done.


Repository:
  rC Clang

https://reviews.llvm.org/D45004



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


[PATCH] D45498: [clang-format] Don't insert space between ObjC class and lightweight generic

2018-04-12 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 142186.
benhamilton marked an inline comment as done.
benhamilton added a comment.

Avoid else after return. Clean up logic so it doesn't need a comment.


Repository:
  rC Clang

https://reviews.llvm.org/D45498

Files:
  lib/Format/TokenAnnotator.cpp
  unittests/Format/FormatTestObjC.cpp


Index: unittests/Format/FormatTestObjC.cpp
===
--- unittests/Format/FormatTestObjC.cpp
+++ unittests/Format/FormatTestObjC.cpp
@@ -299,13 +299,13 @@
"+ (id)init;\n"
"@end");
 
-  verifyFormat("@interface Foo  : Bar  {\n"
+  verifyFormat("@interface Foo : Bar  {\n"
"  int _i;\n"
"}\n"
"+ (id)init;\n"
"@end");
 
-  verifyFormat("@interface Foo > : Xyzzy  {\n"
+  verifyFormat("@interface Foo> : Xyzzy  {\n"
"  int _i;\n"
"}\n"
"+ (id)init;\n"
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -2349,9 +2349,12 @@
: Style.SpacesInParentheses;
   if (Right.isOneOf(tok::semi, tok::comma))
 return false;
-  if (Right.is(tok::less) && Line.Type == LT_ObjCDecl &&
-  Style.ObjCSpaceBeforeProtocolList)
-return true;
+  if (Right.is(tok::less) && Line.Type == LT_ObjCDecl) {
+bool IsLightweightGeneric =
+Right.MatchingParen && Right.MatchingParen->Next &&
+Right.MatchingParen->Next->is(tok::colon);
+return !IsLightweightGeneric && Style.ObjCSpaceBeforeProtocolList;
+  }
   if (Right.is(tok::less) && Left.is(tok::kw_template))
 return Style.SpaceAfterTemplateKeyword;
   if (Left.isOneOf(tok::exclaim, tok::tilde))


Index: unittests/Format/FormatTestObjC.cpp
===
--- unittests/Format/FormatTestObjC.cpp
+++ unittests/Format/FormatTestObjC.cpp
@@ -299,13 +299,13 @@
"+ (id)init;\n"
"@end");
 
-  verifyFormat("@interface Foo  : Bar  {\n"
+  verifyFormat("@interface Foo : Bar  {\n"
"  int _i;\n"
"}\n"
"+ (id)init;\n"
"@end");
 
-  verifyFormat("@interface Foo > : Xyzzy  {\n"
+  verifyFormat("@interface Foo> : Xyzzy  {\n"
"  int _i;\n"
"}\n"
"+ (id)init;\n"
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -2349,9 +2349,12 @@
: Style.SpacesInParentheses;
   if (Right.isOneOf(tok::semi, tok::comma))
 return false;
-  if (Right.is(tok::less) && Line.Type == LT_ObjCDecl &&
-  Style.ObjCSpaceBeforeProtocolList)
-return true;
+  if (Right.is(tok::less) && Line.Type == LT_ObjCDecl) {
+bool IsLightweightGeneric =
+Right.MatchingParen && Right.MatchingParen->Next &&
+Right.MatchingParen->Next->is(tok::colon);
+return !IsLightweightGeneric && Style.ObjCSpaceBeforeProtocolList;
+  }
   if (Right.is(tok::less) && Left.is(tok::kw_template))
 return Style.SpaceAfterTemplateKeyword;
   if (Left.isOneOf(tok::exclaim, tok::tilde))
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45564: [analyzer] Fix null deref in AnyFunctionCall::getRuntimeDefinition

2018-04-12 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added a comment.

We encountered the same problem but did not have time yet to submit the patch. 
We have literally the same fix internally, so it looks good to me. One minor 
style nit inline.

Could you add your repro as a regression test? You can also extend existing CTU 
tests just make sure to trigger the crash before the patch.

Thank you for the submission and the minimal reproducer.




Comment at: lib/StaticAnalyzer/Core/CallEvent.cpp:390
   const FunctionDecl *FD = getDecl();
+  if (!FD) {
+return {};

We usually do not write the braces for single statements.


Repository:
  rC Clang

https://reviews.llvm.org/D45564



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


r329917 - [clang-format] Don't insert space between ObjC class and lightweight generic

2018-04-12 Thread Ben Hamilton via cfe-commits
Author: benhamilton
Date: Thu Apr 12 08:11:51 2018
New Revision: 329917

URL: http://llvm.org/viewvc/llvm-project?rev=329917=rev
Log:
[clang-format] Don't insert space between ObjC class and lightweight generic

Summary:
In D45185, I added clang-format parser support for Objective-C
generics. However, I didn't touch the whitespace logic, so they
got the same space logic as Objective-C protocol lists.

In every example in the Apple SDK and in the documentation,
there is no space between the class name and the opening `<`
for the lightweight generic specification, so this diff
removes the space and updates the tests.

Test Plan: Tests updated. Ran tests with:
  % make -j16 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: djasper, jolesiak

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

Modified:
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/unittests/Format/FormatTestObjC.cpp

Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=329917=329916=329917=diff
==
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Thu Apr 12 08:11:51 2018
@@ -2349,9 +2349,12 @@ bool TokenAnnotator::spaceRequiredBetwee
: Style.SpacesInParentheses;
   if (Right.isOneOf(tok::semi, tok::comma))
 return false;
-  if (Right.is(tok::less) && Line.Type == LT_ObjCDecl &&
-  Style.ObjCSpaceBeforeProtocolList)
-return true;
+  if (Right.is(tok::less) && Line.Type == LT_ObjCDecl) {
+bool IsLightweightGeneric =
+Right.MatchingParen && Right.MatchingParen->Next &&
+Right.MatchingParen->Next->is(tok::colon);
+return !IsLightweightGeneric && Style.ObjCSpaceBeforeProtocolList;
+  }
   if (Right.is(tok::less) && Left.is(tok::kw_template))
 return Style.SpaceAfterTemplateKeyword;
   if (Left.isOneOf(tok::exclaim, tok::tilde))

Modified: cfe/trunk/unittests/Format/FormatTestObjC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestObjC.cpp?rev=329917=329916=329917=diff
==
--- cfe/trunk/unittests/Format/FormatTestObjC.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestObjC.cpp Thu Apr 12 08:11:51 2018
@@ -299,13 +299,13 @@ TEST_F(FormatTestObjC, FormatObjCInterfa
"+ (id)init;\n"
"@end");
 
-  verifyFormat("@interface Foo  : Bar  {\n"
+  verifyFormat("@interface Foo : Bar  {\n"
"  int _i;\n"
"}\n"
"+ (id)init;\n"
"@end");
 
-  verifyFormat("@interface Foo > : Xyzzy  {\n"
+  verifyFormat("@interface Foo> : Xyzzy  {\n"
"  int _i;\n"
"}\n"
"+ (id)init;\n"


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


r329916 - [clang-format] Always indent wrapped Objective-C selector names

2018-04-12 Thread Ben Hamilton via cfe-commits
Author: benhamilton
Date: Thu Apr 12 08:11:48 2018
New Revision: 329916

URL: http://llvm.org/viewvc/llvm-project?rev=329916=rev
Log:
[clang-format] Always indent wrapped Objective-C selector names

Summary:
Currently, indentation of Objective-C method names which are wrapped
onto the next line due to a long return type is controlled by the
style option `IndentWrappedFunctionNames`.

This diff changes the behavior so we always indent wrapped Objective-C
selector names.

NOTE: I partially reverted 
https://github.com/llvm-mirror/clang/commit/6159c0fbd1876c7f5f984b4830c664cc78f16e2e
 / rL242484, as it was causing wrapped selectors to be double-indented. Its 
tests in FormatTestObjC.cpp still pass.

Test Plan: Tests updated. Ran tests with:
  % make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: djasper, jolesiak, stephanemoore, thakis

Reviewed By: djasper

Subscribers: stephanemoore, klimek, cfe-commits

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

Modified:
cfe/trunk/lib/Format/ContinuationIndenter.cpp
cfe/trunk/unittests/Format/FormatTest.cpp
cfe/trunk/unittests/Format/FormatTestObjC.cpp

Modified: cfe/trunk/lib/Format/ContinuationIndenter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/ContinuationIndenter.cpp?rev=329916=329915=329916=diff
==
--- cfe/trunk/lib/Format/ContinuationIndenter.cpp (original)
+++ cfe/trunk/lib/Format/ContinuationIndenter.cpp Thu Apr 12 08:11:48 2018
@@ -26,6 +26,13 @@
 namespace clang {
 namespace format {
 
+// Returns true if a TT_SelectorName should be indented when wrapped,
+// false otherwise.
+static bool shouldIndentWrappedSelectorName(const FormatStyle ,
+LineType LineType) {
+  return Style.IndentWrappedFunctionNames || LineType == LT_ObjCMethodDecl;
+}
+
 // Returns the length of everything up to the first possible line break after
 // the ), ], } or > matching \c Tok.
 static unsigned getLengthToMatchingParen(const FormatToken ) {
@@ -698,7 +705,7 @@ unsigned ContinuationIndenter::addTokenO
 State.Stack.back().AlignColons = false;
   } else {
 State.Stack.back().ColonPos =
-(Style.IndentWrappedFunctionNames
+(shouldIndentWrappedSelectorName(Style, State.Line->Type)
  ? std::max(State.Stack.back().Indent,
 State.FirstIndent + Style.ContinuationIndentWidth)
  : State.Stack.back().Indent) +
@@ -897,7 +904,7 @@ unsigned ContinuationIndenter::getNewLin
   if (NextNonComment->is(TT_SelectorName)) {
 if (!State.Stack.back().ObjCSelectorNameFound) {
   unsigned MinIndent = State.Stack.back().Indent;
-  if (Style.IndentWrappedFunctionNames)
+  if (shouldIndentWrappedSelectorName(Style, State.Line->Type))
 MinIndent = std::max(MinIndent,
  State.FirstIndent + 
Style.ContinuationIndentWidth);
   // If LongestObjCSelectorName is 0, we are indenting the first
@@ -1000,13 +1007,8 @@ unsigned ContinuationIndenter::moveState
   if (Current.isMemberAccess())
 State.Stack.back().StartOfFunctionCall =
 !Current.NextOperator ? 0 : State.Column;
-  if (Current.is(TT_SelectorName)) {
+  if (Current.is(TT_SelectorName))
 State.Stack.back().ObjCSelectorNameFound = true;
-if (Style.IndentWrappedFunctionNames) {
-  State.Stack.back().Indent =
-  State.FirstIndent + Style.ContinuationIndentWidth;
-}
-  }
   if (Current.is(TT_CtorInitializerColon) &&
   Style.BreakConstructorInitializers != FormatStyle::BCIS_AfterColon) {
 // Indent 2 from the column, so:

Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=329916=329915=329916=diff
==
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Thu Apr 12 08:11:48 2018
@@ -7678,16 +7678,18 @@ TEST_F(FormatTest, FormatForObjectiveCMe
 
   // When the function name has to be wrapped.
   FormatStyle Style = getLLVMStyle();
+  // ObjC ignores IndentWrappedFunctionNames when wrapping methods
+  // and always indents instead.
   Style.IndentWrappedFunctionNames = false;
   verifyFormat("- (SomeLongType *)\n"
-   "veryLooongName:(NSString)aa\n"
-   "   anotherName:(NSString)bb {\n"
+   "veryLooongName:(NSString)aa\n"
+   "   anotherName:(NSString)bb {\n"
"}",
Style);
   Style.IndentWrappedFunctionNames = true;
   verifyFormat("- (SomeLongType *)\n"
-   "veryLooongName:(NSString)aa\n"
-   "   

r329919 - [clang-format] Do not break after ObjC category open paren

2018-04-12 Thread Ben Hamilton via cfe-commits
Author: benhamilton
Date: Thu Apr 12 08:11:55 2018
New Revision: 329919

URL: http://llvm.org/viewvc/llvm-project?rev=329919=rev
Log:
[clang-format] Do not break after ObjC category open paren

Summary:
Previously, `clang-format` would break Objective-C
category extensions after the opening parenthesis to avoid
breaking the protocol list:

```
% echo "@interface c (ccc)  { }" | \
  clang-format -assume-filename=foo.h -style="{BasedOnStyle: llvm, \
  ColumnLimit: 40}"
@interface c (
ccc)  {
}
```

This looks fairly odd, as we could have kept the category extension
on the previous line.

Category extensions are a single item, so they are generally very
short compared to protocol lists. We should prefer breaking after the
opening `<` of the protocol list over breaking after the opening `(`
of the category extension.

With this diff, we now avoid breaking after the category extension's
open paren, which causes us to break after the protocol list's
open angle bracket:

```
% echo "@interface c (ccc)  { }" | \
  ./bin/clang-format -assume-filename=foo.h -style="{BasedOnStyle: llvm, \
  ColumnLimit: 40}"
@interface c (ccc) <
c> {
}
```

Test Plan: New test added. Confirmed test failed before diff and
  passed after diff by running:
  % make -j16 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: djasper, jolesiak

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

Modified:
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/unittests/Format/FormatTestObjC.cpp

Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=329919=329918=329919=diff
==
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Thu Apr 12 08:11:55 2018
@@ -2272,6 +2272,13 @@ unsigned TokenAnnotator::splitPenalty(co
   if (Left.is(tok::colon) && Left.is(TT_ObjCMethodExpr))
 return Line.MightBeFunctionDecl ? 50 : 500;
 
+  // In Objective-C type declarations, avoid breaking after the category's
+  // open paren (we'll prefer breaking after the protocol list's opening
+  // angle bracket, if present).
+  if (Line.Type == LT_ObjCDecl && Left.is(tok::l_paren) && Left.Previous &&
+  Left.Previous->isOneOf(tok::identifier, tok::greater))
+return 500;
+
   if (Left.is(tok::l_paren) && InFunctionDecl &&
   Style.AlignAfterOpenBracket != FormatStyle::BAS_DontAlign)
 return 100;

Modified: cfe/trunk/unittests/Format/FormatTestObjC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestObjC.cpp?rev=329919=329918=329919=diff
==
--- cfe/trunk/unittests/Format/FormatTestObjC.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestObjC.cpp Thu Apr 12 08:11:55 2018
@@ -334,6 +334,9 @@ TEST_F(FormatTestObjC, FormatObjCInterfa
"c, c,\n"
"c, c> {\n"
"}");
+  verifyFormat("@interface c (ccc) <\n"
+   "c> {\n"
+   "}");
   Style.ObjCBinPackProtocolList = FormatStyle::BPS_Never;
   verifyFormat("@interface d () <\n"
"d,\n"


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


[PATCH] D45521: [clang-format] Improve ObjC guessing heuristic by supporting all @keywords

2018-04-12 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL329918: [clang-format] Improve ObjC guessing heuristic by 
supporting all @keywords (authored by benhamilton, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D45521

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


Index: cfe/trunk/lib/Format/Format.cpp
===
--- cfe/trunk/lib/Format/Format.cpp
+++ cfe/trunk/lib/Format/Format.cpp
@@ -1465,6 +1465,7 @@
 "NSAffineTransform",
 "NSArray",
 "NSAttributedString",
+"NSBlockOperation",
 "NSBundle",
 "NSCache",
 "NSCalendar",
@@ -1480,6 +1481,7 @@
 "NSIndexPath",
 "NSIndexSet",
 "NSInteger",
+"NSInvocationOperation",
 "NSLocale",
 "NSMapTable",
 "NSMutableArray",
@@ -1494,9 +1496,13 @@
 "NSNumber",
 "NSNumberFormatter",
 "NSObject",
+"NSOperation",
+"NSOperationQueue",
+"NSOperationQueuePriority",
 "NSOrderedSet",
 "NSPoint",
 "NSPointerArray",
+"NSQualityOfService",
 "NSRange",
 "NSRect",
 "NSRegularExpression",
@@ -1518,10 +1524,7 @@
   for (const FormatToken *FormatTok = Line->First; FormatTok;
FormatTok = FormatTok->Next) {
 if ((FormatTok->Previous && FormatTok->Previous->is(tok::at) &&
- (FormatTok->isObjCAtKeyword(tok::objc_interface) ||
-  FormatTok->isObjCAtKeyword(tok::objc_implementation) ||
-  FormatTok->isObjCAtKeyword(tok::objc_protocol) ||
-  FormatTok->isObjCAtKeyword(tok::objc_end) ||
+ (FormatTok->Tok.getObjCKeywordID() != tok::objc_not_keyword ||
   FormatTok->isOneOf(tok::numeric_constant, tok::l_square,
  tok::l_brace))) ||
 (FormatTok->Tok.isAnyIdentifier() &&
Index: cfe/trunk/unittests/Format/FormatTest.cpp
===
--- cfe/trunk/unittests/Format/FormatTest.cpp
+++ cfe/trunk/unittests/Format/FormatTest.cpp
@@ -12118,6 +12118,12 @@
   EXPECT_EQ(FormatStyle::LK_ObjC, guessLanguage("foo.mm", ""));
   EXPECT_EQ(FormatStyle::LK_Cpp, guessLanguage("foo.h", ""));
   EXPECT_EQ(FormatStyle::LK_ObjC, guessLanguage("foo.h", "@interface 
Foo\n@end\n"));
+  EXPECT_EQ(
+  FormatStyle::LK_ObjC,
+  guessLanguage("foo.h", "#define TRY(x, y) @try { x; } @finally { y; }"));
+  EXPECT_EQ(FormatStyle::LK_ObjC,
+guessLanguage("foo.h", "#define AVAIL(x) @available(x, *))"));
+  EXPECT_EQ(FormatStyle::LK_ObjC, guessLanguage("foo.h", "@class Foo;"));
   EXPECT_EQ(FormatStyle::LK_Cpp, guessLanguage("foo", ""));
   EXPECT_EQ(FormatStyle::LK_ObjC, guessLanguage("foo", "@interface 
Foo\n@end\n"));
   EXPECT_EQ(FormatStyle::LK_ObjC,


Index: cfe/trunk/lib/Format/Format.cpp
===
--- cfe/trunk/lib/Format/Format.cpp
+++ cfe/trunk/lib/Format/Format.cpp
@@ -1465,6 +1465,7 @@
 "NSAffineTransform",
 "NSArray",
 "NSAttributedString",
+"NSBlockOperation",
 "NSBundle",
 "NSCache",
 "NSCalendar",
@@ -1480,6 +1481,7 @@
 "NSIndexPath",
 "NSIndexSet",
 "NSInteger",
+"NSInvocationOperation",
 "NSLocale",
 "NSMapTable",
 "NSMutableArray",
@@ -1494,9 +1496,13 @@
 "NSNumber",
 "NSNumberFormatter",
 "NSObject",
+"NSOperation",
+"NSOperationQueue",
+"NSOperationQueuePriority",
 "NSOrderedSet",
 "NSPoint",
 "NSPointerArray",
+"NSQualityOfService",
 "NSRange",
 "NSRect",
 "NSRegularExpression",
@@ -1518,10 +1524,7 @@
   for (const FormatToken *FormatTok = Line->First; FormatTok;
FormatTok = FormatTok->Next) {
 if ((FormatTok->Previous && FormatTok->Previous->is(tok::at) &&
- (FormatTok->isObjCAtKeyword(tok::objc_interface) ||
-  FormatTok->isObjCAtKeyword(tok::objc_implementation) ||
-  FormatTok->isObjCAtKeyword(tok::objc_protocol) ||
-  FormatTok->isObjCAtKeyword(tok::objc_end) ||
+ (FormatTok->Tok.getObjCKeywordID() != tok::objc_not_keyword ||
   FormatTok->isOneOf(tok::numeric_constant, tok::l_square,
  tok::l_brace))) ||
 (FormatTok->Tok.isAnyIdentifier() &&
Index: cfe/trunk/unittests/Format/FormatTest.cpp
===
--- cfe/trunk/unittests/Format/FormatTest.cpp
+++ cfe/trunk/unittests/Format/FormatTest.cpp
@@ -12118,6 +12118,12 @@
   EXPECT_EQ(FormatStyle::LK_ObjC, guessLanguage("foo.mm", ""));
   EXPECT_EQ(FormatStyle::LK_Cpp, 

[PATCH] D45498: [clang-format] Don't insert space between ObjC class and lightweight generic

2018-04-12 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL329917: [clang-format] Dont insert space between ObjC 
class and lightweight generic (authored by benhamilton, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D45498

Files:
  cfe/trunk/lib/Format/TokenAnnotator.cpp
  cfe/trunk/unittests/Format/FormatTestObjC.cpp


Index: cfe/trunk/lib/Format/TokenAnnotator.cpp
===
--- cfe/trunk/lib/Format/TokenAnnotator.cpp
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp
@@ -2349,9 +2349,12 @@
: Style.SpacesInParentheses;
   if (Right.isOneOf(tok::semi, tok::comma))
 return false;
-  if (Right.is(tok::less) && Line.Type == LT_ObjCDecl &&
-  Style.ObjCSpaceBeforeProtocolList)
-return true;
+  if (Right.is(tok::less) && Line.Type == LT_ObjCDecl) {
+bool IsLightweightGeneric =
+Right.MatchingParen && Right.MatchingParen->Next &&
+Right.MatchingParen->Next->is(tok::colon);
+return !IsLightweightGeneric && Style.ObjCSpaceBeforeProtocolList;
+  }
   if (Right.is(tok::less) && Left.is(tok::kw_template))
 return Style.SpaceAfterTemplateKeyword;
   if (Left.isOneOf(tok::exclaim, tok::tilde))
Index: cfe/trunk/unittests/Format/FormatTestObjC.cpp
===
--- cfe/trunk/unittests/Format/FormatTestObjC.cpp
+++ cfe/trunk/unittests/Format/FormatTestObjC.cpp
@@ -299,13 +299,13 @@
"+ (id)init;\n"
"@end");
 
-  verifyFormat("@interface Foo  : Bar  {\n"
+  verifyFormat("@interface Foo : Bar  {\n"
"  int _i;\n"
"}\n"
"+ (id)init;\n"
"@end");
 
-  verifyFormat("@interface Foo > : Xyzzy  {\n"
+  verifyFormat("@interface Foo> : Xyzzy  {\n"
"  int _i;\n"
"}\n"
"+ (id)init;\n"


Index: cfe/trunk/lib/Format/TokenAnnotator.cpp
===
--- cfe/trunk/lib/Format/TokenAnnotator.cpp
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp
@@ -2349,9 +2349,12 @@
: Style.SpacesInParentheses;
   if (Right.isOneOf(tok::semi, tok::comma))
 return false;
-  if (Right.is(tok::less) && Line.Type == LT_ObjCDecl &&
-  Style.ObjCSpaceBeforeProtocolList)
-return true;
+  if (Right.is(tok::less) && Line.Type == LT_ObjCDecl) {
+bool IsLightweightGeneric =
+Right.MatchingParen && Right.MatchingParen->Next &&
+Right.MatchingParen->Next->is(tok::colon);
+return !IsLightweightGeneric && Style.ObjCSpaceBeforeProtocolList;
+  }
   if (Right.is(tok::less) && Left.is(tok::kw_template))
 return Style.SpaceAfterTemplateKeyword;
   if (Left.isOneOf(tok::exclaim, tok::tilde))
Index: cfe/trunk/unittests/Format/FormatTestObjC.cpp
===
--- cfe/trunk/unittests/Format/FormatTestObjC.cpp
+++ cfe/trunk/unittests/Format/FormatTestObjC.cpp
@@ -299,13 +299,13 @@
"+ (id)init;\n"
"@end");
 
-  verifyFormat("@interface Foo  : Bar  {\n"
+  verifyFormat("@interface Foo : Bar  {\n"
"  int _i;\n"
"}\n"
"+ (id)init;\n"
"@end");
 
-  verifyFormat("@interface Foo > : Xyzzy  {\n"
+  verifyFormat("@interface Foo> : Xyzzy  {\n"
"  int _i;\n"
"}\n"
"+ (id)init;\n"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r329918 - [clang-format] Improve ObjC guessing heuristic by supporting all @keywords

2018-04-12 Thread Ben Hamilton via cfe-commits
Author: benhamilton
Date: Thu Apr 12 08:11:53 2018
New Revision: 329918

URL: http://llvm.org/viewvc/llvm-project?rev=329918=rev
Log:
[clang-format] Improve ObjC guessing heuristic by supporting all @keywords

Summary:
This diff improves the Objective-C guessing heuristic by
replacing the hard-coded list of a subset of Objective-C @keywords
with a general check which supports all @keywords.

I also added a few more Foundation keywords which were missing from
the heuristic.

Test Plan: Unit tests updated. Ran tests with:
  % make -j16 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: djasper, jolesiak

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

Modified: cfe/trunk/lib/Format/Format.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=329918=329917=329918=diff
==
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Thu Apr 12 08:11:53 2018
@@ -1465,6 +1465,7 @@ private:
 "NSAffineTransform",
 "NSArray",
 "NSAttributedString",
+"NSBlockOperation",
 "NSBundle",
 "NSCache",
 "NSCalendar",
@@ -1480,6 +1481,7 @@ private:
 "NSIndexPath",
 "NSIndexSet",
 "NSInteger",
+"NSInvocationOperation",
 "NSLocale",
 "NSMapTable",
 "NSMutableArray",
@@ -1494,9 +1496,13 @@ private:
 "NSNumber",
 "NSNumberFormatter",
 "NSObject",
+"NSOperation",
+"NSOperationQueue",
+"NSOperationQueuePriority",
 "NSOrderedSet",
 "NSPoint",
 "NSPointerArray",
+"NSQualityOfService",
 "NSRange",
 "NSRect",
 "NSRegularExpression",
@@ -1518,10 +1524,7 @@ private:
   for (const FormatToken *FormatTok = Line->First; FormatTok;
FormatTok = FormatTok->Next) {
 if ((FormatTok->Previous && FormatTok->Previous->is(tok::at) &&
- (FormatTok->isObjCAtKeyword(tok::objc_interface) ||
-  FormatTok->isObjCAtKeyword(tok::objc_implementation) ||
-  FormatTok->isObjCAtKeyword(tok::objc_protocol) ||
-  FormatTok->isObjCAtKeyword(tok::objc_end) ||
+ (FormatTok->Tok.getObjCKeywordID() != tok::objc_not_keyword ||
   FormatTok->isOneOf(tok::numeric_constant, tok::l_square,
  tok::l_brace))) ||
 (FormatTok->Tok.isAnyIdentifier() &&

Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=329918=329917=329918=diff
==
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Thu Apr 12 08:11:53 2018
@@ -12118,6 +12118,12 @@ TEST_F(FormatTest, FileAndCode) {
   EXPECT_EQ(FormatStyle::LK_ObjC, guessLanguage("foo.mm", ""));
   EXPECT_EQ(FormatStyle::LK_Cpp, guessLanguage("foo.h", ""));
   EXPECT_EQ(FormatStyle::LK_ObjC, guessLanguage("foo.h", "@interface 
Foo\n@end\n"));
+  EXPECT_EQ(
+  FormatStyle::LK_ObjC,
+  guessLanguage("foo.h", "#define TRY(x, y) @try { x; } @finally { y; }"));
+  EXPECT_EQ(FormatStyle::LK_ObjC,
+guessLanguage("foo.h", "#define AVAIL(x) @available(x, *))"));
+  EXPECT_EQ(FormatStyle::LK_ObjC, guessLanguage("foo.h", "@class Foo;"));
   EXPECT_EQ(FormatStyle::LK_Cpp, guessLanguage("foo", ""));
   EXPECT_EQ(FormatStyle::LK_ObjC, guessLanguage("foo", "@interface 
Foo\n@end\n"));
   EXPECT_EQ(FormatStyle::LK_ObjC,


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


[PATCH] D45004: [clang-format] Always indent wrapped Objective-C selector names

2018-04-12 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC329916: [clang-format] Always indent wrapped Objective-C 
selector names (authored by benhamilton, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D45004?vs=142183=142187#toc

Repository:
  rC Clang

https://reviews.llvm.org/D45004

Files:
  lib/Format/ContinuationIndenter.cpp
  unittests/Format/FormatTest.cpp
  unittests/Format/FormatTestObjC.cpp

Index: lib/Format/ContinuationIndenter.cpp
===
--- lib/Format/ContinuationIndenter.cpp
+++ lib/Format/ContinuationIndenter.cpp
@@ -26,6 +26,13 @@
 namespace clang {
 namespace format {
 
+// Returns true if a TT_SelectorName should be indented when wrapped,
+// false otherwise.
+static bool shouldIndentWrappedSelectorName(const FormatStyle ,
+LineType LineType) {
+  return Style.IndentWrappedFunctionNames || LineType == LT_ObjCMethodDecl;
+}
+
 // Returns the length of everything up to the first possible line break after
 // the ), ], } or > matching \c Tok.
 static unsigned getLengthToMatchingParen(const FormatToken ) {
@@ -698,7 +705,7 @@
 State.Stack.back().AlignColons = false;
   } else {
 State.Stack.back().ColonPos =
-(Style.IndentWrappedFunctionNames
+(shouldIndentWrappedSelectorName(Style, State.Line->Type)
  ? std::max(State.Stack.back().Indent,
 State.FirstIndent + Style.ContinuationIndentWidth)
  : State.Stack.back().Indent) +
@@ -897,7 +904,7 @@
   if (NextNonComment->is(TT_SelectorName)) {
 if (!State.Stack.back().ObjCSelectorNameFound) {
   unsigned MinIndent = State.Stack.back().Indent;
-  if (Style.IndentWrappedFunctionNames)
+  if (shouldIndentWrappedSelectorName(Style, State.Line->Type))
 MinIndent = std::max(MinIndent,
  State.FirstIndent + Style.ContinuationIndentWidth);
   // If LongestObjCSelectorName is 0, we are indenting the first
@@ -1000,13 +1007,8 @@
   if (Current.isMemberAccess())
 State.Stack.back().StartOfFunctionCall =
 !Current.NextOperator ? 0 : State.Column;
-  if (Current.is(TT_SelectorName)) {
+  if (Current.is(TT_SelectorName))
 State.Stack.back().ObjCSelectorNameFound = true;
-if (Style.IndentWrappedFunctionNames) {
-  State.Stack.back().Indent =
-  State.FirstIndent + Style.ContinuationIndentWidth;
-}
-  }
   if (Current.is(TT_CtorInitializerColon) &&
   Style.BreakConstructorInitializers != FormatStyle::BCIS_AfterColon) {
 // Indent 2 from the column, so:
Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -7678,16 +7678,18 @@
 
   // When the function name has to be wrapped.
   FormatStyle Style = getLLVMStyle();
+  // ObjC ignores IndentWrappedFunctionNames when wrapping methods
+  // and always indents instead.
   Style.IndentWrappedFunctionNames = false;
   verifyFormat("- (SomeLongType *)\n"
-   "veryLooongName:(NSString)aa\n"
-   "   anotherName:(NSString)bb {\n"
+   "veryLooongName:(NSString)aa\n"
+   "   anotherName:(NSString)bb {\n"
"}",
Style);
   Style.IndentWrappedFunctionNames = true;
   verifyFormat("- (SomeLongType *)\n"
-   "veryLooongName:(NSString)aa\n"
-   "   anotherName:(NSString)bb {\n"
+   "veryLooongName:(NSString)cc\n"
+   "   anotherName:(NSString)dd {\n"
"}",
Style);
 
Index: unittests/Format/FormatTestObjC.cpp
===
--- unittests/Format/FormatTestObjC.cpp
+++ unittests/Format/FormatTestObjC.cpp
@@ -536,28 +536,25 @@
"ofSize:(size_t)height\n"
"  :(size_t)width;");
   Style.ColumnLimit = 40;
-  // Make sure selectors with 0, 1, or more arguments are not indented
-  // when IndentWrappedFunctionNames is false.
-  Style.IndentWrappedFunctionNames = false;
+  // Make sure selectors with 0, 1, or more arguments are indented when wrapped.
   verifyFormat("- (a)\n"
-   ";\n");
+   ";\n");
   verifyFormat("- (a)\n"
-   ":(int)a;\n");
+   ":(int)a;\n");
   verifyFormat("- (a)\n"
-   

[PATCH] D45526: [clang-format] Do not break after ObjC category open paren

2018-04-12 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL329919: [clang-format] Do not break after ObjC category open 
paren (authored by benhamilton, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D45526

Files:
  cfe/trunk/lib/Format/TokenAnnotator.cpp
  cfe/trunk/unittests/Format/FormatTestObjC.cpp


Index: cfe/trunk/lib/Format/TokenAnnotator.cpp
===
--- cfe/trunk/lib/Format/TokenAnnotator.cpp
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp
@@ -2272,6 +2272,13 @@
   if (Left.is(tok::colon) && Left.is(TT_ObjCMethodExpr))
 return Line.MightBeFunctionDecl ? 50 : 500;
 
+  // In Objective-C type declarations, avoid breaking after the category's
+  // open paren (we'll prefer breaking after the protocol list's opening
+  // angle bracket, if present).
+  if (Line.Type == LT_ObjCDecl && Left.is(tok::l_paren) && Left.Previous &&
+  Left.Previous->isOneOf(tok::identifier, tok::greater))
+return 500;
+
   if (Left.is(tok::l_paren) && InFunctionDecl &&
   Style.AlignAfterOpenBracket != FormatStyle::BAS_DontAlign)
 return 100;
Index: cfe/trunk/unittests/Format/FormatTestObjC.cpp
===
--- cfe/trunk/unittests/Format/FormatTestObjC.cpp
+++ cfe/trunk/unittests/Format/FormatTestObjC.cpp
@@ -334,6 +334,9 @@
"c, c,\n"
"c, c> {\n"
"}");
+  verifyFormat("@interface c (ccc) <\n"
+   "c> {\n"
+   "}");
   Style.ObjCBinPackProtocolList = FormatStyle::BPS_Never;
   verifyFormat("@interface d () <\n"
"d,\n"


Index: cfe/trunk/lib/Format/TokenAnnotator.cpp
===
--- cfe/trunk/lib/Format/TokenAnnotator.cpp
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp
@@ -2272,6 +2272,13 @@
   if (Left.is(tok::colon) && Left.is(TT_ObjCMethodExpr))
 return Line.MightBeFunctionDecl ? 50 : 500;
 
+  // In Objective-C type declarations, avoid breaking after the category's
+  // open paren (we'll prefer breaking after the protocol list's opening
+  // angle bracket, if present).
+  if (Line.Type == LT_ObjCDecl && Left.is(tok::l_paren) && Left.Previous &&
+  Left.Previous->isOneOf(tok::identifier, tok::greater))
+return 500;
+
   if (Left.is(tok::l_paren) && InFunctionDecl &&
   Style.AlignAfterOpenBracket != FormatStyle::BAS_DontAlign)
 return 100;
Index: cfe/trunk/unittests/Format/FormatTestObjC.cpp
===
--- cfe/trunk/unittests/Format/FormatTestObjC.cpp
+++ cfe/trunk/unittests/Format/FormatTestObjC.cpp
@@ -334,6 +334,9 @@
"c, c,\n"
"c, c> {\n"
"}");
+  verifyFormat("@interface c (ccc) <\n"
+   "c> {\n"
+   "}");
   Style.ObjCBinPackProtocolList = FormatStyle::BPS_Never;
   verifyFormat("@interface d () <\n"
"d,\n"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45458: MallocChecker refactoring of calls checkers

2018-04-12 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added a comment.

In https://reviews.llvm.org/D45458#1062342, @NoQ wrote:

> @xazax.hun: do you think the approach you took in the `Valist` checker is 
> applicable here? Did you like how it ended up working? Cause i'd love to see 
> `CallDescription` and initializer lists used for readability here. And i'd 
> love to see branches replaced with map lookups. And i'm not sure if anybody 
> has written code that has all the stuff that i'd love to see.


Overall the `CallDescription` interface works really well if you do not need 
anything more advanced, e.g. supporting overloads. I can imagine that its 
current implementation is slightly less efficient since the lazy initialization 
logic of the identifiers are repeated for every identifier but that also makes 
it less bug-prone (do not have the implicit assumption that a set of 
identifiers should always exist together).

It would be great to extend the interface in the future, but one of the reasons 
I was reluctant to do so yet is performance. E.g.: having a simple check that a 
checker is interested only in global C functions is better than having this 
check repeated in every call description object in an array, or making it 
possible to do a StringSwitch like optimization with multiple statically known 
CallDescription objects would also be awesome.

But I think most of the time these tests would not be used on the hot paths 
anyways, so as long its current expressive power is sufficient, I prefer code 
that is utilizing this tool. It tends to make the code slightly shorter.


Repository:
  rC Clang

https://reviews.llvm.org/D45458



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


[PATCH] D45177: CStringChecker, check strlcpy/strlcat

2018-04-12 Thread David CARLIER via Phabricator via cfe-commits
devnexen added a comment.

ping


Repository:
  rC Clang

https://reviews.llvm.org/D45177



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


[PATCH] D45513: [clangd] Add line and column number to the index symbol.

2018-04-12 Thread Sam McCall via Phabricator via cfe-commits
sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

LG, with

- consider reverting the bitpacking stuff
- comment about utf-16
- clang-format :)




Comment at: clangd/index/SymbolCollector.cpp:202
+SymbolLocation::Position Pos;
+// Position is 0-based while source location is 1-based.
+Pos.Line = SM.getLineNumber(FileId, Offset) - 1;

nit: SourceManager is 1-based (or returns 1-based data here).
SourceLocation uses 0-based offsets, not 1-based line/column.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D45513



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


[PATCH] D45532: [StaticAnalyzer] Checker to find uninitialized fields after a constructor call

2018-04-12 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus added a comment.

Thank you for all your comments so far! I'll probably only be able to update 
the diff tomorrow (with me being in the GMT + 1 timezone).

> That's a lot of code, so it'll take me some time to understand what's going 
> on here. You might be able to help me by the large patch in smaller logical 
> chunks.

I know, and I tried to look for ways to split this checker into smaller logical 
chunks, but I didn't find a satisfying solution. I'll be sure to review the 
comments I have in the code so it's as easy as possible to understand what I 
did and why I did it. Also, I'd be delighted to help any way I can to guide you 
through the code! :)

> That said, your checker finds non-bugs, which is always risky. Sometimes the 
> user should be allowed to initialize the field after construction but before 
> the first use as a potentially important performance optimization. [...] If a 
> user wants to have his codebase "analyzer-clean", would he be able to 
> suppress the warning without changing the behavior of the program?

I didn't implement anything explicitly to suppress warnings, so if there is 
nothing in the CSA by default for it, I'm afraid this isn't possible (just yet).

My checker is mainly a tool to enforce the rule that every field should be 
initialized in a C++ object. While I see that this approach could result  
reduced performance, I think it's fine to say that those users who find this 
important (by 'this' I mean not initializing every field) should not enable 
this checker.

Nevertheless, I'd be happy to know what you think of this.

> Did you find any such intentionally uninitialized fields with your checker? 
> Were there many of those?

I ran the checker on some projects, but it's little difficult to analyze larger 
ones as this checker emits very important information in notes, and those are 
not yet part of the plist output. But it's coming: 
https://reviews.llvm.org/D45407! I'll be sure to answer these questions as soon 
as I can.




Comment at: lib/StaticAnalyzer/Checkers/CtorUninitializedMemberChecker.cpp:187
+
+  if (isCalledByConstructor(Context))
+return;

whisperity wrote:
> I think somewhere there should be a bit of reasoning why exactly these cases 
> are ignored by the checker.
At this function's declaration I have some comments describing what this does 
and why it does it. Did you find it insufficient?



Comment at: test/Analysis/ctor-uninitialized-member-inheritance.cpp:24
+  : NonPolymorphicLeft1(int{}) {
+y = 420;
+z = 420;

whisperity wrote:
> The literal `420` is repeated //everywhere// in this file. I think this (the 
> same value appearing over and over again) will make debugging bad if 
> something goes haywire and one has to look at memory dumps, 
> control-flow-graphs, etc.
Would you say that I should rather use a different number for each test case?


https://reviews.llvm.org/D45532



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


[PATCH] D45532: [StaticAnalyzer] Checker to find uninitialized fields after a constructor call

2018-04-12 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus added inline comments.



Comment at: test/Analysis/ctor-uninitialized-member-inheritance.cpp:24
+  : NonPolymorphicLeft1(int{}) {
+y = 420;
+z = 420;

Szelethus wrote:
> whisperity wrote:
> > The literal `420` is repeated //everywhere// in this file. I think this 
> > (the same value appearing over and over again) will make debugging bad if 
> > something goes haywire and one has to look at memory dumps, 
> > control-flow-graphs, etc.
> Would you say that I should rather use a different number for each test case?
I mean, a different number for each variable within a test case.


https://reviews.llvm.org/D45532



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


[PATCH] D45407: [StaticAnalyzer] Added notes to the plist output

2018-04-12 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus added a comment.

Did you have some time to check on those programs? :)


Repository:
  rC Clang

https://reviews.llvm.org/D45407



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


[libcxx] r329979 - [libcxx] [test] Use TEST_IGNORE_NODISCARD.

2018-04-12 Thread Stephan T. Lavavej via cfe-commits
Author: stl_msft
Date: Thu Apr 12 17:07:48 2018
New Revision: 329979

URL: http://llvm.org/viewvc/llvm-project?rev=329979=rev
Log:
[libcxx] [test] Use TEST_IGNORE_NODISCARD.

Fixes D45595.

Modified:

libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp

Modified: 
libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp?rev=329979=329978=329979=diff
==
--- 
libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp
 Thu Apr 12 17:07:48 2018
@@ -33,7 +33,7 @@ int main()
 Myconv myconv;
 try
 {
-(void)myconv.to_bytes(L"\xDA83");
+TEST_IGNORE_NODISCARD myconv.to_bytes(L"\xDA83");
 assert(false);
 }
 catch (const std::range_error&)
@@ -41,7 +41,7 @@ int main()
 }
 try
 {
-(void)myconv.from_bytes('\xA5');
+TEST_IGNORE_NODISCARD myconv.from_bytes('\xA5');
 assert(false);
 }
 catch (const std::range_error&)
@@ -56,7 +56,7 @@ int main()
 #ifndef TEST_HAS_NO_EXCEPTIONS
 try
 {
-(void)myconv.from_bytes('\xA5');
+TEST_IGNORE_NODISCARD myconv.from_bytes('\xA5');
 assert(false);
 }
 catch (const std::range_error&)


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


[PATCH] D45529: [CMake] Set the default ABI version for Fuchsia in CMake as well

2018-04-12 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai accepted this revision.
smeenai added a comment.
This revision is now accepted and ready to land.

Eric accepted on IRC.


Repository:
  rCXX libc++

https://reviews.llvm.org/D45529



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


Buildbot numbers for the week of 4/1/2018 - 4/7/2018

2018-04-12 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the last week of 4/1/2018 - 4/7/2018.

Please see the same data in attached csv files:

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

Thanks

Galina


The longest time each builder was red during the week:
 buildername | was_red
-+-
 clang-ppc64be-linux-lnt | 88:29:57
 clang-cmake-armv7-global-isel   | 62:48:48
 clang-cmake-aarch64-full| 61:35:19
 clang-s390x-linux-lnt   | 60:10:10
 clang-cmake-aarch64-lld | 60:05:58
 clang-cmake-armv7-lnt   | 58:46:15
 clang-cmake-aarch64-quick   | 58:45:23
 clang-cmake-aarch64-global-isel | 58:44:38
 clang-ppc64le-linux-lnt | 57:58:01
 clang-cmake-x86_64-avx2-linux   | 57:49:16
 clang-cmake-x86_64-avx2-linux-perf  | 57:46:39
 clang-cmake-x86_64-sde-avx512-linux | 57:43:40
 clang-cmake-armv8-lnt   | 57:36:33
 perf-x86_64-penryn-O3-polly-parallel-fast   | 56:17:47
 aosp-O3-polly-before-vectorizer-unprofitable| 47:47:06
 libcxx-libcxxabi-libunwind-x86_64-linux-debian  | 47:27:30
 clang-s390x-linux-multistage| 41:11:51
 clang-bpf-build | 39:10:19
 clang-ppc64be-linux-multistage  | 38:54:30
 clang-cmake-armv8-selfhost-neon | 38:24:39
 clang-cmake-armv7-full  | 38:07:00
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast| 37:07:58
 lldb-x86_64-ubuntu-14.04-android| 34:55:36
 clang-s390x-linux   | 33:27:00
 clang-cmake-armv7-selfhost  | 33:18:49
 clang-cmake-armv7-selfhost-neon | 33:09:46
 clang-ppc64le-linux-multistage  | 32:43:40
 clang-x64-ninja-win7| 32:35:51
 clang-x86-windows-msvc2015  | 32:31:10
 clang-atom-d525-fedora-rel  | 32:01:24
 clang-ppc64le-linux | 31:44:57
 clang-cmake-armv7-quick | 31:24:33
 clang-cmake-thumbv7-full-sh | 31:22:23
 clang-cmake-armv8-quick | 30:39:51
 clang-cmake-armv8-full  | 30:26:52
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast  | 30:20:58
 clang-ppc64be-linux | 29:36:47
 sanitizer-x86_64-linux-android  | 29:24:35
 sanitizer-ppc64be-linux | 28:48:04
 clang-hexagon-elf   | 27:04:11
 libcxx-libcxxabi-singlethreaded-x86_64-linux-debian | 24:38:54
 clang-with-thin-lto-windows | 23:23:54
 libcxx-libcxxabi-x86_64-linux-debian| 21:01:48
 libcxx-libcxxabi-x86_64-linux-debian-noexceptions   | 21:01:20
 clang-with-lto-ubuntu   | 14:00:45
 clang-with-thin-lto-ubuntu  | 12:28:20
 clang-lld-x86_64-2stage | 09:51:06
 llvm-clang-x86_64-expensive-checks-win  | 09:16:20
 sanitizer-x86_64-linux-bootstrap-msan   | 07:16:31
 lld-x86_64-darwin13 | 06:28:04
 sanitizer-x86_64-linux-bootstrap-ubsan  | 06:14:39
 llvm-hexagon-elf| 04:48:16
 libcxx-libcxxabi-x86_64-linux-ubuntu-asan   | 04:10:32
 clang-x86_64-debian-fast| 04:09:13
 lldb-windows7-android   | 03:31:03
 libcxx-libcxxabi-libunwind-armv7-linux-noexceptions | 03:29:36
 libcxx-libcxxabi-libunwind-armv7-linux  | 03:08:35
 lldb-amd64-ninja-netbsd8| 02:50:46
 lld-x86_64-win7 | 02:24:32
 libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan  | 01:54:00
 sanitizer-x86_64-linux-bootstrap| 01:49:25
 reverse-iteration   | 01:43:03
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx03  | 01:35:18
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx11  | 01:28:56
 sanitizer-x86_64-linux-fast | 01:28:46
 clang-cuda-build| 01:28:17
 

[PATCH] D44882: [clangd] Implementation of workspace/symbol request

2018-04-12 Thread Marc-Andre Laperle via Phabricator via cfe-commits
malaperle added a comment.

In https://reviews.llvm.org/D44882#1065632, @sammccall wrote:

> In https://reviews.llvm.org/D44882#1065631, @malaperle wrote:
>
> > In https://reviews.llvm.org/D44882#1065622, @sammccall wrote:
> >
> > > Still LG, thanks!
> > >  I'll look into the testing issue.
> >
> >
> > I thought about it after... I think it was because I was trying to test 
> > with std::unordered_map (to prevent multiple results) which needs 
> > std=c++11, I'll try with something else.
>
>
> Worth a shot, but don't count on it - for c++ clang switched to using 
> std=c++11 by default a while ago.


I just tried "std::basic_ostringstream" and that works. Seems safer.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D44882



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


r329879 - [Sema][ObjC] Ensure that the return type of an ObjC method is a complete

2018-04-12 Thread Akira Hatanaka via cfe-commits
Author: ahatanak
Date: Wed Apr 11 23:01:41 2018
New Revision: 329879

URL: http://llvm.org/viewvc/llvm-project?rev=329879=rev
Log:
[Sema][ObjC] Ensure that the return type of an ObjC method is a complete
type.

Copy the code in ActOnStartOfFunctionDef that checks a function's return
type to ActOnStartOfObjCMethodDef. This fixes an assertion failure in
IRGen caused by an uninstantiated return type.

rdar://problem/38691818

Added:
cfe/trunk/test/CodeGenObjCXX/instantiate-return.mm
Modified:
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
cfe/trunk/test/SemaObjCXX/instantiate-method-return.mm

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=329879=329878=329879=diff
==
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Wed Apr 11 23:01:41 2018
@@ -341,6 +341,13 @@ void Sema::ActOnStartOfObjCMethodDef(Sco
   if (!MDecl)
 return;
 
+  QualType ResultType = MDecl->getReturnType();
+  if (!ResultType->isDependentType() && !ResultType->isVoidType() &&
+  !MDecl->isInvalidDecl() &&
+  RequireCompleteType(MDecl->getLocation(), ResultType,
+  diag::err_func_def_incomplete_result))
+MDecl->setInvalidDecl();
+
   // Allow all of Sema to see that we are entering a method definition.
   PushDeclContext(FnBodyScope, MDecl);
   PushFunctionScope();

Added: cfe/trunk/test/CodeGenObjCXX/instantiate-return.mm
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/instantiate-return.mm?rev=329879=auto
==
--- cfe/trunk/test/CodeGenObjCXX/instantiate-return.mm (added)
+++ cfe/trunk/test/CodeGenObjCXX/instantiate-return.mm Wed Apr 11 23:01:41 2018
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -std=c++11 -o - %s 
| FileCheck %s
+
+template 
+struct TemplateClass {
+  int a = 0;
+};
+
+struct S0;
+
+@interface C1
+- (TemplateClass)m1;
+@end
+
+// This code used to assert in CodeGen because the return type 
TemplateClass
+// wasn't instantiated.
+
+// CHECK: define internal i32 @"\01-[C1 m1]"(
+
+@implementation C1
+- (TemplateClass)m1 {
+}
+@end

Modified: cfe/trunk/test/SemaObjCXX/instantiate-method-return.mm
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/instantiate-method-return.mm?rev=329879=329878=329879=diff
==
--- cfe/trunk/test/SemaObjCXX/instantiate-method-return.mm (original)
+++ cfe/trunk/test/SemaObjCXX/instantiate-method-return.mm Wed Apr 11 23:01:41 
2018
@@ -1,14 +1,14 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
-// expected-no-diagnostics
 // PR7386
 
 @class NSObject;
 
-class A;
-template class V {};
+class A; // expected-note {{forward declaration of 'A'}}
+template class V { T x; }; // expected-error {{field has incomplete 
type 'A'}}
 
 @protocol Protocol
 - (V)protocolMethod;
+- (V)method2;
 @end
 
 
@@ -24,4 +24,6 @@ template class V {};
 - (V)protocolMethod {
   V va; return va;
 }
+- (V)method2 { // expected-note {{in instantiation of}}
+}
 @end


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


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

2018-04-12 Thread Timothée Fivaz via Phabricator via cfe-commits
TimF added a comment.

In https://reviews.llvm.org/D28462#1064789, @enyquist wrote:

> As far as I know, there are no updates required from me for this pull 
> request-- I rebased on the main trunk recently, and will do it again tonight 
> to be sure. So it should be compiling/working just fine.
>  I believe it is just awaiting final approval from somebody.


I have done a checkout of both trunks yesterday, applied your patch and 
compiled everything. It is working flawlessly and now the defines are correctly 
aligned. I still hope they'll merge it because I prefer using an official 
release, but until then it will do the job. 
Thanks a lot for your work on this feature, it was the last point preventing us 
from using clang-format. (embedded development too, so we have lots of 
defines). And thanks to all the LLVM contributors by the way :-)


Repository:
  rL LLVM

https://reviews.llvm.org/D28462



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


[PATCH] D45403: Make [[maybe_unused]] work with static data members

2018-04-12 Thread S. B. Tam via Phabricator via cfe-commits
cpplearner added a comment.

I do not have commit access. Could someone commit the change for me?


https://reviews.llvm.org/D45403



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


r329882 - ObjCGNU: Fix empty v3 protocols being emitted two fields short

2018-04-12 Thread David Chisnall via cfe-commits
Author: theraven
Date: Wed Apr 11 23:46:15 2018
New Revision: 329882

URL: http://llvm.org/viewvc/llvm-project?rev=329882=rev
Log:
ObjCGNU: Fix empty v3 protocols being emitted two fields short

Summary:
Protocols that were being referenced but could not be fully realized were being 
emitted without `properties`/`optional_properties`. Since all v3 protocols must 
be 9 processor words wide, the lack of these fields is catastrophic for the 
runtime.

As an example, the runtime cannot know 
[here](https://github.com/gnustep/libobjc2/blob/master/protocol.c#L73) that 
`properties` and `optional_properties` are invalid.

Reviewers: rjmccall, theraven

Reviewed By: rjmccall, theraven

Subscribers: cfe-commits

Tags: #clang

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

Added:
cfe/trunk/test/CodeGenObjC/gnu-empty-protocol-v3.m
Modified:
cfe/trunk/lib/CodeGen/CGObjCGNU.cpp

Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=329882=329881=329882=diff
==
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Wed Apr 11 23:46:15 2018
@@ -1748,11 +1748,13 @@ CGObjCGNU::GenerateEmptyProtocol(const s
   llvm::ConstantInt::get(Int32Ty, ProtocolVersion), IdTy));
 
   Elements.add(MakeConstantString(ProtocolName, ".objc_protocol_name"));
-  Elements.add(ProtocolList);
-  Elements.add(MethodList);
-  Elements.add(MethodList);
-  Elements.add(MethodList);
-  Elements.add(MethodList);
+  Elements.add(ProtocolList); /* .protocol_list */
+  Elements.add(MethodList);   /* .instance_methods */
+  Elements.add(MethodList);   /* .class_methods */
+  Elements.add(MethodList);   /* .optional_instance_methods */
+  Elements.add(MethodList);   /* .optional_class_methods */
+  Elements.add(NULLPtr);  /* .properties */
+  Elements.add(NULLPtr);  /* .optional_properties */
   return Elements.finishAndCreateGlobal(".objc_protocol",
 CGM.getPointerAlign());
 }

Added: cfe/trunk/test/CodeGenObjC/gnu-empty-protocol-v3.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/gnu-empty-protocol-v3.m?rev=329882=auto
==
--- cfe/trunk/test/CodeGenObjC/gnu-empty-protocol-v3.m (added)
+++ cfe/trunk/test/CodeGenObjC/gnu-empty-protocol-v3.m Wed Apr 11 23:46:15 2018
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fobjc-runtime=gnustep-1.9 
-emit-llvm -o - %s | FileCheck %s
+
+@protocol X;
+
+__attribute__((objc_root_class))
+@interface Z 
+@end
+
+@implementation Z
+@end
+
+// CHECK:  @.objc_protocol_list = internal global { i8*, i32, [0 x i8*] } 
zeroinitializer, align 4
+// CHECK:  @.objc_method_list = internal global { i32, [0 x { i8*, i8* }] 
} zeroinitializer, align 4
+// CHECK:  @.objc_protocol_name = private unnamed_addr constant [2 x i8] 
c"X\00", align 1
+// CHECK:  @.objc_protocol = internal global { i8*, i8*, { i8*, i32, [0 x 
i8*] }*, { i32, [0 x { i8*, i8* }] }*, { i32, [0 x { i8*, i8* }] }*, { i32, [0 
x { i8*, i8* }] }*, { i32, [0 x { i8*, i8* }] }*, i8*, i8* } {
+// CHECK-SAME: i8* inttoptr (i32 3 to i8*),
+// CHECK-SAME: i8* getelementptr inbounds ([2 x i8], [2 x i8]* 
@.objc_protocol_name, i32 0, i32 0),
+// CHECK-SAME: { i8*, i32, [0 x i8*] }* @.objc_protocol_list,
+// CHECK-SAME: { i32, [0 x { i8*, i8* }] }* @.objc_method_list,
+// CHECK-SAME: { i32, [0 x { i8*, i8* }] }* @.objc_method_list,
+// CHECK-SAME: { i32, [0 x { i8*, i8* }] }* @.objc_method_list,
+// CHECK-SAME: { i32, [0 x { i8*, i8* }] }* @.objc_method_list,
+// CHECK-SAME: i8* null,
+// CHECK-SAME: i8* null
+// CHECK-SAME: }, align 4


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


[clang-tools-extra] r329881 - [clang-tidy] [modernize-use-auto] Fix test modernize-use-auto-new-remove-stars.cpp after improvement

2018-04-12 Thread Zinovy Nis via cfe-commits
Author: zinovy.nis
Date: Wed Apr 11 23:45:47 2018
New Revision: 329881

URL: http://llvm.org/viewvc/llvm-project?rev=329881=rev
Log:
[clang-tidy] [modernize-use-auto] Fix test 
modernize-use-auto-new-remove-stars.cpp  after improvement

'tooling::fixit::getText' considers a length of "int *" to be 5 instead of 3 
in a new algorithm in https://reviews.llvm.org/rCTE329873. It was the root of 
the test failure.


Modified:

clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-new-remove-stars.cpp

Modified: 
clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-new-remove-stars.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-new-remove-stars.cpp?rev=329881=329880=329881=diff
==
--- 
clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-new-remove-stars.cpp 
(original)
+++ 
clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-new-remove-stars.cpp 
Wed Apr 11 23:45:47 2018
@@ -1,5 +1,5 @@
 // RUN: %check_clang_tidy %s modernize-use-auto %t -- \
-// RUN:   -config="{CheckOptions: [{key: modernize-use-auto.RemoveStars, 
value: '1'}]}" \
+// RUN:   -config="{CheckOptions: [{key: modernize-use-auto.RemoveStars, 
value: '1'}, {key: modernize-use-auto.MinTypeNameLength, value: '0'}]}" \
 // RUN:   -- -std=c++11
 
 class MyType {};


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


[PATCH] D45305: ObjCGNU: Fix empty v3 protocols being emitted two fields short

2018-04-12 Thread David Chisnall via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC329882: ObjCGNU: Fix empty v3 protocols being emitted two 
fields short (authored by theraven, committed by ).

Repository:
  rC Clang

https://reviews.llvm.org/D45305

Files:
  lib/CodeGen/CGObjCGNU.cpp
  test/CodeGenObjC/gnu-empty-protocol-v3.m


Index: lib/CodeGen/CGObjCGNU.cpp
===
--- lib/CodeGen/CGObjCGNU.cpp
+++ lib/CodeGen/CGObjCGNU.cpp
@@ -1748,11 +1748,13 @@
   llvm::ConstantInt::get(Int32Ty, ProtocolVersion), IdTy));
 
   Elements.add(MakeConstantString(ProtocolName, ".objc_protocol_name"));
-  Elements.add(ProtocolList);
-  Elements.add(MethodList);
-  Elements.add(MethodList);
-  Elements.add(MethodList);
-  Elements.add(MethodList);
+  Elements.add(ProtocolList); /* .protocol_list */
+  Elements.add(MethodList);   /* .instance_methods */
+  Elements.add(MethodList);   /* .class_methods */
+  Elements.add(MethodList);   /* .optional_instance_methods */
+  Elements.add(MethodList);   /* .optional_class_methods */
+  Elements.add(NULLPtr);  /* .properties */
+  Elements.add(NULLPtr);  /* .optional_properties */
   return Elements.finishAndCreateGlobal(".objc_protocol",
 CGM.getPointerAlign());
 }
Index: test/CodeGenObjC/gnu-empty-protocol-v3.m
===
--- test/CodeGenObjC/gnu-empty-protocol-v3.m
+++ test/CodeGenObjC/gnu-empty-protocol-v3.m
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fobjc-runtime=gnustep-1.9 
-emit-llvm -o - %s | FileCheck %s
+
+@protocol X;
+
+__attribute__((objc_root_class))
+@interface Z 
+@end
+
+@implementation Z
+@end
+
+// CHECK:  @.objc_protocol_list = internal global { i8*, i32, [0 x i8*] } 
zeroinitializer, align 4
+// CHECK:  @.objc_method_list = internal global { i32, [0 x { i8*, i8* }] 
} zeroinitializer, align 4
+// CHECK:  @.objc_protocol_name = private unnamed_addr constant [2 x i8] 
c"X\00", align 1
+// CHECK:  @.objc_protocol = internal global { i8*, i8*, { i8*, i32, [0 x 
i8*] }*, { i32, [0 x { i8*, i8* }] }*, { i32, [0 x { i8*, i8* }] }*, { i32, [0 
x { i8*, i8* }] }*, { i32, [0 x { i8*, i8* }] }*, i8*, i8* } {
+// CHECK-SAME: i8* inttoptr (i32 3 to i8*),
+// CHECK-SAME: i8* getelementptr inbounds ([2 x i8], [2 x i8]* 
@.objc_protocol_name, i32 0, i32 0),
+// CHECK-SAME: { i8*, i32, [0 x i8*] }* @.objc_protocol_list,
+// CHECK-SAME: { i32, [0 x { i8*, i8* }] }* @.objc_method_list,
+// CHECK-SAME: { i32, [0 x { i8*, i8* }] }* @.objc_method_list,
+// CHECK-SAME: { i32, [0 x { i8*, i8* }] }* @.objc_method_list,
+// CHECK-SAME: { i32, [0 x { i8*, i8* }] }* @.objc_method_list,
+// CHECK-SAME: i8* null,
+// CHECK-SAME: i8* null
+// CHECK-SAME: }, align 4


Index: lib/CodeGen/CGObjCGNU.cpp
===
--- lib/CodeGen/CGObjCGNU.cpp
+++ lib/CodeGen/CGObjCGNU.cpp
@@ -1748,11 +1748,13 @@
   llvm::ConstantInt::get(Int32Ty, ProtocolVersion), IdTy));
 
   Elements.add(MakeConstantString(ProtocolName, ".objc_protocol_name"));
-  Elements.add(ProtocolList);
-  Elements.add(MethodList);
-  Elements.add(MethodList);
-  Elements.add(MethodList);
-  Elements.add(MethodList);
+  Elements.add(ProtocolList); /* .protocol_list */
+  Elements.add(MethodList);   /* .instance_methods */
+  Elements.add(MethodList);   /* .class_methods */
+  Elements.add(MethodList);   /* .optional_instance_methods */
+  Elements.add(MethodList);   /* .optional_class_methods */
+  Elements.add(NULLPtr);  /* .properties */
+  Elements.add(NULLPtr);  /* .optional_properties */
   return Elements.finishAndCreateGlobal(".objc_protocol",
 CGM.getPointerAlign());
 }
Index: test/CodeGenObjC/gnu-empty-protocol-v3.m
===
--- test/CodeGenObjC/gnu-empty-protocol-v3.m
+++ test/CodeGenObjC/gnu-empty-protocol-v3.m
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fobjc-runtime=gnustep-1.9 -emit-llvm -o - %s | FileCheck %s
+
+@protocol X;
+
+__attribute__((objc_root_class))
+@interface Z 
+@end
+
+@implementation Z
+@end
+
+// CHECK:  @.objc_protocol_list = internal global { i8*, i32, [0 x i8*] } zeroinitializer, align 4
+// CHECK:  @.objc_method_list = internal global { i32, [0 x { i8*, i8* }] } zeroinitializer, align 4
+// CHECK:  @.objc_protocol_name = private unnamed_addr constant [2 x i8] c"X\00", align 1
+// CHECK:  @.objc_protocol = internal global { i8*, i8*, { i8*, i32, [0 x i8*] }*, { i32, [0 x { i8*, i8* }] }*, { i32, [0 x { i8*, i8* }] }*, { i32, [0 x { i8*, i8* }] }*, { i32, [0 x { i8*, i8* }] }*, i8*, i8* } {
+// CHECK-SAME: i8* inttoptr (i32 3 to i8*),
+// CHECK-SAME: i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.objc_protocol_name, i32 0, i32 0),
+// 

<    1   2