[PATCH] D35961: [llvm] Update MachOObjectFile::exports interface

2017-07-27 Thread Saleem Abdulrasool via Phabricator via cfe-commits
compnerd added a comment.

Does anyone use the overload with the `O` for `exports` with `nullptr` instead 
of `this`?  If not, we could just inline `this` throughout.




Comment at: tools/llvm-nm/llvm-nm.cpp:1230
   Error Err = Error::success();
-  for (const llvm::object::ExportEntry  : MachO->exports(Err,
-   MachO)) {
+  for (const llvm::object::ExportEntry  : MachO->exports(Err)) {
 bool found = false;

I think that using `auto` here instead of `llvm::object:ExportEntry` is better 
for readability.



Comment at: tools/llvm-objdump/MachODump.cpp:9406
   Error Err = Error::success();
-  for (const llvm::object::ExportEntry  : Obj->exports(Err, Obj)) {
+  for (const llvm::object::ExportEntry  : Obj->exports(Err)) {
 uint64_t Flags = Entry.flags();

Similar.


Repository:
  rL LLVM

https://reviews.llvm.org/D35961



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


[PATCH] D35972: Add warning to clang-reorder-fields when reordering breaks member init list dependencies

2017-07-27 Thread Alexander Shaposhnikov via Phabricator via cfe-commits
alexshap added inline comments.



Comment at: test/clang-reorder-fields/FieldDependencyWarning.cpp:3
+
+#include 
+

tests should not depend on STL (for good examples see how things are done in 
clang-tidy tests), so simply remove this include and define a small class with 
a constructor right here 


Repository:
  rL LLVM

https://reviews.llvm.org/D35972



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


[PATCH] D35972: Add warning to clang-reorder-fields when reordering breaks member init list dependencies

2017-07-27 Thread Saleem Abdulrasool via Phabricator via cfe-commits
compnerd added inline comments.



Comment at: clang-reorder-fields/ReorderFieldsAction.cpp:111
+Results.insert(FD);
+  return Results;
+}

What if the `FieldDecl` belongs to a base class?  Can you add a test case for 
that scenario?


Repository:
  rL LLVM

https://reviews.llvm.org/D35972



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


[libclc] r309358 - add __kernel_exec macros

2017-07-27 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Thu Jul 27 20:39:03 2017
New Revision: 309358

URL: http://llvm.org/viewvc/llvm-project?rev=309358=rev
Log:
add __kernel_exec macros

also consolidate macros into one file, and rename to clcmacros.h

Signed-off-by: Jan Vesely 
Reviewed-by: Aaron Watry 

Added:
libclc/trunk/generic/include/clc/clcmacros.h
Removed:
libclc/trunk/generic/include/clc/clcversion.h
Modified:
libclc/trunk/generic/include/clc/clc.h
libclc/trunk/generic/include/clc/clctypes.h

Modified: libclc/trunk/generic/include/clc/clc.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=309358=309357=309358=diff
==
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Thu Jul 27 20:39:03 2017
@@ -21,7 +21,7 @@
 #include 
 
 /* 6.9 Preprocessor Directives and Macros */
-#include 
+#include 
 
 /* 6.11.1 Work-Item Functions */
 #include 

Added: libclc/trunk/generic/include/clc/clcmacros.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clcmacros.h?rev=309358=auto
==
--- libclc/trunk/generic/include/clc/clcmacros.h (added)
+++ libclc/trunk/generic/include/clc/clcmacros.h Thu Jul 27 20:39:03 2017
@@ -0,0 +1,18 @@
+/* 6.9 Preprocessor Directives and Macros
+ * Some of these are handled by clang or passed by clover */
+#if __OPENCL_VERSION__ >= 110
+#define CLC_VERSION_1_0 100
+#define CLC_VERSION_1_1 110
+#endif
+
+#if __OPENCL_VERSION__ >= 120
+#define CLC_VERSION_1_2 120
+#endif
+
+#define NULL ((void*)NULL)
+
+#define __kernel_exec(X, typen) __kernel \
+__attribute__((work_group_size_hint(X, 1, 1))) 
\
+__attribute__((vec_type_hint(typen)))
+
+#define kernel_exec(X, typen) __kernel_exec(X, typen)

Modified: libclc/trunk/generic/include/clc/clctypes.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clctypes.h?rev=309358=309357=309358=diff
==
--- libclc/trunk/generic/include/clc/clctypes.h (original)
+++ libclc/trunk/generic/include/clc/clctypes.h Thu Jul 27 20:39:03 2017
@@ -85,5 +85,3 @@ typedef __attribute__((ext_vector_type(4
 typedef __attribute__((ext_vector_type(8))) double double8;
 typedef __attribute__((ext_vector_type(16))) double double16;
 #endif
-
-#define NULL ((void *)0)

Removed: libclc/trunk/generic/include/clc/clcversion.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clcversion.h?rev=309357=auto
==
--- libclc/trunk/generic/include/clc/clcversion.h (original)
+++ libclc/trunk/generic/include/clc/clcversion.h (removed)
@@ -1,8 +0,0 @@
-#if __OPENCL_VERSION__ >= 110
-#define CLC_VERSION_1_0 100
-#define CLC_VERSION_1_1 110
-#endif
-
-#if __OPENCL_VERSION__ >= 120
-#define CLC_VERSION_1_2 120
-#endif


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


[PATCH] D35972: Add warning to clang-reorder-fields when reordering breaks member init list dependencies

2017-07-27 Thread Sam Conrad via Phabricator via cfe-commits
sameconrad created this revision.
sameconrad added a project: clang-tools-extra.

This adds a warning emitted by clang-reorder-fields when the reordering fields 
breaks dependencies in the initializer list (such that -Wuninitialized would 
warn when compiling).  For example, given:
Foo::Foo(int x)

  : a(x)
  , b(a) {}

Reordering fields to [b,a] gives:
Foo::Foo(int x)

  : b(a)
  , a(x) {}

Emits the warning:
2: Warning: reordering field a after b makes a uninitialized when used in init 
expression.


https://reviews.llvm.org/D35972

Files:
  clang-reorder-fields/ReorderFieldsAction.cpp
  test/clang-reorder-fields/FieldDependencyWarning.cpp

Index: test/clang-reorder-fields/FieldDependencyWarning.cpp
===
--- test/clang-reorder-fields/FieldDependencyWarning.cpp
+++ test/clang-reorder-fields/FieldDependencyWarning.cpp
@@ -0,0 +1,42 @@
+// RUN: clang-reorder-fields -record-name bar::Foo -fields-order y,z,c,x %s -- 2>&1 | FileCheck %s
+
+#include 
+
+namespace bar {
+class Foo { 
+public:
+  Foo(int x, double y, char cin);
+  Foo(int nx);
+  Foo();
+  int x;
+  double y;
+  char c;
+  std::string z;
+};
+
+static char bar(char c) {
+  return c + 1;
+}
+
+Foo::Foo(int x, double y, char cin) :  
+  x(x), 
+  y(y), 
+  c(cin),   
+  z(this->x, bar(c))// CHECK:  [[@LINE]]: Warning: reordering field x after z makes x uninitialized when used in init expression
+// CHECK-NEXT: [[@LINE-1]]: Warning: reordering field c after z makes c uninitialized when used in init expression
+{}
+
+Foo::Foo(int nx) :
+  x(nx),  
+  y(x), // CHECK-NEXT: [[@LINE]]: Warning: reordering field x after y makes x uninitialized when used in init expression
+  c(0),   
+  z(bar(bar(x)), c) // CHECK-NEXT: [[@LINE]]: Warning: reordering field x after z makes x uninitialized when used in init expression
+// CHECK-NEXT: [[@LINE-1]]: Warning: reordering field c after z makes c uninitialized when used in init expression
+{}
+
+} // namespace bar
+
+int main() {
+  bar::Foo F(5, 12.8, 'c');
+  return 0;
+}
Index: clang-reorder-fields/ReorderFieldsAction.cpp
===
--- clang-reorder-fields/ReorderFieldsAction.cpp
+++ clang-reorder-fields/ReorderFieldsAction.cpp
@@ -22,12 +22,14 @@
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "clang/Lex/Lexer.h"
 #include "clang/Tooling/Refactoring.h"
+#include "llvm/ADT/SetVector.h"
 #include 
 #include 
 
 namespace clang {
 namespace reorder_fields {
 using namespace clang::ast_matchers;
+using llvm::SmallSetVector;
 
 /// \brief Finds the definition of a record by name.
 ///
@@ -91,6 +93,24 @@
   consumeError(Replacements[R.getFilePath()].add(R));
 }
 
+/// \brief Find all member fields used in the given init-list initializer expr
+/// that belong to the same record
+///
+/// \returns a set of field declarations, empty if none were present
+static SmallSetVector
+findMembersUsedInInitExpr(const CXXCtorInitializer *Initializer,
+  ASTContext ) {
+  SmallSetVector Results;
+  auto FoundExprs =
+  match(findAll(memberExpr(hasObjectExpression(cxxThisExpr())).bind("ME")),
+*Initializer->getInit(), Context);
+  for (BoundNodes  : FoundExprs)
+if (auto *MemExpr = BN.getNodeAs("ME"))
+  if (auto *FD = dyn_cast(MemExpr->getMemberDecl()))
+Results.insert(FD);
+  return Results;
+}
+
 /// \brief Reorders fields in the definition of a struct/class.
 ///
 /// At the moment reodering of fields with
@@ -133,7 +153,7 @@
 /// Thus, we need to ensure that we reorder just the initializers that are present.
 static void reorderFieldsInConstructor(
 const CXXConstructorDecl *CtorDecl, ArrayRef NewFieldsOrder,
-const ASTContext ,
+ASTContext ,
 std::map ) {
   assert(CtorDecl && "Constructor declaration is null");
   if (CtorDecl->isImplicit() || CtorDecl->getNumCtorInitializers() <= 1)
@@ -153,6 +173,22 @@
   for (const auto *Initializer : CtorDecl->inits()) {
 if (!Initializer->isWritten())
   continue;
+
+// Warn if this reordering violates initialization expr dependencies
+const auto UsedMembers = findMembersUsedInInitExpr(Initializer, Context);
+const FieldDecl *ThisM = Initializer->getMember();
+for (const FieldDecl *UM : UsedMembers) {
+  if (NewFieldsPositions[UM->getFieldIndex()] >
+  NewFieldsPositions[ThisM->getFieldIndex()]) {
+llvm::errs() << Context.getSourceManager().getSpellingLineNumber(
+Initializer->getSourceLocation())
+ << ": Warning: reordering field " << UM->getName()
+ << " after " << ThisM->getName() << " makes "
+ << UM->getName()
+ << " uninitialized when used in init 

r309352 - Update comment in test case after r309308.

2017-07-27 Thread Akira Hatanaka via cfe-commits
Author: ahatanak
Date: Thu Jul 27 18:58:14 2017
New Revision: 309352

URL: http://llvm.org/viewvc/llvm-project?rev=309352=rev
Log:
Update comment in test case after r309308.

Modified:
cfe/trunk/test/CodeGenCXX/eh.cpp

Modified: cfe/trunk/test/CodeGenCXX/eh.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/eh.cpp?rev=309352=309351=309352=diff
==
--- cfe/trunk/test/CodeGenCXX/eh.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/eh.cpp Thu Jul 27 18:58:14 2017
@@ -461,7 +461,7 @@ class DerivedException: public BaseExcep
 
 int foo() {
   throw DerivedException();
-  // The alignment passed to memset is 8, not 16, on Darwin.
+  // The alignment passed to memset is 16 on Darwin.
 
   // CHECK: [[T0:%.*]] = call i8* @__cxa_allocate_exception(i64 16)
   // CHECK-NEXT: [[T1:%.*]] = bitcast i8* [[T0]] to 
%"class.test17::DerivedException"*


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


[libcxxabi] r309349 - [demangler] Fix some overzealous -Wreturn-type errors

2017-07-27 Thread Erik Pilkington via cfe-commits
Author: epilk
Date: Thu Jul 27 18:35:14 2017
New Revision: 309349

URL: http://llvm.org/viewvc/llvm-project?rev=309349=rev
Log:
[demangler] Fix some overzealous -Wreturn-type errors

Modified:
libcxxabi/trunk/src/cxa_demangle.cpp

Modified: libcxxabi/trunk/src/cxa_demangle.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_demangle.cpp?rev=309349=309348=309349=diff
==
--- libcxxabi/trunk/src/cxa_demangle.cpp (original)
+++ libcxxabi/trunk/src/cxa_demangle.cpp Thu Jul 27 18:35:14 2017
@@ -896,6 +896,7 @@ public:
 case SpecialSubKind::iostream:
   return StringView("basic_iostream");
 }
+return StringView();
   }
 
   void printLeft(OutputStream ) const override {
@@ -944,6 +945,7 @@ public:
 case SpecialSubKind::iostream:
   return StringView("iostream");
 }
+return StringView();
   }
 
   void printLeft(OutputStream ) const override {


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


[PATCH] D35941: Fix -Wshadow false positives with function-local classes.

2017-07-27 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh added a comment.

In https://reviews.llvm.org/D35941#823020, @rnk wrote:

> I'm not really sure this is a bug. The point of -Wshadow is to warn on valid 
> but possibly confusing code. Shadowing a variable is perfectly legal, but 
> people think it's confusing, so we implemented this warning. Are we concerned 
> that people might get confused between the different local variables here?


IIUC, most cases where -Wshadow warnings are issued is when a declaration from 
an enclosing scope would be accessible if there was no declaration that shadows 
it. In this case the the local variable of a function would not be accessible 
inside the local class anyway, so the inner variable with the same name is not 
confusing (at least, much less confusing than if it would prevent access to the 
variable of an outer scope). This is close to shadowing of uncaptured locals in 
lambdas, but it seems to have even less potential for being misleading. We had 
a few of requests internally to mute `-Wshadow` for this case. Another data 
point is that GCC doesn't warn in this case.

But if I'm overseeing reasons to issue a warning in this case, we could add an 
analogue of `-Wshadow-uncaptured-local` for this case. WDYT?


https://reviews.llvm.org/D35941



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


[PATCH] D35056: GCC ABI incompatibility when passing object with trivial copy ctor, trivial dtor, and non-trivial move ctor

2017-07-27 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: lib/CodeGen/CGCXXABI.cpp:43
   if (RD->hasNonTrivialDestructor())
 return false;
 

Does canPassInRegisters() not subsume all of these earlier checks?


https://reviews.llvm.org/D35056



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


[libcxxabi] r309342 - [demangler] Attempt to fix linux bots, include

2017-07-27 Thread Erik Pilkington via cfe-commits
Author: epilk
Date: Thu Jul 27 17:53:30 2017
New Revision: 309342

URL: http://llvm.org/viewvc/llvm-project?rev=309342=rev
Log:
[demangler] Attempt to fix linux bots, include 

Modified:
libcxxabi/trunk/src/cxa_demangle.cpp

Modified: libcxxabi/trunk/src/cxa_demangle.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_demangle.cpp?rev=309342=309341=309342=diff
==
--- libcxxabi/trunk/src/cxa_demangle.cpp (original)
+++ libcxxabi/trunk/src/cxa_demangle.cpp Thu Jul 27 17:53:30 2017
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 


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


[PATCH] D34114: [clang] Change the condition of unnecessary packed warning

2017-07-27 Thread Yan Wang via Phabricator via cfe-commits
yawanng updated this revision to Diff 108555.
yawanng marked an inline comment as done.
yawanng edited the summary of this revision.
yawanng added a comment.

Add more tests and restrict the conditions.


https://reviews.llvm.org/D34114

Files:
  lib/AST/RecordLayoutBuilder.cpp
  test/CodeGenCXX/warn-padded-packed.cpp

Index: test/CodeGenCXX/warn-padded-packed.cpp
===
--- test/CodeGenCXX/warn-padded-packed.cpp
+++ test/CodeGenCXX/warn-padded-packed.cpp
@@ -17,7 +17,7 @@
 } __attribute__((packed));
 
 struct S4 {
-  int i; // expected-warning {{packed attribute is unnecessary for 'i'}}
+  int i;
   char c;
 } __attribute__((packed));
 
@@ -46,18 +46,18 @@
   int i; // expected-warning {{padding struct 'S8' with 3 bytes to align 'i'}}
 };
 
-struct S9 { // expected-warning {{packed attribute is unnecessary for 'S9'}}
-  int x; // expected-warning {{packed attribute is unnecessary for 'x'}}
-  int y; // expected-warning {{packed attribute is unnecessary for 'y'}}
+struct S9 {
+  int x;
+  int y;
 } __attribute__((packed));
 
-struct S10 { // expected-warning {{packed attribute is unnecessary for 'S10'}}
-  int x; // expected-warning {{packed attribute is unnecessary for 'x'}}
+struct S10 {
+  int x;
   char a,b,c,d;
 } __attribute__((packed));
 
 
-struct S11 {
+struct S11 { // expected-warning {{packed attribute is unnecessary for 'S11'}}
   bool x;
   char a,b,c,d;
 } __attribute__((packed));
@@ -72,5 +72,81 @@
   bool b : 10;
 };
 
+struct S14 { // expected-warning {{packed attribute is unnecessary for 'S14'}}
+  char a,b,c,d;
+} __attribute__((packed));
+
+struct S15 { // expected-warning {{packed attribute is unnecessary for 'S15'}}
+  struct S14 s;
+  char a;
+} __attribute__((packed));
+
+struct S16 { // expected-warning {{padding size of 'S16' with 2 bytes to alignment boundary}} expected-warning {{packed attribute is unnecessary for 'S16'}}
+  char a,b;
+} __attribute__((packed, aligned(4)));
+
+struct S17 {
+  struct S16 s;
+  char a,b;
+} __attribute__((packed, aligned(2)));
+
+struct S18 { // expected-warning {{padding size of 'S18' with 2 bytes to alignment boundary}} expected-warning {{packed attribute is unnecessary for 'S18'}}
+  struct S16 s;
+  char a,b;
+} __attribute__((packed, aligned(4)));
+
+struct S19 { // expected-warning {{packed attribute is unnecessary for 'S19'}}
+  bool b;
+  char a;
+} __attribute__((packed, aligned(1)));
+
+struct S20 {
+  int i;
+  char a;
+} __attribute__((packed, aligned(1)));
+
+struct S21 { // expected-warning {{padding size of 'S21' with 4 bits to alignment boundary}}
+  unsigned char a : 6;
+  unsigned char b : 6;
+} __attribute__((packed, aligned(1)));
+
+struct S22 { // expected-warning {{packed attribute is unnecessary for 'S22'}}
+  unsigned char a : 4;
+  unsigned char b : 4;
+} __attribute__((packed));
+
+struct S23 { // expected-warning {{padding size of 'S23' with 4 bits to alignment boundary}} expected-warning {{packed attribute is unnecessary for 'S23'}}
+  unsigned char a : 2;
+  unsigned char b : 2;
+} __attribute__((packed));
+
+struct S24 {
+  unsigned char a : 6;
+  unsigned char b : 6;
+  unsigned char c : 6;
+  unsigned char d : 6;
+  unsigned char e : 6;
+  unsigned char f : 6;
+  unsigned char g : 6;
+  unsigned char h : 6;
+} __attribute__((packed));
+
+struct S25 { // expected-warning {{padding size of 'S25' with 7 bits to alignment boundary}} expected-warning {{packed attribute is unnecessary for 'S25'}}
+  unsigned char a;
+  unsigned char b : 1;
+} __attribute__((packed));
+
+struct S26 { // expected-warning {{packed attribute is unnecessary for 'S26'}}
+  unsigned char a : 1;
+  unsigned char b; //expected-warning {{padding struct 'S26' with 7 bits to align 'b'}}
+} __attribute__((packed));
+
+struct S27 { // expected-warning {{padding size of 'S27' with 7 bits to alignment boundary}}
+  unsigned char a : 1;
+  unsigned char b : 8;
+} __attribute__((packed));
+
+
 // The warnings are emitted when the layout of the structs is computed, so we have to use them.
-void f(S1*, S2*, S3*, S4*, S5*, S6*, S7*, S8*, S9*, S10*, S11*, S12*, S13*) { }
+void f(S1*, S2*, S3*, S4*, S5*, S6*, S7*, S8*, S9*, S10*, S11*, S12*, S13*, S14*, S15*,
+   S16*, S17*, S18*, S19*, S20*, S21*, S22*, S23*, S24*, S25*, S26*, S27*){}
Index: lib/AST/RecordLayoutBuilder.cpp
===
--- lib/AST/RecordLayoutBuilder.cpp
+++ lib/AST/RecordLayoutBuilder.cpp
@@ -632,6 +632,9 @@
   /// pointer, as opposed to inheriting one from a primary base class.
   bool HasOwnVFPtr;
 
+  /// \brief the flag of field offset changing due to packed attribute.
+  bool IsFieldOffsetChangedWithPacked;
+
   typedef llvm::DenseMap BaseOffsetsMapTy;
 
   /// Bases - base classes and their offsets in the record.
@@ -666,7 +669,7 @@
 NonVirtualSize(CharUnits::Zero()),
 NonVirtualAlignment(CharUnits::One()), PrimaryBase(nullptr),
 

[PATCH] D35056: GCC ABI incompatibility when passing object with trivial copy ctor, trivial dtor, and non-trivial move ctor

2017-07-27 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev updated this revision to Diff 108556.
v.g.vassilev added a comment.

Move back the triviality checks in CGCXXABI. Explain why.


https://reviews.llvm.org/D35056

Files:
  include/clang/AST/DeclCXX.h
  lib/AST/ASTImporter.cpp
  lib/AST/DeclCXX.cpp
  lib/CodeGen/CGCXXABI.cpp
  lib/CodeGen/ItaniumCXXABI.cpp
  lib/Sema/SemaDecl.cpp
  lib/Serialization/ASTReaderDecl.cpp
  lib/Serialization/ASTWriter.cpp
  test/CodeGenCXX/uncopyable-args.cpp

Index: test/CodeGenCXX/uncopyable-args.cpp
===
--- test/CodeGenCXX/uncopyable-args.cpp
+++ test/CodeGenCXX/uncopyable-args.cpp
@@ -52,12 +52,11 @@
 void bar() {
   foo({});
 }
-// FIXME: The copy ctor is implicitly deleted.
-// CHECK-DISABLED-LABEL: define void @_ZN9move_ctor3barEv()
-// CHECK-DISABLED: call void @_Z{{.*}}C1Ev(
-// CHECK-DISABLED-NOT: call
-// CHECK-DISABLED: call void @_ZN9move_ctor3fooENS_1AE(%"struct.move_ctor::A"* %{{.*}})
-// CHECK-DISABLED-LABEL: declare void @_ZN9move_ctor3fooENS_1AE(%"struct.move_ctor::A"*)
+// CHECK-LABEL: define void @_ZN9move_ctor3barEv()
+// CHECK: call void @_Z{{.*}}C1Ev(
+// CHECK-NOT: call
+// CHECK: call void @_ZN9move_ctor3fooENS_1AE(%"struct.move_ctor::A"* %{{.*}})
+// CHECK-LABEL: declare void @_ZN9move_ctor3fooENS_1AE(%"struct.move_ctor::A"*)
 
 // WIN64-LABEL: declare void @"\01?foo@move_ctor@@YAXUA@1@@Z"(%"struct.move_ctor::A"*)
 }
@@ -73,12 +72,11 @@
 void bar() {
   foo({});
 }
-// FIXME: The copy ctor is deleted.
-// CHECK-DISABLED-LABEL: define void @_ZN11all_deleted3barEv()
-// CHECK-DISABLED: call void @_Z{{.*}}C1Ev(
-// CHECK-DISABLED-NOT: call
-// CHECK-DISABLED: call void @_ZN11all_deleted3fooENS_1AE(%"struct.all_deleted::A"* %{{.*}})
-// CHECK-DISABLED-LABEL: declare void @_ZN11all_deleted3fooENS_1AE(%"struct.all_deleted::A"*)
+// CHECK-LABEL: define void @_ZN11all_deleted3barEv()
+// CHECK: call void @_Z{{.*}}C1Ev(
+// CHECK-NOT: call
+// CHECK: call void @_ZN11all_deleted3fooENS_1AE(%"struct.all_deleted::A"* %{{.*}})
+// CHECK-LABEL: declare void @_ZN11all_deleted3fooENS_1AE(%"struct.all_deleted::A"*)
 
 // WIN64-LABEL: declare void @"\01?foo@all_deleted@@YAXUA@1@@Z"(%"struct.all_deleted::A"*)
 }
@@ -93,12 +91,11 @@
 void bar() {
   foo({});
 }
-// FIXME: The copy and move ctors are implicitly deleted.
-// CHECK-DISABLED-LABEL: define void @_ZN18implicitly_deleted3barEv()
-// CHECK-DISABLED: call void @_Z{{.*}}C1Ev(
-// CHECK-DISABLED-NOT: call
-// CHECK-DISABLED: call void @_ZN18implicitly_deleted3fooENS_1AE(%"struct.implicitly_deleted::A"* %{{.*}})
-// CHECK-DISABLED-LABEL: declare void @_ZN18implicitly_deleted3fooENS_1AE(%"struct.implicitly_deleted::A"*)
+// CHECK-LABEL: define void @_ZN18implicitly_deleted3barEv()
+// CHECK: call void @_Z{{.*}}C1Ev(
+// CHECK-NOT: call
+// CHECK: call void @_ZN18implicitly_deleted3fooENS_1AE(%"struct.implicitly_deleted::A"* %{{.*}})
+// CHECK-LABEL: declare void @_ZN18implicitly_deleted3fooENS_1AE(%"struct.implicitly_deleted::A"*)
 
 // WIN64-LABEL: declare void @"\01?foo@implicitly_deleted@@YAXUA@1@@Z"(%"struct.implicitly_deleted::A"*)
 }
@@ -113,12 +110,11 @@
 void bar() {
   foo({});
 }
-// FIXME: The copy constructor is implicitly deleted.
-// CHECK-DISABLED-LABEL: define void @_ZN11one_deleted3barEv()
-// CHECK-DISABLED: call void @_Z{{.*}}C1Ev(
-// CHECK-DISABLED-NOT: call
-// CHECK-DISABLED: call void @_ZN11one_deleted3fooENS_1AE(%"struct.one_deleted::A"* %{{.*}})
-// CHECK-DISABLED-LABEL: declare void @_ZN11one_deleted3fooENS_1AE(%"struct.one_deleted::A"*)
+// CHECK-LABEL: define void @_ZN11one_deleted3barEv()
+// CHECK: call void @_Z{{.*}}C1Ev(
+// CHECK-NOT: call
+// CHECK: call void @_ZN11one_deleted3fooENS_1AE(%"struct.one_deleted::A"* %{{.*}})
+// CHECK-LABEL: declare void @_ZN11one_deleted3fooENS_1AE(%"struct.one_deleted::A"*)
 
 // WIN64-LABEL: declare void @"\01?foo@one_deleted@@YAXUA@1@@Z"(%"struct.one_deleted::A"*)
 }
@@ -195,12 +191,10 @@
 void bar() {
   foo({});
 }
-// FIXME: This class has a non-trivial copy ctor and a trivial copy ctor.  It's
-// not clear whether we should pass by address or in registers.
-// CHECK-DISABLED-LABEL: define void @_ZN14two_copy_ctors3barEv()
-// CHECK-DISABLED: call void @_Z{{.*}}C1Ev(
-// CHECK-DISABLED: call void @_ZN14two_copy_ctors3fooENS_1BE(%"struct.two_copy_ctors::B"* %{{.*}})
-// CHECK-DISABLED-LABEL: declare void @_ZN14two_copy_ctors3fooENS_1BE(%"struct.two_copy_ctors::B"*)
+// CHECK-LABEL: define void @_ZN14two_copy_ctors3barEv()
+// CHECK: call void @_Z{{.*}}C1Ev(
+// CHECK: call void @_ZN14two_copy_ctors3fooENS_1BE(%"struct.two_copy_ctors::B"* %{{.*}})
+// CHECK-LABEL: declare void @_ZN14two_copy_ctors3fooENS_1BE(%"struct.two_copy_ctors::B"*)
 
 // WIN64-LABEL: declare void @"\01?foo@two_copy_ctors@@YAXUB@1@@Z"(%"struct.two_copy_ctors::B"*)
 }
Index: lib/Serialization/ASTWriter.cpp
===
--- lib/Serialization/ASTWriter.cpp
+++ lib/Serialization/ASTWriter.cpp
@@ 

[PATCH] D34724: [analyzer] Add MagentaHandleChecker for the Magenta kernel

2017-07-27 Thread Haowei Wu via Phabricator via cfe-commits
haowei abandoned this revision.
haowei added a comment.

Superseded by https://reviews.llvm.org/D35968


https://reviews.llvm.org/D34724



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


r309338 - [sanitizer-coverage] clang flags pumbing for -fsanitize-coverage=pc-table

2017-07-27 Thread Kostya Serebryany via cfe-commits
Author: kcc
Date: Thu Jul 27 17:10:10 2017
New Revision: 309338

URL: http://llvm.org/viewvc/llvm-project?rev=309338=rev
Log:
[sanitizer-coverage] clang flags pumbing for -fsanitize-coverage=pc-table

Modified:
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Frontend/CodeGenOptions.def
cfe/trunk/lib/CodeGen/BackendUtil.cpp
cfe/trunk/lib/Driver/SanitizerArgs.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/Driver/fsanitize-coverage.c

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=309338=309337=309338=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Thu Jul 27 17:10:10 2017
@@ -295,6 +295,9 @@ def fsanitize_coverage_8bit_counters
 def fsanitize_coverage_inline_8bit_counters
 : Flag<["-"], "fsanitize-coverage-inline-8bit-counters">,
   HelpText<"Enable inline 8-bit counters in sanitizer coverage">;
+def fsanitize_coverage_pc_table
+: Flag<["-"], "fsanitize-coverage-pc-table">,
+  HelpText<"Create a table of coverage-instrumented PCs">;
 def fsanitize_coverage_trace_pc
 : Flag<["-"], "fsanitize-coverage-trace-pc">,
   HelpText<"Enable PC tracing in sanitizer coverage">;

Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=309338=309337=309338=diff
==
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.def (original)
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def Thu Jul 27 17:10:10 2017
@@ -167,6 +167,7 @@ CODEGENOPT(SanitizeCoverageTracePC, 1, 0
 CODEGENOPT(SanitizeCoverageTracePCGuard, 1, 0) ///< Enable PC tracing with 
guard
///< in sanitizer coverage.
 CODEGENOPT(SanitizeCoverageInline8bitCounters, 1, 0) ///< Use inline 8bit 
counters.
+CODEGENOPT(SanitizeCoveragePCTable, 1, 0) ///< Create a PC Table.
 CODEGENOPT(SanitizeCoverageNoPrune, 1, 0) ///< Disable coverage pruning.
 CODEGENOPT(SanitizeStats , 1, 0) ///< Collect statistics for sanitizers.
 CODEGENOPT(SimplifyLibCalls  , 1, 1) ///< Set when -fbuiltin is enabled.

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=309338=309337=309338=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Thu Jul 27 17:10:10 2017
@@ -189,6 +189,7 @@ static void addSanitizerCoveragePass(con
   Opts.TracePCGuard = CGOpts.SanitizeCoverageTracePCGuard;
   Opts.NoPrune = CGOpts.SanitizeCoverageNoPrune;
   Opts.Inline8bitCounters = CGOpts.SanitizeCoverageInline8bitCounters;
+  Opts.PCTable = CGOpts.SanitizeCoveragePCTable;
   PM.add(createSanitizerCoverageModulePass(Opts));
 }
 

Modified: cfe/trunk/lib/Driver/SanitizerArgs.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/SanitizerArgs.cpp?rev=309338=309337=309338=diff
==
--- cfe/trunk/lib/Driver/SanitizerArgs.cpp (original)
+++ cfe/trunk/lib/Driver/SanitizerArgs.cpp Thu Jul 27 17:10:10 2017
@@ -55,8 +55,9 @@ enum CoverageFeature {
   Coverage8bitCounters = 1 << 8,  // Deprecated.
   CoverageTracePC = 1 << 9,
   CoverageTracePCGuard = 1 << 10,
-  CoverageInline8bitCounters = 1 << 12,
   CoverageNoPrune = 1 << 11,
+  CoverageInline8bitCounters = 1 << 12,
+  CoveragePCTable = 1 << 13,
 };
 
 /// Parse a -fsanitize= or -fno-sanitize= argument's values, diagnosing any
@@ -663,6 +664,7 @@ void SanitizerArgs::addArgs(const ToolCh
 std::make_pair(CoverageTracePC, "-fsanitize-coverage-trace-pc"),
 std::make_pair(CoverageTracePCGuard, "-fsanitize-coverage-trace-pc-guard"),
 std::make_pair(CoverageInline8bitCounters, 
"-fsanitize-coverage-inline-8bit-counters"),
+std::make_pair(CoveragePCTable, "-fsanitize-coverage-pc-table"),
 std::make_pair(CoverageNoPrune, "-fsanitize-coverage-no-prune")};
   for (auto F : CoverageFlags) {
 if (CoverageFeatures & F.first)
@@ -825,6 +827,7 @@ int parseCoverageFeatures(const Driver &
 .Case("trace-pc-guard", CoverageTracePCGuard)
 .Case("no-prune", CoverageNoPrune)
 .Case("inline-8bit-counters", CoverageInline8bitCounters)
+.Case("pc-table", CoveragePCTable)
 .Default(0);
 if (F == 0)
   D.Diag(clang::diag::err_drv_unsupported_option_argument)

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=309338=309337=309338=diff

[PATCH] D35968: [analyzer] Add MagentaHandleChecker for the Magenta kernel

2017-07-27 Thread Haowei Wu via Phabricator via cfe-commits
haowei created this revision.
Herald added subscribers: xazax.hun, mgorny.

This patch supersedes https://reviews.llvm.org/D34724. We have finished the 
checker but it is too big to be submitted as a single commit. So we split it 
into several pieces to help with the review process. This patch includes the 
annotation attribute support in MagentaHandleChecker. It basically detect 
functions that have special annotation attributes and parse these annotations 
strings to function spec information which would used by the actual analysis. 
In this patch, the checker will not report any bugs. We will follow up with 
another commit that contains the code of actual analysis.


https://reviews.llvm.org/D35968

Files:
  include/clang/StaticAnalyzer/Checkers/Checkers.td
  lib/StaticAnalyzer/Checkers/CMakeLists.txt
  lib/StaticAnalyzer/Checkers/MagentaHandleChecker.cpp

Index: lib/StaticAnalyzer/Checkers/MagentaHandleChecker.cpp
===
--- /dev/null
+++ lib/StaticAnalyzer/Checkers/MagentaHandleChecker.cpp
@@ -0,0 +1,393 @@
+//== MagentaHandleChecker.cpp - Magenta Handle Checker*- C++-*--==//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// This checker checks if the handle of magenta kernel is properly used
+// according to following rules.
+//   - If a handle is acquired, it should be closed/released before execution
+//ends.
+//   - If a handle is closed/released, it should not be closed/released again.
+//   - If a handle is closed/released, it should not be used for other purposes
+//such as I/O.
+//
+// In this checker, each tracked handle is associated with a state. When the
+// handle variable is passed to different function calls or syscalls, its state
+// changes. The state changes can be generally represented by following ASCII
+// Art:
+//
+// release_func failed
+//+-+
+//| |
+//| |
+//| |  As argument
+//  +-+-v-+in uninlined   +-+
+//   acquire_func succeeded | |calls  | |
+//+->  Allocated  +---> Escaped |
+//| | | As return | |
+//| +-+--++ value or  +-+
+//|   |  |  assigned
+//| release_func  |  |  back to argument.
+//|  succeeded|  +--+
+//|   | |handle out++
+//|  +v-+   |of scope  ||
+//|  |  |   +--> Leaked |
+// +--+--+   | Released |  |(REPORT)|
+// | |   |  |  ++
+// | Not tracked <--+++---+-+
+// | |  | |   |   As argument
+// +--+--+  |release_func |   +--+in function
+//| | |  |call
+//| |+v-+| +---+
+//+-+|  || |   |
+//acquire_func failed| Double   |+-> Use after |
+//   | released |  | released  |
+//   | (REPORT) |  | (REPORT)  |
+//   +--+  +---+
+//
+//
+// acquire_func represents the functions or syscalls that may acquire a handle.
+// release_func represents the functions or syscalls that may release a handle.
+//
+// If a tracked handle ends up in "Released" or "Escaped" state, we assume it
+// is properly used. Otherwise a bug and will be reported.
+//
+// Due to the fact that the number of handle related syscalls in magenta kernel
+// is too large, we adopt the annotation attributes to descript syscalls'
+// operations(acquire/release/use/escape) on handles instead of hardcoding
+// everything in the checker.
+//
+// We use following annotation attributes for handle related syscalls or
+// functions:
+//  1. __attribute__((annotate("mx_handle_acquire"))) |handle will be acquired
+//  2. __attribute__((annotate("mx_handle_release"))) |handle will be released
+//  3. __attribute__((annotate("mx_handle_release_always"))) |handle will be
+// released and the function will not fail.
+//  4. __attribute__((annotate("mx_handle_escape"))) |handle will transit to
+// escaped state. This is the 

[PATCH] D35961: [llvm] Update MachOObjectFile::exports interface

2017-07-27 Thread Alexander Shaposhnikov via Phabricator via cfe-commits
alexshap created this revision.

This diff removes the second argument of the method
MachOObjectFile::exports which was recently introduced in r308690.
In all in-tree uses this argument is equal to "this", additionally 
without this argument the interface seems to be cleaner.

Test plan: make check-all


Repository:
  rL LLVM

https://reviews.llvm.org/D35961

Files:
  include/llvm/Object/MachO.h
  lib/Object/MachOObjectFile.cpp
  tools/llvm-nm/llvm-nm.cpp
  tools/llvm-objdump/MachODump.cpp


Index: tools/llvm-objdump/MachODump.cpp
===
--- tools/llvm-objdump/MachODump.cpp
+++ tools/llvm-objdump/MachODump.cpp
@@ -9403,7 +9403,7 @@
 }
   }
   Error Err = Error::success();
-  for (const llvm::object::ExportEntry  : Obj->exports(Err, Obj)) {
+  for (const llvm::object::ExportEntry  : Obj->exports(Err)) {
 uint64_t Flags = Entry.flags();
 bool ReExport = (Flags & MachO::EXPORT_SYMBOL_FLAGS_REEXPORT);
 bool WeakDef = (Flags & MachO::EXPORT_SYMBOL_FLAGS_WEAK_DEFINITION);
Index: tools/llvm-nm/llvm-nm.cpp
===
--- tools/llvm-nm/llvm-nm.cpp
+++ tools/llvm-nm/llvm-nm.cpp
@@ -1227,8 +1227,7 @@
 HFlags & MachO::MH_NLIST_OUTOFSYNC_WITH_DYLDINFO) {
   unsigned ExportsAdded = 0;
   Error Err = Error::success();
-  for (const llvm::object::ExportEntry  : MachO->exports(Err,
-   MachO)) {
+  for (const llvm::object::ExportEntry  : MachO->exports(Err)) {
 bool found = false;
 bool ReExport = false;
 if (!DyldInfoOnly) {
Index: lib/Object/MachOObjectFile.cpp
===
--- lib/Object/MachOObjectFile.cpp
+++ lib/Object/MachOObjectFile.cpp
@@ -2908,9 +2908,8 @@
   return make_range(export_iterator(Start), export_iterator(Finish));
 }
 
-iterator_range MachOObjectFile::exports(Error ,
-  const MachOObjectFile *O) const {
-  return exports(Err, getDyldInfoExportsTrie(), O);
+iterator_range MachOObjectFile::exports(Error ) const {
+  return exports(Err, getDyldInfoExportsTrie(), this);
 }
 
 MachORebaseEntry::MachORebaseEntry(Error *E, const MachOObjectFile *O,
Index: include/llvm/Object/MachO.h
===
--- include/llvm/Object/MachO.h
+++ include/llvm/Object/MachO.h
@@ -365,8 +365,7 @@
   iterator_range load_commands() const;
 
   /// For use iterating over all exported symbols.
-  iterator_range exports(Error ,
-  const MachOObjectFile *O) const;
+  iterator_range exports(Error ) const;
 
   /// For use examining a trie not in a MachOObjectFile.
   static iterator_range exports(Error ,


Index: tools/llvm-objdump/MachODump.cpp
===
--- tools/llvm-objdump/MachODump.cpp
+++ tools/llvm-objdump/MachODump.cpp
@@ -9403,7 +9403,7 @@
 }
   }
   Error Err = Error::success();
-  for (const llvm::object::ExportEntry  : Obj->exports(Err, Obj)) {
+  for (const llvm::object::ExportEntry  : Obj->exports(Err)) {
 uint64_t Flags = Entry.flags();
 bool ReExport = (Flags & MachO::EXPORT_SYMBOL_FLAGS_REEXPORT);
 bool WeakDef = (Flags & MachO::EXPORT_SYMBOL_FLAGS_WEAK_DEFINITION);
Index: tools/llvm-nm/llvm-nm.cpp
===
--- tools/llvm-nm/llvm-nm.cpp
+++ tools/llvm-nm/llvm-nm.cpp
@@ -1227,8 +1227,7 @@
 HFlags & MachO::MH_NLIST_OUTOFSYNC_WITH_DYLDINFO) {
   unsigned ExportsAdded = 0;
   Error Err = Error::success();
-  for (const llvm::object::ExportEntry  : MachO->exports(Err,
-   MachO)) {
+  for (const llvm::object::ExportEntry  : MachO->exports(Err)) {
 bool found = false;
 bool ReExport = false;
 if (!DyldInfoOnly) {
Index: lib/Object/MachOObjectFile.cpp
===
--- lib/Object/MachOObjectFile.cpp
+++ lib/Object/MachOObjectFile.cpp
@@ -2908,9 +2908,8 @@
   return make_range(export_iterator(Start), export_iterator(Finish));
 }
 
-iterator_range MachOObjectFile::exports(Error ,
-  const MachOObjectFile *O) const {
-  return exports(Err, getDyldInfoExportsTrie(), O);
+iterator_range MachOObjectFile::exports(Error ) const {
+  return exports(Err, getDyldInfoExportsTrie(), this);
 }
 
 MachORebaseEntry::MachORebaseEntry(Error *E, const MachOObjectFile *O,
Index: include/llvm/Object/MachO.h
===
--- include/llvm/Object/MachO.h
+++ include/llvm/Object/MachO.h
@@ -365,8 +365,7 @@
   iterator_range load_commands() const;
 
   /// For use iterating over all exported symbols.
-  iterator_range exports(Error ,
-   

[PATCH] D34158: For standards compatibility, preinclude if the file is available

2017-07-27 Thread Fedor Sergeev via Phabricator via cfe-commits
fedor.sergeev added a comment.

Hmm... I tried this patch and now the following worries me:

- it passes -finclude-if-exists stdc-predef.h on all platforms (say, including 
my Solaris platform that has no system stdc-predef.h)
- it searches all the paths, not just "system include" ones

That essentially disallows user to have stdc-predef.h include in my own 
project, since there is a chance that this user header
will be accidentally included by this hidden machinery.

  ] cat stdc-predef.h
  #error I was not expecting to see that
  ] bin/clang hello-world.c
  In file included from :2:
  ./stdc-predef.h:1:2: error: I was not expecting to see this!
  #error I was not expecting to see this!
   ^
  1 error generated.
  ]


Repository:
  rL LLVM

https://reviews.llvm.org/D34158



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


[PATCH] D35056: GCC ABI incompatibility when passing object with trivial copy ctor, trivial dtor, and non-trivial move ctor

2017-07-27 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev updated this revision to Diff 108535.
v.g.vassilev added a comment.

Put back accidentally removed test case.


https://reviews.llvm.org/D35056

Files:
  include/clang/AST/DeclCXX.h
  lib/AST/ASTImporter.cpp
  lib/AST/DeclCXX.cpp
  lib/CodeGen/CGCXXABI.cpp
  lib/CodeGen/ItaniumCXXABI.cpp
  lib/Sema/SemaDecl.cpp
  lib/Serialization/ASTReaderDecl.cpp
  lib/Serialization/ASTWriter.cpp
  test/CodeGenCXX/uncopyable-args.cpp

Index: test/CodeGenCXX/uncopyable-args.cpp
===
--- test/CodeGenCXX/uncopyable-args.cpp
+++ test/CodeGenCXX/uncopyable-args.cpp
@@ -52,12 +52,11 @@
 void bar() {
   foo({});
 }
-// FIXME: The copy ctor is implicitly deleted.
-// CHECK-DISABLED-LABEL: define void @_ZN9move_ctor3barEv()
-// CHECK-DISABLED: call void @_Z{{.*}}C1Ev(
-// CHECK-DISABLED-NOT: call
-// CHECK-DISABLED: call void @_ZN9move_ctor3fooENS_1AE(%"struct.move_ctor::A"* %{{.*}})
-// CHECK-DISABLED-LABEL: declare void @_ZN9move_ctor3fooENS_1AE(%"struct.move_ctor::A"*)
+// CHECK-LABEL: define void @_ZN9move_ctor3barEv()
+// CHECK: call void @_Z{{.*}}C1Ev(
+// CHECK-NOT: call
+// CHECK: call void @_ZN9move_ctor3fooENS_1AE(%"struct.move_ctor::A"* %{{.*}})
+// CHECK-LABEL: declare void @_ZN9move_ctor3fooENS_1AE(%"struct.move_ctor::A"*)
 
 // WIN64-LABEL: declare void @"\01?foo@move_ctor@@YAXUA@1@@Z"(%"struct.move_ctor::A"*)
 }
@@ -73,12 +72,11 @@
 void bar() {
   foo({});
 }
-// FIXME: The copy ctor is deleted.
-// CHECK-DISABLED-LABEL: define void @_ZN11all_deleted3barEv()
-// CHECK-DISABLED: call void @_Z{{.*}}C1Ev(
-// CHECK-DISABLED-NOT: call
-// CHECK-DISABLED: call void @_ZN11all_deleted3fooENS_1AE(%"struct.all_deleted::A"* %{{.*}})
-// CHECK-DISABLED-LABEL: declare void @_ZN11all_deleted3fooENS_1AE(%"struct.all_deleted::A"*)
+// CHECK-LABEL: define void @_ZN11all_deleted3barEv()
+// CHECK: call void @_Z{{.*}}C1Ev(
+// CHECK-NOT: call
+// CHECK: call void @_ZN11all_deleted3fooENS_1AE(%"struct.all_deleted::A"* %{{.*}})
+// CHECK-LABEL: declare void @_ZN11all_deleted3fooENS_1AE(%"struct.all_deleted::A"*)
 
 // WIN64-LABEL: declare void @"\01?foo@all_deleted@@YAXUA@1@@Z"(%"struct.all_deleted::A"*)
 }
@@ -93,12 +91,11 @@
 void bar() {
   foo({});
 }
-// FIXME: The copy and move ctors are implicitly deleted.
-// CHECK-DISABLED-LABEL: define void @_ZN18implicitly_deleted3barEv()
-// CHECK-DISABLED: call void @_Z{{.*}}C1Ev(
-// CHECK-DISABLED-NOT: call
-// CHECK-DISABLED: call void @_ZN18implicitly_deleted3fooENS_1AE(%"struct.implicitly_deleted::A"* %{{.*}})
-// CHECK-DISABLED-LABEL: declare void @_ZN18implicitly_deleted3fooENS_1AE(%"struct.implicitly_deleted::A"*)
+// CHECK-LABEL: define void @_ZN18implicitly_deleted3barEv()
+// CHECK: call void @_Z{{.*}}C1Ev(
+// CHECK-NOT: call
+// CHECK: call void @_ZN18implicitly_deleted3fooENS_1AE(%"struct.implicitly_deleted::A"* %{{.*}})
+// CHECK-LABEL: declare void @_ZN18implicitly_deleted3fooENS_1AE(%"struct.implicitly_deleted::A"*)
 
 // WIN64-LABEL: declare void @"\01?foo@implicitly_deleted@@YAXUA@1@@Z"(%"struct.implicitly_deleted::A"*)
 }
@@ -113,12 +110,11 @@
 void bar() {
   foo({});
 }
-// FIXME: The copy constructor is implicitly deleted.
-// CHECK-DISABLED-LABEL: define void @_ZN11one_deleted3barEv()
-// CHECK-DISABLED: call void @_Z{{.*}}C1Ev(
-// CHECK-DISABLED-NOT: call
-// CHECK-DISABLED: call void @_ZN11one_deleted3fooENS_1AE(%"struct.one_deleted::A"* %{{.*}})
-// CHECK-DISABLED-LABEL: declare void @_ZN11one_deleted3fooENS_1AE(%"struct.one_deleted::A"*)
+// CHECK-LABEL: define void @_ZN11one_deleted3barEv()
+// CHECK: call void @_Z{{.*}}C1Ev(
+// CHECK-NOT: call
+// CHECK: call void @_ZN11one_deleted3fooENS_1AE(%"struct.one_deleted::A"* %{{.*}})
+// CHECK-LABEL: declare void @_ZN11one_deleted3fooENS_1AE(%"struct.one_deleted::A"*)
 
 // WIN64-LABEL: declare void @"\01?foo@one_deleted@@YAXUA@1@@Z"(%"struct.one_deleted::A"*)
 }
@@ -195,12 +191,10 @@
 void bar() {
   foo({});
 }
-// FIXME: This class has a non-trivial copy ctor and a trivial copy ctor.  It's
-// not clear whether we should pass by address or in registers.
-// CHECK-DISABLED-LABEL: define void @_ZN14two_copy_ctors3barEv()
-// CHECK-DISABLED: call void @_Z{{.*}}C1Ev(
-// CHECK-DISABLED: call void @_ZN14two_copy_ctors3fooENS_1BE(%"struct.two_copy_ctors::B"* %{{.*}})
-// CHECK-DISABLED-LABEL: declare void @_ZN14two_copy_ctors3fooENS_1BE(%"struct.two_copy_ctors::B"*)
+// CHECK-LABEL: define void @_ZN14two_copy_ctors3barEv()
+// CHECK: call void @_Z{{.*}}C1Ev(
+// CHECK: call void @_ZN14two_copy_ctors3fooENS_1BE(%"struct.two_copy_ctors::B"* %{{.*}})
+// CHECK-LABEL: declare void @_ZN14two_copy_ctors3fooENS_1BE(%"struct.two_copy_ctors::B"*)
 
 // WIN64-LABEL: declare void @"\01?foo@two_copy_ctors@@YAXUB@1@@Z"(%"struct.two_copy_ctors::B"*)
 }
Index: lib/Serialization/ASTWriter.cpp
===
--- lib/Serialization/ASTWriter.cpp
+++ lib/Serialization/ASTWriter.cpp
@@ -5885,6 +5885,7 @@
   

[PATCH] D35959: Summary: For powerpc64, disable tests that assume long double is 80-bits.

2017-07-27 Thread Sterling Augustine via Phabricator via cfe-commits
saugustine created this revision.
Herald added a subscriber: nemanjai.

https://reviews.llvm.org/D35959

Files:
  compiler-rt/test/builtins/Unit/fixunsxfti_test.c
  compiler-rt/test/builtins/Unit/fixxfti_test.c
  compiler-rt/test/builtins/Unit/floattixf_test.c
  compiler-rt/test/builtins/Unit/floatuntixf_test.c


Index: compiler-rt/test/builtins/Unit/floatuntixf_test.c
===
--- compiler-rt/test/builtins/Unit/floatuntixf_test.c
+++ compiler-rt/test/builtins/Unit/floatuntixf_test.c
@@ -2,7 +2,7 @@
 // XFAIL: aarch64
 // test fails for aarch64 (see pr32260)
 
-// UNSUPPORTED: mips
+// UNSUPPORTED: mips, powerpc64, powerpc64le
 
 //===-- floatuntixf.c - Test __floatuntixf 
===//
 //
Index: compiler-rt/test/builtins/Unit/floattixf_test.c
===
--- compiler-rt/test/builtins/Unit/floattixf_test.c
+++ compiler-rt/test/builtins/Unit/floattixf_test.c
@@ -2,7 +2,7 @@
 // XFAIL: aarch64
 // test fails for aarch64 (see pr32260)
 
-// UNSUPPORTED: mips
+// UNSUPPORTED: mips, powerpc64, powerpc64le
 
 //===-- floattixf.c - Test __floattixf 
===//
 //
Index: compiler-rt/test/builtins/Unit/fixxfti_test.c
===
--- compiler-rt/test/builtins/Unit/fixxfti_test.c
+++ compiler-rt/test/builtins/Unit/fixxfti_test.c
@@ -2,7 +2,7 @@
 // XFAIL: aarch64
 // test fails for aarch64 (see pr32260)
 
-// UNSUPPORTED: mips
+// UNSUPPORTED: mips, powerpc64, powerpc64le
 
 //===-- fixxfti_test.c - Test __fixxfti 
---===//
 //
Index: compiler-rt/test/builtins/Unit/fixunsxfti_test.c
===
--- compiler-rt/test/builtins/Unit/fixunsxfti_test.c
+++ compiler-rt/test/builtins/Unit/fixunsxfti_test.c
@@ -2,7 +2,7 @@
 // XFAIL: aarch64
 // test fails for aarch64 (see pr32260)
 
-// UNSUPPORTED: mips
+// UNSUPPORTED: mips, powerpc64, powerpc64le
 
 //===-- fixunsxfti_test.c - Test __fixunsxfti 
-===//
 //


Index: compiler-rt/test/builtins/Unit/floatuntixf_test.c
===
--- compiler-rt/test/builtins/Unit/floatuntixf_test.c
+++ compiler-rt/test/builtins/Unit/floatuntixf_test.c
@@ -2,7 +2,7 @@
 // XFAIL: aarch64
 // test fails for aarch64 (see pr32260)
 
-// UNSUPPORTED: mips
+// UNSUPPORTED: mips, powerpc64, powerpc64le
 
 //===-- floatuntixf.c - Test __floatuntixf ===//
 //
Index: compiler-rt/test/builtins/Unit/floattixf_test.c
===
--- compiler-rt/test/builtins/Unit/floattixf_test.c
+++ compiler-rt/test/builtins/Unit/floattixf_test.c
@@ -2,7 +2,7 @@
 // XFAIL: aarch64
 // test fails for aarch64 (see pr32260)
 
-// UNSUPPORTED: mips
+// UNSUPPORTED: mips, powerpc64, powerpc64le
 
 //===-- floattixf.c - Test __floattixf ===//
 //
Index: compiler-rt/test/builtins/Unit/fixxfti_test.c
===
--- compiler-rt/test/builtins/Unit/fixxfti_test.c
+++ compiler-rt/test/builtins/Unit/fixxfti_test.c
@@ -2,7 +2,7 @@
 // XFAIL: aarch64
 // test fails for aarch64 (see pr32260)
 
-// UNSUPPORTED: mips
+// UNSUPPORTED: mips, powerpc64, powerpc64le
 
 //===-- fixxfti_test.c - Test __fixxfti ---===//
 //
Index: compiler-rt/test/builtins/Unit/fixunsxfti_test.c
===
--- compiler-rt/test/builtins/Unit/fixunsxfti_test.c
+++ compiler-rt/test/builtins/Unit/fixunsxfti_test.c
@@ -2,7 +2,7 @@
 // XFAIL: aarch64
 // test fails for aarch64 (see pr32260)
 
-// UNSUPPORTED: mips
+// UNSUPPORTED: mips, powerpc64, powerpc64le
 
 //===-- fixunsxfti_test.c - Test __fixunsxfti -===//
 //
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D35056: GCC ABI incompatibility when passing object with trivial copy ctor, trivial dtor, and non-trivial move ctor

2017-07-27 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev added inline comments.



Comment at: lib/Sema/SemaDecl.cpp:14841-14852
+  // If a move constructor or move assignment operator was declared, the
+  // default copy constructors are implicitly deleted, except in one case
+  // related to compatibility with MSVC pre-2015.
+  if (CXXRD->hasUserDeclaredMoveConstructor())
+CopyOrMoveDeleted = true;
+  if (CXXRD->hasUserDeclaredMoveAssignment()) {
+const LangOptions  = SemaRef.getASTContext().getLangOpts();

rsmith wrote:
> Do we need this? The above code will have already declared as deleted the 
> relevant operator, so this seems like it can never trigger.
You are right, we do not need it.


https://reviews.llvm.org/D35056



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


[PATCH] D35056: GCC ABI incompatibility when passing object with trivial copy ctor, trivial dtor, and non-trivial move ctor

2017-07-27 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev updated this revision to Diff 108533.
v.g.vassilev marked 6 inline comments as done.
v.g.vassilev added a comment.

Address some of the comments.


https://reviews.llvm.org/D35056

Files:
  include/clang/AST/DeclCXX.h
  lib/AST/ASTImporter.cpp
  lib/AST/DeclCXX.cpp
  lib/CodeGen/CGCXXABI.cpp
  lib/CodeGen/ItaniumCXXABI.cpp
  lib/Sema/SemaDecl.cpp
  lib/Serialization/ASTReaderDecl.cpp
  lib/Serialization/ASTWriter.cpp
  test/CodeGenCXX/uncopyable-args.cpp

Index: test/CodeGenCXX/uncopyable-args.cpp
===
--- test/CodeGenCXX/uncopyable-args.cpp
+++ test/CodeGenCXX/uncopyable-args.cpp
@@ -1,87 +1,6 @@
 // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -std=c++11 -triple x86_64-windows-msvc -emit-llvm -o - %s | FileCheck %s -check-prefix=WIN64
 
-namespace trivial {
-// Trivial structs should be passed directly.
-struct A {
-  void *p;
-};
-void foo(A);
-void bar() {
-  foo({});
-}
-// CHECK-LABEL: define void @_ZN7trivial3barEv()
-// CHECK: alloca %"struct.trivial::A"
-// CHECK: load i8*, i8**
-// CHECK: call void @_ZN7trivial3fooENS_1AE(i8* %{{.*}})
-// CHECK-LABEL: declare void @_ZN7trivial3fooENS_1AE(i8*)
-
-// WIN64-LABEL: declare void @"\01?foo@trivial@@YAXUA@1@@Z"(i64)
-}
-
-namespace default_ctor {
-struct A {
-  A();
-  void *p;
-};
-void foo(A);
-void bar() {
-  // Core issue 1590.  We can pass this type in registers, even though C++
-  // normally doesn't permit copies when using braced initialization.
-  foo({});
-}
-// CHECK-LABEL: define void @_ZN12default_ctor3barEv()
-// CHECK: alloca %"struct.default_ctor::A"
-// CHECK: call void @_Z{{.*}}C1Ev(
-// CHECK: load i8*, i8**
-// CHECK: call void @_ZN12default_ctor3fooENS_1AE(i8* %{{.*}})
-// CHECK-LABEL: declare void @_ZN12default_ctor3fooENS_1AE(i8*)
-
-// WIN64-LABEL: declare void @"\01?foo@default_ctor@@YAXUA@1@@Z"(i64)
-}
-
-namespace move_ctor {
-// The presence of a move constructor implicitly deletes the trivial copy ctor
-// and means that we have to pass this struct by address.
-struct A {
-  A();
-  A(A &);
-  void *p;
-};
-void foo(A);
-void bar() {
-  foo({});
-}
-// FIXME: The copy ctor is implicitly deleted.
-// CHECK-DISABLED-LABEL: define void @_ZN9move_ctor3barEv()
-// CHECK-DISABLED: call void @_Z{{.*}}C1Ev(
-// CHECK-DISABLED-NOT: call
-// CHECK-DISABLED: call void @_ZN9move_ctor3fooENS_1AE(%"struct.move_ctor::A"* %{{.*}})
-// CHECK-DISABLED-LABEL: declare void @_ZN9move_ctor3fooENS_1AE(%"struct.move_ctor::A"*)
-
-// WIN64-LABEL: declare void @"\01?foo@move_ctor@@YAXUA@1@@Z"(%"struct.move_ctor::A"*)
-}
-
-namespace all_deleted {
-struct A {
-  A();
-  A(const A ) = delete;
-  A(A &) = delete;
-  void *p;
-};
-void foo(A);
-void bar() {
-  foo({});
-}
-// FIXME: The copy ctor is deleted.
-// CHECK-DISABLED-LABEL: define void @_ZN11all_deleted3barEv()
-// CHECK-DISABLED: call void @_Z{{.*}}C1Ev(
-// CHECK-DISABLED-NOT: call
-// CHECK-DISABLED: call void @_ZN11all_deleted3fooENS_1AE(%"struct.all_deleted::A"* %{{.*}})
-// CHECK-DISABLED-LABEL: declare void @_ZN11all_deleted3fooENS_1AE(%"struct.all_deleted::A"*)
-
-// WIN64-LABEL: declare void @"\01?foo@all_deleted@@YAXUA@1@@Z"(%"struct.all_deleted::A"*)
-}
 
 namespace implicitly_deleted {
 struct A {
@@ -93,188 +12,12 @@
 void bar() {
   foo({});
 }
-// FIXME: The copy and move ctors are implicitly deleted.
-// CHECK-DISABLED-LABEL: define void @_ZN18implicitly_deleted3barEv()
-// CHECK-DISABLED: call void @_Z{{.*}}C1Ev(
-// CHECK-DISABLED-NOT: call
-// CHECK-DISABLED: call void @_ZN18implicitly_deleted3fooENS_1AE(%"struct.implicitly_deleted::A"* %{{.*}})
-// CHECK-DISABLED-LABEL: declare void @_ZN18implicitly_deleted3fooENS_1AE(%"struct.implicitly_deleted::A"*)
-
-// WIN64-LABEL: declare void @"\01?foo@implicitly_deleted@@YAXUA@1@@Z"(%"struct.implicitly_deleted::A"*)
-}
-
-namespace one_deleted {
-struct A {
-  A();
-  A(A &) = delete;
-  void *p;
-};
-void foo(A);
-void bar() {
-  foo({});
-}
-// FIXME: The copy constructor is implicitly deleted.
-// CHECK-DISABLED-LABEL: define void @_ZN11one_deleted3barEv()
-// CHECK-DISABLED: call void @_Z{{.*}}C1Ev(
-// CHECK-DISABLED-NOT: call
-// CHECK-DISABLED: call void @_ZN11one_deleted3fooENS_1AE(%"struct.one_deleted::A"* %{{.*}})
-// CHECK-DISABLED-LABEL: declare void @_ZN11one_deleted3fooENS_1AE(%"struct.one_deleted::A"*)
-
-// WIN64-LABEL: declare void @"\01?foo@one_deleted@@YAXUA@1@@Z"(%"struct.one_deleted::A"*)
-}
-
-namespace copy_defaulted {
-struct A {
-  A();
-  A(const A ) = default;
-  A(A &) = delete;
-  void *p;
-};
-void foo(A);
-void bar() {
-  foo({});
-}
-// CHECK-LABEL: define void @_ZN14copy_defaulted3barEv()
+// CHECK-LABEL: define void @_ZN18implicitly_deleted3barEv()
 // CHECK: call void @_Z{{.*}}C1Ev(
-// CHECK: load i8*, i8**
-// CHECK: call void @_ZN14copy_defaulted3fooENS_1AE(i8* %{{.*}})
-// CHECK-LABEL: declare void @_ZN14copy_defaulted3fooENS_1AE(i8*)
+// CHECK-NOT: call

Re: r309327 - Headers: fix _Unwind_{G,S}etGR for non-EHABI targets

2017-07-27 Thread Hans Wennborg via cfe-commits
Merged to 5.0 in r309328.

On Thu, Jul 27, 2017 at 2:56 PM, Saleem Abdulrasool via cfe-commits
 wrote:
> Author: compnerd
> Date: Thu Jul 27 14:56:25 2017
> New Revision: 309327
>
> URL: http://llvm.org/viewvc/llvm-project?rev=309327=rev
> Log:
> Headers: fix _Unwind_{G,S}etGR for non-EHABI targets
>
> The EHABI definition was being inlined into the users even when EHABI
> was not in use.  Adjust the condition to ensure that the right version
> is defined.
>
> Modified:
> cfe/trunk/lib/Headers/unwind.h
>
> Modified: cfe/trunk/lib/Headers/unwind.h
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/unwind.h?rev=309327=309326=309327=diff
> ==
> --- cfe/trunk/lib/Headers/unwind.h (original)
> +++ cfe/trunk/lib/Headers/unwind.h Thu Jul 27 14:56:25 2017
> @@ -177,8 +177,7 @@ typedef _Unwind_Personality_Fn __persona
>  typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn)(struct _Unwind_Context *,
>  void *);
>
> -#if defined(__arm__) && !defined(__APPLE__)
> -
> +#if defined(__arm__) && !(defined(__USING_SJLJ_EXCEPTIONS__) || 
> defined(__ARM_DWARF_EH___))
>  typedef enum {
>_UVRSC_CORE = 0,/* integer register */
>_UVRSC_VFP = 1, /* vfp */
> @@ -200,14 +199,12 @@ typedef enum {
>_UVRSR_FAILED = 2
>  } _Unwind_VRS_Result;
>
> -#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__ARM_DWARF_EH__)
>  typedef uint32_t _Unwind_State;
>  #define _US_VIRTUAL_UNWIND_FRAME  ((_Unwind_State)0)
>  #define _US_UNWIND_FRAME_STARTING ((_Unwind_State)1)
>  #define _US_UNWIND_FRAME_RESUME   ((_Unwind_State)2)
>  #define _US_ACTION_MASK   ((_Unwind_State)3)
>  #define _US_FORCE_UNWIND  ((_Unwind_State)8)
> -#endif
>
>  _Unwind_VRS_Result _Unwind_VRS_Get(struct _Unwind_Context *__context,
>_Unwind_VRS_RegClass __regclass,
>
>
> ___
> 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


Buildmaster restart

2017-07-27 Thread Victor Leschuk via cfe-commits
Hello everyone,
LLVM buildmaster will be updated and restarted approximately at 08:00 AM
PDT 28th July.

-- 
Best Regards,

Victor Leschuk | Software Engineer |Access Softek

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


r309327 - Headers: fix _Unwind_{G,S}etGR for non-EHABI targets

2017-07-27 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Thu Jul 27 14:56:25 2017
New Revision: 309327

URL: http://llvm.org/viewvc/llvm-project?rev=309327=rev
Log:
Headers: fix _Unwind_{G,S}etGR for non-EHABI targets

The EHABI definition was being inlined into the users even when EHABI
was not in use.  Adjust the condition to ensure that the right version
is defined.

Modified:
cfe/trunk/lib/Headers/unwind.h

Modified: cfe/trunk/lib/Headers/unwind.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/unwind.h?rev=309327=309326=309327=diff
==
--- cfe/trunk/lib/Headers/unwind.h (original)
+++ cfe/trunk/lib/Headers/unwind.h Thu Jul 27 14:56:25 2017
@@ -177,8 +177,7 @@ typedef _Unwind_Personality_Fn __persona
 typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn)(struct _Unwind_Context *,
 void *);
 
-#if defined(__arm__) && !defined(__APPLE__)
-
+#if defined(__arm__) && !(defined(__USING_SJLJ_EXCEPTIONS__) || 
defined(__ARM_DWARF_EH___))
 typedef enum {
   _UVRSC_CORE = 0,/* integer register */
   _UVRSC_VFP = 1, /* vfp */
@@ -200,14 +199,12 @@ typedef enum {
   _UVRSR_FAILED = 2
 } _Unwind_VRS_Result;
 
-#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__ARM_DWARF_EH__)
 typedef uint32_t _Unwind_State;
 #define _US_VIRTUAL_UNWIND_FRAME  ((_Unwind_State)0)
 #define _US_UNWIND_FRAME_STARTING ((_Unwind_State)1)
 #define _US_UNWIND_FRAME_RESUME   ((_Unwind_State)2)
 #define _US_ACTION_MASK   ((_Unwind_State)3)
 #define _US_FORCE_UNWIND  ((_Unwind_State)8)
-#endif
 
 _Unwind_VRS_Result _Unwind_VRS_Get(struct _Unwind_Context *__context,
   _Unwind_VRS_RegClass __regclass,


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


[PATCH] D34114: [clang] Change the condition of unnecessary packed warning

2017-07-27 Thread Chih-Hung Hsieh via Phabricator via cfe-commits
chh added inline comments.



Comment at: lib/AST/RecordLayoutBuilder.cpp:1887
+// greater than the one after packing.
+if (Packed && UnpackedAlignment <= Alignment)
   Diag(D->getLocation(), diag::warn_unnecessary_packed)

With this change, UnpackedSize is unused and caused a warning about 
unused-but-set-variable. Please use it or remove the variable.

I think UnpackedSizeInBits should be used somehow in the condition, because bit 
fields can be affected by the packed attribute. Please add a few unit test 
cases with bit fields. For example, the following cases showed that S21 is 
affected by packed, but got a wrong "unnecessary" warning after this change.


```
struct S21 {
  unsigned char a:6;
  unsigned char b:6;
} __attribute__((packed, aligned(1)));
struct S22 {
  unsigned char a:6;
  unsigned char b:6;
} __attribute__((aligned(1)));
struct S23 {
  unsigned char a:6;
  unsigned char b:6;
};

```
Warnings:

```
  padding size of 'S21' with 4 bits to alignment boundary
  packed attribute is unnecessary for 'S21'
  padding struct 'S22' with 2 bits to align 'b'
  padding size of 'S22' with 2 bits to alignment boundary
  padding struct 'S23' with 2 bits to align 'b'
  padding size of 'S23' with 2 bits to alignment boundary

```



https://reviews.llvm.org/D34114



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


[PATCH] D35159: [libcxxabi][demangler] Use an AST to represent the demangled name

2017-07-27 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith accepted this revision.
dexonsmith added a comment.
This revision is now accepted and ready to land.

In https://reviews.llvm.org/D35159#823211, @erik.pilkington wrote:

> Use LLVM naming conventions for all the new stuff in this patch.


Thanks for renaming everything.  LGTM!


https://reviews.llvm.org/D35159



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


[libcxx] r309322 - [libcxx] [test] Remove an unused local typedef in enable_shared_from_this.pass.cpp.

2017-07-27 Thread Stephan T. Lavavej via cfe-commits
Author: stl_msft
Date: Thu Jul 27 14:16:37 2017
New Revision: 309322

URL: http://llvm.org/viewvc/llvm-project?rev=309322=rev
Log:
[libcxx] [test] Remove an unused local typedef in 
enable_shared_from_this.pass.cpp.

Trivial change, committed without review.

Modified:

libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp?rev=309322=309321=309322=diff
==
--- 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
 Thu Jul 27 14:16:37 2017
@@ -80,7 +80,6 @@ int main()
 }
 {
   typedef std::shared_ptr APtr;
-  typedef std::weak_ptr WeakAPtr;
   APtr a1 = std::make_shared();
   assert(a1.use_count() == 1);
 }


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


[PATCH] D34158: For standards compatibility, preinclude if the file is available

2017-07-27 Thread Melanie Blower via Phabricator via cfe-commits
mibintc updated this revision to Diff 108519.
mibintc added a comment.

Here is an updated diff which is rebased to current trunk per @fedor.sergeev  
's suggestion (thank you).  make check-all and check-clang are working for me 
on Linux with no unexpected failures.

The associated patch for test cases in the tools/extra directory is still 
valid, it doesn't need updating.


Repository:
  rL LLVM

https://reviews.llvm.org/D34158

Files:
  include/clang/Driver/CC1Options.td
  include/clang/Lex/PreprocessorOptions.h
  lib/Driver/ToolChains/Clang.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Frontend/InitPreprocessor.cpp
  test/Driver/clang_cpp.c
  test/Driver/crash-report-header.h
  test/Driver/crash-report-spaces.c
  test/Driver/crash-report.c
  test/Driver/rewrite-legacy-objc.m
  test/Driver/rewrite-map-in-diagnostics.c
  test/Driver/rewrite-objc.m
  test/Index/IBOutletCollection.m
  test/Index/annotate-macro-args.m
  test/Index/annotate-tokens-pp.c
  test/Index/annotate-tokens.c
  test/Index/c-index-getCursor-test.m
  test/Index/get-cursor-macro-args.m
  test/Index/get-cursor.cpp
  test/Preprocessor/ignore-pragmas.c
  unittests/Tooling/TestVisitor.h

Index: lib/Driver/ToolChains/Clang.cpp
===
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -3243,6 +3243,11 @@
   KernelOrKext) {
 CmdArgs.push_back("-ffreestanding");
 IsHosted = false;
+  } else {
+// For standards compliance, clang will preinclude 
+// -ffreestanding suppresses this behavior.
+CmdArgs.push_back("-finclude-if-exists");
+CmdArgs.push_back("stdc-predef.h");
   }
 
   // Forward -f (flag) options which we can pass directly.
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -2502,6 +2502,10 @@
   for (const Arg *A : Args.filtered(OPT_chain_include))
 Opts.ChainedIncludes.emplace_back(A->getValue());
 
+  // Add the ordered list of -finclude-if-exists.
+  for (const Arg *A : Args.filtered(OPT_finclude_if_exists))
+Opts.FIncludeIfExists.emplace_back(A->getValue());
+
   for (const Arg *A : Args.filtered(OPT_remap_file)) {
 std::pair Split = StringRef(A->getValue()).split(';');
 
Index: lib/Frontend/InitPreprocessor.cpp
===
--- lib/Frontend/InitPreprocessor.cpp
+++ lib/Frontend/InitPreprocessor.cpp
@@ -69,6 +69,12 @@
   Builder.append(Twine("#include \"") + File + "\"");
 }
 
+static void AddImplicitIncludeIfExists(MacroBuilder , StringRef File) {
+  Builder.append(Twine("#if __has_include( \"") + File + "\")");
+  Builder.append(Twine("#include \"") + File + "\"");
+  Builder.append(Twine("#endif"));
+}
+
 static void AddImplicitIncludeMacros(MacroBuilder , StringRef File) {
   Builder.append(Twine("#__include_macros \"") + File + "\"");
   // Marker token to stop the __include_macros fetch loop.
@@ -1091,6 +1097,12 @@
   // Exit the command line and go back to  (2 is LC_LEAVE).
   if (!PP.getLangOpts().AsmPreprocessor)
 Builder.append("# 1 \"\" 2");
+  
+  // Process -finclude-if-exists directives.
+  for (unsigned i = 0, e = InitOpts.FIncludeIfExists.size(); i != e; ++i) {
+const std::string  = InitOpts.FIncludeIfExists[i];
+AddImplicitIncludeIfExists(Builder, Path);
+  }
 
   // If -imacros are specified, include them now.  These are processed before
   // any -include directives.
Index: unittests/Tooling/TestVisitor.h
===
--- unittests/Tooling/TestVisitor.h
+++ unittests/Tooling/TestVisitor.h
@@ -52,6 +52,7 @@
   /// \brief Runs the current AST visitor over the given code.
   bool runOver(StringRef Code, Language L = Lang_CXX) {
 std::vector Args;
+Args.push_back("-ffreestanding");
 switch (L) {
   case Lang_C:
 Args.push_back("-x");
Index: include/clang/Driver/CC1Options.td
===
--- include/clang/Driver/CC1Options.td
+++ include/clang/Driver/CC1Options.td
@@ -735,6 +735,8 @@
   HelpText<"Use specified token cache file">;
 def detailed_preprocessing_record : Flag<["-"], "detailed-preprocessing-record">,
   HelpText<"include a detailed record of preprocessing actions">;
+def finclude_if_exists : Separate<["-"], "finclude-if-exists">, MetaVarName<"">,
+  HelpText<"Include file before parsing if file exists">;
 
 //===--===//
 // OpenCL Options
Index: include/clang/Lex/PreprocessorOptions.h
===
--- include/clang/Lex/PreprocessorOptions.h
+++ include/clang/Lex/PreprocessorOptions.h
@@ -60,6 +60,9 @@
   /// \brief Headers that will be converted to chained PCHs in memory.
   std::vector 

[PATCH] D35955: clang-format: Add preprocessor directive indentation

2017-07-27 Thread Erik Uhlmann via Phabricator via cfe-commits
euhlmann created this revision.
euhlmann added a project: clang.

This is an implementation for bug 17362 
 which adds support for 
indenting preprocessor statements inside if/ifdef/endif. This takes previous 
work from fmauch and makes it into a full feature.
The context of this patch is that I'm a VMware intern, and I implemented this 
because VMware needs the feature. As such, some decisions were made based on 
what VMware wants, and I would appreciate suggestions on expanding this if 
necessary to use-cases other people may want.

Example:

  #if FOO #if FOO
  #define BAR   -># define BAR
  #endif  #endif



- It's controlled by a new bool config option `IndentPPDirectives`
- Indenting happens after the hash but the hash counts as a column. In other 
words, one space is inserted for the first indent level and two spaces for 
every other level.

  #if FOO
  # if BAR
  #   include 
  # endif
  #endif

This suited VMware's needs, but if not counting the hash as a column is 
significant, this could be configurable instead.

- Tabs are supported if enabled with `UseTab`
- There's a heuristic for detecting include guards and not indenting them. It 
looks for the pattern

  #ifndef 

immediately followed by

  #define 

This was chosen because it's simple, but it will cause problems if that pattern 
appears when it's not meant to be an include guard.


https://reviews.llvm.org/D35955

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

Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -2215,8 +2215,55 @@
getLLVMStyleWithColumns(11));
 }
 
-TEST_F(FormatTest, IndentPreprocessorDirectivesAtZero) {
-  EXPECT_EQ("{\n  {\n#define A\n  }\n}", format("{{\n#define A\n}}"));
+TEST_F(FormatTest, IndentPreprocessorDirectives) {
+  FormatStyle Style = getLLVMStyle();
+  Style.IndentPPDirectives = false;
+  verifyFormat("#ifdef _WIN32\n"
+   "#define A 0\n"
+   "#ifdef VAR2\n"
+   "#define B 1\n"
+   "#include \n"
+   "#define MACRO  "
+   "\\\n"
+   "  some_very_long_func_a"
+   "a();\n"
+   "#endif\n"
+   "#else\n"
+   "#define A 1\n"
+   "#endif", Style);
+
+  Style.IndentPPDirectives = true;
+  verifyFormat("#ifdef _WIN32\n"
+   "# define A 0\n"
+   "# ifdef VAR2\n"
+   "#   define B 1\n"
+   "#   include \n"
+   "#   define MACRO   "
+   "\\\n"
+   "  some_very_long_func_a"
+   "a();\n"
+   "# endif\n"
+   "#else\n"
+   "# define A 1\n"
+   "#endif", Style);
+  // don't indent include guards
+  // verifyFormat() currently calls test::messUp() which incorrectly merges L2
+  // and L3, so call EXPECT_EQ manually
+  EXPECT_EQ("#ifndef _SOMEFILE_H\n"
+"#define _SOMEFILE_H\n"
+"code();\n"
+"#endif", format("#ifndef _SOMEFILE_H\n"
+ "#define _SOMEFILE_H\n"
+ "code();\n"
+ "#endif", Style));
+
+  // make sure it works even with tabs
+  Style.UseTab = FormatStyle::UT_Always;
+  Style.IndentWidth = 8;
+  Style.TabWidth = 8;
+  verifyFormat("#ifdef _WIN32\n"
+   "#\tdefine C 1\n"
+   "#endif", Style);
 }
 
 TEST_F(FormatTest, FormatHashIfNotAtStartOfLine) {
Index: lib/Format/UnwrappedLineParser.h
===
--- lib/Format/UnwrappedLineParser.h
+++ lib/Format/UnwrappedLineParser.h
@@ -235,6 +235,9 @@
   // sequence.
   std::stack PPChainBranchIndex;
 
+  unsigned PPIndentLevel;
+  FormatToken *PPMaybeIncludeGuard;
+
   friend class ScopedLineState;
   friend class CompoundStatementIndenter;
 };
Index: lib/Format/UnwrappedLineParser.cpp
===
--- lib/Format/UnwrappedLineParser.cpp
+++ lib/Format/UnwrappedLineParser.cpp
@@ -231,7 +231,8 @@
 : Line(new UnwrappedLine), MustBreakBeforeNextToken(false),
   CurrentLines(), Style(Style), Keywords(Keywords),
   CommentPragmasRegex(Style.CommentPragmas), Tokens(nullptr),
-  Callback(Callback), AllTokens(Tokens), PPBranchLevel(-1) {}
+  Callback(Callback), 

[PATCH] D35934: [Headers] Add a test for arm64intr.h

2017-07-27 Thread Martin Storsjö via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL309314: [Headers] Add a test for arm64intr.h (authored by 
mstorsjo).

Changed prior to commit:
  https://reviews.llvm.org/D35934?vs=108438=108515#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D35934

Files:
  cfe/trunk/test/Headers/ms-intrin.cpp


Index: cfe/trunk/test/Headers/ms-intrin.cpp
===
--- cfe/trunk/test/Headers/ms-intrin.cpp
+++ cfe/trunk/test/Headers/ms-intrin.cpp
@@ -64,4 +64,8 @@
 #ifdef _M_ARM
   __dmb(_ARM_BARRIER_ISHST);
 #endif
+
+#ifdef _M_ARM64
+  __dmb(_ARM64_BARRIER_SY);
+#endif
 }


Index: cfe/trunk/test/Headers/ms-intrin.cpp
===
--- cfe/trunk/test/Headers/ms-intrin.cpp
+++ cfe/trunk/test/Headers/ms-intrin.cpp
@@ -64,4 +64,8 @@
 #ifdef _M_ARM
   __dmb(_ARM_BARRIER_ISHST);
 #endif
+
+#ifdef _M_ARM64
+  __dmb(_ARM64_BARRIER_SY);
+#endif
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r309314 - [Headers] Add a test for arm64intr.h

2017-07-27 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Thu Jul 27 12:45:13 2017
New Revision: 309314

URL: http://llvm.org/viewvc/llvm-project?rev=309314=rev
Log:
[Headers] Add a test for arm64intr.h

This tests the ARM64 specific constants added in SVN r309081,
similar to the one added in r277928 for armintr.h.

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

Modified:
cfe/trunk/test/Headers/ms-intrin.cpp

Modified: cfe/trunk/test/Headers/ms-intrin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/ms-intrin.cpp?rev=309314=309313=309314=diff
==
--- cfe/trunk/test/Headers/ms-intrin.cpp (original)
+++ cfe/trunk/test/Headers/ms-intrin.cpp Thu Jul 27 12:45:13 2017
@@ -64,4 +64,8 @@ void f() {
 #ifdef _M_ARM
   __dmb(_ARM_BARRIER_ISHST);
 #endif
+
+#ifdef _M_ARM64
+  __dmb(_ARM64_BARRIER_SY);
+#endif
 }


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


[PATCH] D35577: Add -flookup-tables and -fno-lookup-tables flags

2017-07-27 Thread Sumanth Gundapaneni via Phabricator via cfe-commits
sgundapa added a comment.

The only change that is needed is to disable  lookup-tables based on the 
attribute "no-jump-tables" set by  "-fno-jump-tables" clang flag.
It implies that this change is not required.


https://reviews.llvm.org/D35577



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


[PATCH] D35578: Add -fswitch-tables and -fno-switch-tables flags

2017-07-27 Thread Sumanth Gundapaneni via Phabricator via cfe-commits
sgundapa abandoned this revision.
sgundapa added a comment.

Refer to https://reviews.llvm.org/D35577 as we decided to disable lookup tables 
under -fno-jump-tables


https://reviews.llvm.org/D35578



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


[PATCH] D34114: [clang] Change the condition of unnecessary packed warning

2017-07-27 Thread Yan Wang via Phabricator via cfe-commits
yawanng updated this revision to Diff 108513.
yawanng marked 2 inline comments as done.
yawanng edited the summary of this revision.

https://reviews.llvm.org/D34114

Files:
  lib/AST/RecordLayoutBuilder.cpp
  test/CodeGenCXX/warn-padded-packed.cpp

Index: test/CodeGenCXX/warn-padded-packed.cpp
===
--- test/CodeGenCXX/warn-padded-packed.cpp
+++ test/CodeGenCXX/warn-padded-packed.cpp
@@ -17,7 +17,7 @@
 } __attribute__((packed));
 
 struct S4 {
-  int i; // expected-warning {{packed attribute is unnecessary for 'i'}}
+  int i;
   char c;
 } __attribute__((packed));
 
@@ -46,18 +46,18 @@
   int i; // expected-warning {{padding struct 'S8' with 3 bytes to align 'i'}}
 };
 
-struct S9 { // expected-warning {{packed attribute is unnecessary for 'S9'}}
-  int x; // expected-warning {{packed attribute is unnecessary for 'x'}}
-  int y; // expected-warning {{packed attribute is unnecessary for 'y'}}
+struct S9 {
+  int x;
+  int y;
 } __attribute__((packed));
 
-struct S10 { // expected-warning {{packed attribute is unnecessary for 'S10'}}
-  int x; // expected-warning {{packed attribute is unnecessary for 'x'}}
+struct S10 {
+  int x;
   char a,b,c,d;
 } __attribute__((packed));
 
 
-struct S11 {
+struct S11 { // expected-warning {{packed attribute is unnecessary for 'S11'}}
   bool x;
   char a,b,c,d;
 } __attribute__((packed));
@@ -72,5 +72,38 @@
   bool b : 10;
 };
 
+struct S14 { // expected-warning {{packed attribute is unnecessary for 'S14'}}
+  char a,b,c,d;
+} __attribute__((packed));
+
+struct S15 { // expected-warning {{packed attribute is unnecessary for 'S15'}}
+  struct S14 s;
+  char a;
+} __attribute__((packed));
+
+struct S16 { // expected-warning {{padding size of 'S16' with 2 bytes to alignment boundary}} expected-warning {{packed attribute is unnecessary for 'S16'}}
+  char a,b;
+} __attribute__((packed, aligned(4)));
+
+struct S17 {
+  struct S16 s;
+  char a,b;
+} __attribute__((packed, aligned(2)));
+
+struct S18 { // expected-warning {{padding size of 'S18' with 2 bytes to alignment boundary}} expected-warning {{packed attribute is unnecessary for 'S18'}}
+  struct S16 s;
+  char a,b;
+} __attribute__((packed, aligned(4)));
+
+struct S19 { // expected-warning {{packed attribute is unnecessary for 'S19'}}
+  bool b;
+  char a;
+} __attribute__((packed, aligned(1)));
+
+struct S20 {
+  int i;
+  char a;
+} __attribute__((packed, aligned(1)));
+
 // The warnings are emitted when the layout of the structs is computed, so we have to use them.
-void f(S1*, S2*, S3*, S4*, S5*, S6*, S7*, S8*, S9*, S10*, S11*, S12*, S13*) { }
+void f(S1*, S2*, S3*, S4*, S5*, S6*, S7*, S8*, S9*, S10*, S11*, S12*, S13*, S14*, S15*, S16*, S17*, S18*, S19*, S20*){}
Index: lib/AST/RecordLayoutBuilder.cpp
===
--- lib/AST/RecordLayoutBuilder.cpp
+++ lib/AST/RecordLayoutBuilder.cpp
@@ -1882,10 +1882,9 @@
   << (InBits ? 1 : 0); // (byte|bit)
 }
 
-// Warn if we packed it unnecessarily. If the alignment is 1 byte don't
-// bother since there won't be alignment issues.
-if (Packed && UnpackedAlignment > CharUnits::One() && 
-getSize() == UnpackedSize)
+// Warn if we packed it unnecessarily, when the unpacked alignment is not
+// greater than the one after packing.
+if (Packed && UnpackedAlignment <= Alignment)
   Diag(D->getLocation(), diag::warn_unnecessary_packed)
   << Context.getTypeDeclType(RD);
   }
@@ -1978,12 +1977,6 @@
   << PadSize
   << (InBits ? 1 : 0); // (byte|bit)
   }
-
-  // Warn if we packed it unnecessarily. If the alignment is 1 byte don't
-  // bother since there won't be alignment issues.
-  if (isPacked && UnpackedAlign > CharBitNum && Offset == UnpackedOffset)
-Diag(D->getLocation(), diag::warn_unnecessary_packed)
-<< D->getIdentifier();
 }
 
 static const CXXMethodDecl *computeKeyFunction(ASTContext ,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r309309 - [OPENMP] Allow all lvalues in 'depend' clause.

2017-07-27 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Thu Jul 27 12:15:30 2017
New Revision: 309309

URL: http://llvm.org/viewvc/llvm-project?rev=309309=rev
Log:
[OPENMP] Allow all lvalues in 'depend' clause.

According to upcoming OpenMP 5.0 all addressable lvalue expressions are
allowed in deoend clause.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/test/OpenMP/target_depend_messages.cpp
cfe/trunk/test/OpenMP/target_enter_data_depend_messages.cpp
cfe/trunk/test/OpenMP/target_exit_data_depend_messages.cpp
cfe/trunk/test/OpenMP/target_parallel_depend_messages.cpp
cfe/trunk/test/OpenMP/target_parallel_for_depend_messages.cpp
cfe/trunk/test/OpenMP/target_parallel_for_simd_depend_messages.cpp
cfe/trunk/test/OpenMP/target_simd_depend_messages.cpp
cfe/trunk/test/OpenMP/target_teams_depend_messages.cpp
cfe/trunk/test/OpenMP/target_teams_distribute_depend_messages.cpp

cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_depend_messages.cpp

cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_simd_depend_messages.cpp
cfe/trunk/test/OpenMP/target_teams_distribute_simd_depend_messages.cpp
cfe/trunk/test/OpenMP/target_update_depend_messages.cpp
cfe/trunk/test/OpenMP/task_depend_messages.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=309309=309308=309309=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Jul 27 12:15:30 
2017
@@ -8519,6 +8519,8 @@ def err_omp_expected_var_name_member_exp
   "expected variable name%select{| or data member of current class}0">;
 def err_omp_expected_var_name_member_expr_or_array_item : Error<
   "expected variable name%select{|, data member of current class}0, array 
element or array section">;
+def err_omp_expected_addressable_lvalue_or_array_item : Error<
+  "expected addressable lvalue expression, array element or array section">;
 def err_omp_expected_named_var_member_or_array_expression: Error<
   "expected expression containing only member accesses and/or array sections 
based on named variables">;
 def err_omp_bit_fields_forbidden_in_clause : Error<

Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=309309=309308=309309=diff
==
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Thu Jul 27 12:15:30 2017
@@ -10486,23 +10486,26 @@ Sema::ActOnOpenMPDependClause(OpenMPDepe
 }
 OpsOffs.push_back({RHS, OOK});
   } else {
-// OpenMP  [2.11.1.1, Restrictions, p.3]
-//  A variable that is part of another variable (such as a field of a
-//  structure) but is not an array element or an array section cannot
-//  appear  in a depend clause.
-auto *DE = dyn_cast(SimpleExpr);
 auto *ASE = dyn_cast(SimpleExpr);
-auto *OASE = dyn_cast(SimpleExpr);
 if (!RefExpr->IgnoreParenImpCasts()->isLValue() ||
-(!ASE && !DE && !OASE) || (DE && !isa(DE->getDecl())) ||
 (ASE &&
  !ASE->getBase()
   ->getType()
   .getNonReferenceType()
   ->isPointerType() &&
  !ASE->getBase()->getType().getNonReferenceType()->isArrayType())) 
{
-  Diag(ELoc, diag::err_omp_expected_var_name_member_expr_or_array_item)
-  << 0 << RefExpr->getSourceRange();
+  Diag(ELoc, diag::err_omp_expected_addressable_lvalue_or_array_item)
+  << RefExpr->getSourceRange();
+  continue;
+}
+bool Suppress = getDiagnostics().getSuppressAllDiagnostics();
+getDiagnostics().setSuppressAllDiagnostics(/*Val=*/true);
+ExprResult Res = CreateBuiltinUnaryOp(SourceLocation(), UO_AddrOf,
+  RefExpr->IgnoreParenImpCasts());
+getDiagnostics().setSuppressAllDiagnostics(Suppress);
+if (!Res.isUsable() && !isa(SimpleExpr)) {
+  Diag(ELoc, diag::err_omp_expected_addressable_lvalue_or_array_item)
+  << RefExpr->getSourceRange();
   continue;
 }
   }

Modified: cfe/trunk/test/OpenMP/target_depend_messages.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_depend_messages.cpp?rev=309309=309308=309309=diff
==
--- cfe/trunk/test/OpenMP/target_depend_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/target_depend_messages.cpp Thu Jul 27 12:15:30 2017
@@ -36,21 +36,21 @@ int main(int argc, char **argv, char *en
   foo();
   #pragma omp target depend 

[PATCH] D34114: [clang] Change the condition of unnecessary packed warning

2017-07-27 Thread Stephen Hines via Phabricator via cfe-commits
srhines added a comment.

This looks better. It did lose context however, so some of the review is harder 
to read.




Comment at: test/CodeGenCXX/warn-padded-packed.cpp:84
+
+struct S16 { // expected-warning {{padding size of 'S16' with 2 bytes to 
alignment boundar}} expected-warning {{packed attribute is unnecessary for 
'S16'}}
+  char a,b;

boundar -> boundary ?



Comment at: test/CodeGenCXX/warn-padded-packed.cpp:93
+
+struct S18 { // expected-warning {{padding size of 'S18' with 2 bytes to 
alignment boundar}} expected-warning {{packed attribute is unnecessary for 
'S18'}}
+  struct S16 s;

boundary?


https://reviews.llvm.org/D34114



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


r309308 - Revert r264998 and r265035.

2017-07-27 Thread Akira Hatanaka via cfe-commits
Author: ahatanak
Date: Thu Jul 27 11:52:44 2017
New Revision: 309308

URL: http://llvm.org/viewvc/llvm-project?rev=309308=rev
Log:
Revert r264998 and r265035.

r303175 made changes to have __cxa_allocate_exception return a 16-byte
aligned pointer, so it's no longer necessary to specify a lower
alignment (8-bytes) for exception objects on Darwin.

rdar://problem/32363695

Modified:
cfe/trunk/include/clang/Basic/TargetInfo.h
cfe/trunk/lib/Basic/Targets/OSTargets.h
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
cfe/trunk/test/CodeGenCXX/eh.cpp

Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=309308=309307=309308=diff
==
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Thu Jul 27 11:52:44 2017
@@ -464,21 +464,6 @@ public:
   /// types for the given target.
   unsigned getSimdDefaultAlign() const { return SimdDefaultAlign; }
 
-  /// Return the alignment (in bits) of the thrown exception object. This is
-  /// only meaningful for targets that allocate C++ exceptions in a system
-  /// runtime, such as those using the Itanium C++ ABI.
-  virtual unsigned getExnObjectAlignment() const {
-// Itanium says that an _Unwind_Exception has to be "double-word"
-// aligned (and thus the end of it is also so-aligned), meaning 16
-// bytes.  Of course, that was written for the actual Itanium,
-// which is a 64-bit platform.  Classically, the ABI doesn't really
-// specify the alignment on other platforms, but in practice
-// libUnwind declares the struct with __attribute__((aligned)), so
-// we assume that alignment here.  (It's generally 16 bytes, but
-// some targets overwrite it.)
-return getDefaultAlignForAttributeAligned();
-  }
-
   /// \brief Return the size of intmax_t and uintmax_t for this target, in 
bits.
   unsigned getIntMaxTWidth() const {
 return getTypeWidth(IntMaxType);

Modified: cfe/trunk/lib/Basic/Targets/OSTargets.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/OSTargets.h?rev=309308=309307=309308=diff
==
--- cfe/trunk/lib/Basic/Targets/OSTargets.h (original)
+++ cfe/trunk/lib/Basic/Targets/OSTargets.h Thu Jul 27 11:52:44 2017
@@ -127,13 +127,6 @@ public:
   /// is very similar to ELF's "protected";  Darwin requires a "weak"
   /// attribute on declarations that can be dynamically replaced.
   bool hasProtectedVisibility() const override { return false; }
-
-  unsigned getExnObjectAlignment() const override {
-// The alignment of an exception object is 8-bytes for darwin since
-// libc++abi doesn't declare _Unwind_Exception with 
__attribute__((aligned))
-// and therefore doesn't guarantee 16-byte alignment.
-return 64;
-  }
 };
 
 // DragonFlyBSD Target

Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=309308=309307=309308=diff
==
--- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Thu Jul 27 11:52:44 2017
@@ -157,9 +157,17 @@ public:
Address Ptr, QualType ElementType,
const CXXDestructorDecl *Dtor) override;
 
+  /// Itanium says that an _Unwind_Exception has to be "double-word"
+  /// aligned (and thus the end of it is also so-aligned), meaning 16
+  /// bytes.  Of course, that was written for the actual Itanium,
+  /// which is a 64-bit platform.  Classically, the ABI doesn't really
+  /// specify the alignment on other platforms, but in practice
+  /// libUnwind declares the struct with __attribute__((aligned)), so
+  /// we assume that alignment here.  (It's generally 16 bytes, but
+  /// some targets overwrite it.)
   CharUnits getAlignmentOfExnObject() {
-unsigned Align = CGM.getContext().getTargetInfo().getExnObjectAlignment();
-return CGM.getContext().toCharUnitsFromBits(Align);
+auto align = CGM.getContext().getTargetDefaultAlignForAttributeAligned();
+return CGM.getContext().toCharUnitsFromBits(align);
   }
 
   void emitRethrow(CodeGenFunction , bool isNoReturn) override;

Modified: cfe/trunk/test/CodeGenCXX/eh.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/eh.cpp?rev=309308=309307=309308=diff
==
--- cfe/trunk/test/CodeGenCXX/eh.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/eh.cpp Thu Jul 27 11:52:44 2017
@@ -466,7 +466,7 @@ int foo() {
   // CHECK: [[T0:%.*]] = call i8* @__cxa_allocate_exception(i64 16)
   // CHECK-NEXT: [[T1:%.*]] = bitcast i8* [[T0]] to 
%"class.test17::DerivedException"*
   // CHECK-NEXT: [[T2:%.*]] = 

[PATCH] D33561: [CMake] Add Android toolchain CMake cache files.

2017-07-27 Thread Stephen Hines via Phabricator via cfe-commits
srhines accepted this revision.
srhines added a comment.
This revision is now accepted and ready to land.

Awesome!


https://reviews.llvm.org/D33561



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


[libcxx] r309307 - Disable the deduction guide test I added in 309296 for the moment, while I figure out which compilers don't support deduction guides

2017-07-27 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Jul 27 11:47:35 2017
New Revision: 309307

URL: http://llvm.org/viewvc/llvm-project?rev=309307=rev
Log:
Disable the deduction guide test I added in 309296 for the moment, while I 
figure out which compilers don't support deduction guides

Modified:

libcxx/trunk/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp?rev=309307=309306=309307=diff
==
--- 
libcxx/trunk/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
 Thu Jul 27 11:47:35 2017
@@ -261,9 +261,13 @@ int main() {
   test_copy_ctor_valueless_by_exception();
   test_copy_ctor_sfinae();
   test_constexpr_copy_ctor_extension();
+#if 0
+// disable this for the moment; it fails on older compilers.
+//  Need to figure out which compilers will support it.
 { // This is the motivating example from P0739R0
   std::variant v1(3);
   std::variant v2 = v1;
   (void) v2;
 }
+#endif
 }


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


[PATCH] D35056: GCC ABI incompatibility when passing object with trivial copy ctor, trivial dtor, and non-trivial move ctor

2017-07-27 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments.



Comment at: lib/CodeGen/CGCXXABI.cpp:33-47
+  // See also Sema::ShouldDeleteSpecialMember. These two functions
+  // should be kept consistent.
+
   // If RD has a non-trivial move or copy constructor, we cannot copy the
   // argument.
   if (RD->hasNonTrivialCopyConstructor() || RD->hasNonTrivialMoveConstructor())
 return false;

Perhaps it would make sense to put this whole "does the language permit passing 
in registers?" calculation in Sema and store that in the DefinitionData rather 
than storing the "HasNonDeletedCopyOrMoveConstructor" flag.



Comment at: lib/Sema/SemaDecl.cpp:14816-14817
+static bool HasNonDeletedCopyOrMoveCtor(CXXRecordDecl *CXXRD, Sema ) {
+  // FIXME: Handle the cases in which CXXRD is dependent. We need to 
instantiate
+  // the class to figure out if the constructor should be deleted.
+  assert(!CXXRD->isDependentType() && "Not implemented yet");

This seems like a good motivation for the flag to be a "can pass in registers" 
flag: that makes it much more obvious that it's meaningless on a dependent 
class, since such a class will never be passed / returned at all.



Comment at: lib/Sema/SemaDecl.cpp:14821-14822
+CXXConstructorDecl *CopyCtor = 
SemaRef.DeclareImplicitCopyConstructor(CXXRD);
+if (SemaRef.ShouldDeleteSpecialMember(CopyCtor, Sema::CXXCopyConstructor))
+  SemaRef.SetDeclDeleted(CopyCtor, CXXRD->getLocation());
+  }

You don't need to do this: triggering the declaration will delete the member if 
relevant.

However, we should refactor `ShouldDeleteSpecialMember` so that it can be 
called without actually having built a special member declaration: this patch 
removes all laziness in declaring copy or move constructors.



Comment at: lib/Sema/SemaDecl.cpp:14825
+
+  if (CXXRD->needsImplicitMoveConstructor()) {
+CXXConstructorDecl *MoveCtor = 
SemaRef.DeclareImplicitMoveConstructor(CXXRD);

This needs to be guarded by a `getLangOpts().CPlusPlus11` check.



Comment at: lib/Sema/SemaDecl.cpp:14831-14839
+  bool CopyOrMoveDeleted = false;
+  for (const CXXConstructorDecl *CD : CXXRD->ctors()) {
+if (CD->isMoveConstructor() || CD->isCopyConstructor()) {
+  if (!CD->isDeleted()) {
+return true;
+  }
+  CopyOrMoveDeleted = true;

We should do this check before we call `ShouldDeleteSpecialMember` to get the 
benefit of the early exit. If we switch to tracking the ABI flag, we can also 
bail out early if we see a non-trivial copy ctor / move ctor / dtor.



Comment at: lib/Sema/SemaDecl.cpp:14841-14852
+  // If a move constructor or move assignment operator was declared, the
+  // default copy constructors are implicitly deleted, except in one case
+  // related to compatibility with MSVC pre-2015.
+  if (CXXRD->hasUserDeclaredMoveConstructor())
+CopyOrMoveDeleted = true;
+  if (CXXRD->hasUserDeclaredMoveAssignment()) {
+const LangOptions  = SemaRef.getASTContext().getLangOpts();

Do we need this? The above code will have already declared as deleted the 
relevant operator, so this seems like it can never trigger.



Comment at: lib/Sema/SemaDecl.cpp:15147-15148
 
 if (!Completed)
   Record->completeDefinition();
 

This call also needs to pass in the relevant flag.


https://reviews.llvm.org/D35056



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


[PATCH] D35056: GCC ABI incompatibility when passing object with trivial copy ctor, trivial dtor, and non-trivial move ctor

2017-07-27 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev updated this revision to Diff 108505.
v.g.vassilev added a comment.

Move the checks in Sema.


https://reviews.llvm.org/D35056

Files:
  include/clang/AST/DeclCXX.h
  lib/AST/ASTImporter.cpp
  lib/AST/DeclCXX.cpp
  lib/CodeGen/CGCXXABI.cpp
  lib/CodeGen/ItaniumCXXABI.cpp
  lib/Sema/SemaDecl.cpp
  lib/Serialization/ASTReaderDecl.cpp
  lib/Serialization/ASTWriter.cpp
  test/CodeGenCXX/uncopyable-args.cpp

Index: test/CodeGenCXX/uncopyable-args.cpp
===
--- test/CodeGenCXX/uncopyable-args.cpp
+++ test/CodeGenCXX/uncopyable-args.cpp
@@ -52,12 +52,11 @@
 void bar() {
   foo({});
 }
-// FIXME: The copy ctor is implicitly deleted.
-// CHECK-DISABLED-LABEL: define void @_ZN9move_ctor3barEv()
-// CHECK-DISABLED: call void @_Z{{.*}}C1Ev(
-// CHECK-DISABLED-NOT: call
-// CHECK-DISABLED: call void @_ZN9move_ctor3fooENS_1AE(%"struct.move_ctor::A"* %{{.*}})
-// CHECK-DISABLED-LABEL: declare void @_ZN9move_ctor3fooENS_1AE(%"struct.move_ctor::A"*)
+// CHECK-LABEL: define void @_ZN9move_ctor3barEv()
+// CHECK: call void @_Z{{.*}}C1Ev(
+// CHECK-NOT: call
+// CHECK: call void @_ZN9move_ctor3fooENS_1AE(%"struct.move_ctor::A"* %{{.*}})
+// CHECK-LABEL: declare void @_ZN9move_ctor3fooENS_1AE(%"struct.move_ctor::A"*)
 
 // WIN64-LABEL: declare void @"\01?foo@move_ctor@@YAXUA@1@@Z"(%"struct.move_ctor::A"*)
 }
@@ -73,12 +72,11 @@
 void bar() {
   foo({});
 }
-// FIXME: The copy ctor is deleted.
-// CHECK-DISABLED-LABEL: define void @_ZN11all_deleted3barEv()
-// CHECK-DISABLED: call void @_Z{{.*}}C1Ev(
-// CHECK-DISABLED-NOT: call
-// CHECK-DISABLED: call void @_ZN11all_deleted3fooENS_1AE(%"struct.all_deleted::A"* %{{.*}})
-// CHECK-DISABLED-LABEL: declare void @_ZN11all_deleted3fooENS_1AE(%"struct.all_deleted::A"*)
+// CHECK-LABEL: define void @_ZN11all_deleted3barEv()
+// CHECK: call void @_Z{{.*}}C1Ev(
+// CHECK-NOT: call
+// CHECK: call void @_ZN11all_deleted3fooENS_1AE(%"struct.all_deleted::A"* %{{.*}})
+// CHECK-LABEL: declare void @_ZN11all_deleted3fooENS_1AE(%"struct.all_deleted::A"*)
 
 // WIN64-LABEL: declare void @"\01?foo@all_deleted@@YAXUA@1@@Z"(%"struct.all_deleted::A"*)
 }
@@ -93,12 +91,11 @@
 void bar() {
   foo({});
 }
-// FIXME: The copy and move ctors are implicitly deleted.
-// CHECK-DISABLED-LABEL: define void @_ZN18implicitly_deleted3barEv()
-// CHECK-DISABLED: call void @_Z{{.*}}C1Ev(
-// CHECK-DISABLED-NOT: call
-// CHECK-DISABLED: call void @_ZN18implicitly_deleted3fooENS_1AE(%"struct.implicitly_deleted::A"* %{{.*}})
-// CHECK-DISABLED-LABEL: declare void @_ZN18implicitly_deleted3fooENS_1AE(%"struct.implicitly_deleted::A"*)
+// CHECK-LABEL: define void @_ZN18implicitly_deleted3barEv()
+// CHECK: call void @_Z{{.*}}C1Ev(
+// CHECK-NOT: call
+// CHECK: call void @_ZN18implicitly_deleted3fooENS_1AE(%"struct.implicitly_deleted::A"* %{{.*}})
+// CHECK-LABEL: declare void @_ZN18implicitly_deleted3fooENS_1AE(%"struct.implicitly_deleted::A"*)
 
 // WIN64-LABEL: declare void @"\01?foo@implicitly_deleted@@YAXUA@1@@Z"(%"struct.implicitly_deleted::A"*)
 }
@@ -113,12 +110,11 @@
 void bar() {
   foo({});
 }
-// FIXME: The copy constructor is implicitly deleted.
-// CHECK-DISABLED-LABEL: define void @_ZN11one_deleted3barEv()
-// CHECK-DISABLED: call void @_Z{{.*}}C1Ev(
-// CHECK-DISABLED-NOT: call
-// CHECK-DISABLED: call void @_ZN11one_deleted3fooENS_1AE(%"struct.one_deleted::A"* %{{.*}})
-// CHECK-DISABLED-LABEL: declare void @_ZN11one_deleted3fooENS_1AE(%"struct.one_deleted::A"*)
+// CHECK-LABEL: define void @_ZN11one_deleted3barEv()
+// CHECK: call void @_Z{{.*}}C1Ev(
+// CHECK-NOT: call
+// CHECK: call void @_ZN11one_deleted3fooENS_1AE(%"struct.one_deleted::A"* %{{.*}})
+// CHECK-LABEL: declare void @_ZN11one_deleted3fooENS_1AE(%"struct.one_deleted::A"*)
 
 // WIN64-LABEL: declare void @"\01?foo@one_deleted@@YAXUA@1@@Z"(%"struct.one_deleted::A"*)
 }
@@ -195,12 +191,10 @@
 void bar() {
   foo({});
 }
-// FIXME: This class has a non-trivial copy ctor and a trivial copy ctor.  It's
-// not clear whether we should pass by address or in registers.
-// CHECK-DISABLED-LABEL: define void @_ZN14two_copy_ctors3barEv()
-// CHECK-DISABLED: call void @_Z{{.*}}C1Ev(
-// CHECK-DISABLED: call void @_ZN14two_copy_ctors3fooENS_1BE(%"struct.two_copy_ctors::B"* %{{.*}})
-// CHECK-DISABLED-LABEL: declare void @_ZN14two_copy_ctors3fooENS_1BE(%"struct.two_copy_ctors::B"*)
+// CHECK-LABEL: define void @_ZN14two_copy_ctors3barEv()
+// CHECK: call void @_Z{{.*}}C1Ev(
+// CHECK: call void @_ZN14two_copy_ctors3fooENS_1BE(%"struct.two_copy_ctors::B"* %{{.*}})
+// CHECK-LABEL: declare void @_ZN14two_copy_ctors3fooENS_1BE(%"struct.two_copy_ctors::B"*)
 
 // WIN64-LABEL: declare void @"\01?foo@two_copy_ctors@@YAXUB@1@@Z"(%"struct.two_copy_ctors::B"*)
 }
Index: lib/Serialization/ASTWriter.cpp
===
--- lib/Serialization/ASTWriter.cpp
+++ lib/Serialization/ASTWriter.cpp
@@ -5885,6 +5885,7 @@
   

[PATCH] D34030: Fix the postorder visting of the ClassTemplateSpecializationDecl nodes in the RecursiveASTVisitor.

2017-07-27 Thread Peter Siket via Phabricator via cfe-commits
MontyKutyi added a comment.

Is there any particular parameter for the clang-format what I should use? If I 
just run it without any parameter it changes lines of the original test too.


https://reviews.llvm.org/D34030



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


[PATCH] D35930: [CMake] Include sancov tool in Fuchsia toolchain

2017-07-27 Thread Roland McGrath via Phabricator via cfe-commits
mcgrathr accepted this revision.
mcgrathr added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rL LLVM

https://reviews.llvm.org/D35930



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


[PATCH] D35934: [Headers] Add a test for arm64intr.h

2017-07-27 Thread Mandeep Singh Grang via Phabricator via cfe-commits
mgrang accepted this revision.
mgrang added a comment.
This revision is now accepted and ready to land.

LGTM.


https://reviews.llvm.org/D35934



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


Re: r309189 - Clang and LLVM search for different versions of libxml2, reset found

2017-07-27 Thread Reid Kleckner via cfe-commits
Looks like this was resolved. I noticed that we have a window of commits
with extra git-svn-rev notes:

commit 820faedb92322a3a550bd994b652f2e3d0c77b13
Author: Eric Beckmann 
Date:   Wed Jul 26 21:47:17 2017 +

Clang and LLVM search for different versions of libxml2, reset found
variable before each search so that they don't conflict.

Notes:
git-svn-rev: 309189

git-svn-rev: 309189

We can probably just ignore it.

On Wed, Jul 26, 2017 at 4:25 PM, NAKAMURA Takumi 
wrote:

> Seems clang.git stuck to r309145. LLVM.ORG's git-svn doesn't fetch
> r309155.
>
> At the moment, I made llvm-project.git suspended. It will be rebased later.
>
>
> On Thu, Jul 27, 2017 at 8:13 AM Reid Kleckner  wrote:
>
>> This commit hasn't been imported to https://github.com/llvm-
>> project/llvm-project-20170507. Do we need to do anything to make sure it
>> gets picked up eventually? I wonder if there are more "missing commits"
>> like this. Have we seen divergence between SVN and the prototype git
>> monorepo in the past?
>>
>> On Wed, Jul 26, 2017 at 2:47 PM, Eric Beckmann via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: ecbeckmann
>>> Date: Wed Jul 26 14:47:17 2017
>>> New Revision: 309189
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=309189=rev
>>> Log:
>>> Clang and LLVM search for different versions of libxml2, reset found
>>> variable before each search so that they don't conflict.
>>>
>>> Modified:
>>> cfe/trunk/CMakeLists.txt
>>>
>>> Modified: cfe/trunk/CMakeLists.txt
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.
>>> txt?rev=309189=309188=309189=diff
>>> 
>>> ==
>>> --- cfe/trunk/CMakeLists.txt (original)
>>> +++ cfe/trunk/CMakeLists.txt Wed Jul 26 14:47:17 2017
>>> @@ -181,6 +181,7 @@ endif()
>>>  # we can include cmake files from this directory.
>>>  list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/
>>> cmake/modules")
>>>
>>> +set (LIBXML2_FOUND 0)
>>>  find_package(LibXml2 2.5.3 QUIET)
>>>  if (LIBXML2_FOUND)
>>>set(CLANG_HAVE_LIBXML 1)
>>>
>>>
>>> ___
>>> cfe-commits mailing list
>>> cfe-commits@lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>>
>>
>>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D35941: Fix -Wshadow false positives with function-local classes.

2017-07-27 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

I'm not really sure this is a bug. The point of -Wshadow is to warn on valid 
but possibly confusing code. Shadowing a variable is perfectly legal, but 
people think it's confusing, so we implemented this warning. Are we concerned 
that people might get confused between the different local variables here?


https://reviews.llvm.org/D35941



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


[PATCH] D35577: Add -flookup-tables and -fno-lookup-tables flags

2017-07-27 Thread Sumanth Gundapaneni via Phabricator via cfe-commits
sgundapa added a comment.

Thanks. I will make change to this affect


https://reviews.llvm.org/D35577



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


[PATCH] D35950: [clangd] Don't reverse priorities of completion items.

2017-07-27 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL309295: [clangd] Don't reverse priorities of completion 
items. (authored by ibiryukov).

Repository:
  rL LLVM

https://reviews.llvm.org/D35950

Files:
  clang-tools-extra/trunk/clangd/ClangdUnit.cpp
  clang-tools-extra/trunk/test/clangd/authority-less-uri.test
  clang-tools-extra/trunk/test/clangd/completion.test

Index: clang-tools-extra/trunk/test/clangd/completion.test
===
--- clang-tools-extra/trunk/test/clangd/completion.test
+++ clang-tools-extra/trunk/test/clangd/completion.test
@@ -12,29 +12,29 @@
 Content-Length: 148
 
 {"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":3,"character":5}}}
-# The order of results returned by ASTUnit CodeComplete seems to be
+# The order of results returned by codeComplete seems to be
 # nondeterministic, so we check regardless of order.
 #
 # CHECK: {"jsonrpc":"2.0","id":1,"result":[
-# CHECK-DAG: {"label":"a","kind":5,"detail":"int","sortText":"99964a","filterText":"a","insertText":"a"}
-# CHECK-DAG: {"label":"bb","kind":5,"detail":"int","sortText":"99964bb","filterText":"bb","insertText":"bb"}
-# CHECK-DAG: {"label":"ccc","kind":5,"detail":"int","sortText":"99964ccc","filterText":"ccc","insertText":"ccc"}
-# CHECK-DAG: {"label":"operator=(const fake &)","kind":2,"detail":"fake &","sortText":"99965operator=","filterText":"operator=","insertText":"operator="}
-# CHECK-DAG: {"label":"~fake()","kind":4,"detail":"void","sortText":"99965~fake","filterText":"~fake","insertText":"~fake"}
-# CHECK-DAG: {"label":"f(int i, const float f) const","kind":2,"detail":"int","sortText":"99964f","filterText":"f","insertText":"f"}
+# CHECK-DAG: {"label":"a","kind":5,"detail":"int","sortText":"00035a","filterText":"a","insertText":"a"}
+# CHECK-DAG: {"label":"bb","kind":5,"detail":"int","sortText":"00035bb","filterText":"bb","insertText":"bb"}
+# CHECK-DAG: {"label":"ccc","kind":5,"detail":"int","sortText":"00035ccc","filterText":"ccc","insertText":"ccc"}
+# CHECK-DAG: {"label":"operator=(const fake &)","kind":2,"detail":"fake &","sortText":"00034operator=","filterText":"operator=","insertText":"operator="}
+# CHECK-DAG: {"label":"~fake()","kind":4,"detail":"void","sortText":"00034~fake","filterText":"~fake","insertText":"~fake"}
+# CHECK-DAG: {"label":"f(int i, const float f) const","kind":2,"detail":"int","sortText":"00035f","filterText":"f","insertText":"f"}
 # CHECK: ]}
 Content-Length: 148
 
 {"jsonrpc":"2.0","id":2,"method":"textDocument/completion","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":3,"character":5}}}
 # Repeat the completion request, expect the same results.
 #
 # CHECK: {"jsonrpc":"2.0","id":2,"result":[
-# CHECK-DAG: {"label":"a","kind":5,"detail":"int","sortText":"99964a","filterText":"a","insertText":"a"}
-# CHECK-DAG: {"label":"bb","kind":5,"detail":"int","sortText":"99964bb","filterText":"bb","insertText":"bb"}
-# CHECK-DAG: {"label":"ccc","kind":5,"detail":"int","sortText":"99964ccc","filterText":"ccc","insertText":"ccc"}
-# CHECK-DAG: {"label":"operator=(const fake &)","kind":2,"detail":"fake &","sortText":"99965operator=","filterText":"operator=","insertText":"operator="}
-# CHECK-DAG: {"label":"~fake()","kind":4,"detail":"void","sortText":"99965~fake","filterText":"~fake","insertText":"~fake"}
-# CHECK-DAG: {"label":"f(int i, const float f) const","kind":2,"detail":"int","sortText":"99964f","filterText":"f","insertText":"f"}
+# CHECK-DAG: {"label":"a","kind":5,"detail":"int","sortText":"00035a","filterText":"a","insertText":"a"}
+# CHECK-DAG: {"label":"bb","kind":5,"detail":"int","sortText":"00035bb","filterText":"bb","insertText":"bb"}
+# CHECK-DAG: {"label":"ccc","kind":5,"detail":"int","sortText":"00035ccc","filterText":"ccc","insertText":"ccc"}
+# CHECK-DAG: {"label":"operator=(const fake &)","kind":2,"detail":"fake &","sortText":"00034operator=","filterText":"operator=","insertText":"operator="}
+# CHECK-DAG: {"label":"~fake()","kind":4,"detail":"void","sortText":"00034~fake","filterText":"~fake","insertText":"~fake"}
+# CHECK-DAG: {"label":"f(int i, const float f) const","kind":2,"detail":"int","sortText":"00035f","filterText":"f","insertText":"f"}
 # CHECK: ]}
 # Update the source file and check for completions again.
 Content-Length: 226
@@ -47,7 +47,7 @@
 # Repeat the completion request, expect the same results.
 #
 # CHECK: {"jsonrpc":"2.0","id":3,"result":[
-# CHECK-DAG: {"label":"func()","kind":2,"detail":"int (*)(int, int)","sortText":"99965func","filterText":"func","insertText":"func"}
+# CHECK-DAG: {"label":"func()","kind":2,"detail":"int (*)(int, int)","sortText":"00034func","filterText":"func","insertText":"func"}
 # CHECK: ]}
 Content-Length: 44
 
Index: clang-tools-extra/trunk/test/clangd/authority-less-uri.test

[libcxx] r309296 - Implement P0739R0: 'Some improvements to class template argument deduction integration into the standard library' This is an API change (not ABI change) due to a late change in the

2017-07-27 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Jul 27 10:44:03 2017
New Revision: 309296

URL: http://llvm.org/viewvc/llvm-project?rev=309296=rev
Log:
Implement P0739R0: 'Some improvements to class template argument deduction 
integration into the standard library' This is an API change (not ABI change) 
due to a late change in the c++17 standard

Modified:
libcxx/trunk/include/mutex

libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp

libcxx/trunk/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
libcxx/trunk/www/cxx1z_status.html
libcxx/trunk/www/cxx2a_status.html

Modified: libcxx/trunk/include/mutex
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/mutex?rev=309296=309295=309296=diff
==
--- libcxx/trunk/include/mutex (original)
+++ libcxx/trunk/include/mutex Thu Jul 27 10:44:03 2017
@@ -116,7 +116,7 @@ public:
 using mutex_type = Mutex;  // If MutexTypes... consists of the single type 
Mutex
 
 explicit scoped_lock(MutexTypes&... m);
-scoped_lock(MutexTypes&... m, adopt_lock_t);
+scoped_lock(adopt_lock_t, MutexTypes&... m);
 ~scoped_lock();
 scoped_lock(scoped_lock const&) = delete;
 scoped_lock& operator=(scoped_lock const&) = delete;
@@ -500,7 +500,7 @@ public:
 ~scoped_lock() _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability()) 
{__m_.unlock();}
 
 _LIBCPP_INLINE_VISIBILITY
-explicit scoped_lock(mutex_type& __m, adopt_lock_t) 
_LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m))
+explicit scoped_lock(adopt_lock_t, mutex_type& __m) 
_LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m))
 : __m_(__m) {}
 
 scoped_lock(scoped_lock const&) = delete;
@@ -522,7 +522,7 @@ public:
 }
 
 _LIBCPP_INLINE_VISIBILITY
-scoped_lock(_MArgs&... __margs, adopt_lock_t)
+scoped_lock(adopt_lock_t, _MArgs&... __margs)
 : __t_(__margs...)
 {
 }

Modified: 
libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp?rev=309296=309295=309296=diff
==
--- 
libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp
 Thu Jul 27 10:44:03 2017
@@ -14,7 +14,7 @@
 
 // template  class scoped_lock;
 
-// scoped_lock(Mutex&..., adopt_lock_t);
+// scoped_lock(adopt_lock_t, Mutex&...);
 
 #include 
 #include 
@@ -43,7 +43,7 @@ int main()
 using LG = std::scoped_lock;
 m1.lock();
 {
-LG lg(m1, std::adopt_lock);
+LG lg(std::adopt_lock, m1);
 assert(m1.locked);
 }
 assert(!m1.locked);
@@ -53,7 +53,7 @@ int main()
 using LG = std::scoped_lock;
 m1.lock(); m2.lock();
 {
-LG lg(m1, m2, std::adopt_lock);
+LG lg(std::adopt_lock, m1, m2);
 assert(m1.locked && m2.locked);
 }
 assert(!m1.locked && !m2.locked);
@@ -63,7 +63,7 @@ int main()
 using LG = std::scoped_lock;
 m1.lock(); m2.lock(); m3.lock();
 {
-LG lg(m1, m2, m3, std::adopt_lock);
+LG lg(std::adopt_lock, m1, m2, m3);
 assert(m1.locked && m2.locked && m3.locked);
 }
 assert(!m1.locked && !m2.locked && !m3.locked);

Modified: 
libcxx/trunk/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp?rev=309296=309295=309296=diff
==
--- 
libcxx/trunk/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
 Thu Jul 27 10:44:03 2017
@@ -261,4 +261,9 @@ int main() {
   test_copy_ctor_valueless_by_exception();
   test_copy_ctor_sfinae();
   test_constexpr_copy_ctor_extension();
+{ // This is the motivating example from P0739R0
+  std::variant v1(3);
+  std::variant v2 = v1;
+  (void) v2;
+}
 }

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=309296=309295=309296=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Thu Jul 27 10:44:03 2017
@@ -39,6 +39,8 @@
   In February 2017, the C++ standard committee approved this draft, and 
sent it to ISO for approval as 

[clang-tools-extra] r309295 - [clangd] Don't reverse priorities of completion items.

2017-07-27 Thread Ilya Biryukov via cfe-commits
Author: ibiryukov
Date: Thu Jul 27 10:43:07 2017
New Revision: 309295

URL: http://llvm.org/viewvc/llvm-project?rev=309295=rev
Log:
[clangd] Don't reverse priorities of completion items.

Summary: Current algorithm incorrectly provides completion results in a reverse 
order.

Reviewers: krasimir, bkramer

Reviewed By: krasimir

Subscribers: cfe-commits, klimek

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

Modified:
clang-tools-extra/trunk/clangd/ClangdUnit.cpp
clang-tools-extra/trunk/test/clangd/authority-less-uri.test
clang-tools-extra/trunk/test/clangd/completion.test

Modified: clang-tools-extra/trunk/clangd/ClangdUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdUnit.cpp?rev=309295=309294=309295=diff
==
--- clang-tools-extra/trunk/clangd/ClangdUnit.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangdUnit.cpp Thu Jul 27 10:43:07 2017
@@ -370,15 +370,11 @@ public:
 assert(CCS->getTypedText());
 Item.kind = getKind(Result.CursorKind);
 // Priority is a 16-bit integer, hence at most 5 digits.
-// Since identifiers with higher priority need to come first,
-// we subtract the priority from 9.
-// For example, the sort text of the identifier 'a' with priority 35
-// is 99964a.
 assert(CCS->getPriority() < 9 && "Expecting code completion result 
"
  "priority to have at most "
  "5-digits");
-llvm::raw_string_ostream(Item.sortText) << llvm::format(
-"%05d%s", 9 - CCS->getPriority(), CCS->getTypedText());
+llvm::raw_string_ostream(Item.sortText)
+<< llvm::format("%05d%s", CCS->getPriority(), CCS->getTypedText());
 Item.insertText = Item.filterText = CCS->getTypedText();
 if (CCS->getBriefComment())
   Item.documentation = CCS->getBriefComment();

Modified: clang-tools-extra/trunk/test/clangd/authority-less-uri.test
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clangd/authority-less-uri.test?rev=309295=309294=309295=diff
==
--- clang-tools-extra/trunk/test/clangd/authority-less-uri.test (original)
+++ clang-tools-extra/trunk/test/clangd/authority-less-uri.test Thu Jul 27 
10:43:07 2017
@@ -16,7 +16,7 @@ Content-Length: 146
 # Test authority-less URI
 #
 # CHECK: {"jsonrpc":"2.0","id":1,"result":[
-# CHECK-DAG: 
{"label":"a","kind":5,"detail":"int","sortText":"99964a","filterText":"a","insertText":"a"}
+# CHECK-DAG: 
{"label":"a","kind":5,"detail":"int","sortText":"00035a","filterText":"a","insertText":"a"}
 # CHECK: ]}
 
 Content-Length: 172
@@ -25,7 +25,7 @@ Content-Length: 172
 # Test params parsing in the presence of a 1.x-compatible client (inlined 
"uri")
 #
 # CHECK: {"jsonrpc":"2.0","id":2,"result":[
-# CHECK-DAG: 
{"label":"a","kind":5,"detail":"int","sortText":"99964a","filterText":"a","insertText":"a"}
+# CHECK-DAG: 
{"label":"a","kind":5,"detail":"int","sortText":"00035a","filterText":"a","insertText":"a"}
 # CHECK: ]}
 Content-Length: 44
 

Modified: clang-tools-extra/trunk/test/clangd/completion.test
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clangd/completion.test?rev=309295=309294=309295=diff
==
--- clang-tools-extra/trunk/test/clangd/completion.test (original)
+++ clang-tools-extra/trunk/test/clangd/completion.test Thu Jul 27 10:43:07 2017
@@ -12,16 +12,16 @@ Content-Length: 246
 Content-Length: 148
 
 
{"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":3,"character":5}}}
-# The order of results returned by ASTUnit CodeComplete seems to be
+# The order of results returned by codeComplete seems to be
 # nondeterministic, so we check regardless of order.
 #
 # CHECK: {"jsonrpc":"2.0","id":1,"result":[
-# CHECK-DAG: 
{"label":"a","kind":5,"detail":"int","sortText":"99964a","filterText":"a","insertText":"a"}
-# CHECK-DAG: 
{"label":"bb","kind":5,"detail":"int","sortText":"99964bb","filterText":"bb","insertText":"bb"}
-# CHECK-DAG: 
{"label":"ccc","kind":5,"detail":"int","sortText":"99964ccc","filterText":"ccc","insertText":"ccc"}
-# CHECK-DAG: {"label":"operator=(const fake &)","kind":2,"detail":"fake 
&","sortText":"99965operator=","filterText":"operator=","insertText":"operator="}
-# CHECK-DAG: 
{"label":"~fake()","kind":4,"detail":"void","sortText":"99965~fake","filterText":"~fake","insertText":"~fake"}
-# CHECK-DAG: {"label":"f(int i, const float f) 
const","kind":2,"detail":"int","sortText":"99964f","filterText":"f","insertText":"f"}
+# CHECK-DAG: 
{"label":"a","kind":5,"detail":"int","sortText":"00035a","filterText":"a","insertText":"a"}
+# CHECK-DAG: 

[PATCH] D34158: For standards compatibility, preinclude if the file is available

2017-07-27 Thread Melanie Blower via Phabricator via cfe-commits
mibintc planned changes to this revision.
mibintc added a comment.

I'm going to rebase the patch to latest.


Repository:
  rL LLVM

https://reviews.llvm.org/D34158



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


[PATCH] D34030: Fix the postorder visting of the ClassTemplateSpecializationDecl nodes in the RecursiveASTVisitor.

2017-07-27 Thread Bruno Cardoso Lopes via Phabricator via cfe-commits
bruno added a comment.

In https://reviews.llvm.org/D34030#821282, @MontyKutyi wrote:

> Added test for the fix.


Great! The test code you added doesn't seem to be compatible with clang style, 
can you run clang format and update the test?


https://reviews.llvm.org/D34030



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


Re: r309226 - Headers: improve ARM EHABI coverage of unwind.h

2017-07-27 Thread Hans Wennborg via cfe-commits
Merged to 5.0 in r309290.

On Wed, Jul 26, 2017 at 3:55 PM, Saleem Abdulrasool via cfe-commits
 wrote:
> Author: compnerd
> Date: Wed Jul 26 15:55:23 2017
> New Revision: 309226
>
> URL: http://llvm.org/viewvc/llvm-project?rev=309226=rev
> Log:
> Headers: improve ARM EHABI coverage of unwind.h
>
> Ensure that we define the `_Unwind_Control_Block` structure used on ARM
> EHABI targets.  This is needed for building libc++abi with the unwind.h
> from the resource dir.  A minor fallout of this is that we needed to
> create a typedef for _Unwind_Exception to work across ARM EHABI and
> non-EHABI targets.  The structure definitions here are based originally
> on the documentation from ARM under the "Exception Handling ABI for the
> ARM® Architecture" Section 7.2.  They are then adjusted to more closely
> reflect the definition in libunwind from LLVM.  Those changes are
> compatible in layout but permit easier use in libc++abi and help
> maintain compatibility between libunwind and the compiler provided
> definition.
>
> Modified:
> cfe/trunk/lib/Headers/unwind.h
>
> Modified: cfe/trunk/lib/Headers/unwind.h
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/unwind.h?rev=309226=309225=309226=diff
> ==
> --- cfe/trunk/lib/Headers/unwind.h (original)
> +++ cfe/trunk/lib/Headers/unwind.h Wed Jul 26 15:55:23 2017
> @@ -76,7 +76,13 @@ typedef intptr_t _sleb128_t;
>  typedef uintptr_t _uleb128_t;
>
>  struct _Unwind_Context;
> +#if defined(__arm__) && !(defined(__USING_SJLJ_EXCEPTIONS__) || 
> defined(__ARM_DWARF_EH___))
> +struct _Unwind_Control_Block;
> +typedef struct _Unwind_Control_Block _Unwind_Exception; /* Alias */
> +#else
>  struct _Unwind_Exception;
> +typedef struct _Unwind_Exception _Unwind_Exception;
> +#endif
>  typedef enum {
>_URC_NO_REASON = 0,
>  #if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \
> @@ -109,8 +115,42 @@ typedef enum {
>  } _Unwind_Action;
>
>  typedef void (*_Unwind_Exception_Cleanup_Fn)(_Unwind_Reason_Code,
> - struct _Unwind_Exception *);
> + _Unwind_Exception *);
>
> +#if defined(__arm__) && !(defined(__USING_SJLJ_EXCEPTIONS__) || 
> defined(__ARM_DWARF_EH___))
> +typedef struct _Unwind_Control_Block _Unwind_Control_Block;
> +typedef uint32_t _Unwind_EHT_Header;
> +
> +struct _Unwind_Control_Block {
> +  uint64_t exception_class;
> +  void (*exception_cleanup)(_Unwind_Reason_Code, _Unwind_Control_Block *);
> +  /* unwinder cache (private fields for the unwinder's use) */
> +  struct {
> +uint32_t reserved1; /* forced unwind stop function, 0 if not forced */
> +uint32_t reserved2; /* personality routine */
> +uint32_t reserved3; /* callsite */
> +uint32_t reserved4; /* forced unwind stop argument */
> +uint32_t reserved5;
> +  } unwinder_cache;
> +  /* propagation barrier cache (valid after phase 1) */
> +  struct {
> +uint32_t sp;
> +uint32_t bitpattern[5];
> +  } barrier_cache;
> +  /* cleanup cache (preserved over cleanup) */
> +  struct {
> +uint32_t bitpattern[4];
> +  } cleanup_cache;
> +  /* personality cache (for personality's benefit) */
> +  struct {
> +uint32_t fnstart; /* function start address */
> +_Unwind_EHT_Header *ehtp; /* pointer to EHT entry header word */
> +uint32_t additional;  /* additional data */
> +uint32_t reserved1;
> +  } pr_cache;
> +  long long int : 0; /* force alignment of next item to 8-byte boundary */
> +};
> +#else
>  struct _Unwind_Exception {
>_Unwind_Exception_Class exception_class;
>_Unwind_Exception_Cleanup_Fn exception_cleanup;
> @@ -120,16 +160,18 @@ struct _Unwind_Exception {
> * aligned".  GCC has interpreted this to mean "use the maximum useful
> * alignment for the target"; so do we. */
>  } __attribute__((__aligned__));
> +#endif
>
>  typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)(int, _Unwind_Action,
> _Unwind_Exception_Class,
> -   struct _Unwind_Exception *,
> +   _Unwind_Exception *,
> struct _Unwind_Context *,
> void *);
>
> -typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn)(
> -int, _Unwind_Action, _Unwind_Exception_Class, struct _Unwind_Exception *,
> -struct _Unwind_Context *);
> +typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn)(int, _Unwind_Action,
> +  
> _Unwind_Exception_Class,
> +  _Unwind_Exception *,
> +  struct _Unwind_Context 
> *);
>  typedef _Unwind_Personality_Fn __personality_routine;
>
>  typedef 

[PATCH] D35577: Add -flookup-tables and -fno-lookup-tables flags

2017-07-27 Thread Hans Wennborg via Phabricator via cfe-commits
hans added a comment.

In https://reviews.llvm.org/D35577#818956, @mcrosier wrote:

> In https://reviews.llvm.org/D35577#818936, @kparzysz wrote:
>
> > In https://reviews.llvm.org/D35577#817944, @echristo wrote:
> >
> > > "Should this just be part of the tuning for the hexagon backend and not 
> > > options at all"
> >
> >
> >
> >
> >   I don't think we need separate options to control jump tables and lookup 
> > tables: one option to enable/disable the use of memory tables would be 
> > sufficient.
>
>
> I don't have an objection to this direction (i.e., disable the lookup-table 
> optimization when -fno-jump-tables is specified), so long as other are in 
> agreement.


I'm ok with disabling lookup tables under `-fno-jump-tables` as well.


https://reviews.llvm.org/D35577



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


r309289 - Update to use enum classes for various ARM *Kind enums

2017-07-27 Thread Florian Hahn via cfe-commits
Author: fhahn
Date: Thu Jul 27 09:28:39 2017
New Revision: 309289

URL: http://llvm.org/viewvc/llvm-project?rev=309289=rev
Log:
Update to use enum classes for various ARM *Kind enums

Summary: This updates the relevant Clang parts for the LLVM change D35882.

Reviewers: rengolin, chandlerc, javed.absar, rovka

Reviewed By: rovka

Subscribers: aemerson, cfe-commits, kristof.beyls

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

Modified:
cfe/trunk/lib/Basic/Targets/AArch64.cpp
cfe/trunk/lib/Basic/Targets/ARM.cpp
cfe/trunk/lib/Basic/Targets/ARM.h
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains/Arch/AArch64.cpp
cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp
cfe/trunk/lib/Driver/ToolChains/Darwin.cpp
cfe/trunk/lib/Driver/ToolChains/Gnu.cpp

Modified: cfe/trunk/lib/Basic/Targets/AArch64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/AArch64.cpp?rev=309289=309288=309289=diff
==
--- cfe/trunk/lib/Basic/Targets/AArch64.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/AArch64.cpp Thu Jul 27 09:28:39 2017
@@ -90,8 +90,7 @@ bool AArch64TargetInfo::setABI(const std
 
 bool AArch64TargetInfo::isValidCPUName(StringRef Name) const {
   return Name == "generic" ||
- llvm::AArch64::parseCPUArch(Name) !=
- static_cast(llvm::AArch64::ArchKind::AK_INVALID);
+ llvm::AArch64::parseCPUArch(Name) != llvm::AArch64::ArchKind::INVALID;
 }
 
 bool AArch64TargetInfo::setCPU(const std::string ) {
@@ -178,10 +177,10 @@ void AArch64TargetInfo::getTargetDefines
   switch (ArchKind) {
   default:
 break;
-  case llvm::AArch64::ArchKind::AK_ARMV8_1A:
+  case llvm::AArch64::ArchKind::ARMV8_1A:
 getTargetDefinesARMV81A(Opts, Builder);
 break;
-  case llvm::AArch64::ArchKind::AK_ARMV8_2A:
+  case llvm::AArch64::ArchKind::ARMV8_2A:
 getTargetDefinesARMV82A(Opts, Builder);
 break;
   }
@@ -211,7 +210,7 @@ bool AArch64TargetInfo::handleTargetFeat
   Crypto = 0;
   Unaligned = 1;
   HasFullFP16 = 0;
-  ArchKind = llvm::AArch64::ArchKind::AK_ARMV8A;
+  ArchKind = llvm::AArch64::ArchKind::ARMV8A;
 
   for (const auto  : Features) {
 if (Feature == "+neon")
@@ -225,9 +224,9 @@ bool AArch64TargetInfo::handleTargetFeat
 if (Feature == "+strict-align")
   Unaligned = 0;
 if (Feature == "+v8.1a")
-  ArchKind = llvm::AArch64::ArchKind::AK_ARMV8_1A;
+  ArchKind = llvm::AArch64::ArchKind::ARMV8_1A;
 if (Feature == "+v8.2a")
-  ArchKind = llvm::AArch64::ArchKind::AK_ARMV8_2A;
+  ArchKind = llvm::AArch64::ArchKind::ARMV8_2A;
 if (Feature == "+fullfp16")
   HasFullFP16 = 1;
   }

Modified: cfe/trunk/lib/Basic/Targets/ARM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/ARM.cpp?rev=309289=309288=309289=diff
==
--- cfe/trunk/lib/Basic/Targets/ARM.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/ARM.cpp Thu Jul 27 09:28:39 2017
@@ -133,13 +133,13 @@ void ARMTargetInfo::setArchInfo() {
 
   ArchISA = llvm::ARM::parseArchISA(ArchName);
   CPU = llvm::ARM::getDefaultCPU(ArchName);
-  unsigned AK = llvm::ARM::parseArch(ArchName);
-  if (AK != llvm::ARM::AK_INVALID)
+  llvm::ARM::ArchKind AK = llvm::ARM::parseArch(ArchName);
+  if (AK != llvm::ARM::ArchKind::INVALID)
 ArchKind = AK;
   setArchInfo(ArchKind);
 }
 
-void ARMTargetInfo::setArchInfo(unsigned Kind) {
+void ARMTargetInfo::setArchInfo(llvm::ARM::ArchKind Kind) {
   StringRef SubArch;
 
   // cache TargetParser info
@@ -157,10 +157,10 @@ void ARMTargetInfo::setAtomic() {
   // when triple does not specify a sub arch,
   // then we are not using inline atomics
   bool ShouldUseInlineAtomic =
-  (ArchISA == llvm::ARM::IK_ARM && ArchVersion >= 6) ||
-  (ArchISA == llvm::ARM::IK_THUMB && ArchVersion >= 7);
+  (ArchISA == llvm::ARM::ISAKind::ARM && ArchVersion >= 6) ||
+  (ArchISA == llvm::ARM::ISAKind::THUMB && ArchVersion >= 7);
   // Cortex M does not support 8 byte atomics, while general Thumb2 does.
-  if (ArchProfile == llvm::ARM::PK_M) {
+  if (ArchProfile == llvm::ARM::ProfileKind::M) {
 MaxAtomicPromoteWidth = 32;
 if (ShouldUseInlineAtomic)
   MaxAtomicInlineWidth = 32;
@@ -171,7 +171,9 @@ void ARMTargetInfo::setAtomic() {
   }
 }
 
-bool ARMTargetInfo::isThumb() const { return (ArchISA == llvm::ARM::IK_THUMB); 
}
+bool ARMTargetInfo::isThumb() const {
+  return ArchISA == llvm::ARM::ISAKind::THUMB;
+}
 
 bool ARMTargetInfo::supportsThumb() const {
   return CPUAttr.count('T') || ArchVersion >= 6;
@@ -188,42 +190,42 @@ StringRef ARMTargetInfo::getCPUAttr() co
   switch (ArchKind) {
   default:
 return llvm::ARM::getCPUAttr(ArchKind);
-  case llvm::ARM::AK_ARMV6M:
+  case llvm::ARM::ArchKind::ARMV6M:
 return "6M";
-  case llvm::ARM::AK_ARMV7S:
+  case llvm::ARM::ArchKind::ARMV7S:
 return "7S";
-  case 

[PATCH] D35854: Fix double destruction of objects when OpenMP construct is canceled

2017-07-27 Thread Erich Keane via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL309288: Fix double destruction of objects when OpenMP 
construct is canceled (authored by erichkeane).

Changed prior to commit:
  https://reviews.llvm.org/D35854?vs=108153=108489#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D35854

Files:
  cfe/trunk/lib/CodeGen/CodeGenFunction.h
  cfe/trunk/test/OpenMP/cancel_codegen_cleanup.cpp


Index: cfe/trunk/test/OpenMP/cancel_codegen_cleanup.cpp
===
--- cfe/trunk/test/OpenMP/cancel_codegen_cleanup.cpp
+++ cfe/trunk/test/OpenMP/cancel_codegen_cleanup.cpp
@@ -0,0 +1,46 @@
+// RUN: %clang_cc1 -std=c++11 -fopenmp -fopenmp-version=45 -triple 
x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s
+
+//CHECK: call i32 @__kmpc_cancel
+//CHECK: br {{.*}}label %[[EXIT:[^,].+]], label %[[CONTINUE:.+]]
+//CHECK: [[EXIT]]:
+//CHECK: store i32 [[EXIT_SLOT:[0-9]+]]
+//CHECK: br label %[[CLEANUP:.+]]
+//CHECK: [[CONTINUE]]:
+//CHECK: store i32 [[CONT_SLOT:[0-9]+]],
+//CHECK: br label %[[CLEANUP]]
+//CHECK: [[CLEANUP]]:
+//CHECK-NEXT: call void @_ZN3ObjD1Ev
+//CHECK: switch i32{{.*}}, label %[[UNREACHABLE:.+]] [
+//CHECK:   i32 [[CONT_SLOT]], label %[[CLEANUPCONT:.+]]
+//CHECK:   i32 [[EXIT_SLOT]], label %[[CANCELEXIT:.+]]
+//CHECK-NEXT: ]
+//CHECK: [[CLEANUPCONT]]:
+//CHECK: br label %[[CANCELCONT:.+]]
+//CHECK: [[CANCELCONT]]:
+//CHECK-NEXT: call void @__kmpc_barrier(
+//CHECK-NEXT: ret void
+//CHECK: [[UNREACHABLE]]:
+//CHECK-NEXT: unreachable
+//CHECK-NEXT: }
+
+struct Obj {
+  int a; Obj(); Obj(const Obj& r) = delete; Obj =(const Obj& r);
+  ~Obj();
+};
+ 
+void foo() {
+  int i,count = 0;
+  Obj obj;
+
+  #pragma omp parallel private(i) num_threads(1)
+  {
+  #pragma omp for reduction(+:count) lastprivate(obj)
+  for (i=0; i<1000; i++) {
+if(i==100) {
+obj.a = 100;
+#pragma omp cancel for
+}
+count++;
+}
+}
+}
Index: cfe/trunk/lib/CodeGen/CodeGenFunction.h
===
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h
@@ -1116,7 +1116,7 @@
 auto IP = CGF.Builder.saveAndClearIP();
 CGF.EmitBlock(Stack.back().ExitBlock.getBlock());
 CodeGen(CGF);
-CGF.EmitBranchThroughCleanup(Stack.back().ContBlock);
+CGF.EmitBranch(Stack.back().ContBlock.getBlock());
 CGF.Builder.restoreIP(IP);
 Stack.back().HasBeenEmitted = true;
   }


Index: cfe/trunk/test/OpenMP/cancel_codegen_cleanup.cpp
===
--- cfe/trunk/test/OpenMP/cancel_codegen_cleanup.cpp
+++ cfe/trunk/test/OpenMP/cancel_codegen_cleanup.cpp
@@ -0,0 +1,46 @@
+// RUN: %clang_cc1 -std=c++11 -fopenmp -fopenmp-version=45 -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s
+
+//CHECK: call i32 @__kmpc_cancel
+//CHECK: br {{.*}}label %[[EXIT:[^,].+]], label %[[CONTINUE:.+]]
+//CHECK: [[EXIT]]:
+//CHECK: store i32 [[EXIT_SLOT:[0-9]+]]
+//CHECK: br label %[[CLEANUP:.+]]
+//CHECK: [[CONTINUE]]:
+//CHECK: store i32 [[CONT_SLOT:[0-9]+]],
+//CHECK: br label %[[CLEANUP]]
+//CHECK: [[CLEANUP]]:
+//CHECK-NEXT: call void @_ZN3ObjD1Ev
+//CHECK: switch i32{{.*}}, label %[[UNREACHABLE:.+]] [
+//CHECK:   i32 [[CONT_SLOT]], label %[[CLEANUPCONT:.+]]
+//CHECK:   i32 [[EXIT_SLOT]], label %[[CANCELEXIT:.+]]
+//CHECK-NEXT: ]
+//CHECK: [[CLEANUPCONT]]:
+//CHECK: br label %[[CANCELCONT:.+]]
+//CHECK: [[CANCELCONT]]:
+//CHECK-NEXT: call void @__kmpc_barrier(
+//CHECK-NEXT: ret void
+//CHECK: [[UNREACHABLE]]:
+//CHECK-NEXT: unreachable
+//CHECK-NEXT: }
+
+struct Obj {
+  int a; Obj(); Obj(const Obj& r) = delete; Obj =(const Obj& r);
+  ~Obj();
+};
+ 
+void foo() {
+  int i,count = 0;
+  Obj obj;
+
+  #pragma omp parallel private(i) num_threads(1)
+  {
+  #pragma omp for reduction(+:count) lastprivate(obj)
+  for (i=0; i<1000; i++) {
+if(i==100) {
+obj.a = 100;
+#pragma omp cancel for
+}
+count++;
+}
+}
+}
Index: cfe/trunk/lib/CodeGen/CodeGenFunction.h
===
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h
@@ -1116,7 +1116,7 @@
 auto IP = CGF.Builder.saveAndClearIP();
 CGF.EmitBlock(Stack.back().ExitBlock.getBlock());
 CodeGen(CGF);
-CGF.EmitBranchThroughCleanup(Stack.back().ContBlock);
+CGF.EmitBranch(Stack.back().ContBlock.getBlock());
 CGF.Builder.restoreIP(IP);
 Stack.back().HasBeenEmitted = true;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r309288 - Fix double destruction of objects when OpenMP construct is canceled

2017-07-27 Thread Erich Keane via cfe-commits
Author: erichkeane
Date: Thu Jul 27 09:28:20 2017
New Revision: 309288

URL: http://llvm.org/viewvc/llvm-project?rev=309288=rev
Log:
Fix double destruction of objects when OpenMP construct is canceled

When an omp for loop is canceled the constructed objects are being destructed 
twice.

It looks like the desired code is:

{

  Obj o;
  If (cancelled) branch-through-cleanups to cancel.exit.

}
[cleanups]
cancel.exit:

__kmpc_for_static_fini
br cancel.cont (*)

cancel.cont:

__kmpc_barrier
return

The problem seems to be the branch to cancel.cont is currently also going 
through the cleanups calling them again. This change just does a direct branch 
instead.

Patch By: michael.p.r...@intel.com

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

Added:
cfe/trunk/test/OpenMP/cancel_codegen_cleanup.cpp
Modified:
cfe/trunk/lib/CodeGen/CodeGenFunction.h

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=309288=309287=309288=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Thu Jul 27 09:28:20 2017
@@ -1116,7 +1116,7 @@ private:
 auto IP = CGF.Builder.saveAndClearIP();
 CGF.EmitBlock(Stack.back().ExitBlock.getBlock());
 CodeGen(CGF);
-CGF.EmitBranchThroughCleanup(Stack.back().ContBlock);
+CGF.EmitBranch(Stack.back().ContBlock.getBlock());
 CGF.Builder.restoreIP(IP);
 Stack.back().HasBeenEmitted = true;
   }

Added: cfe/trunk/test/OpenMP/cancel_codegen_cleanup.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/cancel_codegen_cleanup.cpp?rev=309288=auto
==
--- cfe/trunk/test/OpenMP/cancel_codegen_cleanup.cpp (added)
+++ cfe/trunk/test/OpenMP/cancel_codegen_cleanup.cpp Thu Jul 27 09:28:20 2017
@@ -0,0 +1,46 @@
+// RUN: %clang_cc1 -std=c++11 -fopenmp -fopenmp-version=45 -triple 
x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s
+
+//CHECK: call i32 @__kmpc_cancel
+//CHECK: br {{.*}}label %[[EXIT:[^,].+]], label %[[CONTINUE:.+]]
+//CHECK: [[EXIT]]:
+//CHECK: store i32 [[EXIT_SLOT:[0-9]+]]
+//CHECK: br label %[[CLEANUP:.+]]
+//CHECK: [[CONTINUE]]:
+//CHECK: store i32 [[CONT_SLOT:[0-9]+]],
+//CHECK: br label %[[CLEANUP]]
+//CHECK: [[CLEANUP]]:
+//CHECK-NEXT: call void @_ZN3ObjD1Ev
+//CHECK: switch i32{{.*}}, label %[[UNREACHABLE:.+]] [
+//CHECK:   i32 [[CONT_SLOT]], label %[[CLEANUPCONT:.+]]
+//CHECK:   i32 [[EXIT_SLOT]], label %[[CANCELEXIT:.+]]
+//CHECK-NEXT: ]
+//CHECK: [[CLEANUPCONT]]:
+//CHECK: br label %[[CANCELCONT:.+]]
+//CHECK: [[CANCELCONT]]:
+//CHECK-NEXT: call void @__kmpc_barrier(
+//CHECK-NEXT: ret void
+//CHECK: [[UNREACHABLE]]:
+//CHECK-NEXT: unreachable
+//CHECK-NEXT: }
+
+struct Obj {
+  int a; Obj(); Obj(const Obj& r) = delete; Obj =(const Obj& r);
+  ~Obj();
+};
+ 
+void foo() {
+  int i,count = 0;
+  Obj obj;
+
+  #pragma omp parallel private(i) num_threads(1)
+  {
+  #pragma omp for reduction(+:count) lastprivate(obj)
+  for (i=0; i<1000; i++) {
+if(i==100) {
+obj.a = 100;
+#pragma omp cancel for
+}
+count++;
+}
+}
+}


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


[PATCH] D33900: Print registered targets in clang's version information

2017-07-27 Thread Hans Wennborg via Phabricator via cfe-commits
hans added a comment.

In https://reviews.llvm.org/D33900#822313, @mehdi_amini wrote:

> In https://reviews.llvm.org/D33900#820281, @hans wrote:
>
> > In https://reviews.llvm.org/D33900#818968, @mehdi_amini wrote:
> >
> > > I think @thakis is right: this too verbose to be the default --version.
> > >  We likely shouldn't ship this in clang-5.0 (@hans).
> >
> >
> > Let me know if you figure out a solution here and I'll merge it.
>
>
> I looped you in because the easy short term answer is: that we take our time 
> to figure what to do in trunk but in the meantime we just revert from the 
> release branch.


Makes sense. I've reverted r304899 and r304836 in r309285, and r304835 in 
r309286.


https://reviews.llvm.org/D33900



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


[PATCH] D33945: [OpenCL] Add support for missing sub_group functions.

2017-07-27 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia accepted this revision.
Anastasia added a comment.

LGTM! Thanks!


https://reviews.llvm.org/D33945



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


[PATCH] D35884: Update to use enum classes for various ARM *Kind enums

2017-07-27 Thread Florian Hahn via Phabricator via cfe-commits
fhahn added inline comments.



Comment at: lib/Basic/Targets/AArch64.cpp:94
  llvm::AArch64::parseCPUArch(Name) !=
- static_cast(llvm::AArch64::ArchKind::AK_INVALID);
+ llvm::AArch64::ArchKind::INVALID;
 }

rovka wrote:
> My eyes might be deceiving me, but did you run clang-format?
Yes, it fits on a single line now, excellent spot :)



Comment at: lib/Driver/ToolChains/Darwin.cpp:71
   const llvm::Triple::ArchType Arch = getArchTypeForMachOArchName(Str);
-  unsigned ArchKind = llvm::ARM::parseArch(Str);
+  llvm::ARM::ArchKind AK = llvm::ARM::parseArch(Str);
   T.setArch(Arch);

rovka wrote:
> Nitpick: The rename seems unnecessary (and anyway the file is inconsistent 
> between Arch, ArchKind and AK).
Agreed.


https://reviews.llvm.org/D35884



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


[PATCH] D35884: Update to use enum classes for various ARM *Kind enums

2017-07-27 Thread Florian Hahn via Phabricator via cfe-commits
fhahn updated this revision to Diff 108479.
fhahn marked an inline comment as done.
fhahn added a comment.

Addressed reviewer comments


https://reviews.llvm.org/D35884

Files:
  lib/Basic/Targets/AArch64.cpp
  lib/Basic/Targets/ARM.cpp
  lib/Basic/Targets/ARM.h
  lib/Driver/ToolChain.cpp
  lib/Driver/ToolChains/Arch/AArch64.cpp
  lib/Driver/ToolChains/Arch/ARM.cpp
  lib/Driver/ToolChains/Darwin.cpp
  lib/Driver/ToolChains/Gnu.cpp

Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -1491,7 +1491,7 @@
   bool IsV7SubArch = TargetTriple.getSubArch() == llvm::Triple::ARMSubArch_v7;
   bool IsThumbMode = IsThumbArch ||
   Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, false) ||
-  (IsArmArch && llvm::ARM::parseArchISA(Arch) == llvm::ARM::IK_THUMB);
+  (IsArmArch && llvm::ARM::parseArchISA(Arch) == llvm::ARM::ISAKind::THUMB);
   bool IsArmV7Mode = (IsArmArch || IsThumbArch) &&
   (llvm::ARM::parseArchVersion(Arch) == 7 ||
(IsArmArch && Arch == "" && IsV7SubArch));
Index: lib/Driver/ToolChains/Darwin.cpp
===
--- lib/Driver/ToolChains/Darwin.cpp
+++ lib/Driver/ToolChains/Darwin.cpp
@@ -68,14 +68,14 @@
 
 void darwin::setTripleTypeForMachOArchName(llvm::Triple , StringRef Str) {
   const llvm::Triple::ArchType Arch = getArchTypeForMachOArchName(Str);
-  unsigned ArchKind = llvm::ARM::parseArch(Str);
+  llvm::ARM::ArchKind ArchKind = llvm::ARM::parseArch(Str);
   T.setArch(Arch);
 
   if (Str == "x86_64h")
 T.setArchName(Str);
-  else if (ArchKind == llvm::ARM::AK_ARMV6M ||
-   ArchKind == llvm::ARM::AK_ARMV7M ||
-   ArchKind == llvm::ARM::AK_ARMV7EM) {
+  else if (ArchKind == llvm::ARM::ArchKind::ARMV6M ||
+   ArchKind == llvm::ARM::ArchKind::ARMV7M ||
+   ArchKind == llvm::ARM::ArchKind::ARMV7EM) {
 T.setOS(llvm::Triple::UnknownOS);
 T.setObjectFormat(llvm::Triple::MachO);
   }
@@ -739,8 +739,8 @@
 }
 
 static const char *ArmMachOArchNameCPU(StringRef CPU) {
-  unsigned ArchKind = llvm::ARM::parseCPUArch(CPU);
-  if (ArchKind == llvm::ARM::AK_INVALID)
+  llvm::ARM::ArchKind ArchKind = llvm::ARM::parseCPUArch(CPU);
+  if (ArchKind == llvm::ARM::ArchKind::INVALID)
 return nullptr;
   StringRef Arch = llvm::ARM::getArchName(ArchKind);
 
Index: lib/Driver/ToolChains/Arch/ARM.cpp
===
--- lib/Driver/ToolChains/Arch/ARM.cpp
+++ lib/Driver/ToolChains/Arch/ARM.cpp
@@ -29,8 +29,7 @@
 // True if M-profile.
 bool arm::isARMMProfile(const llvm::Triple ) {
   llvm::StringRef Arch = Triple.getArchName();
-  unsigned Profile = llvm::ARM::parseArchProfile(Arch);
-  return Profile == llvm::ARM::PK_M;
+  return llvm::ARM::parseArchProfile(Arch) == llvm::ARM::ProfileKind::M;
 }
 
 // Get Arch/CPU from args.
@@ -98,7 +97,7 @@
   std::pair Split = ArchName.split("+");
 
   std::string MArch = arm::getARMArch(ArchName, Triple);
-  if (llvm::ARM::parseArch(MArch) == llvm::ARM::AK_INVALID ||
+  if (llvm::ARM::parseArch(MArch) == llvm::ARM::ArchKind::INVALID ||
   (Split.second.size() && !DecodeARMFeatures(D, Split.second, Features)))
 D.Diag(clang::diag::err_drv_clang_unsupported) << A->getAsString(Args);
 }
@@ -393,7 +392,7 @@
 if (Arg *A = Args.getLastArg(options::OPT_mexecute_only, options::OPT_mno_execute_only)) {
   if (A->getOption().matches(options::OPT_mexecute_only)) {
 if (getARMSubArchVersionNumber(Triple) < 7 &&
-llvm::ARM::parseArch(Triple.getArchName()) != llvm::ARM::AK_ARMV6T2)
+llvm::ARM::parseArch(Triple.getArchName()) != llvm::ARM::ArchKind::ARMV6T2)
   D.Diag(diag::err_target_unsupported_execute_only) << Triple.getArchName();
 else if (Arg *B = Args.getLastArg(options::OPT_mno_movt))
   D.Diag(diag::err_opt_not_valid_with_opt) << A->getAsString(Args) << B->getAsString(Args);
@@ -525,22 +524,22 @@
 // FIXME: This is redundant with -mcpu, why does LLVM use this.
 StringRef arm::getLLVMArchSuffixForARM(StringRef CPU, StringRef Arch,
const llvm::Triple ) {
-  unsigned ArchKind;
+  llvm::ARM::ArchKind ArchKind;
   if (CPU == "generic") {
 std::string ARMArch = tools::arm::getARMArch(Arch, Triple);
 ArchKind = llvm::ARM::parseArch(ARMArch);
-if (ArchKind == llvm::ARM::AK_INVALID)
+if (ArchKind == llvm::ARM::ArchKind::INVALID)
   // In case of generic Arch, i.e. "arm",
   // extract arch from default cpu of the Triple
   ArchKind = llvm::ARM::parseCPUArch(Triple.getARMCPUForArch(ARMArch));
   } else {
 // FIXME: horrible hack to get around the fact that Cortex-A7 is only an
 // armv7k triple if it's actually been specified via "-arch armv7k".
 ArchKind = (Arch == "armv7k" || Arch == "thumbv7k")
- 

[PATCH] D35746: Make new PM honor -fdebug-info-for-profiling (clang side)

2017-07-27 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh marked an inline comment as done.
danielcdh added a comment.

Thanks for the review!

In https://reviews.llvm.org/D35746#822498, @chandlerc wrote:

> LGTM with a tiny tweak below.
>
> Would be good to add a test that this flag is being honored, either in this 
> patch or in a follow-up.


I'll add the test in a follow-up patch. Could you help suggest how to add a 
test for this? Shall I just invoke "clang -cc1 -fexperimental-new-pass-manager" 
and check if discriminator is generated? That seems an integration test.


https://reviews.llvm.org/D35746



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


r309282 - Make new PM honor -fdebug-info-for-profiling (clang side)

2017-07-27 Thread Dehao Chen via cfe-commits
Author: dehao
Date: Thu Jul 27 08:29:53 2017
New Revision: 309282

URL: http://llvm.org/viewvc/llvm-project?rev=309282=rev
Log:
Make new PM honor -fdebug-info-for-profiling (clang side)

Summary: The new PM needs to invoke add-discriminator pass when building with 
-fdebug-info-for-profiling.

Reviewers: chandlerc, davidxl

Reviewed By: chandlerc

Subscribers: sanjoy, cfe-commits

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

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

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=309282=309281=309282=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Thu Jul 27 08:29:53 2017
@@ -840,28 +840,27 @@ void EmitAssemblyHelper::EmitAssemblyWit
 return;
   TheModule->setDataLayout(TM->createDataLayout());
 
-  PGOOptions PGOOpt;
+  Optional PGOOpt;
 
-  // -fprofile-generate.
-  PGOOpt.RunProfileGen = CodeGenOpts.hasProfileIRInstr();
-  if (PGOOpt.RunProfileGen)
-PGOOpt.ProfileGenFile = CodeGenOpts.InstrProfileOutput.empty() ?
-  DefaultProfileGenName : CodeGenOpts.InstrProfileOutput;
+  if (CodeGenOpts.hasProfileIRInstr())
+// -fprofile-generate.
+PGOOpt = PGOOptions(CodeGenOpts.InstrProfileOutput.empty()
+? DefaultProfileGenName
+: CodeGenOpts.InstrProfileOutput,
+"", "", true, CodeGenOpts.DebugInfoForProfiling);
+  else if (CodeGenOpts.hasProfileIRUse())
+// -fprofile-use.
+PGOOpt = PGOOptions("", CodeGenOpts.ProfileInstrumentUsePath, "", false,
+CodeGenOpts.DebugInfoForProfiling);
+  else if (!CodeGenOpts.SampleProfileFile.empty())
+// -fprofile-sample-use
+PGOOpt = PGOOptions("", "", CodeGenOpts.SampleProfileFile, false,
+CodeGenOpts.DebugInfoForProfiling);
+  else if (CodeGenOpts.DebugInfoForProfiling)
+// -fdebug-info-for-profiling
+PGOOpt = PGOOptions("", "", "", false, true);
 
-  // -fprofile-use.
-  if (CodeGenOpts.hasProfileIRUse())
-PGOOpt.ProfileUseFile = CodeGenOpts.ProfileInstrumentUsePath;
-
-  if (!CodeGenOpts.SampleProfileFile.empty())
-PGOOpt.SampleProfileFile = CodeGenOpts.SampleProfileFile;
-
-  // Only pass a PGO options struct if -fprofile-generate or
-  // -fprofile-use were passed on the cmdline.
-  PassBuilder PB(TM.get(),
-(PGOOpt.RunProfileGen ||
-  !PGOOpt.ProfileUseFile.empty() ||
-  !PGOOpt.SampleProfileFile.empty()) ?
-Optional(PGOOpt) : None);
+  PassBuilder PB(TM.get(), PGOOpt);
 
   LoopAnalysisManager LAM;
   FunctionAnalysisManager FAM;


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


r309276 - [clang-diff] Rename, NFC

2017-07-27 Thread Johannes Altmanninger via cfe-commits
Author: krobelus
Date: Thu Jul 27 08:04:44 2017
New Revision: 309276

URL: http://llvm.org/viewvc/llvm-project?rev=309276=rev
Log:
[clang-diff] Rename, NFC

Modified:
cfe/trunk/tools/clang-diff/ClangDiff.cpp

Modified: cfe/trunk/tools/clang-diff/ClangDiff.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-diff/ClangDiff.cpp?rev=309276=309275=309276=diff
==
--- cfe/trunk/tools/clang-diff/ClangDiff.cpp (original)
+++ cfe/trunk/tools/clang-diff/ClangDiff.cpp Thu Jul 27 08:04:44 2017
@@ -24,7 +24,7 @@ using namespace clang::tooling;
 static cl::OptionCategory ClangDiffCategory("clang-diff options");
 
 static cl::opt
-DumpAST("ast-dump",
+ASTDump("ast-dump",
 cl::desc("Print the internal representation of the AST as JSON."),
 cl::init(false), cl::cat(ClangDiffCategory));
 
@@ -74,7 +74,7 @@ int main(int argc, const char **argv) {
 return 1;
   }
 
-  if (DumpAST) {
+  if (ASTDump) {
 if (!DestinationPath.empty()) {
   llvm::errs() << "Error: Please specify exactly one filename.\n";
   return 1;


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


[PATCH] D35884: Update to use enum classes for various ARM *Kind enums

2017-07-27 Thread Diana Picus via Phabricator via cfe-commits
rovka accepted this revision.
rovka added a comment.
This revision is now accepted and ready to land.

Looks entirely mechanical, I don't see any problem with it (just a couple of 
nits).




Comment at: lib/Basic/Targets/AArch64.cpp:94
  llvm::AArch64::parseCPUArch(Name) !=
- static_cast(llvm::AArch64::ArchKind::AK_INVALID);
+ llvm::AArch64::ArchKind::INVALID;
 }

My eyes might be deceiving me, but did you run clang-format?



Comment at: lib/Driver/ToolChains/Darwin.cpp:71
   const llvm::Triple::ArchType Arch = getArchTypeForMachOArchName(Str);
-  unsigned ArchKind = llvm::ARM::parseArch(Str);
+  llvm::ARM::ArchKind AK = llvm::ARM::parseArch(Str);
   T.setArch(Arch);

Nitpick: The rename seems unnecessary (and anyway the file is inconsistent 
between Arch, ArchKind and AK).


https://reviews.llvm.org/D35884



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


[PATCH] D35932: [clang-tidy] Add integer division check

2017-07-27 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh requested changes to this revision.
alexfh added a comment.
This revision now requires changes to proceed.

Could you run the check over LLVM+Clang code and post a summary of results here?


https://reviews.llvm.org/D35932



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


[PATCH] D35932: [clang-tidy] Add integer division check

2017-07-27 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh added inline comments.



Comment at: docs/clang-tidy/checks/bugprone-integer-division.rst:21-24
+  // Do not warn, there are signs of deliberateness.
+  sin(abs(3) / 5);
+  sin(1 + abs(1 + 7 / 2));
+  1 << 2 / 3;

I'd argue that the presence of `abs` here doesn't add any signal, since the 
function has overloads both for integer and floating point types.


https://reviews.llvm.org/D35932



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


[PATCH] D26350: Keep invalid Switch in the AST

2017-07-27 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

This looks reasonable to me, but you should wait for @rsmith to sign off before 
committing.




Comment at: lib/Sema/SemaStmt.cpp:669
   if (Cond.isInvalid())
-return StmtError();
+Cond = ConditionResult(
+*this, nullptr,

ogoffart wrote:
> aaron.ballman wrote:
> > This makes the condition result valid when it isn't. Users of this 
> > condition result may expect a valid condition result to return nonnull 
> > values when calling `get()`, which makes me uncomfortable.
> Get return a non-null value.
> That's why i'm constructing an OpaqueValueExpr placeholder expression.
> 
> The ConditionVar (nullptr in the line bellow) can be null. It is null in 
> valid code most of the time actually, when one does not declare a new 
> variable in in condition.
> 
> But the result is that users of this condition will get a OpaqueValueExpr 
> when calling get and should not be disturbed by that as they will just take 
> that as an expression.
> 
Ah, sorry, I misread the code in my haste.


https://reviews.llvm.org/D26350



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


Re: r309106 - Recommit r308327 2nd time: Add a warning for missing

2017-07-27 Thread Hans Wennborg via cfe-commits
On Thu, Jul 27, 2017 at 3:41 AM, Alex L  wrote:
>
>
> On 26 July 2017 at 22:32, Hans Wennborg  wrote:
>>
>> On Wed, Jul 26, 2017 at 11:27 AM, Hans Wennborg  wrote:
>> > On Wed, Jul 26, 2017 at 5:20 AM, Alex Lorenz via cfe-commits
>> >  wrote:
>> >> Author: arphaman
>> >> Date: Wed Jul 26 05:20:57 2017
>> >> New Revision: 309106
>> >>
>> >> URL: http://llvm.org/viewvc/llvm-project?rev=309106=rev
>> >> Log:
>> >> Recommit r308327 2nd time: Add a warning for missing
>> >> '#pragma pack (pop)' and suspicious uses of '#pragma pack' in included
>> >> files
>> >>
>> >> The first recommit (r308441) caused a "non-default #pragma pack value
>> >> might
>> >> change the alignment of struct or union members in the included file"
>> >> warning
>> >> in LLVM itself. This recommit tweaks the added warning to avoid
>> >> warnings for
>> >> #includes that don't have any records that are affected by the
>> >> non-default
>> >> alignment. This tweak avoids the previously emitted warning in LLVM.
>> >>
>> >> Original message:
>> >>
>> >> This commit adds a new -Wpragma-pack warning. It warns in the following
>> >> cases:
>> >>
>> >> - When a translation unit is missing terminating #pragma pack (pop)
>> >> directives.
>> >> - When entering an included file if the current alignment value as
>> >> determined
>> >>   by '#pragma pack' directives is different from the default alignment
>> >> value.
>> >> - When leaving an included file that changed the state of the current
>> >> alignment
>> >>   value.
>> >>
>> >> rdar://10184173
>> >>
>> >> Differential Revision: https://reviews.llvm.org/D35484
>> >
>> > We have code in Chromium that does exactly this:
>> >
>> > gles2_cmd_format.h does #pragma pack(push, 4) and then #includes a
>> > file with some generated structs, with the intention that the pragma
>> > applies to them.
>> >
>> > What's the best way to pacify the warning in this case?
>> >
>> > (We're tracking this in
>> > https://bugs.chromium.org/p/chromium/issues/detail?id=749197)
>>
>> I agree that cases 1) and 3) from your patch description make sense to
>> warn for, but I'm not sure that's the case for 2). Do you have
>> examples where this catches any bugs? In our case #pragma packing an
>> included file is intentional, and I suspect it might be a bit of a
>> pattern.
>
>
> I see, thanks for your input.
>
> 2) is generally designed for times when #pragma pack pop was accidentally
> used too late (after some #includes that unintentionally receive the
> alignment). I can see how some projects use this pattern heavily, and I
> don't think there's a good way to pacify this warning in that case.
>
> I think that for us it would be reasonable to turn 2) off by default, and
> allow users to enable it explicitly using a stronger flag (something like
> -Wpragma-pack-suspicious-include?). I think that I will leave 2) out of this
> commit, recommit it without 2) and then commit 2) as a non-default warning
> that uses a separate flag.

That sounds reasonable. You can probably still do it with the same
commit, just moving 2) behind a separate flag.

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


[PATCH] D35937: [clang-tidy] Add new readability non-idiomatic static access

2017-07-27 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp:23
+  memberExpr(hasDeclaration(anyOf(cxxMethodDecl(isStaticStorageClass()),
+  varDecl(hasStaticStorageDuration(,
+ unless(isInTemplateInstantiation()))

Why not use `isStaticStorageClass()` here as well?



Comment at: clang-tidy/readability/StaticAccessedThroughInstanceCheck.h:20
+/// \@brief Checks for member expressions that access static members through 
instances
+/// and replaces them with calls to the preferred, more readable `::` operator.
+///

`::` isn't an operator -- I would say: "and replaces them with uses of the 
appropriate qualified-id."



Comment at: 
docs/clang-tidy/checks/readability-static-accessed-through-instance.rst:7
+Checks for member expressions that access static members through instances, and
+replaces them with the corresponding expressions that use a more readable `::` 
operator.
+

Eugene.Zelenko wrote:
> Is :: operator really?
Same wording suggestion here as above.



Comment at: test/clang-tidy/readability-static-accessed-through-instance.cpp:34
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member accessed through 
instance  [readability-static-accessed-through-instance]
+  // CHECK-FIXES: {{^}}  C::x;{{$}}
+}

This fix-it worries me because it changes the semantics of the code. The 
function `f()` is no longer called, and so this isn't a valid source 
transformation.



Comment at: test/clang-tidy/readability-static-accessed-through-instance.cpp:137
+  h<4>();
+}

Please add some tests where the replacement is somewhat more complex, like:
```
namespace N {
struct S {
  struct T {
struct U {
  static int x;
 };
  };
};
}

// Complex replacement
void f(N::S::T::U u) {
  u.x = 12; // N::S::T::U::x = 12;
}
```
Note that this is a case where it's possible that the code becomes *less* 
readable rather than more readable. I am fine without having any configuration 
right now, but we may want to consider whether the nesting level should factor 
in to whether we think this is more or less readable.


Repository:
  rL LLVM

https://reviews.llvm.org/D35937



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


[PATCH] D35937: [clang-tidy] Add new readability non-idiomatic static access

2017-07-27 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added a comment.

It also seems that your code is not based on trunk, since Release Notes were 
cleared when version was changed to 6. Please update.


Repository:
  rL LLVM

https://reviews.llvm.org/D35937



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


[PATCH] D35937: [clang-tidy] Add new readability non-idiomatic static access

2017-07-27 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added inline comments.



Comment at: 
docs/clang-tidy/checks/readability-static-accessed-through-instance.rst:7
+Checks for member expressions that access static members through instances, and
+replaces them with the corresponding expressions that use a more readable `::` 
operator.
+

Is :: operator really?


Repository:
  rL LLVM

https://reviews.llvm.org/D35937



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


[PATCH] D33945: [OpenCL] Add support for missing sub_group functions.

2017-07-27 Thread Alexey Bader via Phabricator via cfe-commits
bader accepted this revision.
bader added a comment.
This revision is now accepted and ready to land.

Thanks!
Overall the patch looks good, but I would suggest splitting it into three 
commits (as they seems to be independent):

1. [OpenCL] Check that cl_khr_subgroups pragma is enabled if respective 
extension is used.
2. [OpenCL] Add support for missing sub_group functions.
3. [OpenCL] Fix return type for reserve pipe built-ins.

Please, add a regression test for the part #3.

You might also review this patch with @Anastasia (OpenCL code owner).




Comment at: Sema/SemaChecking.cpp:685-689
+  // Since return type of reserve_read/write_pipe built-in function is
+  // reserve_id_t, which is not defined in the builtin def file , we used int
+  // as return type and need to override the return type of these functions.
+  Call->setType(S.Context.OCLReserveIDTy);
+

This change is not covered with regression tests.


https://reviews.llvm.org/D33945



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


[PATCH] D35941: Fix -Wshadow false positives with function-local classes.

2017-07-27 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh created this revision.

Fixes http://llvm.org/PR33947.

https://godbolt.org/g/54XRMT

void f(int a) {

  struct A {
void g(int a) {}
A() { int a; }
  };

}

3 : :3:16: warning: declaration shadows a local variable [-Wshadow]

  void g(int a) {}
 ^

1 : :1:12: note: previous declaration is here
void f(int a) {

  ^

4 : :4:15: warning: declaration shadows a local variable [-Wshadow]

  A() { int a; }
^

1 : :1:12: note: previous declaration is here
void f(int a) {

  ^

2 warnings generated.

The local variable `a` of the function `f` can't be accessed from a method of
the function-local class A, thus no shadowing occurs and no diagnostic is
needed.


https://reviews.llvm.org/D35941

Files:
  lib/Sema/SemaDecl.cpp
  test/SemaCXX/warn-shadow.cpp


Index: test/SemaCXX/warn-shadow.cpp
===
--- test/SemaCXX/warn-shadow.cpp
+++ test/SemaCXX/warn-shadow.cpp
@@ -213,3 +213,12 @@
 void handleLinkageSpec() {
   typedef void externC; // expected-warning {{declaration shadows a typedef in 
the global namespace}}
 }
+
+namespace PR33947 {
+void f(int a) {
+  struct A {
+void g(int a) {}
+A() { int a; }
+  };
+}
+}
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -6999,6 +6999,21 @@
   return;
 }
   }
+
+  if (cast(ShadowedDecl)->hasLocalStorage()) {
+// A variable can't shadow a local variable in an enclosing scope, if
+// they are separated by a non-capturing declaration context.
+for (DeclContext *ParentDC = NewDC;
+ ParentDC && !ParentDC->Equals(OldDC);
+ ParentDC = getLambdaAwareParentOfDeclContext(ParentDC)) {
+  // Only block literals, captured statements, and lambda expressions
+  // can capture; other scopes don't.
+  if (!isa(ParentDC) && !isa(ParentDC) &&
+  !isLambdaCallOperator(ParentDC)) {
+return;
+  }
+}
+  }
 }
   }
 


Index: test/SemaCXX/warn-shadow.cpp
===
--- test/SemaCXX/warn-shadow.cpp
+++ test/SemaCXX/warn-shadow.cpp
@@ -213,3 +213,12 @@
 void handleLinkageSpec() {
   typedef void externC; // expected-warning {{declaration shadows a typedef in the global namespace}}
 }
+
+namespace PR33947 {
+void f(int a) {
+  struct A {
+void g(int a) {}
+A() { int a; }
+  };
+}
+}
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -6999,6 +6999,21 @@
   return;
 }
   }
+
+  if (cast(ShadowedDecl)->hasLocalStorage()) {
+// A variable can't shadow a local variable in an enclosing scope, if
+// they are separated by a non-capturing declaration context.
+for (DeclContext *ParentDC = NewDC;
+ ParentDC && !ParentDC->Equals(OldDC);
+ ParentDC = getLambdaAwareParentOfDeclContext(ParentDC)) {
+  // Only block literals, captured statements, and lambda expressions
+  // can capture; other scopes don't.
+  if (!isa(ParentDC) && !isa(ParentDC) &&
+  !isLambdaCallOperator(ParentDC)) {
+return;
+  }
+}
+  }
 }
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r309270 - [OPENMP] Codegen for 'in_reduction' clause.

2017-07-27 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Thu Jul 27 06:20:36 2017
New Revision: 309270

URL: http://llvm.org/viewvc/llvm-project?rev=309270=rev
Log:
[OPENMP] Codegen for 'in_reduction' clause.

Added codegen for task-based directive with in_reduction clause.
```

```
The next code is emitted:
```
void *td;
...
td = call i8* @__kmpc_task_reduction_init();
...
 *priv = ( *)call i8* @__kmpc_task_reduction_get_th_data(i32
GTID, i8* td, i8* )
```

Added:
cfe/trunk/test/OpenMP/task_in_reduction_codegen.cpp
cfe/trunk/test/OpenMP/taskloop_in_reduction_codegen.cpp
cfe/trunk/test/OpenMP/taskloop_simd_in_reduction_codegen.cpp
Modified:
cfe/trunk/include/clang/AST/OpenMPClause.h
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/lib/AST/OpenMPClause.cpp
cfe/trunk/lib/AST/StmtProfile.cpp
cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/include/clang/AST/OpenMPClause.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OpenMPClause.h?rev=309270=309269=309270=diff
==
--- cfe/trunk/include/clang/AST/OpenMPClause.h (original)
+++ cfe/trunk/include/clang/AST/OpenMPClause.h Thu Jul 27 06:20:36 2017
@@ -2212,6 +2212,17 @@ class OMPInReductionClause final
 return llvm::makeArrayRef(getRHSExprs().end(), varlist_size());
   }
 
+  /// Set list of helper reduction taskgroup descriptors.
+  void setTaskgroupDescriptors(ArrayRef ReductionOps);
+
+  ///  Get the list of helper reduction taskgroup descriptors.
+  MutableArrayRef getTaskgroupDescriptors() {
+return MutableArrayRef(getReductionOps().end(), varlist_size());
+  }
+  ArrayRef getTaskgroupDescriptors() const {
+return llvm::makeArrayRef(getReductionOps().end(), varlist_size());
+  }
+
 public:
   /// Creates clause with a list of variables \a VL.
   ///
@@ -2241,6 +2252,8 @@ public:
   /// \endcode
   /// Required for proper codegen of final reduction operation performed by the
   /// reduction clause.
+  /// \param TaskgroupDescriptors List of helper taskgroup descriptors for
+  /// corresponding items in parent taskgroup task_reduction clause.
   /// \param PreInit Statement that must be executed before entering the OpenMP
   /// region with this clause.
   /// \param PostUpdate Expression that must be executed after exit from the
@@ -2252,7 +2265,8 @@ public:
  NestedNameSpecifierLoc QualifierLoc,
  const DeclarationNameInfo , ArrayRef Privates,
  ArrayRef LHSExprs, ArrayRef RHSExprs,
- ArrayRef ReductionOps, Stmt *PreInit, Expr *PostUpdate);
+ ArrayRef ReductionOps, ArrayRef TaskgroupDescriptors,
+ Stmt *PreInit, Expr *PostUpdate);
 
   /// Creates an empty clause with the place for \a N variables.
   ///
@@ -2300,6 +2314,14 @@ public:
 return helper_expr_range(getReductionOps().begin(),
  getReductionOps().end());
   }
+  helper_expr_const_range taskgroup_descriptors() const {
+return helper_expr_const_range(getTaskgroupDescriptors().begin(),
+   getTaskgroupDescriptors().end());
+  }
+  helper_expr_range taskgroup_descriptors() {
+return helper_expr_range(getTaskgroupDescriptors().begin(),
+ getTaskgroupDescriptors().end());
+  }
 
   child_range children() {
 return child_range(reinterpret_cast(varlist_begin()),

Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=309270=309269=309270=diff
==
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Thu Jul 27 06:20:36 2017
@@ -3057,6 +3057,8 @@ bool RecursiveASTVisitor::Visit
   for (auto *E : C->reduction_ops()) {
 TRY_TO(TraverseStmt(E));
   }
+  for (auto *E : C->taskgroup_descriptors())
+TRY_TO(TraverseStmt(E));
   return true;
 }
 

Modified: cfe/trunk/lib/AST/OpenMPClause.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/OpenMPClause.cpp?rev=309270=309269=309270=diff
==
--- cfe/trunk/lib/AST/OpenMPClause.cpp (original)
+++ cfe/trunk/lib/AST/OpenMPClause.cpp Thu Jul 27 06:20:36 2017
@@ -593,14 +593,23 @@ void OMPInReductionClause::setReductionO
   std::copy(ReductionOps.begin(), ReductionOps.end(), getRHSExprs().end());
 }
 
+void OMPInReductionClause::setTaskgroupDescriptors(
+ArrayRef TaskgroupDescriptors) {
+  assert(TaskgroupDescriptors.size() == varlist_size() &&
+ "Number of in reduction descriptors is not the same as the "
+ "preallocated buffer");
+  

[PATCH] D33945: [OpenCL] Add support for missing sub_group functions.

2017-07-27 Thread Joey Gouly via Phabricator via cfe-commits
joey updated this revision to Diff 108452.
joey added a comment.

Updated all the comments you made and rebased.

Sorry for the long delay.


https://reviews.llvm.org/D33945

Files:
  CodeGen/CGBuiltin.cpp
  CodeGenOpenCL/cl20-device-side-enqueue.cl
  CodeGenOpenCL/pipe_builtin.cl
  Sema/SemaChecking.cpp
  SemaOpenCL/cl20-device-side-enqueue.cl
  SemaOpenCL/invalid-pipe-builtin-cl2.0.cl
  clang/Basic/Builtins.def

Index: SemaOpenCL/invalid-pipe-builtin-cl2.0.cl
===
--- SemaOpenCL/invalid-pipe-builtin-cl2.0.cl
+++ SemaOpenCL/invalid-pipe-builtin-cl2.0.cl
@@ -1,5 +1,7 @@
 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0
 
+#pragma OPENCL EXTENSION cl_khr_subgroups : enable
+
 void test1(read_only pipe int p, global int* ptr){
   int tmp;
   reserve_id_t rid;
Index: SemaOpenCL/cl20-device-side-enqueue.cl
===
--- SemaOpenCL/cl20-device-side-enqueue.cl
+++ SemaOpenCL/cl20-device-side-enqueue.cl
@@ -209,3 +209,35 @@
   size = get_kernel_preferred_work_group_size_multiple(1); // expected-error{{expected block argument}}
   size = get_kernel_preferred_work_group_size_multiple(block_A, 1); // expected-error{{too many arguments to function call, expected 1, have 2}}
 }
+
+#pragma OPENCL EXTENSION cl_khr_subgroups : enable
+
+kernel void foo(global int *buf)
+{
+  ndrange_t n;
+  buf[0] = get_kernel_max_sub_group_size_for_ndrange(n, ^(){});
+  buf[0] = get_kernel_max_sub_group_size_for_ndrange(0, ^(){}); // expected-error{{illegal call to 'get_kernel_max_sub_group_size_for_ndrange', expected 'ndrange_t' argument type}}
+  buf[0] = get_kernel_max_sub_group_size_for_ndrange(n, 1); // expected-error{{illegal call to 'get_kernel_max_sub_group_size_for_ndrange', expected block argument type}}
+}
+
+kernel void bar(global int *buf)
+{
+  ndrange_t n;
+  buf[0] = get_kernel_sub_group_count_for_ndrange(n, ^(){});
+  buf[0] = get_kernel_sub_group_count_for_ndrange(0, ^(){}); // expected-error{{illegal call to 'get_kernel_sub_group_count_for_ndrange', expected 'ndrange_t' argument type}}
+  buf[0] = get_kernel_sub_group_count_for_ndrange(n, 1); // expected-error{{illegal call to 'get_kernel_sub_group_count_for_ndrange', expected block argument type}}
+}
+
+#pragma OPENCL EXTENSION cl_khr_subgroups : disable
+
+kernel void foo1(global int *buf)
+{
+  ndrange_t n;
+  buf[0] = get_kernel_max_sub_group_size_for_ndrange(n, ^(){}); // expected-error {{use of declaration 'get_kernel_max_sub_group_size_for_ndrange' requires cl_khr_subgroups extension to be enabled}}
+}
+
+kernel void bar1(global int *buf)
+{
+  ndrange_t n;
+  buf[0] = get_kernel_sub_group_count_for_ndrange(n, ^(){}); // expected-error {{use of declaration 'get_kernel_sub_group_count_for_ndrange' requires cl_khr_subgroups extension to be enabled}}
+}
Index: CodeGenOpenCL/pipe_builtin.cl
===
--- CodeGenOpenCL/pipe_builtin.cl
+++ CodeGenOpenCL/pipe_builtin.cl
@@ -3,6 +3,8 @@
 // CHECK: %opencl.pipe_t = type opaque
 // CHECK: %opencl.reserve_id_t = type opaque
 
+#pragma OPENCL EXTENSION cl_khr_subgroups : enable
+
 void test1(read_only pipe int p, global int *ptr) {
   // CHECK: call i32 @__read_pipe_2(%opencl.pipe_t* %{{.*}}, i8* %{{.*}}, i32 4, i32 4)
   read_pipe(p, ptr);
Index: CodeGenOpenCL/cl20-device-side-enqueue.cl
===
--- CodeGenOpenCL/cl20-device-side-enqueue.cl
+++ CodeGenOpenCL/cl20-device-side-enqueue.cl
@@ -1,6 +1,8 @@
 // RUN: %clang_cc1 %s -cl-std=CL2.0 -ffake-address-space-map -O0 -emit-llvm -o - -triple "spir-unknown-unknown" | FileCheck %s --check-prefix=COMMON --check-prefix=B32
 // RUN: %clang_cc1 %s -cl-std=CL2.0 -ffake-address-space-map -O0 -emit-llvm -o - -triple "spir64-unknown-unknown" | FileCheck %s --check-prefix=COMMON --check-prefix=B64
 
+#pragma OPENCL EXTENSION cl_khr_subgroups : enable
+
 typedef void (^bl_t)(local void *);
 typedef struct {int a;} ndrange_t;
 
@@ -138,4 +140,9 @@
   size = get_kernel_preferred_work_group_size_multiple(block_A);
   // COMMON: call i32 @__get_kernel_preferred_work_group_multiple_impl(i8 addrspace(4)* addrspacecast (i8 addrspace(1)* bitcast ({ i8**, i32, i32, i8*, %struct.__block_descriptor addrspace(2)* } addrspace(1)* [[BL_GLOBAL]] to i8 addrspace(1)*) to i8 addrspace(4)*))
   size = get_kernel_preferred_work_group_size_multiple(block_G);
+
+  // COMMON: call i32 @__get_kernel_max_sub_group_size_for_ndrange_impl(%struct.ndrange_t* {{.*}}, i8 addrspace(4)* addrspacecast (i8 addrspace(1)* bitcast ({ i8**, i32, i32, i8*, %struct.__block_descriptor addrspace(2)* } addrspace(1)* {{.*}} to i8 addrspace(1)*) to i8 addrspace(4)*))
+  size = get_kernel_max_sub_group_size_for_ndrange(ndrange, ^(){});
+  // COMMON: call i32 @__get_kernel_sub_group_count_for_ndrange_impl(%struct.ndrange_t* {{.*}}, i8 addrspace(4)* addrspacecast (i8 

[PATCH] D34748: [clang-diff] improve mapping accuracy

2017-07-27 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added a comment.

In general this patch is too big, and combines a lot of changes that could be 
separated using multiple patches. I've suggested one pre-commit and a new patch 
so far, but more changes might be required once I see the updated patch.




Comment at: include/clang/Tooling/ASTDiff/ASTDiff.h:48
+  bool isLeaf() const { return Children.empty(); }
+  llvm::Optional getQualifiedIdentifier() const;
+  llvm::Optional getIdentifier() const;

Redundant `const` in the return type.



Comment at: include/clang/Tooling/ASTDiff/ASTDiff.h:49
+  llvm::Optional getQualifiedIdentifier() const;
+  llvm::Optional getIdentifier() const;
+};

Redundant `const` in the return type.



Comment at: include/clang/Tooling/ASTDiff/ASTDiff.h:58
 
-  // Returns a list of matches.
-  std::vector getMatches();
-  /// Returns an edit script.
-  std::vector getChanges();
+  SyntaxTree , 
 

Please Move these fields to the end of the class. Can they be private too?



Comment at: lib/Tooling/ASTDiff/ASTDiff.cpp:170
+  // Ignore everything from other files.
+  if (!SrcMgr.isInMainFile(SLoc))
+return true;

How will you deal with changes in headers if you limit analysis to main files 
only? 



Comment at: lib/Tooling/ASTDiff/ASTDiff.cpp:694
+
+const StringRef Node::getTypeLabel() const { return getType().asStringRef(); }
+

Redundant `const` in return type.



Comment at: tools/clang-diff/ClangDiff.cpp:28
 static cl::opt
-DumpAST("ast-dump",
+ASTDump("ast-dump",
 cl::desc("Print the internal representation of the AST as JSON."),

The rename of `DumpAST` to `ASTDump` should be a separate change. Please 
pre-commit this rename and remove it from the updated patch.



Comment at: tools/clang-diff/ClangDiff.cpp:45
 
+static cl::opt NoCompilationDatabase(
+"no-compilation-database",

Can you avoid moving the `NoCompilationDatabase`? This will make the patch 
clearer.



Comment at: tools/clang-diff/ClangDiff.cpp:65
+namespace {
+class ArgumentsAdjustingCompilations : public CompilationDatabase {
+public:

This is a copy `ArgumentsAdjustingCompilations` from lib/Tooling. You should 
create a patch that moves existing `ArgumentsAdjustingCompilations` from the 
implementation file to some header so that it will be accessible by the tool 
and make this patch depend on the new patch.



Comment at: tools/clang-diff/ClangDiff.cpp:224
+  case diff::None:
+  case diff::Delete:
+break;

You might want to assert here. We should never have `Delete` in the destination 
AST, right?


https://reviews.llvm.org/D34748



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


[PATCH] D35937: [clang-tidy] Add new readability non-idiomatic static access

2017-07-27 Thread Barancsuk Lilla via Phabricator via cfe-commits
barancsuk created this revision.
barancsuk added a project: clang-tools-extra.
Herald added subscribers: baloghadamsoftware, xazax.hun, whisperity, 
JDevlieghere, mgorny.

Checks for member expressions that access static members through instances, and
replaces them with the corresponding expressions that use a more readable `::` 
operator.

Example:

The following code:

  struct C {
static void foo();
static int x;
  };
  
  C *c1=new C();
  c1->foo();
  c1->x;

is changed to:

  C::foo();
  C::x;


Repository:
  rL LLVM

https://reviews.llvm.org/D35937

Files:
  clang-tidy/readability/CMakeLists.txt
  clang-tidy/readability/ReadabilityTidyModule.cpp
  clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp
  clang-tidy/readability/StaticAccessedThroughInstanceCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/readability-static-accessed-through-instance.rst
  test/clang-tidy/readability-static-accessed-through-instance.cpp

Index: test/clang-tidy/readability-static-accessed-through-instance.cpp
===
--- /dev/null
+++ test/clang-tidy/readability-static-accessed-through-instance.cpp
@@ -0,0 +1,137 @@
+// RUN: %check_clang_tidy %s readability-static-accessed-through-instance %t
+
+struct C {
+  static void foo();
+  static int x;
+  int nsx;
+  void mf() {
+(void)// OK, x is accessed inside the struct.
+(void)::x; // OK, x is accessed using the scope operator.
+foo();   // OK, foo() is accessed inside the struct.
+  }
+};
+
+struct CC {
+  void foo();
+  int x;
+};
+
+template  struct CT {
+  static T foo();
+  static T x;
+  int nsx;
+  void mf() {
+(void)// OK, x is accessed inside the struct.
+(void)::x; // OK, x is accessed using the scope operator.
+foo();   // OK, foo() is accessed inside the struct.
+  }
+};
+
+C (int, int, int, int);
+void g() {
+  f(1, 2, 3, 4).x;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member accessed through instance  [readability-static-accessed-through-instance]
+  // CHECK-FIXES: {{^}}  C::x;{{$}}
+}
+
+template  T CT::x;
+
+template  struct CCT {
+  T foo();
+  T x;
+};
+
+typedef C D;
+
+using E = D;
+
+#define FOO(c) c.foo()
+#define X(c) c.x
+
+template  void f(T t, C c) {
+  t.x; // OK, t is a template parameter.
+  c.x;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member accessed through
+  // instance  [readability-static-accessed-through-instance]
+  // CHECK-FIXES: {{^}}  C::x;{{$}}
+}
+
+template  struct S { static int x; };
+
+template <> struct S<0> { int x; };
+
+template  void h() {
+  S sN;
+  sN.x; // OK, value of N affects whether x is static or not.
+
+  S<2> s2;
+  s2.x;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member accessed through
+  // instance  [readability-static-accessed-through-instance]
+  // CHECK-FIXES: {{^}}  S<2>::x;{{$}}
+}
+
+void static_through_instance() {
+  C *c1 = new C();
+  c1->foo();
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member accessed through
+  // instance  [readability-static-accessed-through-instance]
+  // CHECK-FIXES: {{^}}  C::foo();{{$}}
+  c1->x;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member accessed through
+  // instance  [readability-static-accessed-through-instance]
+  // CHECK-FIXES: {{^}}  C::x;{{$}}
+  c1->nsx; // OK, nsx is a non-static member.
+
+  C::foo(); // OK, foo() is accessed using the scope operator.
+  C::x; // OK, x is accessed using the scope operator.
+
+  D d;
+  d.foo();
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member accessed through
+  // instance  [readability-static-accessed-through-instance]
+  // CHECK-FIXES: {{^}}  D::foo();{{$}}
+  d.x;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member accessed through
+  // instance  [readability-static-accessed-through-instance]
+  // CHECK-FIXES: {{^}}  D::x;{{$}}
+
+  E e;
+  e.foo();
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member accessed through
+  // instance  [readability-static-accessed-through-instance]
+  // CHECK-FIXES: {{^}}  E::foo();{{$}}
+  e.x;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member accessed through
+  // instance  [readability-static-accessed-through-instance]
+  // CHECK-FIXES: {{^}}  E::x;{{$}}
+
+  CC *cc = new CC;
+
+  f(*c1, *c1);
+  f(*cc, *c1);
+
+  // Macros: OK, macros are not checked.
+  FOO((*c1));
+  X((*c1));
+  FOO((*cc));
+  X((*cc));
+
+  // Templates
+  CT ct;
+  ct.foo();
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member accessed through
+  // instance  [readability-static-accessed-through-instance]
+  // CHECK-FIXES: {{^}}  CT::foo();{{$}}
+  ct.x;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member accessed through
+  // instance  [readability-static-accessed-through-instance]
+  // CHECK-FIXES: {{^}}  CT::x;{{$}}
+  ct.nsx; // OK, nsx is a non-static member
+
+  CCT cct;
+  cct.foo(); // OK, CCT has no static members.
+ 

r309263 - [CodeGen][ARM] ARM runtime helper functions are not always soft-fp

2017-07-27 Thread Peter Smith via cfe-commits
Author: psmith
Date: Thu Jul 27 03:43:53 2017
New Revision: 309263

URL: http://llvm.org/viewvc/llvm-project?rev=309263=rev
Log:
[CodeGen][ARM] ARM runtime helper functions are not always soft-fp

Re-commit r309257 with less precise register checks in arm-float-helpers.c
test.


Added:
cfe/trunk/test/CodeGen/arm-float-helpers.c
Modified:
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/test/CodeGen/complex-math.c

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=309263=309262=309263=diff
==
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Thu Jul 27 03:43:53 2017
@@ -5620,17 +5620,14 @@ void ARMABIInfo::setCCs() {
   // AAPCS apparently requires runtime support functions to be soft-float, but
   // that's almost certainly for historic reasons (Thumb1 not supporting VFP
   // most likely). It's more convenient for AAPCS16_VFP to be hard-float.
-  switch (getABIKind()) {
-  case APCS:
-  case AAPCS16_VFP:
-if (abiCC != getLLVMDefaultCC())
+
+  // The Run-time ABI for the ARM Architecture section 4.1.2 requires
+  // AEABI-complying FP helper functions to use the base AAPCS.
+  // These AEABI functions are expanded in the ARM llvm backend, all the 
builtin
+  // support functions emitted by clang such as the _Complex helpers follow the
+  // abiCC.
+  if (abiCC != getLLVMDefaultCC())
   BuiltinCC = abiCC;
-break;
-  case AAPCS:
-  case AAPCS_VFP:
-BuiltinCC = llvm::CallingConv::ARM_AAPCS;
-break;
-  }
 }
 
 ABIArgInfo ARMABIInfo::classifyArgumentType(QualType Ty,

Added: cfe/trunk/test/CodeGen/arm-float-helpers.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm-float-helpers.c?rev=309263=auto
==
--- cfe/trunk/test/CodeGen/arm-float-helpers.c (added)
+++ cfe/trunk/test/CodeGen/arm-float-helpers.c Thu Jul 27 03:43:53 2017
@@ -0,0 +1,233 @@
+// REQUIRES: arm-registered-target
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi %s | 
FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabihf %s | 
FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi 
-target-feature "+soft-float" -target-feature "+soft-float-abi" %s | FileCheck 
%s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi 
-target-feature "+soft-float" %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi -meabi gnu %s | 
FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi -target-feature 
"+soft-float" -target-feature "+soft-float-abi" -meabi gnu %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi -target-feature 
"+soft-float" -meabi gnu %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabihf %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabihf -meabi gnu %s | 
FileCheck %s
+
+// The Runtime ABI for the ARM Architecture IHI0043 section 4.1.2 The
+// floating-point helper functions to always use the base AAPCS (soft-float)
+// calling convention.
+//
+// These helper functions such as __aeabi_fadd are not explicitly called by
+// clang, instead they are generated by the ARMISelLowering when they are
+// needed; clang relies on llvm to use the base AAPCS.
+//
+// In this test we check that clang is not directly calling the __aeabi_
+// functions. We rely on llvm to test that the base AAPCS is used for any
+// __aeabi_ function from 4.1.2 that is used.
+//
+// When compiled to an object file with -mfloat-abi=soft each function F
+// below should result in a call to __aeabi_F. If clang is changed to call any
+// of these functions directly the test will need to be altered to check that
+// arm_aapcscc is used.
+//
+// Note that it is only the functions in 4.1.2 that must use the base AAPCS,
+// other runtime functions such as the _Complex helper routines are not 
covered.
+
+float fadd(float a, float b) { return a + b; }
+// CHECK-LABEL: define float @fadd(float %a, float %b)
+// CHECK-NOT: __aeabi_fadd
+// CHECK: %add = fadd float  {{.*}}, {{.*}}
+
+float fdiv(float a, float b) { return a / b; }
+// CHECK-LABEL: define float @fdiv(float %a, float %b)
+// CHECK-NOT: __aeabi_fdiv
+// CHECK: %div = fdiv float  {{.*}}, {{.*}}
+
+float fmul(float a, float b) { return a * b; }
+// CHECK-LABEL: define float @fmul(float %a, float %b)
+// CHECK-NOT: __aeabi_fmul
+// CHECK: %mul = fmul float  {{.*}}, {{.*}}
+
+float fsub(float a, float b) { return a - b; }
+// CHECK-LABEL: define float @fsub(float %a, float %b)
+// CHECK-NOT: __aeabi_fsub
+// CHECK: %sub = fsub float  {{.*}}, {{.*}}
+
+int fcmpeq(float 

Re: r309106 - Recommit r308327 2nd time: Add a warning for missing

2017-07-27 Thread Alex L via cfe-commits
On 26 July 2017 at 22:32, Hans Wennborg  wrote:

> On Wed, Jul 26, 2017 at 11:27 AM, Hans Wennborg  wrote:
> > On Wed, Jul 26, 2017 at 5:20 AM, Alex Lorenz via cfe-commits
> >  wrote:
> >> Author: arphaman
> >> Date: Wed Jul 26 05:20:57 2017
> >> New Revision: 309106
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=309106=rev
> >> Log:
> >> Recommit r308327 2nd time: Add a warning for missing
> >> '#pragma pack (pop)' and suspicious uses of '#pragma pack' in included
> files
> >>
> >> The first recommit (r308441) caused a "non-default #pragma pack value
> might
> >> change the alignment of struct or union members in the included file"
> warning
> >> in LLVM itself. This recommit tweaks the added warning to avoid
> warnings for
> >> #includes that don't have any records that are affected by the
> non-default
> >> alignment. This tweak avoids the previously emitted warning in LLVM.
> >>
> >> Original message:
> >>
> >> This commit adds a new -Wpragma-pack warning. It warns in the following
> cases:
> >>
> >> - When a translation unit is missing terminating #pragma pack (pop)
> directives.
> >> - When entering an included file if the current alignment value as
> determined
> >>   by '#pragma pack' directives is different from the default alignment
> value.
> >> - When leaving an included file that changed the state of the current
> alignment
> >>   value.
> >>
> >> rdar://10184173
> >>
> >> Differential Revision: https://reviews.llvm.org/D35484
> >
> > We have code in Chromium that does exactly this:
> >
> > gles2_cmd_format.h does #pragma pack(push, 4) and then #includes a
> > file with some generated structs, with the intention that the pragma
> > applies to them.
> >
> > What's the best way to pacify the warning in this case?
> >
> > (We're tracking this in
> > https://bugs.chromium.org/p/chromium/issues/detail?id=749197)
>
> I agree that cases 1) and 3) from your patch description make sense to
> warn for, but I'm not sure that's the case for 2). Do you have
> examples where this catches any bugs? In our case #pragma packing an
> included file is intentional, and I suspect it might be a bit of a
> pattern.
>

I see, thanks for your input.

2) is generally designed for times when #pragma pack pop was accidentally
used too late (after some #includes that unintentionally receive the
alignment). I can see how some projects use this pattern heavily, and I
don't think there's a good way to pacify this warning in that case.

I think that for us it would be reasonable to turn 2) off by default, and
allow users to enable it explicitly using a stronger flag (something like
-Wpragma-pack-suspicious-include?). I think that I will leave 2) out of
this commit, recommit it without 2) and then commit 2) as a non-default
warning that uses a separate flag.


> Wouldn't cases 1) and 3) catch most situations where this happens
> unintentionally? E.g. when one #includes a file that forgets to
> #pragma pop, and then includes a new file afterwards?
>
> I've reverted in r309186 in the meantime.
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r309259 - [CodeGen][ARM] Revert r309257

2017-07-27 Thread Peter Smith via cfe-commits
Author: psmith
Date: Thu Jul 27 02:57:13 2017
New Revision: 309259

URL: http://llvm.org/viewvc/llvm-project?rev=309259=rev
Log:
[CodeGen][ARM] Revert r309257

The test arm-float-helpers.c appears to be failing on some builders and
needs some work to make it more robust.


Removed:
cfe/trunk/test/CodeGen/arm-float-helpers.c
Modified:
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/test/CodeGen/complex-math.c

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=309259=309258=309259=diff
==
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Thu Jul 27 02:57:13 2017
@@ -5620,14 +5620,17 @@ void ARMABIInfo::setCCs() {
   // AAPCS apparently requires runtime support functions to be soft-float, but
   // that's almost certainly for historic reasons (Thumb1 not supporting VFP
   // most likely). It's more convenient for AAPCS16_VFP to be hard-float.
-
-  // The Run-time ABI for the ARM Architecture section 4.1.2 requires
-  // AEABI-complying FP helper functions to use the base AAPCS.
-  // These AEABI functions are expanded in the ARM llvm backend, all the 
builtin
-  // support functions emitted by clang such as the _Complex helpers follow the
-  // abiCC.
-  if (abiCC != getLLVMDefaultCC())
+  switch (getABIKind()) {
+  case APCS:
+  case AAPCS16_VFP:
+if (abiCC != getLLVMDefaultCC())
   BuiltinCC = abiCC;
+break;
+  case AAPCS:
+  case AAPCS_VFP:
+BuiltinCC = llvm::CallingConv::ARM_AAPCS;
+break;
+  }
 }
 
 ABIArgInfo ARMABIInfo::classifyArgumentType(QualType Ty,

Removed: cfe/trunk/test/CodeGen/arm-float-helpers.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm-float-helpers.c?rev=309258=auto
==
--- cfe/trunk/test/CodeGen/arm-float-helpers.c (original)
+++ cfe/trunk/test/CodeGen/arm-float-helpers.c (removed)
@@ -1,233 +0,0 @@
-// REQUIRES: arm-registered-target
-// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi %s | 
FileCheck %s
-// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabihf %s | 
FileCheck %s
-// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi 
-target-feature "+soft-float" -target-feature "+soft-float-abi" %s | FileCheck 
%s
-// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi 
-target-feature "+soft-float" %s | FileCheck %s
-// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi %s | FileCheck %s
-// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi -meabi gnu %s | 
FileCheck %s
-// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi %s | FileCheck %s
-// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi -target-feature 
"+soft-float" -target-feature "+soft-float-abi" -meabi gnu %s | FileCheck %s
-// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi -target-feature 
"+soft-float" -meabi gnu %s | FileCheck %s
-// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabihf %s | FileCheck %s
-// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabihf -meabi gnu %s | 
FileCheck %s
-
-// The Runtime ABI for the ARM Architecture IHI0043 section 4.1.2 The
-// floating-point helper functions to always use the base AAPCS (soft-float)
-// calling convention.
-//
-// These helper functions such as __aeabi_fadd are not explicitly called by
-// clang, instead they are generated by the ARMISelLowering when they are
-// needed; clang relies on llvm to use the base AAPCS.
-//
-// In this test we check that clang is not directly calling the __aeabi_
-// functions. We rely on llvm to test that the base AAPCS is used for any
-// __aeabi_ function from 4.1.2 that is used.
-//
-// When compiled to an object file with -mfloat-abi=soft each function F
-// below should result in a call to __aeabi_F. If clang is changed to call any
-// of these functions directly the test will need to be altered to check that
-// arm_aapcscc is used.
-//
-// Note that it is only the functions in 4.1.2 that must use the base AAPCS,
-// other runtime functions such as the _Complex helper routines are not 
covered.
-
-float fadd(float a, float b) { return a + b; }
-// CHECK-LABEL: define float @fadd(float %a, float %b)
-// CHECK-NOT: __aeabi_fadd
-// CHECK: %add = fadd float %0, %1
-
-float fdiv(float a, float b) { return a / b; }
-// CHECK-LABEL: define float @fdiv(float %a, float %b)
-// CHECK-NOT: __aeabi_fdiv
-// CHECK: %div = fdiv float %0, %1
-
-float fmul(float a, float b) { return a * b; }
-// CHECK-LABEL: define float @fmul(float %a, float %b)
-// CHECK-NOT: __aeabi_fmul
-// CHECK: %mul = fmul float %0, %1
-
-float fsub(float a, float b) { return a - b; }
-// CHECK-LABEL: define float @fsub(float %a, float %b)
-// CHECK-NOT: __aeabi_fsub
-// CHECK: %sub = fsub float %0, %1
-
-int fcmpeq(float a, float b) { return a == b; }
-// CHECK-LABEL: 

[PATCH] D35746: Make new PM honor -fdebug-info-for-profiling (clang side)

2017-07-27 Thread Chandler Carruth via Phabricator via cfe-commits
chandlerc accepted this revision.
chandlerc added a comment.
This revision is now accepted and ready to land.

LGTM with a tiny tweak below.

Would be good to add a test that this flag is being honored, either in this 
patch or in a follow-up.




Comment at: lib/CodeGen/BackendUtil.cpp:862-863
+PGOOpt = PGOOptions("", "", "", false, true);
+  else
+PGOOpt = None;
 

No need for this? The optional should be disengaged by default when constructed 
as you do above.


https://reviews.llvm.org/D35746



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


[PATCH] D35746: Make new PM honor -fdebug-info-for-profiling (clang side)

2017-07-27 Thread Chandler Carruth via Phabricator via cfe-commits
chandlerc added a comment.

(Also, sorry for the delay reviewing this, for some reason I thought this 
already got reviewed and landed...)


https://reviews.llvm.org/D35746



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


[PATCH] D35538: [CodeGen][ARM] ARM runtime helper functions are not always soft-fp

2017-07-27 Thread Peter Smith via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL309257: [CodeGen][ARM] ARM runtime helper functions are not 
always soft-fp (authored by psmith).

Changed prior to commit:
  https://reviews.llvm.org/D35538?vs=108245=108436#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D35538

Files:
  cfe/trunk/lib/CodeGen/TargetInfo.cpp
  cfe/trunk/test/CodeGen/arm-float-helpers.c
  cfe/trunk/test/CodeGen/complex-math.c

Index: cfe/trunk/test/CodeGen/arm-float-helpers.c
===
--- cfe/trunk/test/CodeGen/arm-float-helpers.c
+++ cfe/trunk/test/CodeGen/arm-float-helpers.c
@@ -0,0 +1,233 @@
+// REQUIRES: arm-registered-target
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabihf %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi -target-feature "+soft-float" -target-feature "+soft-float-abi" %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi -target-feature "+soft-float" %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi -meabi gnu %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi -target-feature "+soft-float" -target-feature "+soft-float-abi" -meabi gnu %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi -target-feature "+soft-float" -meabi gnu %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabihf %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabihf -meabi gnu %s | FileCheck %s
+
+// The Runtime ABI for the ARM Architecture IHI0043 section 4.1.2 The
+// floating-point helper functions to always use the base AAPCS (soft-float)
+// calling convention.
+//
+// These helper functions such as __aeabi_fadd are not explicitly called by
+// clang, instead they are generated by the ARMISelLowering when they are
+// needed; clang relies on llvm to use the base AAPCS.
+//
+// In this test we check that clang is not directly calling the __aeabi_
+// functions. We rely on llvm to test that the base AAPCS is used for any
+// __aeabi_ function from 4.1.2 that is used.
+//
+// When compiled to an object file with -mfloat-abi=soft each function F
+// below should result in a call to __aeabi_F. If clang is changed to call any
+// of these functions directly the test will need to be altered to check that
+// arm_aapcscc is used.
+//
+// Note that it is only the functions in 4.1.2 that must use the base AAPCS,
+// other runtime functions such as the _Complex helper routines are not covered.
+
+float fadd(float a, float b) { return a + b; }
+// CHECK-LABEL: define float @fadd(float %a, float %b)
+// CHECK-NOT: __aeabi_fadd
+// CHECK: %add = fadd float %0, %1
+
+float fdiv(float a, float b) { return a / b; }
+// CHECK-LABEL: define float @fdiv(float %a, float %b)
+// CHECK-NOT: __aeabi_fdiv
+// CHECK: %div = fdiv float %0, %1
+
+float fmul(float a, float b) { return a * b; }
+// CHECK-LABEL: define float @fmul(float %a, float %b)
+// CHECK-NOT: __aeabi_fmul
+// CHECK: %mul = fmul float %0, %1
+
+float fsub(float a, float b) { return a - b; }
+// CHECK-LABEL: define float @fsub(float %a, float %b)
+// CHECK-NOT: __aeabi_fsub
+// CHECK: %sub = fsub float %0, %1
+
+int fcmpeq(float a, float b) { return a == b; }
+// CHECK-LABEL: define i32 @fcmpeq(float %a, float %b)
+// CHECK-NOT: __aeabi_fcmpeq
+// CHECK: %cmp = fcmp oeq float %0, %1
+
+int fcmplt(float a, float b) { return a < b; }
+// CHECK-LABEL: define i32 @fcmplt(float %a, float %b)
+// CHECK-NOT: __aeabi_fcmplt
+// CHECK: %cmp = fcmp olt float %0, %1
+
+int fcmple(float a, float b) { return a <= b; }
+// CHECK-LABEL: define i32 @fcmple(float %a, float %b)
+// CHECK-NOT: __aeabi_fcmple
+// CHECK: %cmp = fcmp ole float %0, %1
+
+int fcmpge(float a, float b) { return a >= b; }
+// CHECK-LABEL: define i32 @fcmpge(float %a, float %b)
+// CHECK-NOT: __aeabi_fcmpge
+// CHECK: %cmp = fcmp oge float %0, %1
+
+int fcmpgt(float a, float b) { return a > b; }
+// CHECK-LABEL: define i32 @fcmpgt(float %a, float %b)
+// CHECK-NOT: __aeabi_fcmpgt
+// CHECK: %cmp = fcmp ogt float %0, %1
+
+int fcmpun(float a, float b) { return __builtin_isunordered(a, b); }
+// CHECK-LABEL: define i32 @fcmpun(float %a, float %b)
+// CHECK-NOT: __aeabi_fcmpun
+// CHECK: %cmp = fcmp uno double %conv, %conv1
+
+double dadd(double a, double b) { return a + b; }
+// CHECK-LABEL: define double @dadd(double %a, double %b)
+// CHECK-NOT: __aeabi_dadd
+// CHECK: %add = fadd double %0, %1
+
+double ddiv(double a, double b) { return a / b; }
+// CHECK-LABEL: define double @ddiv(double %a, double %b)
+// CHECK-NOT: __aeabi_ddiv
+// CHECK: %div = fdiv double %0, %1
+
+double dmul(double a, 

r309257 - [CodeGen][ARM] ARM runtime helper functions are not always soft-fp

2017-07-27 Thread Peter Smith via cfe-commits
Author: psmith
Date: Thu Jul 27 02:21:41 2017
New Revision: 309257

URL: http://llvm.org/viewvc/llvm-project?rev=309257=rev
Log:
[CodeGen][ARM] ARM runtime helper functions are not always soft-fp

The ARM Runtime ABI document (IHI0043) defines the AEABI floating point
helper functions in 4.1.2 The floating-point helper functions. These
functions always use the base PCS (soft-fp). However helper functions
defined outside of this document such as the complex-number multiply and
divide helpers are not covered by this requirement and should use
hard-float PCS if the target is hard-float as both compiler-rt and libgcc
for a hard-float sysroot implement these functions with a hard-float PCS.

All of the floating point helper functions that are explicitly soft float
are expanded in the llvm ARM backend. This change makes clang not force the
BuiltinCC to AAPCS for AAPCS_VFP. With this change the ARM compiler-rt
tests involving _Complex pass with both hard-fp and soft-fp targets.

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


Added:
cfe/trunk/test/CodeGen/arm-float-helpers.c
Modified:
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/test/CodeGen/complex-math.c

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=309257=309256=309257=diff
==
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Thu Jul 27 02:21:41 2017
@@ -5620,17 +5620,14 @@ void ARMABIInfo::setCCs() {
   // AAPCS apparently requires runtime support functions to be soft-float, but
   // that's almost certainly for historic reasons (Thumb1 not supporting VFP
   // most likely). It's more convenient for AAPCS16_VFP to be hard-float.
-  switch (getABIKind()) {
-  case APCS:
-  case AAPCS16_VFP:
-if (abiCC != getLLVMDefaultCC())
+
+  // The Run-time ABI for the ARM Architecture section 4.1.2 requires
+  // AEABI-complying FP helper functions to use the base AAPCS.
+  // These AEABI functions are expanded in the ARM llvm backend, all the 
builtin
+  // support functions emitted by clang such as the _Complex helpers follow the
+  // abiCC.
+  if (abiCC != getLLVMDefaultCC())
   BuiltinCC = abiCC;
-break;
-  case AAPCS:
-  case AAPCS_VFP:
-BuiltinCC = llvm::CallingConv::ARM_AAPCS;
-break;
-  }
 }
 
 ABIArgInfo ARMABIInfo::classifyArgumentType(QualType Ty,

Added: cfe/trunk/test/CodeGen/arm-float-helpers.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm-float-helpers.c?rev=309257=auto
==
--- cfe/trunk/test/CodeGen/arm-float-helpers.c (added)
+++ cfe/trunk/test/CodeGen/arm-float-helpers.c Thu Jul 27 02:21:41 2017
@@ -0,0 +1,233 @@
+// REQUIRES: arm-registered-target
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi %s | 
FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabihf %s | 
FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi 
-target-feature "+soft-float" -target-feature "+soft-float-abi" %s | FileCheck 
%s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi 
-target-feature "+soft-float" %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi -meabi gnu %s | 
FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi -target-feature 
"+soft-float" -target-feature "+soft-float-abi" -meabi gnu %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi -target-feature 
"+soft-float" -meabi gnu %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabihf %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabihf -meabi gnu %s | 
FileCheck %s
+
+// The Runtime ABI for the ARM Architecture IHI0043 section 4.1.2 The
+// floating-point helper functions to always use the base AAPCS (soft-float)
+// calling convention.
+//
+// These helper functions such as __aeabi_fadd are not explicitly called by
+// clang, instead they are generated by the ARMISelLowering when they are
+// needed; clang relies on llvm to use the base AAPCS.
+//
+// In this test we check that clang is not directly calling the __aeabi_
+// functions. We rely on llvm to test that the base AAPCS is used for any
+// __aeabi_ function from 4.1.2 that is used.
+//
+// When compiled to an object file with -mfloat-abi=soft each function F
+// below should result in a call to __aeabi_F. If clang is changed to call any
+// of these functions directly the test will need to be altered to check that
+// arm_aapcscc is used.
+//
+// Note that it is only the functions in 4.1.2 that must use the base AAPCS,
+// other runtime functions such as the _Complex 

[PATCH] D33820: [PowerPC] Pass CPU to assembler with -no-integrated-as

2017-07-27 Thread Nemanja Ivanovic via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL309256: [PowerPC] Pass CPU to assembler with 
-no-integrated-as (authored by nemanjai).

Changed prior to commit:
  https://reviews.llvm.org/D33820?vs=101508=108434#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D33820

Files:
  cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp
  cfe/trunk/lib/Driver/ToolChains/Arch/PPC.h
  cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
  cfe/trunk/test/Driver/linux-as.c
  cfe/trunk/test/Driver/ppc-features.cpp

Index: cfe/trunk/lib/Driver/ToolChains/Arch/PPC.h
===
--- cfe/trunk/lib/Driver/ToolChains/Arch/PPC.h
+++ cfe/trunk/lib/Driver/ToolChains/Arch/PPC.h
@@ -32,6 +32,7 @@
 FloatABI getPPCFloatABI(const Driver , const llvm::opt::ArgList );
 
 std::string getPPCTargetCPU(const llvm::opt::ArgList );
+const char *getPPCAsmModeForCPU(StringRef Name);
 
 void getPPCTargetFeatures(const Driver , const llvm::Triple ,
   const llvm::opt::ArgList ,
Index: cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp
@@ -86,6 +86,18 @@
   return "";
 }
 
+const char *ppc::getPPCAsmModeForCPU(StringRef Name) {
+  return llvm::StringSwitch(Name)
+.Case("pwr7", "-mpower7")
+.Case("power7", "-mpower7")
+.Case("pwr8", "-mpower8")
+.Case("power8", "-mpower8")
+.Case("ppc64le", "-mpower8")
+.Case("pwr9", "-mpower9")
+.Case("power9", "-mpower9")
+.Default("-many");
+}
+
 void ppc::getPPCTargetFeatures(const Driver , const llvm::Triple ,
const ArgList ,
std::vector ) {
Index: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
@@ -11,6 +11,7 @@
 #include "Linux.h"
 #include "Arch/ARM.h"
 #include "Arch/Mips.h"
+#include "Arch/PPC.h"
 #include "Arch/Sparc.h"
 #include "Arch/SystemZ.h"
 #include "CommonArgs.h"
@@ -695,22 +696,28 @@
 else
   CmdArgs.push_back("--64");
 break;
-  case llvm::Triple::ppc:
+  case llvm::Triple::ppc: {
 CmdArgs.push_back("-a32");
 CmdArgs.push_back("-mppc");
-CmdArgs.push_back("-many");
+CmdArgs.push_back(
+  ppc::getPPCAsmModeForCPU(getCPUName(Args, getToolChain().getTriple(;
 break;
-  case llvm::Triple::ppc64:
+  }
+  case llvm::Triple::ppc64: {
 CmdArgs.push_back("-a64");
 CmdArgs.push_back("-mppc64");
-CmdArgs.push_back("-many");
+CmdArgs.push_back(
+  ppc::getPPCAsmModeForCPU(getCPUName(Args, getToolChain().getTriple(;
 break;
-  case llvm::Triple::ppc64le:
+  }
+  case llvm::Triple::ppc64le: {
 CmdArgs.push_back("-a64");
 CmdArgs.push_back("-mppc64");
-CmdArgs.push_back("-many");
 CmdArgs.push_back("-mlittle-endian");
+CmdArgs.push_back(
+  ppc::getPPCAsmModeForCPU(getCPUName(Args, getToolChain().getTriple(;
 break;
+  }
   case llvm::Triple::sparc:
   case llvm::Triple::sparcel: {
 CmdArgs.push_back("-32");
Index: cfe/trunk/test/Driver/ppc-features.cpp
===
--- cfe/trunk/test/Driver/ppc-features.cpp
+++ cfe/trunk/test/Driver/ppc-features.cpp
@@ -171,8 +171,8 @@
 
 // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o -no-integrated-as 2>&1 | FileCheck -check-prefix=CHECK_LE_AS_ARGS %s
 // CHECK_LE_AS_ARGS: "-mppc64"
-// CHECK_LE_AS_ARGS: "-many"
 // CHECK_LE_AS_ARGS: "-mlittle-endian"
+// CHECK_LE_AS_ARGS: "-mpower8"
 
 // linker features
 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK_BE_LD_ARGS %s
Index: cfe/trunk/test/Driver/linux-as.c
===
--- cfe/trunk/test/Driver/linux-as.c
+++ cfe/trunk/test/Driver/linux-as.c
@@ -174,3 +174,18 @@
 // RUN:   -no-integrated-as -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK-Z-ARCH-Z196 %s
 // CHECK-Z-ARCH-Z196: as{{.*}} "-march=z196"
+//
+// RUN: %clang -target powerpc64le-linux -### \
+// RUN:   -no-integrated-as -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-PPC64LE %s
+// CHECK-PPC64LE: as{{.*}} "-mpower8"
+//
+// RUN: %clang -target powerpc64-linux -mcpu=pwr7 -### \
+// RUN:   -no-integrated-as -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-PPC64 %s
+// CHECK-PPC64: as{{.*}} "-mpower7"
+//
+// RUN: %clang -target powerpc-linux -mcpu=pwr9 -### \
+// RUN:   -no-integrated-as -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-PPC32 %s
+// CHECK-PPC32: as{{.*}} "-mpower9"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org

r309256 - [PowerPC] Pass CPU to assembler with -no-integrated-as

2017-07-27 Thread Nemanja Ivanovic via cfe-commits
Author: nemanjai
Date: Thu Jul 27 01:58:28 2017
New Revision: 309256

URL: http://llvm.org/viewvc/llvm-project?rev=309256=rev
Log:
[PowerPC] Pass CPU to assembler with -no-integrated-as

This just adds the CPU to a list of commands passed to GAS when not using the
integrated assembler.

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

Modified:
cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp
cfe/trunk/lib/Driver/ToolChains/Arch/PPC.h
cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
cfe/trunk/test/Driver/linux-as.c
cfe/trunk/test/Driver/ppc-features.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp?rev=309256=309255=309256=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp Thu Jul 27 01:58:28 2017
@@ -86,6 +86,18 @@ std::string ppc::getPPCTargetCPU(const A
   return "";
 }
 
+const char *ppc::getPPCAsmModeForCPU(StringRef Name) {
+  return llvm::StringSwitch(Name)
+.Case("pwr7", "-mpower7")
+.Case("power7", "-mpower7")
+.Case("pwr8", "-mpower8")
+.Case("power8", "-mpower8")
+.Case("ppc64le", "-mpower8")
+.Case("pwr9", "-mpower9")
+.Case("power9", "-mpower9")
+.Default("-many");
+}
+
 void ppc::getPPCTargetFeatures(const Driver , const llvm::Triple ,
const ArgList ,
std::vector ) {

Modified: cfe/trunk/lib/Driver/ToolChains/Arch/PPC.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Arch/PPC.h?rev=309256=309255=309256=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Arch/PPC.h (original)
+++ cfe/trunk/lib/Driver/ToolChains/Arch/PPC.h Thu Jul 27 01:58:28 2017
@@ -32,6 +32,7 @@ enum class FloatABI {
 FloatABI getPPCFloatABI(const Driver , const llvm::opt::ArgList );
 
 std::string getPPCTargetCPU(const llvm::opt::ArgList );
+const char *getPPCAsmModeForCPU(StringRef Name);
 
 void getPPCTargetFeatures(const Driver , const llvm::Triple ,
   const llvm::opt::ArgList ,

Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Gnu.cpp?rev=309256=309255=309256=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp Thu Jul 27 01:58:28 2017
@@ -11,6 +11,7 @@
 #include "Linux.h"
 #include "Arch/ARM.h"
 #include "Arch/Mips.h"
+#include "Arch/PPC.h"
 #include "Arch/Sparc.h"
 #include "Arch/SystemZ.h"
 #include "CommonArgs.h"
@@ -695,22 +696,28 @@ void tools::gnutools::Assembler::Constru
 else
   CmdArgs.push_back("--64");
 break;
-  case llvm::Triple::ppc:
+  case llvm::Triple::ppc: {
 CmdArgs.push_back("-a32");
 CmdArgs.push_back("-mppc");
-CmdArgs.push_back("-many");
+CmdArgs.push_back(
+  ppc::getPPCAsmModeForCPU(getCPUName(Args, getToolChain().getTriple(;
 break;
-  case llvm::Triple::ppc64:
+  }
+  case llvm::Triple::ppc64: {
 CmdArgs.push_back("-a64");
 CmdArgs.push_back("-mppc64");
-CmdArgs.push_back("-many");
+CmdArgs.push_back(
+  ppc::getPPCAsmModeForCPU(getCPUName(Args, getToolChain().getTriple(;
 break;
-  case llvm::Triple::ppc64le:
+  }
+  case llvm::Triple::ppc64le: {
 CmdArgs.push_back("-a64");
 CmdArgs.push_back("-mppc64");
-CmdArgs.push_back("-many");
 CmdArgs.push_back("-mlittle-endian");
+CmdArgs.push_back(
+  ppc::getPPCAsmModeForCPU(getCPUName(Args, getToolChain().getTriple(;
 break;
+  }
   case llvm::Triple::sparc:
   case llvm::Triple::sparcel: {
 CmdArgs.push_back("-32");

Modified: cfe/trunk/test/Driver/linux-as.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/linux-as.c?rev=309256=309255=309256=diff
==
--- cfe/trunk/test/Driver/linux-as.c (original)
+++ cfe/trunk/test/Driver/linux-as.c Thu Jul 27 01:58:28 2017
@@ -174,3 +174,18 @@
 // RUN:   -no-integrated-as -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK-Z-ARCH-Z196 %s
 // CHECK-Z-ARCH-Z196: as{{.*}} "-march=z196"
+//
+// RUN: %clang -target powerpc64le-linux -### \
+// RUN:   -no-integrated-as -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-PPC64LE %s
+// CHECK-PPC64LE: as{{.*}} "-mpower8"
+//
+// RUN: %clang -target powerpc64-linux -mcpu=pwr7 -### \
+// RUN:   -no-integrated-as -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-PPC64 %s
+// CHECK-PPC64: as{{.*}} "-mpower7"
+//
+// RUN: %clang -target powerpc-linux -mcpu=pwr9 -### \
+// RUN:   -no-integrated-as -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-PPC32 %s
+// CHECK-PPC32: 

[PATCH] D35932: [clang-tidy] Add integer division check

2017-07-27 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs created this revision.
rnkovacs added a project: clang-tools-extra.
Herald added subscribers: baloghadamsoftware, JDevlieghere, mgorny.

Finds integer divisions in environments expecting floating-point values.

Examples of possibly unintended precision loss:

  sin(7 / (2 + 3));
  abs(sin(1 + 7 / 2));

The following expressions are presumably deliberate:

  sin(abs(1 + 7 / 2));
  1 << 2 / 3;




https://reviews.llvm.org/D35932

Files:
  clang-tidy/bugprone/BugproneTidyModule.cpp
  clang-tidy/bugprone/CMakeLists.txt
  clang-tidy/bugprone/IntegerDivisionCheck.cpp
  clang-tidy/bugprone/IntegerDivisionCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/bugprone-integer-division.rst
  docs/clang-tidy/checks/list.rst
  test/clang-tidy/bugprone-integer-division.cpp

Index: test/clang-tidy/bugprone-integer-division.cpp
===
--- /dev/null
+++ test/clang-tidy/bugprone-integer-division.cpp
@@ -0,0 +1,130 @@
+// RUN: %check_clang_tidy %s bugprone-integer-division %t
+
+// Functions expecting a floating-point parameter.
+void floatArg(float x) {}
+void doubleArg(double x) {}
+void longDoubleArg(long double x) {}
+
+// Functions expected to return a floating-point value.
+float singleDiv() {
+  int x = -5;
+  int y = 2;
+  return x/y;
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: integer division; possible precision loss [bugprone-integer-division]
+}
+
+double wrongOrder(int x, int y) {
+  return x/y/0.1;
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: integer division; possible precision loss [bugprone-integer-division]
+}
+
+long double rightOrder(int x, int y) {
+  return 0.1/x/y; // OK
+}
+
+// Typical mathematical functions.
+float sin(float);
+double acos(double);
+long double tanh(long double);
+
+namespace std {
+  using ::sin;
+}
+
+template 
+void intDivSin(T x) {
+  sin(x);
+}
+
+int intFunc(int);
+
+struct X {
+  int n;
+  void m() {
+sin(n / 3);
+// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: integer division; possible precision loss [bugprone-integer-division]
+  }
+};
+
+void integerDivision() {
+  char a = 2;
+  short b = -5;
+  int c = 9784;
+  enum third { x, y, z=2 };
+  third d = z;
+  char e[] = {'a', 'b', 'c'};
+  char f = *(e + 1 / a);
+  bool g = 1;
+
+  sin(c / (2 + 2));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: integer division; possible precision loss [bugprone-integer-division]
+  sin(c / (1 + .5));
+  sin((c + .5) / 3);
+
+  sin(intFunc(3) / 5);
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: integer division; possible precision loss [bugprone-integer-division]
+  acos(2 / intFunc(7));
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: integer division; possible precision loss [bugprone-integer-division]
+
+  floatArg(1 + 2 / 3);
+// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: integer division; possible precision loss [bugprone-integer-division]
+  sin(1 + 2 / 3);
+// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: integer division; possible precision loss [bugprone-integer-division]
+  intFunc(sin(1 + 2 / 3));
+// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: integer division; possible precision loss [bugprone-integer-division]
+
+  floatArg(1 + intFunc(1 + 2 / 3));
+  floatArg(1 + 3 * intFunc(a / b));
+
+  1 << 2 / 3;
+  1 << intFunc(2 / 3);
+
+#define M_SIN sin(a / b);
+  M_SIN
+// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: integer division; possible precision loss [bugprone-integer-division]
+
+  intDivSin(a / b);
+// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: integer division; possible precision loss [bugprone-integer-division]
+  intDivSin(c / d);
+// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: integer division; possible precision loss [bugprone-integer-division]
+  intDivSin(f / g);
+// CHECK-MESSAGES: :[[@LINE-1]]:26: warning: integer division; possible precision loss [bugprone-integer-division]
+
+  floatArg(1 / 3);
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: integer division; possible precision loss [bugprone-integer-division]
+  doubleArg(a / b);
+// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: integer division; possible precision loss [bugprone-integer-division]
+  longDoubleArg(3 / d);
+// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: integer division; possible precision loss [bugprone-integer-division]
+  floatArg(a / b / 0.1);
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: integer division; possible precision loss [bugprone-integer-division]
+  doubleArg(1 / 3 / 0.1);
+// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: integer division; possible precision loss [bugprone-integer-division]
+  longDoubleArg(2 / 3 / 5);
+// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: integer division; possible precision loss [bugprone-integer-division]
+
+  std::sin(2 / 3);
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: integer division; possible precision loss [bugprone-integer-division]
+  ::acos(7 / d);
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: integer division; possible precision loss [bugprone-integer-division]
+  tanh(f / g);
+// CHECK-MESSAGES: 

[PATCH] D35930: [CMake] Include sancov tool in Fuchsia toolchain

2017-07-27 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
Herald added a subscriber: mgorny.

Repository:
  rL LLVM

https://reviews.llvm.org/D35930

Files:
  cmake/caches/Fuchsia-stage2.cmake


Index: cmake/caches/Fuchsia-stage2.cmake
===
--- cmake/caches/Fuchsia-stage2.cmake
+++ cmake/caches/Fuchsia-stage2.cmake
@@ -68,6 +68,7 @@
   llvm-size
   llvm-symbolizer
   opt
+  sancov
   CACHE STRING "")
 
 set(LLVM_DISTRIBUTION_COMPONENTS


Index: cmake/caches/Fuchsia-stage2.cmake
===
--- cmake/caches/Fuchsia-stage2.cmake
+++ cmake/caches/Fuchsia-stage2.cmake
@@ -68,6 +68,7 @@
   llvm-size
   llvm-symbolizer
   opt
+  sancov
   CACHE STRING "")
 
 set(LLVM_DISTRIBUTION_COMPONENTS
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits