Re: [PATCH] D14121: Thumb state not being passed through to LLVM triple when using clang -cc1as

2015-10-28 Thread Alexandros Lamprineas via cfe-commits
labrinea updated this revision to Diff 38633.
labrinea added a comment.

I think the patch is now in it's final shape:

- kept TY_PP_Asm check
- added darwin and armv7m in checks in tests
- cached IsMProfile
- used ARM::parseArchVersion


http://reviews.llvm.org/D14121

Files:
  lib/Driver/ToolChain.cpp
  test/Driver/arm-ias-Wa.s

Index: test/Driver/arm-ias-Wa.s
===
--- test/Driver/arm-ias-Wa.s
+++ test/Driver/arm-ias-Wa.s
@@ -62,3 +62,20 @@
 // RUN:   | FileCheck --check-prefix=CHECK-DUP-HDIV %s
 // CHECK-DUP-HDIV: "-target-feature" "-hwdiv-arm"
 // CHECK-DUP-HDIV: "-target-feature" "+hwdiv"
+
+// == Triple
+// RUN: %clang -target armv7a-none-eabi -c %s -### 2>&1 \
+// RUN: %clang -target x86_64-apple-darwin -arch armv7 -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-A-PROFILE %s
+// CHECK-A-PROFILE: "-triple" "armv7-{{.*}}"
+
+// RUN: %clang -target armv7r-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-R-PROFILE %s
+// CHECK-R-PROFILE: "-triple" "armv7r-none--eabi"
+
+// RUN: %clang -target armv7m-none-eabi -c %s -### 2>&1 \
+// RUN: %clang -target thumbv7m-none-eabi -c %s -### 2>&1 \
+// RUN: %clang -target x86_64-apple-darwin -arch armv7m -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-M-PROFILE %s
+// CHECK-M-PROFILE: "-triple" "thumbv7m-{{.*}}"
+
Index: lib/Driver/ToolChain.cpp
===
--- lib/Driver/ToolChain.cpp
+++ lib/Driver/ToolChain.cpp
@@ -23,10 +23,12 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/TargetRegistry.h"
+#include "llvm/Support/TargetParser.h"
 
 using namespace clang::driver;
 using namespace clang::driver::tools;
 using namespace clang;
+using namespace llvm;
 using namespace llvm::opt;
 
 static llvm::opt::Arg *GetRTTIArgument(const ArgList &Args) {
@@ -466,9 +468,9 @@
 : tools::arm::getARMTargetCPU(MCPU, MArch, Triple);
 StringRef Suffix =
   tools::arm::getLLVMArchSuffixForARM(CPU, MArch, Triple);
-bool ThumbDefault = Suffix.startswith("v6m") || Suffix.startswith("v7m") ||
-  Suffix.startswith("v7em") ||
-  (Suffix.startswith("v7") && getTriple().isOSBinFormatMachO());
+bool IsMProfile = ARM::parseArchProfile(Suffix) == ARM::PK_M;
+bool ThumbDefault = IsMProfile || (ARM::parseArchVersion(Suffix) == 7 && 
+   getTriple().isOSBinFormatMachO());
 // FIXME: this is invalid for WindowsCE
 if (getTriple().isOSWindows())
   ThumbDefault = true;
@@ -478,9 +480,9 @@
 else
   ArchName = "arm";
 
-// Assembly files should start in ARM mode.
-if (InputType != types::TY_PP_Asm &&
-Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, 
ThumbDefault))
+// Assembly files should start in ARM mode, unless arch is M-profile.
+if (IsMProfile || (InputType != types::TY_PP_Asm &&
+ Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, 
ThumbDefault)))
 {
   if (IsBigEndian)
 ArchName = "thumbeb";


Index: test/Driver/arm-ias-Wa.s
===
--- test/Driver/arm-ias-Wa.s
+++ test/Driver/arm-ias-Wa.s
@@ -62,3 +62,20 @@
 // RUN:   | FileCheck --check-prefix=CHECK-DUP-HDIV %s
 // CHECK-DUP-HDIV: "-target-feature" "-hwdiv-arm"
 // CHECK-DUP-HDIV: "-target-feature" "+hwdiv"
+
+// == Triple
+// RUN: %clang -target armv7a-none-eabi -c %s -### 2>&1 \
+// RUN: %clang -target x86_64-apple-darwin -arch armv7 -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-A-PROFILE %s
+// CHECK-A-PROFILE: "-triple" "armv7-{{.*}}"
+
+// RUN: %clang -target armv7r-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-R-PROFILE %s
+// CHECK-R-PROFILE: "-triple" "armv7r-none--eabi"
+
+// RUN: %clang -target armv7m-none-eabi -c %s -### 2>&1 \
+// RUN: %clang -target thumbv7m-none-eabi -c %s -### 2>&1 \
+// RUN: %clang -target x86_64-apple-darwin -arch armv7m -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-M-PROFILE %s
+// CHECK-M-PROFILE: "-triple" "thumbv7m-{{.*}}"
+
Index: lib/Driver/ToolChain.cpp
===
--- lib/Driver/ToolChain.cpp
+++ lib/Driver/ToolChain.cpp
@@ -23,10 +23,12 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/TargetRegistry.h"
+#include "llvm/Support/TargetParser.h"
 
 using namespace clang::driver;
 using namespace clang::driver::tools;
 using namespace clang;
+using namespace llvm;
 using namespace llvm::opt;
 
 static llvm::opt::Arg *GetRTTIArgument(const ArgList &Args) {
@@ -466,9 +468,9 @@
 : tools::arm::getARMTargetCPU(MCPU, MArch, Triple);
 StringRef Suffix =
   tools::arm::getLLVMArchS

[clang-tools-extra] r251503 - clang-tools-extra/test/clang-tidy/modernize-redundant-void-arg.c: Use provided by clang, instead of .

2015-10-28 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Wed Oct 28 04:22:21 2015
New Revision: 251503

URL: http://llvm.org/viewvc/llvm-project?rev=251503&view=rev
Log:
clang-tools-extra/test/clang-tidy/modernize-redundant-void-arg.c: Use 
 provided by clang, instead of .

Modified:
clang-tools-extra/trunk/test/clang-tidy/modernize-redundant-void-arg.c

Modified: clang-tools-extra/trunk/test/clang-tidy/modernize-redundant-void-arg.c
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-redundant-void-arg.c?rev=251503&r1=251502&r2=251503&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/modernize-redundant-void-arg.c 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/modernize-redundant-void-arg.c Wed 
Oct 28 04:22:21 2015
@@ -1,6 +1,6 @@
 // RUN: clang-tidy -checks=-*,modernize-redundant-void-arg %s -- -x c | count 0
 
-#include 
+#include 
 
 extern int i;
 


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


Re: [PATCH] D14121: Thumb state not being passed through to LLVM triple when using clang -cc1as

2015-10-28 Thread Renato Golin via cfe-commits
rengolin added a comment.

LGTM, thanks!


http://reviews.llvm.org/D14121



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


r251507 - When running clang with an arm triple such as '--target=thumbv7m-none-eabi'

2015-10-28 Thread Alexandros Lamprineas via cfe-commits
Author: alelab01
Date: Wed Oct 28 05:10:03 2015
New Revision: 251507

URL: http://llvm.org/viewvc/llvm-project?rev=251507&view=rev
Log:
When running clang with an arm triple such as '--target=thumbv7m-none-eabi'
that has a thumb only CPU by default (cortex-m3), and when using the assembler,
the default thumb state of the CPU does not get passed via the triple to LLVM:

$ clang -target thumbv7m-none-eabi -c -v test.s
clang -cc1as ... -triple armv7m-none--eabi ... test.s

Differential Revision: http://reviews.llvm.org/D14121

Modified:
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/test/Driver/arm-ias-Wa.s

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=251507&r1=251506&r2=251507&view=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Wed Oct 28 05:10:03 2015
@@ -23,10 +23,12 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/TargetRegistry.h"
+#include "llvm/Support/TargetParser.h"
 
 using namespace clang::driver;
 using namespace clang::driver::tools;
 using namespace clang;
+using namespace llvm;
 using namespace llvm::opt;
 
 static llvm::opt::Arg *GetRTTIArgument(const ArgList &Args) {
@@ -466,9 +468,9 @@ std::string ToolChain::ComputeLLVMTriple
 : tools::arm::getARMTargetCPU(MCPU, MArch, Triple);
 StringRef Suffix =
   tools::arm::getLLVMArchSuffixForARM(CPU, MArch, Triple);
-bool ThumbDefault = Suffix.startswith("v6m") || Suffix.startswith("v7m") ||
-  Suffix.startswith("v7em") ||
-  (Suffix.startswith("v7") && getTriple().isOSBinFormatMachO());
+bool IsMProfile = ARM::parseArchProfile(Suffix) == ARM::PK_M;
+bool ThumbDefault = IsMProfile || (ARM::parseArchVersion(Suffix) == 7 && 
+   getTriple().isOSBinFormatMachO());
 // FIXME: this is invalid for WindowsCE
 if (getTriple().isOSWindows())
   ThumbDefault = true;
@@ -478,9 +480,9 @@ std::string ToolChain::ComputeLLVMTriple
 else
   ArchName = "arm";
 
-// Assembly files should start in ARM mode.
-if (InputType != types::TY_PP_Asm &&
-Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, 
ThumbDefault))
+// Assembly files should start in ARM mode, unless arch is M-profile.
+if (IsMProfile || (InputType != types::TY_PP_Asm &&
+ Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, 
ThumbDefault)))
 {
   if (IsBigEndian)
 ArchName = "thumbeb";

Modified: cfe/trunk/test/Driver/arm-ias-Wa.s
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-ias-Wa.s?rev=251507&r1=251506&r2=251507&view=diff
==
--- cfe/trunk/test/Driver/arm-ias-Wa.s (original)
+++ cfe/trunk/test/Driver/arm-ias-Wa.s Wed Oct 28 05:10:03 2015
@@ -62,3 +62,20 @@
 // RUN:   | FileCheck --check-prefix=CHECK-DUP-HDIV %s
 // CHECK-DUP-HDIV: "-target-feature" "-hwdiv-arm"
 // CHECK-DUP-HDIV: "-target-feature" "+hwdiv"
+
+// == Triple
+// RUN: %clang -target armv7a-none-eabi -c %s -### 2>&1 \
+// RUN: %clang -target x86_64-apple-darwin -arch armv7 -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-A-PROFILE %s
+// CHECK-A-PROFILE: "-triple" "armv7-{{.*}}"
+
+// RUN: %clang -target armv7r-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-R-PROFILE %s
+// CHECK-R-PROFILE: "-triple" "armv7r-none--eabi"
+
+// RUN: %clang -target armv7m-none-eabi -c %s -### 2>&1 \
+// RUN: %clang -target thumbv7m-none-eabi -c %s -### 2>&1 \
+// RUN: %clang -target x86_64-apple-darwin -arch armv7m -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-M-PROFILE %s
+// CHECK-M-PROFILE: "-triple" "thumbv7m-{{.*}}"
+


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


Re: [PATCH] D14121: Thumb state not being passed through to LLVM triple when using clang -cc1as

2015-10-28 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL251507: When running clang with an arm triple such as 
'--target=thumbv7m-none-eabi' (authored by alelab01).

Changed prior to commit:
  http://reviews.llvm.org/D14121?vs=38633&id=38643#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14121

Files:
  cfe/trunk/lib/Driver/ToolChain.cpp
  cfe/trunk/test/Driver/arm-ias-Wa.s

Index: cfe/trunk/test/Driver/arm-ias-Wa.s
===
--- cfe/trunk/test/Driver/arm-ias-Wa.s
+++ cfe/trunk/test/Driver/arm-ias-Wa.s
@@ -62,3 +62,20 @@
 // RUN:   | FileCheck --check-prefix=CHECK-DUP-HDIV %s
 // CHECK-DUP-HDIV: "-target-feature" "-hwdiv-arm"
 // CHECK-DUP-HDIV: "-target-feature" "+hwdiv"
+
+// == Triple
+// RUN: %clang -target armv7a-none-eabi -c %s -### 2>&1 \
+// RUN: %clang -target x86_64-apple-darwin -arch armv7 -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-A-PROFILE %s
+// CHECK-A-PROFILE: "-triple" "armv7-{{.*}}"
+
+// RUN: %clang -target armv7r-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-R-PROFILE %s
+// CHECK-R-PROFILE: "-triple" "armv7r-none--eabi"
+
+// RUN: %clang -target armv7m-none-eabi -c %s -### 2>&1 \
+// RUN: %clang -target thumbv7m-none-eabi -c %s -### 2>&1 \
+// RUN: %clang -target x86_64-apple-darwin -arch armv7m -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-M-PROFILE %s
+// CHECK-M-PROFILE: "-triple" "thumbv7m-{{.*}}"
+
Index: cfe/trunk/lib/Driver/ToolChain.cpp
===
--- cfe/trunk/lib/Driver/ToolChain.cpp
+++ cfe/trunk/lib/Driver/ToolChain.cpp
@@ -23,10 +23,12 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/TargetRegistry.h"
+#include "llvm/Support/TargetParser.h"
 
 using namespace clang::driver;
 using namespace clang::driver::tools;
 using namespace clang;
+using namespace llvm;
 using namespace llvm::opt;
 
 static llvm::opt::Arg *GetRTTIArgument(const ArgList &Args) {
@@ -466,9 +468,9 @@
 : tools::arm::getARMTargetCPU(MCPU, MArch, Triple);
 StringRef Suffix =
   tools::arm::getLLVMArchSuffixForARM(CPU, MArch, Triple);
-bool ThumbDefault = Suffix.startswith("v6m") || Suffix.startswith("v7m") ||
-  Suffix.startswith("v7em") ||
-  (Suffix.startswith("v7") && getTriple().isOSBinFormatMachO());
+bool IsMProfile = ARM::parseArchProfile(Suffix) == ARM::PK_M;
+bool ThumbDefault = IsMProfile || (ARM::parseArchVersion(Suffix) == 7 && 
+   getTriple().isOSBinFormatMachO());
 // FIXME: this is invalid for WindowsCE
 if (getTriple().isOSWindows())
   ThumbDefault = true;
@@ -478,9 +480,9 @@
 else
   ArchName = "arm";
 
-// Assembly files should start in ARM mode.
-if (InputType != types::TY_PP_Asm &&
-Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, 
ThumbDefault))
+// Assembly files should start in ARM mode, unless arch is M-profile.
+if (IsMProfile || (InputType != types::TY_PP_Asm &&
+ Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, 
ThumbDefault)))
 {
   if (IsBigEndian)
 ArchName = "thumbeb";


Index: cfe/trunk/test/Driver/arm-ias-Wa.s
===
--- cfe/trunk/test/Driver/arm-ias-Wa.s
+++ cfe/trunk/test/Driver/arm-ias-Wa.s
@@ -62,3 +62,20 @@
 // RUN:   | FileCheck --check-prefix=CHECK-DUP-HDIV %s
 // CHECK-DUP-HDIV: "-target-feature" "-hwdiv-arm"
 // CHECK-DUP-HDIV: "-target-feature" "+hwdiv"
+
+// == Triple
+// RUN: %clang -target armv7a-none-eabi -c %s -### 2>&1 \
+// RUN: %clang -target x86_64-apple-darwin -arch armv7 -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-A-PROFILE %s
+// CHECK-A-PROFILE: "-triple" "armv7-{{.*}}"
+
+// RUN: %clang -target armv7r-none-eabi -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-R-PROFILE %s
+// CHECK-R-PROFILE: "-triple" "armv7r-none--eabi"
+
+// RUN: %clang -target armv7m-none-eabi -c %s -### 2>&1 \
+// RUN: %clang -target thumbv7m-none-eabi -c %s -### 2>&1 \
+// RUN: %clang -target x86_64-apple-darwin -arch armv7m -c %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-M-PROFILE %s
+// CHECK-M-PROFILE: "-triple" "thumbv7m-{{.*}}"
+
Index: cfe/trunk/lib/Driver/ToolChain.cpp
===
--- cfe/trunk/lib/Driver/ToolChain.cpp
+++ cfe/trunk/lib/Driver/ToolChain.cpp
@@ -23,10 +23,12 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/TargetRegistry.h"
+#include "llvm/Support/TargetParser.h"
 
 using namespace clang::driver;
 using namespace clang::driver::tools;
 using namespace clang;
+using namespace llvm;
 using namespace llvm::op

Re: [PATCH] D14014: Checker of proper vfork usage

2015-10-28 Thread Yury Gribov via cfe-commits
ygribov added a comment.

> > This is a valid concern because it greatly complicates enablement of 
> > VforkChecker for a casual user.

> 

> 

> I think at the very least I can check that InsecureAPI is enable and issue a 
> warning to user.


Actually I think that's not a huge problem. InsecureAPI checker would issue a 
warning but not emit a sink node. So it wouldn't influence VforkChecker at all.


http://reviews.llvm.org/D14014



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


[PATCH] D14145: modernize-use-default supports copy constructor and copy-assignment operator.

2015-10-28 Thread Angel Garcia via cfe-commits
angelgarcia created this revision.
angelgarcia added a reviewer: klimek.
angelgarcia added subscribers: alexfh, cfe-commits.

the check will now warn when the user provided definitions of this functions is 
equivalent to the explicitly defaulted ones.

http://reviews.llvm.org/D14145

Files:
  clang-tidy/modernize/UseDefaultCheck.cpp
  test/clang-tidy/modernize-use-default-copy.cpp
  test/clang-tidy/modernize-use-default.cpp

Index: test/clang-tidy/modernize-use-default.cpp
===
--- test/clang-tidy/modernize-use-default.cpp
+++ test/clang-tidy/modernize-use-default.cpp
@@ -135,3 +135,13 @@
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
   // CHECK-FIXES: ~N() override = default;
 };
+
+struct O {
+  O() {
+// Don't erase comments inside the body.
+  }
+  ~O() {
+// Don't erase comments inside the body.
+  }
+};
+
Index: test/clang-tidy/modernize-use-default-copy.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-default-copy.cpp
@@ -0,0 +1,424 @@
+// RUN: %check_clang_tidy %s modernize-use-default %t -- -- -std=c++11 -fno-delayed-template-parsing
+
+// Out of line definition.
+struct OL {
+  OL(const OL &);
+  OL &operator=(const OL &);
+  int Field;
+};
+OL::OL(const OL &Other) : Field(Other.Field) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use '= default' to define a trivial copy constructor [modernize-use-default]
+// CHECK-FIXES: OL::OL(const OL &Other) = default;
+OL &OL::operator=(const OL &Other) {
+  Field = Other.Field;
+  return *this;
+}
+// CHECK-MESSAGES: :[[@LINE-4]]:1: warning: use '= default' to define a trivial copy-assignment operator [modernize-use-default]
+// CHECK-FIXES: OL &OL::operator=(const OL &Other) = default;
+
+// Inline.
+struct IL {
+  IL(const IL &Other) : Field(Other.Field) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: IL(const IL &Other) = default;
+  IL &operator=(const IL &Other) {
+Field = Other.Field;
+return *this;
+  }
+  // CHECK-MESSAGES: :[[@LINE-4]]:3: warning: use '= default'
+  // CHECK-FIXES: IL &operator=(const IL &Other) = default;
+  int Field;
+};
+
+// Wrong type.
+struct WT {
+  WT(const IL &Other) {}
+  WT &operator=(const IL &);
+};
+WT &WT::operator=(const IL &Other) { return *this; }
+
+// Qualifiers.
+struct Qual {
+  Qual(const Qual &Other) : Field(Other.Field), Volatile(Other.Volatile),
+Mutable(Other.Mutable), Reference(Other.Reference),
+Const(Other.Const) {}
+  // CHECK-MESSAGES: :[[@LINE-3]]:3: warning: use '= default'
+  // CHECK-FIXES: Qual(const Qual &Other) = default;
+
+  int Field;
+  volatile char Volatile;
+  mutable bool Mutable;
+  const OL &Reference; // This makes this class non-assignable.
+  const IL Const;  // This also makes this class non-assignable.
+  static int Static;
+};
+
+// Wrong init arguments.
+struct WI {
+  WI(const WI &Other) : Field1(Other.Field1), Field2(Other.Field1) {}
+  WI &operator=(const WI &);
+  int Field1, Field2;
+};
+WI &WI::operator=(const WI &Other) {
+  Field1 = Other.Field1;
+  Field2 = Other.Field1;
+  return *this;
+}
+
+// Missing field.
+struct MF {
+  MF(const MF &Other) : Field1(Other.Field1), Field2(Other.Field2) {}
+  MF &operator=(const MF &);
+  int Field1, Field2, Field3;
+};
+MF &MF::operator=(const MF &Other) {
+  Field1 = Other.Field1;
+  Field2 = Other.Field2;
+  return *this;
+}
+
+struct Comments {
+  Comments(const Comments &Other)
+  /* don't delete */ : /* this comment */ Field(Other.Field) {}
+  int Field;
+};
+
+struct MoreComments {
+  MoreComments(const MoreComments &Other) /* this comment is OK */
+  : Field(Other.Field) {}
+  // CHECK-MESSAGES: :[[@LINE-2]]:3: warning: use '= default'
+  // CHECK-FIXES: MoreComments(const MoreComments &Other) /* this comment is OK */
+  // CHECK-FIXES-NEXT: = default;
+  int Field;
+};
+
+struct ColonInComment {
+  ColonInComment(const ColonInComment &Other) /* : */ : Field(Other.Field) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: ColonInComment(const ColonInComment &Other) /* : */ = default;
+  int Field;
+};
+
+// No members or bases (in particular, no colon).
+struct Empty {
+  Empty(const Empty &Other) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: Empty(const Empty &Other) = default;
+  Empty &operator=(const Empty &);
+};
+Empty &Empty::operator=(const Empty &Other) { return *this; }
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use '= default'
+// CHECK-FIXES: Empty &Empty::operator=(const Empty &Other) = default;
+
+// Bit fields.
+struct BF {
+  BF() = default;
+  BF(const BF &Other) : Field1(Other.Field1), Field2(Other.Field2), Field3(Other.Field3),
+Field4(Other.Field4) {}
+  // CHECK-MESSAGES: :[[@LINE-2]]:3: warning: use '= default'
+  // CHECK-FIXES: BF(c

Re: [PATCH] D14145: modernize-use-default supports copy constructor and copy-assignment operator.

2015-10-28 Thread Angel Garcia via cfe-commits
angelgarcia updated this revision to Diff 38648.
angelgarcia added a comment.

Small tweak.


http://reviews.llvm.org/D14145

Files:
  clang-tidy/modernize/UseDefaultCheck.cpp
  test/clang-tidy/modernize-use-default-copy.cpp
  test/clang-tidy/modernize-use-default.cpp

Index: test/clang-tidy/modernize-use-default.cpp
===
--- test/clang-tidy/modernize-use-default.cpp
+++ test/clang-tidy/modernize-use-default.cpp
@@ -135,3 +135,13 @@
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
   // CHECK-FIXES: ~N() override = default;
 };
+
+struct O {
+  O() {
+// Don't erase comments inside the body.
+  }
+  ~O() {
+// Don't erase comments inside the body.
+  }
+};
+
Index: test/clang-tidy/modernize-use-default-copy.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-default-copy.cpp
@@ -0,0 +1,422 @@
+// RUN: %check_clang_tidy %s modernize-use-default %t -- -- -std=c++11 -fno-delayed-template-parsing
+
+// Out of line definition.
+struct OL {
+  OL(const OL &);
+  OL &operator=(const OL &);
+  int Field;
+};
+OL::OL(const OL &Other) : Field(Other.Field) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use '= default' to define a trivial copy constructor [modernize-use-default]
+// CHECK-FIXES: OL::OL(const OL &Other) = default;
+OL &OL::operator=(const OL &Other) {
+  Field = Other.Field;
+  return *this;
+}
+// CHECK-MESSAGES: :[[@LINE-4]]:1: warning: use '= default' to define a trivial copy-assignment operator [modernize-use-default]
+// CHECK-FIXES: OL &OL::operator=(const OL &Other) = default;
+
+// Inline.
+struct IL {
+  IL(const IL &Other) : Field(Other.Field) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: IL(const IL &Other) = default;
+  IL &operator=(const IL &Other) {
+Field = Other.Field;
+return *this;
+  }
+  // CHECK-MESSAGES: :[[@LINE-4]]:3: warning: use '= default'
+  // CHECK-FIXES: IL &operator=(const IL &Other) = default;
+  int Field;
+};
+
+// Wrong type.
+struct WT {
+  WT(const IL &Other) {}
+  WT &operator=(const IL &);
+};
+WT &WT::operator=(const IL &Other) { return *this; }
+
+// Qualifiers.
+struct Qual {
+  Qual(const Qual &Other) : Field(Other.Field), Volatile(Other.Volatile),
+Mutable(Other.Mutable), Reference(Other.Reference),
+Const(Other.Const) {}
+  // CHECK-MESSAGES: :[[@LINE-3]]:3: warning: use '= default'
+  // CHECK-FIXES: Qual(const Qual &Other) = default;
+
+  int Field;
+  volatile char Volatile;
+  mutable bool Mutable;
+  const OL &Reference; // This makes this class non-assignable.
+  const IL Const;  // This also makes this class non-assignable.
+  static int Static;
+};
+
+// Wrong init arguments.
+struct WI {
+  WI(const WI &Other) : Field1(Other.Field1), Field2(Other.Field1) {}
+  WI &operator=(const WI &);
+  int Field1, Field2;
+};
+WI &WI::operator=(const WI &Other) {
+  Field1 = Other.Field1;
+  Field2 = Other.Field1;
+  return *this;
+}
+
+// Missing field.
+struct MF {
+  MF(const MF &Other) : Field1(Other.Field1), Field2(Other.Field2) {}
+  MF &operator=(const MF &);
+  int Field1, Field2, Field3;
+};
+MF &MF::operator=(const MF &Other) {
+  Field1 = Other.Field1;
+  Field2 = Other.Field2;
+  return *this;
+}
+
+struct Comments {
+  Comments(const Comments &Other)
+  /* don't delete */ : /* this comment */ Field(Other.Field) {}
+  int Field;
+};
+
+struct MoreComments {
+  MoreComments(const MoreComments &Other) /* this comment is OK */
+  : Field(Other.Field) {}
+  // CHECK-MESSAGES: :[[@LINE-2]]:3: warning: use '= default'
+  // CHECK-FIXES: MoreComments(const MoreComments &Other) /* this comment is OK */
+  // CHECK-FIXES-NEXT: = default;
+  int Field;
+};
+
+struct ColonInComment {
+  ColonInComment(const ColonInComment &Other) /* : */ : Field(Other.Field) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: ColonInComment(const ColonInComment &Other) /* : */ = default;
+  int Field;
+};
+
+// No members or bases (in particular, no colon).
+struct Empty {
+  Empty(const Empty &Other) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: Empty(const Empty &Other) = default;
+  Empty &operator=(const Empty &);
+};
+Empty &Empty::operator=(const Empty &Other) { return *this; }
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use '= default'
+// CHECK-FIXES: Empty &Empty::operator=(const Empty &Other) = default;
+
+// Bit fields.
+struct BF {
+  BF() = default;
+  BF(const BF &Other) : Field1(Other.Field1), Field2(Other.Field2), Field3(Other.Field3),
+Field4(Other.Field4) {}
+  // CHECK-MESSAGES: :[[@LINE-2]]:3: warning: use '= default'
+  // CHECK-FIXES: BF(const BF &Other) = default;
+  BF &operator=(const BF &);
+
+  unsigned Field1 : 3;
+  int : 7;
+  char Field2 : 6;
+  int : 0;
+  int Field3 : 24;
+  unsigned 

Re: [PATCH] D14145: modernize-use-default supports copy constructor and copy-assignment operator.

2015-10-28 Thread Manuel Klimek via cfe-commits
klimek added a comment.

Generally, I feel like a lot of the code would be written better as ast 
matchers (by adding new matchers if necessary). You can use 
tooling::ast_matchers::matches if you want to do a match inside a callback.



Comment at: clang-tidy/modernize/UseDefaultCheck.cpp:278-279
@@ +277,4 @@
+
+/// \brief Matcher for method declarations that are overloading the
+/// copy-assignment operator.
+AST_MATCHER(CXXMethodDecl, isCopyAssignmentOperator) {

FIXME: Put into ASTMatchers.h (or just do that :)


http://reviews.llvm.org/D14145



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


Re: [PATCH] D14145: modernize-use-default supports copy constructor and copy-assignment operator.

2015-10-28 Thread Angel Garcia via cfe-commits
angelgarcia added a comment.

OK, thanks! I will try to refactor some of the parts into AST matchers
then. It will probably take some time, though.


http://reviews.llvm.org/D14145



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


Re: [PATCH] D12906: [RFC] Bug identification("issue_hash") change for CmpRuns.py

2015-10-28 Thread Honggyu Kim via cfe-commits
honggyu.kim added a comment.

In http://reviews.llvm.org/D12906#274724, @o.gyorgy wrote:

> Hi,
>
> You are right the diff is is based on the hash. We already tried to
>  use an earlier hash generator (before the patch was introduced), which
>  generates a slightly different plist, that is why the current version
>  does not work with the patch.
>  We will fix CodeChecker to use new hash tag introduced in the final
>  patch (we did not change it so far because we didn't know what will be
>  the accepted naming convention and plist format).


Hi, thanks for the explanation. I will try again when it is modified based on 
the final patch.

> We use LD_PRELOAD technique the log all the compiler calls, so no CC

>  or CXX environment variable orverride is necessary.

>  With the 'export CODECHECKER_VERBOSE=debug' enviromnet variable you

>  can see the analyzer commands.


I just cross-compiled Linux kernel using CodeChecker but I don't get the proper 
analysis result. I have fixed cross-compilation issue by adding 
--analyzer-target option to scan-build in http://reviews.llvm.org/D10356.
Could you please explain more about LD_PRELOAD technique? I would like to more 
understand how it works.

Kind regards,

Honggyu


http://reviews.llvm.org/D12906



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


r251514 - Put global classes into the appropriate namespace.

2015-10-28 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Wed Oct 28 08:54:16 2015
New Revision: 251514

URL: http://llvm.org/viewvc/llvm-project?rev=251514&view=rev
Log:
Put global classes into the appropriate namespace.

Most of the cases belong into an anonymous namespace. No functionality
change intended.

Modified:
cfe/trunk/include/clang/Sema/CodeCompleteOptions.h
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Parse/ParsePragma.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp

Modified: cfe/trunk/include/clang/Sema/CodeCompleteOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/CodeCompleteOptions.h?rev=251514&r1=251513&r2=251514&view=diff
==
--- cfe/trunk/include/clang/Sema/CodeCompleteOptions.h (original)
+++ cfe/trunk/include/clang/Sema/CodeCompleteOptions.h Wed Oct 28 08:54:16 2015
@@ -10,6 +10,8 @@
 #ifndef LLVM_CLANG_SEMA_CODECOMPLETEOPTIONS_H
 #define LLVM_CLANG_SEMA_CODECOMPLETEOPTIONS_H
 
+namespace clang {
+
 /// Options controlling the behavior of code completion.
 class CodeCompleteOptions {
 public:
@@ -33,5 +35,7 @@ public:
   { }
 };
 
+} // namespace clang
+
 #endif
 

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=251514&r1=251513&r2=251514&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Wed Oct 28 08:54:16 2015
@@ -2111,7 +2111,8 @@ enum {
   AddRetType | VectorizeRetType | Add1ArgType | InventFloatType
 };
 
- struct NeonIntrinsicInfo {
+namespace {
+struct NeonIntrinsicInfo {
   unsigned BuiltinID;
   unsigned LLVMIntrinsic;
   unsigned AltLLVMIntrinsic;
@@ -2122,6 +2123,7 @@ enum {
 return BuiltinID < RHSBuiltinID;
   }
 };
+} // end anonymous namespace
 
 #define NEONMAP0(NameBase) \
   { NEON::BI__builtin_neon_ ## NameBase, 0, 0, #NameBase, 0 }

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=251514&r1=251513&r2=251514&view=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Wed Oct 28 08:54:16 2015
@@ -2601,7 +2601,7 @@ void CGOpenMPRuntime::emitTaskCall(
 /// (references element of array in original variable).
 /// \param RedOpGen Generator of reduction operation with use of LHSVar and
 /// RHSVar.
-void EmitOMPAggregateReduction(
+static void EmitOMPAggregateReduction(
 CodeGenFunction &CGF, QualType Type, const VarDecl *LHSVar,
 const VarDecl *RHSVar,
 const llvm::function_refhttp://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=251514&r1=251513&r2=251514&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Wed Oct 28 08:54:16 2015
@@ -1562,6 +1562,7 @@ static bool isMicroMips(const ArgList &A
   return A && A->getOption().matches(options::OPT_mmicromips);
 }
 
+namespace {
 struct DetectedMultilibs {
   /// The set of multilibs that the detected installation supports.
   MultilibSet Multilibs;
@@ -1573,6 +1574,7 @@ struct DetectedMultilibs {
   /// targeting the non-default multilib. Otherwise, it is empty.
   llvm::Optional BiarchSibling;
 };
+} // end anonymous namespace
 
 static Multilib makeMultilib(StringRef commonSuffix) {
   return Multilib(commonSuffix, commonSuffix, commonSuffix);

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=251514&r1=251513&r2=251514&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Oct 28 08:54:16 2015
@@ -5369,12 +5369,14 @@ static bool maybeConsumeDash(const std::
   return !HaveDash;
 }
 
+namespace {
 struct EHFlags {
   EHFlags() : Synch(false), Asynch(false), NoExceptC(false) {}
   bool Synch;
   bool Asynch;
   bool NoExceptC;
 };
+} // end anonymous namespace
 
 /// /EH controls whether to run destructor cleanups when exceptions are
 /// thrown.  There are three modifiers:

Modified: cfe/trunk/lib/Parse/ParsePragma.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParsePragma.cpp?rev=251514&r1=251513&r2=251514&view=diff
==
--- cfe/trunk/lib/Parse/ParsePragma.cpp (original)
+++ cfe/trunk/lib/Parse/ParsePragma.cpp Wed Oct 28 08:54:16 2015
@@ -334,6 +334,7 @@ void Parser::HandlePragmaVisibility() {
   Acti

Re: [PATCH] D14145: modernize-use-default supports copy constructor and copy-assignment operator.

2015-10-28 Thread Manuel Klimek via cfe-commits
Thanks!

On Wed, Oct 28, 2015 at 4:51 AM Angel Garcia  wrote:

> angelgarcia added a comment.
>
> OK, thanks! I will try to refactor some of the parts into AST matchers
> then. It will probably take some time, though.
>
>
> http://reviews.llvm.org/D14145
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r251520 - Change test to just define NULL instead of #including stddef.h. In some

2015-10-28 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Wed Oct 28 09:51:09 2015
New Revision: 251520

URL: http://llvm.org/viewvc/llvm-project?rev=251520&view=rev
Log:
Change test to just define NULL instead of #including stddef.h. In some
test environments, even that builtin header isn't available. Also, this
makes it more consistent with the C++ version of this test.

Modified:
clang-tools-extra/trunk/test/clang-tidy/modernize-redundant-void-arg.c

Modified: clang-tools-extra/trunk/test/clang-tidy/modernize-redundant-void-arg.c
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-redundant-void-arg.c?rev=251520&r1=251519&r2=251520&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/modernize-redundant-void-arg.c 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/modernize-redundant-void-arg.c Wed 
Oct 28 09:51:09 2015
@@ -1,6 +1,6 @@
 // RUN: clang-tidy -checks=-*,modernize-redundant-void-arg %s -- -x c | count 0
 
-#include 
+#define NULL 0
 
 extern int i;
 


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


[PATCH] D14152: Add "equalsNode" for types and "isCopyAssignmentOperator" matchers.

2015-10-28 Thread Angel Garcia via cfe-commits
angelgarcia created this revision.
angelgarcia added a reviewer: klimek.
angelgarcia added subscribers: cfe-commits, alexfh.
Herald added a subscriber: klimek.

This matchers are going to be used in modernize-use-default, but are generic 
enough to be placed in ASTMatchers.h.

http://reviews.llvm.org/D14152

Files:
  include/clang/ASTMatchers/ASTMatchers.h

Index: include/clang/ASTMatchers/ASTMatchers.h
===
--- include/clang/ASTMatchers/ASTMatchers.h
+++ include/clang/ASTMatchers/ASTMatchers.h
@@ -3385,6 +3385,23 @@
   return Node.isConst();
 }
 
+/// \brief Matches if the given method declaration declares a copy assignment
+/// operator.
+///
+/// Given
+/// \code
+/// struct A {
+///   A &operator=(const A &);
+///   A &operator=(A &&);
+/// };
+/// \endcode
+///
+/// cxxMethodDecl(isCopyAssignmentOperator()) matches the first method but not
+/// the second one.
+AST_MATCHER(CXXMethodDecl, isCopyAssignmentOperator) {
+  return Node.isCopyAssignmentOperator();
+}
+
 /// \brief Matches if the given method declaration overrides another method.
 ///
 /// Given
@@ -4307,10 +4324,15 @@
 /// \brief Matches if a node equals another node.
 ///
 /// \c Stmt has pointer identity in the AST.
-///
 AST_MATCHER_P_OVERLOAD(Stmt, equalsNode, const Stmt*, Other, 1) {
   return &Node == Other;
 }
+/// \brief Matches if a node equals another node.
+///
+/// \c Type has pointer identity in the AST.
+AST_MATCHER_P_OVERLOAD(Type, equalsNode, const Type*, Other, 2) {
+return &Node == Other;
+}
 
 /// @}
 


Index: include/clang/ASTMatchers/ASTMatchers.h
===
--- include/clang/ASTMatchers/ASTMatchers.h
+++ include/clang/ASTMatchers/ASTMatchers.h
@@ -3385,6 +3385,23 @@
   return Node.isConst();
 }
 
+/// \brief Matches if the given method declaration declares a copy assignment
+/// operator.
+///
+/// Given
+/// \code
+/// struct A {
+///   A &operator=(const A &);
+///   A &operator=(A &&);
+/// };
+/// \endcode
+///
+/// cxxMethodDecl(isCopyAssignmentOperator()) matches the first method but not
+/// the second one.
+AST_MATCHER(CXXMethodDecl, isCopyAssignmentOperator) {
+  return Node.isCopyAssignmentOperator();
+}
+
 /// \brief Matches if the given method declaration overrides another method.
 ///
 /// Given
@@ -4307,10 +4324,15 @@
 /// \brief Matches if a node equals another node.
 ///
 /// \c Stmt has pointer identity in the AST.
-///
 AST_MATCHER_P_OVERLOAD(Stmt, equalsNode, const Stmt*, Other, 1) {
   return &Node == Other;
 }
+/// \brief Matches if a node equals another node.
+///
+/// \c Type has pointer identity in the AST.
+AST_MATCHER_P_OVERLOAD(Type, equalsNode, const Type*, Other, 2) {
+return &Node == Other;
+}
 
 /// @}
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14145: modernize-use-default supports copy constructor and copy-assignment operator.

2015-10-28 Thread Angel Garcia via cfe-commits
angelgarcia updated this revision to Diff 38664.
angelgarcia added a comment.

Refactor most of the code to use AST matchers.

Note that now this change requires http://reviews.llvm.org/D14152 to be applied 
first.


http://reviews.llvm.org/D14145

Files:
  clang-tidy/modernize/UseDefaultCheck.cpp
  test/clang-tidy/modernize-use-default-copy.cpp
  test/clang-tidy/modernize-use-default.cpp

Index: test/clang-tidy/modernize-use-default.cpp
===
--- test/clang-tidy/modernize-use-default.cpp
+++ test/clang-tidy/modernize-use-default.cpp
@@ -135,3 +135,13 @@
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
   // CHECK-FIXES: ~N() override = default;
 };
+
+struct O {
+  O() {
+// Don't erase comments inside the body.
+  }
+  ~O() {
+// Don't erase comments inside the body.
+  }
+};
+
Index: test/clang-tidy/modernize-use-default-copy.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-default-copy.cpp
@@ -0,0 +1,422 @@
+// RUN: %check_clang_tidy %s modernize-use-default %t -- -- -std=c++11 -fno-delayed-template-parsing
+
+// Out of line definition.
+struct OL {
+  OL(const OL &);
+  OL &operator=(const OL &);
+  int Field;
+};
+OL::OL(const OL &Other) : Field(Other.Field) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use '= default' to define a trivial copy constructor [modernize-use-default]
+// CHECK-FIXES: OL::OL(const OL &Other) = default;
+OL &OL::operator=(const OL &Other) {
+  Field = Other.Field;
+  return *this;
+}
+// CHECK-MESSAGES: :[[@LINE-4]]:1: warning: use '= default' to define a trivial copy-assignment operator [modernize-use-default]
+// CHECK-FIXES: OL &OL::operator=(const OL &Other) = default;
+
+// Inline.
+struct IL {
+  IL(const IL &Other) : Field(Other.Field) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: IL(const IL &Other) = default;
+  IL &operator=(const IL &Other) {
+Field = Other.Field;
+return *this;
+  }
+  // CHECK-MESSAGES: :[[@LINE-4]]:3: warning: use '= default'
+  // CHECK-FIXES: IL &operator=(const IL &Other) = default;
+  int Field;
+};
+
+// Wrong type.
+struct WT {
+  WT(const IL &Other) {}
+  WT &operator=(const IL &);
+};
+WT &WT::operator=(const IL &Other) { return *this; }
+
+// Qualifiers.
+struct Qual {
+  Qual(const Qual &Other) : Field(Other.Field), Volatile(Other.Volatile),
+Mutable(Other.Mutable), Reference(Other.Reference),
+Const(Other.Const) {}
+  // CHECK-MESSAGES: :[[@LINE-3]]:3: warning: use '= default'
+  // CHECK-FIXES: Qual(const Qual &Other) = default;
+
+  int Field;
+  volatile char Volatile;
+  mutable bool Mutable;
+  const OL &Reference; // This makes this class non-assignable.
+  const IL Const;  // This also makes this class non-assignable.
+  static int Static;
+};
+
+// Wrong init arguments.
+struct WI {
+  WI(const WI &Other) : Field1(Other.Field1), Field2(Other.Field1) {}
+  WI &operator=(const WI &);
+  int Field1, Field2;
+};
+WI &WI::operator=(const WI &Other) {
+  Field1 = Other.Field1;
+  Field2 = Other.Field1;
+  return *this;
+}
+
+// Missing field.
+struct MF {
+  MF(const MF &Other) : Field1(Other.Field1), Field2(Other.Field2) {}
+  MF &operator=(const MF &);
+  int Field1, Field2, Field3;
+};
+MF &MF::operator=(const MF &Other) {
+  Field1 = Other.Field1;
+  Field2 = Other.Field2;
+  return *this;
+}
+
+struct Comments {
+  Comments(const Comments &Other)
+  /* don't delete */ : /* this comment */ Field(Other.Field) {}
+  int Field;
+};
+
+struct MoreComments {
+  MoreComments(const MoreComments &Other) /* this comment is OK */
+  : Field(Other.Field) {}
+  // CHECK-MESSAGES: :[[@LINE-2]]:3: warning: use '= default'
+  // CHECK-FIXES: MoreComments(const MoreComments &Other) /* this comment is OK */
+  // CHECK-FIXES-NEXT: = default;
+  int Field;
+};
+
+struct ColonInComment {
+  ColonInComment(const ColonInComment &Other) /* : */ : Field(Other.Field) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: ColonInComment(const ColonInComment &Other) /* : */ = default;
+  int Field;
+};
+
+// No members or bases (in particular, no colon).
+struct Empty {
+  Empty(const Empty &Other) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: Empty(const Empty &Other) = default;
+  Empty &operator=(const Empty &);
+};
+Empty &Empty::operator=(const Empty &Other) { return *this; }
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use '= default'
+// CHECK-FIXES: Empty &Empty::operator=(const Empty &Other) = default;
+
+// Bit fields.
+struct BF {
+  BF() = default;
+  BF(const BF &Other) : Field1(Other.Field1), Field2(Other.Field2), Field3(Other.Field3),
+Field4(Other.Field4) {}
+  // CHECK-MESSAGES: :[[@LINE-2]]:3: warning: use '= default'
+  // CHECK-FIXES: BF(const BF &Other) = default;
+  BF &op

Re: [PATCH] D14152: Add "equalsNode" for types and "isCopyAssignmentOperator" matchers.

2015-10-28 Thread Manuel Klimek via cfe-commits
klimek added a comment.

Please add unit tests :)


http://reviews.llvm.org/D14152



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


Re: [PATCH] D14145: modernize-use-default supports copy constructor and copy-assignment operator.

2015-10-28 Thread Manuel Klimek via cfe-commits
klimek added inline comments.


Comment at: clang-tidy/modernize/UseDefaultCheck.cpp:83-91
@@ +82,11 @@
+ const CXXMethodDecl *Method) {
+  if (Method->getNumParams() != 1)
+return false;
+  QualType ArgType = Method->getParamDecl(0)->getType();
+
+  const auto *Record = Method->getParent();
+  QualType RecordType = Context->getTypeDeclType(Record);
+
+  return !ArgType.isNull() && ArgType->isLValueReferenceType() &&
+ ArgType.getNonReferenceType().getUnqualifiedType() == RecordType;
+}

This looks like something we'd want to matcherify, too.


Comment at: clang-tidy/modernize/UseDefaultCheck.cpp:152-153
@@ +151,4 @@
+
+  return Ctor->getNumCtorInitializers() ==
+ BasesToInit.size() + FieldsToInit.size();
+}

In which cases can this be false? (I assume if not all are copied?)


http://reviews.llvm.org/D14145



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


Re: [PATCH] D14145: modernize-use-default supports copy constructor and copy-assignment operator.

2015-10-28 Thread Angel Garcia via cfe-commits
angelgarcia added a comment.

> In which cases can this be false? (I assume if not all are copied?)


This can be false is there is we do anything else than initializing the
bases and members. So the previous code is there to ensure that we do that
and this is here to ensure that we *only* do that.


http://reviews.llvm.org/D14145



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


r251524 - [analyzer] Make inclusion/exclusion of checkers less ambiguous.

2015-10-28 Thread Anton Yartsev via cfe-commits
Author: ayartsev
Date: Wed Oct 28 11:28:57 2015
New Revision: 251524

URL: http://llvm.org/viewvc/llvm-project?rev=251524&view=rev
Log:
[analyzer] Make inclusion/exclusion of checkers less ambiguous.

A checker may be enabled/disabled multiple times via -enable-checker and 
-disable-checker scan-build arguments. Currently the conflicting and repetitive 
arguments are passed to the analyzer as is.
With this patch only the last enable/disable of a particular checker is 
accepted and passed to the analyzer.
This change is mostly done for the upcoming 'config for scan-build' patch when 
multiple inclusions/exclusions of a checker are expected to be more common.

Modified:
cfe/trunk/tools/scan-build/scan-build

Modified: cfe/trunk/tools/scan-build/scan-build
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/scan-build?rev=251524&r1=251523&r2=251524&view=diff
==
--- cfe/trunk/tools/scan-build/scan-build (original)
+++ cfe/trunk/tools/scan-build/scan-build Wed Oct 28 11:28:57 2015
@@ -54,8 +54,8 @@ my %Options = (
   ViewResults => 0,  # View results when the build terminates.
   ExitStatusFoundBugs => 0,  # Exit status reflects whether bugs were found
   KeepEmpty => 0,# Don't remove output directory even with 0 
results.
-  EnableCheckers => [],
-  DisableCheckers => [],
+  EnableCheckers => {},
+  DisableCheckers => {},
   UseCC => undef,# C compiler to use for compilation.
   UseCXX => undef,   # C++ compiler to use for compilation.
   AnalyzerTarget => undef,
@@ -1630,13 +1630,17 @@ sub ProcessArgs {
 
 if ($arg eq "-enable-checker") {
   shift @$Args;
-  push @{$Options{EnableCheckers}}, shift @$Args;
+  my $Checker = shift @$Args;
+  $Options{EnableCheckers}{$Checker} = 1;
+  delete $Options{DisableCheckers}{$Checker};
   next;
 }
 
 if ($arg eq "-disable-checker") {
   shift @$Args;
-  push @{$Options{DisableCheckers}}, shift @$Args;
+  my $Checker = shift @$Args;
+  $Options{DisableCheckers}{$Checker} = 1;
+  delete $Options{EnableCheckers}{$Checker};
   next;
 }
 
@@ -1747,8 +1751,8 @@ Diag("Using '$Clang' for static analysis
 SetHtmlEnv(\@ARGV, $Options{OutputDir});
 
 my @AnalysesToRun;
-foreach (@{$Options{EnableCheckers}}) { push @AnalysesToRun, 
"-analyzer-checker", $_; }
-foreach (@{$Options{DisableCheckers}}) { push @AnalysesToRun, 
"-analyzer-disable-checker", $_; }
+foreach (keys %{$Options{EnableCheckers}}) { push @AnalysesToRun, 
"-analyzer-checker", $_; }
+foreach (keys %{$Options{DisableCheckers}}) { push @AnalysesToRun, 
"-analyzer-disable-checker", $_; }
 if ($Options{AnalyzeHeaders}) { push @AnalysesToRun, 
"-analyzer-opt-analyze-headers"; }
 if ($Options{AnalyzerStats}) { push @AnalysesToRun, 
'-analyzer-checker=debug.Stats'; }
 if ($Options{MaxLoop} > 0) { push @AnalysesToRun, "-analyzer-max-loop 
$Options{MaxLoop}"; }


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


Buildbot e-mail notification has been changed

2015-10-28 Thread Galina Kistanova via cfe-commits
Hello everyone,

I continue works to reduce buildbot noise.
E-mail notification has been changed in the buildmaster. Now it should not
count interrupted builds to figure out if notification should be send.
So, some people might want to reconsider the notification rules for their
personal notifiers.

Please keep an eye on the notifications and let me know if something would
look wrong.

Thanks

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


Re: [PATCH] D14145: modernize-use-default supports copy constructor and copy-assignment operator.

2015-10-28 Thread Manuel Klimek via cfe-commits
klimek added a comment.

In http://reviews.llvm.org/D14145#277202, @angelgarcia wrote:

> > In which cases can this be false? (I assume if not all are copied?)
>
>
> This can be false is there is we do anything else than initializing the
>  bases and members. So the previous code is there to ensure that we do that
>  and this is here to ensure that we *only* do that.


How can we do more inside an initializer list?


http://reviews.llvm.org/D14145



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


Re: [PATCH] D14145: modernize-use-default supports copy constructor and copy-assignment operator.

2015-10-28 Thread Angel Garcia via cfe-commits
angelgarcia added a comment.

You can initialize an indirect base if it's virtual.


http://reviews.llvm.org/D14145



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


r251528 - Move global classes into anonymous namespaces. NFC.

2015-10-28 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Wed Oct 28 12:16:26 2015
New Revision: 251528

URL: http://llvm.org/viewvc/llvm-project?rev=251528&view=rev
Log:
Move global classes into anonymous namespaces. NFC.

Modified:
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/lib/CodeGen/CGCall.cpp

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=251528&r1=251527&r2=251528&view=diff
==
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Wed Oct 28 12:16:26 2015
@@ -2207,6 +2207,7 @@ enum AccessKinds {
   AK_Decrement
 };
 
+namespace {
 /// A handle to a complete object (an object that is not a subobject of
 /// another object).
 struct CompleteObject {
@@ -2223,6 +2224,7 @@ struct CompleteObject {
 
   explicit operator bool() const { return Value; }
 };
+} // end anonymous namespace
 
 /// Find the designated sub-object of an rvalue.
 template

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=251528&r1=251527&r2=251528&view=diff
==
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Wed Oct 28 12:16:26 2015
@@ -2847,8 +2847,6 @@ struct DestroyUnpassedArg final : EHScop
   }
 };
 
-}
-
 struct DisableDebugLocationUpdates {
   CodeGenFunction &CGF;
   bool disabledDebugInfo;
@@ -2862,6 +2860,8 @@ struct DisableDebugLocationUpdates {
   }
 };
 
+} // end anonymous namespace
+
 void CodeGenFunction::EmitCallArg(CallArgList &args, const Expr *E,
   QualType type) {
   DisableDebugLocationUpdates Dis(*this, E);


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


[libcxx] r251529 - Adapt to lit change in llvm r251478-r251481

2015-10-28 Thread Matthias Braun via cfe-commits
Author: matze
Date: Wed Oct 28 12:20:33 2015
New Revision: 251529

URL: http://llvm.org/viewvc/llvm-project?rev=251529&view=rev
Log:
Adapt to lit change in llvm r251478-r251481

Sorry for the breakage.

Modified:
libcxx/trunk/test/libcxx/test/format.py

Modified: libcxx/trunk/test/libcxx/test/format.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/format.py?rev=251529&r1=251528&r2=251529&view=diff
==
--- libcxx/trunk/test/libcxx/test/format.py (original)
+++ libcxx/trunk/test/libcxx/test/format.py Wed Oct 28 12:20:33 2015
@@ -64,20 +64,24 @@ class LibcxxTestFormat(object):
 return (lit.Test.UNSUPPORTED,
 "A lit.local.cfg marked this unsupported")
 
-res = lit.TestRunner.parseIntegratedTestScript(
+script = lit.TestRunner.parseIntegratedTestScript(
 test, require_script=is_sh_test)
 # Check if a result for the test was returned. If so return that
 # result.
-if isinstance(res, lit.Test.Result):
-return res
+if isinstance(script, lit.Test.Result):
+return script
 if lit_config.noExecute:
 return lit.Test.Result(lit.Test.PASS)
-# res is not an instance of lit.test.Result. Expand res into its parts.
-script, tmpBase, execDir = res
+
 # Check that we don't have run lines on tests that don't support them.
 if not is_sh_test and len(script) != 0:
 lit_config.fatal('Unsupported RUN line found in test %s' % name)
 
+tmpDir, tmpBase = lit.TestRunner.getTempPaths(test)
+substitutions = lit.TestRunner.getDefaultSubstitutions(test, tmpDir,
+   tmpBase)
+script = lit.TestRunner.applySubstitutions(script, substitutions)
+
 # Dispatch the test based on its suffix.
 if is_sh_test:
 if not isinstance(self.executor, LocalExecutor):
@@ -86,11 +90,11 @@ class LibcxxTestFormat(object):
 return lit.Test.UNSUPPORTED, 'ShTest format not yet supported'
 return lit.TestRunner._runShTest(test, lit_config,
  self.execute_external, script,
- tmpBase, execDir)
+ tmpBase)
 elif is_fail_test:
 return self._evaluate_fail_test(test)
 elif is_pass_test:
-return self._evaluate_pass_test(test, tmpBase, execDir, lit_config)
+return self._evaluate_pass_test(test, tmpBase, lit_config)
 else:
 # No other test type is supported
 assert False
@@ -98,7 +102,8 @@ class LibcxxTestFormat(object):
 def _clean(self, exec_path):  # pylint: disable=no-self-use
 libcxx.util.cleanFile(exec_path)
 
-def _evaluate_pass_test(self, test, tmpBase, execDir, lit_config):
+def _evaluate_pass_test(self, test, tmpBase, lit_config):
+execDir = os.path.dirname(test.getExecPath())
 source_path = test.getSourcePath()
 exec_path = tmpBase + '.exe'
 object_path = tmpBase + '.o'


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


Re: [PATCH] D14149: __builtin_signbit fix for ppcf128 type

2015-10-28 Thread John McCall via cfe-commits
rjmccall added a comment.

Just a few comment suggestions, but functionally LGTM.



Comment at: lib/CodeGen/CGBuiltin.cpp:246
@@ -244,1 +245,3 @@
+// On little-Endian, high-double will be in low part of i128.
+// Therefore, on big-Endian we shift high part to low part.
 Width >>= 1;

Hmm, let's merge these the old and new comments a bit:

We want the sign bit of the higher-order double.  The bitcast we just
did works as if the double-double was stored to memory and then
read as an i128.  The "store" will put the higher-order double in the
lower address in both little- and big-Endian modes, but the "load"
will treat those bits as a different part of the i128: the low bits in
little-Endian, the high bits in big-Endian.  Therefore, on big-Endian
we need to shift the high bits down to the low before truncating.


Comment at: lib/CodeGen/CGBuiltin.cpp:252
@@ +251,3 @@
+} 
+// After we have high-dobule in the low part of i128
+// we need to truncate it to extract the sign.

Typo: dobule.

Also, we're not quite extracting the sign yet; we're truncating as a way to 
extract the higher-order double, which we'll extract the sign from in a second.


Repository:
  rL LLVM

http://reviews.llvm.org/D14149



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


Re: r251385 - Create undef reference to profile hook symbol

2015-10-28 Thread Justin Bogner via cfe-commits
Xinliang David Li via cfe-commits  writes:
> Author: davidxl
> Date: Tue Oct 27 00:15:35 2015
> New Revision: 251385
>
> URL: http://llvm.org/viewvc/llvm-project?rev=251385&view=rev
> Log:
> Create undef reference to profile hook symbol 
>
> Create undef reference to profile hook symbol when
> PGO instrumentation is turned on. This allows 
> LLVM to omit emission of hook variable use method
> for every single module instrumented.

Nick: This approach should work for ld64 as well, right?

David: This seems like a good idea, but it's buggy as implemented.
Details below.

>
> Modified:
> cfe/trunk/lib/Driver/ToolChains.cpp
> cfe/trunk/lib/Driver/ToolChains.h
>
> Modified: cfe/trunk/lib/Driver/ToolChains.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=251385&r1=251384&r2=251385&view=diff
> ==
> --- cfe/trunk/lib/Driver/ToolChains.cpp (original)
> +++ cfe/trunk/lib/Driver/ToolChains.cpp Tue Oct 27 00:15:35 2015
> @@ -25,6 +25,7 @@
>  #include "llvm/Option/ArgList.h"
>  #include "llvm/Option/OptTable.h"
>  #include "llvm/Option/Option.h"
> +#include "llvm/ProfileData/InstrProf.h"
>  #include "llvm/Support/ErrorHandling.h"
>  #include "llvm/Support/FileSystem.h"
>  #include "llvm/Support/MemoryBuffer.h"
> @@ -3811,6 +3812,18 @@ SanitizerMask Linux::getSupportedSanitiz
>return Res;
>  }
>  
> +void Linux::addProfileRTLibs(const llvm::opt::ArgList &Args,
> + llvm::opt::ArgStringList &CmdArgs) const {
> +  if (!needsProfileRT(Args)) return;
> +
> +  // Add linker option -u__llvm_runtime_variable to cause runtime
> +  // initialization module to be linked in.
> +  if (!Args.hasArg(options::OPT_coverage))

This check isn't right. What about the other gcov-style flags like
-fprofile-args? What if both kinds of coverage are on for some strange
reason? It's also a maintenance burden, since the logic needs to be
duplicated from needsProfileRT. I think we need finer grained helpers -
maybe something like needsGCOVRT and needsInstrProfRT, either of which
will pull in the profileRTLibs.

> +CmdArgs.push_back(Args.MakeArgString(
> +Twine("-u", llvm::getInstrProfRuntimeHookVarName(;
> +  ToolChain::addProfileRTLibs(Args, CmdArgs);
> +}
> +
>  /// DragonFly - DragonFly tool chain which can call as(1) and ld(1) directly.
>  
>  DragonFly::DragonFly(const Driver &D, const llvm::Triple &Triple,
>
> Modified: cfe/trunk/lib/Driver/ToolChains.h
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=251385&r1=251384&r2=251385&view=diff
> ==
> --- cfe/trunk/lib/Driver/ToolChains.h (original)
> +++ cfe/trunk/lib/Driver/ToolChains.h Tue Oct 27 00:15:35 2015
> @@ -744,6 +744,8 @@ public:
>llvm::opt::ArgStringList &CC1Args) const override;
>bool isPIEDefault() const override;
>SanitizerMask getSupportedSanitizers() const override;
> +  void addProfileRTLibs(const llvm::opt::ArgList &Args,
> +llvm::opt::ArgStringList &CmdArgs) const override;
>  
>std::string Linker;
>std::vector ExtraOpts;
>
>
> ___
> 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: [libcxx] r249929 - Split out of .

2015-10-28 Thread Michael Zolotukhin via cfe-commits
Hi Eric, Richard,

Any news on this? The test is still broken, should we revert the commit for now?

Thanks,
Michael

> On Oct 24, 2015, at 1:18 AM, Eric Fiselier  wrote:
> 
> Hi Michael,
> 
> Sorry I'm holding this patch up in review. The fix is quite "novel" and I 
> want to make sure we get it right. If we can't land it over the weekend I'll 
> ask Richard to revert while we work on it.
> 
> /Eric
> 
> On Oct 23, 2015 10:13 PM, "Michael Zolotukhin via cfe-commits" 
> mailto:cfe-commits@lists.llvm.org>> wrote:
> Hi Richard,
> 
> Is this patch ready for commit, or were you just checking an idea? Our bots 
> are still failing to build povray, so we’re really looking forward for some 
> fix:)
> 
> Thanks,
> Michael
> 
>> On Oct 15, 2015, at 6:21 PM, Manman Ren via cfe-commits 
>> mailto:cfe-commits@lists.llvm.org>> wrote:
>> 
>>> 
>>> On Oct 15, 2015, at 1:41 PM, Richard Smith >> > wrote:
>>> 
>>> On Thu, Oct 15, 2015 at 12:03 PM, Manman Ren via cfe-commits 
>>> mailto:cfe-commits@lists.llvm.org>> wrote:
>>> 
 On Oct 15, 2015, at 11:25 AM, Richard Smith >>> > wrote:
 
 I assume the code in question has a "using namespace std;"?
 
 
>>> Yes
>>> 
 I don't see any way around this other than giving up on trying to fix the 
 function signatures here (or maybe adding a Clang feature to let us fix 
 the bad signature).
 
 
>>> Can you elaborate on how to fix the bad signature by adding a Clang 
>>> feature? I want to see how hard it is before giving up on trying to fix the 
>>> signatures.
>>> 
>>> I thought about this a bit more, and we already have a feature that can be 
>>> used for this.
>>> 
>>> Please let me know if the attached patch resolves the issue for you. This 
>>> should also fix the wrong overload sets for these functions being provided 
>>> by  on Darwin.
>> 
>> This works on my testing case. Thanks!!
>> 
>> Manman
>> 
>>> 
>>> 
>>> Eric, Marshall: the attached patch adds a macro _LIBCPP_PREFERRED_OVERLOAD 
>>> that can be applied to a function to (a) mark it as a separate overload 
>>> from any other function with the same signature without the overload, and 
>>> (b) instruct the compiler that it's preferred over another function with 
>>> the same signature without the attribute. This allows us to replace the 
>>> libc function
>>> 
>>>   char *strchr(const char *, int);
>>> 
>>> with the C++ overload set:
>>> 
>>>   const char *strchr(const char *, int);
>>>   char *strchr(char *, int);
>>> 
>>> It only works with Clang, though; for other compilers, we leave the C 
>>> library's signature alone (as we used to before my patches landed).
>>> 
>>> Thanks,
>>> Manman
>>> 
>>> 
 On Oct 15, 2015 11:07 AM, "Manman Ren via cfe-commits" 
 mailto:cfe-commits@lists.llvm.org>> wrote:
 Hi Richard,
 
 This is causing a failure when building povray on iOS.
 
 Compilation error:
 /Users/buildslave/tmp/test-suite-externals/speccpu2006/benchspec/CPU2006/453.povray/src/fileinputoutput.cpp:364:20:
  error: call to 'strrchr' is ambiguous
  const char *p=strrchr(name, '.’);
 
 iOS.sdk/usr/include/string.h:87:7: note: candidate function
 char*strrchr(const char *, int);
  ^
 /Users/buildslave/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:109:46:
  note: candidate function
 inline _LIBCPP_INLINE_VISIBILITY const char* strrchr(const char* __s, int 
 __c) {return ::strrchr(__s, __c);}
 
 It is a little strange to have "char*strrchr(const char *, int);” in 
 iOS. But it is already in our SDK.
 
 Do you have any suggestion on how to fix this?
 
 Thanks,
 Manman
 
 > On Oct 9, 2015, at 6:25 PM, Richard Smith via cfe-commits 
 > mailto:cfe-commits@lists.llvm.org>> wrote:
 >
 > Author: rsmith
 > Date: Fri Oct  9 20:25:31 2015
 > New Revision: 249929
 >
 > URL: http://llvm.org/viewvc/llvm-project?rev=249929&view=rev 
 > 
 > Log:
 > Split  out of .
 >
 > Also fix the overload set for the five functions whose signatures change 
 > in the
 > case where we can fix it. This is already covered by existing tests for 
 > the
 > affected systems.
 >
 > Added:
 >libcxx/trunk/include/string.h
 >  - copied, changed from r249736, libcxx/trunk/include/cstring
 > Modified:
 >libcxx/trunk/include/cstring
 >
 > Modified: libcxx/trunk/include/cstring
 > URL: 
 > http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cstring?rev=249929&r1=249928&r2=249929&view=diff
 >  
 > 
 > ==
 > ---

Re: [PATCH] D13802: [OPENMP] Make -fopenmp to turn on OpenMP support by default.

2015-10-28 Thread Jack Howarth via cfe-commits
jhowarth added a subscriber: jhowarth.
jhowarth added a comment.

The proposed patches here to change the default behavior of -fopenmp from 
-fopenmp=libgomp to -fopenmp=libomp seem to only handle the configure-based 
build. The following change required to switch over the crake-based build to 
default -fopenmp to libomp  is missing.

  Index: CMakeLists.txt
  ===
  --- CMakeLists.txt(revision 251539)
  +++ CMakeLists.txt(working copy)
  @@ -196,7 +196,7 @@ set(GCC_INSTALL_PREFIX "" CACHE PATH "Di
   set(DEFAULT_SYSROOT "" CACHE PATH
 "Default  to all compiler invocations for --sysroot=." )
   
  -set(CLANG_DEFAULT_OPENMP_RUNTIME "libgomp" CACHE STRING
  +set(CLANG_DEFAULT_OPENMP_RUNTIME "libomp" CACHE STRING
 "Default OpenMP runtime used by -fopenmp.")
   
   set(CLANG_VENDOR "" CACHE STRING


http://reviews.llvm.org/D13802



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


Re: r251524 - [analyzer] Make inclusion/exclusion of checkers less ambiguous.

2015-10-28 Thread Devin Coughlin via cfe-commits

> On Oct 28, 2015, at 9:28 AM, Anton Yartsev via cfe-commits 
>  wrote:
> 
> Author: ayartsev
> Date: Wed Oct 28 11:28:57 2015
> New Revision: 251524
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=251524&view=rev
> Log:
> [analyzer] Make inclusion/exclusion of checkers less ambiguous.
...
> 
> my @AnalysesToRun;
> -foreach (@{$Options{EnableCheckers}}) { push @AnalysesToRun, 
> "-analyzer-checker", $_; }
> -foreach (@{$Options{DisableCheckers}}) { push @AnalysesToRun, 
> "-analyzer-disable-checker", $_; }
> +foreach (keys %{$Options{EnableCheckers}}) { push @AnalysesToRun, 
> "-analyzer-checker", $_; }
> +foreach (keys %{$Options{DisableCheckers}}) { push @AnalysesToRun, 
> "-analyzer-disable-checker", $_; }

Does keys guarantee a stable iteration order across different invocations of 
scan-build? I think it is important that the environment scan-build sets up be 
deterministic.

Devin

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


Re: [PATCH] D13802: [OPENMP] Make -fopenmp to turn on OpenMP support by default.

2015-10-28 Thread Alexey Bataev via cfe-commits
ABataev added a comment.

In http://reviews.llvm.org/D13802#277270, @jhowarth wrote:

> The proposed patches here to change the default behavior of -fopenmp from 
> -fopenmp=libgomp to -fopenmp=libomp seem to only handle the configure-based 
> build. The following change required to switch over the crake-based build to 
> default -fopenmp to libomp  is missing.
>
>   Index: CMakeLists.txt
>   ===
>   --- CMakeLists.txt  (revision 251539)
>   +++ CMakeLists.txt  (working copy)
>   @@ -196,7 +196,7 @@ set(GCC_INSTALL_PREFIX "" CACHE PATH "Di
>set(DEFAULT_SYSROOT "" CACHE PATH
>  "Default  to all compiler invocations for --sysroot=." )
>   
>   -set(CLANG_DEFAULT_OPENMP_RUNTIME "libgomp" CACHE STRING
>   +set(CLANG_DEFAULT_OPENMP_RUNTIME "libomp" CACHE STRING
>  "Default OpenMP runtime used by -fopenmp.")
>   
>set(CLANG_VENDOR "" CACHE STRING
>


This patch is for clang and it is accepted already. But I'm going to land all 
patches for -fopenmp only when llvm and libomp changes are accepted.


http://reviews.llvm.org/D13802



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


Re: [PATCH] D13802: [OPENMP] Make -fopenmp to turn on OpenMP support by default.

2015-10-28 Thread Alexey Bataev via cfe-commits
ABataev added a comment.

In http://reviews.llvm.org/D13802#276755, @hfinkel wrote:

> In http://reviews.llvm.org/D13802#275471, @chandlerc wrote:
>
> > In http://reviews.llvm.org/D13802#274847, @ABataev wrote:
> >
> > > Hi Chandler, thanks for the review.
> > >
> > > In http://reviews.llvm.org/D13802#272053, @chandlerc wrote:
> > >
> > > > I've also had one test fail, and then start passing for me on Linux 
> > > > (after fixing the above). I haven't had it fail again, but I don't have 
> > > > a good way of running tests repeatedly (see below, llvm-lit doesn't yet 
> > > > work). It might be good to give the test suite a good 10 or 50 runs and 
> > > > see if anything starts failing. I'll do that overnight and report back 
> > > > if so.
> > >
> > >
> > > Actually, these tests are written so, that they repeats about 1000 times 
> > > to be sure that they are correct. But some of them might be sensible to 
> > > system load.
> >
> >
> > Hmm, so I think we need to find some way to make some of these tests more 
> > reliable.
> >
> > With the fix from http://reviews.llvm.org/D14055 patched in (minus the flag 
> > change in it) I am seeing tests fail pretty regularly:
> >
> >   libomp :: worksharing/for/omp_for_schedule_auto.c
>
>
> Credit goes to a colleague of mine, Ray Loy, for spotting this. This test has 
> a race condition. The updates to the global sum1 are not protected by any 
> kind of synchronization.
>
>   sum1 = sum0;
>   
>
> the for pragma is missing a private(sum1) clause?
>
> > This test seems to fail pretty frequently for me. Maybe as much as half the 
> > time.
>
> > 
>
> >   libomp :: worksharing/sections/omp_sections_nowait.c
>
>
> In omp_testsuite.h, we have this:
>
>   /* following times are in seconds */
>   #define SLEEPTIME 0.1
>   
>
> and this test, and also omp_flush.c, are sensitive to this. If the machine is 
> heavily loaded, or otherwise configured, so the threads involved don't all 
> get scheduled within 0.1 seconds, this will certainly fail.
>
> Also, does this test have a race condition? Specifically, should there be a
>
>   #pragma omp flush(count)
>   
>
> before
>
>   if (count == 0)
>   
>
> I think there should be.
>
> > This test fails less frequently, but still have seen it a few times.
>
> > 
>
> >   libomp :: flush/omp_flush.c
>
> >
>
> > 
>
> > I've seen this test fail just once...
>
>
> This is trying to test the memory flush pragma by having one thread write and 
> flush, and a second thread wait for a fixed time, flush and read. As 
> mentioned above, this is sensitive to SLEEPTIME.


Hal, thanks for pointing this. I'll take a look and try to fix these tests.


http://reviews.llvm.org/D13802



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


Re: [PATCH] D13802: [OPENMP] Make -fopenmp to turn on OpenMP support by default.

2015-10-28 Thread Jack Howarth via cfe-commits
jhowarth added a comment.

The CMakeLists.txt change cited is in top-level of the clang sources and not in 
the llvm top-level.


http://reviews.llvm.org/D13802



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


Re: r251385 - Create undef reference to profile hook symbol

2015-10-28 Thread Vedant Kumar via cfe-commits

> On Oct 28, 2015, at 11:03 AM, Justin Bogner via cfe-commits 
>  wrote:
> 
> Xinliang David Li via cfe-commits  writes:
>> Author: davidxl
>> Date: Tue Oct 27 00:15:35 2015
>> New Revision: 251385
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=251385&view=rev
>> Log:
>> Create undef reference to profile hook symbol 
>> 
>> Create undef reference to profile hook symbol when
>> PGO instrumentation is turned on. This allows 
>> LLVM to omit emission of hook variable use method
>> for every single module instrumented.
> 
> Nick: This approach should work for ld64 as well, right?

Hm, I tried this out with a dummy file:

liba.a(a.o):
0004 C ___llvm_profile_runtime
 T _foo

I compiled with:

$ cc -L. -la liba.a -Wl,-u -Wl,__llvm_profile_runtime b.c -o b

The hook symbol doesn't appear in the final executable:

b:
0001 T __mh_execute_header
00010f90 T _main
 U dyld_stub_binder

If I instead link with "-force_load liba.a", I get the expected result. I could 
just be doing this incorrectly, so I'll defer to Nick.


> 
> David: This seems like a good idea, but it's buggy as implemented.
> Details below.
> 
>> 
>> Modified:
>>cfe/trunk/lib/Driver/ToolChains.cpp
>>cfe/trunk/lib/Driver/ToolChains.h
>> 
>> Modified: cfe/trunk/lib/Driver/ToolChains.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=251385&r1=251384&r2=251385&view=diff
>> ==
>> --- cfe/trunk/lib/Driver/ToolChains.cpp (original)
>> +++ cfe/trunk/lib/Driver/ToolChains.cpp Tue Oct 27 00:15:35 2015
>> @@ -25,6 +25,7 @@
>> #include "llvm/Option/ArgList.h"
>> #include "llvm/Option/OptTable.h"
>> #include "llvm/Option/Option.h"
>> +#include "llvm/ProfileData/InstrProf.h"
>> #include "llvm/Support/ErrorHandling.h"
>> #include "llvm/Support/FileSystem.h"
>> #include "llvm/Support/MemoryBuffer.h"
>> @@ -3811,6 +3812,18 @@ SanitizerMask Linux::getSupportedSanitiz
>>   return Res;
>> }
>> 
>> +void Linux::addProfileRTLibs(const llvm::opt::ArgList &Args,
>> + llvm::opt::ArgStringList &CmdArgs) const {
>> +  if (!needsProfileRT(Args)) return;
>> +
>> +  // Add linker option -u__llvm_runtime_variable to cause runtime
>> +  // initialization module to be linked in.
>> +  if (!Args.hasArg(options::OPT_coverage))
> 
> This check isn't right. What about the other gcov-style flags like
> -fprofile-args? What if both kinds of coverage are on for some strange
> reason? It's also a maintenance burden, since the logic needs to be
> duplicated from needsProfileRT. I think we need finer grained helpers -
> maybe something like needsGCOVRT and needsInstrProfRT, either of which
> will pull in the profileRTLibs.

Sorry I missed this.

vedant

>> +CmdArgs.push_back(Args.MakeArgString(
>> +Twine("-u", llvm::getInstrProfRuntimeHookVarName(;
>> +  ToolChain::addProfileRTLibs(Args, CmdArgs);
>> +}
>> +
>> /// DragonFly - DragonFly tool chain which can call as(1) and ld(1) directly.
>> 
>> DragonFly::DragonFly(const Driver &D, const llvm::Triple &Triple,
>> 
>> Modified: cfe/trunk/lib/Driver/ToolChains.h
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=251385&r1=251384&r2=251385&view=diff
>> ==
>> --- cfe/trunk/lib/Driver/ToolChains.h (original)
>> +++ cfe/trunk/lib/Driver/ToolChains.h Tue Oct 27 00:15:35 2015
>> @@ -744,6 +744,8 @@ public:
>>   llvm::opt::ArgStringList &CC1Args) const override;
>>   bool isPIEDefault() const override;
>>   SanitizerMask getSupportedSanitizers() const override;
>> +  void addProfileRTLibs(const llvm::opt::ArgList &Args,
>> +llvm::opt::ArgStringList &CmdArgs) const override;
>> 
>>   std::string Linker;
>>   std::vector ExtraOpts;
>> 
>> 
>> ___
>> 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


Re: [PATCH] D14145: modernize-use-default supports copy constructor and copy-assignment operator.

2015-10-28 Thread Manuel Klimek via cfe-commits
klimek added a comment.

In http://reviews.llvm.org/D14145#277222, @angelgarcia wrote:

> You can initialize an indirect base if it's virtual.


Cool, those cases would be useful to have as comment, for example:
// Make sure there are no additional initializations going on (for example, of 
indirect bases)
// and that all fields and direct bases have been initialized.


http://reviews.llvm.org/D14145



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


Re: [PATCH] D13925: Implement __attribute__((internal_linkage))

2015-10-28 Thread Evgeniy Stepanov via cfe-commits
eugenis updated this revision to Diff 38679.

Repository:
  rL LLVM

http://reviews.llvm.org/D13925

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  include/clang/Sema/Sema.h
  lib/AST/Decl.cpp
  lib/Sema/Sema.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/CodeGenCXX/attribute_internal_linkage.cpp
  test/Sema/internal_linkage.c
  test/SemaCXX/internal_linkage.cpp

Index: test/SemaCXX/internal_linkage.cpp
===
--- /dev/null
+++ test/SemaCXX/internal_linkage.cpp
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+int f() __attribute__((internal_linkage));
+class __attribute__((internal_linkage)) A {
+public:
+  int x __attribute__((internal_linkage)); // expected-warning{{'internal_linkage' attribute ignored}}
+  static int y __attribute__((internal_linkage));
+  void f1() __attribute__((internal_linkage));
+  void f2() __attribute__((internal_linkage)) {}
+  static void f3() __attribute__((internal_linkage)) {}
+  A() __attribute__((internal_linkage)) {}
+  ~A() __attribute__((internal_linkage)) {}
+  A& operator=(const A&) __attribute__((internal_linkage)) { return *this; }
+  struct {
+int z  __attribute__((internal_linkage)); // expected-warning{{'internal_linkage' attribute ignored}}
+  };
+};
+
+namespace Z __attribute__((internal_linkage)) {
+}
+
+int A::y;
+
+void A::f1() {
+}
Index: test/Sema/internal_linkage.c
===
--- /dev/null
+++ test/Sema/internal_linkage.c
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+int var __attribute__((internal_linkage));
+int var2 __attribute__((internal_linkage,common)); // expected-error{{'internal_linkage' and 'common' attributes are not compatible}} \
+   // expected-note{{conflicting attribute is here}}
+int var3 __attribute__((common,internal_linkage)); // expected-error{{'common' and 'internal_linkage' attributes are not compatible}} \
+   // expected-note{{conflicting attribute is here}}
+
+int var4 __attribute__((common)); // expected-error{{'common' and 'internal_linkage' attributes are not compatible}}
+int var4 __attribute__((internal_linkage)); // expected-note{{conflicting attribute is here}}
+
+int var5 __attribute__((internal_linkage)); // expected-error{{'internal_linkage' and 'common' attributes are not compatible}}
+int var5 __attribute__((common)); // expected-note{{conflicting attribute is here}}
+
+ __attribute__((internal_linkage)) int f() {}
+struct __attribute__((internal_linkage)) S {
+};
Index: test/CodeGenCXX/attribute_internal_linkage.cpp
===
--- /dev/null
+++ test/CodeGenCXX/attribute_internal_linkage.cpp
@@ -0,0 +1,85 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
+
+__attribute__((internal_linkage)) static void f() {}
+// CHECK-DAG: define internal void @_ZL1fv
+
+class A {
+public:
+  static int y __attribute__((internal_linkage));
+// CHECK-DAG: @_ZN1A1yE = internal global
+  void f1() __attribute__((internal_linkage));
+// CHECK-DAG: define internal void @_ZN1A2f1Ev
+  void f2() __attribute__((internal_linkage)) {}
+// CHECK-DAG: define internal void @_ZN1A2f2Ev
+  void f3();
+// CHECK-DAG: define internal void @_ZN1A2f3Ev
+  static void f4() __attribute__((internal_linkage)) {}
+// CHECK-DAG: define internal void @_ZN1A2f4Ev
+  A() __attribute__((internal_linkage)) {}
+// CHECK-DAG: define internal void @_ZN1AC1Ev
+// CHECK-DAG: define internal void @_ZN1AC2Ev
+  ~A() __attribute__((internal_linkage)) {}
+// CHECK-DAG: define internal void @_ZN1AD1Ev
+// CHECK-DAG: define internal void @_ZN1AD2Ev
+};
+
+int A::y;
+
+void A::f1() {
+}
+
+__attribute__((internal_linkage)) void A::f3() {
+}
+
+// Internal_linkage on a namespace affects everything within.
+namespace ZZZ __attribute__((internal_linkage)) {
+int x;
+// CHECK-DAG: @_ZNL3ZZZL1xE = internal global
+void f() {}
+// CHECK-DAG: define internal void @_ZNL3ZZZL1fEv
+class A {
+public:
+  A() {}
+// CHECK-DAG: define internal void @_ZNL3ZZZL1AC1Ev
+// CHECK-DAG: define internal void @_ZNL3ZZZL1AC2Ev
+  ~A() {}
+// CHECK-DAG: define internal void @_ZNL3ZZZL1AD1Ev
+// CHECK-DAG: define internal void @_ZNL3ZZZL1AD2Ev
+  void g() {};
+// CHECK-DAG: define internal void @_ZNL3ZZZL1A1gEv
+};
+}
+
+// Internal_linkage on a class affects all its members.
+class __attribute__((internal_linkage)) B {
+public:
+  B() {}
+  // CHECK-DAG: define internal void @_ZNL1BC1Ev
+  // CHECK-DAG: define internal void @_ZNL1BC2Ev
+  ~B() {}
+  // CHECK-DAG: define internal void @_ZNL1BD1Ev
+  // CHECK-DAG: define internal void @_ZNL1BD2Ev
+  void f() {};
+  // CHECK-DAG: define internal void @_ZNL1B1fEv
+  static int x;
+  // CHECK-DAG: @_ZNL1B1xE = internal global
+};
+
+int B::x;
+
+void use() {
+  A a;
+  a

Re: [PATCH] D13925: Implement __attribute__((internal_linkage))

2015-10-28 Thread Evgeniy Stepanov via cfe-commits
eugenis added a comment.

In http://reviews.llvm.org/D13925#276626, @majnemer wrote:

> No diagnostic is issued for the following C test case:
>
>   int x __attribute__((internal_linkage));
>   int x __attribute__((common));
>   int *f() { return &x; }


Thanks for noticing! Added missing attribute merging logic in SemaAttr.cpp.



Comment at: include/clang/Basic/Attr.td:2112
@@ +2111,3 @@
+
+def InternalLinkage : InheritableAttr {
+  let Spellings = [GCC<"internal_linkage">];

Because the list of subjects is long and unusual, and Subjects field does not 
support arbitrary lists - all combinations must have a specific diagnostic line 
elsewhere in the code.

This is checked in handleInternalLinkageAttr instead.


Repository:
  rL LLVM

http://reviews.llvm.org/D13925



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


[libcxx] r251545 - Mark two Kona papers as 'in progress'

2015-10-28 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Oct 28 14:21:40 2015
New Revision: 251545

URL: http://llvm.org/viewvc/llvm-project?rev=251545&view=rev
Log:
Mark two Kona papers as 'in progress'

Modified:
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=251545&r1=251544&r2=251545&view=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Wed Oct 28 14:21:40 2015
@@ -71,9 +71,9 @@
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4510";>N4510LWGMinimal
 incomplete type support for standard containers, revision 
4LenexaComplete3.6

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0004R1.html";>P0004R1LWGRemove
 Deprecated iostreams aliases.Kona
-   http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0006R0.html";>P0006R0LWGAdopt
 Type Traits Variable Templates for 
C++17.Kona
+   http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0006R0.html";>P0006R0LWGAdopt
 Type Traits Variable Templates for C++17.KonaIn 
progress
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0092R1.html";>P0092R1LWGPolishing
 Kona
-   http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0007R1.html";>P0007R1LWGConstant
 View: A proposal for a std::as_const helper function 
template.Kona
+   http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0007R1.html";>P0007R1LWGConstant
 View: A proposal for a std::as_const helper function 
template.KonaIn progress
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0156R0.htm"; 
>P0156R0LWGVariadic lock_guard(rev 
3).Kona
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0074R0.html";>P0074R0LWGMaking
 std::owner_less more flexibleKona
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0013R1.html";>P0013R1LWGLogical
 type traits rev 2Kona


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


r251552 - [analyzer] Preserve the order checkers were enabled/disabled.

2015-10-28 Thread Anton Yartsev via cfe-commits
Author: ayartsev
Date: Wed Oct 28 15:43:39 2015
New Revision: 251552

URL: http://llvm.org/viewvc/llvm-project?rev=251552&view=rev
Log:
[analyzer] Preserve the order checkers were enabled/disabled.

In addition to r251524: preserve the order the checkers were enabled/disabled 
to be deterministic.
Additionally return the number of arguments read by 'ProcessArgs' - for debug 
purpose.

Modified:
cfe/trunk/tools/scan-build/scan-build

Modified: cfe/trunk/tools/scan-build/scan-build
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/scan-build?rev=251552&r1=251551&r2=251552&view=diff
==
--- cfe/trunk/tools/scan-build/scan-build (original)
+++ cfe/trunk/tools/scan-build/scan-build Wed Oct 28 15:43:39 2015
@@ -1447,9 +1447,12 @@ my $ForceDisplayHelp = 0;
 
 sub ProcessArgs {
   my $Args = shift;
+  my $NumArgs = 0;
 
   while (@$Args) {
 
+$NumArgs++;
+
 # Scan for options we recognize.
 
 my $arg = $Args->[0];
@@ -1631,7 +1634,8 @@ sub ProcessArgs {
 if ($arg eq "-enable-checker") {
   shift @$Args;
   my $Checker = shift @$Args;
-  $Options{EnableCheckers}{$Checker} = 1;
+  # Store $NumArgs to preserve the order the checkers were enabled.
+  $Options{EnableCheckers}{$Checker} = $NumArgs;
   delete $Options{DisableCheckers}{$Checker};
   next;
 }
@@ -1639,7 +1643,8 @@ sub ProcessArgs {
 if ($arg eq "-disable-checker") {
   shift @$Args;
   my $Checker = shift @$Args;
-  $Options{DisableCheckers}{$Checker} = 1;
+  # Store $NumArgs to preserve the order the checkers were disabled.
+  $Options{DisableCheckers}{$Checker} = $NumArgs;
   delete $Options{EnableCheckers}{$Checker};
   next;
 }
@@ -1676,8 +1681,10 @@ sub ProcessArgs {
 
 DieDiag("unrecognized option '$arg'\n") if ($arg =~ /^-/);
 
+$NumArgs--;
 last;
   }
+  return $NumArgs;
 }
 
 if (!@ARGV) {
@@ -1751,8 +1758,16 @@ Diag("Using '$Clang' for static analysis
 SetHtmlEnv(\@ARGV, $Options{OutputDir});
 
 my @AnalysesToRun;
-foreach (keys %{$Options{EnableCheckers}}) { push @AnalysesToRun, 
"-analyzer-checker", $_; }
-foreach (keys %{$Options{DisableCheckers}}) { push @AnalysesToRun, 
"-analyzer-disable-checker", $_; }
+foreach (sort { $Options{EnableCheckers}{$a} <=> $Options{EnableCheckers}{$b} 
} 
+ keys %{$Options{EnableCheckers}}) { 
+  # Push checkers in order they were enabled.
+  push @AnalysesToRun, "-analyzer-checker", $_;
+}
+foreach (sort { $Options{DisableCheckers}{$a} <=> 
$Options{DisableCheckers}{$b} } 
+ keys %{$Options{DisableCheckers}}) { 
+  # Push checkers in order they were disabled.
+  push @AnalysesToRun, "-analyzer-disable-checker", $_;
+}
 if ($Options{AnalyzeHeaders}) { push @AnalysesToRun, 
"-analyzer-opt-analyze-headers"; }
 if ($Options{AnalyzerStats}) { push @AnalysesToRun, 
'-analyzer-checker=debug.Stats'; }
 if ($Options{MaxLoop} > 0) { push @AnalysesToRun, "-analyzer-max-loop 
$Options{MaxLoop}"; }


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


Re: r251524 - [analyzer] Make inclusion/exclusion of checkers less ambiguous.

2015-10-28 Thread Anton Yartsev via cfe-commits

On 28.10.2015 21:26, Devin Coughlin wrote:


On Oct 28, 2015, at 9:28 AM, Anton Yartsev via cfe-commits 
 wrote:

Author: ayartsev
Date: Wed Oct 28 11:28:57 2015
New Revision: 251524

URL: http://llvm.org/viewvc/llvm-project?rev=251524&view=rev
Log:
[analyzer] Make inclusion/exclusion of checkers less ambiguous.

...

my @AnalysesToRun;
-foreach (@{$Options{EnableCheckers}}) { push @AnalysesToRun, 
"-analyzer-checker", $_; }
-foreach (@{$Options{DisableCheckers}}) { push @AnalysesToRun, 
"-analyzer-disable-checker", $_; }
+foreach (keys %{$Options{EnableCheckers}}) { push @AnalysesToRun, 
"-analyzer-checker", $_; }
+foreach (keys %{$Options{DisableCheckers}}) { push @AnalysesToRun, 
"-analyzer-disable-checker", $_; }

Does keys guarantee a stable iteration order across different invocations of 
scan-build? I think it is important that the environment scan-build sets up be 
deterministic.


Hi, Devin, thanks for the remark. Preserved the order the checkers were 
enabled/disabled at r251552 to be fully consistent.



Devin


--
Anton

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


Re: [libcxx] r251529 - Adapt to lit change in llvm r251478-r251481

2015-10-28 Thread Eric Fiselier via cfe-commits
Thanks for the fix.

On Wed, Oct 28, 2015 at 11:20 AM, Matthias Braun via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: matze
> Date: Wed Oct 28 12:20:33 2015
> New Revision: 251529
>
> URL: http://llvm.org/viewvc/llvm-project?rev=251529&view=rev
> Log:
> Adapt to lit change in llvm r251478-r251481
>
> Sorry for the breakage.
>
> Modified:
> libcxx/trunk/test/libcxx/test/format.py
>
> Modified: libcxx/trunk/test/libcxx/test/format.py
> URL:
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/format.py?rev=251529&r1=251528&r2=251529&view=diff
>
> ==
> --- libcxx/trunk/test/libcxx/test/format.py (original)
> +++ libcxx/trunk/test/libcxx/test/format.py Wed Oct 28 12:20:33 2015
> @@ -64,20 +64,24 @@ class LibcxxTestFormat(object):
>  return (lit.Test.UNSUPPORTED,
>  "A lit.local.cfg marked this unsupported")
>
> -res = lit.TestRunner.parseIntegratedTestScript(
> +script = lit.TestRunner.parseIntegratedTestScript(
>  test, require_script=is_sh_test)
>  # Check if a result for the test was returned. If so return that
>  # result.
> -if isinstance(res, lit.Test.Result):
> -return res
> +if isinstance(script, lit.Test.Result):
> +return script
>  if lit_config.noExecute:
>  return lit.Test.Result(lit.Test.PASS)
> -# res is not an instance of lit.test.Result. Expand res into its
> parts.
> -script, tmpBase, execDir = res
> +
>  # Check that we don't have run lines on tests that don't support
> them.
>  if not is_sh_test and len(script) != 0:
>  lit_config.fatal('Unsupported RUN line found in test %s' %
> name)
>
> +tmpDir, tmpBase = lit.TestRunner.getTempPaths(test)
> +substitutions = lit.TestRunner.getDefaultSubstitutions(test,
> tmpDir,
> +   tmpBase)
> +script = lit.TestRunner.applySubstitutions(script, substitutions)
> +
>  # Dispatch the test based on its suffix.
>  if is_sh_test:
>  if not isinstance(self.executor, LocalExecutor):
> @@ -86,11 +90,11 @@ class LibcxxTestFormat(object):
>  return lit.Test.UNSUPPORTED, 'ShTest format not yet
> supported'
>  return lit.TestRunner._runShTest(test, lit_config,
>   self.execute_external,
> script,
> - tmpBase, execDir)
> + tmpBase)
>  elif is_fail_test:
>  return self._evaluate_fail_test(test)
>  elif is_pass_test:
> -return self._evaluate_pass_test(test, tmpBase, execDir,
> lit_config)
> +return self._evaluate_pass_test(test, tmpBase, lit_config)
>  else:
>  # No other test type is supported
>  assert False
> @@ -98,7 +102,8 @@ class LibcxxTestFormat(object):
>  def _clean(self, exec_path):  # pylint: disable=no-self-use
>  libcxx.util.cleanFile(exec_path)
>
> -def _evaluate_pass_test(self, test, tmpBase, execDir, lit_config):
> +def _evaluate_pass_test(self, test, tmpBase, lit_config):
> +execDir = os.path.dirname(test.getExecPath())
>  source_path = test.getSourcePath()
>  exec_path = tmpBase + '.exe'
>  object_path = tmpBase + '.o'
>
>
> ___
> 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: [PATCH] D10022: Refactor: Simplify boolean conditional return statements in lib/StaticAnalyzer/Core

2015-10-28 Thread Anna Zaks via cfe-commits
zaks.anna added inline comments.


Comment at: lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp:692-693
@@ -691,4 +691,2 @@
 
   CXXBasePaths Paths(false, false, false);
-  if (RD->lookupInBases(
-  [DeclName](const CXXBaseSpecifier *Specifier, CXXBasePath &Path) {

LegalizeAdulthood wrote:
> In this case it isn't a simple if-return, if-return, if-return.
I agree that we should keep these as is for better readability and 
maintainability.


Comment at: lib/StaticAnalyzer/Core/SValBuilder.cpp:397
@@ -396,6 +396,3 @@
 
-  if (ToTy != FromTy)
-return false;
-
-  return true;
+  return ToTy == FromTy;
 }

Same chaining pattern here. I do not think it should change.


Comment at: lib/StaticAnalyzer/Core/SymbolManager.cpp:496
@@ -495,5 +495,3 @@
 // location context, then the expression value is now "out of scope".
-if (LCtx->isParentOf(ELCtx))
-  return false;
-return true;
+return !LCtx->isParentOf(ELCtx);
   }

I am OK with changing this one.


http://reviews.llvm.org/D10022



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


Re: [PATCH] D13144: [CUDA] propagate to CUDA sub-compilations target triple of opposite side.

2015-10-28 Thread Eric Christopher via cfe-commits
echristo added a comment.

Some inline comments for discussion.

Thanks!

-eric



Comment at: lib/Driver/Driver.cpp:503
@@ -502,3 +502,3 @@
   if (TC.getTriple().isOSBinFormatMachO())
-BuildUniversalActions(C->getDefaultToolChain(), C->getArgs(), Inputs,
+BuildUniversalActions(*C, C->getDefaultToolChain(), C->getArgs(), Inputs,
   C->getActions());

Can pass one or the other here? I don't think you need both a reference to C 
and one of its members?


Comment at: lib/Driver/Driver.cpp:1285-1291
@@ -1284,6 +1284,9 @@
+ std::unique_ptr HostAction, ActionList &Actions) {
   // Figure out which NVPTX triple to use for device-side compilation based on
   // whether host is 64-bit.
   const char *DeviceTriple = TC.getTriple().isArch64Bit()
  ? "nvptx64-nvidia-cuda"
  : "nvptx-nvidia-cuda";
+  C.setCudaDeviceToolChain(
+  &D.getToolChain(C.getArgs(), llvm::Triple(DeviceTriple)));
   Arg *PartialCompilationArg = Args.getLastArg(options::OPT_cuda_host_only,

Can't you now do all of this in BuildCompilation?


http://reviews.llvm.org/D13144



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


Re: [PATCH] D14014: Checker of proper vfork usage

2015-10-28 Thread Devin Coughlin via cfe-commits
dcoughlin added a comment.

LGTM. Can you update the summary to a commit message? Then I will commit. 
Thanks for upstreaming!


http://reviews.llvm.org/D14014



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


r251565 - Fix missing builtin identifier infos with PCH+modules

2015-10-28 Thread Ben Langmuir via cfe-commits
Author: benlangmuir
Date: Wed Oct 28 17:25:37 2015
New Revision: 251565

URL: http://llvm.org/viewvc/llvm-project?rev=251565&view=rev
Log:
Fix missing builtin identifier infos with PCH+modules

Use the *current* state of "is-moduleness" rather than the state at
serialization time so that if we read a builtin identifier from a module
that wasn't "interesting" to that module, we will still write it out to
a PCH that imports that module.

Otherwise, we would get mysterious "unknown builtin" errors when using
PCH+modules.

rdar://problem/23287656

Added:
cfe/trunk/test/Modules/Inputs/use-builtin.h
Modified:
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/test/Modules/Inputs/builtin_sub.h
cfe/trunk/test/Modules/builtins.m

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=251565&r1=251564&r2=251565&view=diff
==
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Wed Oct 28 17:25:37 2015
@@ -780,7 +780,8 @@ IdentifierInfo *ASTIdentifierLookupTrait
   }
   if (!II->isFromAST()) {
 II->setIsFromAST();
-if (isInterestingIdentifier(Reader, *II, F.isModule()))
+bool IsModule = Reader.PP.getCurrentModule() != nullptr;
+if (isInterestingIdentifier(Reader, *II, IsModule))
   II->setChangedSinceDeserialization();
   }
   Reader.markIdentifierUpToDate(II);
@@ -3511,7 +3512,8 @@ ASTReader::ASTReadResult ASTReader::Read
   // whether we need to serialize it.
   if (!II.isFromAST()) {
 II.setIsFromAST();
-if (isInterestingIdentifier(*this, II, F.isModule()))
+bool IsModule = PP.getCurrentModule() != nullptr;
+if (isInterestingIdentifier(*this, II, IsModule))
   II.setChangedSinceDeserialization();
   }
 

Modified: cfe/trunk/test/Modules/Inputs/builtin_sub.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/builtin_sub.h?rev=251565&r1=251564&r2=251565&view=diff
==
--- cfe/trunk/test/Modules/Inputs/builtin_sub.h (original)
+++ cfe/trunk/test/Modules/Inputs/builtin_sub.h Wed Oct 28 17:25:37 2015
@@ -2,3 +2,4 @@ int getBos1(void) {
   return __builtin_object_size(p, 0);
 }
 
+#define IS_CONST(x) __builtin_constant_p(x)

Added: cfe/trunk/test/Modules/Inputs/use-builtin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/use-builtin.h?rev=251565&view=auto
==
--- cfe/trunk/test/Modules/Inputs/use-builtin.h (added)
+++ cfe/trunk/test/Modules/Inputs/use-builtin.h Wed Oct 28 17:25:37 2015
@@ -0,0 +1,2 @@
+@import builtin;
+@import builtin.sub;

Modified: cfe/trunk/test/Modules/builtins.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/builtins.m?rev=251565&r1=251564&r2=251565&view=diff
==
--- cfe/trunk/test/Modules/builtins.m (original)
+++ cfe/trunk/test/Modules/builtins.m Wed Oct 28 17:25:37 2015
@@ -10,7 +10,15 @@ int bar() {
   return __builtin_object_size(p, 0);
 }
 
+int baz() {
+  return IS_CONST(0);
+}
 
 // RUN: rm -rf %t
 // RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I 
%S/Inputs %s -verify
+
+// RUN: rm -rf %t.pch.cache
+// RUN: %clang_cc1 -fmodules-cache-path=%t.pch.cache -fmodules 
-fimplicit-module-maps -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header 
%S/Inputs/use-builtin.h
+// RUN: %clang_cc1 -fmodules-cache-path=%t.pch.cache -fmodules 
-fimplicit-module-maps -I %S/Inputs %s -include-pch %t.pch %s -verify
+
 // expected-no-diagnostics


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


r251567 - Fix the calling convention of Mingw64 long double values

2015-10-28 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Wed Oct 28 17:29:52 2015
New Revision: 251567

URL: http://llvm.org/viewvc/llvm-project?rev=251567&view=rev
Log:
Fix the calling convention of Mingw64 long double values

GCC uses the x87DoubleExtended model for long doubles, and passes them
indirectly by address through function calls.

Also replace the existing mingw-long-double assembly emitting test with
an IR-level test.

Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/test/CodeGen/mingw-long-double.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=251567&r1=251566&r2=251567&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed Oct 28 17:29:52 2015
@@ -4009,7 +4009,13 @@ public:
 class MinGWX86_64TargetInfo : public WindowsX86_64TargetInfo {
 public:
   MinGWX86_64TargetInfo(const llvm::Triple &Triple)
-  : WindowsX86_64TargetInfo(Triple) {}
+  : WindowsX86_64TargetInfo(Triple) {
+// Mingw64 rounds long double size and alignment up to 16 bytes, but sticks
+// with x86 FP ops. Weird.
+LongDoubleWidth = LongDoubleAlign = 128;
+LongDoubleFormat = &llvm::APFloat::x87DoubleExtended;
+  }
+
   void getTargetDefines(const LangOptions &Opts,
 MacroBuilder &Builder) const override {
 WindowsX86_64TargetInfo::getTargetDefines(Opts, Builder);

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=251567&r1=251566&r2=251567&view=diff
==
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Wed Oct 28 17:29:52 2015
@@ -1772,12 +1772,10 @@ public:
 
 /// WinX86_64ABIInfo - The Windows X86_64 ABI information.
 class WinX86_64ABIInfo : public ABIInfo {
-
-  ABIArgInfo classify(QualType Ty, unsigned &FreeSSERegs,
-  bool IsReturnType) const;
-
 public:
-  WinX86_64ABIInfo(CodeGen::CodeGenTypes &CGT) : ABIInfo(CGT) {}
+  WinX86_64ABIInfo(CodeGen::CodeGenTypes &CGT)
+  : ABIInfo(CGT),
+IsMingw64(getTarget().getTriple().isWindowsGNUEnvironment()) {}
 
   void computeInfo(CGFunctionInfo &FI) const override;
 
@@ -1794,6 +1792,12 @@ public:
 // FIXME: Assumes vectorcall is in use.
 return isX86VectorCallAggregateSmallEnough(NumMembers);
   }
+
+private:
+  ABIArgInfo classify(QualType Ty, unsigned &FreeSSERegs,
+  bool IsReturnType) const;
+
+  bool IsMingw64;
 };
 
 class X86_64TargetCodeGenInfo : public TargetCodeGenInfo {
@@ -3317,7 +3321,7 @@ ABIArgInfo WinX86_64ABIInfo::classify(Qu
 
   TypeInfo Info = getContext().getTypeInfo(Ty);
   uint64_t Width = Info.Width;
-  unsigned Align = getContext().toCharUnitsFromBits(Info.Align).getQuantity();
+  CharUnits Align = getContext().toCharUnitsFromBits(Info.Align);
 
   const RecordType *RT = Ty->getAs();
   if (RT) {
@@ -3330,9 +3334,9 @@ ABIArgInfo WinX86_64ABIInfo::classify(Qu
   return getNaturalAlignIndirect(Ty, /*ByVal=*/false);
 
 // FIXME: mingw-w64-gcc emits 128-bit struct as i128
-if (Width == 128 && getTarget().getTriple().isWindowsGNUEnvironment())
-  return ABIArgInfo::getDirect(llvm::IntegerType::get(getVMContext(),
-  Width));
+if (Width == 128 && IsMingw64)
+  return ABIArgInfo::getDirect(
+  llvm::IntegerType::get(getVMContext(), Width));
   }
 
   // vectorcall adds the concept of a homogenous vector aggregate, similar to
@@ -3346,8 +3350,7 @@ ABIArgInfo WinX86_64ABIInfo::classify(Qu
 return ABIArgInfo::getDirect();
   return ABIArgInfo::getExpand();
 }
-return ABIArgInfo::getIndirect(CharUnits::fromQuantity(Align),
-   /*ByVal=*/false);
+return ABIArgInfo::getIndirect(Align, /*ByVal=*/false);
   }
 
 
@@ -3375,6 +3378,14 @@ ABIArgInfo WinX86_64ABIInfo::classify(Qu
   if (BT && BT->getKind() == BuiltinType::Bool)
 return ABIArgInfo::getExtend();
 
+  // Mingw64 GCC uses the old 80 bit extended precision floating point unit. It
+  // passes them indirectly through memory.
+  if (IsMingw64 && BT && BT->getKind() == BuiltinType::LongDouble) {
+const llvm::fltSemantics *LDF = &getTarget().getLongDoubleFormat();
+if (LDF == &llvm::APFloat::x87DoubleExtended)
+  return ABIArgInfo::getIndirect(Align, /*ByVal=*/false);
+  }
+
   return ABIArgInfo::getDirect();
 }
 

Modified: cfe/trunk/test/CodeGen/mingw-long-double.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/mingw-long-double.c?rev=251567&r1=251566&r2=251567&view=diff
==
--- cfe/trunk/test/CodeGen/mingw-long-double.c (original)
+++ cfe/trunk/test/CodeGe

Re: [PATCH] D13357: [Concepts] Diagnose when 'concept' is specified on a specialization

2015-10-28 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast added inline comments.


Comment at: include/clang/AST/Decl.h:1577
@@ -1576,2 +1576,3 @@
   bool IsConstexpr : 1;
+  bool IsConcept : 1;
 

nwilson wrote:
> faisalv wrote:
> > My inclination would have been to add this bit to FunctionTemplateDecl, 
> > instead of to every FunctionDecl - since not every kind of FunctionDecl can 
> > be a concept ...  My first instinct would have been to add an enum to 
> > TemplateKind, and then forward isConcept() to check if we are a template 
> > and if so, through it, if concept is specified?  
> > 
> > But I suppose that adds more complexity, and you trade space for speed - 
> > For my own edification, could I ask you or Richard to comment on the cons 
> > of that approach - and why the current approach is preferred? (i.e. 
> > simplicity over complexity or space over time etc.)
> Sorry for the slow reply. Yeah, I thought it was a little more 
> straightforward having isConcept as a member function of FunctionDecl (and 
> the bit). It also seemed that we'd be okay in terms of size since 17 bits are 
> already being used here and adding one more wouldn't go over a byte boundary. 
> Maybe Richard has other thoughts though?
I am not sure what the original justification was for IsTrivial to be a bit 
here instead of in CXXMethodDecl, but it seems that similar considerations 
apply.


Comment at: lib/Sema/SemaDecl.cpp:5909
@@ +5908,3 @@
+ diag::err_concept_specified_specialization)
+  << (IsPartialSpecialization ? 2 : 1);
+NewVD->setInvalidDecl(true);

Should we mention that the partial specialization case is pending additional 
wording (under Concepts TS Issue 15)?


http://reviews.llvm.org/D13357



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


Re: [PATCH] D13144: [CUDA] propagate to CUDA sub-compilations target triple of opposite side.

2015-10-28 Thread Artem Belevich via cfe-commits
tra added inline comments.


Comment at: lib/Driver/Driver.cpp:503
@@ -502,3 +502,3 @@
   if (TC.getTriple().isOSBinFormatMachO())
-BuildUniversalActions(C->getDefaultToolChain(), C->getArgs(), Inputs,
+BuildUniversalActions(*C, C->getDefaultToolChain(), C->getArgs(), Inputs,
   C->getActions());

echristo wrote:
> Can pass one or the other here? I don't think you need both a reference to C 
> and one of its members?
I can fold getArgs and getActions for BuildUniversalActions(), but not 
toolchain as it's called with different ones.



Comment at: lib/Driver/Driver.cpp:1285-1291
@@ -1284,6 +1284,9 @@
+ std::unique_ptr HostAction, ActionList &Actions) {
   // Figure out which NVPTX triple to use for device-side compilation based on
   // whether host is 64-bit.
   const char *DeviceTriple = TC.getTriple().isArch64Bit()
  ? "nvptx64-nvidia-cuda"
  : "nvptx-nvidia-cuda";
+  C.setCudaDeviceToolChain(
+  &D.getToolChain(C.getArgs(), llvm::Triple(DeviceTriple)));
   Arg *PartialCompilationArg = Args.getLastArg(options::OPT_cuda_host_only,

echristo wrote:
> Can't you now do all of this in BuildCompilation?
I could, but i'd prefer to avoid putting hardcoded cuda logic into otherwise 
generic BuildCompilation for no good reason.

Here is where we start creating device-side actions and have all relevant info 
for that so it appears to be a sensible place to pick an appropriate toolchain 
for that as well.

When we have better support for multiple compilation targets toolchain 
selection would probably be more generic and would migrate towards 
BuildCompilation, but we're not there yet. :-)


http://reviews.llvm.org/D13144



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


r251576 - [WinEH] Mark calls inside cleanups as noinline

2015-10-28 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Wed Oct 28 18:06:42 2015
New Revision: 251576

URL: http://llvm.org/viewvc/llvm-project?rev=251576&view=rev
Log:
[WinEH] Mark calls inside cleanups as noinline

This works around PR25162. The MSVC tables make it very difficult to
correctly inline a C++ destructor that contains try / catch.  We've
attempted to address PR25162 in LLVM's backend, but it feels pretty
infeasible.  MSVC and ICC both appear to avoid inlining such complex
destructors.

Long term, we want to fix this by making the inliner smart enough to
know when it is inlining into a cleanup, so it can inline simple
destructors (~unique_ptr and ~vector) while avoiding destructors
containing try / catch.

Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/lib/CodeGen/CGCleanup.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
cfe/trunk/test/CodeGenCXX/microsoft-abi-eh-cleanups.cpp

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=251576&r1=251575&r2=251576&view=diff
==
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Wed Oct 28 18:06:42 2015
@@ -3440,8 +3440,14 @@ RValue CodeGenFunction::EmitCall(const C
 Attrs.addAttribute(getLLVMContext(), llvm::AttributeSet::FunctionIndex,
llvm::Attribute::AlwaysInline);
 
-  // Disable inlining inside SEH __try blocks.
-  if (isSEHTryScope())
+  // Disable inlining inside SEH __try blocks and cleanup funclets. None of the
+  // funclet EH personalities that clang supports have tables that are
+  // expressive enough to describe catching an exception inside a cleanup.
+  // __CxxFrameHandler3, for example, will terminate the program without
+  // catching it.
+  // FIXME: Move this decision to the LLVM inliner. Before we can do that, the
+  // inliner needs to know if a given call site is part of a cleanuppad.
+  if (isSEHTryScope() || isCleanupPadScope())
 Attrs =
 Attrs.addAttribute(getLLVMContext(), llvm::AttributeSet::FunctionIndex,
llvm::Attribute::NoInline);

Modified: cfe/trunk/lib/CodeGen/CGCleanup.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCleanup.cpp?rev=251576&r1=251575&r2=251576&view=diff
==
--- cfe/trunk/lib/CodeGen/CGCleanup.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCleanup.cpp Wed Oct 28 18:06:42 2015
@@ -19,6 +19,7 @@
 
 #include "CGCleanup.h"
 #include "CodeGenFunction.h"
+#include "llvm/Support/SaveAndRestore.h"
 
 using namespace clang;
 using namespace CodeGen;
@@ -902,19 +903,19 @@ void CodeGenFunction::PopCleanupBlock(bo
 
 EmitBlock(EHEntry);
 
-// Push terminate scopes around the potentially throwing destructor calls.
-// We don't emit these when using funclets, because the runtime does it for
-// us as part of unwinding out of a cleanuppad.
+llvm::BasicBlock *NextAction = getEHDispatchBlock(EHParent);
+
+// Push a terminate scope or cleanupendpad scope around the potentially
+// throwing cleanups. For funclet EH personalities, the cleanupendpad 
models
+// program termination when cleanups throw.
 bool PushedTerminate = false;
+SaveAndRestore RestoreIsCleanupPadScope(IsCleanupPadScope);
+llvm::CleanupPadInst *CPI = nullptr;
+llvm::BasicBlock *CleanupEndBB = nullptr;
 if (!EHPersonality::get(*this).usesFuncletPads()) {
   EHStack.pushTerminate();
   PushedTerminate = true;
-}
-
-llvm::CleanupPadInst *CPI = nullptr;
-llvm::BasicBlock *CleanupEndBB = nullptr;
-llvm::BasicBlock *NextAction = getEHDispatchBlock(EHParent);
-if (EHPersonality::get(*this).usesFuncletPads()) {
+} else {
   CPI = Builder.CreateCleanupPad({});
 
   // Build a cleanupendpad to unwind through. Our insertion point should be
@@ -922,6 +923,10 @@ void CodeGenFunction::PopCleanupBlock(bo
   CleanupEndBB = createBasicBlock("ehcleanup.end");
   CGBuilderTy(*this, CleanupEndBB).CreateCleanupEndPad(CPI, NextAction);
   EHStack.pushPadEnd(CleanupEndBB);
+
+  // Mark that we're inside a cleanuppad to block inlining.
+  // FIXME: Remove this once the inliner knows when it's safe to do so.
+  IsCleanupPadScope = true;
 }
 
 // We only actually emit the cleanup code if the cleanup is either

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=251576&r1=251575&r2=251576&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Wed Oct 28 18:06:42 2015
@@ -279,6 +279,8 @@ public:
   /// finally block or filter expression.
   bool IsOutlinedSEHHelper;
 
+  bool IsCleanupPadScope = false;
+
   const CodeGen::CGBlo

Re: [PATCH] D13144: [CUDA] propagate to CUDA sub-compilations target triple of opposite side.

2015-10-28 Thread Artem Belevich via cfe-commits
tra updated this revision to Diff 38694.
tra added a comment.

Folded some arguments of BuildUniversalActions.


http://reviews.llvm.org/D13144

Files:
  include/clang/Driver/Compilation.h
  include/clang/Driver/Driver.h
  lib/Driver/Compilation.cpp
  lib/Driver/Driver.cpp
  lib/Driver/Tools.cpp
  test/Driver/cuda-options.cu
  test/SemaCUDA/function-target-hd.cu

Index: test/SemaCUDA/function-target-hd.cu
===
--- test/SemaCUDA/function-target-hd.cu
+++ test/SemaCUDA/function-target-hd.cu
@@ -8,9 +8,9 @@
 // host device functions are not allowed to call device functions.
 
 // RUN: %clang_cc1 -fsyntax-only -verify %s
-// RUN: %clang_cc1 -fsyntax-only -fcuda-is-device -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fcuda-is-device -triple nvptx-unknown-cuda -verify %s
 // RUN: %clang_cc1 -fsyntax-only -fcuda-allow-host-calls-from-host-device -verify %s -DTEST_WARN_HD
-// RUN: %clang_cc1 -fsyntax-only -fcuda-is-device -fcuda-allow-host-calls-from-host-device -verify %s -DTEST_WARN_HD
+// RUN: %clang_cc1 -fsyntax-only -fcuda-is-device -triple nvptx-unknown-cuda -fcuda-allow-host-calls-from-host-device -verify %s -DTEST_WARN_HD
 
 #include "Inputs/cuda.h"
 
Index: test/Driver/cuda-options.cu
===
--- test/Driver/cuda-options.cu
+++ test/Driver/cuda-options.cu
@@ -111,14 +111,6 @@
 // Make sure we don't link anything.
 // RUN:   -check-prefix CUDA-NL %s
 
-// Match device-side preprocessor, and compiler phases with -save-temps
-// CUDA-D1S: "-cc1" "-triple" "nvptx{{(64)?}}-nvidia-cuda"
-// CUDA-D1S-SAME: "-fcuda-is-device"
-// CUDA-D1S-SAME: "-x" "cuda"
-// CUDA-D1S: "-cc1" "-triple" "nvptx{{(64)?}}-nvidia-cuda"
-// CUDA-D1S-SAME: "-fcuda-is-device"
-// CUDA-D1S-SAME: "-x" "cuda-cpp-output"
-
 // --cuda-host-only should never trigger unused arg warning.
 // RUN: %clang -### -target x86_64-linux-gnu --cuda-host-only -c %s 2>&1 | \
 // RUN:FileCheck -check-prefix CUDA-NO-UNUSED-CHO %s
@@ -133,34 +125,47 @@
 // RUN: %clang -### -target x86_64-linux-gnu --cuda-device-only -x c -c %s 2>&1 | \
 // RUN:FileCheck -check-prefix CUDA-UNUSED-CDO %s
 
+// Match device-side preprocessor, and compiler phases with -save-temps
+// CUDA-D1S: "-cc1" "-triple" "nvptx64-nvidia-cuda"
+// CUDA-D1S-SAME: "-aux-triple" "x86_64--linux-gnu"
+// CUDA-D1S-SAME: "-fcuda-is-device"
+// CUDA-D1S-SAME: "-x" "cuda"
+
+// CUDA-D1S: "-cc1" "-triple" "nvptx64-nvidia-cuda"
+// CUDA-D1S-SAME: "-aux-triple" "x86_64--linux-gnu"
+// CUDA-D1S-SAME: "-fcuda-is-device"
+// CUDA-D1S-SAME: "-x" "cuda-cpp-output"
+
 // Match the job that produces PTX assembly
-// CUDA-D1: "-cc1" "-triple" "nvptx{{(64)?}}-nvidia-cuda"
+// CUDA-D1: "-cc1" "-triple" "nvptx64-nvidia-cuda"
+// CUDA-D1NS-SAME: "-aux-triple" "x86_64--linux-gnu"
 // CUDA-D1-SAME: "-fcuda-is-device"
 // CUDA-D1-SM35-SAME: "-target-cpu" "sm_35"
 // CUDA-D1-SAME: "-o" "[[GPUBINARY1:[^"]*]]"
 // CUDA-D1NS-SAME: "-x" "cuda"
 // CUDA-D1S-SAME: "-x" "ir"
 
-// Match anothe device-side compilation
-// CUDA-D2: "-cc1" "-triple" "nvptx{{(64)?}}-nvidia-cuda"
+// Match another device-side compilation
+// CUDA-D2: "-cc1" "-triple" "nvptx64-nvidia-cuda"
+// CUDA-D2-SAME: "-aux-triple" "x86_64--linux-gnu"
 // CUDA-D2-SAME: "-fcuda-is-device"
 // CUDA-D2-SM30-SAME: "-target-cpu" "sm_30"
 // CUDA-D2-SAME: "-o" "[[GPUBINARY2:[^"]*]]"
 // CUDA-D2-SAME: "-x" "cuda"
 
 // Match no device-side compilation
-// CUDA-ND-NOT: "-cc1" "-triple" "nvptx{{(64)?}}-nvidia-cuda"
+// CUDA-ND-NOT: "-cc1" "-triple" "nvptx64-nvidia-cuda"
 // CUDA-ND-SAME-NOT: "-fcuda-is-device"
 
 // Match host-side preprocessor job with -save-temps
-// CUDA-HS: "-cc1" "-triple"
-// CUDA-HS-SAME-NOT: "nvptx{{(64)?}}-nvidia-cuda"
+// CUDA-HS: "-cc1" "-triple" "x86_64--linux-gnu"
+// CUDA-HS-SAME: "-aux-triple" "nvptx64-nvidia-cuda"
 // CUDA-HS-SAME-NOT: "-fcuda-is-device"
 // CUDA-HS-SAME: "-x" "cuda"
 
 // Match host-side compilation
-// CUDA-H: "-cc1" "-triple"
-// CUDA-H-SAME-NOT: "nvptx{{(64)?}}-nvidia-cuda"
+// CUDA-H: "-cc1" "-triple" "x86_64--linux-gnu"
+// CUDA-H-SAME: "-aux-triple" "nvptx64-nvidia-cuda"
 // CUDA-H-SAME-NOT: "-fcuda-is-device"
 // CUDA-H-SAME: "-o" "[[HOSTOUTPUT:[^"]*]]"
 // CUDA-HNS-SAME: "-x" "cuda"
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3215,6 +3215,20 @@
   CmdArgs.push_back("-triple");
   CmdArgs.push_back(Args.MakeArgString(TripleStr));
 
+  if (IsCuda) {
+const ToolChain *AuxToolChain;
+if (&getToolChain() == C.getCudaDeviceToolChain())
+  AuxToolChain = C.getCudaHostToolChain();
+else if (&getToolChain() == C.getCudaHostToolChain())
+  AuxToolChain = C.getCudaDeviceToolChain();
+else
+  llvm_unreachable("Can't figure out CUDA compilation mode.");
+if (AuxToolChain) {
+  CmdArgs.push_back("-aux-triple");
+  CmdArgs.push_back(Args.MakeArgString(

Re: [PATCH] D12358: [Analyzer] Widening loops which do not exit

2015-10-28 Thread Devin Coughlin via cfe-commits
dcoughlin accepted this revision.
dcoughlin added a comment.

LGTM. Please commit. Thanks for tackling this, Sean!


http://reviews.llvm.org/D12358



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


Re: [PATCH] Bug 15109: Implement -Wdouble-promotion for clang

2015-10-28 Thread George Burgess IV via cfe-commits
Thanks for this patch! :) Just a few small nits:
- Is there a reason that test/SemaCXX/warn-double-promotion.cpp can't be at
test/Sema/warn-double-promotion.c instead?
- Can we make the warning message a bit more specific? Maybe something like
"implicit conversion increases floating-point precision: %0 to %1"?
- Please get rid of the empty line after `else if (TargetBT->getKind() >
SourceBT->getKind()) {`

After those are fixed, LGTM -- will you need me to commit this for you?

On Tue, Oct 27, 2015 at 9:45 PM, Carl Norum via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Hi folks,
>
> I had need of this warning, so I cobbled something together. Can someone
> please check it out and let me know if it's reasonable? I'm certainly no
> expert at this stuff. Patch attached for review, thanks!
>
> -- Carl
>
>
> ___
> 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: [PATCH] Bug 15109: Implement -Wdouble-promotion for clang

2015-10-28 Thread Carl Norum via cfe-commits

> On Oct 28, 2015, at 4:37 PM, George Burgess IV  
> wrote:
> 
> Thanks for this patch! :) Just a few small nits:
> - Is there a reason that test/SemaCXX/warn-double-promotion.cpp can't be at 
> test/Sema/warn-double-promotion.c instead?

No reason; I just found warn-float-conversion.c in there and this code is 
similar. Can move easily.

> - Can we make the warning message a bit more specific? Maybe something like 
> "implicit conversion increases floating-point precision: %0 to %1"?

Sure thing.

> - Please get rid of the empty line after `else if (TargetBT->getKind() > 
> SourceBT->getKind()) {`

NP. Will send a patch shortly.

> After those are fixed, LGTM -- will you need me to commit this for you?

I think so yes.

-- Carl


> On Tue, Oct 27, 2015 at 9:45 PM, Carl Norum via cfe-commits 
>  wrote:
> Hi folks,
> 
> I had need of this warning, so I cobbled something together. Can someone 
> please check it out and let me know if it's reasonable? I'm certainly no 
> expert at this stuff. Patch attached for review, thanks!
> 
> -- Carl
> 
> 
> ___
> 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: [PATCH] Bug 15109: Implement -Wdouble-promotion for clang

2015-10-28 Thread Carl Norum via cfe-commits
OK, here you go!

-- Carl




double-promotion-2.patch
Description: Binary data

> On Oct 28, 2015, at 4:53 PM, Carl Norum  wrote:
> 
> 
>> On Oct 28, 2015, at 4:37 PM, George Burgess IV  
>> wrote:
>> 
>> Thanks for this patch! :) Just a few small nits:
>> - Is there a reason that test/SemaCXX/warn-double-promotion.cpp can't be at 
>> test/Sema/warn-double-promotion.c instead?
> 
> No reason; I just found warn-float-conversion.c in there and this code is 
> similar. Can move easily.
> 
>> - Can we make the warning message a bit more specific? Maybe something like 
>> "implicit conversion increases floating-point precision: %0 to %1"?
> 
> Sure thing.
> 
>> - Please get rid of the empty line after `else if (TargetBT->getKind() > 
>> SourceBT->getKind()) {`
> 
> NP. Will send a patch shortly.
> 
>> After those are fixed, LGTM -- will you need me to commit this for you?
> 
> I think so yes.
> 
> -- Carl
> 
> 
>> On Tue, Oct 27, 2015 at 9:45 PM, Carl Norum via cfe-commits 
>>  wrote:
>> Hi folks,
>> 
>> I had need of this warning, so I cobbled something together. Can someone 
>> please check it out and let me know if it's reasonable? I'm certainly no 
>> expert at this stuff. Patch attached for review, thanks!
>> 
>> -- Carl
>> 
>> 
>> ___
>> 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: [PATCH] D14145: modernize-use-default supports copy constructor and copy-assignment operator.

2015-10-28 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments.


Comment at: test/clang-tidy/modernize-use-default.cpp:139
@@ +138,3 @@
+
+struct O {
+  O() {

Can we choose a different name for it, that does not resemble a digit?


Comment at: test/clang-tidy/modernize-use-default.cpp:147
@@ +146,2 @@
+};
+

Please add a test with a function try block. Something along the lines of:

  struct A {};
  struct B : public A {
B() try : A() {} catch(...) {}
  };



http://reviews.llvm.org/D14145



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


r251588 - [Sema] Implement -Wdouble-promotion for clang.

2015-10-28 Thread George Burgess IV via cfe-commits
Author: gbiv
Date: Wed Oct 28 19:28:52 2015
New Revision: 251588

URL: http://llvm.org/viewvc/llvm-project?rev=251588&view=rev
Log:
[Sema] Implement -Wdouble-promotion for clang.

GCC has a warning called -Wdouble-promotion, which warns you when
an implicit conversion increases the width of a floating point type.

This is useful when writing code for architectures that can perform
hardware FP ops on floats, but must fall back to software emulation for
larger types (i.e. double, long double).

This fixes PR15109 .

Thanks to Carl Norum for the patch!


Added:
cfe/trunk/test/Sema/warn-double-promotion.c
Modified:
cfe/trunk/include/clang/Basic/DiagnosticGroups.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaChecking.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=251588&r1=251587&r2=251588&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Wed Oct 28 19:28:52 2015
@@ -46,6 +46,7 @@ def BoolConversion : DiagGroup<"bool-con
 def IntConversion : DiagGroup<"int-conversion">;
 def EnumConversion : DiagGroup<"enum-conversion">;
 def FloatConversion : DiagGroup<"float-conversion">;
+def DoublePromotion : DiagGroup<"double-promotion">;
 def EnumTooLarge : DiagGroup<"enum-too-large">;
 def UnsupportedNan : DiagGroup<"unsupported-nan">;
 def NonLiteralNullConversion : DiagGroup<"non-literal-null-conversion">;

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=251588&r1=251587&r2=251588&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Oct 28 19:28:52 
2015
@@ -2590,6 +2590,9 @@ def warn_impcast_complex_scalar : Warnin
 def warn_impcast_float_precision : Warning<
   "implicit conversion loses floating-point precision: %0 to %1">,
   InGroup, DefaultIgnore;
+def warn_impcast_double_promotion : Warning<
+  "implicit conversion increases floating-point precision: %0 to %1">,
+  InGroup, DefaultIgnore;
 def warn_impcast_float_integer : Warning<
   "implicit conversion turns floating-point number into integer: %0 to %1">,
   InGroup, DefaultIgnore;

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=251588&r1=251587&r2=251588&view=diff
==
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Wed Oct 28 19:28:52 2015
@@ -7217,6 +7217,14 @@ void CheckImplicitConversion(Sema &S, Ex
   return;
 
 DiagnoseImpCast(S, E, T, CC, diag::warn_impcast_float_precision);
+
+  }
+  // ... or possibly if we're increasing rank, too
+  else if (TargetBT->getKind() > SourceBT->getKind()) {
+if (S.SourceMgr.isInSystemMacro(CC))
+  return;
+
+DiagnoseImpCast(S, E, T, CC, diag::warn_impcast_double_promotion);
   }
   return;
 }

Added: cfe/trunk/test/Sema/warn-double-promotion.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-double-promotion.c?rev=251588&view=auto
==
--- cfe/trunk/test/Sema/warn-double-promotion.c (added)
+++ cfe/trunk/test/Sema/warn-double-promotion.c Wed Oct 28 19:28:52 2015
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -verify -fsyntax-only %s -Wdouble-promotion
+
+float ReturnFloatFromDouble(double d) {
+  return d;
+}
+
+float ReturnFloatFromLongDouble(long double ld) {
+  return ld;
+}
+
+double ReturnDoubleFromLongDouble(long double ld) {
+  return ld;
+}
+
+double ReturnDoubleFromFloat(float f) {
+  return f;  //expected-warning{{implicit conversion increases floating-point 
precision: 'float' to 'double'}}
+}
+
+long double ReturnLongDoubleFromFloat(float f) {
+  return f;  //expected-warning{{implicit conversion increases floating-point 
precision: 'float' to 'long double'}}
+}
+
+long double ReturnLongDoubleFromDouble(double d) {
+  return d;  //expected-warning{{implicit conversion increases floating-point 
precision: 'double' to 'long double'}}
+}
+
+void Convert(float f, double d, long double ld) {
+  d = f;  //expected-warning{{implicit conversion increases floating-point 
precision: 'float' to 'double'}}
+  ld = f; //expected-warning{{implicit conversion increases floating-point 
precision: 'float' to 'long double'}}
+  ld = d; //expected-warning{{implicit conversion increases floating-point 
precision: 'double' to 'long double'}}
+  f = d;
+  f = ld

Re: [PATCH] Bug 15109: Implement -Wdouble-promotion for clang

2015-10-28 Thread George Burgess IV via cfe-commits
Committed as r251588 -- thanks again!

FYI: I'm assuming that you meant to change the test to
warn-double-promotion.c instead of leaving it as warn-double-promotion.cpp,
so I made that fix for you prior to committing. If this is isn't something
you wanted, please let me know. :)

2015-10-28 17:02 GMT-07:00 Carl Norum :

> OK, here you go!
>
> -- Carl
>
>
>
>
> > On Oct 28, 2015, at 4:53 PM, Carl Norum  wrote:
> >
> >
> >> On Oct 28, 2015, at 4:37 PM, George Burgess IV <
> george.burgess...@gmail.com> wrote:
> >>
> >> Thanks for this patch! :) Just a few small nits:
> >> - Is there a reason that test/SemaCXX/warn-double-promotion.cpp can't
> be at test/Sema/warn-double-promotion.c instead?
> >
> > No reason; I just found warn-float-conversion.c in there and this code
> is similar. Can move easily.
> >
> >> - Can we make the warning message a bit more specific? Maybe something
> like "implicit conversion increases floating-point precision: %0 to %1"?
> >
> > Sure thing.
> >
> >> - Please get rid of the empty line after `else if (TargetBT->getKind()
> > SourceBT->getKind()) {`
> >
> > NP. Will send a patch shortly.
> >
> >> After those are fixed, LGTM -- will you need me to commit this for you?
> >
> > I think so yes.
> >
> > -- Carl
> >
> >
> >> On Tue, Oct 27, 2015 at 9:45 PM, Carl Norum via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
> >> Hi folks,
> >>
> >> I had need of this warning, so I cobbled something together. Can
> someone please check it out and let me know if it's reasonable? I'm
> certainly no expert at this stuff. Patch attached for review, thanks!
> >>
> >> -- Carl
> >>
> >>
> >> ___
> >> 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: [PATCH] Bug 15109: Implement -Wdouble-promotion for clang

2015-10-28 Thread Carl Norum via cfe-commits

Oh, that's fine. Sorry about that!

-- Carl Thanks for committing.

> On Oct 28, 2015, at 5:32 PM, George Burgess IV  
> wrote:
> 
> Committed as r251588 -- thanks again!
> 
> FYI: I'm assuming that you meant to change the test to 
> warn-double-promotion.c instead of leaving it as warn-double-promotion.cpp, 
> so I made that fix for you prior to committing. If this is isn't something 
> you wanted, please let me know. :)
> 
> 2015-10-28 17:02 GMT-07:00 Carl Norum :
> OK, here you go!
> 
> -- Carl
> 
> 
> 
> 
> > On Oct 28, 2015, at 4:53 PM, Carl Norum  wrote:
> >
> >
> >> On Oct 28, 2015, at 4:37 PM, George Burgess IV 
> >>  wrote:
> >>
> >> Thanks for this patch! :) Just a few small nits:
> >> - Is there a reason that test/SemaCXX/warn-double-promotion.cpp can't be 
> >> at test/Sema/warn-double-promotion.c instead?
> >
> > No reason; I just found warn-float-conversion.c in there and this code is 
> > similar. Can move easily.
> >
> >> - Can we make the warning message a bit more specific? Maybe something 
> >> like "implicit conversion increases floating-point precision: %0 to %1"?
> >
> > Sure thing.
> >
> >> - Please get rid of the empty line after `else if (TargetBT->getKind() > 
> >> SourceBT->getKind()) {`
> >
> > NP. Will send a patch shortly.
> >
> >> After those are fixed, LGTM -- will you need me to commit this for you?
> >
> > I think so yes.
> >
> > -- Carl
> >
> >
> >> On Tue, Oct 27, 2015 at 9:45 PM, Carl Norum via cfe-commits 
> >>  wrote:
> >> Hi folks,
> >>
> >> I had need of this warning, so I cobbled something together. Can someone 
> >> please check it out and let me know if it's reasonable? I'm certainly no 
> >> expert at this stuff. Patch attached for review, thanks!
> >>
> >> -- Carl
> >>
> >>
> >> ___
> >> 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


r251591 - [analyzer] Update analyzer website for release of checker-277.

2015-10-28 Thread Devin Coughlin via cfe-commits
Author: dcoughlin
Date: Wed Oct 28 20:23:57 2015
New Revision: 251591

URL: http://llvm.org/viewvc/llvm-project?rev=251591&view=rev
Log:
[analyzer] Update analyzer website for release of checker-277.

Modified:
cfe/trunk/www/analyzer/index.html
cfe/trunk/www/analyzer/installation.html
cfe/trunk/www/analyzer/latest_checker.html.incl
cfe/trunk/www/analyzer/release_notes.html

Modified: cfe/trunk/www/analyzer/index.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/analyzer/index.html?rev=251591&r1=251590&r2=251591&view=diff
==
--- cfe/trunk/www/analyzer/index.html (original)
+++ cfe/trunk/www/analyzer/index.html Wed Oct 28 20:23:57 2015
@@ -95,7 +95,7 @@ applications.
   
Mac OS X

-Latest build (Intel-only binary, 10.5+):
+Latest build (10.7+):
  
 
 Release notes

Modified: cfe/trunk/www/analyzer/installation.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/analyzer/installation.html?rev=251591&r1=251590&r2=251591&view=diff
==
--- cfe/trunk/www/analyzer/installation.html (original)
+++ cfe/trunk/www/analyzer/installation.html Wed Oct 28 20:23:57 2015
@@ -23,7 +23,7 @@ get started analyzing your code.
 Packaged Builds (Mac OS X)
 
 Semi-regular pre-built binaries of the analyzer are available on Mac
-OS X.  These are built to run on Mac OS 10.5 and later.
+OS X.  These are built to run on OS X 10.7 and later.
 
 Builds are released frequently.  Often the differences between build
 numbers being a few bug fixes or minor feature improvements.  When using

Modified: cfe/trunk/www/analyzer/latest_checker.html.incl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/analyzer/latest_checker.html.incl?rev=251591&r1=251590&r2=251591&view=diff
==
--- cfe/trunk/www/analyzer/latest_checker.html.incl (original)
+++ cfe/trunk/www/analyzer/latest_checker.html.incl Wed Oct 28 20:23:57 2015
@@ -1 +1 @@
-checker-276.tar.bz2 (built 
February 19, 2014)
+checker-277.tar.bz2 (built 
October 28, 2015)

Modified: cfe/trunk/www/analyzer/release_notes.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/analyzer/release_notes.html?rev=251591&r1=251590&r2=251591&view=diff
==
--- cfe/trunk/www/analyzer/release_notes.html (original)
+++ cfe/trunk/www/analyzer/release_notes.html Wed Oct 28 20:23:57 2015
@@ -15,6 +15,36 @@
 
 Release notes for checker-XXX builds
 
+checker-277
+built: October 28, 2015
+   download: checker-277.tar.bz2
+   highlights:
+   
+Includes about 20 months of change to Clang itself.
+New checker for C++ leaks is turned on by default.
+Added various small checks and bug fixes.
+Added experimental checkers for Objective-C:
+
+New localizability checks:
+
+Checker warning about uses of non-localized NSStrings 
passed to UI methods expecting localized strings.
+Checker warning when the comment argument is missing from 
NSLocalizedString macros.
+These can be enabled by passing the following command to 
scan-build:
+
+    -enable-checker 
alpha.osx.cocoa.NonLocalizedStringChecker,alpha.osx.cocoa.EmptyLocalizationContextChecker
+
+
+
+New checks for _Nonnull type qualifiers. These can be 
enabled with:
+
+    -enable-checker 
nullability.NullPassedToNonnull,nullability.NullReturnedFromNonnull
+New checks for misuse of Objective-C generics. These can be 
enabled with -enable-checker alpha.osx.cocoa.ObjCGenerics.
+
+Support for cf_returns_retained and 
cf_returns_not_retained attributes in out-parameters.
+The analyzer now creates one state for a range switch case instead of 
multiple, resulting in performance improvements.
+Now requires OS X 10.7 or later.
+   
+
 checker-276
 built: February 19, 2014
download: checker-276.tar.bz2


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


r251598 - Driver: tweak CrossWindows sanitizer support

2015-10-28 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Wed Oct 28 22:36:38 2015
New Revision: 251598

URL: http://llvm.org/viewvc/llvm-project?rev=251598&view=rev
Log:
Driver: tweak CrossWindows sanitizer support

Indicate support for ASAN on the CrossWindows toolchain.  Although this is
insufficient, this at least permits the handling of the driver flag.

Modified:
cfe/trunk/lib/Driver/CrossWindowsToolChain.cpp
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/test/Driver/windows-cross.c

Modified: cfe/trunk/lib/Driver/CrossWindowsToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/CrossWindowsToolChain.cpp?rev=251598&r1=251597&r2=251598&view=diff
==
--- cfe/trunk/lib/Driver/CrossWindowsToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/CrossWindowsToolChain.cpp Wed Oct 28 22:36:38 2015
@@ -107,6 +107,12 @@ AddCXXStdlibLibArgs(const llvm::opt::Arg
   }
 }
 
+clang::SanitizerMask CrossWindowsToolChain::getSupportedSanitizers() const {
+  SanitizerMask Res = ToolChain::getSupportedSanitizers();
+  Res |= SanitizerKind::Address;
+  return Res;
+}
+
 Tool *CrossWindowsToolChain::buildLinker() const {
   return new tools::CrossWindows::Linker(*this);
 }

Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=251598&r1=251597&r2=251598&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Wed Oct 28 22:36:38 2015
@@ -937,6 +937,8 @@ public:
   void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const override;
 
+  SanitizerMask getSupportedSanitizers() const override;
+
 protected:
   Tool *buildLinker() const override;
   Tool *buildAssembler() const override;

Modified: cfe/trunk/test/Driver/windows-cross.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/windows-cross.c?rev=251598&r1=251597&r2=251598&view=diff
==
--- cfe/trunk/test/Driver/windows-cross.c (original)
+++ cfe/trunk/test/Driver/windows-cross.c Wed Oct 28 22:36:38 2015
@@ -40,5 +40,17 @@
 
 // RUN: %clang -### -target armv7-windows-itanium --sysroot 
%S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin 
-fuse-ld=lld-link2 -shared -o shared.dll -x c++ %s 2>&1 \
 // RUN:| FileCheck %s --check-prefix CHECK-FUSE-LD
+
 // CHECK-FUSE-LD: "{{.*}}lld-link2"
 
+// RUN: %clang -### -target armv7-windows-itanium --sysroot 
%S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin 
-fuse-ld=lld-link2 -shared -o shared.dll -fsanitize=address -x c++ %s 2>&1 \
+// RUN:| FileCheck %s --check-prefix CHECK-SANITIZE-ADDRESS
+
+// CHECK-SANITIZE-ADDRESS: "-fsanitize=address"
+
+// RUN: %clang -### -target armv7-windows-itanium --sysroot 
%S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin 
-fuse-ld=lld-link2 -shared -o shared.dll -fsanitize=tsan -x c++ %s 2>&1 \
+// RUN:| FileCheck %s --check-prefix CHECK-SANITIZE-TSAN
+
+// CHECK-SANITIZE-TSAN: clang-3.8: error: unsupported argument 'tsan' to 
option 'fsanitize='
+// CHECK-SANITIZE-TSAN-NOT: "-fsanitize={{.*}}"
+


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


r251600 - Driver: CrossWindows sanitizers link support

2015-10-28 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Wed Oct 28 22:36:45 2015
New Revision: 251600

URL: http://llvm.org/viewvc/llvm-project?rev=251600&view=rev
Log:
Driver: CrossWindows sanitizers link support

Add the required libraries to the linker invocation when building with
sanitizers.

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/windows-cross.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=251600&r1=251599&r2=251600&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Oct 28 22:36:45 2015
@@ -9746,6 +9746,22 @@ void CrossWindows::Linker::ConstructJob(
 }
   }
 
+  if (TC.getSanitizerArgs().needsAsanRt()) {
+// TODO handle /MT[d] /MD[d]
+if (Args.hasArg(options::OPT_shared)) {
+  CmdArgs.push_back(TC.getCompilerRTArgString(Args, "asan_dll_thunk"));
+} else {
+  for (const auto &Lib : {"asan_dynamic", "asan_dynamic_runtime_thunk"})
+CmdArgs.push_back(TC.getCompilerRTArgString(Args, Lib));
+// Make sure the dynamic runtime thunk is not optimized out at link 
time
+// to ensure proper SEH handling.
+CmdArgs.push_back(Args.MakeArgString("--undefined"));
+CmdArgs.push_back(Args.MakeArgString(TC.getArch() == llvm::Triple::x86
+ ? "___asan_seh_interceptor"
+ : "__asan_seh_interceptor"));
+}
+  }
+
   Exec = Args.MakeArgString(TC.GetLinkerPath());
 
   C.addCommand(llvm::make_unique(JA, *this, Exec, CmdArgs, Inputs));

Modified: cfe/trunk/test/Driver/windows-cross.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/windows-cross.c?rev=251600&r1=251599&r2=251600&view=diff
==
--- cfe/trunk/test/Driver/windows-cross.c (original)
+++ cfe/trunk/test/Driver/windows-cross.c Wed Oct 28 22:36:45 2015
@@ -47,6 +47,19 @@
 // RUN:| FileCheck %s --check-prefix CHECK-SANITIZE-ADDRESS
 
 // CHECK-SANITIZE-ADDRESS: "-fsanitize=address"
+// CHECK-SANITIZE-ADDRESS: "{{.*}}clang_rt.asan_dll_thunk-arm.lib"
+
+// RUN: %clang -### -target armv7-windows-itanium --sysroot 
%S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin 
-fuse-ld=lld-link2 -o test.exe -fsanitize=address -x c++ %s 2>&1 \
+// RUN:| FileCheck %s --check-prefix CHECK-SANITIZE-ADDRESS-EXE
+
+// CHECK-SANITIZE-ADDRESS-EXE: "-fsanitize=address"
+// CHECK-SANITIZE-ADDRESS-EXE: "{{.*}}clang_rt.asan_dynamic-arm.lib" 
"{{.*}}clang_rt.asan_dynamic_runtime_thunk-arm.lib" "--undefined" 
"__asan_seh_interceptor"
+
+// RUN: %clang -### -target i686-windows-itanium -B 
%S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=lld-link2 -o test.exe 
-fsanitize=address -x c++ %s 2>&1 \
+// RUN:| FileCheck %s --check-prefix CHECK-SANITIZE-ADDRESS-EXE-X86
+
+// CHECK-SANITIZE-ADDRESS-EXE-X86: "-fsanitize=address"
+// CHECK-SANITIZE-ADDRESS-EXE-X86: "{{.*}}clang_rt.asan_dynamic-i686.lib" 
"{{.*}}clang_rt.asan_dynamic_runtime_thunk-i686.lib" "--undefined" 
"___asan_seh_interceptor"
 
 // RUN: %clang -### -target armv7-windows-itanium --sysroot 
%S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin 
-fuse-ld=lld-link2 -shared -o shared.dll -fsanitize=tsan -x c++ %s 2>&1 \
 // RUN:| FileCheck %s --check-prefix CHECK-SANITIZE-TSAN


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


r251599 - Driver: inline some small arrays

2015-10-28 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Wed Oct 28 22:36:42 2015
New Revision: 251599

URL: http://llvm.org/viewvc/llvm-project?rev=251599&view=rev
Log:
Driver:  inline some small arrays

Use an initializer list to remove a couple of small static arrays.  NFC.

Modified:
cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=251599&r1=251598&r2=251599&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Oct 28 22:36:42 2015
@@ -9088,22 +9088,16 @@ void visualstudio::Linker::ConstructJob(
 CmdArgs.push_back(Args.MakeArgString("-debug"));
 CmdArgs.push_back(Args.MakeArgString("-incremental:no"));
 if (Args.hasArg(options::OPT__SLASH_MD, options::OPT__SLASH_MDd)) {
-  static const char *const CompilerRTComponents[] = {
-  "asan_dynamic", "asan_dynamic_runtime_thunk",
-  };
-  for (const auto &Component : CompilerRTComponents)
-CmdArgs.push_back(TC.getCompilerRTArgString(Args, Component));
+  for (const auto &Lib : {"asan_dynamic", "asan_dynamic_runtime_thunk"})
+CmdArgs.push_back(TC.getCompilerRTArgString(Args, Lib));
   // Make sure the dynamic runtime thunk is not optimized out at link time
   // to ensure proper SEH handling.
   
CmdArgs.push_back(Args.MakeArgString("-include:___asan_seh_interceptor"));
 } else if (DLL) {
   CmdArgs.push_back(TC.getCompilerRTArgString(Args, "asan_dll_thunk"));
 } else {
-  static const char *const CompilerRTComponents[] = {
-  "asan", "asan_cxx",
-  };
-  for (const auto &Component : CompilerRTComponents)
-CmdArgs.push_back(TC.getCompilerRTArgString(Args, Component));
+  for (const auto &Lib : {"asan", "asan_cxx"})
+CmdArgs.push_back(TC.getCompilerRTArgString(Args, Lib));
 }
   }
 


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


r251603 - test: fix overzealous match

2015-10-28 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Wed Oct 28 22:52:14 2015
New Revision: 251603

URL: http://llvm.org/viewvc/llvm-project?rev=251603&view=rev
Log:
test: fix overzealous match

Accidentally made the test too strict.

Modified:
cfe/trunk/test/Driver/windows-cross.c

Modified: cfe/trunk/test/Driver/windows-cross.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/windows-cross.c?rev=251603&r1=251602&r2=251603&view=diff
==
--- cfe/trunk/test/Driver/windows-cross.c (original)
+++ cfe/trunk/test/Driver/windows-cross.c Wed Oct 28 22:52:14 2015
@@ -64,6 +64,6 @@
 // RUN: %clang -### -target armv7-windows-itanium --sysroot 
%S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin 
-fuse-ld=lld-link2 -shared -o shared.dll -fsanitize=tsan -x c++ %s 2>&1 \
 // RUN:| FileCheck %s --check-prefix CHECK-SANITIZE-TSAN
 
-// CHECK-SANITIZE-TSAN: clang-3.8: error: unsupported argument 'tsan' to 
option 'fsanitize='
+// CHECK-SANITIZE-TSAN: error: unsupported argument 'tsan' to option 
'fsanitize='
 // CHECK-SANITIZE-TSAN-NOT: "-fsanitize={{.*}}"
 


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


r251611 - Fix a soon to be invalid test

2015-10-28 Thread Xinliang David Li via cfe-commits
Author: davidxl
Date: Wed Oct 28 23:04:07 2015
New Revision: 251611

URL: http://llvm.org/viewvc/llvm-project?rev=251611&view=rev
Log:
Fix a soon to be invalid test

Remove a check that won't be valid when LLVM stops
emitting runtime hook user function.

Modified:
cfe/trunk/test/Profile/gcc-flag-compatibility.c

Modified: cfe/trunk/test/Profile/gcc-flag-compatibility.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Profile/gcc-flag-compatibility.c?rev=251611&r1=251610&r2=251611&view=diff
==
--- cfe/trunk/test/Profile/gcc-flag-compatibility.c (original)
+++ cfe/trunk/test/Profile/gcc-flag-compatibility.c Wed Oct 28 23:04:07 2015
@@ -9,7 +9,6 @@
 
 // Check that -fprofile-generate uses the runtime default profile file.
 // RUN: %clang %s -c -S -o - -emit-llvm -fprofile-generate | FileCheck 
-check-prefix=PROFILE-GEN %s
-// PROFILE-GEN: @__llvm_profile_runtime = external global i32
 // PROFILE-GEN-NOT: call void @__llvm_profile_override_default_filename
 // PROFILE-GEN-NOT: declare void @__llvm_profile_override_default_filename(i8*)
 


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


[libcxx] r251618 - Implement P0004R1 'Remove Deprecated iostreams aliases'

2015-10-28 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Oct 29 00:43:30 2015
New Revision: 251618

URL: http://llvm.org/viewvc/llvm-project?rev=251618&view=rev
Log:
Implement P0004R1 'Remove Deprecated iostreams aliases'

Modified:
libcxx/trunk/include/ios
libcxx/trunk/test/std/depr/depr.ios.members/io_state.pass.cpp
libcxx/trunk/test/std/depr/depr.ios.members/open_mode.pass.cpp
libcxx/trunk/test/std/depr/depr.ios.members/seek_dir.pass.cpp
libcxx/trunk/test/std/depr/depr.ios.members/streamoff.pass.cpp
libcxx/trunk/test/std/depr/depr.ios.members/streampos.pass.cpp
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/include/ios
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/ios?rev=251618&r1=251617&r2=251618&view=diff
==
--- libcxx/trunk/include/ios (original)
+++ libcxx/trunk/include/ios Thu Oct 29 00:43:30 2015
@@ -114,9 +114,9 @@ class basic_ios
 public:
 // types:
 typedef charT char_type;
-typedef typename traits::int_type int_type;
-typedef typename traits::pos_type pos_type;
-typedef typename traits::off_type off_type;
+typedef typename traits::int_type int_type;  // removed in C++17
+typedef typename traits::pos_type pos_type;  // removed in C++17
+typedef typename traits::off_type off_type;  // removed in C++17
 typedef traits traits_type;
 
 operator unspecified-bool-type() const;
@@ -254,14 +254,12 @@ public:
 static const fmtflags floatfield  = scientific | fixed;
 
 typedef unsigned int iostate;
-typedef iostate  io_state;
 static const iostate badbit  = 0x1;
 static const iostate eofbit  = 0x2;
 static const iostate failbit = 0x4;
 static const iostate goodbit = 0x0;
 
 typedef unsigned int openmode;
-typedef openmode open_mode;
 static const openmode app= 0x01;
 static const openmode ate= 0x02;
 static const openmode binary = 0x04;
@@ -270,10 +268,15 @@ public:
 static const openmode trunc  = 0x20;
 
 enum seekdir {beg, cur, end};
-typedef seekdir seek_dir;
+
+#if _LIBCPP_STD_VER <= 14
+typedef iostate  io_state;
+typedef openmode open_mode;
+typedef seekdir  seek_dir;
 
 typedef _VSTD::streamoff streamoff;
 typedef _VSTD::streampos streampos;
+#endif
 
 class _LIBCPP_TYPE_VIS Init;
 

Modified: libcxx/trunk/test/std/depr/depr.ios.members/io_state.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.ios.members/io_state.pass.cpp?rev=251618&r1=251617&r2=251618&view=diff
==
--- libcxx/trunk/test/std/depr/depr.ios.members/io_state.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.ios.members/io_state.pass.cpp Thu Oct 29 
00:43:30 2015
@@ -15,11 +15,16 @@
 // typedef T1 io_state;
 // };
 
+//  These members were removed for C++17
+
+#include "test_macros.h"
 #include 
 #include 
 
 int main()
 {
+#if TEST_STD_VER <= 14
 std::strstream::io_state b = std::strstream::eofbit;
 assert(b == std::ios::eofbit);
+#endif
 }

Modified: libcxx/trunk/test/std/depr/depr.ios.members/open_mode.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.ios.members/open_mode.pass.cpp?rev=251618&r1=251617&r2=251618&view=diff
==
--- libcxx/trunk/test/std/depr/depr.ios.members/open_mode.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.ios.members/open_mode.pass.cpp Thu Oct 29 
00:43:30 2015
@@ -15,11 +15,16 @@
 // typedef T2 open_mode;
 // };
 
+//  These members were removed for C++17
+
+#include "test_macros.h"
 #include 
 #include 
 
 int main()
 {
+#if TEST_STD_VER <= 14
 std::strstream::open_mode b = std::strstream::app;
 assert(b == std::ios::app);
+#endif
 }

Modified: libcxx/trunk/test/std/depr/depr.ios.members/seek_dir.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.ios.members/seek_dir.pass.cpp?rev=251618&r1=251617&r2=251618&view=diff
==
--- libcxx/trunk/test/std/depr/depr.ios.members/seek_dir.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.ios.members/seek_dir.pass.cpp Thu Oct 29 
00:43:30 2015
@@ -15,11 +15,16 @@
 // typedef T3 seek_dir;
 // };
 
+//  These members were removed for C++17
+
+#include "test_macros.h"
 #include 
 #include 
 
 int main()
 {
+#if TEST_STD_VER <= 14
 std::strstream::seek_dir b = std::strstream::cur;
 assert(b == std::ios::cur);
+#endif
 }

Modified: libcxx/trunk/test/std/depr/depr.ios.members/streamoff.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.ios.members/streamoff.pass.cpp?rev=251618&r1=251617&r2=251618&view=diff
==
--- libcxx/trunk/test/std/depr/depr

Re: r251567 - Fix the calling convention of Mingw64 long double values

2015-10-28 Thread Yaron Keren via cfe-commits
Thanks!


2015-10-29 0:29 GMT+02:00 Reid Kleckner via cfe-commits <
cfe-commits@lists.llvm.org>:

> Author: rnk
> Date: Wed Oct 28 17:29:52 2015
> New Revision: 251567
>
> URL: http://llvm.org/viewvc/llvm-project?rev=251567&view=rev
> Log:
> Fix the calling convention of Mingw64 long double values
>
> GCC uses the x87DoubleExtended model for long doubles, and passes them
> indirectly by address through function calls.
>
> Also replace the existing mingw-long-double assembly emitting test with
> an IR-level test.
>
> Modified:
> cfe/trunk/lib/Basic/Targets.cpp
> cfe/trunk/lib/CodeGen/TargetInfo.cpp
> cfe/trunk/test/CodeGen/mingw-long-double.c
>
> Modified: cfe/trunk/lib/Basic/Targets.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=251567&r1=251566&r2=251567&view=diff
>
> ==
> --- cfe/trunk/lib/Basic/Targets.cpp (original)
> +++ cfe/trunk/lib/Basic/Targets.cpp Wed Oct 28 17:29:52 2015
> @@ -4009,7 +4009,13 @@ public:
>  class MinGWX86_64TargetInfo : public WindowsX86_64TargetInfo {
>  public:
>MinGWX86_64TargetInfo(const llvm::Triple &Triple)
> -  : WindowsX86_64TargetInfo(Triple) {}
> +  : WindowsX86_64TargetInfo(Triple) {
> +// Mingw64 rounds long double size and alignment up to 16 bytes, but
> sticks
> +// with x86 FP ops. Weird.
> +LongDoubleWidth = LongDoubleAlign = 128;
> +LongDoubleFormat = &llvm::APFloat::x87DoubleExtended;
> +  }
> +
>void getTargetDefines(const LangOptions &Opts,
>  MacroBuilder &Builder) const override {
>  WindowsX86_64TargetInfo::getTargetDefines(Opts, Builder);
>
> Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=251567&r1=251566&r2=251567&view=diff
>
> ==
> --- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Wed Oct 28 17:29:52 2015
> @@ -1772,12 +1772,10 @@ public:
>
>  /// WinX86_64ABIInfo - The Windows X86_64 ABI information.
>  class WinX86_64ABIInfo : public ABIInfo {
> -
> -  ABIArgInfo classify(QualType Ty, unsigned &FreeSSERegs,
> -  bool IsReturnType) const;
> -
>  public:
> -  WinX86_64ABIInfo(CodeGen::CodeGenTypes &CGT) : ABIInfo(CGT) {}
> +  WinX86_64ABIInfo(CodeGen::CodeGenTypes &CGT)
> +  : ABIInfo(CGT),
> +IsMingw64(getTarget().getTriple().isWindowsGNUEnvironment()) {}
>
>void computeInfo(CGFunctionInfo &FI) const override;
>
> @@ -1794,6 +1792,12 @@ public:
>  // FIXME: Assumes vectorcall is in use.
>  return isX86VectorCallAggregateSmallEnough(NumMembers);
>}
> +
> +private:
> +  ABIArgInfo classify(QualType Ty, unsigned &FreeSSERegs,
> +  bool IsReturnType) const;
> +
> +  bool IsMingw64;
>  };
>
>  class X86_64TargetCodeGenInfo : public TargetCodeGenInfo {
> @@ -3317,7 +3321,7 @@ ABIArgInfo WinX86_64ABIInfo::classify(Qu
>
>TypeInfo Info = getContext().getTypeInfo(Ty);
>uint64_t Width = Info.Width;
> -  unsigned Align =
> getContext().toCharUnitsFromBits(Info.Align).getQuantity();
> +  CharUnits Align = getContext().toCharUnitsFromBits(Info.Align);
>
>const RecordType *RT = Ty->getAs();
>if (RT) {
> @@ -3330,9 +3334,9 @@ ABIArgInfo WinX86_64ABIInfo::classify(Qu
>return getNaturalAlignIndirect(Ty, /*ByVal=*/false);
>
>  // FIXME: mingw-w64-gcc emits 128-bit struct as i128
> -if (Width == 128 && getTarget().getTriple().isWindowsGNUEnvironment())
> -  return ABIArgInfo::getDirect(llvm::IntegerType::get(getVMContext(),
> -  Width));
> +if (Width == 128 && IsMingw64)
> +  return ABIArgInfo::getDirect(
> +  llvm::IntegerType::get(getVMContext(), Width));
>}
>
>// vectorcall adds the concept of a homogenous vector aggregate,
> similar to
> @@ -3346,8 +3350,7 @@ ABIArgInfo WinX86_64ABIInfo::classify(Qu
>  return ABIArgInfo::getDirect();
>return ABIArgInfo::getExpand();
>  }
> -return ABIArgInfo::getIndirect(CharUnits::fromQuantity(Align),
> -   /*ByVal=*/false);
> +return ABIArgInfo::getIndirect(Align, /*ByVal=*/false);
>}
>
>
> @@ -3375,6 +3378,14 @@ ABIArgInfo WinX86_64ABIInfo::classify(Qu
>if (BT && BT->getKind() == BuiltinType::Bool)
>  return ABIArgInfo::getExtend();
>
> +  // Mingw64 GCC uses the old 80 bit extended precision floating point
> unit. It
> +  // passes them indirectly through memory.
> +  if (IsMingw64 && BT && BT->getKind() == BuiltinType::LongDouble) {
> +const llvm::fltSemantics *LDF = &getTarget().getLongDoubleFormat();
> +if (LDF == &llvm::APFloat::x87DoubleExtended)
> +  return ABIArgInfo::getIndirect(Align, /*ByVal=*/false);
> +  }
> +
>return ABIArgInfo::getDirect();
>  }
>
>
> Modified: cfe/

Re: [PATCH] D14014: Checker of proper vfork usage

2015-10-28 Thread Yury Gribov via cfe-commits
ygribov added a comment.

Done!


http://reviews.llvm.org/D14014



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


Re: [PATCH] D14014: Checker of proper vfork usage

2015-10-28 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

Thanks for the patch!

Some minor comments inline.

What happens when this checker and the security.insecureAPI.vfork are enabled 
at the same time?

Did you run this checker on a large body of code? Did it find any issues? What 
is needed to turn this into a non-alpha checker?



Comment at: lib/StaticAnalyzer/Checkers/VforkChecker.cpp:10
@@ +9,3 @@
+//
+//  This file defines vfork checker which checks for dangerous uses of vfork.
+//

Let's move the more detailed comment that describes what the checker does here.


Comment at: lib/StaticAnalyzer/Checkers/VforkChecker.cpp:44
@@ +43,3 @@
+// Pattern matches to extract lhs in `lhs = vfork()' statement.
+static const VarDecl *GetAssignedVariable(const CallEvent &Call,
+   CheckerContext &C) {

This should be added as a utility function. Does this exist elsewhere?


Comment at: lib/StaticAnalyzer/Checkers/VforkChecker.cpp:63
@@ +62,3 @@
+  return D;
+  } while (0);
+

Can this be rewritten so that it is more clear why this terminates? 
Also, I'd prefer to use "while(true)".


Comment at: lib/StaticAnalyzer/Checkers/VforkChecker.cpp:155
@@ +154,3 @@
+if (!BT)
+  BT.reset(new BuiltinBug(this, "Dangerous construct in vforked process"));
+

"a vforked process"?


Comment at: lib/StaticAnalyzer/Checkers/VforkChecker.cpp:160
@@ +159,3 @@
+
+os << What << " is prohibited after successful vfork";
+

"after successful vfork" -> "after a successful vfork"?
Devin, are we missing an article here and in the other error messages?


Comment at: lib/StaticAnalyzer/Checkers/VforkChecker.cpp:163
@@ +162,3 @@
+auto Report = llvm::make_unique(*BT, os.str(), N);
+C.emitReport(std::move(Report));
+  }

Ideally, we would point out where the vfork has occurred along the path with a 
BugReportVisitor. (But it's not a blocker.)


Comment at: lib/StaticAnalyzer/Checkers/VforkChecker.cpp:208
@@ +207,3 @@
+  && !isCallWhitelisted(Call.getCalleeIdentifier(), C))
+reportBug("Calling functions (except exec(3) or _exit(2))", C);
+}

We are not listing the full whitelist here. Should we drop the "(except ..)" 
from the message?


Comment at: lib/StaticAnalyzer/Checkers/VforkChecker.cpp:226
@@ +225,3 @@
+
+  reportBug("Assigning variables (except return value of vfork)", C);
+}

"except return value" -> "except the return value"? Or maybe we should drop the 
"(except ...)" here as well to make the message shorter.


Comment at: test/Analysis/vfork.c:24
@@ +23,3 @@
+// Ensure that writing variables is prohibited.
+x = 0; // expected-warning{{}}
+break;

We should check for the exact expected warning in regression tests.


http://reviews.llvm.org/D14014



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