r256243 - [OpenCL] Fix atomic Builtins check for address spaces of non-atomic pointer

2015-12-22 Thread Anastasia Stulova via cfe-commits
Author: stulova
Date: Tue Dec 22 09:14:54 2015
New Revision: 256243

URL: http://llvm.org/viewvc/llvm-project?rev=256243=rev
Log:
[OpenCL] Fix atomic Builtins check for address spaces of non-atomic pointer

If there are two pointers passed to an atomic Builtin, 
Clang doesn't allow the second (non-atomic) one to be qualified
with an address space.

Remove this restriction by recording the address space of passed pointers
in atomics type diagnostics.


Modified:
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/test/CodeGen/atomic-ops.c
cfe/trunk/test/Sema/atomic-ops.c

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=256243=256242=256243=diff
==
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Tue Dec 22 09:14:54 2015
@@ -1801,8 +1801,17 @@ ExprResult Sema::SemaAtomicOpsOverloaded
   Ty = ByValType;
 else if (Form == Arithmetic)
   Ty = Context.getPointerDiffType();
-else
-  Ty = Context.getPointerType(ValType.getUnqualifiedType());
+else {
+  Expr *ValArg = TheCall->getArg(i);
+  unsigned AS = 0;
+  // Keep address space of non-atomic pointer type.
+  if (const PointerType *PtrTy =
+  ValArg->getType()->getAs()) {
+AS = PtrTy->getPointeeType().getAddressSpace();
+  }
+  Ty = Context.getPointerType(
+  Context.getAddrSpaceQualType(ValType.getUnqualifiedType(), AS));
+}
 break;
   case 2:
 // The third argument to compare_exchange / GNU exchange is a

Modified: cfe/trunk/test/CodeGen/atomic-ops.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/atomic-ops.c?rev=256243=256242=256243=diff
==
--- cfe/trunk/test/CodeGen/atomic-ops.c (original)
+++ cfe/trunk/test/CodeGen/atomic-ops.c Tue Dec 22 09:14:54 2015
@@ -1,10 +1,10 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - -ffreestanding 
-triple=i686-apple-darwin9 | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -ffreestanding -ffake-address-space-map 
-triple=i686-apple-darwin9 | FileCheck %s
 // REQUIRES: x86-registered-target
 
 // Also test serialization of atomic operations here, to avoid duplicating the
 // test.
-// RUN: %clang_cc1 %s -emit-pch -o %t -ffreestanding -triple=i686-apple-darwin9
-// RUN: %clang_cc1 %s -include-pch %t -ffreestanding 
-triple=i686-apple-darwin9 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-pch -o %t -ffreestanding -ffake-address-space-map 
-triple=i686-apple-darwin9
+// RUN: %clang_cc1 %s -include-pch %t -ffreestanding -ffake-address-space-map 
-triple=i686-apple-darwin9 -emit-llvm -o - | FileCheck %s
 #ifndef ALREADY_INCLUDED
 #define ALREADY_INCLUDED
 
@@ -155,6 +155,14 @@ _Bool fi4c(atomic_int *i) {
   return atomic_compare_exchange_strong(i, , 1);
 }
 
+#define _AS1 __attribute__((address_space(1)))
+_Bool fi4d(_Atomic(int) *i, int _AS1 *ptr2) {
+  // CHECK-LABEL: @fi4d(
+  // CHECK: [[EXPECTED:%[.0-9A-Z_a-z]+]] = load i32, i32 addrspace(1)* 
%{{[0-9]+}}
+  // CHECK: cmpxchg i32* %{{[0-9]+}}, i32 [[EXPECTED]], i32 %{{[0-9]+}} 
acquire acquire
+  return __c11_atomic_compare_exchange_strong(i, ptr2, 1, 
memory_order_acquire, memory_order_acquire);
+}
+
 float ff1(_Atomic(float) *d) {
   // CHECK-LABEL: @ff1
   // CHECK: load atomic i32, i32* {{.*}} monotonic

Modified: cfe/trunk/test/Sema/atomic-ops.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/atomic-ops.c?rev=256243=256242=256243=diff
==
--- cfe/trunk/test/Sema/atomic-ops.c (original)
+++ cfe/trunk/test/Sema/atomic-ops.c Tue Dec 22 09:14:54 2015
@@ -85,6 +85,9 @@ _Static_assert(__atomic_always_lock_free
 _Static_assert(!__atomic_always_lock_free(8, ), "");
 _Static_assert(__atomic_always_lock_free(8, ), "");
 
+#define _AS1 __attribute__((address_space(1)))
+#define _AS2 __attribute__((address_space(2)))
+
 void f(_Atomic(int) *i, const _Atomic(int) *ci,
_Atomic(int*) *p, _Atomic(float) *d,
int *I, const int *CI,
@@ -190,6 +193,9 @@ void f(_Atomic(int) *i, const _Atomic(in
   (void)__atomic_compare_exchange(CI, I, I, 0, memory_order_seq_cst, 
memory_order_seq_cst); // expected-error {{address argument to atomic operation 
must be a pointer to non-const type ('const int *' invalid)}}
   (void)__atomic_compare_exchange(I, CI, I, 0, memory_order_seq_cst, 
memory_order_seq_cst); // expected-warning {{passing 'const int *' to parameter 
of type 'int *' discards qualifiers}}
 
+  // Pointers to different address spaces are allowed.
+  _Bool cmpexch_10 = __c11_atomic_compare_exchange_strong((_Atomic int _AS1 
*)0x308, (int _AS2 *)0x309, 1, memory_order_seq_cst, memory_order_seq_cst);
+
   const volatile int 

Re: [PATCH] D14354: Add new compiler flag to enable the generation of dwarf accelerator tables

2015-12-22 Thread Tamas Berghammer via cfe-commits
tberghammer abandoned this revision.
tberghammer added a comment.

Thank you for adding the new debugger tuning feature. I am using LLDB so 
"-glldb" will work for me perfectly.

There is one thing we might consider is that the accelerator tables increasing 
the size of the binary by ~10% (measured on clang) so I don't know if we want 
to enable them by default or not on any platform.


http://reviews.llvm.org/D14354



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


RE: [Patch][OpenCL] Custom atomic Builtin check ignores address space of a non-atomic pointer

2015-12-22 Thread Anastasia Stulova via cfe-commits
Thanks! 

Committed with a slight modification as address spaces are now handled 
correctly by convertToAtomicIntPointer helper method!

Cheers
Anastasia 

-Original Message-
From: Pekka Jääskeläinen [mailto:pekka.jaaskelai...@tut.fi] 
Sent: 17 December 2015 08:35
To: Anastasia Stulova; cfe-commits@lists.llvm.org
Cc: nd
Subject: Re: [Patch][OpenCL] Custom atomic Builtin check ignores address space 
of a non-atomic pointer

Hi Anastasia,

Still LGTM.

Pekka

On 16.12.2015 16:42, Anastasia Stulova wrote:
> Hi Pekka,
>
> Re-attaching as a full patch again as something went wrong earlier with the 
> diff wrapping in the email.
>
> Thanks,
> Anastasia
>
> -Original Message-
> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On 
> Behalf Of Anastasia Stulova via cfe-commits
> Sent: 07 December 2015 17:25
> To: 'Pekka Jääskeläinen'; cfe-commits@lists.llvm.org
> Subject: RE: [Patch][OpenCL] Custom atomic Builtin check ignores 
> address space of a non-atomic pointer
>
> Could someone jump in, please!
>
> I have made a small improvement in testing after the patch has been first 
> approved by Pekka.
>
> The last change is essentially this:
>
> Index: test/CodeGen/atomic-ops.c
> ===
> --- test/CodeGen/atomic-ops.c (revision 250025)
> +++ test/CodeGen/atomic-ops.c (working copy)
> @@ -1,10 +1,10 @@
> -// RUN: %clang_cc1 %s -emit-llvm -o - -ffreestanding 
> -triple=i686-apple-darwin9 | FileCheck %s
> +// RUN: %clang_cc1 %s -emit-llvm -o - -ffreestanding 
> +-ffake-address-space-map -triple=i686-apple-darwin9 | FileCheck %s
>   // REQUIRES: x86-registered-target
>
>   // Also test serialization of atomic operations here, to avoid duplicating 
> the  // test.
> -// RUN: %clang_cc1 %s -emit-pch -o %t -ffreestanding 
> -triple=i686-apple-darwin9 -// RUN: %clang_cc1 %s -include-pch %t 
> -ffreestanding -triple=i686-apple-darwin9 -emit-llvm -o - | FileCheck 
> %s
> +// RUN: %clang_cc1 %s -emit-pch -o %t -ffreestanding 
> +-ffake-address-space-map -triple=i686-apple-darwin9 // RUN: 
> +%clang_cc1 %s -include-pch %t -ffreestanding -ffake-address-space-map
> +-triple=i686-apple-darwin9 -emit-llvm -o - | FileCheck %s
>   #ifndef ALREADY_INCLUDED
>   #define ALREADY_INCLUDED
>
> @@ -155,6 +155,14 @@
> return atomic_compare_exchange_strong(i, , 1);  }
>
> +#define _AS1 __attribute__((address_space(1))) _Bool 
> +fi4d(_Atomic(int) *i, int _AS1 *ptr2) {
> +  // CHECK-LABEL: @fi4d(
> +  // CHECK: [[EXPECTED:%[.0-9A-Z_a-z]+]] = load i32, i32 
> +addrspace(1)* %{{[0-9]+}}
> +  // CHECK: cmpxchg i32* %{{[0-9]+}}, i32 [[EXPECTED]], i32 
> +%{{[0-9]+}} acquire acquire
> +  return __c11_atomic_compare_exchange_strong(i, ptr2, 1, 
> +memory_order_acquire, memory_order_acquire); }
> +
>   float ff1(_Atomic(float) *d) {
> // CHECK-LABEL: @ff1
> // CHECK: load atomic i32, i32* {{.*}} monotonic
>
>
> Thank you!
>
> Anastasia
>
> -Original Message-
> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On 
> Behalf Of Anastasia Stulova via cfe-commits
> Sent: 23 November 2015 10:32
> To: cfe-commits@lists.llvm.org; 'Pekka Jääskeläinen'
> Subject: RE: [Patch][OpenCL] Custom atomic Builtin check ignores 
> address space of a non-atomic pointer
>
> Ping! Re-attaching the final patch.
>
> -Original Message-
> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On 
> Behalf Of Anastasia Stulova via cfe-commits
> Sent: 21 October 2015 11:49
> To: 'Pekka Jääskeläinen'; cfe-commits@lists.llvm.org
> Subject: RE: [Patch][OpenCL] Custom atomic Builtin check ignores 
> address space of a non-atomic pointer
>
> Hi Pekka,
>
> Are you ok with this change?
>
> Thanks,
> Anastasia
>
> -Original Message-
> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On 
> Behalf Of Anastasia Stulova via cfe-commits
> Sent: 12 October 2015 16:00
> To: 'Pekka Jääskeläinen'; cfe-commits@lists.llvm.org
> Subject: RE: [Patch][OpenCL] Custom atomic Builtin check ignores 
> address space of a non-atomic pointer
>
> I have just made one minor update in the CodeGen test 
> (test/CodeGen/atomic-ops.c) that is now checking the IR output rather than 
> only making sure frontend doesn't crash.
>
> The final patch is attached here!
>
> Thanks,
> Anastasia
>
>
> -Original Message-
> From: Pekka Jääskeläinen [mailto:pekka.jaaskelai...@tut.fi]
> Sent: 02 October 2015 10:20
> To: Anastasia Stulova; cfe-commits@lists.llvm.org
> Subject: Re: [Patch][OpenCL] Custom atomic Builtin check ignores 
> address space of a non-atomic pointer
>
> LGTM.
>
> Related to it:
> There has been so many getPointerTo() issues with multi-AS in the past that I 
> wonder if it'd be time to drop the default value from it, and go through all 
> the places where it's called with the default AS, thus breaking multi-AS.  
> Might be a worthwhile job to do at some point.
>
> On 09/30/2015 01:23 PM, Anastasia Stulova via cfe-commits wrote:
>> Hi all,
>>

Re: [PATCH] D15710: [clang-tidy] Add non-inline function definition and variable definition check in header files.

2015-12-22 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments.


Comment at: clang-tidy/google/DefinitionsInHeadersCheck.cpp:23
@@ +22,3 @@
+bool inHeaderFile(const SourceManager* SM,
+  const SourceLocation& Location) {
+  StringRef Filename = SM->getFilename(SM->getExpansionLoc(Location));

`SourceLocations` are small and trivially-copyable, they should be passed by 
value.


Comment at: clang-tidy/google/DefinitionsInHeadersCheck.cpp:31
@@ +30,3 @@
+void DefinitionsInHeadersCheck::registerMatchers(MatchFinder *Finder) {
+  Finder->addMatcher(functionDecl(isDefinition()).bind("fun-definition"), 
this);
+  Finder->addMatcher(varDecl(isDefinition()).bind("var-definition"), this);

I'd use a single matcher for both functions and variables 
(`decl(anyOf(functionDecl(), varDecl()), isDefinition()).bind("decl")`) to 
avoid duplicating code in the callback.


Comment at: clang-tidy/google/DefinitionsInHeadersCheck.cpp:42
@@ +41,3 @@
+  // appears in a different translation unit, and provided the definitions
+  // satisfy the following requirements. (C++ basic.def.odr)
+  if (auto funDecl = Result.Nodes.getNodeAs("fun-definition")) {

Please put the `C++ [basic.def.odr]:` part before the quotation from the 
standard.


Comment at: clang-tidy/google/DefinitionsInHeadersCheck.cpp:43
@@ +42,3 @@
+  // satisfy the following requirements. (C++ basic.def.odr)
+  if (auto funDecl = Result.Nodes.getNodeAs("fun-definition")) {
+if (!inHeaderFile(Result.SourceManager, funDecl->getLocStart()))

Please use `const auto *` to make it clear that this is a pointer. Same 
elsewhere.


Comment at: clang-tidy/google/DefinitionsInHeadersCheck.cpp:52
@@ +51,3 @@
+// Inline function is allowed.
+if (funDecl->isInlined())
+  return;

This check can be done in the matcher.


Comment at: clang-tidy/google/DefinitionsInHeadersCheck.cpp:62
@@ +61,3 @@
+if (auto cxxMethodDecl = dyn_cast(funDecl)) {
+  if (cxxMethodDecl->getParent()->getDescribedClassTemplate()) {
+return;

nit: No braces needed here.


Comment at: clang-tidy/google/DefinitionsInHeadersCheck.cpp:68
@@ +67,3 @@
+diag(funDecl->getLocation(),
+ "function definition is not allowed in header file.")
+<< FixItHint::CreateInsertion(funDecl->getSourceRange().getBegin(),

Warning messages are not full sentences. No trailing period is needed.


Comment at: clang-tidy/google/DefinitionsInHeadersCheck.h:17
@@ +16,3 @@
+namespace tidy {
+namespace google {
+

This check is generic enough. It should go to the `misc` module, IMO.


Comment at: clang-tidy/google/DefinitionsInHeadersCheck.h:19
@@ +18,3 @@
+
+// Finds non-inline function definition and variable definition in headers,
+// which may violate cpp one definition rule.

This would read slightly better: "Finds non-extern non-inline function and 
variable definitions in header files, which can lead to ODR violations."


Comment at: clang-tidy/google/DefinitionsInHeadersCheck.h:20
@@ +19,3 @@
+// Finds non-inline function definition and variable definition in headers,
+// which may violate cpp one definition rule.
+class DefinitionsInHeadersCheck : public ClangTidyCheck {

Please add a link to the user-facing documentation:

  // For the user-facing documentation see:
  // http://clang.llvm.org/extra/clang-tidy/checks/.html


Comment at: docs/clang-tidy/checks/google-definitions-in-headers.rst:4
@@ +3,3 @@
+
+Finds non-inline function definition and variable definition in headers, which
+may violate cpp one definition rule.

Please update the wording to match the class comment, and also add a couple of 
examples of what cases does the check detect.


Comment at: unittests/clang-tidy/GoogleModuleTest.cpp:140
@@ +139,3 @@
+ "}", "foo.h"));
+  EXPECT_EQ(errorMessage, runCheckOnCode("template \n"
+ "T f() {\n"

I think, we can already use raw string literals (at least, MSVC 2013 seems to 
support them). Raw string literals would make the test cases more readable, imo.


Repository:
  rL LLVM

http://reviews.llvm.org/D15710



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


[clang-tools-extra] r256261 - [clang-tidy] Added documentation for modernize-redundant-void-arg

2015-12-22 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Tue Dec 22 12:13:00 2015
New Revision: 256261

URL: http://llvm.org/viewvc/llvm-project?rev=256261=rev
Log:
[clang-tidy] Added documentation for modernize-redundant-void-arg

Added:

clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-redundant-void-arg.rst
Modified:
clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst

Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst?rev=256261=256260=256261=diff
==
--- clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst Tue Dec 22 12:13:00 
2015
@@ -61,6 +61,7 @@ Clang-Tidy Checks
modernize-loop-convert
modernize-make-unique
modernize-pass-by-value
+   modernize-redundant-void-arg
modernize-replace-auto-ptr
modernize-shrink-to-fit
modernize-use-auto

Added: 
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-redundant-void-arg.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-redundant-void-arg.rst?rev=256261=auto
==
--- 
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-redundant-void-arg.rst 
(added)
+++ 
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-redundant-void-arg.rst 
Tue Dec 22 12:13:00 2015
@@ -0,0 +1,18 @@
+.. title:: clang-tidy - modernize-redundant-void-arg
+
+modernize-redundant-void-arg
+
+
+Find and remove redundant ``void`` argument lists.
+
+Examples:
+  ===  ===
+  Initial code Code with applied fixes
+  ===  ===
+  ``int f(void);`` ``int f();``
+  ``int (*f(void))(void);````int (*f())();``
+  ``typedef int (*f_t(void))(void);``  ``typedef int (*f_t())();``
+  ``void (C::*p)(void);``  ``void (C::*p)();``
+  ``C::C(void) {}````C::C() {}``
+  ``C::~C(void) {}``   ``C::~C() {}``
+  ===  ===


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


[PATCH] D15721: [Sema] Fix ICE on casting a vector of bools to a vector of T

2015-12-22 Thread George Burgess IV via cfe-commits
george.burgess.iv created this revision.
george.burgess.iv added a reviewer: Anastasia.
george.burgess.iv added a subscriber: cfe-commits.

Clang generally treats booleans as 8-bit types, but lowers them to 1-bit types. 
This means we currently happily accept C++ code like:

```
typedef __attribute__((__ext_vector_type__(4))) bool BoolVector; 
typedef __attribute__((__ext_vector_type__(1))) int IntVector;

int main() {
  BoolVector bv;
  IntVector iv = (IntVector)bv;
}
```

...And lower it to a cast from a `[4 x i1]` to a `[1 x i32]`. Which gives us a 
nice greeting in the form of an ICE.

ISTM that `bool`s are only a valid element type in OpenCL vectors. The spec 
doesn't outline a definitive size for a `bool` (only that it must be able to 
support a 0 or 1), so I'm assuming that lowering to a vector of `i1` is fine.

http://reviews.llvm.org/D15721

Files:
  lib/Sema/SemaExpr.cpp
  test/CodeGenCXX/bool-vector-conversion.cpp

Index: test/CodeGenCXX/bool-vector-conversion.cpp
===
--- /dev/null
+++ test/CodeGenCXX/bool-vector-conversion.cpp
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+//
+// In many parts of clang, we treat a bool as an i8, but we lower it to an i1.
+// This is usually fine, but it broke things with vectors (e.g. we deemed a 
cast
+// from a [4 x i1] to a [1 x i32] to be legal, and proceeded to crash shortly
+// afterward).
+
+// Nothing but OpenCL allows vectors of booleans.
+// CHECK-LABEL: @_Z4testv
+void test() {
+  typedef __attribute__((__ext_vector_type__(8))) bool CLVectorBool8;
+  typedef __attribute__((__ext_vector_type__(1))) unsigned char CLVectorInt1;
+
+  // CHECK: store <8 x i1> zeroinitializer
+  CLVectorBool8 bools = (CLVectorBool8)false;
+  // CHECK: store <1 x i8>
+  CLVectorInt1 ints = (CLVectorInt1)bools;
+  // CHECK: store <8 x i1>
+  bools = (CLVectorBool8)ints;
+
+  // Run through the code in CGExprConstant.
+  // CHECK: store <8 x i1> zeroinitializer
+  bools = (CLVectorBool8)(CLVectorInt1)(CLVectorBool8)false;
+}
+
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -5552,9 +5552,14 @@
   // ASTContext::getTypeSize will return the size rounded up to a
   // power of 2, so instead of using that, we need to use the raw
   // element size multiplied by the element count.
-  uint64_t srcEltSize = Context.getTypeSize(srcEltTy);
-  uint64_t destEltSize = Context.getTypeSize(destEltTy);
-  
+  //
+  // We need to be careful about booleans though; they're lowered to i1s, but
+  // getTypeSize views them as i8s.
+  uint64_t srcEltSize =
+  srcEltTy->isBooleanType() ? 1 : Context.getTypeSize(srcEltTy);
+  uint64_t destEltSize =
+  destEltTy->isBooleanType() ? 1 : Context.getTypeSize(destEltTy);
+
   return (srcLen * srcEltSize == destLen * destEltSize);
 }
 


Index: test/CodeGenCXX/bool-vector-conversion.cpp
===
--- /dev/null
+++ test/CodeGenCXX/bool-vector-conversion.cpp
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+//
+// In many parts of clang, we treat a bool as an i8, but we lower it to an i1.
+// This is usually fine, but it broke things with vectors (e.g. we deemed a cast
+// from a [4 x i1] to a [1 x i32] to be legal, and proceeded to crash shortly
+// afterward).
+
+// Nothing but OpenCL allows vectors of booleans.
+// CHECK-LABEL: @_Z4testv
+void test() {
+  typedef __attribute__((__ext_vector_type__(8))) bool CLVectorBool8;
+  typedef __attribute__((__ext_vector_type__(1))) unsigned char CLVectorInt1;
+
+  // CHECK: store <8 x i1> zeroinitializer
+  CLVectorBool8 bools = (CLVectorBool8)false;
+  // CHECK: store <1 x i8>
+  CLVectorInt1 ints = (CLVectorInt1)bools;
+  // CHECK: store <8 x i1>
+  bools = (CLVectorBool8)ints;
+
+  // Run through the code in CGExprConstant.
+  // CHECK: store <8 x i1> zeroinitializer
+  bools = (CLVectorBool8)(CLVectorInt1)(CLVectorBool8)false;
+}
+
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -5552,9 +5552,14 @@
   // ASTContext::getTypeSize will return the size rounded up to a
   // power of 2, so instead of using that, we need to use the raw
   // element size multiplied by the element count.
-  uint64_t srcEltSize = Context.getTypeSize(srcEltTy);
-  uint64_t destEltSize = Context.getTypeSize(destEltTy);
-  
+  //
+  // We need to be careful about booleans though; they're lowered to i1s, but
+  // getTypeSize views them as i8s.
+  uint64_t srcEltSize =
+  srcEltTy->isBooleanType() ? 1 : Context.getTypeSize(srcEltTy);
+  uint64_t destEltSize =
+  destEltTy->isBooleanType() ? 1 : Context.getTypeSize(destEltTy);
+
   return (srcLen * srcEltSize == destLen * destEltSize);
 }
 
___
cfe-commits 

r256278 - [ASTMatchers] Add booleanType() matcher.

2015-12-22 Thread Samuel Benzaquen via cfe-commits
Author: sbenza
Date: Tue Dec 22 14:06:40 2015
New Revision: 256278

URL: http://llvm.org/viewvc/llvm-project?rev=256278=rev
Log:
[ASTMatchers] Add booleanType() matcher.

Modified:
cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=256278=256277=256278=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Tue Dec 22 14:06:40 2015
@@ -3762,6 +3762,18 @@ AST_MATCHER_FUNCTION_P_OVERLOAD(internal
   new internal::TypeLocTypeMatcher(InnerMatcher));
 }
 
+/// \brief Matches type \c bool.
+///
+/// Given
+/// \code
+///  struct S { bool func(); };
+/// \endcode
+/// functionDecl(returns(boolType()))
+///   matches "bool func();"
+AST_MATCHER(Type, booleanType) {
+  return Node.isBooleanType();
+}
+
 /// \brief Matches type \c void.
 ///
 /// Given

Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp?rev=256278=256277=256278=diff
==
--- cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp (original)
+++ cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp Tue Dec 22 14:06:40 2015
@@ -108,6 +108,7 @@ RegistryMaps::RegistryMaps() {
   REGISTER_MATCHER(autoType);
   REGISTER_MATCHER(binaryOperator);
   REGISTER_MATCHER(blockPointerType);
+  REGISTER_MATCHER(booleanType);
   REGISTER_MATCHER(breakStmt);
   REGISTER_MATCHER(builtinType);
   REGISTER_MATCHER(callExpr);

Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp?rev=256278=256277=256278=diff
==
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp Tue Dec 22 14:06:40 2015
@@ -4146,6 +4146,13 @@ TEST(TypeMatching, MatchesTypes) {
   EXPECT_TRUE(matches("struct S {};", qualType().bind("loc")));
 }
 
+TEST(TypeMatching, MatchesBool) {
+  EXPECT_TRUE(matches("struct S { bool func(); };",
+  cxxMethodDecl(returns(booleanType();
+  EXPECT_TRUE(notMatches("struct S { void func(); };",
+ cxxMethodDecl(returns(booleanType();
+}
+
 TEST(TypeMatching, MatchesVoid) {
   EXPECT_TRUE(matches("struct S { void func(); };",
   cxxMethodDecl(returns(voidType();


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


[PATCH] D15726: Remove setting of inlinehint and cold attributes based on profile data

2015-12-22 Thread Easwaran Raman via cfe-commits
eraman created this revision.
eraman added reviewers: bogner, davidxl.
eraman added a subscriber: cfe-commits.

NFC. These hints are only used for inlining and the inliner now uses the same 
criteria to identify hot and cold callees and set appropriate thresholds 
without relying on these hints. Hence this removed code is superfluous. 

http://reviews.llvm.org/D15726

Files:
  lib/CodeGen/CodeGenPGO.cpp
  test/Profile/c-attributes.c
  test/Profile/func-entry.c

Index: test/Profile/func-entry.c
===
--- test/Profile/func-entry.c
+++ test/Profile/func-entry.c
@@ -5,10 +5,10 @@
 
 void foo(void);
 
-// CHECK: @foo() #0 !prof [[FOO:![0-9]+]]
+// CHECK: @foo() #{{[0-9]}} !prof [[FOO:![0-9]+]]
 void foo() { return; }
 
-// CHECK: @main() #1 !prof [[MAIN:![0-9]+]]
+// CHECK: @main() #{{[0-9]}} !prof [[MAIN:![0-9]+]]
 int main() {
   int i;
   for (i = 0; i < 1; i++) foo();
Index: test/Profile/c-attributes.c
===
--- test/Profile/c-attributes.c
+++ /dev/null
@@ -1,48 +0,0 @@
-// Test that instrumentation based profiling sets function attributes 
correctly.
-
-// RUN: llvm-profdata merge %S/Inputs/c-attributes.proftext -o %t.profdata
-// RUN: %clang %s -o - -mllvm -disable-llvm-optzns -emit-llvm -S 
-fprofile-instr-use=%t.profdata | FileCheck %s
-
-extern int atoi(const char *);
-
-// CHECK: hot_100_percent(i32{{.*}}%i) [[HOT:#[0-9]+]]
-void hot_100_percent(int i) {
-  while (i > 0)
-i--;
-}
-
-// CHECK: hot_40_percent(i32{{.*}}%i) [[HOT]]
-void hot_40_percent(int i) {
-  while (i > 0)
-i--;
-}
-
-// CHECK: normal_func(i32{{.*}}%i) [[NORMAL:#[0-9]+]]
-void normal_func(int i) {
-  while (i > 0)
-i--;
-}
-
-// CHECK: cold_func(i32{{.*}}%i) [[COLD:#[0-9]+]]
-void cold_func(int i) {
-  while (i > 0)
-i--;
-}
-
-// CHECK: attributes [[HOT]] = { inlinehint nounwind {{.*}} }
-// CHECK: attributes [[NORMAL]] = { nounwind {{.*}} }
-// CHECK: attributes [[COLD]] = { cold nounwind {{.*}} }
-
-int main(int argc, const char *argv[]) {
-  int max = atoi(argv[1]);
-  int i;
-  for (i = 0; i < max; i++)
-hot_100_percent(i);
-  for (i = 0; i < max * 4 / 10; i++)
-hot_40_percent(i);
-  for (i = 0; i < max * 2 / 10; i++)
-normal_func(i);
-  for (i = 0; i < max / 200; i++)
-cold_func(i);
-  return 0;
-}
Index: lib/CodeGen/CodeGenPGO.cpp
===
--- lib/CodeGen/CodeGenPGO.cpp
+++ lib/CodeGen/CodeGenPGO.cpp
@@ -721,17 +721,7 @@
   if (!haveRegionCounts())
 return;
 
-  uint64_t MaxFunctionCount = PGOReader->getMaximumFunctionCount();
   uint64_t FunctionCount = getRegionCount(nullptr);
-  if (FunctionCount >= (uint64_t)(0.3 * (double)MaxFunctionCount))
-// Turn on InlineHint attribute for hot functions.
-// FIXME: 30% is from preliminary tuning on SPEC, it may not be optimal.
-Fn->addFnAttr(llvm::Attribute::InlineHint);
-  else if (FunctionCount <= (uint64_t)(0.01 * (double)MaxFunctionCount))
-// Turn on Cold attribute for cold functions.
-// FIXME: 1% is from preliminary tuning on SPEC, it may not be optimal.
-Fn->addFnAttr(llvm::Attribute::Cold);
-
   Fn->setEntryCount(FunctionCount);
 }
 


Index: test/Profile/func-entry.c
===
--- test/Profile/func-entry.c
+++ test/Profile/func-entry.c
@@ -5,10 +5,10 @@
 
 void foo(void);
 
-// CHECK: @foo() #0 !prof [[FOO:![0-9]+]]
+// CHECK: @foo() #{{[0-9]}} !prof [[FOO:![0-9]+]]
 void foo() { return; }
 
-// CHECK: @main() #1 !prof [[MAIN:![0-9]+]]
+// CHECK: @main() #{{[0-9]}} !prof [[MAIN:![0-9]+]]
 int main() {
   int i;
   for (i = 0; i < 1; i++) foo();
Index: test/Profile/c-attributes.c
===
--- test/Profile/c-attributes.c
+++ /dev/null
@@ -1,48 +0,0 @@
-// Test that instrumentation based profiling sets function attributes correctly.
-
-// RUN: llvm-profdata merge %S/Inputs/c-attributes.proftext -o %t.profdata
-// RUN: %clang %s -o - -mllvm -disable-llvm-optzns -emit-llvm -S -fprofile-instr-use=%t.profdata | FileCheck %s
-
-extern int atoi(const char *);
-
-// CHECK: hot_100_percent(i32{{.*}}%i) [[HOT:#[0-9]+]]
-void hot_100_percent(int i) {
-  while (i > 0)
-i--;
-}
-
-// CHECK: hot_40_percent(i32{{.*}}%i) [[HOT]]
-void hot_40_percent(int i) {
-  while (i > 0)
-i--;
-}
-
-// CHECK: normal_func(i32{{.*}}%i) [[NORMAL:#[0-9]+]]
-void normal_func(int i) {
-  while (i > 0)
-i--;
-}
-
-// CHECK: cold_func(i32{{.*}}%i) [[COLD:#[0-9]+]]
-void cold_func(int i) {
-  while (i > 0)
-i--;
-}
-
-// CHECK: attributes [[HOT]] = { inlinehint nounwind {{.*}} }
-// CHECK: attributes [[NORMAL]] = { nounwind {{.*}} }
-// CHECK: attributes [[COLD]] = { cold nounwind {{.*}} }
-
-int main(int argc, const char *argv[]) {
-  int max = atoi(argv[1]);
-  int i;
-  for (i = 0; i < max; i++)
-hot_100_percent(i);
-  for (i = 

Re: r256216 - [WebAssembly] Remove the -target command-line flag from the ld commandline.

2015-12-22 Thread Nico Weber via cfe-commits
Well yes, but we have a Windows bot on http://lab.llvm.org:8011/console,
right?

On Tue, Dec 22, 2015 at 5:54 PM, Dan Gohman  wrote:

> It appears the reason it was only caught on Windows was that only Windows
> appends ".exe" to executable files. Your change to match lld with {{.*}}
> appended fixes it. Thanks!
>
> Dan
>
>
> On Tue, Dec 22, 2015 at 2:34 PM, Nico Weber  wrote:
>
>> This might have broken the test on Windows:
>>
>> Command 1 Stderr:
>> C:\src\chrome\src\third_party\llvm\tools\clang\test\Driver\wasm-toolchain.c:3:13:
>> error: expected string not found in in
>> put
>> // AS_LINK: lld" "-flavor" "ld" "[[temp]]" "-o" "a.out"
>> ^
>> :5:476: note: scanning from here
>>  "C:/src/chrome/src/third_party/llvm-bootstrap/./bin/clang.EXE" "-cc1as"
>> "-triple" "wasm32-unknown-unknown" "-filetype"
>> "obj" "-main-file-name" "wasm-toolchain.c" "-target-cpu" "generic"
>> "-dwarf-version=4" "-fdebug-compilation-dir" "C:\\src
>> \\chrome\\src\\third_party\\llvm-bootstrap\\tools\\clang\\test\\Driver"
>> "-dwarf-debug-producer" "clang version 3.8.0 (tr
>> unk 256248)" "-mrelocation-model" "static" "-o"
>> "C:\\Users\\thakis\\AppData\\Local\\Temp\\wasm-toolchain-f6ec86.o" "C:\\
>>
>> src\\chrome\\src\\third_party\\llvm\\tools\\clang\\test\\Driver\\wasm-toolchain.c"
>>
>>
>>
>>
>>  ^
>> :5:476: note: with variable "temp" equal to
>> "C:UsersthakisAppDataLocalTempwasm-toolchain-
>> f6ec86.o"
>>  "C:/src/chrome/src/third_party/llvm-bootstrap/./bin/clang.EXE" "-cc1as"
>> "-triple" "wasm32-unknown-unknown" "-filetype"
>> "obj" "-main-file-name" "wasm-toolchain.c" "-target-cpu" "generic"
>> "-dwarf-version=4" "-fdebug-compilation-dir" "C:\\src
>> \\chrome\\src\\third_party\\llvm-bootstrap\\tools\\clang\\test\\Driver"
>> "-dwarf-debug-producer" "clang version 3.8.0 (tr
>> unk 256248)" "-mrelocation-model" "static" "-o"
>> "C:\\Users\\thakis\\AppData\\Local\\Temp\\wasm-toolchain-f6ec86.o" "C:\\
>>
>> src\\chrome\\src\\third_party\\llvm\\tools\\clang\\test\\Driver\\wasm-toolchain.c"
>>
>>
>>
>>
>>  ^
>> :6:63: note: possible intended match here
>>  "C:\\src\\chrome\\src\\third_party\\llvm-bootstrap\\bin\\lld.exe"
>> "-flavor" "ld" "C:\\Users\\thakis\\AppData\\Local\\Te
>> mp\\wasm-toolchain-f6ec86.o" "-o" "a.out"
>>   ^
>>
>> I think I fixed this in 256286, but I'm a bit surprised this wasn't
>> caught by any LLVM bots. Can you check why this wasn't caught?
>>
>> On Mon, Dec 21, 2015 at 6:30 PM, Dan Gohman via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: djg
>>> Date: Mon Dec 21 17:30:41 2015
>>> New Revision: 256216
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=256216=rev
>>> Log:
>>> [WebAssembly] Remove the -target command-line flag from the ld
>>> commandline.
>>>
>>> This flag isn't needed, or permitted, with the "ld" flavor of lld.
>>>
>>> Also, add a basic ld commandline test.
>>>
>>> Added:
>>> cfe/trunk/test/Driver/wasm-toolchain.c
>>> Modified:
>>> cfe/trunk/lib/Driver/Tools.cpp
>>>
>>> Modified: cfe/trunk/lib/Driver/Tools.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=256216=256215=256216=diff
>>>
>>> ==
>>> --- cfe/trunk/lib/Driver/Tools.cpp (original)
>>> +++ cfe/trunk/lib/Driver/Tools.cpp Mon Dec 21 17:30:41 2015
>>> @@ -6516,8 +6516,6 @@ void wasm::Linker::ConstructJob(Compilat
>>>ArgStringList CmdArgs;
>>>CmdArgs.push_back("-flavor");
>>>CmdArgs.push_back("ld");
>>> -  CmdArgs.push_back("-target");
>>> -
>>> CmdArgs.push_back(Args.MakeArgString(getToolChain().getTripleString()));
>>>AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
>>>CmdArgs.push_back("-o");
>>>CmdArgs.push_back(Output.getFilename());
>>>
>>> Added: cfe/trunk/test/Driver/wasm-toolchain.c
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/wasm-toolchain.c?rev=256216=auto
>>>
>>> ==
>>> --- cfe/trunk/test/Driver/wasm-toolchain.c (added)
>>> +++ cfe/trunk/test/Driver/wasm-toolchain.c Mon Dec 21 17:30:41 2015
>>> @@ -0,0 +1,3 @@
>>> +// RUN: %clang -### -target wasm32-unknown-unknown -x assembler %s 2>&1
>>> | FileCheck -check-prefix=AS_LINK %s
>>> +// AS_LINK: clang{{.*}}" "-cc1as" {{.*}} "-o" "[[temp:[^"]*]]"
>>> +// AS_LINK: lld" "-flavor" "ld" "[[temp]]" "-o" "a.out"
>>>
>>>
>>> ___
>>> cfe-commits mailing list
>>> cfe-commits@lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>>
>>
>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15363: [UBSan] Implement runtime suppressions (PR25066).

2015-12-22 Thread Nico Weber via cfe-commits
thakis added a subscriber: thakis.


Comment at: compiler-rt/trunk/test/ubsan/TestCases/Integer/suppressions.cpp:1
@@ +1,2 @@
+// RUN: %clangxx -fsanitize=integer -g0 %s -o %t
+

This test fails on Windows. I tried to debug, but the usual way to run tests 
seems to not work with compiler-rt: 

C:\src\chrome\src\third_party\llvm-bootstrap>python bin\llvm-lit.py 
..\llvm\projects\compiler-rt\test\ubsan\TestCases\In
teger\suppressions.cpp -v
llvm-lit.py: discovery.py:113: warning: unable to find test suite for 
'..\\llvm\\projects\\compiler-rt\\test\\ubsan\\Tes
tCases\\Integer\\suppressions.cpp'
llvm-lit.py: discovery.py:224: warning: input 
'..\\llvm\\projects\\compiler-rt\\test\\ubsan\\TestCases\\Integer\\suppres
sions.cpp' contained no tests

How do I run individual compiler-rt tests? (They run fine as part of `ninja 
check-all`, but that takes very long)


Repository:
  rL LLVM

http://reviews.llvm.org/D15363



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


Buildbot numbers for week of 12/13/2015 - 12/19/2015

2015-12-22 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the last week of 12/13/2015 -
12/19/2015.

Thanks

Galina



Number of commits by project:

 project   |   commits
---+---
 llvm  |   293
 cfe   |98
 lldb  |69
 lld   |34
 polly |25
 compiler-rt   |20
 libcxx|15
 openmp| 8
 clang-tools-extra | 8
 libcxxabi | 1
---
   571


Number of completed builds, failed builds and average build time for
successful builds per active builder:

 buildername   | completed  |
failed | time
---+++
 clang-aarch64-lnt | 54
|| 02:34:35
 clang-atom-d525-fedora| 18
|  1 | 08:20:27
 clang-atom-d525-fedora-rel| 65
|  1 | 01:57:35
 clang-bpf-build   |306
| 79 | 00:03:16
 clang-cmake-aarch64-42vma |227
| 65 | 00:20:07
 clang-cmake-aarch64-full  | 40
| 14 | 03:31:52
 clang-cmake-aarch64-quick |177
| 48 | 00:29:44
 clang-cmake-armv7-a15 |149
| 50 | 00:35:43
 clang-cmake-armv7-a15-full| 83
| 14 | 00:48:22
 clang-cmake-armv7-a15-selfhost| 35
|  8 | 04:22:50
 clang-cmake-armv7-a15-selfhost-neon   | 30
| 11 | 06:02:51
 clang-cmake-mips  | 77
| 15 | 01:27:50
 clang-cmake-mipsel| 23
|  8 | 05:14:13
 clang-cmake-thumbv7-a15   |160
| 60 | 00:33:27
 clang-cmake-thumbv7-a15-full-sh   | 25
|  7 | 06:57:47
 clang-hexagon-elf |226
| 54 | 00:16:53
 clang-native-aarch64-full | 15
|  5 | 07:58:09
 clang-native-arm-lnt  | 90
|  5 | 01:16:39
 clang-native-arm-lnt-perf | 16
|  2 | 10:02:34
 clang-ppc64-elf-linux |108
|  4 | 01:03:00
 clang-ppc64-elf-linux2|109
| 38 | 01:17:47
 clang-sphinx-docs | 98
|| 00:00:21
 clang-x64-ninja-win7  |174
| 72 | 00:35:03
 clang-x86-win2008-selfhost|120
| 50 | 01:06:02
 clang-x86_64-darwin13-cross-arm   |226
| 12 | 00:19:57
 clang-x86_64-darwin13-cross-mingw32   |206
| 11 | 00:23:41
 clang-x86_64-debian-fast  |119
|  9 | 00:14:19
 clang-x86_64-linux-abi-test   |316
| 17 | 00:09:51
 clang-x86_64-linux-selfhost-modules   |250
| 53 | 00:15:56
 clang-x86_64-ubuntu-gdb-75|125
|  7 | 00:51:07
 libcxx-libcxxabi-arm-linux| 14
|  1 | 01:07:31
 libcxx-libcxxabi-singlethreaded-x86_64-linux-debian   |  9
|  1 | 00:10:04
 libcxx-libcxxabi-x86_64-linux-debian  |  8
|| 00:10:35
 libcxx-libcxxabi-x86_64-linux-debian-noexceptions |  8
|| 00:10:09
 libcxx-libcxxabi-x86_64-linux-ubuntu-asan | 12
|  1 | 00:12:26
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx03| 12
|| 00:08:09
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx11|  9
|| 00:09:25
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx14| 13
|  1 | 00:08:23
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx1z| 13
|  1 | 00:08:30
 libcxx-libcxxabi-x86_64-linux-ubuntu-msan | 13
|  1 | 00:23:37
 libcxx-libcxxabi-x86_64-linux-ubuntu-tsan | 11
|  1 | 00:16:53
 libcxx-libcxxabi-x86_64-linux-ubuntu-unstable-abi | 

Re: r255382 - [clang-cl] Let /W4 map to -Wall -Wextra instead of just -Wall.

2015-12-22 Thread Nico Weber via cfe-commits
On Tue, Dec 15, 2015 at 2:56 PM, Nico Weber  wrote:

> Looks like the warning is still emitted frequently. It looks like cl.exe
> processes /W4 before /wd4100 even though if it's passed as "/wd4100 /W4".
> clang-cl probably interprets this as "first, disable Wunused-parameter,
> then turn on everything in Wall and Wextra".
>
> I suppose we could process W1-4 before all other warning flags to be
> compatible with cl.exe in this regard. However, it's less clear what to do
> about /Wall -- if we process /Wall before all the other flags, then -Wall
> (another spelling of /Wall) will behave differently in clang and clang-cl.
> Maybe that's ok?
>

Until we decide on something for this, http://reviews.llvm.org/D15731
should make the self-host build less noisy.


>
> On Tue, Dec 15, 2015 at 12:11 PM, Nico Weber  wrote:
>
>> Feedback on PR25563 pretty strongly suggests that users do want most of
>> this. It looks like llvm passes /wd4100 to suppress the corresponding cl
>> warning. r255655 maps that to -Wno-unused-parameter – does this fix the
>> problem of these bots?
>>
>> On Mon, Dec 14, 2015 at 10:01 PM, Reid Kleckner via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> So, this change makes it impossible to download the build lots from the
>>> Windows self-hosting builders because of -Wunused-parameter errors.
>>>
>>> http://lab.llvm.org:8011/builders/clang-x86-win2008-selfhost/builds/5103/steps/build%20stage%202/logs/stdio
>>>
>>> Maybe that's an indication that users don't really want /W4 to go to
>>> -Wextra?
>>>
>>> On Fri, Dec 11, 2015 at 2:31 PM, Nico Weber via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>>
 Author: nico
 Date: Fri Dec 11 16:31:16 2015
 New Revision: 255382

 URL: http://llvm.org/viewvc/llvm-project?rev=255382=rev
 Log:
 [clang-cl] Let /W4 map to -Wall -Wextra instead of just -Wall.

 There's no way to make a flag alias to two flags, so add a /WCL4 flag
 that
 maps to the All, Extra diag groups.  Fixes PR25563.

 http://reviews.llvm.org/D15350

 Modified:
 cfe/trunk/docs/UsersManual.rst
 cfe/trunk/include/clang/Basic/DiagnosticGroups.td
 cfe/trunk/include/clang/Driver/CLCompatOptions.td
 cfe/trunk/include/clang/Driver/Options.td
 cfe/trunk/test/Driver/cl-options.c

 Modified: cfe/trunk/docs/UsersManual.rst
 URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.rst?rev=255382=255381=255382=diff

 ==
 --- cfe/trunk/docs/UsersManual.rst (original)
 +++ cfe/trunk/docs/UsersManual.rst Fri Dec 11 16:31:16 2015
 @@ -2080,7 +2080,7 @@ Execute ``clang-cl /?`` to see a list of
/W1Enable -Wall
/W2Enable -Wall
/W3Enable -Wall
 -  /W4Enable -Wall
 +  /W4Enable -Wall and -Wextra
/Wall  Enable -Wall
/WX-   Do not treat warnings as errors
/WXTreat warnings as errors

 Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
 URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=255382=255381=255382=diff

 ==
 --- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
 +++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Fri Dec 11
 16:31:16 2015
 @@ -663,7 +663,10 @@ def Consumed   : DiagGroup<"consumed
  // Note that putting warnings in -Wall will not disable them by
 default. If a
  // warning should be active _only_ when -Wall is passed in, mark it as
  // DefaultIgnore in addition to putting it here.
 -def : DiagGroup<"all", [Most, Parentheses, Switch, SwitchBool]>;
 +def All : DiagGroup<"all", [Most, Parentheses, Switch, SwitchBool]>;
 +
 +// Warnings that should be in clang-cl /w4.
 +def : DiagGroup<"CL4", [All, Extra]>;

  // Warnings enabled by -pedantic.  This is magically filled in by
 TableGen.
  def Pedantic : DiagGroup<"pedantic">;

 Modified: cfe/trunk/include/clang/Driver/CLCompatOptions.td
 URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CLCompatOptions.td?rev=255382=255381=255382=diff

 ==
 --- cfe/trunk/include/clang/Driver/CLCompatOptions.td (original)
 +++ cfe/trunk/include/clang/Driver/CLCompatOptions.td Fri Dec 11
 16:31:16 2015
 @@ -119,7 +119,7 @@ def _SLASH_W0 : CLFlag<"W0">, HelpText<"
  def _SLASH_W1 : CLFlag<"W1">, HelpText<"Enable -Wall">, Alias;
  def _SLASH_W2 : CLFlag<"W2">, 

Re: [PATCH] D15729: Load compiler plugins in ASTUnit, too

2015-12-22 Thread Kevin Funk via cfe-commits
kfunk added a comment.

By the way; prove that it really works:

  http://wstaw.org/m/2015/12/23/kdevelop-clazy.png (loving it!) :)


http://reviews.llvm.org/D15729



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


Re: [PATCH] D15363: [UBSan] Implement runtime suppressions (PR25066).

2015-12-22 Thread Nico Weber via cfe-commits
thakis added a comment.

It's because FlagParser::is_space() considers ':' as a space, so it thinks c:\ 
ends after the c and then starts parsing another flag at the \.

Fix ideas: Don't treat : as space while in quotes, or use ; as separator on 
Windows.


Repository:
  rL LLVM

http://reviews.llvm.org/D15363



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


Re: [PATCH] D15363: [UBSan] Implement runtime suppressions (PR25066).

2015-12-22 Thread Nico Weber via cfe-commits
thakis added a comment.

And this in turn is because env strips the quotes:

C:\src\chrome\src\third_party\llvm-bootstrap>env 
UBSAN_OPTIONS=halt_on_error=1:suppressions="C:\src\chrome\src\third_party\llvm-bootstrap\projects\compiler-rt\test\ubsan\Standalone-x86_64\TestCases\Integer\Output\suppressions.cpp.tmp.wrong-supp"
 env

...
===

UBSAN_OPTIONS=halt_on_error=1:suppressions=C:\src\chrome\src\third_party\llvm-bootstrap\projects\compiler-rt\test\ubsan\Standalone-x86_64\TestCases\Integer\Output\suppressions.cpp.tmp.wrong-supp


Repository:
  rL LLVM

http://reviews.llvm.org/D15363



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


Re: [PATCH] D15363: [UBSan] Implement runtime suppressions (PR25066).

2015-12-22 Thread Nico Weber via cfe-commits
thakis added a comment.

I've looked at it some, and couldn't find a way of escaping quotes that lit 
doesn't strip but that ubsan accepts.

'"c:\foo"' gets its quotes stripped by lit, so does """c:\foo""". \"c:\foo\" 
confuses lit enough that it tries to call lit.util.warning() which doesn't 
exist.

I've XFAIL'd the test on win32 in 256307 for now. Please take a look when 
you're back. Maybe teaching lit about \" escaping is the best fix.


Repository:
  rL LLVM

http://reviews.llvm.org/D15363



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


r256284 - [ASTMatchers] Fix typo in booleanType() doc.

2015-12-22 Thread Samuel Benzaquen via cfe-commits
Author: sbenza
Date: Tue Dec 22 15:06:36 2015
New Revision: 256284

URL: http://llvm.org/viewvc/llvm-project?rev=256284=rev
Log:
[ASTMatchers] Fix typo in booleanType() doc.

Fix typo in booleanType() doc and recreate the
LibASTMatchersReference.html reference document.

Modified:
cfe/trunk/docs/LibASTMatchersReference.html
cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h

Modified: cfe/trunk/docs/LibASTMatchersReference.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=256284=256283=256284=diff
==
--- cfe/trunk/docs/LibASTMatchersReference.html (original)
+++ cfe/trunk/docs/LibASTMatchersReference.html Tue Dec 22 15:06:36 2015
@@ -2502,6 +2502,18 @@ i is const-qualified but the qualifier i
 
 
 
+Matcherhttp://clang.llvm.org/doxygen/classclang_1_1QualType.html;>QualTypeisAnyCharacter
+Matches QualType 
nodes that are of character type.
+
+Given
+  void a(char);
+  void b(wchar_t);
+  void c(double);
+functionDecl(hasAnyParameter(hasType(isAnyCharacter(
+matches "a(char)", "b(wchar_t)", but not "c(double)".
+
+
+
 Matcherhttp://clang.llvm.org/doxygen/classclang_1_1QualType.html;>QualTypeisConstQualified
 Matches QualType 
nodes that are const-qualified, i.e., that
 include "top-level" const.
@@ -2742,6 +2754,16 @@ Usable as: Matcherhttp://cla
 
 
 
+Matcherhttp://clang.llvm.org/doxygen/classclang_1_1Type.html;>TypebooleanType
+Matches type bool.
+
+Given
+ struct S { bool func(); };
+functionDecl(returns(booleanType()))
+  matches "bool func();"
+
+
+
 Matcherhttp://clang.llvm.org/doxygen/classclang_1_1Type.html;>TypeequalsBoundNodestd::string 
ID
 Matches if a node 
equals a previously bound node.
 

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=256284=256283=256284=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Tue Dec 22 15:06:36 2015
@@ -3768,7 +3768,7 @@ AST_MATCHER_FUNCTION_P_OVERLOAD(internal
 /// \code
 ///  struct S { bool func(); };
 /// \endcode
-/// functionDecl(returns(boolType()))
+/// functionDecl(returns(booleanType()))
 ///   matches "bool func();"
 AST_MATCHER(Type, booleanType) {
   return Node.isBooleanType();


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


Re: r256278 - [ASTMatchers] Add booleanType() matcher.

2015-12-22 Thread Samuel Benzaquen via cfe-commits
On Tue, Dec 22, 2015 at 3:16 PM, Aaron Ballman 
wrote:

> On Tue, Dec 22, 2015 at 3:06 PM, Samuel Benzaquen via cfe-commits
>  wrote:
> > Author: sbenza
> > Date: Tue Dec 22 14:06:40 2015
> > New Revision: 256278
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=256278=rev
> > Log:
> > [ASTMatchers] Add booleanType() matcher.
> >
> > Modified:
> > cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
> > cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
> > cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
> >
> > Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=256278=256277=256278=diff
> >
> ==
> > --- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
> > +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Tue Dec 22
> 14:06:40 2015
> > @@ -3762,6 +3762,18 @@ AST_MATCHER_FUNCTION_P_OVERLOAD(internal
> >new internal::TypeLocTypeMatcher(InnerMatcher));
> >  }
> >
> > +/// \brief Matches type \c bool.
> > +///
> > +/// Given
> > +/// \code
> > +///  struct S { bool func(); };
> > +/// \endcode
> > +/// functionDecl(returns(boolType()))
>
> The comment does not match reality -- I think you meant booleanType()
> instead.
>

Sorry about that. Last minute typo.
Done at r256284.


>
> Also, this commit did not update the documentation; please run
> dump_ast_matchers.py as well.
>

Done. It also added another matcher that was missing.


>
> ~Aaron
>
> > +///   matches "bool func();"
> > +AST_MATCHER(Type, booleanType) {
> > +  return Node.isBooleanType();
> > +}
> > +
> >  /// \brief Matches type \c void.
> >  ///
> >  /// Given
> >
> > Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp?rev=256278=256277=256278=diff
> >
> ==
> > --- cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp (original)
> > +++ cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp Tue Dec 22 14:06:40
> 2015
> > @@ -108,6 +108,7 @@ RegistryMaps::RegistryMaps() {
> >REGISTER_MATCHER(autoType);
> >REGISTER_MATCHER(binaryOperator);
> >REGISTER_MATCHER(blockPointerType);
> > +  REGISTER_MATCHER(booleanType);
> >REGISTER_MATCHER(breakStmt);
> >REGISTER_MATCHER(builtinType);
> >REGISTER_MATCHER(callExpr);
> >
> > Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp?rev=256278=256277=256278=diff
> >
> ==
> > --- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp (original)
> > +++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp Tue Dec 22
> 14:06:40 2015
> > @@ -4146,6 +4146,13 @@ TEST(TypeMatching, MatchesTypes) {
> >EXPECT_TRUE(matches("struct S {};", qualType().bind("loc")));
> >  }
> >
> > +TEST(TypeMatching, MatchesBool) {
> > +  EXPECT_TRUE(matches("struct S { bool func(); };",
> > +  cxxMethodDecl(returns(booleanType();
> > +  EXPECT_TRUE(notMatches("struct S { void func(); };",
> > + cxxMethodDecl(returns(booleanType();
> > +}
> > +
> >  TEST(TypeMatching, MatchesVoid) {
> >EXPECT_TRUE(matches("struct S { void func(); };",
> >cxxMethodDecl(returns(voidType();
> >
> >
> > ___
> > 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


r256288 - Disable include sorting by default for Chromium style.

2015-12-22 Thread Nico Weber via cfe-commits
Author: nico
Date: Tue Dec 22 16:42:56 2015
New Revision: 256288

URL: http://llvm.org/viewvc/llvm-project?rev=256288=rev
Log:
Disable include sorting by default for Chromium style.

Include sorting generally can break .cc files, especially on Windows.  Make
this opt-in for Chromium style to give us some more time to roll this out.

(Given that the Google style guide is used by many companies, some of them
probably writing code on Windows, one could argue this should be opt-in in
general...)

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

Modified: cfe/trunk/lib/Format/Format.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=256288=256287=256288=diff
==
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Tue Dec 22 16:42:56 2015
@@ -607,6 +607,7 @@ FormatStyle getChromiumStyle(FormatStyle
 ChromiumStyle.BinPackParameters = false;
 ChromiumStyle.DerivePointerAlignment = false;
   }
+  ChromiumStyle.SortIncludes = false;
   return ChromiumStyle;
 }
 


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


Re: [PATCH] D15726: Remove setting of inlinehint and cold attributes based on profile data

2015-12-22 Thread David Li via cfe-commits
davidxl added a comment.

This looks like a straightforward cleanup (the test cases have been in a 
previous patch).


http://reviews.llvm.org/D15726



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


Re: [PATCH] D15729: Load compiler plugins in ASTUnit, too

2015-12-22 Thread Kevin Funk via cfe-commits
kfunk added a comment.

Doing as requested by 
http://lists.llvm.org/pipermail/cfe-dev/2014-October/039381.html, let's put 
this up for review in its initial form, so we can discuss a better approach.


http://reviews.llvm.org/D15729



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


Re: [PATCH] D15363: [UBSan] Implement runtime suppressions (PR25066).

2015-12-22 Thread Nico Weber via cfe-commits
thakis added a comment.

Here's the error (I still don't know how to run single tests through lit, 
though):

C:\src\chrome\src\third_party\llvm-bootstrap>env 
UBSAN_OPTIONS=halt_on_error=1:suppressions="C:\src\chrome\src\third_party\llvm-bootstrap\projects\compiler-rt\test\ubsan\Standalone-x86_64\TestCases\Integer\Output\suppressions.cpp.tmp.wrong-supp"
 
C:\src\chrome\src\third_party\llvm-bootstrap\projects\compiler-rt\test\ubsan\Standalone-x86_64\TestCases\Integer\Output\suppressions.cpp.tmp

C:\src\chrome\src\third_party\llvm-bootstrap>ERROR: expected '='


Repository:
  rL LLVM

http://reviews.llvm.org/D15363



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


r256286 - Make wasm-toolchain.c test pass on Windows.

2015-12-22 Thread Nico Weber via cfe-commits
Author: nico
Date: Tue Dec 22 16:30:14 2015
New Revision: 256286

URL: http://llvm.org/viewvc/llvm-project?rev=256286=rev
Log:
Make wasm-toolchain.c test pass on Windows.

Modified:
cfe/trunk/test/Driver/wasm-toolchain.c

Modified: cfe/trunk/test/Driver/wasm-toolchain.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/wasm-toolchain.c?rev=256286=256285=256286=diff
==
--- cfe/trunk/test/Driver/wasm-toolchain.c (original)
+++ cfe/trunk/test/Driver/wasm-toolchain.c Tue Dec 22 16:30:14 2015
@@ -1,3 +1,3 @@
 // RUN: %clang -### -no-canonical-prefixes -target wasm32-unknown-unknown -x 
assembler %s 2>&1 | FileCheck -check-prefix=AS_LINK %s
 // AS_LINK: clang{{.*}}" "-cc1as" {{.*}} "-o" "[[temp:[^"]*]]"
-// AS_LINK: lld" "-flavor" "ld" "[[temp]]" "-o" "a.out"
+// AS_LINK: lld{{.*}}" "-flavor" "ld" "[[temp]]" "-o" "a.out"


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


Re: [PATCH] D15208: Patch for inline abort code generation

2015-12-22 Thread Dan Austin via cfe-commits
danielaustin updated this revision to Diff 43459.
danielaustin added a comment.

Test case added which looks for the existence of multiple trap basic blocks in 
generated LLVM-IR with optimization turned on. Flag renamed 
(-fmerge-traps/-fno-merge-traps) and placed in a more sensible location 
(CodeGenOptions.def). Trap inlining logic changed to work with most recent 
version of LLVM (as opposed to the one packaged with AOSP). Without turning 
optimization off in the function containing the trap, there were cases that the 
abort calls were merged to the end of the function. Turning off inlining and 
optimization for a function which is not to merge traps appears to be working, 
but further analysis is in process.

This version results in slightly bigger code (~10% per function) than the 
original version, but has the benefit of not breaking basic blocks.


Repository:
  rL LLVM

http://reviews.llvm.org/D15208

Files:
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  include/clang/Frontend/CodeGenOptions.h
  lib/CodeGen/CGExpr.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/merge-traps.c

Index: test/CodeGen/merge-traps.c
===
--- test/CodeGen/merge-traps.c
+++ test/CodeGen/merge-traps.c
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu %s -emit-llvm -o - -fsanitize=unsigned-integer-overflow -ftrapv -fmerge-traps -O2 | FileCheck %s --check-prefix=ALL --check-prefix=MERGE 
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu %s -emit-llvm -o - -fsanitize=unsigned-integer-overflow -ftrapv -fno-merge-traps -O2 | FileCheck %s --check-prefix=ALL --check-prefix=NOMERGETRAPS
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu %s -emit-llvm -o - -fsanitize=unsigned-integer-overflow -ftrapv -O2| FileCheck %s -check-prefix=ALL --check-prefix=MERGE
+// Verify that -fmerge-traps works as expected with appropriate supporting flags
+
+
+void test_trap_merge() {
+  extern volatile int a, b, c;
+  a = b + c;
+  // MERGE: tail call void @llvm.trap()
+  // NOMERGETRAPS: call void @llvm.trap()
+  b = a + c;
+  // NOMERGETRAPS-DAG: call void @llvm.trap()
+}
+
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -518,6 +518,8 @@
 
   Opts.MergeFunctions = Args.hasArg(OPT_fmerge_functions);
 
+  Opts.MergeTraps = Args.hasFlag(OPT_fmerge_traps, OPT_fno_merge_traps, true);
+
   Opts.PrepareForLTO = Args.hasArg(OPT_flto, OPT_flto_EQ);
   const Arg *A = Args.getLastArg(OPT_flto, OPT_flto_EQ);
   Opts.EmitFunctionSummary = A && A->containsValue("thin");
Index: lib/CodeGen/CGExpr.cpp
===
--- lib/CodeGen/CGExpr.cpp
+++ lib/CodeGen/CGExpr.cpp
@@ -27,6 +27,7 @@
 #include "llvm/ADT/Hashing.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/IR/DataLayout.h"
+#include "llvm/IR/InlineAsm.h"
 #include "llvm/IR/Intrinsics.h"
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/IR/MDBuilder.h"
@@ -2535,16 +2536,40 @@
 void CodeGenFunction::EmitTrapCheck(llvm::Value *Checked) {
   llvm::BasicBlock *Cont = createBasicBlock("cont");
 
-  // If we're optimizing, collapse all calls to trap down to just one per
-  // function to save on code size.
-  if (!CGM.getCodeGenOpts().OptimizationLevel || !TrapBB) {
+  // Collapsing all calls to trap down to one per function makes debugging
+  // these issues much more difficult. Allowing for elimination of this optimization 
+  // for debugging purposes.
+  // RE: Bug: 25682
+  if(!CGM.getCodeGenOpts().MergeTraps || !CGM.getCodeGenOpts().OptimizationLevel || !TrapBB) {
+// If we aren't merging traps, set the function to not be optimized as some
+// trap calls appear to be merged to the end of the function even with
+// the call - EmptyAsm - Unreachable pattern at the end of the function. 
+if(!CGM.getCodeGenOpts().MergeTraps) {
+  CurFn->addFnAttr(llvm::Attribute::OptimizeNone);
+  CurFn->addFnAttr(llvm::Attribute::NoInline);
+}
+
 TrapBB = createBasicBlock("trap");
 Builder.CreateCondBr(Checked, Cont, TrapBB);
 EmitBlock(TrapBB);
-llvm::CallInst *TrapCall = EmitTrapCall(llvm::Intrinsic::trap);
-TrapCall->setDoesNotReturn();
-TrapCall->setDoesNotThrow();
-Builder.CreateUnreachable();
+if(!CGM.getCodeGenOpts().MergeTraps) {
+  // This closely mirrors what is done to avoid function merging
+  // in the address sanitizer. The trap function is not set
+  // to not return as there is an unreachable instruction
+  // generated at the end of the block.
+  EmitTrapCall(llvm::Intrinsic::trap);
+  llvm::InlineAsm *EmptyAsm = llvm::InlineAsm::get(llvm::FunctionType::get(Builder.getVoidTy(), false),
+		   StringRef(""), StringRef(""), true);
+
+  // This stops the trap calls from being merged at the 

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

2015-12-22 Thread Nathan Wilson via cfe-commits
nwilson updated this revision to Diff 43469.
nwilson added a comment.

Updating to r256247


http://reviews.llvm.org/D13357

Files:
  include/clang/AST/DeclTemplate.h
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaTemplate.cpp
  test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p1.cpp

Index: test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p1.cpp
===
--- test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p1.cpp
+++ test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p1.cpp
@@ -41,3 +41,20 @@
 void fpc(concept int i) {} // expected-error {{'concept' can only appear on the definition of a function template or variable template}}
 
 concept bool; // expected-error {{'concept' can only appear on the definition of a function template or variable template}}
+
+template concept bool VCEI { true };
+template concept bool VCEI; // expected-error {{'concept' cannot be applied on an explicit instantiation}}
+extern template concept bool VCEI; // expected-error {{'concept' cannot be applied on an explicit instantiation}}
+
+template concept bool VCPS { true };
+template concept bool VCPS { true }; // expected-error {{'concept' cannot be applied on an partial specialization}}
+
+template concept bool VCES { true };
+template<> concept bool VCES { true }; // expected-error {{'concept' cannot be applied on an explicit specialization}}
+
+template concept bool FCEI() { return true; }
+template concept bool FCEI(); // expected-error {{'concept' cannot be applied on an explicit instantiation}}
+extern template concept bool FCEI(); // expected-error {{'concept' cannot be applied on an explicit instantiation}}
+
+template concept bool FCES() { return true; }
+template<> concept bool FCES() { return true; } // expected-error {{'concept' cannot be applied on an explicit specialization}}
Index: lib/Sema/SemaTemplate.cpp
===
--- lib/Sema/SemaTemplate.cpp
+++ lib/Sema/SemaTemplate.cpp
@@ -7667,6 +7667,17 @@
 Diag(D.getDeclSpec().getConstexprSpecLoc(),
  diag::err_explicit_instantiation_constexpr);
 
+  // C++ Concepts TS [dcl.spec.concept]p1: The concept specifier shall be
+  // applied only to the definition of a function template or variable template,
+  // declared in namespace scope. A concept definition refers to either a
+  // function concept and its definition or a variable concept and its
+  // initializer.
+  if (D.getDeclSpec().isConceptSpecified()) {
+Diag(D.getDeclSpec().getConceptSpecLoc(),
+ diag:: err_concept_specified_specialization) << 0;
+return true;
+  }
+
   // C++0x [temp.explicit]p2:
   //   There are two forms of explicit instantiation: an explicit instantiation
   //   definition and an explicit instantiation declaration. An explicit
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -5988,6 +5988,16 @@
 << 0 << 3;
 NewVD->setInvalidDecl(true);
   }
+
+  // C++ Concepts TS [dcl.spec.concept]p1: The concept specifier shall be
+  // applied only to the definition of a [...] variable template, declared
+  // in namespace scope. [...] A concept definition refers to [...] a
+  // variable concept and its initializer.
+  if (IsVariableTemplateSpecialization) {
+Diag(D.getDeclSpec().getConceptSpecLoc(),
+ diag::err_concept_specified_specialization)
+  << (IsPartialSpecialization ? 2 : 1);
+  }
 }
   }
 
@@ -7645,6 +7655,10 @@
 }
 
 if (isConcept) {
+  // This is a function concept.
+  if (FunctionTemplateDecl *FTD = NewFD->getDescribedFunctionTemplate())
+FTD->setConcept(true);
+
   // C++ Concepts TS [dcl.spec.concept]p1: The concept specifier shall be
   // applied only to the definition of a function template [...]
   if (!D.isFunctionDefinition()) {
@@ -7703,6 +7717,15 @@
 << 1 << 3;
 NewFD->setInvalidDecl(true);
   }
+
+  // C++ Concepts TS [dcl.spec.concept]p1: The concept specifier shall be
+  // applied only to the definition of a function template [...], declared
+  // in namespace scope. [...] A concept definition refers to either a
+  // function concept and its definition [...].
+  if (isFunctionTemplateSpecialization) {
+Diag(D.getDeclSpec().getConceptSpecLoc(),
+ diag::err_concept_specified_specialization) << 1;
+  }
 }
 
 // If __module_private__ was specified, mark the function accordingly.
@@ -7964,9 +7987,9 @@
  TemplateId->NumArgs);
   translateTemplateArguments(TemplateArgsPtr,
  TemplateArgs);
-
+
   HasExplicitTemplateArgs = true;
-
+
   if (NewFD->isInvalidDecl()) {
 HasExplicitTemplateArgs 

Re: r256278 - [ASTMatchers] Add booleanType() matcher.

2015-12-22 Thread Aaron Ballman via cfe-commits
On Tue, Dec 22, 2015 at 3:06 PM, Samuel Benzaquen via cfe-commits
 wrote:
> Author: sbenza
> Date: Tue Dec 22 14:06:40 2015
> New Revision: 256278
>
> URL: http://llvm.org/viewvc/llvm-project?rev=256278=rev
> Log:
> [ASTMatchers] Add booleanType() matcher.
>
> Modified:
> cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
> cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
> cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
>
> Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=256278=256277=256278=diff
> ==
> --- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
> +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Tue Dec 22 14:06:40 2015
> @@ -3762,6 +3762,18 @@ AST_MATCHER_FUNCTION_P_OVERLOAD(internal
>new internal::TypeLocTypeMatcher(InnerMatcher));
>  }
>
> +/// \brief Matches type \c bool.
> +///
> +/// Given
> +/// \code
> +///  struct S { bool func(); };
> +/// \endcode
> +/// functionDecl(returns(boolType()))

The comment does not match reality -- I think you meant booleanType() instead.

Also, this commit did not update the documentation; please run
dump_ast_matchers.py as well.

~Aaron

> +///   matches "bool func();"
> +AST_MATCHER(Type, booleanType) {
> +  return Node.isBooleanType();
> +}
> +
>  /// \brief Matches type \c void.
>  ///
>  /// Given
>
> Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp?rev=256278=256277=256278=diff
> ==
> --- cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp (original)
> +++ cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp Tue Dec 22 14:06:40 2015
> @@ -108,6 +108,7 @@ RegistryMaps::RegistryMaps() {
>REGISTER_MATCHER(autoType);
>REGISTER_MATCHER(binaryOperator);
>REGISTER_MATCHER(blockPointerType);
> +  REGISTER_MATCHER(booleanType);
>REGISTER_MATCHER(breakStmt);
>REGISTER_MATCHER(builtinType);
>REGISTER_MATCHER(callExpr);
>
> Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp?rev=256278=256277=256278=diff
> ==
> --- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp (original)
> +++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp Tue Dec 22 14:06:40 
> 2015
> @@ -4146,6 +4146,13 @@ TEST(TypeMatching, MatchesTypes) {
>EXPECT_TRUE(matches("struct S {};", qualType().bind("loc")));
>  }
>
> +TEST(TypeMatching, MatchesBool) {
> +  EXPECT_TRUE(matches("struct S { bool func(); };",
> +  cxxMethodDecl(returns(booleanType();
> +  EXPECT_TRUE(notMatches("struct S { void func(); };",
> + cxxMethodDecl(returns(booleanType();
> +}
> +
>  TEST(TypeMatching, MatchesVoid) {
>EXPECT_TRUE(matches("struct S { void func(); };",
>cxxMethodDecl(returns(voidType();
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [clang-tools-extra] r255886 - Remove clang-modernize.

2015-12-22 Thread Alexander Kornienko via cfe-commits
Sure, will do
On Dec 17, 2015 6:44 PM, "Aaron Ballman"  wrote:

> Can you also be sure to update the release notes for this change?
>
> ~Aaron
>
> On Thu, Dec 17, 2015 at 6:49 AM, Alexander Kornienko via cfe-commits
>  wrote:
> > Author: alexfh
> > Date: Thu Dec 17 05:49:19 2015
> > New Revision: 255886
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=255886=rev
> > Log:
> > Remove clang-modernize.
> >
> > Summary:
> > clang-modernize transforms have moved to clang-tidy. Removing
> > the old tool now.
> >
> > Reviewers: klimek
> >
> > Subscribers: cfe-commits
> >
> > Differential Revision: http://reviews.llvm.org/D15606
> >
> > Removed:
> > clang-tools-extra/trunk/clang-modernize/
> > clang-tools-extra/trunk/docs/AddOverrideTransform.rst
> > clang-tools-extra/trunk/docs/LoopConvertTransform.rst
> > clang-tools-extra/trunk/docs/MigratorUsage.rst
> > clang-tools-extra/trunk/docs/ModernizerUsage.rst
> > clang-tools-extra/trunk/docs/PassByValueTransform.rst
> > clang-tools-extra/trunk/docs/ReplaceAutoPtrTransform.rst
> > clang-tools-extra/trunk/docs/UseAutoTransform.rst
> > clang-tools-extra/trunk/docs/UseNullptrTransform.rst
> > clang-tools-extra/trunk/test/clang-modernize/
> > clang-tools-extra/trunk/unittests/clang-modernize/
> > clang-tools-extra/trunk/unittests/include/common/Utility.h
> > Modified:
> > clang-tools-extra/trunk/CMakeLists.txt
> > clang-tools-extra/trunk/Makefile
> > clang-tools-extra/trunk/docs/clang-modernize.rst
> > clang-tools-extra/trunk/docs/cpp11-migrate.rst
> > clang-tools-extra/trunk/docs/index.rst
> > clang-tools-extra/trunk/test/CMakeLists.txt
> > clang-tools-extra/trunk/unittests/CMakeLists.txt
> > clang-tools-extra/trunk/unittests/Makefile
> >
> > Modified: clang-tools-extra/trunk/CMakeLists.txt
> > URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/CMakeLists.txt?rev=255886=255885=255886=diff
> >
> ==
> > --- clang-tools-extra/trunk/CMakeLists.txt (original)
> > +++ clang-tools-extra/trunk/CMakeLists.txt Thu Dec 17 05:49:19 2015
> > @@ -1,5 +1,4 @@
> >  add_subdirectory(clang-apply-replacements)
> > -add_subdirectory(clang-modernize)
> >  add_subdirectory(clang-rename)
> >  add_subdirectory(modularize)
> >  if(CLANG_ENABLE_STATIC_ANALYZER)
> >
> > Modified: clang-tools-extra/trunk/Makefile
> > URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/Makefile?rev=255886=255885=255886=diff
> >
> ==
> > --- clang-tools-extra/trunk/Makefile (original)
> > +++ clang-tools-extra/trunk/Makefile Thu Dec 17 05:49:19 2015
> > @@ -12,8 +12,7 @@ CLANG_LEVEL := ../..
> >  include $(CLANG_LEVEL)/../../Makefile.config
> >
> >  PARALLEL_DIRS := tool-template modularize pp-trace
> > -DIRS := clang-apply-replacements clang-modernize clang-rename
> clang-tidy \
> > -   clang-query unittests
> > +DIRS := clang-apply-replacements clang-rename clang-tidy clang-query
> unittests
> >
> >  include $(CLANG_LEVEL)/Makefile
> >
> >
> > Removed: clang-tools-extra/trunk/docs/AddOverrideTransform.rst
> > URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/AddOverrideTransform.rst?rev=255885=auto
> >
> ==
> > --- clang-tools-extra/trunk/docs/AddOverrideTransform.rst (original)
> > +++ clang-tools-extra/trunk/docs/AddOverrideTransform.rst (removed)
> > @@ -1,54 +0,0 @@
> > -.. index:: Add-Override Transform
> > -
> > -==
> > -Add-Override Transform
> > -==
> > -
> > -The Add-Override Transform adds the ``override`` specifier to member
> > -functions that override a virtual function in a base class and that
> > -don't already have the specifier. The transform is enabled with the
> > -:option:`-add-override` option of :program:`clang-modernize`.
> > -For example:
> > -
> > -.. code-block:: c++
> > -
> > -  class A {
> > -  public:
> > -virtual void h() const;
> > -  };
> > -
> > -  class B : public A {
> > -  public:
> > -void h() const;
> > -
> > -// The declaration of h is transformed to
> > -void h() const override;
> > -  };
> > -
> > -Using Expands-to-Override Macros
> > -
> > -
> > -Like LLVM's ``LLVM_OVERRIDE``, several projects have macros that
> conditionally
> > -expand to the ``override`` keyword when compiling with C++11 features
> enabled.
> > -To maintain compatibility with non-C++11 builds, the Add-Override
> Transform
> > -supports detection and use of these macros instead of using the
> ``override``
> > -keyword directly. Specify ``-override-macros`` on the command line to
> the
> > -Modernizer to enable this behavior.
> > -
> > -
> > -Known Limitations
> > -=
> > -* This transform 

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

2015-12-22 Thread Richard Smith via cfe-commits
rsmith added inline comments.


Comment at: include/clang/AST/DeclTemplate.h:836
@@ -835,2 +835,3 @@
 
+  bool IsConcept : 1;
 protected:

This might make more sense on `TemplateDecl`, since we also want this flag for 
`VarTemplateDecl`s. In any case, please use some existing spare bit for this 
rather than making all `FunctionTemplateDecl`s 8 bytes larger by putting it 
here.


Comment at: include/clang/AST/DeclTemplate.h:986
@@ +985,3 @@
+  bool isConcept() const { return IsConcept; }
+  void setConcept(bool IC) { IsConcept = IC; }
+

Do we need a setter for this? (Can it change after the decl is constructed?)


Comment at: lib/Sema/SemaDecl.cpp:7681
@@ +7680,3 @@
+Diag(D.getDeclSpec().getConceptSpecLoc(),
+ diag::err_concept_specified_specialization) << 1;
+  }

Yes, I think that's a reasonable way forward. You can change either 
`TemplatedDecl` or `TemplateParams` into a `PointerIntPair` to avoid making 
`TemplateDecl` larger.


Comment at: lib/Sema/SemaTemplate.cpp:7672-7674
@@ +7671,5 @@
+  // applied only to the definition of a function template or variable 
template,
+  // declared in namespace scope. A concept definition refers to either a
+  // function concept and its definition or a variable concept and its
+  // initializer.
+  if (D.getDeclSpec().isConceptSpecified()) {

I don't think we need to quote the second sentence here.


Comment at: lib/Sema/SemaTemplate.cpp:7677
@@ +7676,3 @@
+Diag(D.getDeclSpec().getConceptSpecLoc(),
+ diag:: err_concept_specified_specialization) << 0;
+return true;

No space after `::`


http://reviews.llvm.org/D13357



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


[libcxxabi] r256323 - Add new tests for throwing incomplete pointer types

2015-12-22 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Dec 23 01:04:32 2015
New Revision: 256323

URL: http://llvm.org/viewvc/llvm-project?rev=256323=rev
Log:
Add new tests for throwing incomplete pointer types

Modified:
libcxxabi/trunk/test/incomplete_type.sh.cpp

Modified: libcxxabi/trunk/test/incomplete_type.sh.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/incomplete_type.sh.cpp?rev=256323=256322=256323=diff
==
--- libcxxabi/trunk/test/incomplete_type.sh.cpp (original)
+++ libcxxabi/trunk/test/incomplete_type.sh.cpp Wed Dec 23 01:04:32 2015
@@ -14,9 +14,9 @@
 // incomplete flags set, equality can be tested by comparing the type_info
 // addresses.
 
-// RUN: %cxx %compile_flags -c %s -o %t.one.o
-// RUN: %cxx %compile_flags -c %s -o %t.two.o -DTU_ONE
-// RUN: %cxx %link_flags -o %t.exe %t.one.o %t.two.o
+// RUN: %cxx %flags %compile_flags -c %s -o %t.one.o
+// RUN: %cxx %flags %compile_flags -c %s -o %t.two.o -DTU_ONE
+// RUN: %cxx %flags %link_flags -o %t.exe %t.one.o %t.two.o
 // RUN: %t.exe
 
 #include 
@@ -24,28 +24,42 @@
 #include 
 
 struct NeverDefined;
-void ThrowNeverDefined();
+void ThrowNeverDefinedMP();
 
 struct IncompleteAtThrow;
-void ThrowIncomplete();
-std::type_info const& ReturnTypeInfoIncomplete();
+void ThrowIncompleteMP();
+void ThrowIncompletePP();
+void ThrowIncompletePMP();
+std::type_info const& ReturnTypeInfoIncompleteMP();
+std::type_info const& ReturnTypeInfoIncompletePP();
 
 struct CompleteAtThrow;
-void ThrowComplete();
-std::type_info const& ReturnTypeInfoComplete();
+void ThrowCompleteMP();
+void ThrowCompletePP();
+void ThrowCompletePMP();
+std::type_info const& ReturnTypeInfoCompleteMP();
+std::type_info const& ReturnTypeInfoCompletePP();
 
 void ThrowNullptr();
 
 #ifndef TU_ONE
 
-void ThrowNeverDefined() { throw (int NeverDefined::*)nullptr; }
+void ThrowNeverDefinedMP() { throw (int NeverDefined::*)nullptr; }
 
-void ThrowIncomplete() { throw (int IncompleteAtThrow::*)nullptr; }
-std::type_info const& ReturnTypeInfoIncomplete() { return typeid(int 
IncompleteAtThrow::*); }
+void ThrowIncompleteMP() { throw (int IncompleteAtThrow::*)nullptr; }
+void ThrowIncompletePP() { throw (IncompleteAtThrow**)nullptr; }
+void ThrowIncompletePMP() { throw (int IncompleteAtThrow::**)nullptr; }
+
+std::type_info const& ReturnTypeInfoIncompleteMP() { return typeid(int 
IncompleteAtThrow::*); }
+std::type_info const& ReturnTypeInfoIncompletePP() { return 
typeid(IncompleteAtThrow**); }
 
 struct CompleteAtThrow {};
-void ThrowComplete() { throw (int CompleteAtThrow::*)nullptr; }
-std::type_info const& ReturnTypeInfoComplete() { return typeid(int 
CompleteAtThrow::*); }
+void ThrowCompleteMP() { throw (int CompleteAtThrow::*)nullptr; }
+void ThrowCompletePP() { throw (CompleteAtThrow**)nullptr; }
+void ThrowCompletePMP() { throw (int CompleteAtThrow::**)nullptr; }
+
+std::type_info const& ReturnTypeInfoCompleteMP() { return typeid(int 
CompleteAtThrow::*); }
+std::type_info const& ReturnTypeInfoCompletePP() { return 
typeid(CompleteAtThrow**); }
 
 void ThrowNullptr() { throw nullptr; }
 
@@ -54,16 +68,81 @@ void ThrowNullptr() { throw nullptr; }
 struct IncompleteAtThrow {};
 
 int main() {
-  assert(ReturnTypeInfoIncomplete() != typeid(int IncompleteAtThrow::*));
   try {
-ThrowIncomplete();
+ThrowNeverDefinedMP();
+assert(false);
+  } catch (int IncompleteAtThrow::*) {
+assert(false);
+  } catch (int CompleteAtThrow::*) {
+assert(false);
+  } catch (int NeverDefined::*) {}
+
+  assert(ReturnTypeInfoIncompleteMP() != typeid(int IncompleteAtThrow::*));
+  try {
+ThrowIncompleteMP();
+assert(false);
+  } catch (CompleteAtThrow**) {
+assert(false);
+  } catch (int CompleteAtThrow::*) {
+assert(false);
+  } catch (IncompleteAtThrow**) {
+assert(false);
   } catch (int IncompleteAtThrow::*) {}
 
-  assert(ReturnTypeInfoComplete() != typeid(int CompleteAtThrow::*));
+  assert(ReturnTypeInfoIncompletePP() != typeid(IncompleteAtThrow**));
+  try {
+ThrowIncompletePP();
+assert(false);
+  } catch (int IncompleteAtThrow::*) {
+assert(false);
+  } catch (IncompleteAtThrow**) {}
+
   try {
-ThrowComplete();
+ThrowIncompletePMP();
+assert(false);
+  } catch (int IncompleteAtThrow::*) {
+assert(false);
+  } catch (IncompleteAtThrow**) {
+assert(false);
+  } catch (int IncompleteAtThrow::**) {}
+
+  assert(ReturnTypeInfoCompleteMP() != typeid(int CompleteAtThrow::*));
+  try {
+ThrowCompleteMP();
+assert(false);
+  } catch (IncompleteAtThrow**) {
+assert(false);
+  } catch (int IncompleteAtThrow::*) {
+assert(false);
+  } catch (CompleteAtThrow**) {
+assert(false);
   } catch (int CompleteAtThrow::*) {}
 
+  assert(ReturnTypeInfoCompletePP() != typeid(CompleteAtThrow**));
+  try {
+ThrowCompletePP();
+assert(false);
+  } catch (IncompleteAtThrow**) {
+assert(false);
+  } catch (int IncompleteAtThrow::*) {
+

r256319 - [Sema] Make an enum local to the only method that uses it. NFC

2015-12-22 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Tue Dec 22 23:44:46 2015
New Revision: 256319

URL: http://llvm.org/viewvc/llvm-project?rev=256319=rev
Log:
[Sema] Make an enum local to the only method that uses it. NFC

Modified:
cfe/trunk/lib/Sema/SemaChecking.cpp

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=256319=256318=256319=diff
==
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Tue Dec 22 23:44:46 2015
@@ -7570,12 +7570,6 @@ void AnalyzeImplicitConversions(Sema ,
 
 } // end anonymous namespace
 
-enum {
-  AddressOf,
-  FunctionPointer,
-  ArrayPointer
-};
-
 // Helper function for Sema::DiagnoseAlwaysNonNullPointer.
 // Returns true when emitting a warning about taking the address of a 
reference.
 static bool CheckForReference(Sema , const Expr *E,
@@ -7757,7 +7751,11 @@ void Sema::DiagnoseAlwaysNonNullPointer(
 
   unsigned DiagID = IsCompare ? diag::warn_null_pointer_compare
   : diag::warn_impcast_pointer_to_bool;
-  unsigned DiagType;
+  enum {
+AddressOf,
+FunctionPointer,
+ArrayPointer
+  } DiagType;
   if (IsAddressOf)
 DiagType = AddressOf;
   else if (IsFunction)


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


r256318 - [Sema] Use available enum types instead of integers. As one is used in a switch, this makes the compiler ensure the switch is fully covered. NFC

2015-12-22 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Tue Dec 22 23:44:43 2015
New Revision: 256318

URL: http://llvm.org/viewvc/llvm-project?rev=256318=rev
Log:
[Sema] Use available enum types instead of integers. As one is used in a 
switch, this makes the compiler ensure the switch is fully covered. NFC

Modified:
cfe/trunk/lib/Sema/SemaStmtAttr.cpp

Modified: cfe/trunk/lib/Sema/SemaStmtAttr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmtAttr.cpp?rev=256318=256317=256318=diff
==
--- cfe/trunk/lib/Sema/SemaStmtAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmtAttr.cpp Tue Dec 22 23:44:43 2015
@@ -150,9 +150,8 @@ CheckForIncompatibleAttributes(Sema ,
 if (!LH)
   continue;
 
-int Option = LH->getOption();
-int Category;
-enum { Vectorize, Interleave, Unroll };
+LoopHintAttr::OptionType Option = LH->getOption();
+enum { Vectorize, Interleave, Unroll } Category;
 switch (Option) {
 case LoopHintAttr::Vectorize:
 case LoopHintAttr::VectorizeWidth:


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


[libcxxabi] r256322 - Fix PR25898 - Check for incomplete pointers types in can_catch(...)

2015-12-22 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Dec 23 00:35:25 2015
New Revision: 256322

URL: http://llvm.org/viewvc/llvm-project?rev=256322=rev
Log:
Fix PR25898 - Check for incomplete pointers types in can_catch(...)

Added:
libcxxabi/trunk/test/incomplete_type.sh.cpp
Modified:
libcxxabi/trunk/src/private_typeinfo.cpp

Modified: libcxxabi/trunk/src/private_typeinfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/private_typeinfo.cpp?rev=256322=256321=256322=diff
==
--- libcxxabi/trunk/src/private_typeinfo.cpp (original)
+++ libcxxabi/trunk/src/private_typeinfo.cpp Wed Dec 23 00:35:25 2015
@@ -34,9 +34,12 @@
 // 
 // _LIBCXX_DYNAMIC_FALLBACK is currently off by default.
 
+
+#include 
+
+
 #ifdef _LIBCXX_DYNAMIC_FALLBACK
 #include "abort_message.h"
-#include 
 #include 
 #endif
 
@@ -57,31 +60,19 @@ namespace __cxxabiv1
 
 #pragma GCC visibility push(hidden)
 
-#ifdef _LIBCXX_DYNAMIC_FALLBACK
-
 inline
 bool
 is_equal(const std::type_info* x, const std::type_info* y, bool use_strcmp)
 {
+#ifndef _WIN32
 if (!use_strcmp)
 return x == y;
 return strcmp(x->name(), y->name()) == 0;
-}
-
-#else  // !_LIBCXX_DYNAMIC_FALLBACK
-
-inline
-bool
-is_equal(const std::type_info* x, const std::type_info* y, bool)
-{
-#ifndef _WIN32
-return x == y;
 #else
 return (x == y) || (strcmp(x->name(), y->name()) == 0);
-#endif
+#endif
 }
 
-#endif  // _LIBCXX_DYNAMIC_FALLBACK
 
 // __shim_type_info
 
@@ -351,8 +342,17 @@ bool
 __pbase_type_info::can_catch(const __shim_type_info* thrown_type,
  void*&) const
 {
-return is_equal(this, thrown_type, false) ||
-   is_equal(thrown_type, (std::nullptr_t), false);
+if (is_equal(thrown_type, (std::nullptr_t), false)) return true;
+bool use_strcmp = this->__flags & (__incomplete_class_mask |
+   __incomplete_mask);
+if (!use_strcmp) {
+const __pbase_type_info* thrown_pbase = dynamic_cast(
+thrown_type);
+if (!thrown_pbase) return false;
+use_strcmp = thrown_pbase->__flags & (__incomplete_class_mask |
+  __incomplete_mask);
+}
+return is_equal(this, thrown_type, use_strcmp);
 }
 
 #ifdef __clang__

Added: libcxxabi/trunk/test/incomplete_type.sh.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/incomplete_type.sh.cpp?rev=256322=auto
==
--- libcxxabi/trunk/test/incomplete_type.sh.cpp (added)
+++ libcxxabi/trunk/test/incomplete_type.sh.cpp Wed Dec 23 00:35:25 2015
@@ -0,0 +1,83 @@
+//===- incomplete_type.cpp 
--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+// http://mentorembedded.github.io/cxx-abi/abi.html#rtti-layout
+
+// Two abi::__pbase_type_info objects can always be compared for equality
+// (i.e. of the types represented) or ordering by comparison of their name
+// NTBS addresses. In addition, unless either or both have either of the
+// incomplete flags set, equality can be tested by comparing the type_info
+// addresses.
+
+// RUN: %cxx %compile_flags -c %s -o %t.one.o
+// RUN: %cxx %compile_flags -c %s -o %t.two.o -DTU_ONE
+// RUN: %cxx %link_flags -o %t.exe %t.one.o %t.two.o
+// RUN: %t.exe
+
+#include 
+#include 
+#include 
+
+struct NeverDefined;
+void ThrowNeverDefined();
+
+struct IncompleteAtThrow;
+void ThrowIncomplete();
+std::type_info const& ReturnTypeInfoIncomplete();
+
+struct CompleteAtThrow;
+void ThrowComplete();
+std::type_info const& ReturnTypeInfoComplete();
+
+void ThrowNullptr();
+
+#ifndef TU_ONE
+
+void ThrowNeverDefined() { throw (int NeverDefined::*)nullptr; }
+
+void ThrowIncomplete() { throw (int IncompleteAtThrow::*)nullptr; }
+std::type_info const& ReturnTypeInfoIncomplete() { return typeid(int 
IncompleteAtThrow::*); }
+
+struct CompleteAtThrow {};
+void ThrowComplete() { throw (int CompleteAtThrow::*)nullptr; }
+std::type_info const& ReturnTypeInfoComplete() { return typeid(int 
CompleteAtThrow::*); }
+
+void ThrowNullptr() { throw nullptr; }
+
+#else
+
+struct IncompleteAtThrow {};
+
+int main() {
+  assert(ReturnTypeInfoIncomplete() != typeid(int IncompleteAtThrow::*));
+  try {
+ThrowIncomplete();
+  } catch (int IncompleteAtThrow::*) {}
+
+  assert(ReturnTypeInfoComplete() != typeid(int CompleteAtThrow::*));
+  try {
+ThrowComplete();
+  } catch (int CompleteAtThrow::*) {}
+
+#if __cplusplus >= 201103L
+  // Catch nullptr as complete type
+  try {
+ThrowNullptr();
+  } catch (int IncompleteAtThrow::*) {}
+
+  // Catch nullptr as an incomplete type
+  try {
+

Re: [PATCH] D15227: [analyzer] Valist checkers.

2015-12-22 Thread Gábor Horváth via cfe-commits
xazax.hun marked 9 inline comments as done.
xazax.hun added a comment.

It was tested on gcc and rAthena (https://github.com/rathena/rathena). It did 
not find any issues in those projects, but I was able to find some issues that 
I artificially put into those projects.



Comment at: lib/StaticAnalyzer/Checkers/ValistChecker.cpp:30
@@ +29,3 @@
+
+struct VAListAcceptingFunc {
+  mutable IdentifierInfo *II;

zaks.anna wrote:
> This looks like a general purpose utility that could be used by other 
> checkers.
> (Though, this code might not support all languages as is.)
I agree.
Right now it does not support namespaces, overloading on the types of the 
argument, overloading on CV qualifiers etc. Do you have any other language 
features that is not supported in mind?
Supporting all of that might be useful but I am a bit afraid of the result 
being bloated. What do you think, what would be the most appropriate place to 
put such utility? It could be a helper class in CallEvent.cpp/h.


Comment at: lib/StaticAnalyzer/Checkers/ValistChecker.cpp:54
@@ +53,3 @@
+
+  static const SmallVector, 15> VAArgLikes;
+  static const VAListAcceptingFunc VaStart, VaEnd, VaCopy;

zaks.anna wrote:
> What are "likes" ?
va_list accepting functions.


Comment at: lib/StaticAnalyzer/Checkers/ValistChecker.cpp:82
@@ +81,3 @@
+  bool IsCopy) const;
+  void checkEndCall(const CallEvent , CheckerContext ) const;
+

zaks.anna wrote:
> Maybe these could be called "checkVAListEndCall" or something similar; as is 
> they are too similar to "checkPreCall/checkPostCall".
You are right, I will rename this to better reflect their role.


Comment at: lib/StaticAnalyzer/Checkers/ValistChecker.cpp:204
@@ +203,3 @@
+
+StringRef ValistChecker::getVariableNameFromRegion(const MemRegion *Reg) const 
{
+  const ElementRegion *EReg;

zaks.anna wrote:
> This should be a general-purpose utility. It's not a good idea for each 
> checker to roll their own implementation:) See 'variableName' in 
> http://reviews.llvm.org/D12761.
> 
> There could be other places in the analyzer where we print the names. 
> 
I agree that it would be great to have this as a general utility. I think I 
should wait until the implementation from the other checker gets commited.


Comment at: lib/StaticAnalyzer/Checkers/ValistChecker.cpp:217
@@ +216,3 @@
+
+const ExplodedNode *ValistChecker::getStartCallSite(const ExplodedNode *N,
+const MemRegion *Reg,

zaks.anna wrote:
> Please, add a comment explaining what this does and roughly how.
> 
> Looks like the main difference with Malloc checker's getAllocationSite is 
> that this does not look for the ReferenceRegion. That might not matter for va 
> lists since the usage is not likely to span many inlined functions, is that 
> correct?
Right. Clarified this in the comment.


Comment at: test/Analysis/Inputs/system-header-simulator-for-valist.h:4
@@ +3,3 @@
+// functions do not arbitrarily free() their parameters, and that some bugs
+// found in system headers cannot be fixed by the user and should be
+// suppressed.

zaks.anna wrote:
> Does the second part of the comment refer to something you test for here?
Added a test for it.


Comment at: test/Analysis/Inputs/system-header-simulator-valist.h:3
@@ +2,3 @@
+
+#pragma clang system_header
+

zaks.anna wrote:
> Is this an unused duplicate file?
Yes, it is.


Comment at: test/Analysis/valist-uninitialized.c:98
@@ +97,3 @@
+  va_end(va);
+} // no-warning
+

zaks.anna wrote:
> The majority of functions end with "//no-warning" comment. Why is that?
To indicate that, no leak related warning there. Do you prefer to remove those 
comments?


Comment at: test/Analysis/valist-uninitialized.c:134
@@ +133,3 @@
+
+// NOTE: this is invalid, as the man page of va_end requires that "Each 
invocation of va_start()
+// must be matched by a corresponding  invocation of va_end() in the same 
function."

zaks.anna wrote:
> Is this something we would want to warn on or not?
We should definitely wanr on that, but I think it should be ok to add this 
feature later.


http://reviews.llvm.org/D15227



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


r256240 - [mips] Add _GCC_HAVE_SYNC_COMPARE_AND_SWAP macros.

2015-12-22 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Tue Dec 22 06:59:30 2015
New Revision: 256240

URL: http://llvm.org/viewvc/llvm-project?rev=256240=rev
Log:
[mips] Add _GCC_HAVE_SYNC_COMPARE_AND_SWAP macros.

This fixes the 'pure virtual function called' failure with ThreadPool in a
clang-built clang. This fixes the llvm-mips-linux builder.


Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Preprocessor/predefined-macros.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=256240=256239=256240=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Tue Dec 22 06:59:30 2015
@@ -6585,6 +6585,12 @@ public:
 
 Builder.defineMacro("_MIPS_ARCH", "\"" + CPU + "\"");
 Builder.defineMacro("_MIPS_ARCH_" + StringRef(CPU).upper());
+
+// These shouldn't be defined for MIPS-I but there's no need to check
+// for that since MIPS-I isn't supported.
+Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
+Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
+Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
   }
 
   ArrayRef getTargetBuiltins() const override {
@@ -6959,6 +6965,8 @@ public:
 }
 else
   llvm_unreachable("Invalid ABI for Mips64.");
+
+Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
   }
   ArrayRef getGCCRegAliases() const override {
 static const TargetInfo::GCCRegAlias GCCRegAliases[] = {

Modified: cfe/trunk/test/Preprocessor/predefined-macros.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/predefined-macros.c?rev=256240=256239=256240=diff
==
--- cfe/trunk/test/Preprocessor/predefined-macros.c (original)
+++ cfe/trunk/test/Preprocessor/predefined-macros.c Tue Dec 22 06:59:30 2015
@@ -134,3 +134,15 @@
 // RUN: %clang_cc1 %s -E -dM -o - -triple armv6 -target-cpu cortex-m0 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-SYNC_CAS_ARMv6
 // CHECK-SYNC_CAS_ARMv6-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP
+//
+// RUN: %clang_cc1 %s -E -dM -o - -triple mips -target-cpu mips2 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-SYNC_CAS_MIPS \
+// RUN: --check-prefix=CHECK-SYNC_CAS_MIPS32
+// RUN: %clang_cc1 %s -E -dM -o - -triple mips64 -target-cpu mips3 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-SYNC_CAS_MIPS \
+// RUN: --check-prefix=CHECK-SYNC_CAS_MIPS64
+// CHECK-SYNC_CAS_MIPS:   __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
+// CHECK-SYNC_CAS_MIPS:   __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
+// CHECK-SYNC_CAS_MIPS:   __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
+// CHECK-SYNC_CAS_MIPS32-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
+// CHECK-SYNC_CAS_MIPS64: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8


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


Re: [PATCH] D15166: Fix C++ support on recent DragonFly BSD releases

2015-12-22 Thread Davide Italiano via cfe-commits
davide added a subscriber: davide.
davide accepted this revision.
davide added a reviewer: davide.
davide added a comment.
This revision is now accepted and ready to land.

The patch looks good, and the changes are localized to the DflyBSD driver so if 
you tested and works, I'm fine with it. I'll comit that unless objections rise.


http://reviews.llvm.org/D15166



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


r256238 - [OPENMP 4.5] Parsing/sema for 'depend(sink:vec)' clause in 'ordered' directive.

2015-12-22 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Tue Dec 22 06:21:47 2015
New Revision: 256238

URL: http://llvm.org/viewvc/llvm-project?rev=256238=rev
Log:
[OPENMP 4.5] Parsing/sema for 'depend(sink:vec)' clause in 'ordered' directive.
OpenMP 4.5 adds 'depend(sink:vec)' in 'ordered' directive for doacross loop 
synchronization. Patch adds parsing and semantic analysis for this clause.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Basic/OpenMPKinds.def
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/test/OpenMP/ordered_ast_print.cpp
cfe/trunk/test/OpenMP/ordered_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=256238=256237=256238=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Dec 22 06:21:47 
2015
@@ -7951,6 +7951,16 @@ def err_omp_firstprivate_distribute_in_t
   "reduction variable in '#pragma omp teams' cannot be firstprivate in 
'#pragma omp distribute'">;
 def err_omp_depend_clause_thread_simd : Error<
   "'depend' clauses cannot be mixed with '%0' clause">;
+def err_omp_depend_sink_wrong_expr : Error<
+  "expected expression form x[+-d], where x is the loop iteration variable and 
d is a constant non-negative integer">;
+def err_omp_depend_sink_expected_loop_iteration : Error<
+  "expected %0 loop iteration variable">;
+def err_omp_depend_sink_unexpected_expr : Error<
+  "unexpected expression: number of expressions is larger than the number of 
associated loops">;
+def err_omp_depend_sink_expected_plus_minus : Error<
+  "expected '+' or '-' operation">;
+def err_omp_depend_sink_source_not_allowed : Error<
+  "'depend(%select{source|sink:vec}0)' clause%select{|s}0 cannot be mixed with 
'depend(%select{sink:vec|source}0)' clause%select{s|}0">;
 } // end of OpenMP category
 
 let CategoryName = "Related Result Type Issue" in {

Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.def?rev=256238=256237=256238=diff
==
--- cfe/trunk/include/clang/Basic/OpenMPKinds.def (original)
+++ cfe/trunk/include/clang/Basic/OpenMPKinds.def Tue Dec 22 06:21:47 2015
@@ -255,6 +255,7 @@ OPENMP_DEPEND_KIND(in)
 OPENMP_DEPEND_KIND(out)
 OPENMP_DEPEND_KIND(inout)
 OPENMP_DEPEND_KIND(source)
+OPENMP_DEPEND_KIND(sink)
 
 // Modifiers for 'linear' clause.
 OPENMP_LINEAR_KIND(val)

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=256238=256237=256238=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Tue Dec 22 06:21:47 2015
@@ -7760,8 +7760,10 @@ private:
   /// \brief Initialization of data-sharing attributes stack.
   void InitDataSharingAttributesStack();
   void DestroyDataSharingAttributesStack();
-  ExprResult VerifyPositiveIntegerConstantInClause(Expr *Op,
-   OpenMPClauseKind CKind);
+  ExprResult
+  VerifyPositiveIntegerConstantInClause(Expr *Op, OpenMPClauseKind CKind,
+bool StrictlyPositive = true);
+
 public:
   /// \brief Return true if the provided declaration \a VD should be captured 
by
   /// reference in the provided scope \a RSI. This will take into account the

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=256238=256237=256238=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Tue Dec 22 06:21:47 2015
@@ -2556,6 +2556,7 @@ void CGOpenMPRuntime::emitTaskCall(
 DepKind = DepInOut;
 break;
   case OMPC_DEPEND_source:
+  case OMPC_DEPEND_sink:
   case OMPC_DEPEND_unknown:
 llvm_unreachable("Unknown task dependence type");
   }

Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=256238=256237=256238=diff
==
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Tue Dec 22 06:21:47 2015
@@ -89,7 +89,7 @@ private:
   };
   typedef llvm::SmallDenseMap DeclSAMapTy;
   typedef llvm::SmallDenseMap AlignedMapTy;
-  typedef llvm::DenseSet LoopControlVariablesSetTy;
+  typedef llvm::DenseMap 

r256239 - [OPENMP] Revert r256238 to fix the problem with tests on Linux.

2015-12-22 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Tue Dec 22 06:44:46 2015
New Revision: 256239

URL: http://llvm.org/viewvc/llvm-project?rev=256239=rev
Log:
[OPENMP] Revert r256238 to fix the problem with tests on Linux.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Basic/OpenMPKinds.def
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/test/OpenMP/ordered_ast_print.cpp
cfe/trunk/test/OpenMP/ordered_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=256239=256238=256239=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Dec 22 06:44:46 
2015
@@ -7951,16 +7951,6 @@ def err_omp_firstprivate_distribute_in_t
   "reduction variable in '#pragma omp teams' cannot be firstprivate in 
'#pragma omp distribute'">;
 def err_omp_depend_clause_thread_simd : Error<
   "'depend' clauses cannot be mixed with '%0' clause">;
-def err_omp_depend_sink_wrong_expr : Error<
-  "expected expression form x[+-d], where x is the loop iteration variable and 
d is a constant non-negative integer">;
-def err_omp_depend_sink_expected_loop_iteration : Error<
-  "expected %0 loop iteration variable">;
-def err_omp_depend_sink_unexpected_expr : Error<
-  "unexpected expression: number of expressions is larger than the number of 
associated loops">;
-def err_omp_depend_sink_expected_plus_minus : Error<
-  "expected '+' or '-' operation">;
-def err_omp_depend_sink_source_not_allowed : Error<
-  "'depend(%select{source|sink:vec}0)' clause%select{|s}0 cannot be mixed with 
'depend(%select{sink:vec|source}0)' clause%select{s|}0">;
 } // end of OpenMP category
 
 let CategoryName = "Related Result Type Issue" in {

Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.def?rev=256239=256238=256239=diff
==
--- cfe/trunk/include/clang/Basic/OpenMPKinds.def (original)
+++ cfe/trunk/include/clang/Basic/OpenMPKinds.def Tue Dec 22 06:44:46 2015
@@ -255,7 +255,6 @@ OPENMP_DEPEND_KIND(in)
 OPENMP_DEPEND_KIND(out)
 OPENMP_DEPEND_KIND(inout)
 OPENMP_DEPEND_KIND(source)
-OPENMP_DEPEND_KIND(sink)
 
 // Modifiers for 'linear' clause.
 OPENMP_LINEAR_KIND(val)

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=256239=256238=256239=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Tue Dec 22 06:44:46 2015
@@ -7760,10 +7760,8 @@ private:
   /// \brief Initialization of data-sharing attributes stack.
   void InitDataSharingAttributesStack();
   void DestroyDataSharingAttributesStack();
-  ExprResult
-  VerifyPositiveIntegerConstantInClause(Expr *Op, OpenMPClauseKind CKind,
-bool StrictlyPositive = true);
-
+  ExprResult VerifyPositiveIntegerConstantInClause(Expr *Op,
+   OpenMPClauseKind CKind);
 public:
   /// \brief Return true if the provided declaration \a VD should be captured 
by
   /// reference in the provided scope \a RSI. This will take into account the

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=256239=256238=256239=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Tue Dec 22 06:44:46 2015
@@ -2556,7 +2556,6 @@ void CGOpenMPRuntime::emitTaskCall(
 DepKind = DepInOut;
 break;
   case OMPC_DEPEND_source:
-  case OMPC_DEPEND_sink:
   case OMPC_DEPEND_unknown:
 llvm_unreachable("Unknown task dependence type");
   }

Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=256239=256238=256239=diff
==
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Tue Dec 22 06:44:46 2015
@@ -89,7 +89,7 @@ private:
   };
   typedef llvm::SmallDenseMap DeclSAMapTy;
   typedef llvm::SmallDenseMap AlignedMapTy;
-  typedef llvm::DenseMap LoopControlVariablesMapTy;
+  typedef llvm::DenseSet LoopControlVariablesSetTy;
   typedef llvm::SmallDenseMap MappedDeclsTy;
   typedef llvm::StringMap
   CriticalsWithHintsTy;
@@ -98,7 +98,7 @@ private:
 

Re: r256216 - [WebAssembly] Remove the -target command-line flag from the ld commandline.

2015-12-22 Thread Rafael Espíndola via cfe-commits
Thanks!

On 21 December 2015 at 18:30, Dan Gohman via cfe-commits
 wrote:
> Author: djg
> Date: Mon Dec 21 17:30:41 2015
> New Revision: 256216
>
> URL: http://llvm.org/viewvc/llvm-project?rev=256216=rev
> Log:
> [WebAssembly] Remove the -target command-line flag from the ld commandline.
>
> This flag isn't needed, or permitted, with the "ld" flavor of lld.
>
> Also, add a basic ld commandline test.
>
> Added:
> cfe/trunk/test/Driver/wasm-toolchain.c
> Modified:
> cfe/trunk/lib/Driver/Tools.cpp
>
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=256216=256215=256216=diff
> ==
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Mon Dec 21 17:30:41 2015
> @@ -6516,8 +6516,6 @@ void wasm::Linker::ConstructJob(Compilat
>ArgStringList CmdArgs;
>CmdArgs.push_back("-flavor");
>CmdArgs.push_back("ld");
> -  CmdArgs.push_back("-target");
> -  CmdArgs.push_back(Args.MakeArgString(getToolChain().getTripleString()));
>AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
>CmdArgs.push_back("-o");
>CmdArgs.push_back(Output.getFilename());
>
> Added: cfe/trunk/test/Driver/wasm-toolchain.c
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/wasm-toolchain.c?rev=256216=auto
> ==
> --- cfe/trunk/test/Driver/wasm-toolchain.c (added)
> +++ cfe/trunk/test/Driver/wasm-toolchain.c Mon Dec 21 17:30:41 2015
> @@ -0,0 +1,3 @@
> +// RUN: %clang -### -target wasm32-unknown-unknown -x assembler %s 2>&1 | 
> FileCheck -check-prefix=AS_LINK %s
> +// AS_LINK: clang{{.*}}" "-cc1as" {{.*}} "-o" "[[temp:[^"]*]]"
> +// AS_LINK: lld" "-flavor" "ld" "[[temp]]" "-o" "a.out"
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15705: Adding a scripted test for PR25717

2015-12-22 Thread Rafael Espíndola via cfe-commits
Can't you use the preprocessor to  produce a large output? See the
testcase in https://llvm.org/bugs/show_bug.cgi?id=10651#c10 for
example.

Cheers,
Rafael

On 21 December 2015 at 20:07, Yunzhong Gao via cfe-commits
 wrote:
> ygao created this revision.
> ygao added subscribers: cfe-commits, rsandifo, majnemer, aaron.ballman.
>
> Hi,
> I am trying to add a test for PR25717. The test itself is fairly 
> straight-forward: it generates a
> large .c temporary file on the fly and then runs the preprocessor over the 
> generated file to
> make sure we do not see any unexpected fatal errors.
> I have never added a scripted test before, so it would be really nice if 
> someone with this
> experience could take a look that I did make all the necessary changes.
> Many thanks in advance,
> - Gao
>
> http://reviews.llvm.org/D15705
>
> Files:
>   test/Preprocessor/bigoutput.py
>   test/Preprocessor/lit.local.cfg
>
> Index: test/Preprocessor/lit.local.cfg
> ===
> --- test/Preprocessor/lit.local.cfg
> +++ test/Preprocessor/lit.local.cfg
> @@ -0,0 +1,2 @@
> +config.suffixes = ['.c', '.cpp', '.m', '.mm', '.cu', '.cl', '.s', '.S', 
> '.py']
> +
> Index: test/Preprocessor/bigoutput.py
> ===
> --- test/Preprocessor/bigoutput.py
> +++ test/Preprocessor/bigoutput.py
> @@ -0,0 +1,11 @@
> +# RUN: python %s
> +# RUN: %clang_cc1 -E -x c bigoutput.c | FileCheck %s
> +
> +# Make sure clang does not crash during preprocessing
> +# CHECK-NOT: fatal error
> +
> +f = open("bigoutput.c", "wb")
> +for i in range(0, 15000):
> +  # this test requires UNIX line endings
> +  f.write("int v%d;\n" % i)
> +f.close()
>
>
>
> ___
> 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


r256247 - clang-format: [JS] Support arrays of object-type literals.

2015-12-22 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Tue Dec 22 09:48:35 2015
New Revision: 256247

URL: http://llvm.org/viewvc/llvm-project?rev=256247=rev
Log:
clang-format: [JS] Support arrays of object-type literals.

Before:
  interface I {
o: {}
[];
  }

After:
  interface I {
o: {}[];
  }

Modified:
cfe/trunk/lib/Format/UnwrappedLineParser.cpp
cfe/trunk/unittests/Format/FormatTestJS.cpp

Modified: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineParser.cpp?rev=256247=256246=256247=diff
==
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Tue Dec 22 09:48:35 2015
@@ -357,7 +357,7 @@ void UnwrappedLineParser::calculateBrace
 ProbablyBracedList =
 NextTok->isOneOf(tok::comma, tok::period, tok::colon,
  tok::r_paren, tok::r_square, tok::l_brace,
- tok::l_paren, tok::ellipsis) ||
+ tok::l_square, tok::l_paren, tok::ellipsis) ||
 (NextTok->is(tok::semi) &&
  (!ExpectClassBody || LBraceStack.size() != 1)) ||
 (NextTok->isBinaryOperator() && !NextIsObjCMethod);

Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=256247=256246=256247=diff
==
--- cfe/trunk/unittests/Format/FormatTestJS.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp Tue Dec 22 09:48:35 2015
@@ -768,6 +768,11 @@ TEST_F(FormatTestJS, InterfaceDeclaratio
   verifyFormat("interface a {}\n"
"export function b() {}\n"
"var x;");
+
+  // Arrays of object type literals.
+  verifyFormat("interface I {\n"
+   "  o: {}[];\n"
+   "}");
 }
 
 TEST_F(FormatTestJS, EnumDeclarations) {


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


r256245 - clang-format: [JS] "operator" is not a keyword in Java/JavaScript.

2015-12-22 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Tue Dec 22 09:47:56 2015
New Revision: 256245

URL: http://llvm.org/viewvc/llvm-project?rev=256245=rev
Log:
clang-format: [JS] "operator" is not a keyword in Java/JavaScript.

Modified:
cfe/trunk/lib/Format/Format.cpp
cfe/trunk/unittests/Format/FormatTestJS.cpp
cfe/trunk/unittests/Format/FormatTestJava.cpp

Modified: cfe/trunk/lib/Format/Format.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=256245=256244=256245=diff
==
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Tue Dec 22 09:47:56 2015
@@ -1274,11 +1274,13 @@ private:
   FormatTok->Tok.setIdentifierInfo();
   FormatTok->Tok.setKind(Info.getTokenID());
   if (Style.Language == FormatStyle::LK_Java &&
-  FormatTok->isOneOf(tok::kw_struct, tok::kw_union, tok::kw_delete)) {
+  FormatTok->isOneOf(tok::kw_struct, tok::kw_union, tok::kw_delete,
+ tok::kw_operator)) {
 FormatTok->Tok.setKind(tok::identifier);
 FormatTok->Tok.setIdentifierInfo(nullptr);
   } else if (Style.Language == FormatStyle::LK_JavaScript &&
- FormatTok->isOneOf(tok::kw_struct, tok::kw_union)) {
+ FormatTok->isOneOf(tok::kw_struct, tok::kw_union,
+tok::kw_operator)) {
 FormatTok->Tok.setKind(tok::identifier);
 FormatTok->Tok.setIdentifierInfo(nullptr);
   }

Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=256245=256244=256245=diff
==
--- cfe/trunk/unittests/Format/FormatTestJS.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp Tue Dec 22 09:47:56 2015
@@ -115,6 +115,11 @@ TEST_F(FormatTestJS, ReservedWords) {
   verifyFormat("var union = 2;");
 }
 
+TEST_F(FormatTestJS, CppKeywords) {
+  // Make sure we don't mess stuff up because of C++ keywords.
+  verifyFormat("return operator && (aa);");
+}
+
 TEST_F(FormatTestJS, ES6DestructuringAssignment) {
   verifyFormat("var [a, b, c] = [1, 2, 3];");
   verifyFormat("let [a, b, c] = [1, 2, 3];");

Modified: cfe/trunk/unittests/Format/FormatTestJava.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJava.cpp?rev=256245=256244=256245=diff
==
--- cfe/trunk/unittests/Format/FormatTestJava.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestJava.cpp Tue Dec 22 09:47:56 2015
@@ -426,6 +426,7 @@ TEST_F(FormatTestJava, CppKeywords) {
   verifyFormat("public void union(Type a, Type b);");
   verifyFormat("public void struct(Object o);");
   verifyFormat("public void delete(Object o);");
+  verifyFormat("return operator && (aa);");
 }
 
 TEST_F(FormatTestJava, NeverAlignAfterReturn) {


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


Re: [PATCH] D12407: [clang-format-vs] Add an option to reformat source code when file is saved to disk

2015-12-22 Thread Beren Minor via cfe-commits
berenm marked 8 inline comments as done.
berenm added a comment.

For information, I just tested the current diff under Visual Studio 2010 SP1 
and everything looks fine as well.


http://reviews.llvm.org/D12407



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


Re: [PATCH] D12407: [clang-format-vs] Add an option to reformat source code when file is saved to disk

2015-12-22 Thread Beren Minor via cfe-commits
berenm added a comment.

Actually, the main issue that I see is the difficulty to build the plugin 
itself. The project does not build out-of-the-box on VS2013, and I had to 
change the assembly references by hand.

I have a patch to get the required assemblies in a more portable way using 
nuget packages, but I didn't want to include that in this revision. I'll open a 
separate one if that's useful.


http://reviews.llvm.org/D12407



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


Re: [PATCH] D15166: Fix C++ support on recent DragonFly BSD releases

2015-12-22 Thread John Marino via cfe-commits
jrmarino added a subscriber: jrmarino.
jrmarino added a comment.

Hi, can someone take a look at http://reviews.llvm.org/D15166? 
It's a simple patch but critical for DragonFly.


http://reviews.llvm.org/D15166



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


Re: [PATCH] D15166: Fix C++ support on recent DragonFly BSD releases

2015-12-22 Thread John Marino via cfe-commits
jrmarino added a comment.

Hi Davide,

Yes, the patch is tested it.  We are carrying them in FreeBSD ports (which 
DragonFly uses), so they are being used now.


http://reviews.llvm.org/D15166



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


Re: [PATCH] D15373: Fix for bug 25786 - Assertion "Chunk.Kind == DeclaratorChunk::Function" failed with regparm attribute.

2015-12-22 Thread Alexander Makarov via cfe-commits
a.makarov updated this revision to Diff 43442.
a.makarov added a comment.

Actual updated patch. Sorry for noise.


http://reviews.llvm.org/D15373

Files:
  include/clang/Sema/Sema.h
  lib/Sema/SemaDeclAttr.cpp
  lib/Sema/SemaType.cpp
  test/CodeGen/adding_defaulted_cc_attr_to_type.c
  test/Sema/callingconv.c

Index: lib/Sema/SemaType.cpp
===
--- lib/Sema/SemaType.cpp
+++ lib/Sema/SemaType.cpp
@@ -5856,7 +5856,8 @@
 
   // Otherwise, a calling convention.
   CallingConv CC;
-  if (S.CheckCallingConvAttr(attr, CC))
+  bool isDefaulted = false;
+  if (S.CheckCallingConvAttr(attr, CC, /*FD*/nullptr, ))
 return true;
 
   const FunctionType *fn = unwrapped.get();
@@ -5906,7 +5907,11 @@
   FunctionType::ExtInfo EI = unwrapped.get()->getExtInfo().withCallingConv(CC);
   QualType Equivalent =
   unwrapped.wrap(S, S.Context.adjustFunctionType(unwrapped.get(), EI));
-  type = S.Context.getAttributedType(CCAttrKind, type, Equivalent);
+  // If calling convention was defaulted, we should not create attributed type
+  // with this attribute.
+  if (!isDefaulted)
+type = S.Context.getAttributedType(CCAttrKind, type, Equivalent);
+
   return true;
 }
 
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -3701,8 +3701,8 @@
   }
 }
 
-bool Sema::CheckCallingConvAttr(const AttributeList , CallingConv , 
-const FunctionDecl *FD) {
+bool Sema::CheckCallingConvAttr(const AttributeList , CallingConv ,
+const FunctionDecl *FD, bool *Defaulted) {
   if (attr.isInvalid())
 return true;
 
@@ -3750,11 +3750,16 @@
   default: llvm_unreachable("unexpected attribute kind");
   }
 
+  if (Defaulted)
+*Defaulted = false;
   const TargetInfo  = Context.getTargetInfo();
   TargetInfo::CallingConvCheckResult A = TI.checkCallingConvention(CC);
   if (A != TargetInfo::CCCR_OK) {
-if (A == TargetInfo::CCCR_Warning)
+if (A == TargetInfo::CCCR_Warning) {
   Diag(attr.getLoc(), diag::warn_cconv_ignored) << attr.getName();
+  if (Defaulted)
+*Defaulted = true;
+}
 
 // This convention is not valid for the target. Use the default function or
 // method calling convention.
Index: include/clang/Sema/Sema.h
===
--- include/clang/Sema/Sema.h
+++ include/clang/Sema/Sema.h
@@ -2937,8 +2937,9 @@
   bool isValidPointerAttrType(QualType T, bool RefOkay = false);
 
   bool CheckRegparmAttr(const AttributeList , unsigned );
-  bool CheckCallingConvAttr(const AttributeList , CallingConv , 
-const FunctionDecl *FD = nullptr);
+  bool CheckCallingConvAttr(const AttributeList , CallingConv ,
+const FunctionDecl *FD = nullptr,
+bool *Defaulted = nullptr);
   bool CheckNoReturnAttr(const AttributeList );
   bool checkStringLiteralArgumentAttr(const AttributeList ,
   unsigned ArgNum, StringRef ,
Index: test/CodeGen/adding_defaulted_cc_attr_to_type.c
===
--- test/CodeGen/adding_defaulted_cc_attr_to_type.c
+++ test/CodeGen/adding_defaulted_cc_attr_to_type.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -verify -emit-llvm -o - %s | FileCheck %s
+
+void (__attribute__ ((regparm (3), stdcall )) *f) (int); // expected-warning {{calling convention 'stdcall' ignored for this target}}
+
+// CHECK: @f = common global void (i32)*
+
+void (__attribute__((regparm(2), stdcall)) foo) () { // expected-warning {{calling convention 'stdcall' ignored for this target}}
+}
+
+// CHECK: define void @foo(){{.*}}
Index: test/Sema/callingconv.c
===
--- test/Sema/callingconv.c
+++ test/Sema/callingconv.c
@@ -66,3 +66,6 @@
 void __attribute__((stdcall)) typedef_fun(int x) { } // expected-error {{function declared 'stdcall' here was previously declared without calling convention}}
 
 struct type_test {} __attribute__((stdcall));  // expected-warning {{'stdcall' attribute only applies to functions and methods}}
+
+
+void (__attribute__ ((regparm (3), stdcall("abacaba") )) *test_ignored) (int); // expected-error {{'stdcall' attribute takes no arguments}}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxxabi] r256241 - Fix ARM __cxa_end_cleanup() and gc-sections.

2015-12-22 Thread Logan Chien via cfe-commits
Author: logan
Date: Tue Dec 22 08:38:30 2015
New Revision: 256241

URL: http://llvm.org/viewvc/llvm-project?rev=256241=rev
Log:
Fix ARM __cxa_end_cleanup() and gc-sections.

This commit adds SHF_ALLOC and SHF_EXECINSTR section flags to
`.text.__cxa_end_cleanup` section.  This fixes a link error when we are
using integrated-as and `ld.gold` (with `-Wl,--gc-sections` and
`-Wl,--fatal-warnings`.)

Detailed Explanation:

1. There might be some problem with LLVM integrated-as.  It is not
   emitting any section flags for text sections.  (This will be fixed in
   an independent commit.)

2. `ld.gold` will skip the external symbols in the section without
   SHF_ALLOC.  This is the reason why `.text.__cxa_end_cleanup_impl`
   section is discarded even though it is referenced by
   `__cxa_end_cleanup()`.

This commit workaround the problem by specifying the section flags
explicitly.

Fix http://llvm.org/PR21292

Modified:
libcxxabi/trunk/src/cxa_exception.cpp

Modified: libcxxabi/trunk/src/cxa_exception.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_exception.cpp?rev=256241=256240=256241=diff
==
--- libcxxabi/trunk/src/cxa_exception.cpp (original)
+++ libcxxabi/trunk/src/cxa_exception.cpp Tue Dec 22 08:38:30 2015
@@ -334,7 +334,7 @@ __cxa_end_cleanup_impl()
 }
 
 asm (
-"  .pushsection.text.__cxa_end_cleanup\n"
+"  .pushsection.text.__cxa_end_cleanup,\"ax\",%progbits\n"
 "  .globl  __cxa_end_cleanup\n"
 "  .type   __cxa_end_cleanup,%function\n"
 "__cxa_end_cleanup:\n"


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


Re: [PATCH] D15373: Fix for bug 25786 - Assertion "Chunk.Kind == DeclaratorChunk::Function" failed with regparm attribute.

2015-12-22 Thread Alexander Makarov via cfe-commits
a.makarov updated this revision to Diff 43440.
a.makarov added a comment.

I've updated the patch. Please, re-review it again.
About creating attributed type - I think we shouldn't create it if we ignored 
specified CC attribute. Ignoring specified CC attribute (and emitting the 
warning, of course) leads to substituting it by default; calling convention, 
substituted by default, is the same situation like there is no CC attribute 
specified for chosen function. Thus, from this point of view, we should not 
create AttributedType.


http://reviews.llvm.org/D15373

Files:
  include/clang/Sema/Sema.h
  lib/Sema/SemaDeclAttr.cpp
  lib/Sema/SemaType.cpp
  test/CodeGen/adding_defaulted_attr_to_type.c
  test/Sema/callingconv.c

Index: lib/Sema/SemaType.cpp
===
--- lib/Sema/SemaType.cpp
+++ lib/Sema/SemaType.cpp
@@ -5913,7 +5913,19 @@
   FunctionType::ExtInfo EI = unwrapped.get()->getExtInfo().withCallingConv(CC);
   QualType Equivalent =
   unwrapped.wrap(S, S.Context.adjustFunctionType(unwrapped.get(), EI));
-  type = S.Context.getAttributedType(CCAttrKind, type, Equivalent);
+
+  // We should add attribute specifier to type only if we didn't subsitute
+  // 'default' calling convention instead of the one provided by the attribute.
+  CallingConv RawCC;
+  bool RecognizedAttr = S.getCCFromAttr(attr, RawCC);
+  assert(!RecognizedAttr &&
+ "Somehow ill-formed calling convention attribute reached here!");
+  TargetInfo::CallingConvCheckResult CCResult =
+  S.Context.getTargetInfo().checkCallingConvention(RawCC);
+  // If calling convention is available (CCCR_OK) or default (CCCR_Ignored), add
+  // it to type.
+  if (CCResult != TargetInfo::CCCR_Warning)
+type = S.Context.getAttributedType(CCAttrKind, type, Equivalent);
   return true;
 }
 
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -3701,8 +3701,11 @@
   }
 }
 
-bool Sema::CheckCallingConvAttr(const AttributeList , CallingConv , 
-const FunctionDecl *FD) {
+/// This function simply dispatches passed attribute to corresponding
+/// calling convention.
+/// If attribute is ill-formed, it returns 'true' and makes marks attribute as
+/// invalid.
+bool Sema::getCCFromAttr(const AttributeList , CallingConv ) {
   if (attr.isInvalid())
 return true;
 
@@ -3714,19 +3717,31 @@
 
   // TODO: diagnose uses of these conventions on the wrong target.
   switch (attr.getKind()) {
-  case AttributeList::AT_CDecl: CC = CC_C; break;
-  case AttributeList::AT_FastCall: CC = CC_X86FastCall; break;
-  case AttributeList::AT_StdCall: CC = CC_X86StdCall; break;
-  case AttributeList::AT_ThisCall: CC = CC_X86ThisCall; break;
-  case AttributeList::AT_Pascal: CC = CC_X86Pascal; break;
-  case AttributeList::AT_VectorCall: CC = CC_X86VectorCall; break;
+  case AttributeList::AT_CDecl:
+CC = CC_C;
+break;
+  case AttributeList::AT_FastCall:
+CC = CC_X86FastCall;
+break;
+  case AttributeList::AT_StdCall:
+CC = CC_X86StdCall;
+break;
+  case AttributeList::AT_ThisCall:
+CC = CC_X86ThisCall;
+break;
+  case AttributeList::AT_Pascal:
+CC = CC_X86Pascal;
+break;
+  case AttributeList::AT_VectorCall:
+CC = CC_X86VectorCall;
+break;
   case AttributeList::AT_MSABI:
-CC = Context.getTargetInfo().getTriple().isOSWindows() ? CC_C :
- CC_X86_64Win64;
+CC = Context.getTargetInfo().getTriple().isOSWindows() ? CC_C
+   : CC_X86_64Win64;
 break;
   case AttributeList::AT_SysVABI:
-CC = Context.getTargetInfo().getTriple().isOSWindows() ? CC_X86_64SysV :
- CC_C;
+CC = Context.getTargetInfo().getTriple().isOSWindows() ? CC_X86_64SysV
+   : CC_C;
 break;
   case AttributeList::AT_Pcs: {
 StringRef StrRef;
@@ -3741,13 +3756,27 @@
   CC = CC_AAPCS_VFP;
   break;
 }
-
 attr.setInvalid();
 Diag(attr.getLoc(), diag::err_invalid_pcs);
 return true;
   }
-  case AttributeList::AT_IntelOclBicc: CC = CC_IntelOclBicc; break;
-  default: llvm_unreachable("unexpected attribute kind");
+  case AttributeList::AT_IntelOclBicc:
+CC = CC_IntelOclBicc;
+break;
+  default:
+llvm_unreachable("unexpected attribute kind");
+  }
+  return false;
+}
+
+bool Sema::CheckCallingConvAttr(const AttributeList , CallingConv , 
+const FunctionDecl *FD) {
+  if (attr.isInvalid())
+return true;
+
+  if (getCCFromAttr(attr, CC)) {
+assert(attr.isInvalid() && "Error occured but attribute is not invalid!");
+return true;
   }
 
   const TargetInfo  = Context.getTargetInfo();
Index: include/clang/Sema/Sema.h

Re: [PATCH] D15613: Fix ARM __cxa_end_cleanup() and gc-sections.

2015-12-22 Thread Logan Chien via cfe-commits
logan closed this revision.
logan added a comment.

Thanks!  Committed as http://reviews.llvm.org/rL256241.


http://reviews.llvm.org/D15613



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


[clang-tools-extra] r256253 - [clang-tools-extra] Text formatting

2015-12-22 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Tue Dec 22 11:08:57 2015
New Revision: 256253

URL: http://llvm.org/viewvc/llvm-project?rev=256253=rev
Log:
[clang-tools-extra] Text formatting

Modified:
clang-tools-extra/trunk/docs/index.rst

Modified: clang-tools-extra/trunk/docs/index.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/index.rst?rev=256253=256252=256253=diff
==
--- clang-tools-extra/trunk/docs/index.rst (original)
+++ clang-tools-extra/trunk/docs/index.rst Tue Dec 22 11:08:57 2015
@@ -7,7 +7,8 @@
 
 Introduction
 
-Welcome to clang-tools-exta project which contains extra tools built using 
Clang's tooling API's
+Welcome to the clang-tools-exta project which contains extra tools built using
+Clang's tooling API's.
 
 
 Contents
@@ -23,10 +24,10 @@ Contents
 Doxygen Documentation
 =
 The Doxygen documentation describes the **internal** software that makes up the
-tools of clang-tools-extra, not the **external** use of these tools. The
-Doxygen documentation contains no instructions about how to use the tools,
-only the APIs that make up the software. For usage instructions, please see
-the user's guide or reference manual for each tool.
+tools of clang-tools-extra, not the **external** use of these tools. The 
Doxygen
+documentation contains no instructions about how to use the tools, only the 
APIs
+that make up the software. For usage instructions, please see the user's guide
+or reference manual for each tool.
 
 * `Doxygen documentation`_
 
@@ -34,8 +35,8 @@ the user's guide or reference manual for
 
 ..  note::
 This documentation is generated directly from the source code with doxygen.
-Since the tools of clang-tools-extra are constantly under active 
development,
-what you're about to read is out of date!
+Since the tools of clang-tools-extra are constantly under active
+development, what you're about to read is out of date!
 
 
 Indices and tables


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


[clang-tools-extra] r256254 - Updated year (2014-2015).

2015-12-22 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Tue Dec 22 11:10:34 2015
New Revision: 256254

URL: http://llvm.org/viewvc/llvm-project?rev=256254=rev
Log:
Updated year (2014-2015).

Modified:
clang-tools-extra/trunk/LICENSE.TXT
clang-tools-extra/trunk/docs/conf.py

Modified: clang-tools-extra/trunk/LICENSE.TXT
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/LICENSE.TXT?rev=256254=256253=256254=diff
==
--- clang-tools-extra/trunk/LICENSE.TXT (original)
+++ clang-tools-extra/trunk/LICENSE.TXT Tue Dec 22 11:10:34 2015
@@ -4,7 +4,7 @@ LLVM Release License
 University of Illinois/NCSA
 Open Source License
 
-Copyright (c) 2007-2014 University of Illinois at Urbana-Champaign.
+Copyright (c) 2007-2015 University of Illinois at Urbana-Champaign.
 All rights reserved.
 
 Developed by:

Modified: clang-tools-extra/trunk/docs/conf.py
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/conf.py?rev=256254=256253=256254=diff
==
--- clang-tools-extra/trunk/docs/conf.py (original)
+++ clang-tools-extra/trunk/docs/conf.py Tue Dec 22 11:10:34 2015
@@ -41,7 +41,7 @@ master_doc = 'index'
 
 # General information about the project.
 project = u'Extra Clang Tools'
-copyright = u'2007-2014, The Clang Team'
+copyright = u'2007-2015, The Clang Team'
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the


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


[clang-tools-extra] r256259 - [clang-tidy] Updates to documentation: formatting, titles, etc.

2015-12-22 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Tue Dec 22 11:36:49 2015
New Revision: 256259

URL: http://llvm.org/viewvc/llvm-project?rev=256259=rev
Log:
[clang-tidy] Updates to documentation: formatting, titles, etc.

Modified:
clang-tools-extra/trunk/clang-tidy/add_new_check.py
clang-tools-extra/trunk/docs/clang-tidy/checks/cert-setlongjmp.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/cert-static-object-exception.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/cert-thrown-exception-type.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/cert-variadic-function-def.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-array-to-pointer-decay.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-pointer-arithmetic.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-const-cast.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-cstyle-cast.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-reinterpret-cast.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-static-cast-downcast.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-union-access.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-vararg.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/google-build-explicit-make-pair.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/google-build-namespaces.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/google-build-using-namespace.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/google-explicit-constructor.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/google-global-names-in-headers.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-braces-around-statements.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-casting.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-function-size.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-namespace-comments.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-redundant-smartptr-get.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-todo.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/google-runtime-int.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/google-runtime-member-string-references.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/google-runtime-memset.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/google-runtime-operator.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/llvm-header-guard.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/llvm-include-order.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/llvm-namespace-comment.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/llvm-twine-local.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-argument-comment.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-assert-side-effect.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-assign-operator-signature.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-bool-pointer-implicit-conversion.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-inaccurate-erase.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-inefficient-algorithm.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-macro-parentheses.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-macro-repeated-side-effects.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-move-constructor-init.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-new-delete-overloads.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-noexcept-move-constructor.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-non-copyable-objects.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-sizeof-container.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-static-assert.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-string-integer-assignment.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-swapped-arguments.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-undelegated-constructor.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-uniqueptr-reset-release.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-unused-alias-decls.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-unused-parameters.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-unused-raii.rst

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

2015-12-22 Thread Faisal Vali via cfe-commits
faisalv added a subscriber: Nate.


Comment at: include/clang/AST/DeclTemplate.h:836
@@ -835,2 +835,3 @@
 
+  bool IsConcept : 1;
 protected:

rsmith wrote:
> This might make more sense on `TemplateDecl`, since we also want this flag 
> for `VarTemplateDecl`s. In any case, please use some existing spare bit for 
> this rather than making all `FunctionTemplateDecl`s 8 bytes larger by putting 
> it here.
@Nate - since you asked before, if I was to try and do this (now that we know 
Richard cares strongly about the extra space), I would probably risk complexity 
(and insult readability) by attempting to smuggle the extra bit into 
RedeclararableTemplateDecl::CommonBase::InstantiatedFromMember or perhaps 
within the low bits of the pointer to ReDeclarableTemplateDecl::CommonBase 
itself (i.e. Common) 
Let's see if Richard has a preference - or suggests a completely different 
strategy for squirreling.


http://reviews.llvm.org/D13357



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