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 =(const OL &);
+  int Field;
+};
+OL::OL(const OL ) : 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 ) = default;
+OL ::operator=(const OL ) {
+  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 ::operator=(const OL ) = default;
+
+// Inline.
+struct IL {
+  IL(const IL ) : Field(Other.Field) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: IL(const IL ) = default;
+  IL =(const IL ) {
+Field = Other.Field;
+return *this;
+  }
+  // CHECK-MESSAGES: :[[@LINE-4]]:3: warning: use '= default'
+  // CHECK-FIXES: IL =(const IL ) = default;
+  int Field;
+};
+
+// Wrong type.
+struct WT {
+  WT(const IL ) {}
+  WT =(const IL &);
+};
+WT ::operator=(const IL ) { return *this; }
+
+// Qualifiers.
+struct Qual {
+  Qual(const Qual ) : 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 ) = default;
+
+  int Field;
+  volatile char Volatile;
+  mutable bool Mutable;
+  const OL  // 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 ) : Field1(Other.Field1), Field2(Other.Field1) {}
+  WI =(const WI &);
+  int Field1, Field2;
+};
+WI ::operator=(const WI ) {
+  Field1 = Other.Field1;
+  Field2 = Other.Field1;
+  return *this;
+}
+
+// Missing field.
+struct MF {
+  MF(const MF ) : Field1(Other.Field1), Field2(Other.Field2) {}
+  MF =(const MF &);
+  int Field1, Field2, Field3;
+};
+MF ::operator=(const MF ) {
+  Field1 = Other.Field1;
+  Field2 = Other.Field2;
+  return *this;
+}
+
+struct Comments {
+  Comments(const Comments )
+  /* don't delete */ : /* this comment */ Field(Other.Field) {}
+  int Field;
+};
+
+struct MoreComments {
+  MoreComments(const MoreComments ) /* this comment is OK */
+  : Field(Other.Field) {}
+  // CHECK-MESSAGES: :[[@LINE-2]]:3: warning: use '= default'
+  // CHECK-FIXES: MoreComments(const MoreComments ) /* this comment is OK */
+  // CHECK-FIXES-NEXT: = default;
+  int Field;
+};
+
+struct ColonInComment {
+  ColonInComment(const ColonInComment ) /* : */ : Field(Other.Field) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: ColonInComment(const ColonInComment ) /* : */ = default;
+  int Field;
+};
+
+// No members or bases (in particular, no colon).
+struct Empty {
+  Empty(const Empty ) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: Empty(const Empty ) = default;
+  Empty =(const Empty &);
+};
+Empty ::operator=(const Empty ) { return *this; }
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use '= default'
+// CHECK-FIXES: Empty ::operator=(const Empty ) = default;
+
+// Bit fields.
+struct BF {
+  BF() = default;
+  BF(const BF ) : 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 ) = default;
+  BF =(const BF &);
+
+  unsigned Field1 : 3;
+  int : 7;
+  char Field2 : 6;
+  int : 0;
+  int Field3 : 24;
+  unsigned char Field4;
+};
+BF ::operator=(const BF ) {
+  Field1 = Other.Field1;
+  Field2 = Other.Field2;
+  Field3 = Other.Field3;
+  Field4 = Other.Field4;
+  return *this;
+}
+// CHECK-MESSAGES: :[[@LINE-7]]:1: warning: use '= default'
+// CHECK-FIXES: BF ::operator=(const BF 

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] 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=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=251513=251514=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=251513=251514=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=251513=251514=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 , QualType Type, const VarDecl *LHSVar,
 const VarDecl *RHSVar,
 const llvm::function_refgetOption().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=251513=251514=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=251513=251514=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 

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] 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 =(const OL &);
+  int Field;
+};
+OL::OL(const OL ) : 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 ) = default;
+OL ::operator=(const OL ) {
+  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 ::operator=(const OL ) = default;
+
+// Inline.
+struct IL {
+  IL(const IL ) : Field(Other.Field) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: IL(const IL ) = default;
+  IL =(const IL ) {
+Field = Other.Field;
+return *this;
+  }
+  // CHECK-MESSAGES: :[[@LINE-4]]:3: warning: use '= default'
+  // CHECK-FIXES: IL =(const IL ) = default;
+  int Field;
+};
+
+// Wrong type.
+struct WT {
+  WT(const IL ) {}
+  WT =(const IL &);
+};
+WT ::operator=(const IL ) { return *this; }
+
+// Qualifiers.
+struct Qual {
+  Qual(const Qual ) : 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 ) = default;
+
+  int Field;
+  volatile char Volatile;
+  mutable bool Mutable;
+  const OL  // 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 ) : Field1(Other.Field1), Field2(Other.Field1) {}
+  WI =(const WI &);
+  int Field1, Field2;
+};
+WI ::operator=(const WI ) {
+  Field1 = Other.Field1;
+  Field2 = Other.Field1;
+  return *this;
+}
+
+// Missing field.
+struct MF {
+  MF(const MF ) : Field1(Other.Field1), Field2(Other.Field2) {}
+  MF =(const MF &);
+  int Field1, Field2, Field3;
+};
+MF ::operator=(const MF ) {
+  Field1 = Other.Field1;
+  Field2 = Other.Field2;
+  return *this;
+}
+
+struct Comments {
+  Comments(const Comments )
+  /* don't delete */ : /* this comment */ Field(Other.Field) {}
+  int Field;
+};
+
+struct MoreComments {
+  MoreComments(const MoreComments ) /* this comment is OK */
+  : Field(Other.Field) {}
+  // CHECK-MESSAGES: :[[@LINE-2]]:3: warning: use '= default'
+  // CHECK-FIXES: MoreComments(const MoreComments ) /* this comment is OK */
+  // CHECK-FIXES-NEXT: = default;
+  int Field;
+};
+
+struct ColonInComment {
+  ColonInComment(const ColonInComment ) /* : */ : Field(Other.Field) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: ColonInComment(const ColonInComment ) /* : */ = default;
+  int Field;
+};
+
+// No members or bases (in particular, no colon).
+struct Empty {
+  Empty(const Empty ) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: Empty(const Empty ) = default;
+  Empty =(const Empty &);
+};
+Empty ::operator=(const Empty ) { return *this; }
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use '= default'
+// CHECK-FIXES: Empty ::operator=(const Empty ) = default;
+
+// Bit fields.
+struct BF {
+  BF() = default;
+  BF(const BF ) : 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 ) = default;
+  BF =(const BF &);
+
+  unsigned Field1 : 3;
+  int : 7;
+  char Field2 : 6;
+  int : 0;
+  int Field3 : 24;
+  unsigned char Field4;
+};
+BF ::operator=(const BF ) {
+  Field1 = Other.Field1;
+  Field2 = Other.Field2;
+  Field3 = 

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=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=251519=251520=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


r251501 - Reflow comment.

2015-10-28 Thread Eric Christopher via cfe-commits
Author: echristo
Date: Wed Oct 28 01:56:25 2015
New Revision: 251501

URL: http://llvm.org/viewvc/llvm-project?rev=251501=rev
Log:
Reflow comment.

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

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=251501=251500=251501=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Wed Oct 28 01:56:25 2015
@@ -324,12 +324,10 @@ bool CodeGenFunction::checkBuiltinTarget
 if (ParsedAttr.second != "")
   TargetCPU = ParsedAttr.second;
 
-// Now populate the feature map, first with the TargetCPU which is
-// either
-// the default or a new one from the target attribute string. Then we'll
-// use the passed in features (FeaturesAsWritten) along with the new
-// ones
-// from the attribute.
+// Now populate the feature map, first with the TargetCPU which is either
+// the default or a new one from the target attribute string. Then we'll 
use
+// the passed in features (FeaturesAsWritten) along with the new ones from
+// the attribute.
 Target.initFeatureMap(FeatureMap, CGM.getDiags(), TargetCPU,
   ParsedAttr.first);
   } else {


___
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 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 ) {
@@ -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 ) {
@@ -466,9 +468,9 @@
 : tools::arm::getARMTargetCPU(MCPU, MArch, Triple);
 StringRef Suffix =
   

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


[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 =(const A &);
+///   A =(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  == 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  == 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 =(const A &);
+///   A =(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  == 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  == 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 =(const OL &);
+  int Field;
+};
+OL::OL(const OL ) : 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 ) = default;
+OL ::operator=(const OL ) {
+  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 ::operator=(const OL ) = default;
+
+// Inline.
+struct IL {
+  IL(const IL ) : Field(Other.Field) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: IL(const IL ) = default;
+  IL =(const IL ) {
+Field = Other.Field;
+return *this;
+  }
+  // CHECK-MESSAGES: :[[@LINE-4]]:3: warning: use '= default'
+  // CHECK-FIXES: IL =(const IL ) = default;
+  int Field;
+};
+
+// Wrong type.
+struct WT {
+  WT(const IL ) {}
+  WT =(const IL &);
+};
+WT ::operator=(const IL ) { return *this; }
+
+// Qualifiers.
+struct Qual {
+  Qual(const Qual ) : 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 ) = default;
+
+  int Field;
+  volatile char Volatile;
+  mutable bool Mutable;
+  const OL  // 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 ) : Field1(Other.Field1), Field2(Other.Field1) {}
+  WI =(const WI &);
+  int Field1, Field2;
+};
+WI ::operator=(const WI ) {
+  Field1 = Other.Field1;
+  Field2 = Other.Field1;
+  return *this;
+}
+
+// Missing field.
+struct MF {
+  MF(const MF ) : Field1(Other.Field1), Field2(Other.Field2) {}
+  MF =(const MF &);
+  int Field1, Field2, Field3;
+};
+MF ::operator=(const MF ) {
+  Field1 = Other.Field1;
+  Field2 = Other.Field2;
+  return *this;
+}
+
+struct Comments {
+  Comments(const Comments )
+  /* don't delete */ : /* this comment */ Field(Other.Field) {}
+  int Field;
+};
+
+struct MoreComments {
+  MoreComments(const MoreComments ) /* this comment is OK */
+  : Field(Other.Field) {}
+  // CHECK-MESSAGES: :[[@LINE-2]]:3: warning: use '= default'
+  // CHECK-FIXES: MoreComments(const MoreComments ) /* this comment is OK */
+  // CHECK-FIXES-NEXT: = default;
+  int Field;
+};
+
+struct ColonInComment {
+  ColonInComment(const ColonInComment ) /* : */ : Field(Other.Field) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: ColonInComment(const ColonInComment ) /* : */ = default;
+  int Field;
+};
+
+// No members or bases (in particular, no colon).
+struct Empty {
+  Empty(const Empty ) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: Empty(const Empty ) = default;
+  Empty =(const Empty &);
+};
+Empty ::operator=(const Empty ) { return *this; }
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use '= default'
+// CHECK-FIXES: Empty ::operator=(const Empty ) = default;
+
+// Bit fields.
+struct BF {
+  BF() = default;
+  BF(const BF ) : 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 ) = default;
+  BF =(const BF &);
+
+  unsigned Field1 : 3;
+  int : 7;
+  char Field2 : 6;
+  int : 0;
+  int Field3 : 24;
+  unsigned char Field4;
+};
+BF ::operator=(const BF ) {
+  Field1 = Other.Field1;
+  Field2 = Other.Field2;
+  Field3 = Other.Field3;
+  Field4 = 

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


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 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


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: [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: [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 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


[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=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=251528=251529=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: [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" 
> > 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 
>> > 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 
>>> > 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" 
 > 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 
 > > wrote:
 >
 > Author: rsmith
 > Date: Fri Oct  9 20:25:31 2015
 > New Revision: 249929
 >
 > URL: http://llvm.org/viewvc/llvm-project?rev=249929=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=249928=249929=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


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=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=251527=251528=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=251527=251528=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 
   bool disabledDebugInfo;
@@ -2862,6 +2860,8 @@ struct DisableDebugLocationUpdates {
   }
 };
 
+} // end anonymous namespace
+
 void CodeGenFunction::EmitCallArg(CallArgList , 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


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=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=251384=251385=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 ,
> + llvm::opt::ArgStringList ) 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 , const llvm::Triple ,
>
> Modified: cfe/trunk/lib/Driver/ToolChains.h
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=251385=251384=251385=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 ) const override;
>bool isPIEDefault() const override;
>SanitizerMask getSupportedSanitizers() const override;
> +  void addProfileRTLibs(const llvm::opt::ArgList ,
> +llvm::opt::ArgStringList ) 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: 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=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: 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=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=251384=251385=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 ,
>> + llvm::opt::ArgStringList ) 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 , const llvm::Triple ,
>> 
>> Modified: cfe/trunk/lib/Driver/ToolChains.h
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=251385=251384=251385=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 ) const override;
>>   bool isPIEDefault() const override;
>>   SanitizerMask getSupportedSanitizers() const override;
>> +  void addProfileRTLibs(const llvm::opt::ArgList ,
>> +llvm::opt::ArgStringList ) 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] 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  }


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


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;
+  

[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=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=251544=251545=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
 chronoKona
-   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


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=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=251598=251599=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  : CompilerRTComponents)
-CmdArgs.push_back(TC.getCompilerRTArgString(Args, Component));
+  for (const auto  : {"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  : CompilerRTComponents)
-CmdArgs.push_back(TC.getCompilerRTArgString(Args, Component));
+  for (const auto  : {"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


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=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=251599=251600=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  : {"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=251599=251600=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


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=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=251610=251611=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


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=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=251602=251603=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


[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=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=251617=251618=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=251617=251618=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=251617=251618=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=251617=251618=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=251617=251618=diff
==
--- libcxx/trunk/test/std/depr/depr.ios.members/streamoff.pass.cpp (original)
+++ 

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=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=251566=251567=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 )
> -  : 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 = ::APFloat::x87DoubleExtended;
> +  }
> +
>void getTargetDefines(const LangOptions ,
>  MacroBuilder ) 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=251566=251567=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 ,
> -  bool IsReturnType) const;
> -
>  public:
> -  WinX86_64ABIInfo(CodeGen::CodeGenTypes ) : ABIInfo(CGT) {}
> +  WinX86_64ABIInfo(CodeGen::CodeGenTypes )
> +  : ABIInfo(CGT),
> +IsMingw64(getTarget().getTriple().isWindowsGNUEnvironment()) {}
>
>void computeInfo(CGFunctionInfo ) const override;
>
> @@ -1794,6 +1792,12 @@ public:
>  // FIXME: Assumes vectorcall is in use.
>  return isX86VectorCallAggregateSmallEnough(NumMembers);
>}
> +
> +private:
> +  ABIArgInfo classify(QualType Ty, unsigned ,
> +  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 = ().getLongDoubleFormat();
> +if (LDF == ::APFloat::x87DoubleExtended)
> +  return ABIArgInfo::getIndirect(Align, /*ByVal=*/false);
> +  }
> +
>return ABIArgInfo::getDirect();
>  }
>
>
> Modified: cfe/trunk/test/CodeGen/mingw-long-double.c
> URL:
> 

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=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=251551=251552=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: [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=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=251528=251529=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: 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=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: [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 ) {

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 ) {
   // 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(
+  (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


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


[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=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=251502=251503=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