Re: [PATCH] D15309: [CUDA] emit vtables only for classes with methods usable on this side of compilation.

2015-12-17 Thread Jacques Pienaar via cfe-commits
jpienaar accepted this revision.
jpienaar added a comment.
This revision is now accepted and ready to land.

Looks good, thanks



Comment at: test/CodeGenCUDA/device-vtable.cu:37
@@ +36,3 @@
+  virtual void h_method();
+  __device__ virtual void d_method();
+};

Does the comment need to be updated to reflect vtable with NULL pointers?


http://reviews.llvm.org/D15309



___
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-17 Thread Pekka Jääskeläinen via cfe-commits

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, &cmp, 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,

Address spaces are not handled in custom semantic checks of atomic Builtins.

If there are two pointers passed to the Builtin, it doesn't allow the
second

(non-atomic) one to be qualified with an address space.

This patch removed this restriction by recording the address space of
the

passed pointers while checking its type correctness.

Currently, the following code:

_Atomic int __attribute__((address_space(1))) *A;

int __attribute__((address_space(2))) *B;

...

... = __c11_atomic_compare_exchange_strong(A, B, 1,
memory_order_seq_cst, memory_order_seq_cst);

fails to compile with an error:

"passing '__attribute__((address_space(2))) int *' to parameter

Re: [PATCH] D13126: New static analyzer checker for loss of sign/precision

2015-12-17 Thread Artem Dergachev via cfe-commits
NoQ added a comment.

I've got a few minor code comments.

I really wish to have a look at false positives on which

> the value analysis fails and then there is not much my checker could do


either in a form of FIXME tests, or as preprocessed code samples, because i'm 
currently digging the topic of improving cast modeling (either through 
producing `SymbolCast` more often, or by taking sub-symbol-types vs. 
symbolic-expression-types vs. ast-expression-types into account during 
`assume()` and `evalBinOp()` and various`ExprEngine` calls. Eg, when casting an 
int into a char and then back into an int, ensure that the resulting int value 
carries, at most, a char-range constraint. So i wonder if such fix would help.



Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:78
@@ +77,3 @@
+
+// Can E value be greater or equal than Val?
+static bool canBeGreaterEqual(CheckerContext &C, const Expr *E,

It's not quite "the value can be greater or equal", but in fact rather "the 
value is certainly greater or equal".
Same applies to `canBeNegative()`.


Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:85
@@ +84,3 @@
+return false;
+  DefinedSVal DefinedEVal = EVal.castAs();
+

A slightly shorter way to express the same thing:
```
llvm::Optional EVal = C.getSVal(E).getAs();
if (!EVal)
  return false;
// later use (*EVal)
```


Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:96
@@ +95,3 @@
+  ProgramStateRef StGE = State->assume(GE.castAs(), true);
+  ProgramStateRef StLT = State->assume(GE.castAs(), false);
+  return (StGE && !StLT);

You can use the overridden version of `assume()` that returns two states at 
once into a std::pair, in order to avoid double-work.


Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:121
@@ +120,3 @@
+
+static bool isConstant(const Expr *E, const ASTContext &Ctx) {
+  E = E->IgnoreParenCasts();

Not sure, but shouldn't the common `Expr::EvaluateAsInt()` mechanism handle it 
all of it, including recursive traversal through operators?


Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:142
@@ +141,3 @@
+
+  if (!SubType.getTypePtr()->isIntegerType() ||
+  !ResultType.getTypePtr()->isIntegerType())

You don't need to call `.getTypePtr()`, because `QualType` already has a 
convenient overridden `operator ->()`, which gives you quick access to the 
underlying `Type *`.


Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:158
@@ +157,3 @@
+
+  unsigned long long MaxVal = 1ULL << W;
+  if (canBeGreaterEqual(C, Cast->getSubExpr(), MaxVal))

`BasicValueFactory::getMaxValue(QualType)` might be useful.


http://reviews.llvm.org/D13126



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


Re: [PATCH] D15603: [OpenCL] Pipe type support

2015-12-17 Thread Alexey Bader via cfe-commits
bader added inline comments.


Comment at: include/clang/AST/Type.h:5020
@@ +5019,3 @@
+/// PipeType - OpenCL20.
+///
+class PipeType : public Type, public llvm::FoldingSetNode {

Xuili, could you apply the comments left by Pekka and Anastasia for the 
previous version of the patch (http://reviews.llvm.org/D14441). Most of the 
comments are valid for this patch also.
Particularly for this line Anastasia asked "Any reason for an empty comment 
line here?". I think it's not necessary.


http://reviews.llvm.org/D15603



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


Re: [PATCH] D15606: Remove clang-modernize.

2015-12-17 Thread Manuel Klimek via cfe-commits
klimek accepted this revision.
klimek added a comment.
This revision is now accepted and ready to land.

lg


http://reviews.llvm.org/D15606



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


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

2015-12-17 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Thu Dec 17 05:49:19 2015
New Revision: 255886

URL: http://llvm.org/viewvc/llvm-project?rev=255886&view=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&r1=255885&r2=255886&view=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&r1=255885&r2=255886&view=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&view=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 will not insert the override keyword if a method is
-  pure. At the moment it's not possible to track down the pure
-  specifier location.
-
-.. code-block:: c++
-
-  class B : public A {
-  public:
-virtual void h() const = 0;
-
-// The declaration of h is NOT transformed to
-virtual void h() const override = 0;
-  };
-

Removed: clang-tools-extra/trunk/docs/LoopConvertTransform.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/LoopConvertTransform.rst?rev=255885&view=auto
==
--- clang-tools-extra/trunk/docs/LoopConvertTransform.rst (original)
+++ clang-tools-extra/trunk/docs/LoopConvertTransform.rst

Re: [PATCH] D12901: [Static Analyzer] Assertion "System is over constrained" after truncating 64 bits integers to 32 bits. (PR25078)

2015-12-17 Thread pierre gousseau via cfe-commits
pgousseau updated the summary for this revision.
pgousseau updated this revision to Diff 43120.
pgousseau added a comment.

Following Gabor and Anna's advice:

- Instead of modifying assumeSymNE and assumeSymEQ, this patch adds a new 
method 'SValBuilder::evalIntegralCast'.

The current workaround for truncations not being modelled is that the 
evaluation of integer to integer casts are simply bypassed and so the original 
symbol is used as the new casted symbol (cf 
SimpleSValBuilder::evalCastFromNonLoc).
This lead to the issue described above, as the RangeConstraintManager 
associates ranges with symbols.

The new evalIntegralCast method added by this patch wont bypass the cast if it 
finds the range of the symbol to be greater than the maximum value of the 
target type.

This patch also fixes a bug in 'RangeSet::pin' causing single value ranges to 
not be considered conventionally ordered.

The patch has been tested with openssl-1.0.0d-src and bullet-2.82-r2704 with no 
regressions observed.

Please let me know if this an acceptable change?

Regards,

Pierre Gousseau
SN Systems - Sony Computer Entertainment


http://reviews.llvm.org/D12901

Files:
  include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
  lib/StaticAnalyzer/Core/ExprEngineC.cpp
  lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
  lib/StaticAnalyzer/Core/SValBuilder.cpp
  test/Analysis/range_casts.c

Index: test/Analysis/range_casts.c
===
--- /dev/null
+++ test/Analysis/range_casts.c
@@ -0,0 +1,156 @@
+// This test checks that intersecting ranges does not cause 'system is over constrained' assertions in the case of eg: 32 bits unsigned integers getting their range from 64 bits signed integers.
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-store=region -verify %s
+
+void clang_analyzer_warnIfReached();
+
+void f1(long foo)
+{
+  unsigned index = -1;
+  if (index < foo) index = foo;
+  if (index + 1 == 0) // because of foo range, index is in range [0; UINT_MAX]
+clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+  else
+clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+}
+
+void f2(unsigned long foo)
+{
+  int index = -1;
+  if (index < foo) index = foo; // index equals ULONG_MAX
+  if (index + 1 == 0)
+clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+  else
+clang_analyzer_warnIfReached(); // no-warning
+}
+
+void f3(unsigned long foo)
+{
+  unsigned index = -1;
+  if (index < foo) index = foo;
+  if (index + 1 == 0)
+clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+  else
+clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+}
+
+void f4(long foo)
+{
+  int index = -1;
+  if (index < foo) index = foo;
+  if (index + 1 == 0)
+clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+  else
+clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+}
+
+void f5(long foo)
+{
+  unsigned index = -1;
+  if (index < foo) index = foo;
+  if (index == -1)
+clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+  else
+clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+}
+
+void f6(long foo)
+{
+  unsigned index = -1;
+  if (index < foo) index = foo;
+  if (index == -1)
+clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+  else
+clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+}
+
+void f7(long foo)
+{
+  unsigned index = -1;
+  if (index < foo) index = foo;
+  if (index - 1 == 0) // Was not reached prior fix.
+clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+  else
+clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+}
+
+void f8(long foo)
+{
+  unsigned index = -1;
+  if (index < foo) index = foo;
+  if (index + 1L == 0L)
+clang_analyzer_warnIfReached(); // no-warning
+  else
+clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+}
+
+void f9(long foo)
+{
+  unsigned index = -1;
+  if (index < foo) index = foo;
+  if (index - 1L == 0L) // Was not reached prior fix.
+clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+  else
+clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+}
+
+void f10(long foo)
+{
+  unsigned index = -1;
+  if (index < foo) index = foo;
+  if (index + 1 == 0L)
+clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+  else
+clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+}
+
+void f11(long foo)
+{
+  unsigned index = -1;
+  if (index < foo) index = foo;
+  if (index + 1UL == 0L)
+clang_analyzer_warnIfReached(); // no-warning
+  else
+clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+}
+
+void f12(long foo)
+{
+  unsigned index = -1;
+  if (index < foo) index = foo;
+  if (index - 1UL == 0L) // Was not reached prior fix.
+clang_analyzer

r255890 - [ms-inline-asm] Add support for composite structs in MS inline asm

2015-12-17 Thread Marina Yatsina via cfe-commits
Author: myatsina
Date: Thu Dec 17 06:51:51 2015
New Revision: 255890

URL: http://llvm.org/viewvc/llvm-project?rev=255890&view=rev
Log:
[ms-inline-asm] Add support for composite structs in MS inline asm

Add MS inline asm support for structs that contain fields that are also structs.

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


Modified:
cfe/trunk/lib/Sema/SemaStmtAsm.cpp
cfe/trunk/test/CodeGen/ms-inline-asm.c

Modified: cfe/trunk/lib/Sema/SemaStmtAsm.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmtAsm.cpp?rev=255890&r1=255889&r2=255890&view=diff
==
--- cfe/trunk/lib/Sema/SemaStmtAsm.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmtAsm.cpp Thu Dec 17 06:51:51 2015
@@ -617,45 +617,57 @@ ExprResult Sema::LookupInlineAsmIdentifi
 bool Sema::LookupInlineAsmField(StringRef Base, StringRef Member,
 unsigned &Offset, SourceLocation AsmLoc) {
   Offset = 0;
+  SmallVector Members;
+  Member.split(Members, ".");
+
   LookupResult BaseResult(*this, &Context.Idents.get(Base), SourceLocation(),
   LookupOrdinaryName);
 
   if (!LookupName(BaseResult, getCurScope()))
 return true;
 
-  if (!BaseResult.isSingleResult())
-return true;
+  LookupResult CurrBaseResult(BaseResult);
 
-  const RecordType *RT = nullptr;
-  NamedDecl *FoundDecl = BaseResult.getFoundDecl();
-  if (VarDecl *VD = dyn_cast(FoundDecl))
-RT = VD->getType()->getAs();
-  else if (TypedefNameDecl *TD = dyn_cast(FoundDecl)) {
-MarkAnyDeclReferenced(TD->getLocation(), TD, /*OdrUse=*/false);
-RT = TD->getUnderlyingType()->getAs();
-  } else if (TypeDecl *TD = dyn_cast(FoundDecl))
-RT = TD->getTypeForDecl()->getAs();
-  if (!RT)
-return true;
-
-  if (RequireCompleteType(AsmLoc, QualType(RT, 0), 0))
-return true;
+  for (StringRef NextMember : Members) {
 
-  LookupResult FieldResult(*this, &Context.Idents.get(Member), 
SourceLocation(),
-   LookupMemberName);
-
-  if (!LookupQualifiedName(FieldResult, RT->getDecl()))
-return true;
-
-  // FIXME: Handle IndirectFieldDecl?
-  FieldDecl *FD = dyn_cast(FieldResult.getFoundDecl());
-  if (!FD)
-return true;
+if (!CurrBaseResult.isSingleResult())
+  return true;
 
-  const ASTRecordLayout &RL = Context.getASTRecordLayout(RT->getDecl());
-  unsigned i = FD->getFieldIndex();
-  CharUnits Result = Context.toCharUnitsFromBits(RL.getFieldOffset(i));
-  Offset = (unsigned)Result.getQuantity();
+const RecordType *RT = nullptr;
+NamedDecl *FoundDecl = CurrBaseResult.getFoundDecl();
+if (VarDecl *VD = dyn_cast(FoundDecl))
+  RT = VD->getType()->getAs();
+else if (TypedefNameDecl *TD = dyn_cast(FoundDecl)) {
+  MarkAnyDeclReferenced(TD->getLocation(), TD, /*OdrUse=*/false);
+  RT = TD->getUnderlyingType()->getAs();
+} else if (TypeDecl *TD = dyn_cast(FoundDecl))
+  RT = TD->getTypeForDecl()->getAs();
+else if (FieldDecl *TD = dyn_cast(FoundDecl))
+  RT = TD->getType()->getAs();
+if (!RT)
+  return true;
+
+if (RequireCompleteType(AsmLoc, QualType(RT, 0), 0))
+  return true;
+
+LookupResult FieldResult(*this, &Context.Idents.get(NextMember),
+ SourceLocation(), LookupMemberName);
+
+if (!LookupQualifiedName(FieldResult, RT->getDecl()))
+  return true;
+
+// FIXME: Handle IndirectFieldDecl?
+FieldDecl *FD = dyn_cast(FieldResult.getFoundDecl());
+if (!FD)
+  return true;
+
+CurrBaseResult = FieldResult;
+
+const ASTRecordLayout &RL = Context.getASTRecordLayout(RT->getDecl());
+unsigned i = FD->getFieldIndex();
+CharUnits Result = Context.toCharUnitsFromBits(RL.getFieldOffset(i));
+Offset += (unsigned)Result.getQuantity();
+  }
 
   return false;
 }

Modified: cfe/trunk/test/CodeGen/ms-inline-asm.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-inline-asm.c?rev=255890&r1=255889&r2=255890&view=diff
==
--- cfe/trunk/test/CodeGen/ms-inline-asm.c (original)
+++ cfe/trunk/test/CodeGen/ms-inline-asm.c Thu Dec 17 06:51:51 2015
@@ -470,6 +470,18 @@ typedef struct {
   int b;
 } A;
 
+typedef struct {
+  int b1;
+  A   b2;
+} B;
+
+typedef struct {
+  int c1;
+  A   c2;
+  int c3;
+  B   c4;
+} C;
+
 void t39() {
 // CHECK-LABEL: define void @t39
   __asm mov eax, [eax].A.b
@@ -478,6 +490,14 @@ void t39() {
 // CHECK: mov eax, [eax] .4
   __asm mov eax, fs:[0] A.b
 // CHECK: mov eax, fs:[$$0] .4
+  __asm mov eax, [eax].B.b2.a
+// CHECK: mov eax, [eax].4
+  __asm mov eax, [eax] B.b2.b
+// CHECK: mov eax, [eax] .8
+  __asm mov eax, fs:[0] C.c2.b
+// CHECK: mov eax, fs:[$$0] .8
+  __asm mov eax, [eax]C.c4.b2.b
+// CHECK: mov eax, [eax].24
 // CHECK: "~{eax},~{dirflag},~{fpsr},~{flags}"()
 }
 


___
cfe-commits mailing list
c

Re: [PATCH] D13126: New static analyzer checker for loss of sign/precision

2015-12-17 Thread Artem Dergachev via cfe-commits
NoQ added a comment.

Hmm, just noticed the related work on casts in http://reviews.llvm.org/D12901, 
which seems to be directly related to my hand-waving above. It might 
accidentally be useful for reducing FPs of this checker as well.


http://reviews.llvm.org/D13126



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


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

2015-12-17 Thread Haojian Wu via cfe-commits
hokein added a comment.

Oh, this is my first attempt to submit a patch, and it isn't ready for review. 
Just ignore it.


Repository:
  rL LLVM

http://reviews.llvm.org/D15560



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


Re: [PATCH] D14441: [OpenCL] Pipe types support.

2015-12-17 Thread Xiuli PAN via cfe-commits
pxli168 added a comment.

Hi guys,
I have upload a the bugfix version for bader's patch, but I could not merge my 
patch to his. It automatically became a new diff http://reviews.llvm.org/D15603.
I will upload the pipe related built-in and some bug fix patches after this is 
merged, the alltogether patch is too huge.

Thanks
Xiuli


http://reviews.llvm.org/D14441



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


[PATCH] D15603: [OpenCL] Pipe type support

2015-12-17 Thread Xiuli PAN via cfe-commits
pxli168 created this revision.
pxli168 added a reviewer: pekka.jaaskelainen.
pxli168 added subscribers: cfe-commits, Anastasia, bader.

Support for OpenCL 2.0 pipe type.
This is a bug-fix version for bader's patch reviews.llvm.org/D14441


http://reviews.llvm.org/D15603

Files:
  include/clang/AST/ASTContext.h
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/AST/Type.h
  include/clang/AST/TypeLoc.h
  include/clang/AST/TypeNodes.def
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/Specifiers.h
  include/clang/Basic/TokenKinds.def
  include/clang/Sema/DeclSpec.h
  include/clang/Sema/Sema.h
  include/clang/Serialization/ASTBitCodes.h
  lib/AST/ASTContext.cpp
  lib/AST/ASTImporter.cpp
  lib/AST/ItaniumMangle.cpp
  lib/AST/MicrosoftMangle.cpp
  lib/AST/Type.cpp
  lib/AST/TypePrinter.cpp
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CGDebugInfo.h
  lib/CodeGen/CGOpenCLRuntime.cpp
  lib/CodeGen/CGOpenCLRuntime.h
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenTypes.cpp
  lib/CodeGen/ItaniumCXXABI.cpp
  lib/Parse/ParseDecl.cpp
  lib/Sema/DeclSpec.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaLookup.cpp
  lib/Sema/SemaTemplate.cpp
  lib/Sema/SemaTemplateDeduction.cpp
  lib/Sema/SemaTemplateVariadic.cpp
  lib/Sema/SemaType.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReader.cpp
  lib/Serialization/ASTWriter.cpp
  test/CodeGenOpenCL/pipe_types.cl
  test/PCH/ocl_types.cl
  test/PCH/ocl_types.h
  test/SemaOpenCL/pipes-1.2-negative.cl
  tools/libclang/CIndex.cpp

Index: tools/libclang/CIndex.cpp
===
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -1692,6 +1692,10 @@
   return Visit(TL.getValueLoc());
 }
 
+bool CursorVisitor::VisitPipeTypeLoc(PipeTypeLoc TL) {
+  return Visit(TL.getValueLoc());
+}
+
 #define DEFAULT_TYPELOC_IMPL(CLASS, PARENT) \
 bool CursorVisitor::Visit##CLASS##TypeLoc(CLASS##TypeLoc TL) { \
   return Visit##PARENT##Loc(TL); \
Index: test/SemaOpenCL/pipes-1.2-negative.cl
===
--- /dev/null
+++ test/SemaOpenCL/pipes-1.2-negative.cl
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2
+
+void foo(read_only pipe int p); // expected-error {{expected parameter declarator}} expected-error {{expected ')'}} expected-note {{to match this '('}}
Index: test/PCH/ocl_types.h
===
--- test/PCH/ocl_types.h
+++ test/PCH/ocl_types.h
@@ -44,6 +44,7 @@
 // image2d_array_depth_t
 typedef image2d_array_depth_t img2darr_dep_t;
 
+#pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing : enable
 // image2d_msaa_t
 typedef image2d_msaa_t img2dmsaa_t;
 
@@ -56,4 +57,14 @@
 // image2d_array_msaa_depth_t
 typedef image2d_array_msaa_depth_t img2darrmsaadep_t;
 
+// pipe specifier
+
+typedef struct _person {
+  int id;
+  const char *name;
+} Person;
+
+void int_pipe_function(pipe int);
+
+void person_pipe_function(pipe Person);
 #endif
Index: test/PCH/ocl_types.cl
===
--- test/PCH/ocl_types.cl
+++ test/PCH/ocl_types.cl
@@ -1,9 +1,9 @@
 // Test this without pch.
-// RUN: %clang_cc1 -include %S/ocl_types.h -fsyntax-only %s
+// RUN: %clang_cc1 -include %S/ocl_types.h -fsyntax-only %s -cl-std=CL2.0 -D__OPENCL_VERSION__=200
 
 // Test with pch.
-// RUN: %clang_cc1 -x cl -emit-pch -o %t %S/ocl_types.h
-// RUN: %clang_cc1 -include-pch %t -fsyntax-only %s -ast-print
+// RUN: %clang_cc1 -x cl -emit-pch -o %t %S/ocl_types.h -cl-std=CL2.0 -D__OPENCL_VERSION__=200
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only %s -ast-print -cl-std=CL2.0 -D__OPENCL_VERSION__=200
 
 void foo1(img1d_t img);
 
@@ -24,3 +24,15 @@
 void foo8(evt_t evt) {
   evt_t loc_evt;
 }
+
+#if __OPENCL_VERSION__ >= 200
+
+void foo9(pipe int P) {
+  int_pipe_function(P);
+}
+
+void foo10(pipe Person P) {
+  person_pipe_function(P);
+}
+
+#endif
Index: test/CodeGenOpenCL/pipe_types.cl
===
--- /dev/null
+++ test/CodeGenOpenCL/pipe_types.cl
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL2.0 -o - %s | FileCheck %s
+
+// CHECK: %opencl.pipe_t = type opaque
+typedef unsigned char __attribute__((ext_vector_type(3))) uchar3;
+typedef int __attribute__((ext_vector_type(4))) int4;
+
+void test1(read_only pipe int p) {
+// CHECK: define void @test1(%opencl.pipe_t* %p)
+  reserve_id_t rid;
+// CHECK: %rid = alloca %opencl.reserve_id_t
+}
+
+void test2(write_only pipe float p) {
+// CHECK: define void @test2(%opencl.pipe_t* %p)
+  reserve_id_t rid;
+// CHECK: %rid = alloca %opencl.reserve_id_t
+}
+
+void test3(read_only pipe const int p) {
+// CHECK: define void @test3(%opencl.pipe_t* %p)
+  reserve_id_t rid;
+// CHECK: %rid = alloca %opencl.reserve_id_t
+}
+
+void test4(read_only pipe uchar3 p) {
+// CHECK: define void @test4(%open

Re: [PATCH] D15603: [OpenCL] Pipe type support

2015-12-17 Thread Xiuli PAN via cfe-commits
pxli168 added inline comments.


Comment at: include/clang/AST/Type.h:5020
@@ +5019,3 @@
+/// PipeType - OpenCL20.
+///
+class PipeType : public Type, public llvm::FoldingSetNode {

bader wrote:
> Xuili, could you apply the comments left by Pekka and Anastasia for the 
> previous version of the patch (http://reviews.llvm.org/D14441). Most of the 
> comments are valid for this patch also.
> Particularly for this line Anastasia asked "Any reason for an empty comment 
> line here?". I think it's not necessary.
I have made some changes to their comments, but I found something still left 
here. I will fix them.


http://reviews.llvm.org/D15603



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


Re: [PATCH] D15603: [OpenCL] Pipe type support

2015-12-17 Thread Xiuli PAN via cfe-commits
pxli168 updated this revision to Diff 43121.
pxli168 added a comment.

Apply comment form http://reviews.llvm.org/D14441.


http://reviews.llvm.org/D15603

Files:
  include/clang/AST/ASTContext.h
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/AST/Type.h
  include/clang/AST/TypeLoc.h
  include/clang/AST/TypeNodes.def
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/Specifiers.h
  include/clang/Basic/TokenKinds.def
  include/clang/Sema/DeclSpec.h
  include/clang/Sema/Sema.h
  include/clang/Serialization/ASTBitCodes.h
  lib/AST/ASTContext.cpp
  lib/AST/ASTImporter.cpp
  lib/AST/ItaniumMangle.cpp
  lib/AST/MicrosoftMangle.cpp
  lib/AST/Type.cpp
  lib/AST/TypePrinter.cpp
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CGDebugInfo.h
  lib/CodeGen/CGOpenCLRuntime.cpp
  lib/CodeGen/CGOpenCLRuntime.h
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenTypes.cpp
  lib/CodeGen/ItaniumCXXABI.cpp
  lib/Parse/ParseDecl.cpp
  lib/Sema/DeclSpec.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaLookup.cpp
  lib/Sema/SemaTemplate.cpp
  lib/Sema/SemaTemplateDeduction.cpp
  lib/Sema/SemaTemplateVariadic.cpp
  lib/Sema/SemaType.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReader.cpp
  lib/Serialization/ASTWriter.cpp
  test/CodeGenOpenCL/pipe_types.cl
  test/PCH/ocl_types.cl
  test/PCH/ocl_types.h
  test/SemaOpenCL/pipes-1.2-negative.cl
  tools/libclang/CIndex.cpp

Index: tools/libclang/CIndex.cpp
===
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -1692,6 +1692,10 @@
   return Visit(TL.getValueLoc());
 }
 
+bool CursorVisitor::VisitPipeTypeLoc(PipeTypeLoc TL) {
+  return Visit(TL.getValueLoc());
+}
+
 #define DEFAULT_TYPELOC_IMPL(CLASS, PARENT) \
 bool CursorVisitor::Visit##CLASS##TypeLoc(CLASS##TypeLoc TL) { \
   return Visit##PARENT##Loc(TL); \
Index: test/SemaOpenCL/pipes-1.2-negative.cl
===
--- /dev/null
+++ test/SemaOpenCL/pipes-1.2-negative.cl
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2
+
+void foo(read_only pipe int p); // expected-error {{expected parameter declarator}} expected-error {{expected ')'}} expected-note {{to match this '('}}
Index: test/PCH/ocl_types.h
===
--- test/PCH/ocl_types.h
+++ test/PCH/ocl_types.h
@@ -44,6 +44,7 @@
 // image2d_array_depth_t
 typedef image2d_array_depth_t img2darr_dep_t;
 
+#pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing : enable
 // image2d_msaa_t
 typedef image2d_msaa_t img2dmsaa_t;
 
@@ -56,4 +57,14 @@
 // image2d_array_msaa_depth_t
 typedef image2d_array_msaa_depth_t img2darrmsaadep_t;
 
+// pipe specifier
+
+typedef struct _person {
+  int id;
+  const char *name;
+} Person;
+
+void int_pipe_function(pipe int);
+
+void person_pipe_function(pipe Person);
 #endif
Index: test/PCH/ocl_types.cl
===
--- test/PCH/ocl_types.cl
+++ test/PCH/ocl_types.cl
@@ -1,9 +1,9 @@
 // Test this without pch.
-// RUN: %clang_cc1 -include %S/ocl_types.h -fsyntax-only %s
+// RUN: %clang_cc1 -include %S/ocl_types.h -fsyntax-only %s -cl-std=CL2.0 -D__OPENCL_VERSION__=200
 
 // Test with pch.
-// RUN: %clang_cc1 -x cl -emit-pch -o %t %S/ocl_types.h
-// RUN: %clang_cc1 -include-pch %t -fsyntax-only %s -ast-print
+// RUN: %clang_cc1 -x cl -emit-pch -o %t %S/ocl_types.h -cl-std=CL2.0 -D__OPENCL_VERSION__=200
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only %s -ast-print -cl-std=CL2.0 -D__OPENCL_VERSION__=200
 
 void foo1(img1d_t img);
 
@@ -24,3 +24,15 @@
 void foo8(evt_t evt) {
   evt_t loc_evt;
 }
+
+#if __OPENCL_VERSION__ >= 200
+
+void foo9(pipe int P) {
+  int_pipe_function(P);
+}
+
+void foo10(pipe Person P) {
+  person_pipe_function(P);
+}
+
+#endif
Index: test/CodeGenOpenCL/pipe_types.cl
===
--- /dev/null
+++ test/CodeGenOpenCL/pipe_types.cl
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL2.0 -o - %s | FileCheck %s
+
+// CHECK: %opencl.pipe_t = type opaque
+typedef unsigned char __attribute__((ext_vector_type(3))) uchar3;
+typedef int __attribute__((ext_vector_type(4))) int4;
+
+void test1(read_only pipe int p) {
+// CHECK: define void @test1(%opencl.pipe_t* %p)
+  reserve_id_t rid;
+// CHECK: %rid = alloca %opencl.reserve_id_t
+}
+
+void test2(write_only pipe float p) {
+// CHECK: define void @test2(%opencl.pipe_t* %p)
+  reserve_id_t rid;
+// CHECK: %rid = alloca %opencl.reserve_id_t
+}
+
+void test3(read_only pipe const int p) {
+// CHECK: define void @test3(%opencl.pipe_t* %p)
+  reserve_id_t rid;
+// CHECK: %rid = alloca %opencl.reserve_id_t
+}
+
+void test4(read_only pipe uchar3 p) {
+// CHECK: define void @test4(%opencl.pipe_t* %p)
+  reserve_id_t rid;
+// CHECK: %rid = alloca %opencl.reserve_id_t
+}
+
+void test5(read_only pipe in

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

2015-12-17 Thread Aaron Ballman via cfe-commits
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&view=rev
> Log:
> Remove clang-modernize.
>
> Summary:
> clang-modernize transforms have moved to clang-tidy. Removing
> the old tool now.

Awesome, thank you!

~Aaron

>
> 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&r1=255885&r2=255886&view=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&r1=255885&r2=255886&view=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&view=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 will not insert the override keyword if a method is
> -  pure. At the moment it's not possible to track down the pure
> -  specifier location.
> -
> -.. code-block:: c++
> -
> -  class B : public A {
> -  public:
> -virtual void h() const = 0;
> -
> -// The declaration of h is NOT transformed to
> -virtual void h() const override = 0;
> -  };
> -
>
> Removed: clang-too

Re: r255875 - Add QualType case to operator< for DynTypedNode.

2015-12-17 Thread Aaron Ballman via cfe-commits
On Wed, Dec 16, 2015 at 11:46 PM, Richard Trieu via cfe-commits
 wrote:
> Author: rtrieu
> Date: Wed Dec 16 22:46:48 2015
> New Revision: 255875
>
> URL: http://llvm.org/viewvc/llvm-project?rev=255875&view=rev
> Log:
> Add QualType case to operator< for DynTypedNode.
>
> This allows sorting DynTypedNode's which are QualType's since QualType does
> not have memoization.
>
> Modified:
> cfe/trunk/include/clang/AST/ASTTypeTraits.h
>
> Modified: cfe/trunk/include/clang/AST/ASTTypeTraits.h
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTTypeTraits.h?rev=255875&r1=255874&r2=255875&view=diff
> ==
> --- cfe/trunk/include/clang/AST/ASTTypeTraits.h (original)
> +++ cfe/trunk/include/clang/AST/ASTTypeTraits.h Wed Dec 16 22:46:48 2015
> @@ -271,6 +271,10 @@ public:
>  if (!NodeKind.isSame(Other.NodeKind))
>return NodeKind < Other.NodeKind;
>
> +if (ASTNodeKind::getFromNodeKind().isSame(NodeKind))
> +  return getUnchecked().getAsOpaquePtr() ==
> + Other.getUnchecked().getAsOpaquePtr();
> +

This only tests for equality, not comparison, which means operator< no
longer has a strict weak ordering. Also, there are no tests for this
change.

~Aaron

>  if (ASTNodeKind::getFromNodeKind().isSame(NodeKind)) {
>auto TLA = getUnchecked();
>auto TLB = Other.getUnchecked();
>
>
> ___
> 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] D15524: [GCC] Attribute ifunc support in clang

2015-12-17 Thread Dmitry Polukhin via cfe-commits
DmitryPolukhin added a comment.

John, I'm still working on new patch but meanwhile I would like to clarify few 
things in your comments.



Comment at: include/clang/Basic/AttrDocs.td:1866
@@ +1865,3 @@
+  let Content = [{
+The attribute ``__attribute__((ifunc("resolver")))`` is used to mark a 
function as an indirect function using the STT_GNU_IFUNC symbol type extension 
to the ELF standard. For more information, see GCC ifunc attribute 
documentation https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html
+  }];

rjmccall wrote:
> This is unnecessarily technical for user-level documentation.  Fortunately, 
> you need to change it anyway because you copied that sentence directly from 
> documentation that I believe is GPL'ed.  Also, it would be better to actually 
> document the behavior of the attribute here rather than forwarding to GCC's 
> documentation.
> 
> I would say something like this:
> 
>   ``__attribute__((ifunc("resolver")))`` is used to mark that the address of 
> a declaration should be resolved at runtime by calling a resolver function.
> 
>   The symbol name of the resolver function is given in quotes.  A function 
> with this name (after mangling) must be defined in the current translation 
> unit; it may be ``static``.  The resolver function should take no arguments 
> and return a function pointer of type ``void (*)(void)``.
> 
>   The ``ifunc`` attribute may only be used on a function declaration.  A 
> function declaration with an ``ifunc`` attribute is considered to be a 
> definition of the declared entity.  The entity must not have weak linkage; 
> for example, in C++, it cannot be applied to a declaration if a definition at 
> that location would be considered inline.
> 
>   Not all targets support this attribute.  ELF targets support this attribute 
> when using binutils v2.20.1 or higher and glibc v2.11.1 or higher.  Non-ELF 
> targets currently do not support this attribute.
> The symbol name of the resolver function is given in quotes.  A function with 
> this name (after mangling) must be defined in the current translation unit; 
> it may be ``static``.  The resolver function should take no arguments and 
> return a function pointer of type ``void (*)(void)`

Actually GCC doesn't make much less checks on resolver function itself. For 
example, it could return size_t or even void. So I removed part about return 
value type. Same as resolver function may have arguments but nothing will be 
passed there and it is not checked. With arguments of resolver perhaps we 
should add checks as for return value I think we have to be relaxed here to 
support existing code that uses void* as far as I can see.


Comment at: lib/CodeGen/CodeGenModule.cpp:2757
@@ +2756,3 @@
+  if (D->hasAttr()) {
+GA->setIFunc(true);
+GA->setLinkage(llvm::GlobalValue::LinkOnceAnyLinkage);

rjmccall wrote:
> This seems like a very poor choice of representation for this in LLVM IR.  I 
> understand that there are some basic parallels between ifuncs and global 
> aliases in terms of what they store — they're both global definitions that 
> refer to a different symbol — but they are semantically extremely different.  
> In particular, code that sees an llvm::GlobalAlias should not have to check 
> !isIFunc().
Could you please clarify what do you mean by "check !isIFunc()"? I don't have 
such checks I only check for if (isIFunc()) and some extra work. I only have 
setIFunc(false) in c-tor just to initialize the field. ifunc is an alias with 
some additional properties so it could be modeled as derivative class from 
alias. 


Comment at: lib/CodeGen/CodeGenModule.cpp:2758
@@ +2757,3 @@
+GA->setIFunc(true);
+GA->setLinkage(llvm::GlobalValue::LinkOnceAnyLinkage);
+  }

rjmccall wrote:
> Can you explain the purpose of this line?
I need it don't allow optimization that use resolver function directly instead 
of alias. I could patch checks or I can make special linkage in LLVM for ifunc.


http://reviews.llvm.org/D15524



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


Re: [PATCH] D13126: New static analyzer checker for loss of sign/precision

2015-12-17 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment.

Thanks a lot for those comments. I'll try your suggestions. I will try to 
upload some samples where I think the ProgramState is wrong.



Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:78
@@ +77,3 @@
+
+// Can E value be greater or equal than Val?
+static bool canBeGreaterEqual(CheckerContext &C, const Expr *E,

NoQ wrote:
> It's not quite "the value can be greater or equal", but in fact rather "the 
> value is certainly greater or equal".
> Same applies to `canBeNegative()`.
I disagree.

int A = 0;
if (X) {
 A = 1000;
}
U8 = A;  // <- Imho; A _can_ be 1000

Imho it's better to say that A _can_ be 1000 unless A is 1000 for all possible 
execution paths through the code.



http://reviews.llvm.org/D13126



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


Re: [PATCH] D15070: [mips] Added support for -Wa, -mips32 and similar.

2015-12-17 Thread Scott Egerton via cfe-commits
s.egerton updated this revision to Diff 43131.
s.egerton marked 4 inline comments as done.
s.egerton added a comment.

Responded to reviewers comments.

The -mips* option is now saved until all arguments have been parsed. The last 
-mips* option is the only one pushed back.
The tests are now updated to check that multiple -target-feature -mips* options 
are not present.


http://reviews.llvm.org/D15070

Files:
  lib/Driver/Tools.cpp
  test/Driver/mips-ias-Wa.s

Index: test/Driver/mips-ias-Wa.s
===
--- test/Driver/mips-ias-Wa.s
+++ test/Driver/mips-ias-Wa.s
@@ -47,3 +47,91 @@
 // RUN:   FileCheck -check-prefix=MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST %s
 // MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST: -cc1as
 // MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST: "-target-feature" "-soft-float" "-target-feature" "+soft-float"
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips1 2>&1 | \
+// RUN:   FileCheck -check-prefix=MIPS1 %s
+// MIPS1: -cc1as
+// MIPS1: "-target-feature" "+mips1"
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips2 2>&1 | \
+// RUN:   FileCheck -check-prefix=MIPS2 %s
+// MIPS2: -cc1as
+// MIPS2: "-target-feature" "+mips2"
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips3 2>&1 | \
+// RUN:   FileCheck -check-prefix=MIPS3 %s
+// MIPS3: -cc1as
+// MIPS3: "-target-feature" "+mips3"
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips4 2>&1 | \
+// RUN:   FileCheck -check-prefix=MIPS4 %s
+// MIPS4: -cc1as
+// MIPS4: "-target-feature" "+mips4"
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips5 2>&1 | \
+// RUN:   FileCheck -check-prefix=MIPS5 %s
+// MIPS5: -cc1as
+// MIPS5: "-target-feature" "+mips5"
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32 2>&1 | \
+// RUN:   FileCheck -check-prefix=MIPS32 %s
+// MIPS32: -cc1as
+// MIPS32: "-target-feature" "+mips32"
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r2 2>&1 | \
+// RUN:   FileCheck -check-prefix=MIPS32R2 %s
+// MIPS32R2: -cc1as
+// MIPS32R2: "-target-feature" "+mips32r2"
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r3 2>&1 | \
+// RUN:   FileCheck -check-prefix=MIPS32R3 %s
+// MIPS32R3: -cc1as
+// MIPS32R3: "-target-feature" "+mips32r3"
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r5 2>&1 | \
+// RUN:   FileCheck -check-prefix=MIPS32R5 %s
+// MIPS32R5: -cc1as
+// MIPS32R5: "-target-feature" "+mips32r5"
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r6 2>&1 | \
+// RUN:   FileCheck -check-prefix=MIPS32R6 %s
+// MIPS32R6: -cc1as
+// MIPS32R6: "-target-feature" "+mips32r6"
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64 2>&1 | \
+// RUN:   FileCheck -check-prefix=MIPS64 %s
+// MIPS64: -cc1as
+// MIPS64: "-target-feature" "+mips64"
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64r2 2>&1 | \
+// RUN:   FileCheck -check-prefix=MIPS64R2 %s
+// MIPS64R2: -cc1as
+// MIPS64R2: "-target-feature" "+mips64r2"
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64r3 2>&1 | \
+// RUN:   FileCheck -check-prefix=MIPS64R3 %s
+// MIPS64R3: -cc1as
+// MIPS64R3: "-target-feature" "+mips64r3"
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64r5 2>&1 | \
+// RUN:   FileCheck -check-prefix=MIPS64R5 %s
+// MIPS64R5: -cc1as
+// MIPS64R5: "-target-feature" "+mips64r5"
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64r6 2>&1 | \
+// RUN:   FileCheck -check-prefix=MIPS64R6 %s
+// MIPS64R6: -cc1as
+// MIPS64R6: "-target-feature" "+mips64r6"
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64r2,-mips4 2>&1 | \
+// RUN:   FileCheck -check-prefix=MIPS64R2-MIPS4 %s
+// MIPS64R2-MIPS4: -cc1as
+// MIPS64R2-MIPS4: "-target-feature" "+mips4"
+// MIPS64R2-MIPS4-NOT: "-target-feature" "+mips64r2"
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64,-mips32,-mips32r2 2>&1 | \
+// RUN:   FileCheck -check-prefix=MIPS64-MIPS32-MIPS32R2 %s
+// MIPS64-MIPS32-MIPS32R2: -cc1as
+// MIPS64-MIPS32-MIPS32R2: "-target-feature" "+mips32r2"
+// MIPS64-MIPS32-MIPS32R2-NOT: "-target-feature" "+mips64"
+// MIPS64-MIPS32-MIPS32R2-NOT: "-target-feature" "+mips32"
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -2460,6 +2460,7 @@
   // When using an integrated assembler, translate -Wa, and -Xassembler
   // options.
   bool CompressDebugSections = false;
+  const char *MipsTargetFeature = "";
   for (const Arg *A :
Args.filtered(options::OPT_Wa_COMMA, options::OPT_Xassembler)) {
 A->claim();
@@ -2498,7 +2499,25 @@
   CmdArgs.push_back("-soft-float");

Re: [PATCH] D15456: [PATCH] New diagnostic for non-idiomatic copy or move operations (v2)

2015-12-17 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

Ping.


http://reviews.llvm.org/D15456



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


Re: [PATCH] D15455: [Driver] Let -static override the toolchain default PIC setting.

2015-12-17 Thread James Y Knight via cfe-commits
jyknight added a comment.

> #define CC1_SPEC "%{!mkernel:%{!static:%{!mdynamic-no-pic:-fPIC}}}


That's sad.

> We can change this to be Darwin-specific if you prefer, but we should 
> maintain compatibility with GCC and previous Clang releases in this behavior.


Yes, the broken behavior should be reinstated for Darwin only.


http://reviews.llvm.org/D15455



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


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

2015-12-17 Thread Logan Chien via cfe-commits
logan created this revision.
logan added reviewers: rengolin, danalbert, kevin.qin, echristo, srhines.
logan added a subscriber: cfe-commits.
Herald added subscribers: rengolin, aemerson.

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 issue with LLVM integrated-as, so that there is
   no default 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 flag
explicitly.

Fix http://llvm.org/PR21292

http://reviews.llvm.org/D15613

Files:
  src/cxa_exception.cpp

Index: src/cxa_exception.cpp
===
--- src/cxa_exception.cpp
+++ src/cxa_exception.cpp
@@ -334,7 +334,7 @@
 }
 
 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"


Index: src/cxa_exception.cpp
===
--- src/cxa_exception.cpp
+++ src/cxa_exception.cpp
@@ -334,7 +334,7 @@
 }
 
 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] D13126: New static analyzer checker for loss of sign/precision

2015-12-17 Thread Aleksei Sidorin via cfe-commits
a.sidorin added a subscriber: a.sidorin.


Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:41
@@ +40,3 @@
+const Stmt *Parent = PM.getParent(Cast);
+if (!Parent)
+  return;

Parent should always exist for an implicit cast. May be it's better to assert 
here?


Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:49
@@ +48,3 @@
+BinaryOperator::Opcode Opc = B->getOpcode();
+if (Opc == BO_Assign || Opc == BO_MulAssign)
+  diagnoseLossOfPrecision(Cast, C);

It's not evident why do you omit other Assign operators here, like 
BO_SubAssign, BO_AddAssign and BO_DivAssign. As I see from your test, there are 
some problems with them. Could you add a comment?


Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:74
@@ +73,3 @@
+static bool isSigned(const Expr *E) {
+  const Type *T = E ? E->getType().getTypePtr() : nullptr;
+  return T && T->isSignedIntegerType();

Source sub-expression of cast expression we're visiting cannot be null and it 
should have non-null type. I think you can use something like 
`E->getType()->isSignedIntegerType()` instead of this function or you can use 
some assertions.


http://reviews.llvm.org/D13126



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


Re: [PATCH] D10370: clang-format: Implement AlwaysBreakAfterDeclarationReturnType.

2015-12-17 Thread Zachary Turner via cfe-commits
zturner added a comment.

ping


http://reviews.llvm.org/D10370



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


Re: [PATCH] D15222: [Patch][Profile] add “--dependent-lib= libclang_rt.profile-x86_64.a” to the CC1 command line when enabling code coverage on PS4

2015-12-17 Thread Ying Yi via cfe-commits
MaggieYi added a comment.

Thanks Paul for your help.


Repository:
  rL LLVM

http://reviews.llvm.org/D15222



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


Re: [PATCH] D13126: New static analyzer checker for loss of sign/precision

2015-12-17 Thread Aleksei Sidorin via cfe-commits
a.sidorin added inline comments.


Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:44
@@ +43,3 @@
+
+const BinaryOperator *B = dyn_cast(Parent);
+if (!B)

Note that InitExprs of DeclStmts are not binary operators. So you will not get 
a warning on initialization and this test:

```
void test(unsigned int p) {
  unsigned X = 1000;
  unsigned char uc = X; // expected-warning {{Loss of precision}}
}
```
will fail.


http://reviews.llvm.org/D13126



___
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-17 Thread Aaron Ballman via cfe-commits
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&view=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&r1=255885&r2=255886&view=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&r1=255885&r2=255886&view=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&view=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 will not insert the override keyword if a method is
> -  pure. At the moment it's not possible to track down the pure
> -  specifier location.
> -
> -.. code-block:: c++
> -
> -  class B : public A {
> -  public:
> -virtual void h() const = 0;
> -
> -// The declaration of h is NOT transformed to
> -virtual void h() const ove

Re: [PATCH] D15528: Teach clang-tidy how to -Werror checks.

2015-12-17 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

Thanks for the review! I'll rework this a bit early next week.


http://reviews.llvm.org/D15528



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


Re: [PATCH] D15163: Attach maximum function count to Module when using PGO mode.

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

LGTM


Repository:
  rL LLVM

http://reviews.llvm.org/D15163



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


r255911 - [CUDA] Make vtable construction aware of host/device side of CUDA compilation.

2015-12-17 Thread Artem Belevich via cfe-commits
Author: tra
Date: Thu Dec 17 12:12:36 2015
New Revision: 255911

URL: http://llvm.org/viewvc/llvm-project?rev=255911&view=rev
Log:
[CUDA] Make vtable construction aware of host/device side of CUDA compilation.

C++ emits vtables for classes that have key function present in the
current TU. While we compile CUDA the fact that key function was found
in this TU does not mean that we are going to generate code for it. E.g.
vtable for a class with host-only methods should not (and can not) be
generated on device side, because we'll never generate code for them
during device-side compilation.

This patch adds an extra CUDA-specific check during key method computation
and filters out potential key methods that are not suitable for this side
of CUDA compilation.

When we codegen vtable, entries for unsuitable methods are set to null.

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

Added:
cfe/trunk/test/CodeGenCUDA/device-vtable.cu
Modified:
cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
cfe/trunk/lib/CodeGen/CGVTables.cpp

Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?rev=255911&r1=255910&r2=255911&view=diff
==
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Thu Dec 17 12:12:36 2015
@@ -2025,6 +2025,21 @@ static const CXXMethodDecl *computeKeyFu
 continue;
 }
 
+if (Context.getLangOpts().CUDA) {
+  // While compiler may see key method in this TU, during CUDA
+  // compilation we should ignore methods that are not accessible
+  // on this side of compilation.
+  if (Context.getLangOpts().CUDAIsDevice) {
+// In device mode ignore methods without __device__ attribute.
+if (!MD->hasAttr())
+  continue;
+  } else {
+// In host mode ignore __device__-only methods.
+if (!MD->hasAttr() && MD->hasAttr())
+  continue;
+  }
+}
+
 // If the key function is dllimport but the class isn't, then the class has
 // no key function. The DLL that exports the key function won't export the
 // vtable in this case.

Modified: cfe/trunk/lib/CodeGen/CGVTables.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTables.cpp?rev=255911&r1=255910&r2=255911&view=diff
==
--- cfe/trunk/lib/CodeGen/CGVTables.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVTables.cpp Thu Dec 17 12:12:36 2015
@@ -582,6 +582,24 @@ llvm::Constant *CodeGenVTables::CreateVT
 break;
   }
 
+  if (CGM.getLangOpts().CUDA) {
+// Emit NULL for methods we can't codegen on this
+// side. Otherwise we'd end up with vtable with unresolved
+// references.
+const CXXMethodDecl *MD = cast(GD.getDecl());
+// OK on device side: functions w/ __device__ attribute
+// OK on host side: anything except __device__-only functions.
+bool CanEmitMethod = CGM.getLangOpts().CUDAIsDevice
+ ? MD->hasAttr()
+ : (MD->hasAttr() ||
+!MD->hasAttr());
+if (!CanEmitMethod) {
+  Init = llvm::ConstantExpr::getNullValue(Int8PtrTy);
+  break;
+}
+// Method is acceptable, continue processing as usual.
+  }
+
   if (cast(GD.getDecl())->isPure()) {
 // We have a pure virtual member function.
 if (!PureVirtualFn) {

Added: cfe/trunk/test/CodeGenCUDA/device-vtable.cu
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCUDA/device-vtable.cu?rev=255911&view=auto
==
--- cfe/trunk/test/CodeGenCUDA/device-vtable.cu (added)
+++ cfe/trunk/test/CodeGenCUDA/device-vtable.cu Thu Dec 17 12:12:36 2015
@@ -0,0 +1,61 @@
+// REQUIRES: x86-registered-target
+// REQUIRES: nvptx-registered-target
+
+// Make sure we don't emit vtables for classes with methods that have
+// inappropriate target attributes. Currently it's mostly needed in
+// order to avoid emitting vtables for host-only classes on device
+// side where we can't codegen them.
+
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -o - %s \
+// RUN: | FileCheck %s -check-prefix=CHECK-HOST -check-prefix=CHECK-BOTH
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -fcuda-is-device -emit-llvm -o 
- %s \
+// RUN: | FileCheck %s -check-prefix=CHECK-DEVICE -check-prefix=CHECK-BOTH
+
+#include "Inputs/cuda.h"
+
+struct H  {
+  virtual void method();
+};
+//CHECK-HOST: @_ZTV1H =
+//CHECK-HOST-SAME: @_ZN1H6methodEv
+//CHECK-DEVICE-NOT: @_ZTV1H =
+
+struct D  {
+   __device__ virtual void method();
+};
+
+//CHECK-DEVICE: @_ZTV1D
+//CHECK-DEVICE-SAME: @_ZN1D6methodEv
+//CHECK-HOST-NOT: @_ZTV1D
+
+// This is the case with

Re: [PATCH] D15309: [CUDA] emit vtables only for classes with methods usable on this side of compilation.

2015-12-17 Thread Artem Belevich via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL255911: [CUDA] Make vtable construction aware of host/device 
side of CUDA compilation. (authored by tra).

Changed prior to commit:
  http://reviews.llvm.org/D15309?vs=42341&id=43150#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15309

Files:
  cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
  cfe/trunk/lib/CodeGen/CGVTables.cpp
  cfe/trunk/test/CodeGenCUDA/device-vtable.cu

Index: cfe/trunk/test/CodeGenCUDA/device-vtable.cu
===
--- cfe/trunk/test/CodeGenCUDA/device-vtable.cu
+++ cfe/trunk/test/CodeGenCUDA/device-vtable.cu
@@ -0,0 +1,61 @@
+// REQUIRES: x86-registered-target
+// REQUIRES: nvptx-registered-target
+
+// Make sure we don't emit vtables for classes with methods that have
+// inappropriate target attributes. Currently it's mostly needed in
+// order to avoid emitting vtables for host-only classes on device
+// side where we can't codegen them.
+
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -o - %s \
+// RUN: | FileCheck %s -check-prefix=CHECK-HOST -check-prefix=CHECK-BOTH
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -fcuda-is-device -emit-llvm -o - %s \
+// RUN: | FileCheck %s -check-prefix=CHECK-DEVICE -check-prefix=CHECK-BOTH
+
+#include "Inputs/cuda.h"
+
+struct H  {
+  virtual void method();
+};
+//CHECK-HOST: @_ZTV1H =
+//CHECK-HOST-SAME: @_ZN1H6methodEv
+//CHECK-DEVICE-NOT: @_ZTV1H =
+
+struct D  {
+   __device__ virtual void method();
+};
+
+//CHECK-DEVICE: @_ZTV1D
+//CHECK-DEVICE-SAME: @_ZN1D6methodEv
+//CHECK-HOST-NOT: @_ZTV1D
+
+// This is the case with mixed host and device virtual methods.  It's
+// impossible to emit a valid vtable in that case because only host or
+// only device methods would be available during host or device
+// compilation. At the moment Clang (and NVCC) emit NULL pointers for
+// unavailable methods,
+struct HD  {
+  virtual void h_method();
+  __device__ virtual void d_method();
+};
+// CHECK-BOTH: @_ZTV2HD
+// CHECK-DEVICE-NOT: @_ZN2HD8h_methodEv
+// CHECK-DEVICE-SAME: null
+// CHECK-DEVICE-SAME: @_ZN2HD8d_methodEv
+// CHECK-HOST-SAME: @_ZN2HD8h_methodEv
+// CHECK-HOST-NOT: @_ZN2HD8d_methodEv
+// CHECK-HOST-SAME: null
+// CHECK-BOTH-SAME: ]
+
+void H::method() {}
+//CHECK-HOST: define void @_ZN1H6methodEv
+
+void __device__ D::method() {}
+//CHECK-DEVICE: define void @_ZN1D6methodEv
+
+void __device__ HD::d_method() {}
+// CHECK-DEVICE: define void @_ZN2HD8d_methodEv
+// CHECK-HOST-NOT: define void @_ZN2HD8d_methodEv
+void HD::h_method() {}
+// CHECK-HOST: define void @_ZN2HD8h_methodEv
+// CHECK-DEVICE-NOT: define void @_ZN2HD8h_methodEv
+
Index: cfe/trunk/lib/CodeGen/CGVTables.cpp
===
--- cfe/trunk/lib/CodeGen/CGVTables.cpp
+++ cfe/trunk/lib/CodeGen/CGVTables.cpp
@@ -582,6 +582,24 @@
 break;
   }
 
+  if (CGM.getLangOpts().CUDA) {
+// Emit NULL for methods we can't codegen on this
+// side. Otherwise we'd end up with vtable with unresolved
+// references.
+const CXXMethodDecl *MD = cast(GD.getDecl());
+// OK on device side: functions w/ __device__ attribute
+// OK on host side: anything except __device__-only functions.
+bool CanEmitMethod = CGM.getLangOpts().CUDAIsDevice
+ ? MD->hasAttr()
+ : (MD->hasAttr() ||
+!MD->hasAttr());
+if (!CanEmitMethod) {
+  Init = llvm::ConstantExpr::getNullValue(Int8PtrTy);
+  break;
+}
+// Method is acceptable, continue processing as usual.
+  }
+
   if (cast(GD.getDecl())->isPure()) {
 // We have a pure virtual member function.
 if (!PureVirtualFn) {
Index: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
===
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
@@ -2025,6 +2025,21 @@
 continue;
 }
 
+if (Context.getLangOpts().CUDA) {
+  // While compiler may see key method in this TU, during CUDA
+  // compilation we should ignore methods that are not accessible
+  // on this side of compilation.
+  if (Context.getLangOpts().CUDAIsDevice) {
+// In device mode ignore methods without __device__ attribute.
+if (!MD->hasAttr())
+  continue;
+  } else {
+// In host mode ignore __device__-only methods.
+if (!MD->hasAttr() && MD->hasAttr())
+  continue;
+  }
+}
+
 // If the key function is dllimport but the class isn't, then the class has
 // no key function. The DLL that exports the key function won't export the
 // vtable in this case.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm

Re: [PATCH] D15455: [Driver] Let -static override the toolchain default PIC setting.

2015-12-17 Thread Joerg Sonnenberger via cfe-commits
On Wed, Dec 16, 2015 at 11:59:10PM +, Bob Wilson via cfe-commits wrote:
> We can change this to be Darwin-specific if you prefer, but we should
> maintain compatibility with GCC and previous Clang releases in this behavior.

Who is really affected by this? I don't care too much about obscure
Darwin hacks, but I really wonder why it isn't better to just explicitly
add -fno-PIC (e.g. when building a kernel module). It's not like that
will break on older versions of GCC or Clang.

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


Re: [PATCH] D14653: [libcxx] Introduce the mechanism for fixing -fno-exceptions test failures.

2015-12-17 Thread Marshall Clow via cfe-commits
mclow.lists added inline comments.


Comment at: test/support/noexcept.h:43
@@ +42,3 @@
+#define try if(!setjmp(try_buf))
+#define catch(ex) else
+

This is explicitly forbidden by the standard.
[macro.names]/2:
A translation unit shall not #define or #undef names lexically identical to 
keywords, to the identifiers listed in Table 2, or to the attribute-tokens 
described in 7.6.


http://reviews.llvm.org/D14653



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


Re: [PATCH] D15524: [GCC] Attribute ifunc support in clang

2015-12-17 Thread John McCall via cfe-commits
rjmccall added inline comments.


Comment at: include/clang/Basic/AttrDocs.td:1866
@@ +1865,3 @@
+  let Content = [{
+The attribute ``__attribute__((ifunc("resolver")))`` is used to mark a 
function as an indirect function using the STT_GNU_IFUNC symbol type extension 
to the ELF standard. For more information, see GCC ifunc attribute 
documentation https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html
+  }];

DmitryPolukhin wrote:
> rjmccall wrote:
> > This is unnecessarily technical for user-level documentation.  Fortunately, 
> > you need to change it anyway because you copied that sentence directly from 
> > documentation that I believe is GPL'ed.  Also, it would be better to 
> > actually document the behavior of the attribute here rather than forwarding 
> > to GCC's documentation.
> > 
> > I would say something like this:
> > 
> >   ``__attribute__((ifunc("resolver")))`` is used to mark that the address 
> > of a declaration should be resolved at runtime by calling a resolver 
> > function.
> > 
> >   The symbol name of the resolver function is given in quotes.  A function 
> > with this name (after mangling) must be defined in the current translation 
> > unit; it may be ``static``.  The resolver function should take no arguments 
> > and return a function pointer of type ``void (*)(void)``.
> > 
> >   The ``ifunc`` attribute may only be used on a function declaration.  A 
> > function declaration with an ``ifunc`` attribute is considered to be a 
> > definition of the declared entity.  The entity must not have weak linkage; 
> > for example, in C++, it cannot be applied to a declaration if a definition 
> > at that location would be considered inline.
> > 
> >   Not all targets support this attribute.  ELF targets support this 
> > attribute when using binutils v2.20.1 or higher and glibc v2.11.1 or 
> > higher.  Non-ELF targets currently do not support this attribute.
> > The symbol name of the resolver function is given in quotes.  A function 
> > with this name (after mangling) must be defined in the current translation 
> > unit; it may be ``static``.  The resolver function should take no arguments 
> > and return a function pointer of type ``void (*)(void)`
> 
> Actually GCC doesn't make much less checks on resolver function itself. For 
> example, it could return size_t or even void. So I removed part about return 
> value type. Same as resolver function may have arguments but nothing will be 
> passed there and it is not checked. With arguments of resolver perhaps we 
> should add checks as for return value I think we have to be relaxed here to 
> support existing code that uses void* as far as I can see.
That generally makes sense, but let's at least require it to return a pointer.


Comment at: lib/CodeGen/CodeGenModule.cpp:2758
@@ +2757,3 @@
+GA->setIFunc(true);
+GA->setLinkage(llvm::GlobalValue::LinkOnceAnyLinkage);
+  }

DmitryPolukhin wrote:
> rjmccall wrote:
> > Can you explain the purpose of this line?
> I need it don't allow optimization that use resolver function directly 
> instead of alias. I could patch checks or I can make special linkage in LLVM 
> for ifunc.
Okay, this ties into the previous comment.  The problem I have with ifuncs just 
being represented as global aliases with a special flag set is that now every 
LLVM analysis that sees a global alias has to check the flag before it can 
correctly interpret it.  It doesn't promote maintainable, 
conservatively-correct code.  You're working around that by setting a 
particular kind of linkage, but that's just going to cause other problems.

A much better fix is to make a new kind of llvm::GlobalValue that represents a 
dynamically resolved global.  This is a lot less work than you probably think 
it is — there are very few exhaustive switches over all value kinds in LLVM, 
and frankly most of those are places you need to be updating for ifuncs anyway. 
 It might make sense for this to share a common base class with 
llvm::GlobalAlias, but it shouldn't be a *subclass* of llvm::GlobalAlias.


http://reviews.llvm.org/D15524



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


Re: [PATCH] D15524: [GCC] Attribute ifunc support in clang

2015-12-17 Thread Eric Christopher via cfe-commits
echristo added inline comments.


Comment at: lib/CodeGen/CodeGenModule.cpp:2758
@@ +2757,3 @@
+GA->setIFunc(true);
+GA->setLinkage(llvm::GlobalValue::LinkOnceAnyLinkage);
+  }

rjmccall wrote:
> DmitryPolukhin wrote:
> > rjmccall wrote:
> > > Can you explain the purpose of this line?
> > I need it don't allow optimization that use resolver function directly 
> > instead of alias. I could patch checks or I can make special linkage in 
> > LLVM for ifunc.
> Okay, this ties into the previous comment.  The problem I have with ifuncs 
> just being represented as global aliases with a special flag set is that now 
> every LLVM analysis that sees a global alias has to check the flag before it 
> can correctly interpret it.  It doesn't promote maintainable, 
> conservatively-correct code.  You're working around that by setting a 
> particular kind of linkage, but that's just going to cause other problems.
> 
> A much better fix is to make a new kind of llvm::GlobalValue that represents 
> a dynamically resolved global.  This is a lot less work than you probably 
> think it is — there are very few exhaustive switches over all value kinds in 
> LLVM, and frankly most of those are places you need to be updating for ifuncs 
> anyway.  It might make sense for this to share a common base class with 
> llvm::GlobalAlias, but it shouldn't be a *subclass* of llvm::GlobalAlias.
FWIW I completely agree with this. :)


http://reviews.llvm.org/D15524



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


Re: r255371 - Error on redeclaring with a conflicting asm label and on redeclaring with an asm label after the first ODR-use. Detects problems like the one in PR22830 where gcc and clang both compiled

2015-12-17 Thread Kostya Serebryany via cfe-commits
I am now observing this error message when building glibc with clang (from
trunk):
../include/string.h:101:28: error: cannot apply asm label to function after
its first use
libc_hidden_builtin_proto (memcpy)
(many more instances)


Do you think this is a bug in glibc code, or the error message could be
more relaxed?





On Fri, Dec 11, 2015 at 1:28 PM, Nick Lewycky via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: nicholas
> Date: Fri Dec 11 15:28:55 2015
> New Revision: 255371
>
> URL: http://llvm.org/viewvc/llvm-project?rev=255371&view=rev
> Log:
> Error on redeclaring with a conflicting asm label and on redeclaring with
> an asm label after the first ODR-use. Detects problems like the one in
> PR22830 where gcc and clang both compiled the file but with different
> behaviour.
>
> Added:
> cfe/trunk/test/Sema/asm-label.c
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> cfe/trunk/lib/Sema/SemaDecl.cpp
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=255371&r1=255370&r2=255371&view=diff
>
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Dec 11
> 15:28:55 2015
> @@ -4259,6 +4259,9 @@ def err_tag_definition_of_typedef : Erro
>  def err_conflicting_types : Error<"conflicting types for %0">;
>  def err_different_pass_object_size_params : Error<
>"conflicting pass_object_size attributes on parameters">;
> +def err_late_asm_label_name : Error<
> +  "cannot apply asm label to %select{variable|function}0 after its first
> use">;
> +def err_different_asm_label : Error<"conflicting asm label">;
>  def err_nested_redefinition : Error<"nested redefinition of %0">;
>  def err_use_with_wrong_tag : Error<
>"use of %0 with tag type that does not match previous declaration">;
>
> Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=255371&r1=255370&r2=255371&view=diff
>
> ==
> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Dec 11 15:28:55 2015
> @@ -2379,9 +2379,24 @@ void Sema::mergeDeclAttributes(NamedDecl
>if (!Old->hasAttrs() && !New->hasAttrs())
>  return;
>
> -  // attributes declared post-definition are currently ignored
> +  // Attributes declared post-definition are currently ignored.
>checkNewAttributesAfterDef(*this, New, Old);
>
> +  if (AsmLabelAttr *NewA = New->getAttr()) {
> +if (AsmLabelAttr *OldA = Old->getAttr()) {
> +  if (OldA->getLabel() != NewA->getLabel()) {
> +// This redeclaration changes __asm__ label.
> +Diag(New->getLocation(), diag::err_different_asm_label);
> +Diag(OldA->getLocation(), diag::note_previous_declaration);
> +  }
> +} else if (Old->isUsed()) {
> +  // This redeclaration adds an __asm__ label to a declaration that
> has
> +  // already been ODR-used.
> +  Diag(New->getLocation(), diag::err_late_asm_label_name)
> +<< isa(Old) <<
> New->getAttr()->getRange();
> +}
> +  }
> +
>if (!Old->hasAttrs())
>  return;
>
>
> Added: cfe/trunk/test/Sema/asm-label.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/asm-label.c?rev=255371&view=auto
>
> ==
> --- cfe/trunk/test/Sema/asm-label.c (added)
> +++ cfe/trunk/test/Sema/asm-label.c Fri Dec 11 15:28:55 2015
> @@ -0,0 +1,30 @@
> +// RUN: %clang_cc1 -verify %s
> +
> +void f();
> +void f() __asm__("fish");
> +void g();
> +
> +void f() {
> +  g();
> +}
> +void g() __asm__("gold");  // expected-error{{cannot apply asm label to
> function after its first use}}
> +
> +void h() __asm__("hose");  // expected-note{{previous declaration is
> here}}
> +void h() __asm__("hair");  // expected-error{{conflicting asm label}}
> +
> +int x;
> +int x __asm__("xenon");
> +int y;
> +
> +int test() { return y; }
> +
> +int y __asm__("yacht");  // expected-error{{cannot apply asm label to
> variable after its first use}}
> +
> +int z __asm__("zebra");  // expected-note{{previous declaration is here}}
> +int z __asm__("zooms");  // expected-error{{conflicting asm label}}
> +
> +
> +// No diagnostics on the following.
> +void __real_readlink() __asm("readlink");
> +void readlink() __asm("__protected_readlink");
> +void readlink() { __real_readlink(); }
>
>
> ___
> 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


r255915 - [x86] Filecheck is case sensitive. Capitalize directives.

2015-12-17 Thread Chad Rosier via cfe-commits
Author: mcrosier
Date: Thu Dec 17 12:54:42 2015
New Revision: 255915

URL: http://llvm.org/viewvc/llvm-project?rev=255915&view=rev
Log:
[x86] Filecheck is case sensitive.  Capitalize directives.

Modified:
cfe/trunk/test/CodeGen/avx512er-builtins.c

Modified: cfe/trunk/test/CodeGen/avx512er-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512er-builtins.c?rev=255915&r1=255914&r2=255915&view=diff
==
--- cfe/trunk/test/CodeGen/avx512er-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512er-builtins.c Thu Dec 17 12:54:42 2015
@@ -12,14 +12,14 @@ __m512d test_mm512_rsqrt28_round_pd(__m5
 }
 
 __m512d test_mm512_mask_rsqrt28_round_pd(__m512d s, __mmask8 m, __m512d a) {
-  // check-label: @test_mm512_mask_rsqrt28_round_pd
-  // check: @llvm.x86.avx512.rsqrt28.pd
+  // CHECK-LABEL: @test_mm512_mask_rsqrt28_round_pd
+  // CHECK: @llvm.x86.avx512.rsqrt28.pd
   return _mm512_mask_rsqrt28_round_pd(s, m, a, _MM_FROUND_TO_NEAREST_INT);
 }
 
 __m512d test_mm512_maskz_rsqrt28_round_pd(__mmask8 m, __m512d a) {
-  // check-label: @test_mm512_maskz_rsqrt28_round_pd
-  // check: @llvm.x86.avx512.rsqrt28.pd
+  // CHECK-LABEL: @test_mm512_maskz_rsqrt28_round_pd
+  // CHECK: @llvm.x86.avx512.rsqrt28.pd
   return _mm512_maskz_rsqrt28_round_pd(m, a, _MM_FROUND_TO_NEAREST_INT);
 }
 
@@ -30,14 +30,14 @@ __m512d test_mm512_rsqrt28_pd(__m512d a)
 }
 
 __m512d test_mm512_mask_rsqrt28_pd(__m512d s, __mmask8 m, __m512d a) {
-  // check-label: @test_mm512_mask_rsqrt28_pd
-  // check: @llvm.x86.avx512.rsqrt28.pd
+  // CHECK-LABEL: @test_mm512_mask_rsqrt28_pd
+  // CHECK: @llvm.x86.avx512.rsqrt28.pd
   return _mm512_mask_rsqrt28_pd(s, m, a);
 }
 
 __m512d test_mm512_maskz_rsqrt28_pd(__mmask8 m, __m512d a) {
-  // check-label: @test_mm512_maskz_rsqrt28_pd
-  // check: @llvm.x86.avx512.rsqrt28.pd
+  // CHECK-LABEL: @test_mm512_maskz_rsqrt28_pd
+  // CHECK: @llvm.x86.avx512.rsqrt28.pd
   return _mm512_maskz_rsqrt28_pd(m, a);
 }
 
@@ -78,38 +78,38 @@ __m512 test_mm512_maskz_rsqrt28_ps(__mma
 }
 
 __m128 test_mm_rsqrt28_round_ss(__m128 a, __m128 b) {
-  // check-label: @test_mm_rsqrt28_round_ss
-  // check: @llvm.x86.avx512.rsqrt28.ss
+  // CHECK-LABEL: @test_mm_rsqrt28_round_ss
+  // CHECK: @llvm.x86.avx512.rsqrt28.ss
   return _mm_rsqrt28_round_ss(a, b, _MM_FROUND_TO_NEAREST_INT);
 }
 
 __m128 test_mm_mask_rsqrt28_round_ss(__m128 s, __mmask16 m, __m128 a, __m128 
b) {
-  // check-label: @test_mm_mask_rsqrt28_round_ss
-  // check: @llvm.x86.avx512.rsqrt28.ss
+  // CHECK-LABEL: @test_mm_mask_rsqrt28_round_ss
+  // CHECK: @llvm.x86.avx512.rsqrt28.ss
   return _mm_mask_rsqrt28_round_ss(s, m, a, b, _MM_FROUND_TO_NEAREST_INT);
 }
 
 __m128 test_mm_maskz_rsqrt28_round_ss(__mmask16 m, __m128 a, __m128 b) {
-  // check-label: @test_mm_maskz_rsqrt28_round_ss
-  // check: @llvm.x86.avx512.rsqrt28.ss
+  // CHECK-LABEL: @test_mm_maskz_rsqrt28_round_ss
+  // CHECK: @llvm.x86.avx512.rsqrt28.ss
   return _mm_maskz_rsqrt28_round_ss(m, a, b, _MM_FROUND_TO_NEAREST_INT);
 }
 
 __m128 test_mm_rsqrt28_ss(__m128 a, __m128 b) {
-  // check-label: @test_mm_rsqrt28_ss
-  // check: @llvm.x86.avx512.rsqrt28.ss
+  // CHECK-LABEL: @test_mm_rsqrt28_ss
+  // CHECK: @llvm.x86.avx512.rsqrt28.ss
   return _mm_rsqrt28_ss(a, b);
 }
 
 __m128 test_mm_mask_rsqrt28_ss(__m128 s, __mmask16 m, __m128 a, __m128 b) {
-  // check-label: @test_mm_mask_rsqrt28_ss
-  // check: @llvm.x86.avx512.rsqrt28.ss
+  // CHECK-LABEL: @test_mm_mask_rsqrt28_ss
+  // CHECK: @llvm.x86.avx512.rsqrt28.ss
   return _mm_mask_rsqrt28_ss(s, m, a, b);
 }
 
 __m128 test_mm_maskz_rsqrt28_ss(__mmask16 m, __m128 a, __m128 b) {
-  // check-label: @test_mm_maskz_rsqrt28_ss
-  // check: @llvm.x86.avx512.rsqrt28.ss
+  // CHECK-LABEL: @test_mm_maskz_rsqrt28_ss
+  // CHECK: @llvm.x86.avx512.rsqrt28.ss
   return _mm_maskz_rsqrt28_ss(m, a, b);
 }
 
@@ -138,14 +138,14 @@ __m512d test_mm512_rcp28_round_pd(__m512
 }
 
 __m512d test_mm512_mask_rcp28_round_pd(__m512d s, __mmask8 m, __m512d a) {
-  // check-label: @test_mm512_mask_rcp28_round_pd
-  // check: @llvm.x86.avx512.rcp28.pd
+  // CHECK-LABEL: @test_mm512_mask_rcp28_round_pd
+  // CHECK: @llvm.x86.avx512.rcp28.pd
   return _mm512_mask_rcp28_round_pd(s, m, a, _MM_FROUND_TO_NEAREST_INT);
 }
 
 __m512d test_mm512_maskz_rcp28_round_pd(__mmask8 m, __m512d a) {
-  // check-label: @test_mm512_maskz_rcp28_round_pd
-  // check: @llvm.x86.avx512.rcp28.pd
+  // CHECK-LABEL: @test_mm512_maskz_rcp28_round_pd
+  // CHECK: @llvm.x86.avx512.rcp28.pd
   return _mm512_maskz_rcp28_round_pd(m, a, _MM_FROUND_TO_NEAREST_INT);
 }
 
@@ -156,14 +156,14 @@ __m512d test_mm512_rcp28_pd(__m512d a) {
 }
 
 __m512d test_mm512_mask_rcp28_pd(__m512d s, __mmask8 m, __m512d a) {
-  // check-label: @test_mm512_mask_rcp28_pd
-  // check: @llvm.x86.avx512.rcp28.pd
+  // CHECK-LABEL: @test_mm512_mask_rcp28_pd
+  // CHECK: @llvm.x86.avx512.rcp28.pd
   return _mm512_mask_rcp28_pd(s, m, a);
 }
 
 __m5

Re: [PATCH] D15455: [Driver] Let -static override the toolchain default PIC setting.

2015-12-17 Thread Bob Wilson via cfe-commits

> On Dec 17, 2015, at 10:16 AM, Joerg Sonnenberger via cfe-commits 
>  wrote:
> 
> On Wed, Dec 16, 2015 at 11:59:10PM +, Bob Wilson via cfe-commits wrote:
>> We can change this to be Darwin-specific if you prefer, but we should
>> maintain compatibility with GCC and previous Clang releases in this behavior.
> 
> Who is really affected by this? I don't care too much about obscure
> Darwin hacks, but I really wonder why it isn't better to just explicitly
> add -fno-PIC (e.g. when building a kernel module). It's not like that
> will break on older versions of GCC or Clang.

Apple has internal projects that are failing to build. This behavior has been 
in places for many years and I don’t even know how we could find all the people 
relying on this behavior. Yes, we could break them and force everyone to add 
-fno-PIC, but typically when we make disruptive and incompatible changes like 
that, we need to stage the changes and give people a transition plan. For 
example, we could keep the old behavior but add a warning about the change, 
something like “warning: -static may be changed in future versions of clang to 
stop implying -fno-PIC”. After a year or two, we could then go ahead with the 
change. That is all a lot of work and there needs to be some significant 
benefit to justify breaking compatibility with older compilers. I don’t see any 
significant benefit here. It’s a 2-line change to the driver.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r255916 - [x86] Filecheck is case sensitive. Capitalize directives.

2015-12-17 Thread Chad Rosier via cfe-commits
Author: mcrosier
Date: Thu Dec 17 13:01:55 2015
New Revision: 255916

URL: http://llvm.org/viewvc/llvm-project?rev=255916&view=rev
Log:
[x86] Filecheck is case sensitive.  Capitalize directives.

Modified:
cfe/trunk/test/CodeGen/avx512f-builtins.c

Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=255916&r1=255915&r2=255916&view=diff
==
--- cfe/trunk/test/CodeGen/avx512f-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c Thu Dec 17 13:01:55 2015
@@ -772,8 +772,8 @@ __mmask16 test_mm512_mask_cmp_round_ps_m
 }
 
 __mmask16 test_mm512_cmp_ps_mask(__m512 a, __m512 b) {
-  // check-label: @test_mm512_cmp_ps_mask
-  // check: @llvm.x86.avx512.mask.cmp.ps.512
+  // CHECK-LABEL: @test_mm512_cmp_ps_mask
+  // CHECKn: @llvm.x86.avx512.mask.cmp.ps.512
   return _mm512_cmp_ps_mask(a, b, 0);
 }
 
@@ -796,8 +796,8 @@ __mmask8 test_mm512_mask_cmp_round_pd_ma
 }
 
 __mmask8 test_mm512_cmp_pd_mask(__m512d a, __m512d b) {
-  // check-label: @test_mm512_cmp_pd_mask
-  // check: @llvm.x86.avx512.mask.cmp.pd.512
+  // CHECK-LABEL: @test_mm512_cmp_pd_mask
+  // CHECK: @llvm.x86.avx512.mask.cmp.pd.512
   return _mm512_cmp_pd_mask(a, b, 0);
 }
 


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


r255918 - Attach maximum function count to Module when using PGO mode.

2015-12-17 Thread Easwaran Raman via cfe-commits
Author: eraman
Date: Thu Dec 17 13:14:27 2015
New Revision: 255918

URL: http://llvm.org/viewvc/llvm-project?rev=255918&view=rev
Log:
Attach maximum function count to Module when using PGO mode.

This sets the maximum entry count among all functions in the program to the 
module using module flags. This allows the optimizer to use this information.

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

Added:
cfe/trunk/test/Profile/Inputs/max-function-count.proftext
cfe/trunk/test/Profile/max-function-count.c
Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=255918&r1=255917&r2=255918&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Thu Dec 17 13:14:27 2015
@@ -375,8 +375,11 @@ void CodeGenModule::Release() {
 if (llvm::Function *CudaDtorFunction = 
CUDARuntime->makeModuleDtorFunction())
   AddGlobalDtor(CudaDtorFunction);
   }
-  if (PGOReader && PGOStats.hasDiagnostics())
-PGOStats.reportDiagnostics(getDiags(), getCodeGenOpts().MainFileName);
+  if (PGOReader) {
+getModule().setMaximumFunctionCount(PGOReader->getMaximumFunctionCount());
+if (PGOStats.hasDiagnostics())
+  PGOStats.reportDiagnostics(getDiags(), getCodeGenOpts().MainFileName);
+  }
   EmitCtorList(GlobalCtors, "llvm.global_ctors");
   EmitCtorList(GlobalDtors, "llvm.global_dtors");
   EmitGlobalAnnotations();

Added: cfe/trunk/test/Profile/Inputs/max-function-count.proftext
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Profile/Inputs/max-function-count.proftext?rev=255918&view=auto
==
--- cfe/trunk/test/Profile/Inputs/max-function-count.proftext (added)
+++ cfe/trunk/test/Profile/Inputs/max-function-count.proftext Thu Dec 17 
13:14:27 2015
@@ -0,0 +1,26 @@
+begin
+# Func Hash:
+10
+# Num Counters:
+2
+# Counter Values:
+1
+0
+
+main
+# Func Hash:
+0
+# Num Counters:
+1
+# Counter Values:
+1
+
+end
+# Func Hash:
+10
+# Num Counters:
+2
+# Counter Values:
+2
+2
+

Added: cfe/trunk/test/Profile/max-function-count.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Profile/max-function-count.c?rev=255918&view=auto
==
--- cfe/trunk/test/Profile/max-function-count.c (added)
+++ cfe/trunk/test/Profile/max-function-count.c Thu Dec 17 13:14:27 2015
@@ -0,0 +1,24 @@
+// Test that maximum function counts are set correctly.
+
+// RUN: llvm-profdata merge %S/Inputs/max-function-count.proftext -o 
%t.profdata
+// RUN: %clang %s -o - -mllvm -disable-llvm-optzns -emit-llvm -S 
-fprofile-instr-use=%t.profdata | FileCheck %s
+//
+int begin(int i) {
+  if (i)
+return 0;
+  return 1;
+}
+
+int end(int i) {
+  if (i)
+return 0;
+  return 1;
+}
+
+int main(int argc, const char *argv[]) {
+  begin(0);
+  end(1);
+  end(1);
+  return 0;
+}
+// CHECK: !{{[0-9]+}} = !{i32 1, !"MaxFunctionCount", i32 2}


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


Re: [PATCH] D15309: [CUDA] emit vtables only for classes with methods usable on this side of compilation.

2015-12-17 Thread Richard Smith via cfe-commits
On Wed, Dec 16, 2015 at 3:43 PM, Artem Belevich via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> @rsmith -- Richard, can you take a look at this change as well?


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


[PATCH] D15621: [Bugfix] Disallow declarations of named types in parameter lists of overloadable functions in C

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

This keeps the ICE in https://llvm.org/bugs/show_bug.cgi?id=25836 from 
happening. Long story short, the following C code will make clang overflow its 
stack:

```
int Foo(struct A*) __attribute__((overloadable)) {}
```

...Because the mangling of `struct A` (which is declared inside of `Foo`, and 
therefore nested in `Foo`) depends on the mangling of `Foo`, and the mangling 
of `Foo` depends on the mangling of `struct A`. It's a vicious cycle.

This patch fixes the ICE by simply not allowing the user to declare new named 
types in the parameter list of an overloadable function. See the bug for 

If no one wants to pick this up, I'll find a victim at some point. :)

http://reviews.llvm.org/D15621

Files:
  include/clang/AST/Decl.h
  include/clang/Basic/AttrDocs.td
  include/clang/Sema/Sema.h
  lib/AST/ASTDumper.cpp
  lib/AST/Decl.cpp
  lib/Sema/SemaDecl.cpp
  test/CodeGen/overloadable.c
  test/Sema/overloadable.c

Index: test/Sema/overloadable.c
===
--- test/Sema/overloadable.c
+++ test/Sema/overloadable.c
@@ -99,3 +99,8 @@
   unsigned char *c;
   multi_type(c);
 }
+
+void pr25836() {
+  void foo(struct Declaring *) __attribute__((overloadable)); // expected-error{{'Declaring' cannot be defined in a parameter type}}
+  void foo(struct Foo {int foo; int bar;} a) __attribute__((overloadable)); // expected-error{{'Foo' cannot be defined in a parameter type}}
+}
Index: test/CodeGen/overloadable.c
===
--- test/CodeGen/overloadable.c
+++ test/CodeGen/overloadable.c
@@ -16,6 +16,8 @@
 
 void __attribute__((overloadable)) f(void (*x)()) {}
 
+void anon_struct(struct {int foo; int bar;} *a) __attribute__((overloadable)) { }
+
 int main() {
   int iv = 17;
   float fv = 3.0f;
@@ -28,4 +30,5 @@
   dv = f(dv);
   cdv = f(cdv);
   vv = f(vv);
+  anon_struct((void*)0);
 }
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -8289,6 +8289,16 @@
   return NewFD;
 }
 
+/// We complain every time a user declares an enum/struct/union/class inside of
+/// a parameter list. In the case where the user is doing so in a function that
+/// can be overloaded, our complaint is an error; otherwise, it's a warning. We
+/// don't always know if a function is overloadable when we would normally
+/// complain, so we need to defer complaints where we're not sure until later.
+static bool
+needToDeferDeclInParamListComplaint(const clang::LangOptions &Opts) {
+  return !Opts.CPlusPlus && !Opts.ObjC1 && !Opts.ObjC2;
+}
+
 /// \brief Perform semantic checking of a new function declaration.
 ///
 /// Performs semantic analysis of the new function declaration
@@ -8394,6 +8404,22 @@
 }
   }
 
+  // If we have a decl in our param list, and the complaint about it was
+  // deferred, now is a good time to complain.
+  if (!NewFD->getDeclsInPrototypeScope().empty() &&
+  needToDeferDeclInParamListComplaint(Context.getLangOpts())) {
+if (NewFD->hasAttr()) {
+  for (TagDecl *Tag : NewFD->getDeclsInPrototypeScope())
+Diag(Tag->getLocStart(), diag::err_type_defined_in_param_type) << Tag;
+  NewFD->setInvalidDecl();
+  return Redeclaration;
+}
+
+for (TagDecl *Tag : NewFD->getDeclsInPrototypeScope())
+  Diag(Tag->getLocStart(), diag::warn_decl_in_param_list) <<
+Context.getTagDeclType(Tag);
+  }
+
   // C++11 [dcl.constexpr]p8:
   //   A constexpr specifier for a non-static member function that is not
   //   a constructor declares that member function to be const.
@@ -10901,12 +10927,7 @@
   // If we had any tags defined in the function prototype,
   // introduce them into the function scope.
   if (FnBodyScope) {
-for (ArrayRef::iterator
- I = FD->getDeclsInPrototypeScope().begin(),
- E = FD->getDeclsInPrototypeScope().end();
- I != E; ++I) {
-  NamedDecl *D = *I;
-
+for (TagDecl *D : FD->getDeclsInPrototypeScope()) {
   // Some of these decls (like enums) may have been pinned to the
   // translation unit for lack of a real context earlier. If so, remove
   // from the translation unit and reattach to the current context.
@@ -12581,18 +12602,20 @@
   // the list of decls to inject into the function definition scope.
   if ((Name || Kind == TTK_Enum) &&
   getNonFieldDeclScope(S)->isFunctionPrototypeScope()) {
-if (getLangOpts().CPlusPlus) {
-  // C++ [dcl.fct]p6:
-  //   Types shall not be defined in return or parameter types.
-  if (TUK == TUK_Definition && !IsTypeSpecifier) {
-Diag(Loc, diag::err_type_defined_in_param_type)
-<< Name;
-Invalid = true;
+DeclsInPrototypeScope.push_back(New);
+
+if (!needToDeferDeclInParamListComplaint(Context.getLangOpts())) {
+  if (getLan

Re: [PATCH] D15584: [CMake] Support a simple case for bootstrap builds to generate PGO data

2015-12-17 Thread Justin Bogner via cfe-commits
Chris Bieneman  writes:
> beanz created this revision.
> beanz added reviewers: bogner, silvas, chandlerc.
> beanz added a subscriber: cfe-commits.
>
> This patch adds support for the clang multi-stage bootstrapping to
> support PGO profdata generation, and can build a 2 or 3 stage
> compiler.
>
> With this patch applied you can configure your build directory with
> the following invocation of CMake:
>
> cmake -G  -C /cmake/caches/PGO-stage1.cmake
> 
>
> After configuration the following additional targets will be generated:
>
> stage2:
> Builds a stage1 x86 compiler, runtime, and required tools
> (llvm-config, llvm-profdata) then uses that compiler to build an
> instrumented stage2 compiler.
>
> stage2-generate-profdata:
> Depends on "stage2" and will use the stage2 compiler to generate
> profdata based on the training files in /utils/perf-training
>
> stage3:
> Depends on "stage2-generate-profdata" and will use the stage1 compiler
> with the stage2 profdata to build a PGO-optimized compiler.

Let's bikeshed a bit about terminology here.

This isn't really what "stage3" means in the typical sense - that term
is generally for a compiler built with a stage 2. What we're getting out
of this process is a PGO optimized compiler, but the result is actually
a stage 2 compiler. If we ever want to build another PGO'd compiler
using this one and do a binary compare, *that* would be stage 3.

So if we want to use the "stage" terminology we have a stage1, a
training-stage2 and a optimized-stage2, or something like that. Those
are a little long though, so maybe it would make sense to just call
these stage1, training, and stage2. WDYT?


On a related note, the way these cache files are happening there are
sort of two kinds of them. The stage1 files are more-or-less user facing
and use the later stage cache files in their builds. Maybe we should
drop the stage1 from the user facing files and name them so that they
imply what the total result of the build will be (ie, it's just PGO).

> stage3-check-llvm:
> Depends on stage3 and runs check-llvm using the stage3 compiler.
>
> stage3-check-clang:
> Depends on stage3 and runs check-clang using the stage3 compiler.
>
> stage3-check-all:
> Depends on stage3 and runs check-all using the stage3 compiler.
>
> stage3-test-suite:
> Depends on stage3 and runs the test-suite using the stage3 compiler
> (requires in-tree test-suite).
>
> http://reviews.llvm.org/D15584
>
> Files:
>   CMakeLists.txt
>   cmake/caches/PGO-stage1.cmake
>   cmake/caches/PGO-stage2.cmake
>   cmake/caches/PGO-stage3.cmake
>
> Index: cmake/caches/PGO-stage3.cmake
> ===
> --- /dev/null
> +++ cmake/caches/PGO-stage3.cmake
> @@ -0,0 +1,2 @@
> +set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
> +set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "")

Does this actually use the generated profdata file? I can't find a place
where it does that.

> Index: cmake/caches/PGO-stage2.cmake
> ===
> --- /dev/null
> +++ cmake/caches/PGO-stage2.cmake
> @@ -0,0 +1,9 @@
> +set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
> +set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
> +set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "")
> +
> +set(CLANG_BOOTSTRAP_TARGETS check-all check-llvm check-clang test-suite 
> CACHE STRING "")
> +
> +set(CLANG_BOOTSTRAP_CMAKE_ARGS
> +  -C ${CMAKE_CURRENT_LIST_DIR}/PGO-stage3.cmake
> +  CACHE STRING "")
> Index: cmake/caches/PGO-stage1.cmake
> ===
> --- /dev/null
> +++ cmake/caches/PGO-stage1.cmake
> @@ -0,0 +1,17 @@
> +set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
> +set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
> +set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "")
> +
> +set(LLVM_TARGETS_TO_BUILD X86 CACHE STRING "")
> +set(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED ON CACHE BOOL "")
> +set(CLANG_BOOTSTRAP_TARGETS
> +  stage3
> +  generate-profdata
> +  stage3-check-all
> +  stage3-check-llvm
> +  stage3-check-clang
> +  stage3-test-suite CACHE STRING "")
> +
> +set(CLANG_BOOTSTRAP_CMAKE_ARGS
> +  -C ${CMAKE_CURRENT_LIST_DIR}/PGO-stage2.cmake
> +  CACHE STRING "")
> Index: CMakeLists.txt
> ===
> --- CMakeLists.txt
> +++ CMakeLists.txt
> @@ -677,6 +677,25 @@
>  CLANG_REPOSITORY_STRING
>  CMAKE_MAKE_PROGRAM)
>  
> +  set(COMPILER_OPTIONS
> +-DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++
> +-DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
> +-DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang)
> +
> +  if(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED)
> +set(PGO_DEP llvm-profdata)
> +set(PGO_OPT -DLLVM_PROFDATA=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-profdata)
> +  endif()
> +
> +  if(LLVM_BUILD_INSTRUMENTED)
> +set(PGO_DEP generate-profdata)
> +set(PGO_OPT 
> -DLLVM_PROFDATA_FILE=${CMAKE_CURRENT_BINARY_DIR}/utils/perf-trai

Re: [PATCH] D15173: [Preprocessor] Fix assertion in AnnotatePreviousCachedTokens

2015-12-17 Thread Richard Smith via cfe-commits
rsmith added a subscriber: rsmith.
rsmith requested changes to this revision.
rsmith added a reviewer: rsmith.
rsmith added a comment.
This revision now requires changes to proceed.

I think that this will leave us with a broken token stream. In your example, 
the cached token stream starts as

`NSArray` `<` `id` `<` `PB` `>>` `*` [...]

... and we try to annotate the `id` with our `CachedLexPos` pointing at the 
`*` token. That leaves `CachedTokens` containing:

`NSArray` `<` `(type annotation)` `*` [...]

... which is wrong. We need to actually convert the `tok::greatergreater` in 
`CachedTokens` into a `tok::greater` and update its location and length in 
order for the cached token stream to be correctly updated. Otherwise if the 
parser backtracks it will see the wrong token stream.



Comment at: lib/Lex/PPCaching.cpp:102-104
@@ +101,5 @@
+#ifndef NDEBUG
+  Token CachedLastTok = CachedTokens[CachedLexPos - 1];
+  SourceLocation CachedLastTokLoc = CachedLastTok.getLastLoc();
+  SourceLocation TokAnnEndLoc = Tok.getAnnotationEndLoc();
+

Please add braces inside this #ifndef block so these variables don't 
accidentally leak into the rest of the function.


Comment at: lib/Lex/PPCaching.cpp:108
@@ +107,3 @@
+  // `Tok` length could be bigger than one (e.g. greatergreater '>>'), account
+  // for that cases before checking the assertion.
+  if (!CachedLastTok.isAnnotation()) {

that cases -> that case


Comment at: lib/Lex/PPCaching.cpp:109
@@ +108,3 @@
+  // for that cases before checking the assertion.
+  if (!CachedLastTok.isAnnotation()) {
+CachedLastTokLoc =

Please only do this extra work if `CachedLastTokLoc != TokAnnEndLoc`.


http://reviews.llvm.org/D15173



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


[PATCH] D15624: Add iOS/watchOS/tvOS support for ASan (clang part)

2015-12-17 Thread Anna Zaks via cfe-commits
zaks.anna created this revision.
zaks.anna added reviewers: kcc, cfe-commits.

Change the clang driver to accept ASan on iOS/watchOS/tvOS. 

This change along with the corresponding changes in llvm and compiler-rt 
complete ASan support for iOS/watchOS/tvOS.

http://reviews.llvm.org/D15624

Files:
  lib/Driver/ToolChains.cpp
  test/Driver/fsanitize.c

Index: test/Driver/fsanitize.c
===
--- test/Driver/fsanitize.c
+++ test/Driver/fsanitize.c
@@ -230,7 +230,7 @@
 // CHECK-VPTR-DARWIN-NEW: -fsanitize=alignment,vptr
 
 // RUN: %clang -target armv7-apple-ios7 -miphoneos-version-min=7.0 
-fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-IOS
-// CHECK-ASAN-IOS: unsupported option '-fsanitize=address' for target 
'arm-apple-ios7'
+// CHECK-ASAN-IOS: -fsanitize=address
 
 // RUN: %clang -target i386-pc-openbsd -fsanitize=address %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-ASAN-OPENBSD
 // CHECK-ASAN-OPENBSD: unsupported option '-fsanitize=address' for target 
'i386-pc-openbsd'
Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -363,9 +363,24 @@
 // Sanitizer runtime libraries requires C++.
 AddCXXStdlibLibArgs(Args, CmdArgs);
   }
-  // ASan is not supported on watchOS.
-  assert(isTargetMacOS() || isTargetIOSSimulator());
-  StringRef OS = isTargetMacOS() ? "osx" : "iossim";
+
+  StringRef OS = "";
+  if (isTargetMacOS())
+OS = "osx";
+  if (isTargetWatchOSSimulator())
+OS = "watchossim";
+  if (isTargetWatchOS())
+OS = "watchos";
+  if (isTargetIOSSimulator())
+OS = "iossim";
+  if (isTargetIPhoneOS())
+OS = "ios";
+  if (isTargetTvOSSimulator())
+OS = "tvossim";
+  if (isTargetTvOS())
+OS = "tvos";
+  assert(!OS.empty());
+
   AddLinkRuntimeLib(
   Args, CmdArgs,
   (Twine("libclang_rt.") + Sanitizer + "_" + OS + "_dynamic.dylib").str(),
@@ -1213,8 +1228,7 @@
 
 SanitizerMask Darwin::getSupportedSanitizers() const {
   SanitizerMask Res = ToolChain::getSupportedSanitizers();
-  if (isTargetMacOS() || isTargetIOSSimulator())
-Res |= SanitizerKind::Address;
+  Res |= SanitizerKind::Address;
   if (isTargetMacOS()) {
 if (!isMacosxVersionLT(10, 9))
   Res |= SanitizerKind::Vptr;


Index: test/Driver/fsanitize.c
===
--- test/Driver/fsanitize.c
+++ test/Driver/fsanitize.c
@@ -230,7 +230,7 @@
 // CHECK-VPTR-DARWIN-NEW: -fsanitize=alignment,vptr
 
 // RUN: %clang -target armv7-apple-ios7 -miphoneos-version-min=7.0 -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-IOS
-// CHECK-ASAN-IOS: unsupported option '-fsanitize=address' for target 'arm-apple-ios7'
+// CHECK-ASAN-IOS: -fsanitize=address
 
 // RUN: %clang -target i386-pc-openbsd -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-OPENBSD
 // CHECK-ASAN-OPENBSD: unsupported option '-fsanitize=address' for target 'i386-pc-openbsd'
Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -363,9 +363,24 @@
 // Sanitizer runtime libraries requires C++.
 AddCXXStdlibLibArgs(Args, CmdArgs);
   }
-  // ASan is not supported on watchOS.
-  assert(isTargetMacOS() || isTargetIOSSimulator());
-  StringRef OS = isTargetMacOS() ? "osx" : "iossim";
+
+  StringRef OS = "";
+  if (isTargetMacOS())
+OS = "osx";
+  if (isTargetWatchOSSimulator())
+OS = "watchossim";
+  if (isTargetWatchOS())
+OS = "watchos";
+  if (isTargetIOSSimulator())
+OS = "iossim";
+  if (isTargetIPhoneOS())
+OS = "ios";
+  if (isTargetTvOSSimulator())
+OS = "tvossim";
+  if (isTargetTvOS())
+OS = "tvos";
+  assert(!OS.empty());
+
   AddLinkRuntimeLib(
   Args, CmdArgs,
   (Twine("libclang_rt.") + Sanitizer + "_" + OS + "_dynamic.dylib").str(),
@@ -1213,8 +1228,7 @@
 
 SanitizerMask Darwin::getSupportedSanitizers() const {
   SanitizerMask Res = ToolChain::getSupportedSanitizers();
-  if (isTargetMacOS() || isTargetIOSSimulator())
-Res |= SanitizerKind::Address;
+  Res |= SanitizerKind::Address;
   if (isTargetMacOS()) {
 if (!isMacosxVersionLT(10, 9))
   Res |= SanitizerKind::Vptr;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15624: Add iOS/watchOS/tvOS support for ASan (clang part)

2015-12-17 Thread Kostya Serebryany via cfe-commits
kcc accepted this revision.
kcc added a comment.
This revision is now accepted and ready to land.

LGTM


http://reviews.llvm.org/D15624



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


Re: [PATCH] D15624: Add iOS/watchOS/tvOS support for ASan (clang part)

2015-12-17 Thread Alexey Samsonov via cfe-commits
samsonov added a subscriber: samsonov.


Comment at: lib/Driver/ToolChains.cpp:368
@@ +367,3 @@
+  StringRef OS = "";
+  if (isTargetMacOS())
+OS = "osx";

Wait, this looks horrible. Can we teach toolchain to give us OS name?


http://reviews.llvm.org/D15624



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


Re: [PATCH] D15584: [CMake] Support a simple case for bootstrap builds to generate PGO data

2015-12-17 Thread Chris Bieneman via cfe-commits

> On Dec 17, 2015, at 11:37 AM, Justin Bogner  wrote:
> 
> Chris Bieneman mailto:be...@apple.com>> writes:
>> beanz created this revision.
>> beanz added reviewers: bogner, silvas, chandlerc.
>> beanz added a subscriber: cfe-commits.
>> 
>> This patch adds support for the clang multi-stage bootstrapping to
>> support PGO profdata generation, and can build a 2 or 3 stage
>> compiler.
>> 
>> With this patch applied you can configure your build directory with
>> the following invocation of CMake:
>> 
>> cmake -G  -C /cmake/caches/PGO-stage1.cmake
>> 
>> 
>> After configuration the following additional targets will be generated:
>> 
>> stage2:
>> Builds a stage1 x86 compiler, runtime, and required tools
>> (llvm-config, llvm-profdata) then uses that compiler to build an
>> instrumented stage2 compiler.
>> 
>> stage2-generate-profdata:
>> Depends on "stage2" and will use the stage2 compiler to generate
>> profdata based on the training files in /utils/perf-training
>> 
>> stage3:
>> Depends on "stage2-generate-profdata" and will use the stage1 compiler
>> with the stage2 profdata to build a PGO-optimized compiler.
> 
> Let's bikeshed a bit about terminology here.
> 
> This isn't really what "stage3" means in the typical sense - that term
> is generally for a compiler built with a stage 2. What we're getting out
> of this process is a PGO optimized compiler, but the result is actually
> a stage 2 compiler. If we ever want to build another PGO'd compiler
> using this one and do a binary compare, *that* would be stage 3.
> 
> So if we want to use the "stage" terminology we have a stage1, a
> training-stage2 and a optimized-stage2, or something like that. Those
> are a little long though, so maybe it would make sense to just call
> these stage1, training, and stage2. WDYT?

How about stage2-instrumented and just stage2? Prefacing the instrumented with 
“stage2” lets us know what stage we’re on. That way it will continue to work if 
someone did either a stage1 or stage3 instrumented build.

> 
> 
> On a related note, the way these cache files are happening there are
> sort of two kinds of them. The stage1 files are more-or-less user facing
> and use the later stage cache files in their builds. Maybe we should
> drop the stage1 from the user facing files and name them so that they
> imply what the total result of the build will be (ie, it's just PGO).

I’ll make that change.

I’m going to send out updated patches shortly caveat that I am sending them 
“untested”. The CMake configuration for stage1 works, and I expect it to fully 
work, but the many-stage builds take a long time.

> 
>> stage3-check-llvm:
>> Depends on stage3 and runs check-llvm using the stage3 compiler.
>> 
>> stage3-check-clang:
>> Depends on stage3 and runs check-clang using the stage3 compiler.
>> 
>> stage3-check-all:
>> Depends on stage3 and runs check-all using the stage3 compiler.
>> 
>> stage3-test-suite:
>> Depends on stage3 and runs the test-suite using the stage3 compiler
>> (requires in-tree test-suite).
>> 
>> http://reviews.llvm.org/D15584
>> 
>> Files:
>>  CMakeLists.txt
>>  cmake/caches/PGO-stage1.cmake
>>  cmake/caches/PGO-stage2.cmake
>>  cmake/caches/PGO-stage3.cmake
>> 
>> Index: cmake/caches/PGO-stage3.cmake
>> ===
>> --- /dev/null
>> +++ cmake/caches/PGO-stage3.cmake
>> @@ -0,0 +1,2 @@
>> +set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
>> +set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "")
> 
> Does this actually use the generated profdata file? I can't find a place
> where it does that.

This is actually setup in this diff in clang/CMakelists.txt. Look for PGO_OPT.

> 
>> Index: cmake/caches/PGO-stage2.cmake
>> ===
>> --- /dev/null
>> +++ cmake/caches/PGO-stage2.cmake
>> @@ -0,0 +1,9 @@
>> +set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
>> +set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
>> +set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "")
>> +
>> +set(CLANG_BOOTSTRAP_TARGETS check-all check-llvm check-clang test-suite 
>> CACHE STRING "")
>> +
>> +set(CLANG_BOOTSTRAP_CMAKE_ARGS
>> +  -C ${CMAKE_CURRENT_LIST_DIR}/PGO-stage3.cmake
>> +  CACHE STRING "")
>> Index: cmake/caches/PGO-stage1.cmake
>> ===
>> --- /dev/null
>> +++ cmake/caches/PGO-stage1.cmake
>> @@ -0,0 +1,17 @@
>> +set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
>> +set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
>> +set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "")
>> +
>> +set(LLVM_TARGETS_TO_BUILD X86 CACHE STRING "")
>> +set(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED ON CACHE BOOL "")
>> +set(CLANG_BOOTSTRAP_TARGETS
>> +  stage3
>> +  generate-profdata
>> +  stage3-check-all
>> +  stage3-check-llvm
>> +  stage3-check-clang
>> +  stage3-test-suite CACHE STRING "")
>> +
>> +set(CLANG_BOOTSTRAP_CMAKE_ARGS
>> +  -C ${CMAKE_CURRENT_LIST_DIR}/PGO-stage2.cmake
>> +  CACHE STRING "")
>> I

Re: [PATCH] D15584: [CMake] Support a simple case for bootstrap builds to generate PGO data

2015-12-17 Thread Chris Bieneman via cfe-commits
beanz updated this revision to Diff 43177.
beanz added a comment.

Updates based on bogner's feedback.

- Target stages are now stage2-instrumented and stage2 instead of stage2 and 
stage3.
- Renamed PGO-stage1.cmake to PGO.cmake


http://reviews.llvm.org/D15584

Files:
  CMakeLists.txt
  cmake/caches/PGO-stage2.cmake
  cmake/caches/PGO-stage3.cmake
  cmake/caches/PGO.cmake

Index: cmake/caches/PGO.cmake
===
--- /dev/null
+++ cmake/caches/PGO.cmake
@@ -0,0 +1,17 @@
+set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
+set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "")
+
+set(LLVM_TARGETS_TO_BUILD X86 CACHE STRING "")
+set(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED ON CACHE BOOL "")
+set(CLANG_BOOTSTRAP_TARGETS
+  generate-profdata
+  stage2
+  stage2-check-all
+  stage2-check-llvm
+  stage2-check-clang
+  stage2-test-suite CACHE STRING "")
+
+set(CLANG_BOOTSTRAP_CMAKE_ARGS
+  -C ${CMAKE_CURRENT_LIST_DIR}/PGO-stage2.cmake
+  CACHE STRING "")
Index: cmake/caches/PGO-stage3.cmake
===
--- /dev/null
+++ cmake/caches/PGO-stage3.cmake
@@ -0,0 +1,2 @@
+set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
+set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "")
Index: cmake/caches/PGO-stage2.cmake
===
--- /dev/null
+++ cmake/caches/PGO-stage2.cmake
@@ -0,0 +1,9 @@
+set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
+set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "")
+
+set(CLANG_BOOTSTRAP_TARGETS check-all check-llvm check-clang test-suite CACHE STRING "")
+
+set(CLANG_BOOTSTRAP_CMAKE_ARGS
+  -C ${CMAKE_CURRENT_LIST_DIR}/PGO-stage3.cmake
+  CACHE STRING "")
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -631,11 +631,19 @@
 
   string(REGEX MATCH "stage([0-9]*)" MATCHED_STAGE "${CLANG_STAGE}")
   if(MATCHED_STAGE)
-math(EXPR STAGE_NUM "${MATCHED_STAGE} + 1")
-set(NEXT_CLANG_STAGE stage${STAGE_NUM})
+if(NOT LLVM_BUILD_INSTRUMENTED)
+  math(EXPR STAGE_NUM "${MATCHED_STAGE} + 1")
+  set(NEXT_CLANG_STAGE stage${STAGE_NUM})
+else()
+  set(NEXT_CLANG_STAGE stage${MATCHED_STAGE})
+endif()
   else()
 set(NEXT_CLANG_STAGE bootstrap)
   endif()
+
+  if(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED)
+set(NEXT_CLANG_STAGE ${NEXT_CLANG_STAGE}-instrumented)
+  endif()
   message(STATUS "Setting next clang stage to: ${NEXT_CLANG_STAGE}")
   
   
@@ -677,6 +685,25 @@
 CLANG_REPOSITORY_STRING
 CMAKE_MAKE_PROGRAM)
 
+  set(COMPILER_OPTIONS
+-DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++
+-DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
+-DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang)
+
+  if(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED)
+set(PGO_DEP llvm-profdata)
+set(PGO_OPT -DLLVM_PROFDATA=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-profdata)
+  endif()
+
+  if(LLVM_BUILD_INSTRUMENTED)
+set(PGO_DEP generate-profdata)
+set(PGO_OPT -DLLVM_PROFDATA_FILE=${CMAKE_CURRENT_BINARY_DIR}/utils/perf-training/clang.profdata)
+set(COMPILER_OPTIONS
+  -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
+  -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
+  -DCMAKE_ASM_COMPILER=${CMAKE_ASM_COMPILER})
+  endif()
+  
   if(TARGET compiler-rt)
 set(RUNTIME_DEP compiler-rt)
   endif()
@@ -703,7 +730,7 @@
   endforeach()
 
   ExternalProject_Add(${NEXT_CLANG_STAGE}
-DEPENDS clang ${LTO_DEP} ${RUNTIME_DEP}
+DEPENDS clang ${LTO_DEP} ${RUNTIME_DEP} ${PGO_DEP}
 PREFIX ${NEXT_CLANG_STAGE}
 SOURCE_DIR ${CMAKE_SOURCE_DIR}
 STAMP_DIR ${STAMP_DIR}
@@ -715,11 +742,9 @@
 -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
 ${CLANG_BOOTSTRAP_CMAKE_ARGS}
 ${PASSTHROUGH_VARIABLES}
--DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++
--DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
--DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
--DCLANG_STAGE=${NEXT_CLANG_STAGE}
-${LTO_LIBRARY} ${LTO_AR} ${LTO_RANLIB} ${verbose}
+ -DCLANG_STAGE=${NEXT_CLANG_STAGE}
+${COMPILER_OPTIONS}
+${LTO_LIBRARY} ${LTO_AR} ${LTO_RANLIB} ${verbose} ${PGO_OPT}
 INSTALL_COMMAND ""
 STEP_TARGETS configure build
 ${cmake_3_4_USES_TERMINAL_OPTIONS}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [libcxx] [PATCH] unordered_map: Avoid unnecessary mallocs when no insert occurs

2015-12-17 Thread Duncan P. N. Exon Smith via cfe-commits

> On 2015-Dec-16, at 14:42, Duncan P. N. Exon Smith  
> wrote:
> 
> This is a follow-up to r239666: "Fix PR12999 - unordered_set::insert
> calls operator new when no insert occurs".  That fix didn't apply to
> `unordered_map` because unordered_map::value_type gets packed inside:
> --
> union __value_type {
>  pair __nc;   // Only C++11 or higher.
>  pair __cc; // Always.
>  // Constructors...
> };
> --
> and the underlying __hash_table only knows about __value_type.

Sorry for the quick ping, but I realized this morning that my approach
was still leaving mallocs on the table.

I've attached a new patch that handles more cases.

This patch should avoid unnecessary mallocs whenever the caller passes
in a pair such that T is trivially convertible to key_type.

Since __hash_table's value_type is really *never* a pair (for
unordered_map, it's a union of two pairs) the static dispatch is all in
unordered_map.  It's doing this:
  - If the argument isn't a pair<>, alloc.
  - If argument.first can be referenced as const key_type&, don't alloc.
  - If argument.first can be trivially converted to key_type, don't
alloc.
  - Else alloc.

In the pre-C++11 world the caller has already converted to
unordered_map::value_type.  We can always avoid the alloc.

To support all of this:
  - In C++03, __unordered_map_equal and __unordered_map_hasher need to
handle unordered_map::value_type.
  - In C++03, __hash_table::__insert_unique_value() now takes its
argument by template.
  - In C++11, __hash_table::__insert_unique_value() is now a one-liner
that forwards to __insert_unique_key_value() for the real work.
  - The versions of __hash_table::__construct_node() that take a
pre-computed hash have been renamed to __construct_node_hash(), and
these versions use perfect forwarding.

Most of the following still apply:

> This is one of my first patches for libc++, and I'm not sure of a few
> things:
>  - Did I successfully match the coding style?  (I'm kind of lost
>without clang-format TBH.)
>  - Should I separate the change to __construct_node_hash() into a
>separate prep commit?  (I would if this were LLVM, but I'm not sure
>if the common practice is different for libc++.)
>  - Most of the overloads I added to __unordered_map_hasher and
>__unordered_map_equal aren't actually used by
>__hash_table::__insert_unique_value().  Should I omit the unused
>ones?  (Again, for LLVM I would have omitted them.)

(For the updated patch, I went with the LLVM approach of only adding
the used API.  It seems more appropriate in this case.)

> After this I'll fix the same performance issue in std::map (and I
> assume std::set?).



0001-unordered_map-Avoid-unnecessary-mallocs-when-no-i-v2.patch
Description: Binary data
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r255929 - Fix r255875, use '<' instead of '==' for 'operator<'

2015-12-17 Thread Richard Trieu via cfe-commits
Author: rtrieu
Date: Thu Dec 17 15:56:22 2015
New Revision: 255929

URL: http://llvm.org/viewvc/llvm-project?rev=255929&view=rev
Log:
Fix r255875, use '<' instead of '==' for 'operator<'

Aaron Ballman pointed out a typo from the copy and paste in r255875.  This will
preserve the strict weak ordering when comparing DynTypedNode.

Modified:
cfe/trunk/include/clang/AST/ASTTypeTraits.h

Modified: cfe/trunk/include/clang/AST/ASTTypeTraits.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTTypeTraits.h?rev=255929&r1=255928&r2=255929&view=diff
==
--- cfe/trunk/include/clang/AST/ASTTypeTraits.h (original)
+++ cfe/trunk/include/clang/AST/ASTTypeTraits.h Thu Dec 17 15:56:22 2015
@@ -272,7 +272,7 @@ public:
   return NodeKind < Other.NodeKind;
 
 if (ASTNodeKind::getFromNodeKind().isSame(NodeKind))
-  return getUnchecked().getAsOpaquePtr() ==
+  return getUnchecked().getAsOpaquePtr() <
  Other.getUnchecked().getAsOpaquePtr();
 
 if (ASTNodeKind::getFromNodeKind().isSame(NodeKind)) {


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


Re: [PATCH] D15314: Fix a bug in unavailable checking

2015-12-17 Thread Manman Ren via cfe-commits
manmanren added a comment.

Ping

Appreciate comments on the general direction.

Cheers,
Manman


http://reviews.llvm.org/D15314



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


Re: r255875 - Add QualType case to operator< for DynTypedNode.

2015-12-17 Thread Richard Trieu via cfe-commits
On Thu, Dec 17, 2015 at 5:47 AM, Aaron Ballman 
wrote:

> On Wed, Dec 16, 2015 at 11:46 PM, Richard Trieu via cfe-commits
>  wrote:
> > Author: rtrieu
> > Date: Wed Dec 16 22:46:48 2015
> > New Revision: 255875
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=255875&view=rev
> > Log:
> > Add QualType case to operator< for DynTypedNode.
> >
> > This allows sorting DynTypedNode's which are QualType's since QualType
> does
> > not have memoization.
> >
> > Modified:
> > cfe/trunk/include/clang/AST/ASTTypeTraits.h
> >
> > Modified: cfe/trunk/include/clang/AST/ASTTypeTraits.h
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTTypeTraits.h?rev=255875&r1=255874&r2=255875&view=diff
> >
> ==
> > --- cfe/trunk/include/clang/AST/ASTTypeTraits.h (original)
> > +++ cfe/trunk/include/clang/AST/ASTTypeTraits.h Wed Dec 16 22:46:48 2015
> > @@ -271,6 +271,10 @@ public:
> >  if (!NodeKind.isSame(Other.NodeKind))
> >return NodeKind < Other.NodeKind;
> >
> > +if (ASTNodeKind::getFromNodeKind().isSame(NodeKind))
> > +  return getUnchecked().getAsOpaquePtr() ==
> > + Other.getUnchecked().getAsOpaquePtr();
> > +
>
> This only tests for equality, not comparison, which means operator< no
> longer has a strict weak ordering. Also, there are no tests for this
> change.
>
> ~Aaron
>
> r255929 changes the operator to '<', which should fix this.  I don't have
a test case since the assertion was triggered in a recently checked in
Clang Tidy test that only fails in a special configuration that I couldn't
reproduce in a clean change.

>  if (ASTNodeKind::getFromNodeKind().isSame(NodeKind)) {
> >auto TLA = getUnchecked();
> >auto TLB = Other.getUnchecked();
> >
> >
> > ___
> > 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: r255875 - Add QualType case to operator< for DynTypedNode.

2015-12-17 Thread Aaron Ballman via cfe-commits
On Thu, Dec 17, 2015 at 5:02 PM, Richard Trieu  wrote:
> On Thu, Dec 17, 2015 at 5:47 AM, Aaron Ballman 
> wrote:
>>
>> On Wed, Dec 16, 2015 at 11:46 PM, Richard Trieu via cfe-commits
>>  wrote:
>> > Author: rtrieu
>> > Date: Wed Dec 16 22:46:48 2015
>> > New Revision: 255875
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=255875&view=rev
>> > Log:
>> > Add QualType case to operator< for DynTypedNode.
>> >
>> > This allows sorting DynTypedNode's which are QualType's since QualType
>> > does
>> > not have memoization.
>> >
>> > Modified:
>> > cfe/trunk/include/clang/AST/ASTTypeTraits.h
>> >
>> > Modified: cfe/trunk/include/clang/AST/ASTTypeTraits.h
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTTypeTraits.h?rev=255875&r1=255874&r2=255875&view=diff
>> >
>> > ==
>> > --- cfe/trunk/include/clang/AST/ASTTypeTraits.h (original)
>> > +++ cfe/trunk/include/clang/AST/ASTTypeTraits.h Wed Dec 16 22:46:48 2015
>> > @@ -271,6 +271,10 @@ public:
>> >  if (!NodeKind.isSame(Other.NodeKind))
>> >return NodeKind < Other.NodeKind;
>> >
>> > +if (ASTNodeKind::getFromNodeKind().isSame(NodeKind))
>> > +  return getUnchecked().getAsOpaquePtr() ==
>> > + Other.getUnchecked().getAsOpaquePtr();
>> > +
>>
>> This only tests for equality, not comparison, which means operator< no
>> longer has a strict weak ordering. Also, there are no tests for this
>> change.
>>
>> ~Aaron
>>
> r255929 changes the operator to '<', which should fix this.  I don't have a
> test case since the assertion was triggered in a recently checked in Clang
> Tidy test that only fails in a special configuration that I couldn't
> reproduce in a clean change.

Thank you, that commit looks much better! Couldn't we add a test in
ASTTypeTraitsTests.cpp as a unit test, or was the assert specific to
that particular special configuration?

~Aaron

>
>> >  if (ASTNodeKind::getFromNodeKind().isSame(NodeKind)) {
>> >auto TLA = getUnchecked();
>> >auto TLB = Other.getUnchecked();
>> >
>> >
>> > ___
>> > 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] D15584: [CMake] Support a simple case for bootstrap builds to generate PGO data

2015-12-17 Thread Chris Bieneman via cfe-commits
beanz updated this revision to Diff 43183.
beanz added a comment.

Updating to fix a bug in my CMake regex handling that caused the targets to not 
be mapped up correctly.


http://reviews.llvm.org/D15584

Files:
  CMakeLists.txt
  cmake/caches/PGO-stage2.cmake
  cmake/caches/PGO-stage3.cmake
  cmake/caches/PGO.cmake

Index: cmake/caches/PGO.cmake
===
--- /dev/null
+++ cmake/caches/PGO.cmake
@@ -0,0 +1,17 @@
+set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
+set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "")
+
+set(LLVM_TARGETS_TO_BUILD X86 CACHE STRING "")
+set(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED ON CACHE BOOL "")
+set(CLANG_BOOTSTRAP_TARGETS
+  generate-profdata
+  stage2
+  stage2-check-all
+  stage2-check-llvm
+  stage2-check-clang
+  stage2-test-suite CACHE STRING "")
+
+set(CLANG_BOOTSTRAP_CMAKE_ARGS
+  -C ${CMAKE_CURRENT_LIST_DIR}/PGO-stage2.cmake
+  CACHE STRING "")
Index: cmake/caches/PGO-stage3.cmake
===
--- /dev/null
+++ cmake/caches/PGO-stage3.cmake
@@ -0,0 +1,2 @@
+set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
+set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "")
Index: cmake/caches/PGO-stage2.cmake
===
--- /dev/null
+++ cmake/caches/PGO-stage2.cmake
@@ -0,0 +1,9 @@
+set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
+set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "")
+
+set(CLANG_BOOTSTRAP_TARGETS check-all check-llvm check-clang test-suite CACHE STRING "")
+
+set(CLANG_BOOTSTRAP_CMAKE_ARGS
+  -C ${CMAKE_CURRENT_LIST_DIR}/PGO-stage3.cmake
+  CACHE STRING "")
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -631,11 +631,19 @@
 
   string(REGEX MATCH "stage([0-9]*)" MATCHED_STAGE "${CLANG_STAGE}")
   if(MATCHED_STAGE)
-math(EXPR STAGE_NUM "${MATCHED_STAGE} + 1")
-set(NEXT_CLANG_STAGE stage${STAGE_NUM})
+if(NOT LLVM_BUILD_INSTRUMENTED)
+  math(EXPR STAGE_NUM "${CMAKE_MATCH_1} + 1")
+  set(NEXT_CLANG_STAGE stage${STAGE_NUM})
+else()
+  set(NEXT_CLANG_STAGE stage${CMAKE_MATCH_1})
+endif()
   else()
 set(NEXT_CLANG_STAGE bootstrap)
   endif()
+
+  if(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED)
+set(NEXT_CLANG_STAGE ${NEXT_CLANG_STAGE}-instrumented)
+  endif()
   message(STATUS "Setting next clang stage to: ${NEXT_CLANG_STAGE}")
   
   
@@ -677,6 +685,25 @@
 CLANG_REPOSITORY_STRING
 CMAKE_MAKE_PROGRAM)
 
+  set(COMPILER_OPTIONS
+-DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++
+-DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
+-DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang)
+
+  if(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED)
+set(PGO_DEP llvm-profdata)
+set(PGO_OPT -DLLVM_PROFDATA=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-profdata)
+  endif()
+
+  if(LLVM_BUILD_INSTRUMENTED)
+set(PGO_DEP generate-profdata)
+set(PGO_OPT -DLLVM_PROFDATA_FILE=${CMAKE_CURRENT_BINARY_DIR}/utils/perf-training/clang.profdata)
+set(COMPILER_OPTIONS
+  -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
+  -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
+  -DCMAKE_ASM_COMPILER=${CMAKE_ASM_COMPILER})
+  endif()
+  
   if(TARGET compiler-rt)
 set(RUNTIME_DEP compiler-rt)
   endif()
@@ -703,7 +730,7 @@
   endforeach()
 
   ExternalProject_Add(${NEXT_CLANG_STAGE}
-DEPENDS clang ${LTO_DEP} ${RUNTIME_DEP}
+DEPENDS clang ${LTO_DEP} ${RUNTIME_DEP} ${PGO_DEP}
 PREFIX ${NEXT_CLANG_STAGE}
 SOURCE_DIR ${CMAKE_SOURCE_DIR}
 STAMP_DIR ${STAMP_DIR}
@@ -715,11 +742,9 @@
 -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
 ${CLANG_BOOTSTRAP_CMAKE_ARGS}
 ${PASSTHROUGH_VARIABLES}
--DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++
--DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
--DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
--DCLANG_STAGE=${NEXT_CLANG_STAGE}
-${LTO_LIBRARY} ${LTO_AR} ${LTO_RANLIB} ${verbose}
+ -DCLANG_STAGE=${NEXT_CLANG_STAGE}
+${COMPILER_OPTIONS}
+${LTO_LIBRARY} ${LTO_AR} ${LTO_RANLIB} ${verbose} ${PGO_OPT}
 INSTALL_COMMAND ""
 STEP_TARGETS configure build
 ${cmake_3_4_USES_TERMINAL_OPTIONS}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r255933 - [CUDA] runtime wrapper header tweaks

2015-12-17 Thread Artem Belevich via cfe-commits
Author: tra
Date: Thu Dec 17 16:25:22 2015
New Revision: 255933

URL: http://llvm.org/viewvc/llvm-project?rev=255933&view=rev
Log:
[CUDA] runtime wrapper header tweaks

* Pull in host-only implementations of few CUDA-specific math functions.
* #nclude  early to prevent its inclusion from CUDA headers after
  they've messed with __THROW macro.

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

Modified: cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h?rev=255933&r1=255932&r2=255933&view=diff
==
--- cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h (original)
+++ cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h Thu Dec 17 16:25:22 
2015
@@ -45,6 +45,7 @@
 // Include some standard headers to avoid CUDA headers including them
 // while some required macros (like __THROW) are in a weird state.
 #include 
+#include 
 
 // Preserve common macros that will be changed below by us or by CUDA
 // headers.
@@ -117,7 +118,7 @@
 #undef __cxa_vec_delete3
 #undef __cxa_pure_virtual
 
-// We need decls for functions in CUDA's libdevice woth __device__
+// We need decls for functions in CUDA's libdevice with __device__
 // attribute only. Alas they come either as __host__ __device__ or
 // with no attributes at all. To work around that, define __CUDA_RTC__
 // which produces HD variant and undef __host__ which gives us desided
@@ -143,6 +144,26 @@
 #include "math_functions_dbl_ptx3.hpp"
 #pragma pop_macro("__forceinline__")
 
+// Pull in host-only functions that are only available when neither
+// __CUDACC__ nor __CUDABE__ are defined.
+#undef __MATH_FUNCTIONS_HPP__
+#undef __CUDABE__
+#include "math_functions.hpp"
+// Alas, additional overloads for these functions are hard to get to.
+// Considering that we only need these overloads for a few functions,
+// we can provide them here.
+static inline float rsqrt(float a) { return rsqrtf(a); }
+static inline float rcbrt(float a) { return rcbrtf(a); }
+static inline float sinpi(float a) { return sinpif(a); }
+static inline float cospi(float a) { return cospif(a); }
+static inline void sincospi(float a, float *b, float *c) {
+  return sincospi(a, b, c);
+}
+static inline float erfcinv(float a) { return erfcinvf(a); }
+static inline float normcdfinv(float a) { return normcdfinvf(a); }
+static inline float normcdf(float a) { return normcdff(a); }
+static inline float erfcx(float a) { return erfcxf(a); }
+
 // For some reason single-argument variant is not always declared by
 // CUDA headers. Alas, device_functions.hpp included below needs it.
 static inline __device__ void __brkpt(int c) { __brkpt(); }
@@ -182,9 +203,9 @@ static inline __device__ void __brkpt(in
 #define __NVCC__
 
 #if defined(__CUDA_ARCH__)
-// We need to emit IR declaration for non-existing __nvvm_reflect to
+// We need to emit IR declaration for non-existing __nvvm_reflect() to
 // let backend know that it should be treated as const nothrow
-// function which is implicitly assumed by NVVMReflect pass.
+// function which is what NVVMReflect pass expects to see.
 extern "C" __device__ __attribute__((const)) int __nvvm_reflect(const void *);
 static __device__ __attribute__((used)) int __nvvm_reflect_anchor() {
   return __nvvm_reflect("NONE");


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


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

2015-12-17 Thread Eric Christopher via cfe-commits
echristo accepted this revision.
echristo added a comment.
This revision is now accepted and ready to land.

This works for me as a workaround, a comment about what's going on here would 
probably be good.

-eric


http://reviews.llvm.org/D15613



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


Re: [PATCH] D15584: [CMake] Support a simple case for bootstrap builds to generate PGO data

2015-12-17 Thread Chris Bieneman via cfe-commits
beanz updated this revision to Diff 43192.
beanz added a comment.

One more dependency hookup fix, this one makes it so that stage2 doesn't depend 
on the stage2-instrumented compiler-rt, and avoids building it when you invoke 
the 'stage2' target.


http://reviews.llvm.org/D15584

Files:
  CMakeLists.txt
  cmake/caches/PGO-stage2.cmake
  cmake/caches/PGO-stage3.cmake
  cmake/caches/PGO.cmake

Index: cmake/caches/PGO.cmake
===
--- /dev/null
+++ cmake/caches/PGO.cmake
@@ -0,0 +1,17 @@
+set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
+set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "")
+
+set(LLVM_TARGETS_TO_BUILD X86 CACHE STRING "")
+set(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED ON CACHE BOOL "")
+set(CLANG_BOOTSTRAP_TARGETS
+  generate-profdata
+  stage2
+  stage2-check-all
+  stage2-check-llvm
+  stage2-check-clang
+  stage2-test-suite CACHE STRING "")
+
+set(CLANG_BOOTSTRAP_CMAKE_ARGS
+  -C ${CMAKE_CURRENT_LIST_DIR}/PGO-stage2.cmake
+  CACHE STRING "")
Index: cmake/caches/PGO-stage3.cmake
===
--- /dev/null
+++ cmake/caches/PGO-stage3.cmake
@@ -0,0 +1,2 @@
+set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
+set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "")
Index: cmake/caches/PGO-stage2.cmake
===
--- /dev/null
+++ cmake/caches/PGO-stage2.cmake
@@ -0,0 +1,9 @@
+set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
+set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "")
+
+set(CLANG_BOOTSTRAP_TARGETS check-all check-llvm check-clang test-suite CACHE STRING "")
+
+set(CLANG_BOOTSTRAP_CMAKE_ARGS
+  -C ${CMAKE_CURRENT_LIST_DIR}/PGO-stage3.cmake
+  CACHE STRING "")
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -631,11 +631,19 @@
 
   string(REGEX MATCH "stage([0-9]*)" MATCHED_STAGE "${CLANG_STAGE}")
   if(MATCHED_STAGE)
-math(EXPR STAGE_NUM "${MATCHED_STAGE} + 1")
-set(NEXT_CLANG_STAGE stage${STAGE_NUM})
+if(NOT LLVM_BUILD_INSTRUMENTED)
+  math(EXPR STAGE_NUM "${CMAKE_MATCH_1} + 1")
+  set(NEXT_CLANG_STAGE stage${STAGE_NUM})
+else()
+  set(NEXT_CLANG_STAGE stage${CMAKE_MATCH_1})
+endif()
   else()
 set(NEXT_CLANG_STAGE bootstrap)
   endif()
+
+  if(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED)
+set(NEXT_CLANG_STAGE ${NEXT_CLANG_STAGE}-instrumented)
+  endif()
   message(STATUS "Setting next clang stage to: ${NEXT_CLANG_STAGE}")
   
   
@@ -681,6 +689,26 @@
 set(RUNTIME_DEP compiler-rt)
   endif()
 
+  set(COMPILER_OPTIONS
+-DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++
+-DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
+-DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang)
+
+  if(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED)
+set(PGO_DEP llvm-profdata)
+set(PGO_OPT -DLLVM_PROFDATA=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-profdata)
+  endif()
+
+  if(LLVM_BUILD_INSTRUMENTED)
+set(PGO_DEP generate-profdata)
+set(PGO_OPT -DLLVM_PROFDATA_FILE=${CMAKE_CURRENT_BINARY_DIR}/utils/perf-training/clang.profdata)
+set(COMPILER_OPTIONS
+  -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
+  -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
+  -DCMAKE_ASM_COMPILER=${CMAKE_ASM_COMPILER})
+set(RUNTIME_DEP) # Don't set runtime dependencies
+  endif()
+
   # Find all variables that start with BOOTSTRAP_ and populate a variable with
   # them.
   get_cmake_property(variableNames VARIABLES)
@@ -703,7 +731,7 @@
   endforeach()
 
   ExternalProject_Add(${NEXT_CLANG_STAGE}
-DEPENDS clang ${LTO_DEP} ${RUNTIME_DEP}
+DEPENDS clang ${LTO_DEP} ${RUNTIME_DEP} ${PGO_DEP}
 PREFIX ${NEXT_CLANG_STAGE}
 SOURCE_DIR ${CMAKE_SOURCE_DIR}
 STAMP_DIR ${STAMP_DIR}
@@ -715,11 +743,9 @@
 -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
 ${CLANG_BOOTSTRAP_CMAKE_ARGS}
 ${PASSTHROUGH_VARIABLES}
--DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++
--DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
--DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
--DCLANG_STAGE=${NEXT_CLANG_STAGE}
-${LTO_LIBRARY} ${LTO_AR} ${LTO_RANLIB} ${verbose}
+ -DCLANG_STAGE=${NEXT_CLANG_STAGE}
+${COMPILER_OPTIONS}
+${LTO_LIBRARY} ${LTO_AR} ${LTO_RANLIB} ${verbose} ${PGO_OPT}
 INSTALL_COMMAND ""
 STEP_TARGETS configure build
 ${cmake_3_4_USES_TERMINAL_OPTIONS}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r255937 - Add a test for r255875 & r255929, comparisons on DynTypeNode wrapped QualType.

2015-12-17 Thread Richard Trieu via cfe-commits
Author: rtrieu
Date: Thu Dec 17 17:20:57 2015
New Revision: 255937

URL: http://llvm.org/viewvc/llvm-project?rev=255937&view=rev
Log:
Add a test for r255875 & r255929, comparisons on DynTypeNode wrapped QualType.

Modified:
cfe/trunk/unittests/AST/ASTTypeTraitsTest.cpp

Modified: cfe/trunk/unittests/AST/ASTTypeTraitsTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/ASTTypeTraitsTest.cpp?rev=255937&r1=255936&r2=255937&view=diff
==
--- cfe/trunk/unittests/AST/ASTTypeTraitsTest.cpp (original)
+++ cfe/trunk/unittests/AST/ASTTypeTraitsTest.cpp Thu Dec 17 17:20:57 2015
@@ -162,5 +162,12 @@ TEST(DynTypedNode, StmtPrint) {
   EXPECT_TRUE(Verifier.match("void f() {}", stmt()));
 }
 
+TEST(DynTypedNode, QualType) {
+  QualType Q;
+  DynTypedNode Node = DynTypedNode::create(Q);
+  EXPECT_TRUE(Node == Node);
+  EXPECT_FALSE(Node < Node);
+}
+
 }  // namespace ast_type_traits
 }  // namespace clang


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


Re: r255875 - Add QualType case to operator< for DynTypedNode.

2015-12-17 Thread Richard Trieu via cfe-commits
The assert was the one later in the function:
assert(getMemoizationData() && Other.getMemoizationData());
My best guess as to what happened was my configuration had a container
which reordered the comparison, making the QualType comparison happen
earlier than it would otherwise.
r255937 has a small test case which demonstrates where the assert used to
happen.

On Thu, Dec 17, 2015 at 2:05 PM, Aaron Ballman 
wrote:

> On Thu, Dec 17, 2015 at 5:02 PM, Richard Trieu  wrote:
> > On Thu, Dec 17, 2015 at 5:47 AM, Aaron Ballman 
> > wrote:
> >>
> >> On Wed, Dec 16, 2015 at 11:46 PM, Richard Trieu via cfe-commits
> >>  wrote:
> >> > Author: rtrieu
> >> > Date: Wed Dec 16 22:46:48 2015
> >> > New Revision: 255875
> >> >
> >> > URL: http://llvm.org/viewvc/llvm-project?rev=255875&view=rev
> >> > Log:
> >> > Add QualType case to operator< for DynTypedNode.
> >> >
> >> > This allows sorting DynTypedNode's which are QualType's since QualType
> >> > does
> >> > not have memoization.
> >> >
> >> > Modified:
> >> > cfe/trunk/include/clang/AST/ASTTypeTraits.h
> >> >
> >> > Modified: cfe/trunk/include/clang/AST/ASTTypeTraits.h
> >> > URL:
> >> >
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTTypeTraits.h?rev=255875&r1=255874&r2=255875&view=diff
> >> >
> >> >
> ==
> >> > --- cfe/trunk/include/clang/AST/ASTTypeTraits.h (original)
> >> > +++ cfe/trunk/include/clang/AST/ASTTypeTraits.h Wed Dec 16 22:46:48
> 2015
> >> > @@ -271,6 +271,10 @@ public:
> >> >  if (!NodeKind.isSame(Other.NodeKind))
> >> >return NodeKind < Other.NodeKind;
> >> >
> >> > +if (ASTNodeKind::getFromNodeKind().isSame(NodeKind))
> >> > +  return getUnchecked().getAsOpaquePtr() ==
> >> > + Other.getUnchecked().getAsOpaquePtr();
> >> > +
> >>
> >> This only tests for equality, not comparison, which means operator< no
> >> longer has a strict weak ordering. Also, there are no tests for this
> >> change.
> >>
> >> ~Aaron
> >>
> > r255929 changes the operator to '<', which should fix this.  I don't
> have a
> > test case since the assertion was triggered in a recently checked in
> Clang
> > Tidy test that only fails in a special configuration that I couldn't
> > reproduce in a clean change.
>
> Thank you, that commit looks much better! Couldn't we add a test in
> ASTTypeTraitsTests.cpp as a unit test, or was the assert specific to
> that particular special configuration?
>
> ~Aaron
>
> >
> >> >  if (ASTNodeKind::getFromNodeKind().isSame(NodeKind)) {
> >> >auto TLA = getUnchecked();
> >> >auto TLB = Other.getUnchecked();
> >> >
> >> >
> >> > ___
> >> > 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: r255875 - Add QualType case to operator< for DynTypedNode.

2015-12-17 Thread Aaron Ballman via cfe-commits
On Thu, Dec 17, 2015 at 6:25 PM, Richard Trieu  wrote:
> The assert was the one later in the function:
> assert(getMemoizationData() && Other.getMemoizationData());
> My best guess as to what happened was my configuration had a container which
> reordered the comparison, making the QualType comparison happen earlier than
> it would otherwise.
> r255937 has a small test case which demonstrates where the assert used to
> happen.

Thanks!

~Aaron

>
> On Thu, Dec 17, 2015 at 2:05 PM, Aaron Ballman 
> wrote:
>>
>> On Thu, Dec 17, 2015 at 5:02 PM, Richard Trieu  wrote:
>> > On Thu, Dec 17, 2015 at 5:47 AM, Aaron Ballman 
>> > wrote:
>> >>
>> >> On Wed, Dec 16, 2015 at 11:46 PM, Richard Trieu via cfe-commits
>> >>  wrote:
>> >> > Author: rtrieu
>> >> > Date: Wed Dec 16 22:46:48 2015
>> >> > New Revision: 255875
>> >> >
>> >> > URL: http://llvm.org/viewvc/llvm-project?rev=255875&view=rev
>> >> > Log:
>> >> > Add QualType case to operator< for DynTypedNode.
>> >> >
>> >> > This allows sorting DynTypedNode's which are QualType's since
>> >> > QualType
>> >> > does
>> >> > not have memoization.
>> >> >
>> >> > Modified:
>> >> > cfe/trunk/include/clang/AST/ASTTypeTraits.h
>> >> >
>> >> > Modified: cfe/trunk/include/clang/AST/ASTTypeTraits.h
>> >> > URL:
>> >> >
>> >> > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTTypeTraits.h?rev=255875&r1=255874&r2=255875&view=diff
>> >> >
>> >> >
>> >> > ==
>> >> > --- cfe/trunk/include/clang/AST/ASTTypeTraits.h (original)
>> >> > +++ cfe/trunk/include/clang/AST/ASTTypeTraits.h Wed Dec 16 22:46:48
>> >> > 2015
>> >> > @@ -271,6 +271,10 @@ public:
>> >> >  if (!NodeKind.isSame(Other.NodeKind))
>> >> >return NodeKind < Other.NodeKind;
>> >> >
>> >> > +if (ASTNodeKind::getFromNodeKind().isSame(NodeKind))
>> >> > +  return getUnchecked().getAsOpaquePtr() ==
>> >> > + Other.getUnchecked().getAsOpaquePtr();
>> >> > +
>> >>
>> >> This only tests for equality, not comparison, which means operator< no
>> >> longer has a strict weak ordering. Also, there are no tests for this
>> >> change.
>> >>
>> >> ~Aaron
>> >>
>> > r255929 changes the operator to '<', which should fix this.  I don't
>> > have a
>> > test case since the assertion was triggered in a recently checked in
>> > Clang
>> > Tidy test that only fails in a special configuration that I couldn't
>> > reproduce in a clean change.
>>
>> Thank you, that commit looks much better! Couldn't we add a test in
>> ASTTypeTraitsTests.cpp as a unit test, or was the assert specific to
>> that particular special configuration?
>>
>> ~Aaron
>>
>> >
>> >> >  if (ASTNodeKind::getFromNodeKind().isSame(NodeKind)) {
>> >> >auto TLA = getUnchecked();
>> >> >auto TLB = Other.getUnchecked();
>> >> >
>> >> >
>> >> > ___
>> >> > 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] D15624: Add iOS/watchOS/tvOS support for ASan (clang part)

2015-12-17 Thread Anna Zaks via cfe-commits
zaks.anna added inline comments.


Comment at: lib/Driver/ToolChains.cpp:368
@@ +367,3 @@
+  StringRef OS = "";
+  if (isTargetMacOS())
+OS = "osx";

samsonov wrote:
> Wait, this looks horrible. Can we teach toolchain to give us OS name?
These are not OS names; they are prefixes we use to name the library. I believe 
"appletvsimulator" would be a platform name, which is too long to append to the 
dylib name.

I could factor this out into a separate function, but there are no other 
immediate users. Not sure if the profiler library could be refactored to use 
it, logic there seems more complicated.


http://reviews.llvm.org/D15624



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


Re: r255371 - Error on redeclaring with a conflicting asm label and on redeclaring with an asm label after the first ODR-use. Detects problems like the one in PR22830 where gcc and clang both compiled

2015-12-17 Thread Nick Lewycky via cfe-commits

On 12/17/2015 10:47 AM, Kostya Serebryany wrote:

I am now observing this error message when building glibc with clang
(from trunk):
../include/string.h:101:28: error: cannot apply asm label to function
after its first use
libc_hidden_builtin_proto (memcpy)
(many more instances)


Do you think this is a bug in glibc code, or the error message could be
more relaxed?


Could you email me a .i copy of a failing build? That will help me 
decide whether it's a bug in the error or in glibc.








On Fri, Dec 11, 2015 at 1:28 PM, Nick Lewycky via cfe-commits
mailto:cfe-commits@lists.llvm.org>> wrote:

Author: nicholas
Date: Fri Dec 11 15:28:55 2015
New Revision: 255371

URL: http://llvm.org/viewvc/llvm-project?rev=255371&view=rev
Log:
Error on redeclaring with a conflicting asm label and on redeclaring
with an asm label after the first ODR-use. Detects problems like the
one in PR22830 where gcc and clang both compiled the file but with
different behaviour.

Added:
 cfe/trunk/test/Sema/asm-label.c
Modified:
 cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
 cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL:

http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=255371&r1=255370&r2=255371&view=diff

==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Dec 11
15:28:55 2015
@@ -4259,6 +4259,9 @@ def err_tag_definition_of_typedef : Erro
  def err_conflicting_types : Error<"conflicting types for %0">;
  def err_different_pass_object_size_params : Error<
"conflicting pass_object_size attributes on parameters">;
+def err_late_asm_label_name : Error<
+  "cannot apply asm label to %select{variable|function}0 after its
first use">;
+def err_different_asm_label : Error<"conflicting asm label">;
  def err_nested_redefinition : Error<"nested redefinition of %0">;
  def err_use_with_wrong_tag : Error<
"use of %0 with tag type that does not match previous declaration">;

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL:

http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=255371&r1=255370&r2=255371&view=diff

==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Dec 11 15:28:55 2015
@@ -2379,9 +2379,24 @@ void Sema::mergeDeclAttributes(NamedDecl
if (!Old->hasAttrs() && !New->hasAttrs())
  return;

-  // attributes declared post-definition are currently ignored
+  // Attributes declared post-definition are currently ignored.
checkNewAttributesAfterDef(*this, New, Old);

+  if (AsmLabelAttr *NewA = New->getAttr()) {
+if (AsmLabelAttr *OldA = Old->getAttr()) {
+  if (OldA->getLabel() != NewA->getLabel()) {
+// This redeclaration changes __asm__ label.
+Diag(New->getLocation(), diag::err_different_asm_label);
+Diag(OldA->getLocation(), diag::note_previous_declaration);
+  }
+} else if (Old->isUsed()) {
+  // This redeclaration adds an __asm__ label to a declaration
that has
+  // already been ODR-used.
+  Diag(New->getLocation(), diag::err_late_asm_label_name)
+<< isa(Old) <<
New->getAttr()->getRange();
+}
+  }
+
if (!Old->hasAttrs())
  return;


Added: cfe/trunk/test/Sema/asm-label.c
URL:

http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/asm-label.c?rev=255371&view=auto

==
--- cfe/trunk/test/Sema/asm-label.c (added)
+++ cfe/trunk/test/Sema/asm-label.c Fri Dec 11 15:28:55 2015
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -verify %s
+
+void f();
+void f() __asm__("fish");
+void g();
+
+void f() {
+  g();
+}
+void g() __asm__("gold");  // expected-error{{cannot apply asm
label to function after its first use}}
+
+void h() __asm__("hose");  // expected-note{{previous declaration
is here}}
+void h() __asm__("hair");  // expected-error{{conflicting asm label}}
+
+int x;
+int x __asm__("xenon");
+int y;
+
+int test() { return y; }
+
+int y __asm__("yacht");  // expected-error{{cannot apply asm label
to variable after its first use}}
+
+int z __asm__("zebra");  // expected-note{{previous declaration is
here}}
+int z __asm__("zooms");  // expected-error{{conflicting asm label}}
+
+
+// No diagnostics on the following.
+void __real_readlink() __asm("readlink");
+void readlink() __asm("__p

cfe-commits@lists.llvm.org

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

LGTM. Thanks.


http://reviews.llvm.org/D14839



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


[libcxx] r255941 - [libcxx] LWG2485: get() should be overloaded for const tuple&&. Patch from K-Ballo.

2015-12-17 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Dec 17 18:36:55 2015
New Revision: 255941

URL: http://llvm.org/viewvc/llvm-project?rev=255941&view=rev
Log:
[libcxx] LWG2485: get() should be overloaded for const tuple&&. Patch from 
K-Ballo.

Review: http://reviews.llvm.org/D14839

Added:

libcxx/trunk/test/std/containers/sequences/array/array.tuple/get_const_rv.pass.cpp

libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const_rv.fail.cpp

libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const_rv.pass.cpp

libcxx/trunk/test/std/utilities/utility/pairs/pair.astuple/get_const_rv.pass.cpp
Modified:
libcxx/trunk/include/__tuple
libcxx/trunk/include/array
libcxx/trunk/include/tuple
libcxx/trunk/include/utility

libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.pass.cpp

libcxx/trunk/test/std/utilities/utility/pairs/pair.astuple/pairs.by.type.pass.cpp
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/include/__tuple
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__tuple?rev=255941&r1=255940&r2=255941&view=diff
==
--- libcxx/trunk/include/__tuple (original)
+++ libcxx/trunk/include/__tuple Thu Dec 17 18:36:55 2015
@@ -86,6 +86,11 @@ template 
 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
 typename tuple_element<_Ip, tuple<_Tp...> >::type&&
 get(tuple<_Tp...>&&) _NOEXCEPT;
+
+template 
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
+get(const tuple<_Tp...>&&) _NOEXCEPT;
 #endif
 
 // pair specializations
@@ -109,6 +114,11 @@ template  >::type&&
 get(pair<_T1, _T2>&&) _NOEXCEPT;
+
+template 
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+const typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
+get(const pair<_T1, _T2>&&) _NOEXCEPT;
 #endif
 
 // array specializations
@@ -132,6 +142,11 @@ template &&) _NOEXCEPT;
+
+template 
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+const _Tp&&
+get(const array<_Tp, _Size>&&) _NOEXCEPT;
 #endif
 
 #if !defined(_LIBCPP_HAS_NO_VARIADICS)

Modified: libcxx/trunk/include/array
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/array?rev=255941&r1=255940&r2=255941&view=diff
==
--- libcxx/trunk/include/array (original)
+++ libcxx/trunk/include/array Thu Dec 17 18:36:55 2015
@@ -95,6 +95,7 @@ template  s
 template  T& get(array&) noexcept; // 
constexpr in C++14
 template  const T& get(const array&) 
noexcept; // constexpr in C++14
 template  T&& get(array&&) noexcept; // 
constexpr in C++14
+template  const T&& get(const array&&) 
noexcept; // constexpr in C++14
 
 }  // std
 
@@ -324,6 +325,15 @@ get(array<_Tp, _Size>&& __a) _NOEXCEPT
 return _VSTD::move(__a.__elems_[_Ip]);
 }
 
+template 
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+const _Tp&&
+get(const array<_Tp, _Size>&& __a) _NOEXCEPT
+{
+static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const 
std::array &&)");
+return _VSTD::move(__a.__elems_[_Ip]);
+}
+
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
 _LIBCPP_END_NAMESPACE_STD

Modified: libcxx/trunk/include/tuple
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/tuple?rev=255941&r1=255940&r2=255941&view=diff
==
--- libcxx/trunk/include/tuple (original)
+++ libcxx/trunk/include/tuple Thu Dec 17 18:36:55 2015
@@ -95,6 +95,9 @@ template 
 template 
 typename tuple_element>::type&&
 get(tuple&&) noexcept; // constexpr in C++14
+template 
+const typename tuple_element>::type&&
+get(const tuple&&) noexcept; // constexpr in C++14
 
 template 
 constexpr T1& get(tuple&) noexcept;  // C++14
@@ -102,6 +105,8 @@ template 
 constexpr const T1& get(const tuple&) noexcept;   // C++14
 template 
 constexpr T1&& get(tuple&&) noexcept;   // C++14
+template 
+constexpr const T1&& get(const tuple&&) noexcept;   // C++14
 
 // 20.4.1.6, relational operators:
 template bool operator==(const tuple&, const 
tuple&); // constexpr in C++14
@@ -507,6 +512,8 @@ class _LIBCPP_TYPE_VIS_ONLY tuple
 const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const 
tuple<_Up...>&) _NOEXCEPT;
 template  friend _LIBCPP_CONSTEXPR_AFTER_CXX11
 typename tuple_element<_Jp, tuple<_Up...> >::type&& 
get(tuple<_Up...>&&) _NOEXCEPT;
+template  friend _LIBCPP_CONSTEXPR_AFTER_CXX11
+const typename tuple_element<_Jp, tuple<_Up...> >::type&& get(const 
tuple<_Up...>&&) _NOEXCEPT;
 public:
 
 template && __t) _NOEXCEPT
  static_cast<__tuple_leaf<_Ip, type>&&>(__t.base_).get());
 }
 
+template 
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
+get(const tuple<_Tp...>&& __t

cfe-commits@lists.llvm.org

2015-12-17 Thread Eric Fiselier via cfe-commits
EricWF closed this revision.
EricWF added a comment.

r255941.


http://reviews.llvm.org/D14839



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


r255943 - ObjC properties: consider ownership of properties from protocols when synthesizing.

2015-12-17 Thread Douglas Gregor via cfe-commits
Author: dgregor
Date: Thu Dec 17 18:52:31 2015
New Revision: 255943

URL: http://llvm.org/viewvc/llvm-project?rev=255943&view=rev
Log:
ObjC properties: consider ownership of properties from protocols when 
synthesizing.

When determining whether ownership was explicitly written for a
property when it is being synthesized, also consider that the original
property might have come from a protocol. Fixes rdar://problem/23931441.

Modified:
cfe/trunk/lib/Sema/SemaObjCProperty.cpp
cfe/trunk/test/SemaObjC/arc-property-decl-attrs.m

Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=255943&r1=255942&r2=255943&view=diff
==
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Thu Dec 17 18:52:31 2015
@@ -868,6 +868,13 @@ static bool hasWrittenStorageAttribute(O
   return OrigProp->getPropertyAttributesAsWritten() & OwnershipMask;
   }
 
+  // Look through all of the protocols.
+  for (const auto *Proto : OrigClass->all_referenced_protocols()) {
+if (ObjCPropertyDecl *OrigProp =
+  Proto->FindPropertyDeclaration(Prop->getIdentifier()))
+  return OrigProp->getPropertyAttributesAsWritten() & OwnershipMask;
+  }
+
   return false;
 }
 

Modified: cfe/trunk/test/SemaObjC/arc-property-decl-attrs.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/arc-property-decl-attrs.m?rev=255943&r1=255942&r2=255943&view=diff
==
--- cfe/trunk/test/SemaObjC/arc-property-decl-attrs.m (original)
+++ cfe/trunk/test/SemaObjC/arc-property-decl-attrs.m Thu Dec 17 18:52:31 2015
@@ -105,3 +105,19 @@
 @property(nonatomic, weak, nonnull, readonly) id ROdelegate; // expected-error 
{{property attributes 'nonnull' and 'weak' are mutually exclusive}}
 @end
 
+// rdar://problem/23931441
+@protocol P
+@property(readonly, retain) id prop;
+@end
+
+__attribute__((objc_root_class))
+@interface I2
+@end
+
+@interface I2()
+@property (readwrite) id prop;
+@end
+
+@implementation I2
+@synthesize prop;
+@end


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


Re: r255371 - Error on redeclaring with a conflicting asm label and on redeclaring with an asm label after the first ODR-use. Detects problems like the one in PR22830 where gcc and clang both compiled

2015-12-17 Thread Richard Smith via cfe-commits
On Thu, Dec 17, 2015 at 3:59 PM, Nick Lewycky via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On 12/17/2015 10:47 AM, Kostya Serebryany wrote:
>
>> I am now observing this error message when building glibc with clang
>> (from trunk):
>> ../include/string.h:101:28: error: cannot apply asm label to function
>> after its first use
>> libc_hidden_builtin_proto (memcpy)
>> (many more instances)
>>
>>
>> Do you think this is a bug in glibc code, or the error message could be
>> more relaxed?
>>
>
> Could you email me a .i copy of a failing build? That will help me decide
> whether it's a bug in the error or in glibc.


Also PR22830 comment 1 seems relevant here.


> On Fri, Dec 11, 2015 at 1:28 PM, Nick Lewycky via cfe-commits
>> mailto:cfe-commits@lists.llvm.org>> wrote:
>>
>> Author: nicholas
>> Date: Fri Dec 11 15:28:55 2015
>> New Revision: 255371
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=255371&view=rev
>> Log:
>> Error on redeclaring with a conflicting asm label and on redeclaring
>> with an asm label after the first ODR-use. Detects problems like the
>> one in PR22830 where gcc and clang both compiled the file but with
>> different behaviour.
>>
>> Added:
>>  cfe/trunk/test/Sema/asm-label.c
>> Modified:
>>  cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>>  cfe/trunk/lib/Sema/SemaDecl.cpp
>>
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>> URL:
>>
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=255371&r1=255370&r2=255371&view=diff
>>
>> ==
>> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
>> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Dec 11
>> 15:28:55 2015
>> @@ -4259,6 +4259,9 @@ def err_tag_definition_of_typedef : Erro
>>   def err_conflicting_types : Error<"conflicting types for %0">;
>>   def err_different_pass_object_size_params : Error<
>> "conflicting pass_object_size attributes on parameters">;
>> +def err_late_asm_label_name : Error<
>> +  "cannot apply asm label to %select{variable|function}0 after its
>> first use">;
>> +def err_different_asm_label : Error<"conflicting asm label">;
>>   def err_nested_redefinition : Error<"nested redefinition of %0">;
>>   def err_use_with_wrong_tag : Error<
>> "use of %0 with tag type that does not match previous
>> declaration">;
>>
>> Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
>> URL:
>>
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=255371&r1=255370&r2=255371&view=diff
>>
>> ==
>> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Dec 11 15:28:55 2015
>> @@ -2379,9 +2379,24 @@ void Sema::mergeDeclAttributes(NamedDecl
>> if (!Old->hasAttrs() && !New->hasAttrs())
>>   return;
>>
>> -  // attributes declared post-definition are currently ignored
>> +  // Attributes declared post-definition are currently ignored.
>> checkNewAttributesAfterDef(*this, New, Old);
>>
>> +  if (AsmLabelAttr *NewA = New->getAttr()) {
>> +if (AsmLabelAttr *OldA = Old->getAttr()) {
>> +  if (OldA->getLabel() != NewA->getLabel()) {
>> +// This redeclaration changes __asm__ label.
>> +Diag(New->getLocation(), diag::err_different_asm_label);
>> +Diag(OldA->getLocation(), diag::note_previous_declaration);
>> +  }
>> +} else if (Old->isUsed()) {
>> +  // This redeclaration adds an __asm__ label to a declaration
>> that has
>> +  // already been ODR-used.
>> +  Diag(New->getLocation(), diag::err_late_asm_label_name)
>> +<< isa(Old) <<
>> New->getAttr()->getRange();
>> +}
>> +  }
>> +
>> if (!Old->hasAttrs())
>>   return;
>>
>>
>> Added: cfe/trunk/test/Sema/asm-label.c
>> URL:
>>
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/asm-label.c?rev=255371&view=auto
>>
>> ==
>> --- cfe/trunk/test/Sema/asm-label.c (added)
>> +++ cfe/trunk/test/Sema/asm-label.c Fri Dec 11 15:28:55 2015
>> @@ -0,0 +1,30 @@
>> +// RUN: %clang_cc1 -verify %s
>> +
>> +void f();
>> +void f() __asm__("fish");
>> +void g();
>> +
>> +void f() {
>> +  g();
>> +}
>> +void g() __asm__("gold");  // expected-error{{cannot apply asm
>> label to function after its first use}}
>> +
>> +void h() __asm__("hose");  // expected-note{{previous declaration
>> is here}}
>> +void h() __asm__("hair");  // expected-error{{conflicting asm label}}
>> +
>> +int x;
>> +int x __asm__("xenon");
>> 

[libcxx] r255944 - Fix type in tuple test. Sorry for the noise

2015-12-17 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Dec 17 19:04:36 2015
New Revision: 255944

URL: http://llvm.org/viewvc/llvm-project?rev=255944&view=rev
Log:
Fix type in tuple test. Sorry for the noise

Modified:

libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.pass.cpp?rev=255944&r1=255943&r2=255944&view=diff
==
--- 
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.pass.cpp
 Thu Dec 17 19:04:36 2015
@@ -67,7 +67,7 @@ int main()
 
 {
 int x = 42;
-int tuple y = 43;
+int y = 43;
 std::tuple const t(x, y);
 static_assert(std::is_same(std::move(t)))>::value, "");
 static_assert(noexcept(std::get(std::move(t))), "");
@@ -77,7 +77,7 @@ int main()
 
 {
 int x = 42;
-int tuple y = 43;
+int y = 43;
 std::tuple const t(std::move(x), std::move(y));
 static_assert(std::is_same(std::move(t)))>::value, "");
 static_assert(noexcept(std::get(std::move(t))), "");


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


Re: [PATCH] D13750: [libcxx] Fix LWG Issue #2367 - Fixing std::tuple and std::pair's default constructors.

2015-12-17 Thread Eric Fiselier via cfe-commits
EricWF updated this revision to Diff 43202.
EricWF added a comment.

Address some of @mclow.lists offline comments. I cleaned up the tests.


http://reviews.llvm.org/D13750

Files:
  include/__config
  include/utility
  test/std/utilities/utility/pairs/pairs.pair/default-sfinae.pass.cpp
  test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp

Index: test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp
===
--- test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp
+++ test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp
@@ -13,24 +13,29 @@
 
 // constexpr pair();
 
+// NOTE: The SFINAE on the default constructor is tested in
+//   default-sfinae.pass.cpp
+
 #include 
+#include 
 #include 
 
+#include "test_macros.h"
+
 int main()
 {
 {
 typedef std::pair P;
 P p;
 assert(p.first == 0.0f);
 assert(p.second == nullptr);
 }
-
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 11
 {
-typedef std::pair P;
-constexpr P p;
-static_assert(p.first == 0.0f, "");
-static_assert(p.second == nullptr, "");
+typedef std::pair P;
+constexpr P p;
+static_assert(p.first == 0.0f, "");
+static_assert(p.second == nullptr, "");
 }
 #endif
 }
Index: test/std/utilities/utility/pairs/pairs.pair/default-sfinae.pass.cpp
===
--- /dev/null
+++ test/std/utilities/utility/pairs/pairs.pair/default-sfinae.pass.cpp
@@ -0,0 +1,164 @@
+//===--===//
+//
+// 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.
+//
+//===--===//
+
+// 
+
+// template  struct pair
+
+// Test the SFINAE required by LWG Issue #2367.
+// is_default_constructible
+
+// UNSUPPORTED: c++98, c++03
+
+#include 
+#include 
+#include 
+
+#include "test_macros.h"
+
+#if TEST_STD_VER > 11
+#define CONSTEXPR_CXX14 constexpr
+#define STATIC_ASSERT_CXX14(Pred) static_assert(Pred, "")
+#else
+#define CONSTEXPR_CXX14
+#define STATIC_ASSERT_CXX14(Pred) assert(Pred)
+#endif
+
+struct DeletedDefault {
+// A class with a deleted default constructor. Used to test the SFINAE
+// on std::pairs default constructor.
+constexpr explicit DeletedDefault(int x) : value(x) {}
+constexpr DeletedDefault() = delete;
+int value;
+};
+
+template 
+struct DependantType: public Tp {};
+
+template 
+using DependantIsDefault = DependantType, Val>;
+
+template 
+struct DefaultSFINAES {
+template ::value
+>::type
+>
+constexpr DefaultSFINAES() : value() {}
+constexpr explicit DefaultSFINAES(T const& x) : value(x) {}
+T value;
+};
+
+struct NoDefault {
+constexpr NoDefault(int v) : value(v) {}
+int value;
+};
+
+template 
+void test_not_is_default_constructible()
+{
+{
+typedef std::pair P;
+static_assert(!std::is_default_constructible::value, "");
+static_assert(std::is_constructible::value, "");
+}
+{
+typedef std::pair P;
+static_assert(!std::is_default_constructible::value, "");
+static_assert(std::is_constructible::value, "");
+}
+{
+typedef std::pair P;
+static_assert(!std::is_default_constructible::value, "");
+static_assert(std::is_constructible::value, "");
+}
+}
+
+template 
+void test_is_default_constructible()
+{
+{
+typedef std::pair P;
+static_assert(std::is_default_constructible::value, "");
+}
+{
+typedef std::pair P;
+static_assert(std::is_default_constructible::value, "");
+}
+{
+typedef std::pair P;
+static_assert(std::is_default_constructible::value, "");
+}
+}
+
+template 
+struct IllFormedDefaultImp {
+  constexpr explicit IllFormedDefaultImp(int v) : value(v) {}
+  constexpr IllFormedDefaultImp() : value(T::DoesNotExistAndShouldNotCompile) {}
+  int value;
+};
+
+typedef IllFormedDefaultImp IllFormedDefault;
+// A class which provides a constexpr default constructor with a valid
+// signature but an ill-formed body. The A compile error will be emitted if
+// the default constructor is instantiated.
+
+
+// Check that the SFINAE on the default constructor is not evaluated when
+// it isn't needed. If the default constructor of 'IllFormedDefault' is evaluated
+// in C++11, even with is_default_constructible, then this test should fail to
+// compile. In C++14 and greater evaluate each test is evaluated as a constant
+// expression.
+// See LWG issue #2367
+void test_illformed_default()
+{
+{
+typedef std::pair P;
+static_assert((std::is_constructible::value), "");
+CONSTEXPR_CXX14 P p(IllFormedDefault(42), -5);
+STA

LLVM buildmaster will be restarted in few minutes

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

LLVM buildmaster will be updated and restarted after 7 PM Pacific time
today.

Thanks

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


r255986 - [OPENMP 4.5] Parsing/sema analysis for 'depend(source)' clause in 'ordered' directive.

2015-12-17 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Thu Dec 17 23:05:56 2015
New Revision: 255986

URL: http://llvm.org/viewvc/llvm-project?rev=255986&view=rev
Log:
[OPENMP 4.5] Parsing/sema analysis for 'depend(source)' clause in 'ordered' 
directive.
OpenMP 4.5 adds 'depend(source)' clause for 'ordered' directive to support 
cross-iteration dependence. Patch adds parsing and semantic analysis for this 
construct.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Basic/OpenMPKinds.def
cfe/trunk/include/clang/Parse/Parser.h
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/lib/Parse/ParseOpenMP.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
cfe/trunk/test/OpenMP/task_depend_messages.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td?rev=255986&r1=255985&r2=255986&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td Thu Dec 17 23:05:56 
2015
@@ -213,5 +213,5 @@ def err_arcmt_nsinvocation_ownership : E
 
 // OpenMP
 def err_omp_more_one_clause : Error<
-  "directive '#pragma omp %0' cannot contain more than one '%1' 
clause%select{| with '%3' name modifier}2">;
+  "directive '#pragma omp %0' cannot contain more than one '%1' 
clause%select{| with '%3' name modifier| with 'source' dependence}2">;
 }

Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=255986&r1=255985&r2=255986&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Thu Dec 17 23:05:56 
2015
@@ -916,6 +916,8 @@ def warn_pragma_omp_ignored : Warning<
 def warn_omp_extra_tokens_at_eol : Warning<
   "extra tokens at the end of '#pragma omp %0' are ignored">,
   InGroup;
+def warn_pragma_expected_colon_r_paren : Warning<
+  "missing ':' or ')' after %0 - ignoring">, InGroup;
 def err_omp_unknown_directive : Error<
   "expected an OpenMP directive">;
 def err_omp_unexpected_directive : Error<
@@ -925,7 +927,7 @@ def err_omp_expected_punc : Error<
 def err_omp_unexpected_clause : Error<
   "unexpected OpenMP clause '%0' in directive '#pragma omp %1'">;
 def err_omp_immediate_directive : Error<
-  "'#pragma omp %0' cannot be an immediate substatement">;
+  "'#pragma omp %0' %select{|with '%2' clause }1cannot be an immediate 
substatement">;
 def err_omp_expected_identifier_for_critical : Error<
   "expected identifier specifying the name of the 'omp critical' directive">;
 def err_omp_unknown_map_type : Error<

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=255986&r1=255985&r2=255986&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Dec 17 23:05:56 
2015
@@ -7911,6 +7911,8 @@ def note_omp_previous_named_if_clause :
   "previous clause with directive name modifier specified here">;
 def err_omp_ordered_directive_with_param : Error<
   "'ordered' directive %select{without any clauses|with 'threads' clause}0 
cannot be closely nested inside ordered region with specified parameter">;
+def err_omp_ordered_directive_without_param : Error<
+  "'ordered' directive with 'depend' clause cannot be closely nested inside 
ordered region without specified parameter">;
 def note_omp_ordered_param : Note<
   "'ordered' clause with specified parameter">;
 def err_omp_expected_base_var_name : Error<
@@ -7947,6 +7949,8 @@ def err_omp_firstprivate_and_lastprivate
   "lastprivate variable cannot be firstprivate in '#pragma omp distribute'">;
 def err_omp_firstprivate_distribute_in_teams_reduction : Error<
   "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">;
 } // 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=255986&r1=255985&r2=255986&view=diff
===