r283724 - Mark aligned allocation as done.

2016-10-10 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Mon Oct 10 01:55:42 2016
New Revision: 283724

URL: http://llvm.org/viewvc/llvm-project?rev=283724&view=rev
Log:
Mark aligned allocation as done.

Modified:
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
cfe/trunk/test/Lexer/cxx-features.cpp
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=283724&r1=283723&r2=283724&view=diff
==
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Mon Oct 10 01:55:42 2016
@@ -510,7 +510,6 @@ static void InitializeCPlusPlusFeatureTe
   if (LangOpts.CPlusPlus1z) {
 Builder.defineMacro("__cpp_hex_float", "201603");
 Builder.defineMacro("__cpp_inline_variables", "201606");
-//Builder.defineMacro("__cpp_aligned_new", "201606");
 //Builder.defineMacro("__cpp_noexcept_function_type", "201510");
 Builder.defineMacro("__cpp_capture_star_this", "201603");
 Builder.defineMacro("__cpp_if_constexpr", "201606");
@@ -522,6 +521,8 @@ static void InitializeCPlusPlusFeatureTe
 Builder.defineMacro("__cpp_nontype_template_args", "201411");
 Builder.defineMacro("__cpp_fold_expressions", "201603");
   }
+  if (LangOpts.AlignedAllocation)
+Builder.defineMacro("__cpp_aligned_new", "201606");
 
   // TS features.
   if (LangOpts.ConceptsTS)

Modified: cfe/trunk/test/Lexer/cxx-features.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/cxx-features.cpp?rev=283724&r1=283723&r2=283724&view=diff
==
--- cfe/trunk/test/Lexer/cxx-features.cpp (original)
+++ cfe/trunk/test/Lexer/cxx-features.cpp Mon Oct 10 01:55:42 2016
@@ -30,8 +30,7 @@
 #error "wrong value for __cpp_inline_variables"
 #endif
 
-#if check(aligned_new, 0, 0, 0, 0) // FIXME: provisional name
-// FIXME: value shuld be 201606 for cxx1z once implemented
+#if check(aligned_new, 0, 0, 0, 201606) // FIXME: provisional name
 #error "wrong value for __cpp_aligned_new"
 #endif
 

Modified: cfe/trunk/www/cxx_status.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=283724&r1=283723&r2=283724&view=diff
==
--- cfe/trunk/www/cxx_status.html (original)
+++ cfe/trunk/www/cxx_status.html Mon Oct 10 01:55:42 2016
@@ -679,7 +679,7 @@ as the draft C++1z standard evolves.
 
   Dynamic memory allocation for over-aligned data
   http://wg21.link/p0035r4";>P0035R4
-  No
+  SVN
 
 
   Template argument deduction for class templates


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


[PATCH] D25004: [x86][inline-asm][clang] accept 'v' constraint

2016-10-10 Thread coby via cfe-commits
coby closed this revision.
coby added a comment.

Commitd to revision 283716


https://reviews.llvm.org/D25004



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


[PATCH] D25338: [Driver] Make -print-libgcc-file-name print compiler-rt lib when used

2016-10-10 Thread Petr Hosek via cfe-commits
phosek added a comment.

I have submitted the same change https://reviews.llvm.org/D25256 a few days ago 
but this one seems to be getting more traction so I'm going to abandon mine in 
favor of this one.




Comment at: lib/Driver/Driver.cpp:1000
+case ToolChain::RLT_CompilerRT:
+  llvm::outs() << TC.getCompilerRTArgString(C.getArgs(), "builtins") << 
"\n";
+  break;

I think you should use `TC.getCompilerRT` rather than 
`TC.getCompilerRTArgString` here.


https://reviews.llvm.org/D25338



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


[PATCH] D25256: [Driver] Print path to correct rtlib for -print-libgcc-file-name

2016-10-10 Thread Petr Hosek via cfe-commits
phosek abandoned this revision.
phosek added a comment.

Michał Górny has submitted the same change as https://reviews.llvm.org/D25338 
and his change seems to be getting more traction.


Repository:
  rL LLVM

https://reviews.llvm.org/D25256



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


[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-10 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added inline comments.



Comment at: test/Analysis/unreachable-code-path.c:201
+static int inlineFunction(const int i) {
+  if (table[i] != 0)
+return 1;

NoQ wrote:
> a.sidorin wrote:
> > I have a small question. Is it possible to simplify this sample with 
> > removing of table[] array? Like putting something like `i != 0` into 
> > condition. As I understand, the problem is not array-related.
> Any `UnknownVal` in the condition would trigger this issue.
> Is it possible to simplify this sample with removing of table[] array? 

I tried to simplify as much as possible. But as NoQ says an UnknownVal is 
required here for this test.


Repository:
  rL LLVM

https://reviews.llvm.org/D25326



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


r283725 - Fix style issue. Spaces in argument list.

2016-10-10 Thread Daniel Marjamaki via cfe-commits
Author: danielmarjamaki
Date: Mon Oct 10 02:39:39 2016
New Revision: 283725

URL: http://llvm.org/viewvc/llvm-project?rev=283725&view=rev
Log:
Fix style issue. Spaces in argument list.

Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h?rev=283725&r1=283724&r2=283725&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h Mon 
Oct 10 02:39:39 2016
@@ -263,7 +263,7 @@ public:
   /// function has ended. Called for both inlined and and top-level functions.
   void processEndOfFunction(NodeBuilderContext& BC,
 ExplodedNode *Pred,
-const ReturnStmt *RS=nullptr) override;
+const ReturnStmt *RS = nullptr) override;
 
   /// Remove dead bindings/symbols before exiting a function.
   void removeDeadOnEndOfFunction(NodeBuilderContext& BC,


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


[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-10 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment.

In https://reviews.llvm.org/D25326#564584, @zaks.anna wrote:

> Please, fix the style issues before committing.


Sorry I missed that.

Ideally it would be possible to run clang-format on the files before 
committing. but currently I get lots of unrelated changes then.

Would it be ok to run clang-format on some files to clean up the formatting? At 
least some minor changes like removing trailing spaces.


Repository:
  rL LLVM

https://reviews.llvm.org/D25326



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


[PATCH] D25414: [libcxx] Add support for Fuchsia

2016-10-10 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

Is this *all* that's needed to get libc++ working?


Repository:
  rL LLVM

https://reviews.llvm.org/D25414



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


[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-10 Thread Artem Dergachev via cfe-commits
NoQ added a comment.

In https://reviews.llvm.org/D25326#565919, @danielmarjamaki wrote:

> Ideally it would be possible to run clang-format on the files before 
> committing. but currently I get lots of unrelated changes then.
>
> Would it be ok to run clang-format on some files to clean up the formatting? 
> At least some minor changes like removing trailing spaces.


clang-format should be able to format small sections of the code, keeping in 
mind the rest of the file but not touching it. In vim, i use a hotkey for 
formatting the statement under cursor. I've seen a plugin for Xcode that 
clang-format's selected text. Also, there's this `git clang-format` thingy, 
which should be able to clang-format git changes and only them, i didn't try, 
but it might be universally useful.


Repository:
  rL LLVM

https://reviews.llvm.org/D25326



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


[PATCH] D25373: Fix for Bug 30639: CGDebugInfo Null dereference with OpenMP array access

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

I think the fix is not quite correct. I believe it's better to replace a call 
of getVariableArrayDecayedType() in CGStmtOpenMP.cpp by a call to 
getCanonicalParamType(). Try to replace it and check the result.


Repository:
  rL LLVM

https://reviews.llvm.org/D25373



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


[PATCH] D25429: [analyzer] Link libStaticAnalyzerCheckers to libASTMatchers.

2016-10-10 Thread Artem Dergachev via cfe-commits
NoQ created this revision.
NoQ added reviewers: zaks.anna, dcoughlin, xazax.hun, a.sidorin, alexfh.
NoQ added a subscriber: cfe-commits.
Herald added subscribers: mgorny, beanz.

ASTMatchers are sometimes handy in the Analyzer, and there are more patches to 
make use of them.

However, it turns out that not only the Analyzer, but also the whole clang 
binary was never linked to libASTMatchers. So there's a binary size concern.

On my machine (mac) binary size increases by:

- 0.5% (73 731 296 bytes => 74 118 172 bytes) in release mode,
- 2% (243 942 672 bytes => 249 748 052 bytes) in debug mode.

Is such increase bearable? Would anybody approve that?


https://reviews.llvm.org/D25429

Files:
  lib/StaticAnalyzer/Checkers/CMakeLists.txt


Index: lib/StaticAnalyzer/Checkers/CMakeLists.txt
===
--- lib/StaticAnalyzer/Checkers/CMakeLists.txt
+++ lib/StaticAnalyzer/Checkers/CMakeLists.txt
@@ -91,6 +91,7 @@
 
   LINK_LIBS
   clangAST
+  clangASTMatchers
   clangAnalysis
   clangBasic
   clangLex


Index: lib/StaticAnalyzer/Checkers/CMakeLists.txt
===
--- lib/StaticAnalyzer/Checkers/CMakeLists.txt
+++ lib/StaticAnalyzer/Checkers/CMakeLists.txt
@@ -91,6 +91,7 @@
 
   LINK_LIBS
   clangAST
+  clangASTMatchers
   clangAnalysis
   clangBasic
   clangLex
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25429: [analyzer] Link libStaticAnalyzerCheckers to libASTMatchers.

2016-10-10 Thread Gábor Horváth via cfe-commits
xazax.hun added a comment.

I might be confused, but as far as I remember, when you do static linking, 
symbols tend to be linked in lazily. So as long as you do not use the matchers, 
those numbers might be misleading.


https://reviews.llvm.org/D25429



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


[PATCH] D25429: [analyzer] Link libStaticAnalyzerCheckers to libASTMatchers.

2016-10-10 Thread Artem Dergachev via cfe-commits
NoQ added a comment.

In https://reviews.llvm.org/D25429#565939, @xazax.hun wrote:

> I might be confused, but as far as I remember, when you do static linking, 
> symbols tend to be linked in lazily. So as long as you do not use the 
> matchers, those numbers might be misleading.


Yep, i did actually obtain these numbers by using matchers in one of the 
checkers.


https://reviews.llvm.org/D25429



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


[PATCH] D25429: [analyzer] Link libStaticAnalyzerCheckers to libASTMatchers.

2016-10-10 Thread Gábor Horváth via cfe-commits
xazax.hun added a comment.

In https://reviews.llvm.org/D25429#565940, @NoQ wrote:

> In https://reviews.llvm.org/D25429#565939, @xazax.hun wrote:
>
> > I might be confused, but as far as I remember, when you do static linking, 
> > symbols tend to be linked in lazily. So as long as you do not use the 
> > matchers, those numbers might be misleading.
>
>
> Yep, i did actually obtain these numbers by using matchers in one of the 
> checkers.


Great! I am in favour of this change. I wonder, however, if it is worth to ask 
this on the mailing list as well.


https://reviews.llvm.org/D25429



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


[PATCH] D25414: [libcxx] Add support for Fuchsia

2016-10-10 Thread Petr Hosek via cfe-commits
phosek added a comment.

Currently yes, we've been using libc++ (and libc++abi which doesn't need any 
changes) for a few months now without any problems. Our C library is a fork of 
musl so we rely on all the changes that have already been done to support it. 
However, we're building libc++ with `LIBCXX_HAS_MUSL_LIBC=ON` but we're slowly 
diverging from the upstream version so it might be better to stop relying on 
that option. I'd have to copy `include/support/musl/xlocale.h` to 
`include/support/fuchsia/xlocale.h`. Would that be fine with you?


Repository:
  rL LLVM

https://reviews.llvm.org/D25414



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


[PATCH] D25414: [libcxx] Add support for Fuchsia

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

Cool! This patch LGTM then.

> we're slowly diverging from the upstream version so it might be better to 
> stop relying on that option. I'd have to copy include/support/musl/xlocale.h 
> to include/support/fuchsia/xlocale.h. Would that be fine with you?

That sounds fine.


Repository:
  rL LLVM

https://reviews.llvm.org/D25414



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


[PATCH] D25414: [libcxx] Add support for Fuchsia

2016-10-10 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

PS. If your not already locked into an ABI you'll want to look into enabling 
the most recent ABI breaking changes. See the `_LIBCPP_ABI_VERSION` 
configuration at the top of `__config` for more info.


Repository:
  rL LLVM

https://reviews.llvm.org/D25414



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


[PATCH] D25414: [libcxx] Add support for Fuchsia

2016-10-10 Thread Petr Hosek via cfe-commits
phosek added a comment.

> That sounds fine.

Shall I send it as a separate patch or update this one?

> PS. If your not already locked into an ABI you'll want to look into enabling 
> the most recent ABI breaking changes. See the `_LIBCPP_ABI_VERSION` 
> configuration at the top of `__config` for more info.

We're already defaulting to `LIBCXX_ABI_VERSION=2`, I figured that's what we 
want to be using.


Repository:
  rL LLVM

https://reviews.llvm.org/D25414



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


[PATCH] D25353: Implement __emul, __emulu, _mul128 and _umul128 MS intrinsics

2016-10-10 Thread Hans Wennborg via cfe-commits
hans accepted this revision.
hans added a comment.
This revision is now accepted and ready to land.

lgtm with some nits




Comment at: lib/CodeGen/CGBuiltin.cpp:7592
 Value *LHS = EmitScalarExpr(E->getArg(0));
 Value *RHS = EmitScalarExpr(E->getArg(1));
 llvm::Type *ResType = ConvertType(E->getType());

While you're here, or if you want to do a follow-up, I think this code could 
just use Ops[0] and Ops[1] directly, as the "EmitScaleExpr" was done earlier.



Comment at: lib/Headers/intrin.h:420
 unsigned __int64 _shrx_u64(unsigned __int64, unsigned int);
-/*
- * Multiply two 64-bit integers and obtain a 64-bit result.
- * The low-half is returned directly and the high half is in an out parameter.
- */
-static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS
-_umul128(unsigned __int64 _Multiplier, unsigned __int64 _Multiplicand,
- unsigned __int64 *_HighProduct) {
-  unsigned __int128 _FullProduct =
-  (unsigned __int128)_Multiplier * (unsigned __int128)_Multiplicand;
-  *_HighProduct = _FullProduct >> 64;
-  return _FullProduct;
-}
+static __inline__ unsigned __int64 _umul128(unsigned __int64 _Multiplier,
+unsigned __int64 _Multiplicand,

Maybe move this one next to __mul128 (or move that here), so they're next to 
each other in the file.



Comment at: test/CodeGen/ms-x86-intrinsics.c:57
+// CHECK-X64-LABEL: define i64 @test_mul128(i64 %Multiplier, i64 
%Multiplicand, i64*{{[a-z_ ]*}}%HighProduct)
+// CHECK-X64: = mul nsw i128 %
+// CHECK-X64: store i64 %

it would be good to check for the sext's too (and zext's for _umul128)


https://reviews.llvm.org/D25353



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


[PATCH] D25419: Use unique_ptr in LLVMContextImpl's constant maps.

2016-10-10 Thread Tim Shen via cfe-commits
timshen added inline comments.



Comment at: llvm/lib/IR/LLVMContextImpl.cpp:106
   for (auto &CDSConstant : CDSConstants)
 delete CDSConstant.second;
   CDSConstants.clear();

Do you want to change this one as well?


https://reviews.llvm.org/D25419



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


[libcxx] r283726 - [libcxx] Add the missing limits.h header

2016-10-10 Thread Asiri Rathnayake via cfe-commits
Author: asiri
Date: Mon Oct 10 03:38:51 2016
New Revision: 283726

URL: http://llvm.org/viewvc/llvm-project?rev=283726&view=rev
Log:
[libcxx] Add the missing limits.h header

The implementation of [depr.c.headers] in D12747 introduced the necessary
C headers into libc++. This patch adds one more missing headers: limits.h

We spotted this due to a failing C++03 test [limits_h.pass.cpp] in our libc++
configuration; when the limits.h header is included from a C++ program, it now
bypassed the __config header and went directly into the underlying C library's
limits.h header, which is problematic for us because we use __config header to
configure the underlying C library's behaviour when used from a C++ context.

Reviewers: mclow.lists, rsmith

Differential revision: https://reviews.llvm.org/D25361

Added:
libcxx/trunk/include/limits.h

Added: libcxx/trunk/include/limits.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/limits.h?rev=283726&view=auto
==
--- libcxx/trunk/include/limits.h (added)
+++ libcxx/trunk/include/limits.h Mon Oct 10 03:38:51 2016
@@ -0,0 +1,49 @@
+// -*- C++ -*-
+//===--- limits.h 
-===//
+//
+// 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.
+//
+//===--===//
+
+#ifndef _LIBCPP_LIMITS_H
+#define _LIBCPP_LIMITS_H
+
+/*
+limits.h synopsis
+
+Macros:
+
+CHAR_BIT
+SCHAR_MIN
+SCHAR_MAX
+UCHAR_MAX
+CHAR_MIN
+CHAR_MAX
+MB_LEN_MAX
+SHRT_MIN
+SHRT_MAX
+USHRT_MAX
+INT_MIN
+INT_MAX
+UINT_MAX
+LONG_MIN
+LONG_MAX
+ULONG_MAX
+LLONG_MIN   // C99
+LLONG_MAX   // C99
+ULLONG_MAX  // C99
+
+*/
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#include_next 
+
+#endif  // _LIBCPP_LIMITS_H


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


[PATCH] D25361: [libcxx] Add the missing limits.h header

2016-10-10 Thread Asiri Rathnayake via cfe-commits
rmaprath closed this revision.
rmaprath added a comment.

Thanks.

Committed as r283726.


https://reviews.llvm.org/D25361



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


[PATCH] D25420: [AST] Convert MangleNumberingContext to a unique_ptr.

2016-10-10 Thread Tim Shen via cfe-commits
timshen accepted this revision.
timshen added inline comments.
This revision is now accepted and ready to land.



Comment at: clang/include/clang/Sema/Sema.h:879
 /// do not have lambda expressions or block literals.
-IntrusiveRefCntPtr MangleNumbering;
+std::unique_ptr MangleNumbering;
 

Wait, what? 

This is awesome. :)


https://reviews.llvm.org/D25420



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


[PATCH] D25425: [AST] Convert Marshallers to use unique_ptr.

2016-10-10 Thread Tim Shen via cfe-commits
timshen added inline comments.



Comment at: clang/lib/ASTMatchers/Dynamic/Marshallers.h:514
+  MutableArrayRef> Callbacks)
+  : Overloads(std::make_move_iterator(Callbacks.begin()),
+  std::make_move_iterator(Callbacks.end())) {}

Notice that this is 2x slower, because move on unique_ptr resets the move-from 
side. But it is less likely to have an issue.



Comment at: clang/lib/ASTMatchers/Dynamic/Registry.cpp:501
   for (const auto &M : RegistryData->constructors()) {
-const auto *Matcher = M.getValue();
+const std::unique_ptr& Matcher = M.getValue();
 StringRef Name = M.getKey();

const MatcherDescriptor &Matcher = *M.getValue()?


https://reviews.llvm.org/D25425



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


[PATCH] D25427: [Analysis] Use unique_ptr for CallGraph::FunctionMap.

2016-10-10 Thread Tim Shen via cfe-commits
timshen added inline comments.



Comment at: clang/include/clang/Analysis/CallGraph.h:204
+  static clang::CallGraphNode *
+  CGGetValue(decltype(*std::declval()) &P) {
+return P.second.get();

Does clang::CallGraph::const_iterator::value_type work?


https://reviews.llvm.org/D25427



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


[PATCH] D25430: [Sema] Prevent using member declaration diagnostic if the base class is invalid.

2016-10-10 Thread Eric Fiselier via cfe-commits
EricWF created this revision.
EricWF added reviewers: rsmith, majnemer, aaron.ballman.
EricWF added a subscriber: cfe-commits.

Once a base class has been made invalid (by a static_assert for example) all 
using-member declarations in the derived classes will result in a "not a base 
class" diagnostic. This diagnostic is very misleading and should not be emitted.

This change is needed to help libc++ produce reasonable diagnostics in 
`std::optional` and `std::variant`.


https://reviews.llvm.org/D25430

Files:
  lib/Sema/SemaDeclCXX.cpp
  test/SemaCXX/using-decl-templates.cpp


Index: test/SemaCXX/using-decl-templates.cpp
===
--- test/SemaCXX/using-decl-templates.cpp
+++ test/SemaCXX/using-decl-templates.cpp
@@ -92,3 +92,17 @@
 
   template struct APtr; // expected-error{{elaborated type refers to a 
type alias template}}
 }
+
+namespace DontDiagnoseInvalidTest {
+template  struct False { enum { value = 0 }; };
+template  struct Base {
+  static_assert(False::value, ""); // expected-error {{static_assert 
failed}}
+  T value;
+};
+template 
+struct Derived : Base { // expected-note {{requested here}}
+  using Base::Base; // OK. Don't diagnose that 'Base' isn't a base class of 
Derived.
+};
+template struct Derived; // expected-note {{requested here}}
+
+} // namespace DontDiagnoseInvalidTest
Index: lib/Sema/SemaDeclCXX.cpp
===
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -9462,11 +9462,13 @@
 return true;
   }
 
-  Diag(SS.getRange().getBegin(),
-   diag::err_using_decl_nested_name_specifier_is_not_base_class)
-<< SS.getScopeRep()
-<< cast(CurContext)
-<< SS.getRange();
+  if (!cast(NamedContext)->isInvalidDecl()) {
+Diag(SS.getRange().getBegin(),
+ diag::err_using_decl_nested_name_specifier_is_not_base_class)
+  << SS.getScopeRep()
+  << cast(CurContext)
+  << SS.getRange();
+  }
   return true;
 }
 


Index: test/SemaCXX/using-decl-templates.cpp
===
--- test/SemaCXX/using-decl-templates.cpp
+++ test/SemaCXX/using-decl-templates.cpp
@@ -92,3 +92,17 @@
 
   template struct APtr; // expected-error{{elaborated type refers to a type alias template}}
 }
+
+namespace DontDiagnoseInvalidTest {
+template  struct False { enum { value = 0 }; };
+template  struct Base {
+  static_assert(False::value, ""); // expected-error {{static_assert failed}}
+  T value;
+};
+template 
+struct Derived : Base { // expected-note {{requested here}}
+  using Base::Base; // OK. Don't diagnose that 'Base' isn't a base class of Derived.
+};
+template struct Derived; // expected-note {{requested here}}
+
+} // namespace DontDiagnoseInvalidTest
Index: lib/Sema/SemaDeclCXX.cpp
===
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -9462,11 +9462,13 @@
 return true;
   }
 
-  Diag(SS.getRange().getBegin(),
-   diag::err_using_decl_nested_name_specifier_is_not_base_class)
-<< SS.getScopeRep()
-<< cast(CurContext)
-<< SS.getRange();
+  if (!cast(NamedContext)->isInvalidDecl()) {
+Diag(SS.getRange().getBegin(),
+ diag::err_using_decl_nested_name_specifier_is_not_base_class)
+  << SS.getScopeRep()
+  << cast(CurContext)
+  << SS.getRange();
+  }
   return true;
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25414: [libcxx] Add support for Fuchsia

2016-10-10 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

In https://reviews.llvm.org/D25414#565956, @phosek wrote:

> > That sounds fine.
>
> Shall I send it as a separate patch or update this one?


I would send a separate patch. This one is already good to go so you might as 
well commit it.

> 
> 
>> PS. If your not already locked into an ABI you'll want to look into enabling 
>> the most recent ABI breaking changes. See the `_LIBCPP_ABI_VERSION` 
>> configuration at the top of `__config` for more info.
> 
> We're already defaulting to `LIBCXX_ABI_VERSION=2`, I figured that's what we 
> want to be using.

Great! Just be aware that ABI v2 is not yet stable. We're just staging it for 
later.


Repository:
  rL LLVM

https://reviews.llvm.org/D25414



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


[PATCH] D25430: [Sema] Prevent using member declaration diagnostic if the base class is invalid.

2016-10-10 Thread Eric Fiselier via cfe-commits
EricWF updated this revision to Diff 74112.
EricWF added a comment.

Simplify test case.


https://reviews.llvm.org/D25430

Files:
  lib/Sema/SemaDeclCXX.cpp
  test/SemaCXX/using-decl-templates.cpp


Index: test/SemaCXX/using-decl-templates.cpp
===
--- test/SemaCXX/using-decl-templates.cpp
+++ test/SemaCXX/using-decl-templates.cpp
@@ -92,3 +92,12 @@
 
   template struct APtr; // expected-error{{elaborated type refers to a 
type alias template}}
 }
+
+namespace DontDiagnoseInvalidTest {
+template  struct Base {
+  static_assert(Value, ""); // expected-error {{static_assert failed}}
+};
+struct Derived : Base { // expected-note {{requested here}}
+  using Base::Base; // OK. Don't diagnose that 'Base' isn't a base 
class of Derived.
+};
+} // namespace DontDiagnoseInvalidTest
Index: lib/Sema/SemaDeclCXX.cpp
===
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -9462,11 +9462,13 @@
 return true;
   }
 
-  Diag(SS.getRange().getBegin(),
-   diag::err_using_decl_nested_name_specifier_is_not_base_class)
-<< SS.getScopeRep()
-<< cast(CurContext)
-<< SS.getRange();
+  if (!cast(NamedContext)->isInvalidDecl()) {
+Diag(SS.getRange().getBegin(),
+ diag::err_using_decl_nested_name_specifier_is_not_base_class)
+  << SS.getScopeRep()
+  << cast(CurContext)
+  << SS.getRange();
+  }
   return true;
 }
 


Index: test/SemaCXX/using-decl-templates.cpp
===
--- test/SemaCXX/using-decl-templates.cpp
+++ test/SemaCXX/using-decl-templates.cpp
@@ -92,3 +92,12 @@
 
   template struct APtr; // expected-error{{elaborated type refers to a type alias template}}
 }
+
+namespace DontDiagnoseInvalidTest {
+template  struct Base {
+  static_assert(Value, ""); // expected-error {{static_assert failed}}
+};
+struct Derived : Base { // expected-note {{requested here}}
+  using Base::Base; // OK. Don't diagnose that 'Base' isn't a base class of Derived.
+};
+} // namespace DontDiagnoseInvalidTest
Index: lib/Sema/SemaDeclCXX.cpp
===
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -9462,11 +9462,13 @@
 return true;
   }
 
-  Diag(SS.getRange().getBegin(),
-   diag::err_using_decl_nested_name_specifier_is_not_base_class)
-<< SS.getScopeRep()
-<< cast(CurContext)
-<< SS.getRange();
+  if (!cast(NamedContext)->isInvalidDecl()) {
+Diag(SS.getRange().getBegin(),
+ diag::err_using_decl_nested_name_specifier_is_not_base_class)
+  << SS.getScopeRep()
+  << cast(CurContext)
+  << SS.getRange();
+  }
   return true;
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25338: [Driver] Make -print-libgcc-file-name print compiler-rt lib when used

2016-10-10 Thread Michał Górny via cfe-commits
mgorny updated this revision to Diff 74111.
mgorny added a comment.

Updated to use TC.getCompilerRT().


https://reviews.llvm.org/D25338

Files:
  docs/CommandGuide/clang.rst
  include/clang/Driver/Options.td
  lib/Driver/Driver.cpp
  test/Driver/montavista-gcc-toolchain.c
  test/Driver/print-libgcc-file-name-clangrt.c
  test/Driver/print-libgcc-file-name-libgcc.c
  test/lit.cfg

Index: test/lit.cfg
===
--- test/lit.cfg
+++ test/lit.cfg
@@ -375,6 +375,11 @@
 if platform.system() not in ['Windows']:
 config.available_features.add('utf8-capable-terminal')
 
+# Support for libgcc runtime. Used to rule out tests that require
+# clang to run with -rtlib=libgcc.
+if platform.system() not in ['Darwin', 'Fuchsia']:
+config.available_features.add('libgcc')
+
 # Native compilation: Check if triples match.
 # FIXME: Consider cases that target can be executed
 # even if host_triple were different from target_triple.
Index: test/Driver/print-libgcc-file-name-libgcc.c
===
--- /dev/null
+++ test/Driver/print-libgcc-file-name-libgcc.c
@@ -0,0 +1,7 @@
+// Test that -print-libgcc-file-name correctly respects -rtlib=libgcc.
+
+// REQUIRES: libgcc
+
+// RUN: %clang -rtlib=libgcc -print-libgcc-file-name 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-LIBGCC %s
+// CHECK-LIBGCC: libgcc.a
Index: test/Driver/print-libgcc-file-name-clangrt.c
===
--- /dev/null
+++ test/Driver/print-libgcc-file-name-clangrt.c
@@ -0,0 +1,11 @@
+// Test that -print-libgcc-file-name correctly respects -rtlib=compiler-rt.
+
+// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \
+// RUN: --target=x86_64-pc-linux \
+// RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-X8664 %s
+// CHECK-CLANGRT-X8664: libclang_rt.builtins-x86_64.a
+
+// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \
+// RUN: --target=i686-pc-linux \
+// RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-I686 %s
+// CHECK-CLANGRT-I686: libclang_rt.builtins-i686.a
Index: test/Driver/montavista-gcc-toolchain.c
===
--- test/Driver/montavista-gcc-toolchain.c
+++ test/Driver/montavista-gcc-toolchain.c
@@ -1,6 +1,6 @@
 // Test that the montavista gcc-toolchain is correctly detected
 //
-// RUN: %clang -print-libgcc-file-name 2>&1 \
+// RUN: %clang -rtlib=platform -print-libgcc-file-name 2>&1 \
 // RUN: --target=i686-montavista-linux \
 // RUN: --gcc-toolchain=%S/Inputs/montavista_i686_tree/usr \
 // RUN:   | FileCheck %s
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -994,7 +994,15 @@
   }
 
   if (C.getArgs().hasArg(options::OPT_print_libgcc_file_name)) {
-llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
+ToolChain::RuntimeLibType RLT = TC.GetRuntimeLibType(C.getArgs());
+switch (RLT) {
+case ToolChain::RLT_CompilerRT:
+  llvm::outs() << TC.getCompilerRT(C.getArgs(), "builtins") << "\n";
+  break;
+case ToolChain::RLT_Libgcc:
+  llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
+  break;
+}
 return false;
   }
 
Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1861,7 +1861,8 @@
 def print_ivar_layout : Flag<["-"], "print-ivar-layout">, Flags<[CC1Option]>,
   HelpText<"Enable Objective-C Ivar layout bitmap print trace">;
 def print_libgcc_file_name : Flag<["-", "--"], "print-libgcc-file-name">,
-  HelpText<"Print the library path for \"libgcc.a\"">;
+  HelpText<"Print the library path for the currently used compiler runtime "
+   "library (\"libgcc.a\" or \"libclang_rt.builtins.*.a\")">;
 def print_multi_directory : Flag<["-", "--"], "print-multi-directory">;
 def print_multi_lib : Flag<["-", "--"], "print-multi-lib">;
 def print_multi_os_directory : Flag<["-", "--"], "print-multi-os-directory">,
Index: docs/CommandGuide/clang.rst
===
--- docs/CommandGuide/clang.rst
+++ docs/CommandGuide/clang.rst
@@ -394,7 +394,8 @@
 
 .. option:: -print-libgcc-file-name
 
-  Print the library path for "libgcc.a".
+  Print the library path for the currently used compiler runtime library
+  ("libgcc.a" or "libclang_rt.builtins.*.a").
 
 .. option:: -print-prog-name=
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25263: [Driver] Allow setting the default linker during build

2016-10-10 Thread Michał Górny via cfe-commits
mgorny added inline comments.



Comment at: CMakeLists.txt:198
 
+set(CLANG_DEFAULT_LINKER "" CACHE STRING
+  "Default linker to use (\"bfd\" or \"gold\" or \"lld\", empty for platform 
default")

Is there a reason not to allow using the absolute path here, like for the 
command-line option?


Repository:
  rL LLVM

https://reviews.llvm.org/D25263



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


[PATCH] D25402: [Driver] Pass -lunwind when using libc++ + compiler-rt

2016-10-10 Thread Michał Górny via cfe-commits
mgorny added a comment.

In https://reviews.llvm.org/D25402#565557, @joerg wrote:

> No, they are not desirable, in fact, they pretty much break clang. That's why 
> I wanted to see the test diff...


Thank you for your feedback. However, I would really appreciate if you kindly 
said what you meant up front next time instead of requesting me to perform 
pointless work. You should note that your behavior as well as tone is strongly 
discouraging to contributors like me, and I doubt this is really of any benefit 
to anyone.


https://reviews.llvm.org/D25402



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


Re: [libcxx] r283659 - [cmake] Split linked libraries into private & public, for linker script

2016-10-10 Thread Renato Golin via cfe-commits
On 9 October 2016 at 22:45, Eric Fiselier  wrote:
> Hi Renato, Hal,
>
> I've hopefully fixed this in r283700. I'll be watching the bots to ensure
> everything works.

All green, thanks! :)

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


[clang-tools-extra] r283736 - Use `let' instead of `let*' in one place where `let*' isn't necessary

2016-10-10 Thread Manuel Klimek via cfe-commits
Author: klimek
Date: Mon Oct 10 05:22:40 2016
New Revision: 283736

URL: http://llvm.org/viewvc/llvm-project?rev=283736&view=rev
Log:
Use `let' instead of `let*' in one place where `let*' isn't necessary

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

Patch by Philipp Stephani.

Modified:
clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.el

Modified: clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.el
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.el?rev=283736&r1=283735&r2=283736&view=diff
==
--- clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.el (original)
+++ clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.el Mon Oct 
10 05:22:40 2016
@@ -94,9 +94,9 @@ CALLBACK is called after the process fin
 called with a single argument, the buffer where standard output
 has been inserted.  ARGS is a list of additional command line
 arguments.  Return the new process object."
-  (let* ((stdin (current-buffer))
- (stdout (generate-new-buffer "*clang-include-fixer output*"))
- (stderr (generate-new-buffer "*clang-include-fixer errors*")))
+  (let ((stdin (current-buffer))
+(stdout (generate-new-buffer "*clang-include-fixer output*"))
+(stderr (generate-new-buffer "*clang-include-fixer errors*")))
 (make-process :name "clang-include-fixer"
   :buffer stdout
   :command (clang-include-fixer--command args)


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


[PATCH] D25402: [Driver] Pass -lunwind when using libc++ + compiler-rt on Linux

2016-10-10 Thread Michał Górny via cfe-commits
mgorny retitled this revision from "[Driver] Pass -lunwind when using libc++ + 
compiler-rt" to "[Driver] Pass -lunwind when using libc++ + compiler-rt on 
Linux".
mgorny updated the summary for this revision.
mgorny updated this revision to Diff 74115.

https://reviews.llvm.org/D25402

Files:
  lib/Driver/ToolChains.cpp
  lib/Driver/ToolChains.h
  test/Driver/linux-ld.c


Index: test/Driver/linux-ld.c
===
--- test/Driver/linux-ld.c
+++ test/Driver/linux-ld.c
@@ -443,6 +443,20 @@
 // CHECK-BASIC-LIBCXX-C-LINK: "--sysroot=[[SYSROOT]]"
 // CHECK-BASIC-LIBCXX-C-LINK: "-L[[SYSROOT]]/usr/bin/../lib"
 //
+// Test that libc++ combined with compiler-rt includes -lunwind
+// (and no gcc libraries).
+// RUN: %clangxx -no-canonical-prefixes -x c++ %s -### -o %t.o 2>&1 \
+// RUN: -target x86_64-unknown-linux-gnu \
+// RUN: -stdlib=libc++ -rtlib=compiler-rt \
+// RUN: -ccc-install-dir %S/Inputs/basic_linux_tree/usr/bin \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-BASIC-LIBCXX-CLANGRT %s
+// CHECK-BASIC-LIBCXX-CLANGRT: "-lc++" "-lunwind"
+// CHECK-BASIC-LIBCXX-CLANGRT-NOT: "-lgcc_s"
+// CHECK-BASIC-LIBCXX-CLANGRT-NOT: "-lgcc"
+// CHECK-BASIC-LIBCXX-CLANGRT-NOT: "-lgcc_eh"
+//
 // Test a very broken version of multiarch that shipped in Ubuntu 11.04.
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN: --target=i386-unknown-linux \
Index: lib/Driver/ToolChains.h
===
--- lib/Driver/ToolChains.h
+++ lib/Driver/ToolChains.h
@@ -830,6 +830,8 @@
   void AddClangCXXStdlibIncludeArgs(
   const llvm::opt::ArgList &DriverArgs,
   llvm::opt::ArgStringList &CC1Args) const override;
+  void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
+   llvm::opt::ArgStringList &CmdArgs) const override;
   void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs,
   llvm::opt::ArgStringList &CC1Args) const override;
   void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -4692,6 +4692,18 @@
   }
 }
 
+void Linux::AddCXXStdlibLibArgs(const ArgList &Args,
+ArgStringList &CmdArgs) const {
+  ToolChain::AddCXXStdlibLibArgs(Args, CmdArgs);
+
+  // Append -lunwind if using libc++ along with compiler-rt.
+  // With libgcc, gcc_s/gcc_eh already provides the unwinding interface,
+  // and with libstdc++ the unwinding interface is linked in implicitly.
+  if (GetCXXStdlibType(Args) == ToolChain::CST_Libcxx &&
+  GetRuntimeLibType(Args) == ToolChain::RLT_CompilerRT)
+CmdArgs.push_back("-lunwind");
+}
+
 void Linux::AddCudaIncludeArgs(const ArgList &DriverArgs,
ArgStringList &CC1Args) const {
   if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {


Index: test/Driver/linux-ld.c
===
--- test/Driver/linux-ld.c
+++ test/Driver/linux-ld.c
@@ -443,6 +443,20 @@
 // CHECK-BASIC-LIBCXX-C-LINK: "--sysroot=[[SYSROOT]]"
 // CHECK-BASIC-LIBCXX-C-LINK: "-L[[SYSROOT]]/usr/bin/../lib"
 //
+// Test that libc++ combined with compiler-rt includes -lunwind
+// (and no gcc libraries).
+// RUN: %clangxx -no-canonical-prefixes -x c++ %s -### -o %t.o 2>&1 \
+// RUN: -target x86_64-unknown-linux-gnu \
+// RUN: -stdlib=libc++ -rtlib=compiler-rt \
+// RUN: -ccc-install-dir %S/Inputs/basic_linux_tree/usr/bin \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-BASIC-LIBCXX-CLANGRT %s
+// CHECK-BASIC-LIBCXX-CLANGRT: "-lc++" "-lunwind"
+// CHECK-BASIC-LIBCXX-CLANGRT-NOT: "-lgcc_s"
+// CHECK-BASIC-LIBCXX-CLANGRT-NOT: "-lgcc"
+// CHECK-BASIC-LIBCXX-CLANGRT-NOT: "-lgcc_eh"
+//
 // Test a very broken version of multiarch that shipped in Ubuntu 11.04.
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN: --target=i386-unknown-linux \
Index: lib/Driver/ToolChains.h
===
--- lib/Driver/ToolChains.h
+++ lib/Driver/ToolChains.h
@@ -830,6 +830,8 @@
   void AddClangCXXStdlibIncludeArgs(
   const llvm::opt::ArgList &DriverArgs,
   llvm::opt::ArgStringList &CC1Args) const override;
+  void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
+   llvm::opt::ArgStringList &CmdArgs) const override;
   void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs,
   llvm::opt::ArgStringList &CC1Args) const override;
   void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
Index: lib/Driver/ToolChains.cpp
==

[PATCH] D25402: [Driver] Pass -lunwind when using libc++ + compiler-rt on Linux

2016-10-10 Thread Michał Górny via cfe-commits
mgorny added a comment.

I've updated the patch to apply to Linux toolchain only.


https://reviews.llvm.org/D25402



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


[PATCH] D25363: Store a SourceRange for multi-token builtin types

2016-10-10 Thread Malcolm Parsons via cfe-commits
malcolm.parsons updated this revision to Diff 74117.
malcolm.parsons added a comment.

Ensure SourceRange is initialized


https://reviews.llvm.org/D25363

Files:
  include/clang/AST/TypeLoc.h
  include/clang/Sema/DeclSpec.h
  lib/Sema/DeclSpec.cpp
  lib/Sema/SemaType.cpp

Index: lib/Sema/SemaType.cpp
===
--- lib/Sema/SemaType.cpp
+++ lib/Sema/SemaType.cpp
@@ -4919,11 +4919,9 @@
 TL.getWrittenBuiltinSpecs() = DS.getWrittenBuiltinSpecs();
 // Try to have a meaningful source location.
 if (TL.getWrittenSignSpec() != TSS_unspecified)
-  // Sign spec loc overrides the others (e.g., 'unsigned long').
-  TL.setBuiltinLoc(DS.getTypeSpecSignLoc());
-else if (TL.getWrittenWidthSpec() != TSW_unspecified)
-  // Width spec loc overrides type spec loc (e.g., 'short int').
-  TL.setBuiltinLoc(DS.getTypeSpecWidthLoc());
+  TL.expandBuiltinRange(DS.getTypeSpecSignLoc());
+if (TL.getWrittenWidthSpec() != TSW_unspecified)
+  TL.expandBuiltinRange(DS.getTypeSpecWidthRange());
   }
 }
 void VisitElaboratedTypeLoc(ElaboratedTypeLoc TL) {
Index: lib/Sema/DeclSpec.cpp
===
--- lib/Sema/DeclSpec.cpp
+++ lib/Sema/DeclSpec.cpp
@@ -610,14 +610,16 @@
 const char *&PrevSpec,
 unsigned &DiagID,
 const PrintingPolicy &Policy) {
-  // Overwrite TSWLoc only if TypeSpecWidth was unspecified, so that
+  // Overwrite TSWRange.Begin only if TypeSpecWidth was unspecified, so that
   // for 'long long' we will keep the source location of the first 'long'.
   if (TypeSpecWidth == TSW_unspecified)
-TSWLoc = Loc;
+TSWRange.setBegin(Loc);
   // Allow turning long -> long long.
   else if (W != TSW_longlong || TypeSpecWidth != TSW_long)
 return BadSpecifier(W, (TSW)TypeSpecWidth, PrevSpec, DiagID);
   TypeSpecWidth = W;
+  // Remember location of the last 'long'
+  TSWRange.setEnd(Loc);
   return false;
 }
 
@@ -997,9 +999,9 @@
TypeQualifiers)) {
 const unsigned NumLocs = 9;
 SourceLocation ExtraLocs[NumLocs] = {
-  TSWLoc, TSCLoc, TSSLoc, AltiVecLoc,
-  TQ_constLoc, TQ_restrictLoc, TQ_volatileLoc, TQ_atomicLoc, TQ_unalignedLoc
-};
+TSWRange.getBegin(), TSCLoc,   TSSLoc,
+AltiVecLoc,  TQ_constLoc,  TQ_restrictLoc,
+TQ_volatileLoc,  TQ_atomicLoc, TQ_unalignedLoc};
 FixItHint Hints[NumLocs];
 SourceLocation FirstLoc;
 for (unsigned I = 0; I != NumLocs; ++I) {
@@ -1041,8 +1043,8 @@
   // Only 'short' and 'long long' are valid with vector bool. (PIM 2.1)
   if ((TypeSpecWidth != TSW_unspecified) && (TypeSpecWidth != TSW_short) &&
   (TypeSpecWidth != TSW_longlong))
-S.Diag(TSWLoc, diag::err_invalid_vector_bool_decl_spec)
-  << getSpecifierName((TSW)TypeSpecWidth);
+S.Diag(TSWRange.getBegin(), diag::err_invalid_vector_bool_decl_spec)
+<< getSpecifierName((TSW)TypeSpecWidth);
 
   // vector bool long long requires VSX support or ZVector.
   if ((TypeSpecWidth == TSW_longlong) &&
@@ -1059,7 +1061,8 @@
   // vector long double and vector long long double are never allowed.
   // vector double is OK for Power7 and later, and ZVector.
   if (TypeSpecWidth == TSW_long || TypeSpecWidth == TSW_longlong)
-S.Diag(TSWLoc, diag::err_invalid_vector_long_double_decl_spec);
+S.Diag(TSWRange.getBegin(),
+   diag::err_invalid_vector_long_double_decl_spec);
   else if (!S.Context.getTargetInfo().hasFeature("vsx") &&
!S.getLangOpts().ZVector)
 S.Diag(TSTLoc, diag::err_invalid_vector_double_decl_spec);
@@ -1070,10 +1073,11 @@
 } else if (TypeSpecWidth == TSW_long) {
   // vector long is unsupported for ZVector and deprecated for AltiVec.
   if (S.getLangOpts().ZVector)
-S.Diag(TSWLoc, diag::err_invalid_vector_long_decl_spec);
+S.Diag(TSWRange.getBegin(), diag::err_invalid_vector_long_decl_spec);
   else
-S.Diag(TSWLoc, diag::warn_vector_long_decl_spec_combination)
-  << getSpecifierName((TST)TypeSpecType, Policy);
+S.Diag(TSWRange.getBegin(),
+   diag::warn_vector_long_decl_spec_combination)
+<< getSpecifierName((TST)TypeSpecType, Policy);
 }
 
 if (TypeAltiVecPixel) {
@@ -1106,18 +1110,18 @@
 if (TypeSpecType == TST_unspecified)
   TypeSpecType = TST_int; // short -> short int, long long -> long long int.
 else if (TypeSpecType != TST_int) {
-  S.Diag(TSWLoc, diag::err_invalid_width_spec) << (int)TypeSpecWidth
-<<  getSpecifierName((TST)TypeSpecType, Policy);
+  S.Diag(TSWRange.getBegin(), diag::err_invalid_width_spec)
+  << (int)TypeSpecWidth << getSpecifierName((TST)TypeSpecType, Policy);
   TypeSpecType = TST_in

[PATCH] D24799: [XRay] Check in Clang whether XRay supports the target when -fxray-instrument is passed

2016-10-10 Thread Dean Michael Berris via cfe-commits
dberris requested changes to this revision.
dberris added a comment.
This revision now requires changes to proceed.

Sorry, I forgot to update the status. I made a few more comments to make this 
part a little more readable.


https://reviews.llvm.org/D24799



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


[PATCH] D25402: [Driver] Pass -lunwind when using libc++ + compiler-rt on Linux

2016-10-10 Thread Joerg Sonnenberger via cfe-commits
joerg added a comment.

It's difficult to say whether if one change to certain driver functions affect 
some target or not. That's one reason why the test change is so important.

Looking at the latest version, I still don't understand why the change for 
Linux is needed. libc++ should provide a linker script now and that should 
include -lunwind as appropriate.


https://reviews.llvm.org/D25402



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


Re: r283716 - [x86][inline-asm][clang] accept 'v' constraint

2016-10-10 Thread Ismail Donmez via cfe-commits
Hi,

On Mon, Oct 10, 2016 at 8:45 AM, Michael Zuckerman via cfe-commits
 wrote:
> Author: mzuckerm
> Date: Mon Oct 10 00:45:54 2016
> New Revision: 283716
>
> URL: http://llvm.org/viewvc/llvm-project?rev=283716&view=rev
> Log:
> [x86][inline-asm][clang] accept 'v' constraint
>
> Commit in the name of: Coby Tayree
>
> 1.'v' constraint for (x86) non-avx arch imitates the already implemented 'x' 
> constraint, i.e. allows XMM{0-15} & YMM{0-15} depending on the apparent arch 
> & mode (32/64).
> 2.for the avx512 arch it allows [X,Y,Z]MM{0-31} (mode dependent)
>
> This patch applies the needed changes to clang
>  LLVM patch: https://reviews.llvm.org/D25005
>
> Differential Revision: D25004

This fails on Linux x86-64:

 --
Exit Code: 1

Command Output (stderr):
--
/home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/CodeGen/x86-inline-asm-v-constraint.c:10:9:
error: expected string not found in input
// SSE: call <4 x float> asm "vmovhlps $1, $2, $0",
"=v,v,v,~{dirflag},~{fpsr},~{flags}"(i64 %0, <4 x float> %1)
^
:1:1: note: scanning from here
 ; ModuleID = 
'/home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/CodeGen/x86-inline-asm-v-constraint.c'
 ^
:14:7: note: possible intended match here
%3 = call <4 x float> asm "vmovhlps $1, $2, $0",
"=v,v,v,~{dirflag},~{fpsr},~{flags}"(i64 %1, <4 x float> %2) #1,
!srcloc !1
  ^

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


r283743 - Revert "[x86][inline-asm][clang] accept 'v' constraint"

2016-10-10 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Mon Oct 10 06:40:28 2016
New Revision: 283743

URL: http://llvm.org/viewvc/llvm-project?rev=283743&view=rev
Log:
Revert "[x86][inline-asm][clang] accept 'v' constraint"

This reverts commit r283716.

Breaks buildbot:
http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_check/9155/testReport/junit/Clang/CodeGen/x86_inline_asm_v_constraint_c/

Removed:
cfe/trunk/test/CodeGen/x86-inline-asm-v-constraint.c
Modified:
cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=283743&r1=283742&r2=283743&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Oct 10 06:40:28 2016
@@ -4005,7 +4005,6 @@ X86TargetInfo::validateAsmConstraint(con
   case 'u': // Second from top of floating point stack.
   case 'q': // Any register accessible as [r]l: a, b, c, and d.
   case 'y': // Any MMX register.
-  case 'v': // Any {X,Y,Z}MM register (Arch & context dependent)
   case 'x': // Any SSE register.
   case 'Q': // Any register accessible as [r]h: a, b, c, and d.
   case 'R': // "Legacy" registers: ax, bx, cx, dx, di, si, sp, bp.
@@ -4046,7 +4045,6 @@ bool X86TargetInfo::validateOperandSize(
   case 't':
   case 'u':
 return Size <= 128;
-  case 'v':
   case 'x':
 if (SSELevel >= AVX512F)
   // 512-bit zmm registers can be used if target supports AVX512F.

Removed: cfe/trunk/test/CodeGen/x86-inline-asm-v-constraint.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86-inline-asm-v-constraint.c?rev=283742&view=auto
==
--- cfe/trunk/test/CodeGen/x86-inline-asm-v-constraint.c (original)
+++ cfe/trunk/test/CodeGen/x86-inline-asm-v-constraint.c (removed)
@@ -1,30 +0,0 @@
-// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -target-cpu 
x86-64 -o - | FileCheck %s --check-prefix SSE
-// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -target-cpu 
skylake -D AVX -o - | FileCheck %s --check-prefixes AVX,SSE
-// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -target-cpu 
skylake-avx512 -D AVX512 -D AVX -o - | FileCheck %s --check-prefixes 
AVX512,AVX,SSE
-// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -target-cpu 
knl -D AVX -D AVX512 -o - | FileCheck %s --check-prefixes AVX512,AVX,SSE
-
-typedef float __m128 __attribute__ ((vector_size (16)));
-typedef float __m256 __attribute__ ((vector_size (32)));
-typedef float __m512 __attribute__ ((vector_size (64)));
-
-// SSE: call <4 x float> asm "vmovhlps $1, $2, $0", 
"=v,v,v,~{dirflag},~{fpsr},~{flags}"(i64 %0, <4 x float> %1)
-__m128 testXMM(__m128 _xmm0, long _l) {
-  __asm__("vmovhlps %1, %2, %0" :"=v"(_xmm0) : "v"(_l), "v"(_xmm0));
-  return _xmm0;
-}
-
-// AVX: call <8 x float> asm "vmovsldup $1, $0", 
"=v,v,~{dirflag},~{fpsr},~{flags}"(<8 x float> %0)
-__m256 testYMM(__m256 _ymm0) {
-#ifdef AVX
-  __asm__("vmovsldup %1, %0" :"=v"(_ymm0) : "v"(_ymm0));
-#endif
-  return _ymm0;
-}
-
-// AVX512: call <16 x float> asm "vpternlogd $$0, $1, $2, $0", 
"=v,v,v,~{dirflag},~{fpsr},~{flags}"(<16 x float> %0, <16 x float> %1)
-__m512 testZMM(__m512 _zmm0, __m512 _zmm1) {
-#ifdef AVX512
-  __asm__("vpternlogd $0, %1, %2, %0" :"=v"(_zmm0) : "v"(_zmm1), "v"(_zmm0));
-#endif
-  return _zmm0;
-}


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


Re: r283716 - [x86][inline-asm][clang] accept 'v' constraint

2016-10-10 Thread Daniel Jasper via cfe-commits
I have reverted this in r283743 for now.

On Mon, Oct 10, 2016 at 1:43 PM, Ismail Donmez via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Hi,
>
> On Mon, Oct 10, 2016 at 8:45 AM, Michael Zuckerman via cfe-commits
>  wrote:
> > Author: mzuckerm
> > Date: Mon Oct 10 00:45:54 2016
> > New Revision: 283716
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=283716&view=rev
> > Log:
> > [x86][inline-asm][clang] accept 'v' constraint
> >
> > Commit in the name of: Coby Tayree
> >
> > 1.'v' constraint for (x86) non-avx arch imitates the already implemented
> 'x' constraint, i.e. allows XMM{0-15} & YMM{0-15} depending on the apparent
> arch & mode (32/64).
> > 2.for the avx512 arch it allows [X,Y,Z]MM{0-31} (mode dependent)
> >
> > This patch applies the needed changes to clang
> >  LLVM patch: https://reviews.llvm.org/D25005
> >
> > Differential Revision: D25004
>
> This fails on Linux x86-64:
>
>  --
> Exit Code: 1
>
> Command Output (stderr):
> --
> /home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/CodeGen/
> x86-inline-asm-v-constraint.c:10:9:
> error: expected string not found in input
> // SSE: call <4 x float> asm "vmovhlps $1, $2, $0",
> "=v,v,v,~{dirflag},~{fpsr},~{flags}"(i64 %0, <4 x float> %1)
> ^
> :1:1: note: scanning from here
>  ; ModuleID = '/home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/CodeGen/
> x86-inline-asm-v-constraint.c'
>  ^
> :14:7: note: possible intended match here
> %3 = call <4 x float> asm "vmovhlps $1, $2, $0",
> "=v,v,v,~{dirflag},~{fpsr},~{flags}"(i64 %1, <4 x float> %2) #1,
> !srcloc !1
>   ^
>
> --
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25402: [Driver] Pass -lunwind when using libc++ + compiler-rt on Linux

2016-10-10 Thread Michał Górny via cfe-commits
mgorny added a comment.

In https://reviews.llvm.org/D25402#566070, @joerg wrote:

> It's difficult to say whether if one change to certain driver functions 
> affect some target or not. That's one reason why the test change is so 
> important.
>
> Looking at the latest version, I still don't understand why the change for 
> Linux is needed. libc++ should provide a linker script now and that should 
> include -lunwind as appropriate.


Most importantly, the linker script can't predict which -rtlib will be used and 
therefore whether -lgcc_s or -lunwind should be used.


https://reviews.llvm.org/D25402



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


[PATCH] D25338: [Driver] Make -print-libgcc-file-name print compiler-rt lib when used

2016-10-10 Thread Gabor Greif via cfe-commits
ggreif accepted this revision.
ggreif added a comment.
This revision is now accepted and ready to land.

LGTM.


https://reviews.llvm.org/D25338



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


r283746 - [Driver] Make -print-libgcc-file-name print compiler-rt lib when used

2016-10-10 Thread Michal Gorny via cfe-commits
Author: mgorny
Date: Mon Oct 10 07:23:40 2016
New Revision: 283746

URL: http://llvm.org/viewvc/llvm-project?rev=283746&view=rev
Log:
[Driver] Make -print-libgcc-file-name print compiler-rt lib when used

Make the -print-libgcc-file-name option print an appropriate compiler
runtime library, that is libgcc.a if gcc runtime is used
and an appropriate compiler-rt library if that runtime is used.

The main use for this is to allow linking executables built with
-nodefaultlibs (e.g. to avoid linking to the standard C++ library) to
the compiler runtime library, e.g. using:

  clang++ ... -nodefaultlibs $(clang++ ... -print-libgcc-file-name)

in which case currently a program built like this linked to the gcc
runtime unconditionally. The patch fixes it to use compiler-rt libraries
instead when compiler-rt is the active runtime.

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

Added:
cfe/trunk/test/Driver/print-libgcc-file-name-clangrt.c
cfe/trunk/test/Driver/print-libgcc-file-name-libgcc.c
Modified:
cfe/trunk/docs/CommandGuide/clang.rst
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/test/Driver/montavista-gcc-toolchain.c
cfe/trunk/test/lit.cfg

Modified: cfe/trunk/docs/CommandGuide/clang.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/CommandGuide/clang.rst?rev=283746&r1=283745&r2=283746&view=diff
==
--- cfe/trunk/docs/CommandGuide/clang.rst (original)
+++ cfe/trunk/docs/CommandGuide/clang.rst Mon Oct 10 07:23:40 2016
@@ -394,7 +394,8 @@ Driver Options
 
 .. option:: -print-libgcc-file-name
 
-  Print the library path for "libgcc.a".
+  Print the library path for the currently used compiler runtime library
+  ("libgcc.a" or "libclang_rt.builtins.*.a").
 
 .. option:: -print-prog-name=
 

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=283746&r1=283745&r2=283746&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Mon Oct 10 07:23:40 2016
@@ -1861,7 +1861,8 @@ def print_file_name_EQ : Joined<["-", "-
 def print_ivar_layout : Flag<["-"], "print-ivar-layout">, Flags<[CC1Option]>,
   HelpText<"Enable Objective-C Ivar layout bitmap print trace">;
 def print_libgcc_file_name : Flag<["-", "--"], "print-libgcc-file-name">,
-  HelpText<"Print the library path for \"libgcc.a\"">;
+  HelpText<"Print the library path for the currently used compiler runtime "
+   "library (\"libgcc.a\" or \"libclang_rt.builtins.*.a\")">;
 def print_multi_directory : Flag<["-", "--"], "print-multi-directory">;
 def print_multi_lib : Flag<["-", "--"], "print-multi-lib">;
 def print_multi_os_directory : Flag<["-", "--"], "print-multi-os-directory">,

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=283746&r1=283745&r2=283746&view=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Mon Oct 10 07:23:40 2016
@@ -994,7 +994,15 @@ bool Driver::HandleImmediateArgs(const C
   }
 
   if (C.getArgs().hasArg(options::OPT_print_libgcc_file_name)) {
-llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
+ToolChain::RuntimeLibType RLT = TC.GetRuntimeLibType(C.getArgs());
+switch (RLT) {
+case ToolChain::RLT_CompilerRT:
+  llvm::outs() << TC.getCompilerRT(C.getArgs(), "builtins") << "\n";
+  break;
+case ToolChain::RLT_Libgcc:
+  llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
+  break;
+}
 return false;
   }
 

Modified: cfe/trunk/test/Driver/montavista-gcc-toolchain.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/montavista-gcc-toolchain.c?rev=283746&r1=283745&r2=283746&view=diff
==
--- cfe/trunk/test/Driver/montavista-gcc-toolchain.c (original)
+++ cfe/trunk/test/Driver/montavista-gcc-toolchain.c Mon Oct 10 07:23:40 2016
@@ -1,6 +1,6 @@
 // Test that the montavista gcc-toolchain is correctly detected
 //
-// RUN: %clang -print-libgcc-file-name 2>&1 \
+// RUN: %clang -rtlib=platform -print-libgcc-file-name 2>&1 \
 // RUN: --target=i686-montavista-linux \
 // RUN: --gcc-toolchain=%S/Inputs/montavista_i686_tree/usr \
 // RUN:   | FileCheck %s

Added: cfe/trunk/test/Driver/print-libgcc-file-name-clangrt.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/print-libgcc-file-name-clangrt.c?rev=283746&view=auto
==
--- cfe/trunk/test/Driver/print-libgcc-file-name-clangrt.c (added)
+++ cfe/trunk/test/Driver/print-libgcc-file-name-clangrt.c Mon Oct 10 07:2

[PATCH] D25338: [Driver] Make -print-libgcc-file-name print compiler-rt lib when used

2016-10-10 Thread Michał Górny via cfe-commits
mgorny added a comment.

Thanks for the review.


https://reviews.llvm.org/D25338



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


RE: r283716 - [x86][inline-asm][clang] accept 'v' constraint

2016-10-10 Thread Zuckerman, Michael via cfe-commits
Thanks ,
We will check it.

From: Daniel Jasper [mailto:djas...@google.com]
Sent: Monday, October 10, 2016 14:50
To: Ismail Donmez 
Cc: Zuckerman, Michael ; cfe-commits 

Subject: Re: r283716 - [x86][inline-asm][clang] accept 'v' constraint

I have reverted this in r283743 for now.

On Mon, Oct 10, 2016 at 1:43 PM, Ismail Donmez via cfe-commits 
mailto:cfe-commits@lists.llvm.org>> wrote:
Hi,

On Mon, Oct 10, 2016 at 8:45 AM, Michael Zuckerman via cfe-commits
mailto:cfe-commits@lists.llvm.org>> wrote:
> Author: mzuckerm
> Date: Mon Oct 10 00:45:54 2016
> New Revision: 283716
>
> URL: http://llvm.org/viewvc/llvm-project?rev=283716&view=rev
> Log:
> [x86][inline-asm][clang] accept 'v' constraint
>
> Commit in the name of: Coby Tayree
>
> 1.'v' constraint for (x86) non-avx arch imitates the already implemented 'x' 
> constraint, i.e. allows XMM{0-15} & YMM{0-15} depending on the apparent arch 
> & mode (32/64).
> 2.for the avx512 arch it allows [X,Y,Z]MM{0-31} (mode dependent)
>
> This patch applies the needed changes to clang
>  LLVM patch: https://reviews.llvm.org/D25005
>
> Differential Revision: D25004

This fails on Linux x86-64:

 --
Exit Code: 1

Command Output (stderr):
--
/home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/CodeGen/x86-inline-asm-v-constraint.c:10:9:
error: expected string not found in input
// SSE: call <4 x float> asm "vmovhlps $1, $2, $0",
"=v,v,v,~{dirflag},~{fpsr},~{flags}"(i64 %0, <4 x float> %1)
^
:1:1: note: scanning from here
 ; ModuleID = 
'/home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/CodeGen/x86-inline-asm-v-constraint.c'
 ^
:14:7: note: possible intended match here
%3 = call <4 x float> asm "vmovhlps $1, $2, $0",
"=v,v,v,~{dirflag},~{fpsr},~{flags}"(i64 %1, <4 x float> %2) #1,
!srcloc !1
  ^

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

-
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25431: [libcxx] [CMake] Build Solaris compat as separate C lib, to avoid -std= issues

2016-10-10 Thread Michał Górny via cfe-commits
mgorny created this revision.
mgorny added reviewers: EricWF, theraven.
mgorny added a subscriber: cfe-commits.
Herald added a subscriber: beanz.

Build the Solaris compatibility code (C) as a separate static library
rather than appending it to libc++ sources, in order to prevent
the -std=c++11 flag from being used for C code as it causes build
failure with clang.


https://reviews.llvm.org/D25431

Files:
  lib/CMakeLists.txt


Index: lib/CMakeLists.txt
===
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -7,7 +7,8 @@
   list(APPEND LIBCXX_SOURCES ${LIBCXX_WIN32_SOURCES})
 elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS")
   file(GLOB LIBCXX_SOLARIS_SOURCES ../src/support/solaris/*.c)
-  list(APPEND LIBCXX_SOURCES ${LIBCXX_SOLARIS_SOURCES})
+  add_library(libcxx_solaris_compat STATIC ${LIBCXX_SOLARIS_SOURCES})
+  add_library_flags(libcxx_solaris_compat)
 endif()
 
 # Add all the headers to the project for IDEs.


Index: lib/CMakeLists.txt
===
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -7,7 +7,8 @@
   list(APPEND LIBCXX_SOURCES ${LIBCXX_WIN32_SOURCES})
 elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS")
   file(GLOB LIBCXX_SOLARIS_SOURCES ../src/support/solaris/*.c)
-  list(APPEND LIBCXX_SOURCES ${LIBCXX_SOLARIS_SOURCES})
+  add_library(libcxx_solaris_compat STATIC ${LIBCXX_SOLARIS_SOURCES})
+  add_library_flags(libcxx_solaris_compat)
 endif()
 
 # Add all the headers to the project for IDEs.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25431: [libcxx] [CMake] Build Solaris compat as separate C lib, to avoid -std= issues

2016-10-10 Thread David Chisnall via cfe-commits
theraven added a comment.

It sounds as if the bug here is either that the .c files are being treated as 
c++, or that we're sticking -std=c++{whatever} in CFLAGS as well as CXXFLAGS.  
This is probably the bug that should be fixed.


https://reviews.llvm.org/D25431



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


[PATCH] D25431: [libcxx] [CMake] Build Solaris compat as separate C lib, to avoid -std= issues

2016-10-10 Thread Michał Górny via cfe-commits
mgorny added a comment.

In https://reviews.llvm.org/D25431#566096, @theraven wrote:

> It sounds as if the bug here is either that the .c files are being treated as 
> c++, or that we're sticking -std=c++{whatever} in CFLAGS as well as CXXFLAGS. 
>  This is probably the bug that should be fixed.


We're sticking them into LIBCXX_COMPILE_FLAGS, to be more precise. And this is 
the only C file in the whole libcxx, so I'm not sure if anyone even remember 
about that ;-).


https://reviews.llvm.org/D25431



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


[PATCH] D24339: [clang-tidy] Add check 'readability-redundant-member-init'

2016-10-10 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!


https://reviews.llvm.org/D24339



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


[PATCH] D25238: [clang-tidy] Ignore empty members and bases in cppcoreguidelines-pro-type-member-init

2016-10-10 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM, with one small commenting nit.




Comment at: clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp:320
 
+// copied from clang/lib/Sema/SemaDeclCXX.cpp
+static bool isIncompleteOrZeroLengthArrayType(ASTContext &Context, QualType T) 
{

Comments should be complete sentences (capitalization, punctuation, etc), 
however, I'm not certain that this comment adds value as is. I would mark it a 
FIXME because copy-paste code is bad.


https://reviews.llvm.org/D25238



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


[PATCH] D24669: {Sema] Gcc compatibility of vector shift.

2016-10-10 Thread Vladimir Yakovlev via cfe-commits
vbyakovlcl updated this revision to Diff 74123.

https://reviews.llvm.org/D24669

Files:
  llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td
  llvm/tools/clang/lib/Sema/SemaExpr.cpp
  llvm/tools/clang/test/CodeGen/vecshift.c
  llvm/tools/clang/test/Sema/vecshift.c

Index: llvm/tools/clang/lib/Sema/SemaExpr.cpp
===
--- llvm/tools/clang/lib/Sema/SemaExpr.cpp
+++ llvm/tools/clang/lib/Sema/SemaExpr.cpp
@@ -8784,6 +8784,20 @@
 << LHS.get()->getSourceRange() << RHS.get()->getSourceRange();
   return QualType();
 }
+if (!S.LangOpts.OpenCL && !S.LangOpts.ZVector) {
+  const BuiltinType *LHSBT = LHSEleType->getAs();
+  const BuiltinType *RHSBT = RHSEleType->getAs();
+  if (LHSBT != RHSBT &&
+  S.Context.getTypeSize(LHSBT) != S.Context.getTypeSize(RHSBT)) {
+S.Diag(Loc, diag::warn_typecheck_vector_element_sizes_not_equal)
+<< LHS.get()->getType() << RHS.get()->getType()
+<< LHS.get()->getSourceRange() << RHS.get()->getSourceRange();
+if (S.Diags.getDiagnosticLevel(
+diag::warn_typecheck_vector_element_sizes_not_equal, Loc) ==
+DiagnosticsEngine::Level::Error)
+  return QualType();
+  }
+}
   } else {
 // ...else expand RHS to match the number of elements in LHS.
 QualType VecTy =
Index: llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -2301,6 +2301,9 @@
   "cannot convert between vector and non-scalar values (%0 and %1)">;
 def err_typecheck_vector_lengths_not_equal : Error<
   "vector operands do not have the same number of elements (%0 and %1)">;
+def warn_typecheck_vector_element_sizes_not_equal : Warning<
+  "vector operands do not have the same elements sizes (%0 and %1)">,
+  InGroup>, DefaultError;
 def err_ext_vector_component_exceeds_length : Error<
   "vector component access exceeds type %0">;
 def err_ext_vector_component_name_illegal : Error<
Index: llvm/tools/clang/test/CodeGen/vecshift.c
===
--- llvm/tools/clang/test/CodeGen/vecshift.c
+++ llvm/tools/clang/test/CodeGen/vecshift.c
@@ -1,5 +1,7 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1  -Wno-error-vec-elem-size -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1  -Wno-error-vec-elem-size -DEXT -emit-llvm %s -o - | FileCheck %s
 
+#ifdef EXT
 typedef __attribute__((__ext_vector_type__(8))) char vector_char8;
 typedef __attribute__((__ext_vector_type__(8))) short vector_short8;
 typedef __attribute__((__ext_vector_type__(8))) int vector_int8;
@@ -12,6 +14,20 @@
 typedef __attribute__((__ext_vector_type__(4))) unsigned char vector_uchar4;
 typedef __attribute__((__ext_vector_type__(4))) unsigned short vector_ushort4;
 typedef __attribute__((__ext_vector_type__(4))) unsigned int vector_uint4;
+#else
+typedef __attribute__((vector_size(8))) char vector_char8;
+typedef __attribute__((vector_size(16))) short vector_short8;
+typedef __attribute__((vector_size(32))) int vector_int8;
+typedef __attribute__((vector_size(8))) unsigned char vector_uchar8;
+typedef __attribute__((vector_size(16))) unsigned short vector_ushort8;
+typedef __attribute__((vector_size(32))) unsigned int vector_uint8;
+typedef __attribute__((vector_size(4))) char vector_char4;
+typedef __attribute__((vector_size(4))) short vector_short4;
+typedef __attribute__((vector_size(16))) int vector_int4;
+typedef __attribute__((vector_size(4))) unsigned char vector_uchar4;
+typedef __attribute__((vector_size(8))) unsigned short vector_ushort4;
+typedef __attribute__((vector_size(16))) unsigned int vector_uint4;
+#endif
 
 char c;
 short s;
Index: llvm/tools/clang/test/Sema/vecshift.c
===
--- llvm/tools/clang/test/Sema/vecshift.c
+++ llvm/tools/clang/test/Sema/vecshift.c
@@ -1,5 +1,9 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -DERR -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-error-vec-elem-size -verify %s
+// RUN: %clang_cc1 -fsyntax-only -DEXT -DERR -verify %s
+// RUN: %clang_cc1 -fsyntax-only -DEXT -Wno-error-vec-elem-size -verify %s
 
+#ifdef EXT
 typedef __attribute__((__ext_vector_type__(8))) char vector_char8;
 typedef __attribute__((__ext_vector_type__(8))) short vector_short8;
 typedef __attribute__((__ext_vector_type__(8))) int vector_int8;
@@ -12,6 +16,20 @@
 typedef __attribute__((__ext_vector_type__(4))) unsigned char vector_uchar4;
 typedef __attribute__((__ext_vector_type__(4))) unsigned short vector_ushort4;
 typedef __attribute__((__ext_vector_type__(4))) unsigned int vector_uint4;
+#else
+typedef __attribute__((vector_size(8))) char vector_char8;
+typedef __attribute__

[PATCH] D24669: {Sema] Gcc compatibility of vector shift.

2016-10-10 Thread Vladimir Yakovlev via cfe-commits
vbyakovlcl added inline comments.



Comment at: llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td:2306
+  "vector operands do not have the same elements sizes (%0 and %1)">,
+  InGroup>, DefaultError;
 def err_ext_vector_component_exceeds_length : Error<

bruno wrote:
> Although the motivation is to support the same warning present in GCC, I 
> think this is helpful enough anyway so that we might skip calling it 
> "gnu-vec-elem-size" and have a more generic name instead? How about plain 
> "vec-elem-size"?
I'm agree.



Comment at: llvm/tools/clang/lib/Sema/SemaExpr.cpp:8787
 }
+if (!S.LangOpts.OpenCL && !S.LangOpts.ZVector) {
+  const BuiltinType *LHSBT = LHSEleType->getAs();

bruno wrote:
> Besides `__ext_vector_type__`, would this also trigger for `vector_size`? 
> Right now this is an error for `vector_size` primarily because the number of 
> elements is different, can you confirm this won't change?
I compare vector element sizes, so there must not be any differencies caused by 
different triggers. I added additional type definitions to the tests. All 
compiles fain.


https://reviews.llvm.org/D24669



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


[PATCH] D25363: Store a SourceRange for multi-token builtin types

2016-10-10 Thread Malcolm Parsons via cfe-commits
malcolm.parsons updated this revision to Diff 74124.
malcolm.parsons added a comment.

Add unit tests


https://reviews.llvm.org/D25363

Files:
  include/clang/AST/TypeLoc.h
  include/clang/Sema/DeclSpec.h
  lib/Sema/DeclSpec.cpp
  lib/Sema/SemaType.cpp
  unittests/AST/SourceLocationTest.cpp

Index: unittests/AST/SourceLocationTest.cpp
===
--- unittests/AST/SourceLocationTest.cpp
+++ unittests/AST/SourceLocationTest.cpp
@@ -148,6 +148,84 @@
  varDecl(), Lang_C89));
 }
 
+TEST(TypeLoc, IntRange) {
+  RangeVerifier Verifier;
+  Verifier.expectRange(1, 1, 1, 1);
+  EXPECT_TRUE(Verifier.match("int a;", typeLoc()));
+}
+
+TEST(TypeLoc, LongRange) {
+  RangeVerifier Verifier;
+  Verifier.expectRange(1, 1, 1, 1);
+  EXPECT_TRUE(Verifier.match("long a;", typeLoc()));
+}
+
+TEST(TypeLoc, LongIntRange) {
+  RangeVerifier Verifier;
+  Verifier.expectRange(1, 1, 1, 6);
+  EXPECT_TRUE(Verifier.match("long int a;", typeLoc()));
+}
+
+TEST(TypeLoc, IntLongRange) {
+  RangeVerifier Verifier;
+  Verifier.expectRange(1, 1, 1, 5);
+  EXPECT_TRUE(Verifier.match("int long a;", typeLoc()));
+}
+
+TEST(TypeLoc, UnsignedIntRange) {
+  RangeVerifier Verifier;
+  Verifier.expectRange(1, 1, 1, 10);
+  EXPECT_TRUE(Verifier.match("unsigned int a;", typeLoc()));
+}
+
+TEST(TypeLoc, IntUnsignedRange) {
+  RangeVerifier Verifier;
+  Verifier.expectRange(1, 1, 1, 5);
+  EXPECT_TRUE(Verifier.match("int unsigned a;", typeLoc()));
+}
+
+TEST(TypeLoc, LongLongRange) {
+  RangeVerifier Verifier;
+  Verifier.expectRange(1, 1, 1, 6);
+  EXPECT_TRUE(Verifier.match("long long a;", typeLoc()));
+}
+
+TEST(TypeLoc, UnsignedLongLongRange) {
+  RangeVerifier Verifier;
+  Verifier.expectRange(1, 1, 1, 15);
+  EXPECT_TRUE(Verifier.match("unsigned long long a;", typeLoc()));
+}
+
+TEST(TypeLoc, LongUnsignedLongRange) {
+  RangeVerifier Verifier;
+  Verifier.expectRange(1, 1, 1, 15);
+  EXPECT_TRUE(Verifier.match("long unsigned long a;", typeLoc()));
+}
+
+TEST(TypeLoc, LongLongUnsignedRange) {
+  RangeVerifier Verifier;
+  Verifier.expectRange(1, 1, 1, 11);
+  EXPECT_TRUE(Verifier.match("long long unsigned a;", typeLoc()));
+}
+
+TEST(TypeLoc, ConstLongLongRange) {
+  RangeVerifier Verifier;
+  Verifier.expectRange(1, 7, 1, 12);
+  EXPECT_TRUE(Verifier.match("const long long a = 0;", typeLoc()));
+}
+
+TEST(TypeLoc, LongConstLongRange) {
+  RangeVerifier Verifier;
+  Verifier.expectRange(1, 1, 1, 12);
+  EXPECT_TRUE(Verifier.match("long const long a = 0;", typeLoc()));
+}
+
+TEST(TypeLoc, LongLongConstRange) {
+  RangeVerifier Verifier;
+  Verifier.expectRange(1, 1, 1, 6);
+  EXPECT_TRUE(Verifier.match("long long const a = 0;", typeLoc()));
+}
+
 TEST(CXXConstructorDecl, NoRetFunTypeLocRange) {
   RangeVerifier Verifier;
   Verifier.expectRange(1, 11, 1, 13);
Index: lib/Sema/SemaType.cpp
===
--- lib/Sema/SemaType.cpp
+++ lib/Sema/SemaType.cpp
@@ -4919,11 +4919,9 @@
 TL.getWrittenBuiltinSpecs() = DS.getWrittenBuiltinSpecs();
 // Try to have a meaningful source location.
 if (TL.getWrittenSignSpec() != TSS_unspecified)
-  // Sign spec loc overrides the others (e.g., 'unsigned long').
-  TL.setBuiltinLoc(DS.getTypeSpecSignLoc());
-else if (TL.getWrittenWidthSpec() != TSW_unspecified)
-  // Width spec loc overrides type spec loc (e.g., 'short int').
-  TL.setBuiltinLoc(DS.getTypeSpecWidthLoc());
+  TL.expandBuiltinRange(DS.getTypeSpecSignLoc());
+if (TL.getWrittenWidthSpec() != TSW_unspecified)
+  TL.expandBuiltinRange(DS.getTypeSpecWidthRange());
   }
 }
 void VisitElaboratedTypeLoc(ElaboratedTypeLoc TL) {
Index: lib/Sema/DeclSpec.cpp
===
--- lib/Sema/DeclSpec.cpp
+++ lib/Sema/DeclSpec.cpp
@@ -610,14 +610,16 @@
 const char *&PrevSpec,
 unsigned &DiagID,
 const PrintingPolicy &Policy) {
-  // Overwrite TSWLoc only if TypeSpecWidth was unspecified, so that
+  // Overwrite TSWRange.Begin only if TypeSpecWidth was unspecified, so that
   // for 'long long' we will keep the source location of the first 'long'.
   if (TypeSpecWidth == TSW_unspecified)
-TSWLoc = Loc;
+TSWRange.setBegin(Loc);
   // Allow turning long -> long long.
   else if (W != TSW_longlong || TypeSpecWidth != TSW_long)
 return BadSpecifier(W, (TSW)TypeSpecWidth, PrevSpec, DiagID);
   TypeSpecWidth = W;
+  // Remember location of the last 'long'
+  TSWRange.setEnd(Loc);
   return false;
 }
 
@@ -997,9 +999,9 @@
TypeQualifiers)) {
 const unsigned NumLocs = 9;
 SourceLocation ExtraLocs[NumLocs] = {
-  TSWLoc, TSCLoc, TSSLoc, AltiVecLoc,
-  TQ_constLoc, TQ_restrictLoc, TQ_volatileLoc, TQ_atomicLoc, TQ_unalignedLoc
-};
+TSWRange.getBegin(), TSC

[PATCH] D25283: AvailabilityAttrs: Refactor context checking when diagnosing an availability violation

2016-10-10 Thread Aaron Ballman via cfe-commits
aaron.ballman added a reviewer: aaron.ballman.
aaron.ballman added inline comments.



Comment at: include/clang/Sema/Sema.h:9747
+  AvailabilityResult ShouldDiagnoseAvailabilityOfDecl(NamedDecl *&D,
+  std::string *Message);
 

Since you're altering the doxygen comments, it would be nice to add a comment 
for `Message`.



Comment at: lib/Sema/SemaDeclAttr.cpp:6346
+Decl *Ctx) {
+  assert(K != AR_Available);
+

Please add an explanatory string literal to the condition.



Comment at: lib/Sema/SemaDeclAttr.cpp:6350
+if (K == AR_NotYetIntroduced) {
+  if (auto *AA = getAttrForPlatform(S.Context, C))
+if (AA->getIntroduced() >= DeclVersion)

Please do not use `auto` here; the type is not spelled out in the 
initialization.



Comment at: lib/Sema/SemaDeclAttr.cpp:6368
+if (const auto *CatOrImpl = dyn_cast(Ctx))
+  if (const auto *Interface = CatOrImpl->getClassInterface())
+if (IsContextGreater(Interface))

Same comment here as well.



Comment at: lib/Sema/SemaDeclAttr.cpp:6372
+// A category implicitly has the availability of the interface.
+if (const ObjCCategoryDecl *CatD = dyn_cast(Ctx))
+  if (const ObjCInterfaceDecl *Interface = CatD->getClassInterface())

You can use `auto` here though. :-)



Comment at: lib/Sema/SemaDeclAttr.cpp:6398
+  VersionTuple DeclVersion;
+  if (auto *AA = getAttrForPlatform(S.Context, D))
+DeclVersion = AA->getIntroduced();

Please do not use `auto` here; the type is not spelled out in the 
initialization.



Comment at: lib/Sema/SemaDeclAttr.cpp:6699
+
+// If the context of this function is more unavailable then D, we should 
not
+// emit a diagnostic.

s/then/than


https://reviews.llvm.org/D25283



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


[PATCH] D25308: [Sema] Ignore transparent_union attributes in C++

2016-10-10 Thread Aaron Ballman via cfe-commits
aaron.ballman requested changes to this revision.
aaron.ballman added inline comments.
This revision now requires changes to proceed.



Comment at: lib/Sema/SemaDeclAttr.cpp:3011
const AttributeList &Attr) {
+  if (S.getLangOpts().CPlusPlus) {
+return;

The correct way to do this is to mark the attribute as C-only on its 
declaration in Attr.td. See the definition of `FlagEnum` for an example.


Repository:
  rL LLVM

https://reviews.llvm.org/D25308



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


[PATCH] D25238: [clang-tidy] Ignore empty members and bases in cppcoreguidelines-pro-type-member-init

2016-10-10 Thread Malcolm Parsons via cfe-commits
malcolm.parsons updated this revision to Diff 74125.
malcolm.parsons added a comment.

Mark comment as FIXME.


https://reviews.llvm.org/D25238

Files:
  clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
  test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp


Index: test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp
===
--- test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp
+++ test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp
@@ -423,3 +423,30 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: constructor does not initialize 
these fields: F
 UNINITIALIZED_FIELD_IN_MACRO_BODY_VIRTUAL(G);
 // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: constructor does not initialize 
these fields: G
+
+struct NegativeEmpty {
+};
+
+static void NegativeEmptyVar() {
+  NegativeEmpty e;
+  (void)e;
+}
+
+struct NegativeEmptyMember {
+  NegativeEmptyMember() {}
+  NegativeEmpty e;
+};
+
+struct NegativeEmptyBase : NegativeEmpty {
+  NegativeEmptyBase() {}
+};
+
+struct NegativeEmptyArrayMember {
+  NegativeEmptyArrayMember() {}
+  char e[0];
+};
+
+struct NegativeIncompleteArrayMember {
+  NegativeIncompleteArrayMember() {}
+  char e[];
+};
Index: clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
===
--- clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
+++ clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
@@ -317,6 +317,28 @@
   Options.store(Opts, "IgnoreArrays", IgnoreArrays);
 }
 
+// FIXME: Copied from clang/lib/Sema/SemaDeclCXX.cpp.
+static bool isIncompleteOrZeroLengthArrayType(ASTContext &Context, QualType T) 
{
+  if (T->isIncompleteArrayType())
+return true;
+
+  while (const ConstantArrayType *ArrayT = Context.getAsConstantArrayType(T)) {
+if (!ArrayT->getSize())
+  return true;
+
+T = ArrayT->getElementType();
+  }
+
+  return false;
+}
+
+static bool isEmpty(ASTContext &Context, const QualType &Type) {
+  if (const CXXRecordDecl *ClassDecl = Type->getAsCXXRecordDecl()) {
+return ClassDecl->isEmpty();
+  }
+  return isIncompleteOrZeroLengthArrayType(Context, Type);
+}
+
 void ProTypeMemberInitCheck::checkMissingMemberInitializer(
 ASTContext &Context, const CXXRecordDecl &ClassDecl,
 const CXXConstructorDecl *Ctor) {
@@ -330,7 +352,8 @@
   forEachField(ClassDecl, ClassDecl.fields(), false, [&](const FieldDecl *F) {
 if (!F->hasInClassInitializer() &&
 utils::type_traits::isTriviallyDefaultConstructible(F->getType(),
-Context))
+Context) &&
+!isEmpty(Context, F->getType()))
   FieldsToInit.insert(F);
   });
   if (FieldsToInit.empty())


Index: test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp
===
--- test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp
+++ test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp
@@ -423,3 +423,30 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: constructor does not initialize these fields: F
 UNINITIALIZED_FIELD_IN_MACRO_BODY_VIRTUAL(G);
 // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: constructor does not initialize these fields: G
+
+struct NegativeEmpty {
+};
+
+static void NegativeEmptyVar() {
+  NegativeEmpty e;
+  (void)e;
+}
+
+struct NegativeEmptyMember {
+  NegativeEmptyMember() {}
+  NegativeEmpty e;
+};
+
+struct NegativeEmptyBase : NegativeEmpty {
+  NegativeEmptyBase() {}
+};
+
+struct NegativeEmptyArrayMember {
+  NegativeEmptyArrayMember() {}
+  char e[0];
+};
+
+struct NegativeIncompleteArrayMember {
+  NegativeIncompleteArrayMember() {}
+  char e[];
+};
Index: clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
===
--- clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
+++ clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
@@ -317,6 +317,28 @@
   Options.store(Opts, "IgnoreArrays", IgnoreArrays);
 }
 
+// FIXME: Copied from clang/lib/Sema/SemaDeclCXX.cpp.
+static bool isIncompleteOrZeroLengthArrayType(ASTContext &Context, QualType T) {
+  if (T->isIncompleteArrayType())
+return true;
+
+  while (const ConstantArrayType *ArrayT = Context.getAsConstantArrayType(T)) {
+if (!ArrayT->getSize())
+  return true;
+
+T = ArrayT->getElementType();
+  }
+
+  return false;
+}
+
+static bool isEmpty(ASTContext &Context, const QualType &Type) {
+  if (const CXXRecordDecl *ClassDecl = Type->getAsCXXRecordDecl()) {
+return ClassDecl->isEmpty();
+  }
+  return isIncompleteOrZeroLengthArrayType(Context, Type);
+}
+
 void ProTypeMemberInitCheck::checkMissingMemberInitializer(
 ASTContext &Context, const CXXRecordDecl &ClassDecl,
 const CXXConstructorDecl *Ctor) {
@@ -330,7 +352,8 @@
   forEachField(ClassDecl, ClassDecl.fields(), false, [&](const FieldDecl *F) {

[PATCH] D20428: Tracking exception specification source locations

2016-10-10 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

In https://reviews.llvm.org/D20428#564511, @sbarzowski wrote:

> What's happening here? It's accepted, but not merged and the last activity is 
> 3 months old while my change is waiting for it. Can I help somehow?


It was accepted, but then caused build failures. I started correcting it, but 
ran into problems properly getting `TypeLocBuilder` to generate the proper type 
location information. Since then, I've ran out of funding to work on the 
problem and haven't had the spare time to pick it back up again. If someone 
would like to work on this patch in the meantime, I certainly would not be 
offended (and I'd be happy to help review).


https://reviews.llvm.org/D20428



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


[PATCH] D24991: Inline hot functions in libcxx shared_ptr implementation.

2016-10-10 Thread Sebastian Pop via cfe-commits
sebpop added a comment.

In https://reviews.llvm.org/D24991#565861, @EricWF wrote:

> Please provide benchmark tests which demonstrate that these benefits are 
> concrete and not just "potential".  Moving methods out of the dylib is no 
> easy task so I would like hard evidence that it's worth while.


With this patch we have seen the score of a proprietary benchmark going up by 
20%, matching the performance we see with LLVM + libstdc++. 
We will provide a testcase that shows the performance uplift.


Repository:
  rL LLVM

https://reviews.llvm.org/D24991



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


[PATCH] D24991: Inline hot functions in libcxx shared_ptr implementation.

2016-10-10 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

In https://reviews.llvm.org/D24991#566140, @sebpop wrote:

> In https://reviews.llvm.org/D24991#565861, @EricWF wrote:
>
> > Please provide benchmark tests which demonstrate that these benefits are 
> > concrete and not just "potential".  Moving methods out of the dylib is no 
> > easy task so I would like hard evidence that it's worth while.
>
>
> With this patch we have seen the score of a proprietary benchmark going up by 
> 20%, matching the performance we see with LLVM + libstdc++. 
>  We will provide a testcase that shows the performance uplift.


20% sounds amazing! Thanks for working on this.


Repository:
  rL LLVM

https://reviews.llvm.org/D24991



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


r283747 - Revert r283680.

2016-10-10 Thread Nico Weber via cfe-commits
Author: nico
Date: Mon Oct 10 09:10:00 2016
New Revision: 283747

URL: http://llvm.org/viewvc/llvm-project?rev=283747&view=rev
Log:
Revert r283680.

Breaks bootstrap builds on (at least) Windows:
In file included from 
D:\buildslave\clang-x64-ninja-win7\llvm\lib\Support\Allocator.cpp:14:
In file included from 
D:\buildslave\clang-x64-ninja-win7\llvm\include\llvm/Support/Allocator.h:24:
In file included from 
D:\buildslave\clang-x64-ninja-win7\llvm\include\llvm/ADT/SmallVector.h:20:
In file included from 
D:\buildslave\clang-x64-ninja-win7\llvm\include\llvm/Support/MathExtras.h:19:
D:\buildslave\clang-x64-ninja-win7\stage1.install\bin\..\lib\clang\4.0.0\include\algorithm(63,8)
 :
error: unknown type name '__device__'
inline __device__ const __T &

Removed:
cfe/trunk/lib/Headers/__clang_cuda_complex_builtins.h
cfe/trunk/lib/Headers/cuda_wrappers/
Modified:
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Headers/CMakeLists.txt
cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=283747&r1=283746&r2=283747&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Oct 10 09:10:00 2016
@@ -4694,15 +4694,6 @@ void Linux::AddClangCXXStdlibIncludeArgs
 
 void Linux::AddCudaIncludeArgs(const ArgList &DriverArgs,
ArgStringList &CC1Args) const {
-  if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
-// Add cuda_wrappers/* to our system include path.  This lets us wrap
-// standard library headers.
-SmallString<128> P(getDriver().ResourceDir);
-llvm::sys::path::append(P, "include");
-llvm::sys::path::append(P, "cuda_wrappers");
-addSystemInclude(DriverArgs, CC1Args, P);
-  }
-
   if (DriverArgs.hasArg(options::OPT_nocudainc))
 return;
 

Modified: cfe/trunk/lib/Headers/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/CMakeLists.txt?rev=283747&r1=283746&r2=283747&view=diff
==
--- cfe/trunk/lib/Headers/CMakeLists.txt (original)
+++ cfe/trunk/lib/Headers/CMakeLists.txt Mon Oct 10 09:10:00 2016
@@ -24,7 +24,6 @@ set(files
   bmiintrin.h
   __clang_cuda_builtin_vars.h
   __clang_cuda_cmath.h
-  __clang_cuda_complex_builtins.h
   __clang_cuda_intrinsics.h
   __clang_cuda_math_forward_declares.h
   __clang_cuda_runtime_wrapper.h

Removed: cfe/trunk/lib/Headers/__clang_cuda_complex_builtins.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/__clang_cuda_complex_builtins.h?rev=283746&view=auto
==
--- cfe/trunk/lib/Headers/__clang_cuda_complex_builtins.h (original)
+++ cfe/trunk/lib/Headers/__clang_cuda_complex_builtins.h (removed)
@@ -1,203 +0,0 @@
-/*===-- __clang_cuda_complex_builtins - CUDA impls of runtime complex fns 
---===
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to 
deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- *===---===
- */
-
-#ifndef __CLANG_CUDA_COMPLEX_BUILTINS
-#define __CLANG_CUDA_COMPLEX_BUILTINS
-
-// This header defines __muldc3, __mulsc3, __divdc3, and __divsc3.  These are
-// libgcc functions that clang assumes are available when compiling c99 complex
-// operations.  (These implementations come from libc++, and have been modified
-// to work with CUDA.)
-
-extern "C" inline __device__ double _Complex __muldc3(double __a, double __b,
-  double __c, double __d) {
-  double __ac = __a * __c;
-  double __bd = __b * __d;
-  double __ad = __a * __d;
-  double __bc = __b * __c;
-  double _Complex z;
-  __real__(z) = __ac - __bd;
-  __imag__(z) = __ad + __bc;
-  if (std::i

Re: r283680 - [CUDA] Support and std::min/max on the device.

2016-10-10 Thread Nico Weber via cfe-commits
This broke bootstrap builds, I reverted it for now in r283747.

On Sat, Oct 8, 2016 at 6:16 PM, Justin Lebar via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: jlebar
> Date: Sat Oct  8 17:16:12 2016
> New Revision: 283680
>
> URL: http://llvm.org/viewvc/llvm-project?rev=283680&view=rev
> Log:
> [CUDA] Support  and std::min/max on the device.
>
> Summary:
> We do this by wrapping  and .
>
> Tests are in the test-suite.
>
> Reviewers: tra
>
> Subscribers: jhen, beanz, cfe-commits, mgorny
>
> Differential Revision: https://reviews.llvm.org/D24979
>
> Added:
> cfe/trunk/lib/Headers/__clang_cuda_complex_builtins.h
> cfe/trunk/lib/Headers/cuda_wrappers/
> cfe/trunk/lib/Headers/cuda_wrappers/algorithm
> cfe/trunk/lib/Headers/cuda_wrappers/complex
> Modified:
> cfe/trunk/lib/Driver/ToolChains.cpp
> cfe/trunk/lib/Headers/CMakeLists.txt
> cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h
>
> Modified: cfe/trunk/lib/Driver/ToolChains.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/
> ToolChains.cpp?rev=283680&r1=283679&r2=283680&view=diff
> 
> ==
> --- cfe/trunk/lib/Driver/ToolChains.cpp (original)
> +++ cfe/trunk/lib/Driver/ToolChains.cpp Sat Oct  8 17:16:12 2016
> @@ -4694,6 +4694,15 @@ void Linux::AddClangCXXStdlibIncludeArgs
>
>  void Linux::AddCudaIncludeArgs(const ArgList &DriverArgs,
> ArgStringList &CC1Args) const {
> +  if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
> +// Add cuda_wrappers/* to our system include path.  This lets us wrap
> +// standard library headers.
> +SmallString<128> P(getDriver().ResourceDir);
> +llvm::sys::path::append(P, "include");
> +llvm::sys::path::append(P, "cuda_wrappers");
> +addSystemInclude(DriverArgs, CC1Args, P);
> +  }
> +
>if (DriverArgs.hasArg(options::OPT_nocudainc))
>  return;
>
>
> Modified: cfe/trunk/lib/Headers/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/
> CMakeLists.txt?rev=283680&r1=283679&r2=283680&view=diff
> 
> ==
> --- cfe/trunk/lib/Headers/CMakeLists.txt (original)
> +++ cfe/trunk/lib/Headers/CMakeLists.txt Sat Oct  8 17:16:12 2016
> @@ -24,10 +24,13 @@ set(files
>bmiintrin.h
>__clang_cuda_builtin_vars.h
>__clang_cuda_cmath.h
> +  __clang_cuda_complex_builtins.h
>__clang_cuda_intrinsics.h
>__clang_cuda_math_forward_declares.h
>__clang_cuda_runtime_wrapper.h
>cpuid.h
> +  cuda_wrappers/algorithm
> +  cuda_wrappers/complex
>clflushoptintrin.h
>emmintrin.h
>f16cintrin.h
>
> Added: cfe/trunk/lib/Headers/__clang_cuda_complex_builtins.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/
> __clang_cuda_complex_builtins.h?rev=283680&view=auto
> 
> ==
> --- cfe/trunk/lib/Headers/__clang_cuda_complex_builtins.h (added)
> +++ cfe/trunk/lib/Headers/__clang_cuda_complex_builtins.h Sat Oct  8
> 17:16:12 2016
> @@ -0,0 +1,203 @@
> +/*===-- __clang_cuda_complex_builtins - CUDA impls of runtime complex fns
> ---===
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining
> a copy
> + * of this software and associated documentation files (the "Software"),
> to deal
> + * in the Software without restriction, including without limitation the
> rights
> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or
> sell
> + * copies of the Software, and to permit persons to whom the Software is
> + * furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be
> included in
> + * all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
> SHALL THE
> + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> ARISING FROM,
> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> IN
> + * THE SOFTWARE.
> + *
> + *===
> ---===
> + */
> +
> +#ifndef __CLANG_CUDA_COMPLEX_BUILTINS
> +#define __CLANG_CUDA_COMPLEX_BUILTINS
> +
> +// This header defines __muldc3, __mulsc3, __divdc3, and __divsc3.  These
> are
> +// libgcc functions that clang assumes are available when compiling c99
> complex
> +// operations.  (These implementations come from libc++, and have been
> modified
> +// to work with CUDA.)
> +
> +extern "C" inline __device__ double _Complex __muldc3(double __a, double
> __b,
> +

[libcxx] r283749 - Add tests for LWG2544. We already implement this; just adding tests to make sure that we keep doing it.

2016-10-10 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Oct 10 09:10:45 2016
New Revision: 283749

URL: http://llvm.org/viewvc/llvm-project?rev=283749&view=rev
Log:
Add tests for LWG2544. We already implement this; just adding tests to make 
sure that we keep doing it.

Modified:

libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_equal/equal.pass.cpp

libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op!=/not_equal.pass.cpp

libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op==/equal.pass.cpp

Modified: 
libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_equal/equal.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_equal/equal.pass.cpp?rev=283749&r1=283748&r2=283749&view=diff
==
--- 
libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_equal/equal.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_equal/equal.pass.cpp
 Mon Oct 10 09:10:45 2016
@@ -26,26 +26,37 @@ int main()
 std::istreambuf_iterator i2(inf2);
 std::istreambuf_iterator i3;
 std::istreambuf_iterator i4;
+std::istreambuf_iterator i5(nullptr);
 
 assert( i1.equal(i1));
 assert( i1.equal(i2));
 assert(!i1.equal(i3));
 assert(!i1.equal(i4));
+assert(!i1.equal(i5));
 
 assert( i2.equal(i1));
 assert( i2.equal(i2));
 assert(!i2.equal(i3));
 assert(!i2.equal(i4));
+assert(!i2.equal(i5));
 
 assert(!i3.equal(i1));
 assert(!i3.equal(i2));
 assert( i3.equal(i3));
 assert( i3.equal(i4));
+assert( i3.equal(i5));
 
 assert(!i4.equal(i1));
 assert(!i4.equal(i2));
 assert( i4.equal(i3));
 assert( i4.equal(i4));
+assert( i4.equal(i5));
+
+assert(!i5.equal(i1));
+assert(!i5.equal(i2));
+assert( i5.equal(i3));
+assert( i5.equal(i4));
+assert( i5.equal(i5));
 }
 {
 std::wistringstream inf1(L"abc");
@@ -54,25 +65,36 @@ int main()
 std::istreambuf_iterator i2(inf2);
 std::istreambuf_iterator i3;
 std::istreambuf_iterator i4;
+std::istreambuf_iterator i5(nullptr);
 
 assert( i1.equal(i1));
 assert( i1.equal(i2));
 assert(!i1.equal(i3));
 assert(!i1.equal(i4));
+assert(!i1.equal(i5));
 
 assert( i2.equal(i1));
 assert( i2.equal(i2));
 assert(!i2.equal(i3));
 assert(!i2.equal(i4));
+assert(!i2.equal(i5));
 
 assert(!i3.equal(i1));
 assert(!i3.equal(i2));
 assert( i3.equal(i3));
 assert( i3.equal(i4));
+assert( i3.equal(i5));
 
 assert(!i4.equal(i1));
 assert(!i4.equal(i2));
 assert( i4.equal(i3));
 assert( i4.equal(i4));
+assert( i4.equal(i5));
+
+assert(!i5.equal(i1));
+assert(!i5.equal(i2));
+assert( i5.equal(i3));
+assert( i5.equal(i4));
+assert( i5.equal(i5));
 }
 }

Modified: 
libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op!=/not_equal.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op%21%3D/not_equal.pass.cpp?rev=283749&r1=283748&r2=283749&view=diff
==
--- 
libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op!=/not_equal.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op!=/not_equal.pass.cpp
 Mon Oct 10 09:10:45 2016
@@ -28,26 +28,37 @@ int main()
 std::istreambuf_iterator i2(inf2);
 std::istreambuf_iterator i3;
 std::istreambuf_iterator i4;
+std::istreambuf_iterator i5(nullptr);
 
 assert(!(i1 != i1));
 assert(!(i1 != i2));
 assert( (i1 != i3));
 assert( (i1 != i4));
+assert( (i1 != i5));
 
 assert(!(i2 != i1));
 assert(!(i2 != i2));
 assert( (i2 != i3));
 assert( (i2 != i4));
+assert( (i2 != i5));
 
 assert( (i3 != i1));
 assert( (i3 != i2));
 assert(!(i3 != i3));
 assert(!(i3 != i4));
+assert(!(i3 != i5));
 
 assert( (i4 != i1));
 assert( (i4 != i2));
 assert(!(i4 != i3));
 assert(!(i4 != i4));
+assert(!(i4 != i5));
+
+assert( (i5 != i1));
+assert( (i5 != i2));
+assert(!(i5 != i3));
+assert(!(i5 != i4));
+assert(!(i5 != i5));
 }
 {
 

[libcxx] r283752 - Mark issues 2544, 2567, 2569, 2686 and 2694 as ready/done.

2016-10-10 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Oct 10 09:15:56 2016
New Revision: 283752

URL: http://llvm.org/viewvc/llvm-project?rev=283752&view=rev
Log:
Mark issues 2544, 2567, 2569, 2686 and 2694 as ready/done.

Modified:
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=283752&r1=283751&r2=283752&view=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Mon Oct 10 09:15:56 2016
@@ -78,11 +78,11 @@
 http://wg21.link/LWG2536";>2536What 
should  do?IssaquahWe already do 
this
 http://wg21.link/LWG2540";>2540unordered_multimap::insert 
hint iteratorIssaquah
 http://wg21.link/LWG2543";>2543LWG 2148 
(hash support for enum types) seems 
under-specifiedIssaquah
-http://wg21.link/LWG2544";>2544istreambuf_iterator(basic_streambuf* s) effects unclear when s is 0Issaquah
+http://wg21.link/LWG2544";>2544istreambuf_iterator(basic_streambuf* s) effects unclear when s is 0IssaquahWe already do 
this
 http://wg21.link/LWG2556";>2556Wide 
contract for future::share()IssaquahPatch ready
 http://wg21.link/LWG2562";>2562Consistent 
total ordering of pointers by comparison 
functorsIssaquah
-http://wg21.link/LWG2567";>2567Specification of logical 
operator traits uses BaseCharacteristic, which is defined only for 
UnaryTypeTraits and BinaryTypeTraitsIssaquah
-http://wg21.link/LWG2569";>2569conjunction and disjunction 
requirements are too strictIssaquah
+http://wg21.link/LWG2567";>2567Specification of logical 
operator traits uses BaseCharacteristic, which is defined only for 
UnaryTypeTraits and BinaryTypeTraitsIssaquahNothing to 
do.
+http://wg21.link/LWG2569";>2569conjunction and disjunction 
requirements are too strictIssaquahNothing to do.
 http://wg21.link/LWG2570";>2570[fund.ts.v2] conjunction and 
disjunction requirements are too strictIssaquah
 http://wg21.link/LWG2578";>2578Iterator 
requirements should reference iterator traitsIssaquahNothing 
to do
 http://wg21.link/LWG2584";>2584 
ECMAScript IdentityEscape is ambiguousIssaquah
@@ -97,8 +97,8 @@
 http://wg21.link/LWG2680";>2680Add 
"Equivalent to" to filesystemIssaquah
 http://wg21.link/LWG2681";>2681filesystem::copy() cannot copy 
symlinksIssaquah
 http://wg21.link/LWG2682";>2682filesystem::copy() won't 
create a symlink to a directoryIssaquah
-http://wg21.link/LWG2686";>2686Why is 
std::hash specialized for error_code, but not 
error_condition?Issaquah
-http://wg21.link/LWG2694";>2694Application of LWG 436 
accidentally deleted definition of "facet"Issaquah
+http://wg21.link/LWG2686";>2686Why is 
std::hash specialized for error_code, but not 
error_condition?IssaquahPatch ready
+http://wg21.link/LWG2694";>2694Application of LWG 436 
accidentally deleted definition of "facet"IssaquahNothing to 
do
 http://wg21.link/LWG2696";>2696Interaction between 
make_shared and enable_shared_from_this is 
underspecifiedIssaquah
 http://wg21.link/LWG2699";>2699Missing 
restriction in [numeric.requirements]Issaquah
 http://wg21.link/LWG2712";>2712copy_file(from, to, ...) has a 
number of unspecified error conditionsIssaquah
@@ -152,33 +152,33 @@
 2536 - We already do this. 
 2540 - 
 2543 - 
-2544 - 
+2544 - We already do this; I've added tests to make sure we keep doing 
so
 2556 - Patch and tests ready
 2562 - 
-2567 - 
-2569 - 
-2570 - 
+2567 - This is just wording cleanup.
+2569 - This is just wording cleanup.
+2570 - Same as 2569, but applied to LFTS
 2578 - This is just wording cleanup. 
 2584 - 
 2589 - This is just wording cleanup. 
 2591 - 
 2598 - Patch and tests ready
-2664 - 
-2665 - 
-2672 - 
-2678 - 
+2664 - File System; Eric?
+2665 - File System; Eric?
+2672 - File System; Eric?
+2678 - File System; Eric?
 2679 - This is just wording cleanup. 
-2680 - 
-2681 - 
-2682 - 
-2686 - 
-2694 - 
+2680 - File System; Eric?
+2681 - File System; Eric?
+2682 - File System; Eric?
+2686 - Patch and tests ready
+2694 - Restoring inadvertently deleted text. No code changes needed.
 2696 - 
 2699 - I don't think this requires any code changes; look more 
closely.
 2712 - 
-2722 - 
+2722 - File System; Eric?
 2729 - 
-2732 - 
+2732 - File System; Eric?
 2733 - 
 2735 - 
 2736 - 


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


[PATCH] D25316: [clang-tidy] Enhance modernize-use-auto to casts

2016-10-10 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.



Comment at: clang-tidy/modernize/UseAutoCheck.cpp:346
 
-const auto *NewExpr = 
cast(V->getInit()->IgnoreParenImpCasts());
-// Ensure that every VarDecl has a CXXNewExpr initializer.
-if (!NewExpr)
+const auto *Expr = cast(V->getInit()->IgnoreParenImpCasts());
+// Ensure that every VarDecl has an ExprType initializer.

I think you should use `dyn_cast` here because `ExprType` may vary from call to 
call and produce an invalid cast otherwise.



Comment at: clang-tidy/modernize/UseAutoCheck.cpp:404
  Result.Nodes.getNodeAs(DeclWithNewId)) {
-replaceNew(Decl, Result.Context);
+auto GetType = [](const CXXNewExpr *Expr) {
+  return Expr->getType();

Just inline the lambda expression (below as well).



Comment at: clang-tidy/modernize/UseAutoCheck.h:28
   void replaceIterators(const DeclStmt *D, ASTContext *Context);
-  void replaceNew(const DeclStmt *D, ASTContext *Context);
+  template 
+  void replaceExpr(const DeclStmt *D, ASTContext *Context, TypeFn GetType,

Having the template declaration in the header, but the definition in the source 
file, is living a bit too close to the edge for my tastes. Since there are no 
function definitions in the header file, I suppose this may be okay, however.



Comment at: clang-tidy/modernize/UseAutoCheck.h:30
+  void replaceExpr(const DeclStmt *D, ASTContext *Context, TypeFn GetType,
+   StringRef message);
 

s/message/Message



Comment at: docs/clang-tidy/checks/modernize-use-auto.rst:150
+Frequently, when a variable is declared and initialized with a cast, the
+variable type has to be written twice: in the declaration type and in the
+cast expression. In this cases, the declaration type can be replaced with

s/has to be/is



Comment at: docs/clang-tidy/checks/modernize-use-auto.rst:164-165
+``reinterpret_cast``, functional casts and c style casts.
+It does not handle function templates that behave as casts, such as
+``llvm::dyn_cast``, ``boost::lexical_cast`` or ``gsl::narrow_cast``.
+

Should this be moved into Known Limitations?


https://reviews.llvm.org/D25316



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


r283753 - Revert r283683 because r283680 got reverted.

2016-10-10 Thread Nico Weber via cfe-commits
Author: nico
Date: Mon Oct 10 09:20:35 2016
New Revision: 283753

URL: http://llvm.org/viewvc/llvm-project?rev=283753&view=rev
Log:
Revert r283683 because r283680 got reverted.

Modified:
cfe/trunk/lib/Headers/CMakeLists.txt

Modified: cfe/trunk/lib/Headers/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/CMakeLists.txt?rev=283753&r1=283752&r2=283753&view=diff
==
--- cfe/trunk/lib/Headers/CMakeLists.txt (original)
+++ cfe/trunk/lib/Headers/CMakeLists.txt Mon Oct 10 09:20:35 2016
@@ -89,11 +89,6 @@ set(files
   xtestintrin.h
   )
 
-set(cuda_wrapper_files
-  cuda_wrappers/algorithm
-  cuda_wrappers/complex
-)
-
 set(output_dir ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/include)
 
 # Generate arm_neon.h
@@ -101,7 +96,7 @@ clang_tablegen(arm_neon.h -gen-arm-neon
   SOURCE ${CLANG_SOURCE_DIR}/include/clang/Basic/arm_neon.td)
 
 set(out_files)
-foreach( f ${files} ${cuda_wrapper_files} )
+foreach( f ${files} )
   set( src ${CMAKE_CURRENT_SOURCE_DIR}/${f} )
   set( dst ${output_dir}/${f} )
   add_custom_command(OUTPUT ${dst}
@@ -126,12 +121,6 @@ install(
   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
   DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
 
-install(
-  FILES ${cuda_wrapper_files}
-  COMPONENT clang-headers
-  PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
-  DESTINATION 
lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include/cuda_wrappers)
-
 if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDE's.
   add_custom_target(install-clang-headers
 DEPENDS clang-headers


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


[PATCH] D25430: [Sema] Prevent using member declaration diagnostic if the base class is invalid.

2016-10-10 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!


https://reviews.llvm.org/D25430



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


Re: r283753 - Revert r283683 because r283680 got reverted.

2016-10-10 Thread Renato Golin via cfe-commits
On 10 October 2016 at 15:20, Nico Weber via cfe-commits
 wrote:
> Author: nico
> Date: Mon Oct 10 09:20:35 2016
> New Revision: 283753
>
> URL: http://llvm.org/viewvc/llvm-project?rev=283753&view=rev
> Log:
> Revert r283683 because r283680 got reverted.

Great commit message! :D
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r283755 - [Sema] Prevent using member declaration diagnostic if the base class is invalid.

2016-10-10 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Mon Oct 10 09:26:40 2016
New Revision: 283755

URL: http://llvm.org/viewvc/llvm-project?rev=283755&view=rev
Log:
[Sema] Prevent using member declaration diagnostic if the base class is invalid.

Summary:
Once a base class has been made invalid (by a static_assert for example) all 
using-member declarations in the derived classes will result in a "not a base 
class" diagnostic. This diagnostic is very misleading and should not be emitted.

This change is needed to help libc++ produce reasonable diagnostics in 
`std::optional` and `std::variant`.  

Reviewers: rsmith, majnemer, aaron.ballman

Subscribers: cfe-commits

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

Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/SemaCXX/using-decl-templates.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=283755&r1=283754&r2=283755&view=diff
==
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Mon Oct 10 09:26:40 2016
@@ -9470,11 +9470,13 @@ bool Sema::CheckUsingDeclQualifier(Sourc
 return true;
   }
 
-  Diag(SS.getRange().getBegin(),
-   diag::err_using_decl_nested_name_specifier_is_not_base_class)
-<< SS.getScopeRep()
-<< cast(CurContext)
-<< SS.getRange();
+  if (!cast(NamedContext)->isInvalidDecl()) {
+Diag(SS.getRange().getBegin(),
+ diag::err_using_decl_nested_name_specifier_is_not_base_class)
+  << SS.getScopeRep()
+  << cast(CurContext)
+  << SS.getRange();
+  }
   return true;
 }
 

Modified: cfe/trunk/test/SemaCXX/using-decl-templates.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/using-decl-templates.cpp?rev=283755&r1=283754&r2=283755&view=diff
==
--- cfe/trunk/test/SemaCXX/using-decl-templates.cpp (original)
+++ cfe/trunk/test/SemaCXX/using-decl-templates.cpp Mon Oct 10 09:26:40 2016
@@ -92,3 +92,12 @@ namespace aliastemplateinst {
 
   template struct APtr; // expected-error{{elaborated type refers to a 
type alias template}}
 }
+
+namespace DontDiagnoseInvalidTest {
+template  struct Base {
+  static_assert(Value, ""); // expected-error {{static_assert failed}}
+};
+struct Derived : Base { // expected-note {{requested here}}
+  using Base::Base; // OK. Don't diagnose that 'Base' isn't a base 
class of Derived.
+};
+} // namespace DontDiagnoseInvalidTest


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


[PATCH] D25430: [Sema] Prevent using member declaration diagnostic if the base class is invalid.

2016-10-10 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

Thanks @aaron.ballman!


https://reviews.llvm.org/D25430



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


[clang-tools-extra] r283754 - [include-fixer] query-mode should be false by default.

2016-10-10 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Mon Oct 10 09:21:55 2016
New Revision: 283754

URL: http://llvm.org/viewvc/llvm-project?rev=283754&view=rev
Log:
[include-fixer] query-mode should be false by default.

Makes it consistent with documentations.

Modified:
clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py

Modified: clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py?rev=283754&r1=283753&r2=283754&view=diff
==
--- clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py (original)
+++ clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py Mon Oct 
10 09:21:55 2016
@@ -45,7 +45,7 @@ jump_to_include = False
 if vim.eval('exists("g:clang_include_fixer_jump_to_include")') == "1":
   jump_to_include = vim.eval('g:clang_include_fixer_jump_to_include') != "0"
 
-query_mode = True
+query_mode = False
 if vim.eval('exists("g:clang_include_fixer_query_mode")') == "1":
   query_mode = vim.eval('g:clang_include_fixer_query_mode') != "0"
 


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


[PATCH] D25406: Fix doubled whitespace in modernize-use-auto fixit

2016-10-10 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.



Comment at: clang-tidy/modernize/UseAutoCheck.cpp:378
+  Lexer::getLocForEndOfToken(Range.getEnd(), 0, SM, 
Context->getLangOpts());
+  bool Whitespace = isWhitespace(*FullSourceLoc(Next, SM).getCharacterData());
+

Oye, this is deceptively expensive because you now have to go back to the 
actual source file for this information. That source file may live on a network 
share somewhere, for instance.

Can you use `Token::hasLeadingSpace()` instead?

Also, doesn't this still need to care about the `RemoveStars` option?


https://reviews.llvm.org/D25406



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


[libcxx] r283757 - Add whitespace to make not_fn_impl more clear. NFC.

2016-10-10 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Oct 10 09:37:18 2016
New Revision: 283757

URL: http://llvm.org/viewvc/llvm-project?rev=283757&view=rev
Log:
Add whitespace to make not_fn_impl more clear. NFC.

Modified:
libcxx/trunk/include/functional

Modified: libcxx/trunk/include/functional
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/functional?rev=283757&r1=283756&r2=283757&view=diff
==
--- libcxx/trunk/include/functional (original)
+++ libcxx/trunk/include/functional Mon Oct 10 09:37:18 2016
@@ -2646,30 +2646,30 @@ public:
 _LIBCPP_INLINE_VISIBILITY
 auto operator()(_Args&& ...__args) &
 noexcept(noexcept(!_VSTD::invoke(__fd, 
_VSTD::forward<_Args>(__args)...)))
--> decltype(!_VSTD::invoke(__fd, _VSTD::forward<_Args>(__args)...))
-{ return !_VSTD::invoke(__fd, _VSTD::forward<_Args>(__args)...); }
+-> decltype(  !_VSTD::invoke(__fd, 
_VSTD::forward<_Args>(__args)...))
+{ return  !_VSTD::invoke(__fd, 
_VSTD::forward<_Args>(__args)...); }
 
 template 
 _LIBCPP_INLINE_VISIBILITY
 auto operator()(_Args&& ...__args) &&
 noexcept(noexcept(!_VSTD::invoke(_VSTD::move(__fd), 
_VSTD::forward<_Args>(__args)...)))
--> decltype(!_VSTD::invoke(_VSTD::move(__fd), 
_VSTD::forward<_Args>(__args)...))
-{ return !_VSTD::invoke(_VSTD::move(__fd), 
_VSTD::forward<_Args>(__args)...); }
+-> decltype(  !_VSTD::invoke(_VSTD::move(__fd), 
_VSTD::forward<_Args>(__args)...))
+{ return  !_VSTD::invoke(_VSTD::move(__fd), 
_VSTD::forward<_Args>(__args)...); }
 
 template 
 _LIBCPP_INLINE_VISIBILITY
 auto operator()(_Args&& ...__args) const&
 noexcept(noexcept(!_VSTD::invoke(__fd, 
_VSTD::forward<_Args>(__args)...)))
--> decltype(!_VSTD::invoke(__fd, _VSTD::forward<_Args>(__args)...))
-{ return !_VSTD::invoke(__fd, _VSTD::forward<_Args>(__args)...); }
+-> decltype(  !_VSTD::invoke(__fd, 
_VSTD::forward<_Args>(__args)...))
+{ return  !_VSTD::invoke(__fd, 
_VSTD::forward<_Args>(__args)...); }
 
 
 template 
 _LIBCPP_INLINE_VISIBILITY
 auto operator()(_Args&& ...__args) const&&
 noexcept(noexcept(!_VSTD::invoke(_VSTD::move(__fd), 
_VSTD::forward<_Args>(__args)...)))
--> decltype(!_VSTD::invoke(_VSTD::move(__fd), 
_VSTD::forward<_Args>(__args)...))
-{ return !_VSTD::invoke(_VSTD::move(__fd), 
_VSTD::forward<_Args>(__args)...); }
+-> decltype(  !_VSTD::invoke(_VSTD::move(__fd), 
_VSTD::forward<_Args>(__args)...))
+{ return  !_VSTD::invoke(_VSTD::move(__fd), 
_VSTD::forward<_Args>(__args)...); }
 
 private:
 template http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r283759 - Fix documentation mis-spelling.

2016-10-10 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Mon Oct 10 09:45:06 2016
New Revision: 283759

URL: http://llvm.org/viewvc/llvm-project?rev=283759&view=rev
Log:
Fix documentation mis-spelling.

I promise to stop misspelling things when the English language gains a program
that does strict semantic checking.

Modified:
libcxx/trunk/CMakeLists.txt

Modified: libcxx/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=283759&r1=283758&r2=283759&view=diff
==
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Mon Oct 10 09:45:06 2016
@@ -272,7 +272,7 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIB
 # LIBCXX_LINK_FLAGS: Linker only flags.
 # LIBCXX_LIBRARIES: libraries libc++ is linked to.
 # LIBCXX_INTERFACE_LIBRARIES: Libraries that must be linked when using libc++
-# There libraries are exposed in the linker script.
+# These libraries are exposed in the linker script.
 set(LIBCXX_COMPILE_FLAGS "")
 set(LIBCXX_LINK_FLAGS "")
 set(LIBCXX_LIBRARIES "")


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


[PATCH] D25308: [Sema] Ignore transparent_union attributes in C++

2016-10-10 Thread Alex Lorenz via cfe-commits
arphaman updated this revision to Diff 74127.
arphaman marked an inline comment as done.
arphaman added a comment.

The updated patch uses a proper way to mark the attribute as C only.


Repository:
  rL LLVM

https://reviews.llvm.org/D25308

Files:
  include/clang/Basic/Attr.td
  test/SemaCXX/attr-gnu.cpp


Index: test/SemaCXX/attr-gnu.cpp
===
--- test/SemaCXX/attr-gnu.cpp
+++ test/SemaCXX/attr-gnu.cpp
@@ -27,3 +27,19 @@
   void test3() __attribute__((cf_unknown_transfer)) override {} // Ok, not 
known to GCC.
 };
 }
+
+template
+union Tu { T b; } __attribute__((transparent_union)); // expected-warning 
{{'transparent_union' attribute ignored}}
+
+template
+union Tu2 { int x; T b; } __attribute__((transparent_union)); // 
expected-warning {{'transparent_union' attribute ignored}}
+
+union Tu3 { int x; } __attribute((transparent_union)); // expected-warning 
{{'transparent_union' attribute ignored}}
+
+void tuTest1(Tu u); // expected-note {{candidate function not viable: no 
known conversion from 'int' to 'Tu' for 1st argument}}
+void tuTest2(Tu3 u); // expected-note {{candidate function not viable: no 
known conversion from 'int' to 'Tu3' for 1st argument}}
+void tu() {
+  int x = 2;
+  tuTest1(x); // expected-error {{no matching function for call to 'tuTest1'}}
+  tuTest2(x); // expected-error {{no matching function for call to 'tuTest2'}}
+}
Index: include/clang/Basic/Attr.td
===
--- include/clang/Basic/Attr.td
+++ include/clang/Basic/Attr.td
@@ -1543,6 +1543,7 @@
   let Spellings = [GCC<"transparent_union">];
 //  let Subjects = SubjectList<[Record, TypedefName]>;
   let Documentation = [Undocumented];
+  let LangOpts = [COnly];
 }
 
 def Unavailable : InheritableAttr {


Index: test/SemaCXX/attr-gnu.cpp
===
--- test/SemaCXX/attr-gnu.cpp
+++ test/SemaCXX/attr-gnu.cpp
@@ -27,3 +27,19 @@
   void test3() __attribute__((cf_unknown_transfer)) override {} // Ok, not known to GCC.
 };
 }
+
+template
+union Tu { T b; } __attribute__((transparent_union)); // expected-warning {{'transparent_union' attribute ignored}}
+
+template
+union Tu2 { int x; T b; } __attribute__((transparent_union)); // expected-warning {{'transparent_union' attribute ignored}}
+
+union Tu3 { int x; } __attribute((transparent_union)); // expected-warning {{'transparent_union' attribute ignored}}
+
+void tuTest1(Tu u); // expected-note {{candidate function not viable: no known conversion from 'int' to 'Tu' for 1st argument}}
+void tuTest2(Tu3 u); // expected-note {{candidate function not viable: no known conversion from 'int' to 'Tu3' for 1st argument}}
+void tu() {
+  int x = 2;
+  tuTest1(x); // expected-error {{no matching function for call to 'tuTest1'}}
+  tuTest2(x); // expected-error {{no matching function for call to 'tuTest2'}}
+}
Index: include/clang/Basic/Attr.td
===
--- include/clang/Basic/Attr.td
+++ include/clang/Basic/Attr.td
@@ -1543,6 +1543,7 @@
   let Spellings = [GCC<"transparent_union">];
 //  let Subjects = SubjectList<[Record, TypedefName]>;
   let Documentation = [Undocumented];
+  let LangOpts = [COnly];
 }
 
 def Unavailable : InheritableAttr {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25308: [Sema] Ignore transparent_union attributes in C++

2016-10-10 Thread Alex Lorenz via cfe-commits
arphaman added a comment.

The updated patch now makes clang warn every time it encounters this attribute 
in C++ mode. Would that be the desired behaviour?


Repository:
  rL LLVM

https://reviews.llvm.org/D25308



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


[PATCH] D24508: PR28752: Do not instantiate var decls which are not visible.

2016-10-10 Thread Vassil Vassilev via cfe-commits
v.g.vassilev updated this revision to Diff 74129.
v.g.vassilev marked 3 inline comments as done.
v.g.vassilev added a comment.

Address comments.


https://reviews.llvm.org/D24508

Files:
  include/clang/AST/Decl.h
  lib/AST/Decl.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaTemplate.cpp
  lib/Sema/SemaTemplateInstantiateDecl.cpp
  lib/Sema/SemaType.cpp
  lib/Serialization/ASTReaderDecl.cpp
  lib/Serialization/ASTWriterDecl.cpp
  test/Modules/Inputs/PR28752/Subdir1/b.h
  test/Modules/Inputs/PR28752/Subdir1/c.h
  test/Modules/Inputs/PR28752/Subdir1/module.modulemap
  test/Modules/Inputs/PR28752/a.h
  test/Modules/Inputs/PR28752/module.modulemap
  test/Modules/Inputs/PR28752/vector
  test/Modules/pr28752.cpp

Index: test/Modules/pr28752.cpp
===
--- /dev/null
+++ test/Modules/pr28752.cpp
@@ -0,0 +1,19 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -std=c++11 -nostdsysteminc -I%S/Inputs/PR28752 -verify %s
+// RUN: %clang_cc1 -std=c++11 -nostdsysteminc -fmodules -fmodule-map-file=%S/Inputs/PR28752/Subdir1/module.modulemap -fmodule-map-file=%S/Inputs/PR28752/module.modulemap -fmodules-cache-path=%t -I%S/Inputs/PR28752 -I%S/Inputs/PR28752/Subdir1 -verify %s
+
+#include "a.h"
+#include "Subdir1/c.h"
+#include 
+
+class TClingClassInfo {
+  std::vector fIterStack;
+};
+
+TClingClassInfo *a;
+class TClingBaseClassInfo {
+  TClingBaseClassInfo() { new TClingClassInfo(*a); }
+};
+
+// expected-no-diagnostics
+
Index: test/Modules/Inputs/PR28752/vector
===
--- /dev/null
+++ test/Modules/Inputs/PR28752/vector
@@ -0,0 +1,28 @@
+#ifndef VECTOR
+#define VECTOR
+template  struct B;
+template  struct B { typedef _Tp type; };
+namespace std {
+template  struct D {
+
+  template  struct F {
+static const bool value = 0;
+  };
+
+  template 
+  typename B::value, _Alloc2>::type _S_select(_Alloc2);
+  template 
+  static
+  typename B::value, _Alloc2>::type _S_select(_Alloc2);
+};
+template 
+template 
+const bool D<_Alloc>::F<_Alloc2>::value;
+
+template  class vector {
+public:
+  vector(int);
+  vector(vector &) : vector(D::_S_select((bool)0)) {}
+};
+}
+#endif // VECTOR
\ No newline at end of file
Index: test/Modules/Inputs/PR28752/module.modulemap
===
--- /dev/null
+++ test/Modules/Inputs/PR28752/module.modulemap
@@ -0,0 +1 @@
+module a { header "a.h" export * }
Index: test/Modules/Inputs/PR28752/a.h
===
--- /dev/null
+++ test/Modules/Inputs/PR28752/a.h
@@ -0,0 +1 @@
+#include 
Index: test/Modules/Inputs/PR28752/Subdir1/module.modulemap
===
--- /dev/null
+++ test/Modules/Inputs/PR28752/Subdir1/module.modulemap
@@ -0,0 +1,5 @@
+module b {
+  module "b.h" { header "b.h" export * }
+  module "c.h" { header "c.h" export * }
+  export *
+}
Index: test/Modules/Inputs/PR28752/Subdir1/b.h
===
--- /dev/null
+++ test/Modules/Inputs/PR28752/Subdir1/b.h
@@ -0,0 +1 @@
+#include 
Index: lib/Serialization/ASTWriterDecl.cpp
===
--- lib/Serialization/ASTWriterDecl.cpp
+++ lib/Serialization/ASTWriterDecl.cpp
@@ -894,6 +894,7 @@
   Record.push_back(D->getTSCSpec());
   Record.push_back(D->getInitStyle());
   if (!isa(D)) {
+Record.push_back(D->isThisDeclarationADemotedDefinition());
 Record.push_back(D->isExceptionVariable());
 Record.push_back(D->isNRVOVariable());
 Record.push_back(D->isCXXForRangeDecl());
@@ -998,6 +999,8 @@
   // Check things we know are true of *every* PARM_VAR_DECL, which is more than
   // just us assuming it.
   assert(!D->getTSCSpec() && "PARM_VAR_DECL can't use TLS");
+  assert(!D->isThisDeclarationADemotedDefinition()
+ && "PARM_VAR_DECL can't be demoted definition.");
   assert(D->getAccess() == AS_none && "PARM_VAR_DECL can't be public/private");
   assert(!D->isExceptionVariable() && "PARM_VAR_DECL can't be exception var");
   assert(D->getPreviousDecl() == nullptr && "PARM_VAR_DECL can't be redecl");
@@ -1957,6 +1960,7 @@
   Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // SClass
   Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // TSCSpec
   Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // InitStyle
+  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsThisDeclarationADemotedDefinition
   Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isExceptionVariable
   Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isNRVOVariable
   Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isCXXForRangeDecl
Index: lib/Serialization/ASTReaderDecl.cpp
===
--- lib/Serialization/ASTReaderDecl.cpp
+++ lib/Serialization/ASTReaderDecl.cpp
@@ -1216,6 +1216,7 

[PATCH] D25414: [libcxx] Add support for Fuchsia

2016-10-10 Thread Marshall Clow via cfe-commits
mclow.lists added a comment.

@EricWF > Cool! This patch LGTM then.

This looks fine to me, too.


Repository:
  rL LLVM

https://reviews.llvm.org/D25414



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


[PATCH] D25316: [clang-tidy] Enhance modernize-use-auto to casts

2016-10-10 Thread Malcolm Parsons via cfe-commits
malcolm.parsons added inline comments.



Comment at: clang-tidy/modernize/UseAutoCheck.cpp:346
 
-const auto *NewExpr = 
cast(V->getInit()->IgnoreParenImpCasts());
-// Ensure that every VarDecl has a CXXNewExpr initializer.
-if (!NewExpr)
+const auto *Expr = cast(V->getInit()->IgnoreParenImpCasts());
+// Ensure that every VarDecl has an ExprType initializer.

aaron.ballman wrote:
> I think you should use `dyn_cast` here because `ExprType` may vary from call 
> to call and produce an invalid cast otherwise.
The `cast` was safe in the existing check because `makeDeclWithNewMatcher` 
creates a matcher that ensures all initializers are `CxxNewExpr`. 
`makeDeclWithCastMatcher` needs to be fixed.



Comment at: clang-tidy/modernize/UseAutoCheck.cpp:404
  Result.Nodes.getNodeAs(DeclWithNewId)) {
-replaceNew(Decl, Result.Context);
+auto GetType = [](const CXXNewExpr *Expr) {
+  return Expr->getType();

aaron.ballman wrote:
> Just inline the lambda expression (below as well).
OK.



Comment at: clang-tidy/modernize/UseAutoCheck.h:30
+  void replaceExpr(const DeclStmt *D, ASTContext *Context, TypeFn GetType,
+   StringRef message);
 

aaron.ballman wrote:
> s/message/Message
Oops.



Comment at: docs/clang-tidy/checks/modernize-use-auto.rst:150
+Frequently, when a variable is declared and initialized with a cast, the
+variable type has to be written twice: in the declaration type and in the
+cast expression. In this cases, the declaration type can be replaced with

aaron.ballman wrote:
> s/has to be/is
It's a copy and paste from the section above; I'll fix both.



Comment at: docs/clang-tidy/checks/modernize-use-auto.rst:164-165
+``reinterpret_cast``, functional casts and c style casts.
+It does not handle function templates that behave as casts, such as
+``llvm::dyn_cast``, ``boost::lexical_cast`` or ``gsl::narrow_cast``.
+

aaron.ballman wrote:
> Should this be moved into Known Limitations?
OK.


https://reviews.llvm.org/D25316



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


[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-10 Thread Devin Coughlin via cfe-commits
dcoughlin added inline comments.



Comment at: test/Analysis/unreachable-code-path.c:201
+static int inlineFunction(const int i) {
+  if (table[i] != 0)
+return 1;

danielmarjamaki wrote:
> NoQ wrote:
> > a.sidorin wrote:
> > > I have a small question. Is it possible to simplify this sample with 
> > > removing of table[] array? Like putting something like `i != 0` into 
> > > condition. As I understand, the problem is not array-related.
> > Any `UnknownVal` in the condition would trigger this issue.
> > Is it possible to simplify this sample with removing of table[] array? 
> 
> I tried to simplify as much as possible. But as NoQ says an UnknownVal is 
> required here for this test.
This is worth a comment in the test then, so that if we ever add symbolic 
reasoning we'll know how to adjust the test.

You could also try to add a canary with clang analyzer eval after the if 
statement to force the test to fail if we do add this symbolic reasoning.


Repository:
  rL LLVM

https://reviews.llvm.org/D25326



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


Re: [libcxx] r283757 - Add whitespace to make not_fn_impl more clear. NFC.

2016-10-10 Thread Eric Fiselier via cfe-commits
Thanks. I should have done that a while ago.

On Mon, Oct 10, 2016 at 8:37 AM, Marshall Clow via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: marshall
> Date: Mon Oct 10 09:37:18 2016
> New Revision: 283757
>
> URL: http://llvm.org/viewvc/llvm-project?rev=283757&view=rev
> Log:
> Add whitespace to make not_fn_impl more clear. NFC.
>
> Modified:
> libcxx/trunk/include/functional
>
> Modified: libcxx/trunk/include/functional
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/
> functional?rev=283757&r1=283756&r2=283757&view=diff
> 
> ==
> --- libcxx/trunk/include/functional (original)
> +++ libcxx/trunk/include/functional Mon Oct 10 09:37:18 2016
> @@ -2646,30 +2646,30 @@ public:
>  _LIBCPP_INLINE_VISIBILITY
>  auto operator()(_Args&& ...__args) &
>  noexcept(noexcept(!_VSTD::invoke(__fd,
> _VSTD::forward<_Args>(__args)...)))
> --> decltype(!_VSTD::invoke(__fd, _VSTD::forward<_Args>(__args).
> ..))
> -{ return !_VSTD::invoke(__fd, _VSTD::forward<_Args>(__args)...);
> }
> +-> decltype(  !_VSTD::invoke(__fd,
> _VSTD::forward<_Args>(__args)...))
> +{ return  !_VSTD::invoke(__fd,
> _VSTD::forward<_Args>(__args)...); }
>
>  template 
>  _LIBCPP_INLINE_VISIBILITY
>  auto operator()(_Args&& ...__args) &&
>  noexcept(noexcept(!_VSTD::invoke(_VSTD::move(__fd),
> _VSTD::forward<_Args>(__args)...)))
> --> decltype(!_VSTD::invoke(_VSTD::move(__fd),
> _VSTD::forward<_Args>(__args)...))
> -{ return !_VSTD::invoke(_VSTD::move(__fd),
> _VSTD::forward<_Args>(__args)...); }
> +-> decltype(  !_VSTD::invoke(_VSTD::move(__fd),
> _VSTD::forward<_Args>(__args)...))
> +{ return  !_VSTD::invoke(_VSTD::move(__fd),
> _VSTD::forward<_Args>(__args)...); }
>
>  template 
>  _LIBCPP_INLINE_VISIBILITY
>  auto operator()(_Args&& ...__args) const&
>  noexcept(noexcept(!_VSTD::invoke(__fd,
> _VSTD::forward<_Args>(__args)...)))
> --> decltype(!_VSTD::invoke(__fd, _VSTD::forward<_Args>(__args).
> ..))
> -{ return !_VSTD::invoke(__fd, _VSTD::forward<_Args>(__args)...);
> }
> +-> decltype(  !_VSTD::invoke(__fd,
> _VSTD::forward<_Args>(__args)...))
> +{ return  !_VSTD::invoke(__fd,
> _VSTD::forward<_Args>(__args)...); }
>
>
>  template 
>  _LIBCPP_INLINE_VISIBILITY
>  auto operator()(_Args&& ...__args) const&&
>  noexcept(noexcept(!_VSTD::invoke(_VSTD::move(__fd),
> _VSTD::forward<_Args>(__args)...)))
> --> decltype(!_VSTD::invoke(_VSTD::move(__fd),
> _VSTD::forward<_Args>(__args)...))
> -{ return !_VSTD::invoke(_VSTD::move(__fd),
> _VSTD::forward<_Args>(__args)...); }
> +-> decltype(  !_VSTD::invoke(_VSTD::move(__fd),
> _VSTD::forward<_Args>(__args)...))
> +{ return  !_VSTD::invoke(_VSTD::move(__fd),
> _VSTD::forward<_Args>(__args)...); }
>
>  private:
>  template 
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D21706: [libcxx] refactor for throw

2016-10-10 Thread Marshall Clow via cfe-commits
mclow.lists added a comment.

I think we've got most of this now.  Do we still need this patch?


https://reviews.llvm.org/D21706



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


[PATCH] D25406: Fix doubled whitespace in modernize-use-auto fixit

2016-10-10 Thread Malcolm Parsons via cfe-commits
malcolm.parsons updated this revision to Diff 74131.
malcolm.parsons added a comment.

Only insert whitespace when removing stars


https://reviews.llvm.org/D25406

Files:
  clang-tidy/modernize/UseAutoCheck.cpp
  clang-tidy/modernize/UseAutoCheck.h
  test/clang-tidy/modernize-use-auto-new-remove-stars.cpp

Index: test/clang-tidy/modernize-use-auto-new-remove-stars.cpp
===
--- test/clang-tidy/modernize-use-auto-new-remove-stars.cpp
+++ test/clang-tidy/modernize-use-auto-new-remove-stars.cpp
@@ -6,8 +6,6 @@
 
 class MyDerivedType : public MyType {};
 
-// FIXME: the replacement sometimes results in two consecutive spaces after
-// the word 'auto' (due to the presence of spaces at both sides of '*').
 void auto_new() {
   MyType *a_new = new MyType();
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with new
@@ -29,15 +27,15 @@
   // not "MyType * const".
   static MyType * const d_static = new MyType();
   // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: use auto when initializing with new
-  // CHECK-FIXES: static auto  const d_static = new MyType();
+  // CHECK-FIXES: static auto const d_static = new MyType();
 
   MyType * const a_const = new MyType();
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with new
-  // CHECK-FIXES: auto  const a_const = new MyType();
+  // CHECK-FIXES: auto const a_const = new MyType();
 
   MyType * volatile vol = new MyType();
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with new
-  // CHECK-FIXES: auto  volatile vol = new MyType();
+  // CHECK-FIXES: auto volatile vol = new MyType();
 
   struct SType {} *stype = new SType;
 
@@ -81,15 +79,15 @@
 
 int_p a = new int;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use auto when initializing with new
-// CHECK-FIXES: auto  a = new int;
+// CHECK-FIXES: auto a = new int;
 int_p *b = new int*;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use auto when initializing with new
 // CHECK-FIXES: auto b = new int*;
 
 // Test for typedefs in declarations lists.
 int_p c = new int, d = new int;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use auto when initializing with new
-// CHECK-FIXES: auto  c = new int, d = new int;
+// CHECK-FIXES: auto c = new int, d = new int;
 
 // Different types should not be transformed.
 int_p e = new int, *f = new int_p;
Index: clang-tidy/modernize/UseAutoCheck.h
===
--- clang-tidy/modernize/UseAutoCheck.h
+++ clang-tidy/modernize/UseAutoCheck.h
@@ -25,7 +25,7 @@
 
 private:
   void replaceIterators(const DeclStmt *D, ASTContext *Context);
-  void replaceNew(const DeclStmt *D, ASTContext *Context);
+  void replaceNew(const DeclStmt *D, ASTContext *Context, SourceManager &SM);
 
   const bool RemoveStars;
 };
Index: clang-tidy/modernize/UseAutoCheck.cpp
===
--- clang-tidy/modernize/UseAutoCheck.cpp
+++ clang-tidy/modernize/UseAutoCheck.cpp
@@ -11,6 +11,7 @@
 #include "clang/AST/ASTContext.h"
 #include "clang/ASTMatchers/ASTMatchers.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Lex/Lexer.h"
 
 using namespace clang;
 using namespace clang::ast_matchers;
@@ -313,7 +314,8 @@
   << FixItHint::CreateReplacement(Range, "auto");
 }
 
-void UseAutoCheck::replaceNew(const DeclStmt *D, ASTContext *Context) {
+void UseAutoCheck::replaceNew(const DeclStmt *D, ASTContext *Context,
+  SourceManager &SM) {
   const auto *FirstDecl = dyn_cast(*D->decl_begin());
   // Ensure that there is at least one VarDecl within the DeclStmt.
   if (!FirstDecl)
@@ -371,18 +373,23 @@
   auto Diag = diag(Range.getBegin(), "use auto when initializing with new"
  " to avoid duplicating the type name");
 
+  SourceLocation Next =
+  Lexer::getLocForEndOfToken(Range.getEnd(), 0, SM, Context->getLangOpts());
+  bool Whitespace = isWhitespace(*FullSourceLoc(Next, SM).getCharacterData());
+
   // Space after 'auto' to handle cases where the '*' in the pointer type is
   // next to the identifier. This avoids changing 'int *p' into 'autop'.
-  Diag << FixItHint::CreateReplacement(Range, RemoveStars ? "auto " : "auto")
+  Diag << FixItHint::CreateReplacement(
+  Range, (Whitespace || !RemoveStars) ? "auto" : "auto ")
<< StarRemovals;
 }
 
 void UseAutoCheck::check(const MatchFinder::MatchResult &Result) {
   if (const auto *Decl = Result.Nodes.getNodeAs(IteratorDeclStmtId)) {
 replaceIterators(Decl, Result.Context);
   } else if (const auto *Decl =
  Result.Nodes.getNodeAs(DeclWithNewId)) {
-replaceNew(Decl, Result.Context);
+replaceNew(Decl, Result.Context, *Result.SourceManager);
   } else {
 llvm_unreachable("Bad Callback. No node provided.");
   }
___

[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

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

In https://reviews.llvm.org/D25326#565919, @danielmarjamaki wrote:

> In https://reviews.llvm.org/D25326#564584, @zaks.anna wrote:
>
> > Please, fix the style issues before committing.
>
>
> Would it be ok to run clang-format on some files to clean up the formatting? 
> At least some minor changes like removing trailing spaces.


We generally try to avoid large-scale fixes of formatting and spacing issues if 
they are not on lines already modified by a patch. This makes it a bit easier 
to track down the original commit for a line and also reduces merge conflicts.


Repository:
  rL LLVM

https://reviews.llvm.org/D25326



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


[PATCH] D25406: Fix doubled whitespace in modernize-use-auto fixit

2016-10-10 Thread Malcolm Parsons via cfe-commits
malcolm.parsons added inline comments.



Comment at: clang-tidy/modernize/UseAutoCheck.cpp:378
+  Lexer::getLocForEndOfToken(Range.getEnd(), 0, SM, 
Context->getLangOpts());
+  bool Whitespace = isWhitespace(*FullSourceLoc(Next, SM).getCharacterData());
+

aaron.ballman wrote:
> Oye, this is deceptively expensive because you now have to go back to the 
> actual source file for this information. That source file may live on a 
> network share somewhere, for instance.
> 
> Can you use `Token::hasLeadingSpace()` instead?
> 
> Also, doesn't this still need to care about the `RemoveStars` option?
Where would I get a Token from?


https://reviews.llvm.org/D25406



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


[PATCH] D25316: [clang-tidy] Enhance modernize-use-auto to casts

2016-10-10 Thread Malcolm Parsons via cfe-commits
malcolm.parsons updated this revision to Diff 74134.
malcolm.parsons added a comment.

Fix ast matcher
Add test
Fix parameter case
Inline lambdas
Doc fixes


https://reviews.llvm.org/D25316

Files:
  clang-tidy/modernize/UseAutoCheck.cpp
  clang-tidy/modernize/UseAutoCheck.h
  docs/clang-tidy/checks/modernize-use-auto.rst
  test/clang-tidy/modernize-use-auto-cast-remove-stars.cpp
  test/clang-tidy/modernize-use-auto-cast.cpp
  test/clang-tidy/modernize-use-auto-new.cpp

Index: test/clang-tidy/modernize-use-auto-new.cpp
===
--- test/clang-tidy/modernize-use-auto-new.cpp
+++ test/clang-tidy/modernize-use-auto-new.cpp
@@ -15,6 +15,10 @@
   // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: use auto when initializing with new
   // CHECK-FIXES: static auto *a_static = new MyType();
 
+  long long *ll = new long long();
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with new
+  // CHECK-FIXES: auto *ll = new long long();
+
   MyType *derived = new MyDerivedType();
 
   void *vd = new MyType();
Index: test/clang-tidy/modernize-use-auto-cast.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-auto-cast.cpp
@@ -0,0 +1,120 @@
+// RUN: %check_clang_tidy %s modernize-use-auto %t -- -- \
+// RUN:   -std=c++11 -I %S/Inputs/modernize-use-auto
+
+struct A {
+  virtual ~A() {}
+};
+
+struct B : public A {};
+
+struct C {};
+
+void f_static_cast() {
+  long l = 1;
+  int i1 = static_cast(l);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto i1 = static_cast(l);
+
+  const int i2 = static_cast(l);
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: const auto i2 = static_cast(l);
+
+  long long ll = static_cast(l);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto ll = static_cast(l);
+  unsigned long long ull = static_cast(l);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto ull = static_cast(l);
+  unsigned int ui = static_cast(l);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto ui = static_cast(l);
+  long double ld = static_cast(l);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto ld = static_cast(l);
+
+  A *a = new B();
+  B *b1 = static_cast(a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto *b1 = static_cast(a);
+
+  B *const b2 = static_cast(a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto *const b2 = static_cast(a);
+
+  const B *b3 = static_cast(a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: const auto *b3 = static_cast(a);
+
+  B &b4 = static_cast(*a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto &b4 = static_cast(*a);
+
+  const B &b5 = static_cast(*a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: const auto &b5 = static_cast(*a);
+
+  B &b6 = static_cast(*a), &b7 = static_cast(*a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto &b6 = static_cast(*a), &b7 = static_cast(*a);
+
+  // Don't warn when non-cast involved
+  long double cast = static_cast(l), noncast = 5;
+
+  // Don't warn when auto is already being used.
+  auto i3 = static_cast(l);
+  auto *b8 = static_cast(a);
+  auto &b9 = static_cast(*a);
+}
+
+void f_dynamic_cast() {
+  A *a = new B();
+  B *b1 = dynamic_cast(a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto *b1 = dynamic_cast(a);
+
+  B &b2 = dynamic_cast(*a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto &b2 = dynamic_cast(*a);
+}
+
+void f_reinterpret_cast() {
+  auto *a = new A();
+  C *c1 = reinterpret_cast(a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto *c1 = reinterpret_cast(a);
+
+  C &c2 = reinterpret_cast(*a)

Re: r283680 - [CUDA] Support and std::min/max on the device.

2016-10-10 Thread Justin Lebar via cfe-commits
As discussed over IM, builds are still failing after reverting this.

The issue seems to be that the stage 1 build in bootstrap compiles is
not a clean build.  Therefore the errant  and 
headers are never removed from the install directory.

I believe I fixed the cmake in r283683 (sent a few hours after this
one), but because the stage 1 builds are not clean, they were still
broken after that change.

Easiest fix at this point would be to find someone with ssh access to
the buildbots to rm -rf the stage 1 directory.

On Mon, Oct 10, 2016 at 7:19 AM, Nico Weber  wrote:
> This broke bootstrap builds, I reverted it for now in r283747.
>
> On Sat, Oct 8, 2016 at 6:16 PM, Justin Lebar via cfe-commits
>  wrote:
>>
>> Author: jlebar
>> Date: Sat Oct  8 17:16:12 2016
>> New Revision: 283680
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=283680&view=rev
>> Log:
>> [CUDA] Support  and std::min/max on the device.
>>
>> Summary:
>> We do this by wrapping  and .
>>
>> Tests are in the test-suite.
>>
>> Reviewers: tra
>>
>> Subscribers: jhen, beanz, cfe-commits, mgorny
>>
>> Differential Revision: https://reviews.llvm.org/D24979
>>
>> Added:
>> cfe/trunk/lib/Headers/__clang_cuda_complex_builtins.h
>> cfe/trunk/lib/Headers/cuda_wrappers/
>> cfe/trunk/lib/Headers/cuda_wrappers/algorithm
>> cfe/trunk/lib/Headers/cuda_wrappers/complex
>> Modified:
>> cfe/trunk/lib/Driver/ToolChains.cpp
>> cfe/trunk/lib/Headers/CMakeLists.txt
>> cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h
>>
>> Modified: cfe/trunk/lib/Driver/ToolChains.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=283680&r1=283679&r2=283680&view=diff
>>
>> ==
>> --- cfe/trunk/lib/Driver/ToolChains.cpp (original)
>> +++ cfe/trunk/lib/Driver/ToolChains.cpp Sat Oct  8 17:16:12 2016
>> @@ -4694,6 +4694,15 @@ void Linux::AddClangCXXStdlibIncludeArgs
>>
>>  void Linux::AddCudaIncludeArgs(const ArgList &DriverArgs,
>> ArgStringList &CC1Args) const {
>> +  if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
>> +// Add cuda_wrappers/* to our system include path.  This lets us wrap
>> +// standard library headers.
>> +SmallString<128> P(getDriver().ResourceDir);
>> +llvm::sys::path::append(P, "include");
>> +llvm::sys::path::append(P, "cuda_wrappers");
>> +addSystemInclude(DriverArgs, CC1Args, P);
>> +  }
>> +
>>if (DriverArgs.hasArg(options::OPT_nocudainc))
>>  return;
>>
>>
>> Modified: cfe/trunk/lib/Headers/CMakeLists.txt
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/CMakeLists.txt?rev=283680&r1=283679&r2=283680&view=diff
>>
>> ==
>> --- cfe/trunk/lib/Headers/CMakeLists.txt (original)
>> +++ cfe/trunk/lib/Headers/CMakeLists.txt Sat Oct  8 17:16:12 2016
>> @@ -24,10 +24,13 @@ set(files
>>bmiintrin.h
>>__clang_cuda_builtin_vars.h
>>__clang_cuda_cmath.h
>> +  __clang_cuda_complex_builtins.h
>>__clang_cuda_intrinsics.h
>>__clang_cuda_math_forward_declares.h
>>__clang_cuda_runtime_wrapper.h
>>cpuid.h
>> +  cuda_wrappers/algorithm
>> +  cuda_wrappers/complex
>>clflushoptintrin.h
>>emmintrin.h
>>f16cintrin.h
>>
>> Added: cfe/trunk/lib/Headers/__clang_cuda_complex_builtins.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/__clang_cuda_complex_builtins.h?rev=283680&view=auto
>>
>> ==
>> --- cfe/trunk/lib/Headers/__clang_cuda_complex_builtins.h (added)
>> +++ cfe/trunk/lib/Headers/__clang_cuda_complex_builtins.h Sat Oct  8
>> 17:16:12 2016
>> @@ -0,0 +1,203 @@
>> +/*===-- __clang_cuda_complex_builtins - CUDA impls of runtime complex fns
>> ---===
>> + *
>> + * Permission is hereby granted, free of charge, to any person obtaining
>> a copy
>> + * of this software and associated documentation files (the "Software"),
>> to deal
>> + * in the Software without restriction, including without limitation the
>> rights
>> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or
>> sell
>> + * copies of the Software, and to permit persons to whom the Software is
>> + * furnished to do so, subject to the following conditions:
>> + *
>> + * The above copyright notice and this permission notice shall be
>> included in
>> + * all copies or substantial portions of the Software.
>> + *
>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
>> EXPRESS OR
>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
>> MERCHANTABILITY,
>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
>> SHALL THE
>> + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
>> ARISING FROM,
>> + * OUT OF OR IN CONNECTION WITH THE 

[PATCH] D25425: [AST] Convert Marshallers to use unique_ptr.

2016-10-10 Thread Justin Lebar via cfe-commits
jlebar marked 2 inline comments as done.
jlebar added inline comments.



Comment at: clang/lib/ASTMatchers/Dynamic/Marshallers.h:514
+  MutableArrayRef> Callbacks)
+  : Overloads(std::make_move_iterator(Callbacks.begin()),
+  std::make_move_iterator(Callbacks.end())) {}

timshen wrote:
> Notice that this is 2x slower, because move on unique_ptr resets the 
> move-from side. But it is less likely to have an issue.
It may be even worse than that because we used to be able to do memcpy, but 
now, unless llvm is incredibly smart, we're forced to copy one element at a 
time.

I think these lists are at most two elements, though.


https://reviews.llvm.org/D25425



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


[libcxx] r283762 - [libcxx] Fix gcc build.

2016-10-10 Thread Asiri Rathnayake via cfe-commits
Author: asiri
Date: Mon Oct 10 10:56:01 2016
New Revision: 283762

URL: http://llvm.org/viewvc/llvm-project?rev=283762&view=rev
Log:
[libcxx] Fix gcc build.

Attempt to fix a horrible gcc include order problem.

Modified:
libcxx/trunk/include/limits.h

Modified: libcxx/trunk/include/limits.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/limits.h?rev=283762&r1=283761&r2=283762&view=diff
==
--- libcxx/trunk/include/limits.h (original)
+++ libcxx/trunk/include/limits.h Mon Oct 10 10:56:01 2016
@@ -44,6 +44,22 @@ Macros:
 #pragma GCC system_header
 #endif
 
+#ifndef __GNUC__
 #include_next 
+#else
+// GCC header limits.h recursively includes itself through another header 
called
+// syslimits.h for some reason. This setup breaks down if we directly
+// #include_next GCC's limits.h (reasons not entirely clear to me). Therefore,
+// we manually re-create the necessary include sequence below:
+
+// Get the system limits.h defines (force recurse into the next level)
+#define _GCC_LIMITS_H_
+#define _GCC_NEXT_LIMITS_H
+#include_next 
+
+// Get the ISO C defines
+#undef _GCC_LIMITS_H_
+#include_next 
+#endif // __GNUC__
 
 #endif  // _LIBCPP_LIMITS_H


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


[PATCH] D25427: [Analysis] Use unique_ptr for CallGraph::FunctionMap.

2016-10-10 Thread Justin Lebar via cfe-commits
jlebar marked an inline comment as done.
jlebar added inline comments.



Comment at: clang/include/clang/Analysis/CallGraph.h:204
+  static clang::CallGraphNode *
+  CGGetValue(decltype(*std::declval()) &P) {
+return P.second.get();

timshen wrote:
> Does clang::CallGraph::const_iterator::value_type work?
Much better, thanks.


https://reviews.llvm.org/D25427



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


[PATCH] D25373: Fix for Bug 30639: CGDebugInfo Null dereference with OpenMP array access

2016-10-10 Thread Erich Keane via cfe-commits
erichkeane added a comment.

Andrey-
It seems that getVariableArrayDecayedType and getCanonicalParamType return the 
same type in this case (at least in the reproduction).  I could definitely 
change the call, though the changes to CGDebugInfo.cpp are apparently also 
necessary even in that case.

Is there additional logic that should happen in CGStmtOpenMP that I'm missing?


Repository:
  rL LLVM

https://reviews.llvm.org/D25373



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


[PATCH] D25419: Use unique_ptr in LLVMContextImpl's constant maps.

2016-10-10 Thread Justin Lebar via cfe-commits
jlebar marked an inline comment as done.
jlebar added inline comments.



Comment at: llvm/lib/IR/LLVMContextImpl.cpp:106
   for (auto &CDSConstant : CDSConstants)
 delete CDSConstant.second;
   CDSConstants.clear();

timshen wrote:
> Do you want to change this one as well?
Sure, but this one is complicated enough I'll put it in its own patch.


https://reviews.llvm.org/D25419



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


[PATCH] D25419: Use unique_ptr in LLVMContextImpl's constant maps.

2016-10-10 Thread Justin Lebar via cfe-commits
jlebar added inline comments.



Comment at: llvm/lib/IR/LLVMContextImpl.cpp:106
   for (auto &CDSConstant : CDSConstants)
 delete CDSConstant.second;
   CDSConstants.clear();

jlebar wrote:
> timshen wrote:
> > Do you want to change this one as well?
> Sure, but this one is complicated enough I'll put it in its own patch.
Actually, this one is very complicated, because we're walking a linked list 
where the head is now a unique_ptr but the other elements are raw pointers, and 
we assume we can assign into any of them using generic code...

I'll save it for another day.  I'd call DeleteContainerSeconds, but that 
doesn't work because the destructors of the map's value types are protected...  
:)


https://reviews.llvm.org/D25419



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


[PATCH] D25338: [Driver] Make -print-libgcc-file-name print compiler-rt lib when used

2016-10-10 Thread Bruno Cardoso Lopes via cfe-commits
bruno accepted this revision.
bruno added a comment.

LGTM


https://reviews.llvm.org/D25338



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


r283766 - [Sema] Use unique_ptr instead of raw pointers in the late-parsed templates map.

2016-10-10 Thread Justin Lebar via cfe-commits
Author: jlebar
Date: Mon Oct 10 11:26:08 2016
New Revision: 283766

URL: http://llvm.org/viewvc/llvm-project?rev=283766&view=rev
Log:
[Sema] Use unique_ptr instead of raw pointers in the late-parsed templates map.

Summary:
This is possible now that MapVector supports move-only values.

Depends on D25404.

Reviewers: timshen

Subscribers: cfe-commits

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

Modified:
cfe/trunk/include/clang/Sema/ExternalSemaSource.h
cfe/trunk/include/clang/Sema/MultiplexExternalSemaSource.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/include/clang/Serialization/ASTReader.h
cfe/trunk/lib/Sema/MultiplexExternalSemaSource.cpp
cfe/trunk/lib/Sema/Sema.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp

Modified: cfe/trunk/include/clang/Sema/ExternalSemaSource.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/ExternalSemaSource.h?rev=283766&r1=283765&r2=283766&view=diff
==
--- cfe/trunk/include/clang/Sema/ExternalSemaSource.h (original)
+++ cfe/trunk/include/clang/Sema/ExternalSemaSource.h Mon Oct 10 11:26:08 2016
@@ -190,7 +190,8 @@ public:
   /// external source should take care not to introduce the same map entries
   /// repeatedly.
   virtual void ReadLateParsedTemplates(
-  llvm::MapVector &LPTMap) {}
+  llvm::MapVector>
+  &LPTMap) {}
 
   /// \copydoc Sema::CorrectTypo
   /// \note LookupKind must correspond to a valid Sema::LookupNameKind

Modified: cfe/trunk/include/clang/Sema/MultiplexExternalSemaSource.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/MultiplexExternalSemaSource.h?rev=283766&r1=283765&r2=283766&view=diff
==
--- cfe/trunk/include/clang/Sema/MultiplexExternalSemaSource.h (original)
+++ cfe/trunk/include/clang/Sema/MultiplexExternalSemaSource.h Mon Oct 10 
11:26:08 2016
@@ -322,8 +322,8 @@ public:
   /// external source should take care not to introduce the same map entries
   /// repeatedly.
   void ReadLateParsedTemplates(
-  llvm::MapVector &LPTMap)
-  override;
+  llvm::MapVector>
+  &LPTMap) override;
 
   /// \copydoc ExternalSemaSource::CorrectTypo
   /// \note Returns the first nonempty correction.

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=283766&r1=283765&r2=283766&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Mon Oct 10 11:26:08 2016
@@ -551,7 +551,8 @@ public:
   SmallVector, 2>
 DelayedDefaultedMemberExceptionSpecs;
 
-  typedef llvm::MapVector
+  typedef llvm::MapVector>
   LateParsedTemplateMapT;
   LateParsedTemplateMapT LateParsedTemplateMap;
 

Modified: cfe/trunk/include/clang/Serialization/ASTReader.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=283766&r1=283765&r2=283766&view=diff
==
--- cfe/trunk/include/clang/Serialization/ASTReader.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTReader.h Mon Oct 10 11:26:08 2016
@@ -1877,8 +1877,8 @@ public:
SourceLocation> > &Pending) 
override;
 
   void ReadLateParsedTemplates(
-  llvm::MapVector &LPTMap)
-  override;
+  llvm::MapVector>
+  &LPTMap) override;
 
   /// \brief Load a selector from disk, registering its ID if it exists.
   void LoadSelector(Selector Sel);

Modified: cfe/trunk/lib/Sema/MultiplexExternalSemaSource.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/MultiplexExternalSemaSource.cpp?rev=283766&r1=283765&r2=283766&view=diff
==
--- cfe/trunk/lib/Sema/MultiplexExternalSemaSource.cpp (original)
+++ cfe/trunk/lib/Sema/MultiplexExternalSemaSource.cpp Mon Oct 10 11:26:08 2016
@@ -285,7 +285,8 @@ void MultiplexExternalSemaSource::ReadPe
 }
 
 void MultiplexExternalSemaSource::ReadLateParsedTemplates(
-llvm::MapVector &LPTMap) {
+llvm::MapVector>
+&LPTMap) {
   for (size_t i = 0; i < Sources.size(); ++i)
 Sources[i]->ReadLateParsedTemplates(LPTMap);
 }

Modified: cfe/trunk/lib/Sema/Sema.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=283766&r1=283765&r2=283766&view=diff
==
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Mon Oct 10 11:26:08 2016
@@ -259,7 +259,6 @@ void Sema::Initialize() {
 }
 
 Sema::~Sema() {
-  llvm::DeleteC

r283768 - [AST] Convert MangleNumberingContext to a unique_ptr.

2016-10-10 Thread Justin Lebar via cfe-commits
Author: jlebar
Date: Mon Oct 10 11:26:19 2016
New Revision: 283768

URL: http://llvm.org/viewvc/llvm-project?rev=283768&view=rev
Log:
[AST] Convert MangleNumberingContext to a unique_ptr.

Summary: It doesn't need to be refcounted anymore, either.

Reviewers: timshen

Subscribers: cfe-commits

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

Modified:
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/include/clang/AST/MangleNumberingContext.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/CXXABI.h
cfe/trunk/lib/AST/ItaniumCXXABI.cpp
cfe/trunk/lib/AST/MicrosoftCXXABI.cpp

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=283768&r1=283767&r2=283768&view=diff
==
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Mon Oct 10 11:26:19 2016
@@ -407,7 +407,7 @@ private:
   /// \brief Mapping from each declaration context to its corresponding
   /// mangling numbering context (used for constructs like lambdas which
   /// need to be consistently numbered for the mangler).
-  llvm::DenseMap
+  llvm::DenseMap>
   MangleNumberingContexts;
 
   /// \brief Side-table of mangling numbers for declarations which rarely
@@ -2470,7 +2470,7 @@ public:
   /// DeclContext.
   MangleNumberingContext &getManglingNumberContext(const DeclContext *DC);
 
-  MangleNumberingContext *createMangleNumberingContext() const;
+  std::unique_ptr createMangleNumberingContext() const;
 
   /// \brief Used by ParmVarDecl to store on the side the
   /// index of the parameter when it exceeds the size of the normal bitfield.

Modified: cfe/trunk/include/clang/AST/MangleNumberingContext.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/MangleNumberingContext.h?rev=283768&r1=283767&r2=283768&view=diff
==
--- cfe/trunk/include/clang/AST/MangleNumberingContext.h (original)
+++ cfe/trunk/include/clang/AST/MangleNumberingContext.h Mon Oct 10 11:26:19 
2016
@@ -29,7 +29,7 @@ class VarDecl;
 
 /// \brief Keeps track of the mangled names of lambda expressions and block
 /// literals within a particular context.
-class MangleNumberingContext : public RefCountedBase {
+class MangleNumberingContext {
 public:
   virtual ~MangleNumberingContext() {}
 

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=283768&r1=283767&r2=283768&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Mon Oct 10 11:26:19 2016
@@ -876,7 +876,7 @@ public:
 ///
 /// This mangling information is allocated lazily, since most contexts
 /// do not have lambda expressions or block literals.
-IntrusiveRefCntPtr MangleNumbering;
+std::unique_ptr MangleNumbering;
 
 /// \brief If we are processing a decltype type, a set of call expressions
 /// for which we have deferred checking the completeness of the return 
type.

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=283768&r1=283767&r2=283768&view=diff
==
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Mon Oct 10 11:26:19 2016
@@ -794,8 +794,6 @@ ASTContext::~ASTContext() {
 
   for (const auto &Value : ModuleInitializers)
 Value.second->~PerModuleInitializers();
-
-  llvm::DeleteContainerSeconds(MangleNumberingContexts);
 }
 
 void ASTContext::ReleaseParentMapEntries() {
@@ -8982,13 +8980,14 @@ unsigned ASTContext::getStaticLocalNumbe
 MangleNumberingContext &
 ASTContext::getManglingNumberContext(const DeclContext *DC) {
   assert(LangOpts.CPlusPlus);  // We don't need mangling numbers for plain C.
-  MangleNumberingContext *&MCtx = MangleNumberingContexts[DC];
+  std::unique_ptr &MCtx = MangleNumberingContexts[DC];
   if (!MCtx)
 MCtx = createMangleNumberingContext();
   return *MCtx;
 }
 
-MangleNumberingContext *ASTContext::createMangleNumberingContext() const {
+std::unique_ptr
+ASTContext::createMangleNumberingContext() const {
   return ABI->createMangleNumberingContext();
 }
 

Modified: cfe/trunk/lib/AST/CXXABI.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CXXABI.h?rev=283768&r1=283767&r2=283768&view=diff
==
--- cfe/trunk/lib/AST/CXXABI.h (original)
+++ cfe/trunk/lib/AST/CXXABI.h Mon Oct 10 11:26:19 2016
@@ -43,7 +43,8 @@ public:
   virtual bool isNearlyEmpty(const CXXRecordDecl *RD) const = 0;
 
   /// Returns a new mangling number conte

[PATCH] D25316: [clang-tidy] Enhance modernize-use-auto to casts

2016-10-10 Thread Malcolm Parsons via cfe-commits
malcolm.parsons marked 15 inline comments as done.
malcolm.parsons added inline comments.



Comment at: test/clang-tidy/modernize-use-auto-cast.cpp:14
+  long l = 1;
+  int i1 = static_cast(l);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with 
a cast to avoid duplicating the type name

Prazek wrote:
> How do you handle cases like
> 
>   long l = static_cast(i1);
> 
> I would expect it to produce warning, but not produce fixit (because it might 
> change the behavior of program), but I still would like to get information 
> about it because it seems like a bug.
The check requires the VarDecl and Initializer to have the same type, so there 
is no warning.
I don't think this check should warn about it.


https://reviews.llvm.org/D25316



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


r283771 - Use unique_ptr for VTableBuilder::VFTableLayouts map.

2016-10-10 Thread Justin Lebar via cfe-commits
Author: jlebar
Date: Mon Oct 10 11:26:33 2016
New Revision: 283771

URL: http://llvm.org/viewvc/llvm-project?rev=283771&view=rev
Log:
Use unique_ptr for VTableBuilder::VFTableLayouts map.

Reviewers: timshen

Subscribers: cfe-commits

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

Modified:
cfe/trunk/include/clang/AST/VTableBuilder.h
cfe/trunk/lib/AST/VTableBuilder.cpp

Modified: cfe/trunk/include/clang/AST/VTableBuilder.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/VTableBuilder.h?rev=283771&r1=283770&r2=283771&view=diff
==
--- cfe/trunk/include/clang/AST/VTableBuilder.h (original)
+++ cfe/trunk/include/clang/AST/VTableBuilder.h Mon Oct 10 11:26:33 2016
@@ -480,7 +480,8 @@ private:
   VFPtrLocationsMapTy VFPtrLocations;
 
   typedef std::pair VFTableIdTy;
-  typedef llvm::DenseMap VFTableLayoutMapTy;
+  typedef llvm::DenseMap>
+  VFTableLayoutMapTy;
   VFTableLayoutMapTy VFTableLayouts;
 
   llvm::DenseMap VBaseInfo;

Modified: cfe/trunk/lib/AST/VTableBuilder.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/VTableBuilder.cpp?rev=283771&r1=283770&r2=283771&view=diff
==
--- cfe/trunk/lib/AST/VTableBuilder.cpp (original)
+++ cfe/trunk/lib/AST/VTableBuilder.cpp Mon Oct 10 11:26:33 2016
@@ -3389,7 +3389,6 @@ static bool rebucketPaths(VPtrInfoVector
 }
 
 MicrosoftVTableContext::~MicrosoftVTableContext() {
-  llvm::DeleteContainerSeconds(VFTableLayouts);
   llvm::DeleteContainerSeconds(VBaseInfo);
 }
 
@@ -3592,7 +3591,7 @@ void MicrosoftVTableContext::computeVTab
 assert(VFTableLayouts.count(id) == 0);
 SmallVector VTableThunks(
 Builder.vtable_thunks_begin(), Builder.vtable_thunks_end());
-VFTableLayouts[id] = new VTableLayout(
+VFTableLayouts[id] = llvm::make_unique(
 Builder.getNumVTableComponents(), Builder.vtable_component_begin(),
 VTableThunks.size(), VTableThunks.data(), EmptyAddressPointsMap, true);
 Thunks.insert(Builder.thunks_begin(), Builder.thunks_end());


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


r283769 - [AST] Use unique_ptr for VTableLayout.

2016-10-10 Thread Justin Lebar via cfe-commits
Author: jlebar
Date: Mon Oct 10 11:26:24 2016
New Revision: 283769

URL: http://llvm.org/viewvc/llvm-project?rev=283769&view=rev
Log:
[AST] Use unique_ptr for VTableLayout.

Reviewers: timshen

Subscribers: cfe-commits

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

Modified:
cfe/trunk/include/clang/AST/VTableBuilder.h
cfe/trunk/lib/AST/VTableBuilder.cpp

Modified: cfe/trunk/include/clang/AST/VTableBuilder.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/VTableBuilder.h?rev=283769&r1=283768&r2=283769&view=diff
==
--- cfe/trunk/include/clang/AST/VTableBuilder.h (original)
+++ cfe/trunk/include/clang/AST/VTableBuilder.h Mon Oct 10 11:26:24 2016
@@ -313,8 +313,9 @@ private:
   typedef llvm::DenseMap MethodVTableIndicesTy;
   MethodVTableIndicesTy MethodVTableIndices;
 
-  typedef llvm::DenseMap
-VTableLayoutMapTy;
+  typedef llvm::DenseMap>
+  VTableLayoutMapTy;
   VTableLayoutMapTy VTableLayouts;
 
   typedef std::pair createConstructionVTableLayout(
+  const CXXRecordDecl *MostDerivedClass, CharUnits MostDerivedClassOffset,
+  bool MostDerivedClassIsVirtual, const CXXRecordDecl *LayoutClass);
 
   /// \brief Locate a virtual function in the vtable.
   ///

Modified: cfe/trunk/lib/AST/VTableBuilder.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/VTableBuilder.cpp?rev=283769&r1=283768&r2=283769&view=diff
==
--- cfe/trunk/lib/AST/VTableBuilder.cpp (original)
+++ cfe/trunk/lib/AST/VTableBuilder.cpp Mon Oct 10 11:26:24 2016
@@ -2234,9 +2234,7 @@ VTableLayout::~VTableLayout() { }
 ItaniumVTableContext::ItaniumVTableContext(ASTContext &Context)
 : VTableContextBase(/*MS=*/false) {}
 
-ItaniumVTableContext::~ItaniumVTableContext() {
-  llvm::DeleteContainerSeconds(VTableLayouts);
-}
+ItaniumVTableContext::~ItaniumVTableContext() {}
 
 uint64_t ItaniumVTableContext::getMethodVTableIndex(GlobalDecl GD) {
   MethodVTableIndicesTy::iterator I = MethodVTableIndices.find(GD);
@@ -2280,21 +2278,20 @@ ItaniumVTableContext::getVirtualBaseOffs
   return I->second;
 }
 
-static VTableLayout *CreateVTableLayout(const ItaniumVTableBuilder &Builder) {
+static std::unique_ptr
+CreateVTableLayout(const ItaniumVTableBuilder &Builder) {
   SmallVector
 VTableThunks(Builder.vtable_thunks_begin(), Builder.vtable_thunks_end());
 
-  return new VTableLayout(Builder.getNumVTableComponents(),
-  Builder.vtable_component_begin(),
-  VTableThunks.size(),
-  VTableThunks.data(),
-  Builder.getAddressPoints(),
-  /*IsMicrosoftABI=*/false);
+  return llvm::make_unique(
+  Builder.getNumVTableComponents(), Builder.vtable_component_begin(),
+  VTableThunks.size(), VTableThunks.data(), Builder.getAddressPoints(),
+  /*IsMicrosoftABI=*/false);
 }
 
 void
 ItaniumVTableContext::computeVTableRelatedInformation(const CXXRecordDecl *RD) 
{
-  const VTableLayout *&Entry = VTableLayouts[RD];
+  std::unique_ptr &Entry = VTableLayouts[RD];
 
   // Check if we've computed this information before.
   if (Entry)
@@ -2330,7 +2327,8 @@ ItaniumVTableContext::computeVTableRelat
   }
 }
 
-VTableLayout *ItaniumVTableContext::createConstructionVTableLayout(
+std::unique_ptr
+ItaniumVTableContext::createConstructionVTableLayout(
 const CXXRecordDecl *MostDerivedClass, CharUnits MostDerivedClassOffset,
 bool MostDerivedClassIsVirtual, const CXXRecordDecl *LayoutClass) {
   ItaniumVTableBuilder Builder(*this, MostDerivedClass, MostDerivedClassOffset,


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


r283773 - [AST] Convert Marshallers to use unique_ptr.

2016-10-10 Thread Justin Lebar via cfe-commits
Author: jlebar
Date: Mon Oct 10 11:26:40 2016
New Revision: 283773

URL: http://llvm.org/viewvc/llvm-project?rev=283773&view=rev
Log:
[AST] Convert Marshallers to use unique_ptr.

Reviewers: timshen

Subscribers: cfe-commits, klimek

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

Modified:
cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h
cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp

Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h?rev=283773&r1=283772&r2=283773&view=diff
==
--- cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h (original)
+++ cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h Mon Oct 10 11:26:40 2016
@@ -480,8 +480,8 @@ template 
 class AdaptativeOverloadCollector {
 public:
-  AdaptativeOverloadCollector(StringRef Name,
-  std::vector &Out)
+  AdaptativeOverloadCollector(
+  StringRef Name, std::vector> &Out)
   : Name(Name), Out(Out) {
 collect(FromTypes());
   }
@@ -499,7 +499,7 @@ private:
   inline void collect(FromTypeList);
 
   StringRef Name;
-  std::vector &Out;
+  std::vector> &Out;
 };
 
 /// \brief MatcherDescriptor that wraps multiple "overloads" of the same
@@ -509,8 +509,10 @@ private:
 /// more than one overloads match the arguments.
 class OverloadedMatcherDescriptor : public MatcherDescriptor {
 public:
-  OverloadedMatcherDescriptor(ArrayRef Callbacks)
-  : Overloads(Callbacks.begin(), Callbacks.end()) {}
+  OverloadedMatcherDescriptor(
+  MutableArrayRef> Callbacks)
+  : Overloads(std::make_move_iterator(Callbacks.begin()),
+  std::make_move_iterator(Callbacks.end())) {}
 
   ~OverloadedMatcherDescriptor() override {}
 
@@ -641,36 +643,37 @@ private:
 
 /// \brief 0-arg overload
 template 
-MatcherDescriptor *makeMatcherAutoMarshall(ReturnType (*Func)(),
- StringRef MatcherName) {
+std::unique_ptr
+makeMatcherAutoMarshall(ReturnType (*Func)(), StringRef MatcherName) {
   std::vector RetTypes;
   BuildReturnTypeVector::build(RetTypes);
-  return new FixedArgCountMatcherDescriptor(
+  return llvm::make_unique(
   matcherMarshall0, reinterpret_cast(Func),
   MatcherName, RetTypes, None);
 }
 
 /// \brief 1-arg overload
 template 
-MatcherDescriptor *makeMatcherAutoMarshall(ReturnType (*Func)(ArgType1),
- StringRef MatcherName) {
+std::unique_ptr
+makeMatcherAutoMarshall(ReturnType (*Func)(ArgType1), StringRef MatcherName) {
   std::vector RetTypes;
   BuildReturnTypeVector::build(RetTypes);
   ArgKind AK = ArgTypeTraits::getKind();
-  return new FixedArgCountMatcherDescriptor(
+  return llvm::make_unique(
   matcherMarshall1,
   reinterpret_cast(Func), MatcherName, RetTypes, AK);
 }
 
 /// \brief 2-arg overload
 template 
-MatcherDescriptor *makeMatcherAutoMarshall(ReturnType (*Func)(ArgType1, 
ArgType2),
- StringRef MatcherName) {
+std::unique_ptr
+makeMatcherAutoMarshall(ReturnType (*Func)(ArgType1, ArgType2),
+StringRef MatcherName) {
   std::vector RetTypes;
   BuildReturnTypeVector::build(RetTypes);
   ArgKind AKs[] = { ArgTypeTraits::getKind(),
 ArgTypeTraits::getKind() };
-  return new FixedArgCountMatcherDescriptor(
+  return llvm::make_unique(
   matcherMarshall2,
   reinterpret_cast(Func), MatcherName, RetTypes, AKs);
 }
@@ -678,10 +681,10 @@ MatcherDescriptor *makeMatcherAutoMarsha
 /// \brief Variadic overload.
 template )>
-MatcherDescriptor *makeMatcherAutoMarshall(
+std::unique_ptr makeMatcherAutoMarshall(
 ast_matchers::internal::VariadicFunction VarFunc,
 StringRef MatcherName) {
-  return new VariadicFuncMatcherDescriptor(VarFunc, MatcherName);
+  return llvm::make_unique(VarFunc, 
MatcherName);
 }
 
 /// \brief Overload for VariadicDynCastAllOfMatchers.
@@ -689,24 +692,24 @@ MatcherDescriptor *makeMatcherAutoMarsha
 /// Not strictly necessary, but DynCastAllOfMatcherDescriptor gives us better
 /// completion results for that type of matcher.
 template 
-MatcherDescriptor *
-makeMatcherAutoMarshall(ast_matchers::internal::VariadicDynCastAllOfMatcher<
-BaseT, DerivedT> VarFunc,
-StringRef MatcherName) {
-  return new DynCastAllOfMatcherDescriptor(VarFunc, MatcherName);
+std::unique_ptr makeMatcherAutoMarshall(
+ast_matchers::internal::VariadicDynCastAllOfMatcher
+VarFunc,
+StringRef MatcherName) {
+  return llvm::make_unique(VarFunc, 
MatcherName);
 }
 
 /// \brief Argument adaptative overload.
 template  class ArgumentAdapterT,
   typename FromTypes, typename ToTypes>
-MatcherDescriptor *
-makeMatcherAutoMarshall(ast_matchers::internal::ArgumentAdaptingMatcherFunc<
-ArgumentAdapterT, FromTypes, ToTypes>,
-

  1   2   3   >