Re: [PATCH] D21224: [Driver] Add method to redirect output of Compilation.

2016-06-28 Thread Nikolay Haustov via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL273997: [Driver] Add method to redirect output of 
Compilation. (authored by nhaustov).

Changed prior to commit:
  http://reviews.llvm.org/D21224?vs=60333&id=62066#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21224

Files:
  cfe/trunk/include/clang/Driver/Compilation.h
  cfe/trunk/lib/Driver/Compilation.cpp

Index: cfe/trunk/include/clang/Driver/Compilation.h
===
--- cfe/trunk/include/clang/Driver/Compilation.h
+++ cfe/trunk/include/clang/Driver/Compilation.h
@@ -252,6 +252,15 @@
 
   /// Return true if we're compiling for diagnostics.
   bool isForDiagnostics() const { return ForDiagnostics; }
+
+  /// Redirect - Redirect output of this compilation. Can only be done once.
+  ///
+  /// \param Redirects - array of pointers to paths. The array
+  /// should have a size of three. The inferior process's
+  /// stdin(0), stdout(1), and stderr(2) will be redirected to the
+  /// corresponding paths. This compilation instance becomes
+  /// the owner of Redirects and will delete the array and StringRef's.
+  void Redirect(const StringRef** Redirects);
 };
 
 } // end namespace driver
Index: cfe/trunk/lib/Driver/Compilation.cpp
===
--- cfe/trunk/lib/Driver/Compilation.cpp
+++ cfe/trunk/lib/Driver/Compilation.cpp
@@ -45,6 +45,7 @@
 
   // Free redirections of stdout/stderr.
   if (Redirects) {
+delete Redirects[0];
 delete Redirects[1];
 delete Redirects[2];
 delete [] Redirects;
@@ -213,3 +214,7 @@
 StringRef Compilation::getSysRoot() const {
   return getDriver().SysRoot;
 }
+
+void Compilation::Redirect(const StringRef** Redirects) {
+  this->Redirects = Redirects;
+}


Index: cfe/trunk/include/clang/Driver/Compilation.h
===
--- cfe/trunk/include/clang/Driver/Compilation.h
+++ cfe/trunk/include/clang/Driver/Compilation.h
@@ -252,6 +252,15 @@
 
   /// Return true if we're compiling for diagnostics.
   bool isForDiagnostics() const { return ForDiagnostics; }
+
+  /// Redirect - Redirect output of this compilation. Can only be done once.
+  ///
+  /// \param Redirects - array of pointers to paths. The array
+  /// should have a size of three. The inferior process's
+  /// stdin(0), stdout(1), and stderr(2) will be redirected to the
+  /// corresponding paths. This compilation instance becomes
+  /// the owner of Redirects and will delete the array and StringRef's.
+  void Redirect(const StringRef** Redirects);
 };
 
 } // end namespace driver
Index: cfe/trunk/lib/Driver/Compilation.cpp
===
--- cfe/trunk/lib/Driver/Compilation.cpp
+++ cfe/trunk/lib/Driver/Compilation.cpp
@@ -45,6 +45,7 @@
 
   // Free redirections of stdout/stderr.
   if (Redirects) {
+delete Redirects[0];
 delete Redirects[1];
 delete Redirects[2];
 delete [] Redirects;
@@ -213,3 +214,7 @@
 StringRef Compilation::getSysRoot() const {
   return getDriver().SysRoot;
 }
+
+void Compilation::Redirect(const StringRef** Redirects) {
+  this->Redirects = Redirects;
+}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21642: [clang-tidy] boost-use-to-string arg expr location bugfix

2016-06-28 Thread Piotr Padlewski via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL274001: [clang-tidy] boost-use-to-string arg expr location 
bugfix (authored by Prazek).

Changed prior to commit:
  http://reviews.llvm.org/D21642?vs=61665&id=62069#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21642

Files:
  clang-tools-extra/trunk/clang-tidy/boost/UseToStringCheck.cpp
  clang-tools-extra/trunk/test/clang-tidy/boost-use-to-string.cpp

Index: clang-tools-extra/trunk/clang-tidy/boost/UseToStringCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/boost/UseToStringCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/boost/UseToStringCheck.cpp
@@ -64,7 +64,7 @@
 
   Diag << FixItHint::CreateReplacement(
   CharSourceRange::getCharRange(Call->getLocStart(),
-Call->getArg(0)->getExprLoc()),
+Call->getArg(0)->getLocStart()),
   (llvm::Twine("std::to_") + StringType + "(").str());
 }
 
Index: clang-tools-extra/trunk/test/clang-tidy/boost-use-to-string.cpp
===
--- clang-tools-extra/trunk/test/clang-tidy/boost-use-to-string.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/boost-use-to-string.cpp
@@ -27,7 +27,7 @@
   // CHECK-FIXES: auto xa = std::to_string(5);
 
   auto z = boost::lexical_cast(42LL);
-  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use std::to_string {{..}}
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use std::to_string 
   // CHECK-FIXES: auto z = std::to_string(42LL);
 
   // this should not trigger
@@ -49,22 +49,22 @@
   bool j;
 
   fun(boost::lexical_cast(a));
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string {{..}}
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string 
   // CHECK-FIXES: fun(std::to_string(a));
   fun(boost::lexical_cast(b));
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string {{..}}
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string 
   // CHECK-FIXES: fun(std::to_string(b));
   fun(boost::lexical_cast(c));
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string {{..}}
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string 
   // CHECK-FIXES: fun(std::to_string(c));
   fun(boost::lexical_cast(d));
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string {{..}}
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string 
   // CHECK-FIXES: fun(std::to_string(d));
   fun(boost::lexical_cast(e));
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string {{..}}
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string 
   // CHECK-FIXES: fun(std::to_string(e));
   fun(boost::lexical_cast(f));
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string {{..}}
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string 
   // CHECK-FIXES: fun(std::to_string(f));
 
   // No change for floating numbers.
@@ -93,19 +93,19 @@
   // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring instead of boost::lexical_cast [boost-use-to-string]
   // CHECK-FIXES: fun(std::to_wstring(a));
   fun(boost::lexical_cast(b));
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring {{..}}
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring 
   // CHECK-FIXES: fun(std::to_wstring(b));
   fun(boost::lexical_cast(c));
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring {{..}}
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring 
   // CHECK-FIXES: fun(std::to_wstring(c));
   fun(boost::lexical_cast(d));
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring {{..}}
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring 
   // CHECK-FIXES: fun(std::to_wstring(d));
   fun(boost::lexical_cast(e));
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring {{..}}
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring 
   // CHECK-FIXES: fun(std::to_wstring(e));
   fun(boost::lexical_cast(f));
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring {{..}}
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring 
   // CHECK-FIXES: fun(std::to_wstring(f));
 
   // No change for floating numbers
@@ -117,13 +117,13 @@
 }
 
 const auto glob = boost::lexical_cast(42);
-// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: use std::to_string{{..}}
+// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: use std::to_string
 // CHECK-FIXES: const auto glob = std::to_string(42);
 
 template 
 void string_as_T(T t = T()) {
   boost::lexical_cast(42);
-  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use std::to_string{{..}}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use std::to_string
   // CHECK-FIXES: std::to_string(42);
 
   boost::lexical_cast(42);
@@ -137,7 +137,7 @@
 
 void no_fixup_inside_macro() {
   my_to_string(12);
-  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use s

[clang-tools-extra] r274001 - [clang-tidy] boost-use-to-string arg expr location bugfix

2016-06-28 Thread Piotr Padlewski via cfe-commits
Author: prazek
Date: Tue Jun 28 03:16:20 2016
New Revision: 274001

URL: http://llvm.org/viewvc/llvm-project?rev=274001&view=rev
Log:
[clang-tidy] boost-use-to-string arg expr location bugfix

Summary: getExprLoc returns location after dot for member call.

Reviewers: alexfh, sbenza, hokein

Subscribers: cfe-commits

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

Modified:
clang-tools-extra/trunk/clang-tidy/boost/UseToStringCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/boost-use-to-string.cpp

Modified: clang-tools-extra/trunk/clang-tidy/boost/UseToStringCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/boost/UseToStringCheck.cpp?rev=274001&r1=274000&r2=274001&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/boost/UseToStringCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/boost/UseToStringCheck.cpp Tue Jun 28 
03:16:20 2016
@@ -64,7 +64,7 @@ void UseToStringCheck::check(const Match
 
   Diag << FixItHint::CreateReplacement(
   CharSourceRange::getCharRange(Call->getLocStart(),
-Call->getArg(0)->getExprLoc()),
+Call->getArg(0)->getLocStart()),
   (llvm::Twine("std::to_") + StringType + "(").str());
 }
 

Modified: clang-tools-extra/trunk/test/clang-tidy/boost-use-to-string.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/boost-use-to-string.cpp?rev=274001&r1=274000&r2=274001&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/boost-use-to-string.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/boost-use-to-string.cpp Tue Jun 28 
03:16:20 2016
@@ -27,7 +27,7 @@ void test_to_string1() {
   // CHECK-FIXES: auto xa = std::to_string(5);
 
   auto z = boost::lexical_cast(42LL);
-  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use std::to_string {{..}}
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use std::to_string 
   // CHECK-FIXES: auto z = std::to_string(42LL);
 
   // this should not trigger
@@ -49,22 +49,22 @@ void test_to_string2() {
   bool j;
 
   fun(boost::lexical_cast(a));
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string {{..}}
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string 
   // CHECK-FIXES: fun(std::to_string(a));
   fun(boost::lexical_cast(b));
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string {{..}}
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string 
   // CHECK-FIXES: fun(std::to_string(b));
   fun(boost::lexical_cast(c));
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string {{..}}
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string 
   // CHECK-FIXES: fun(std::to_string(c));
   fun(boost::lexical_cast(d));
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string {{..}}
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string 
   // CHECK-FIXES: fun(std::to_string(d));
   fun(boost::lexical_cast(e));
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string {{..}}
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string 
   // CHECK-FIXES: fun(std::to_string(e));
   fun(boost::lexical_cast(f));
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string {{..}}
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string 
   // CHECK-FIXES: fun(std::to_string(f));
 
   // No change for floating numbers.
@@ -93,19 +93,19 @@ void test_to_wstring() {
   // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring instead of 
boost::lexical_cast [boost-use-to-string]
   // CHECK-FIXES: fun(std::to_wstring(a));
   fun(boost::lexical_cast(b));
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring {{..}}
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring 
   // CHECK-FIXES: fun(std::to_wstring(b));
   fun(boost::lexical_cast(c));
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring {{..}}
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring 
   // CHECK-FIXES: fun(std::to_wstring(c));
   fun(boost::lexical_cast(d));
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring {{..}}
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring 
   // CHECK-FIXES: fun(std::to_wstring(d));
   fun(boost::lexical_cast(e));
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring {{..}}
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring 
   // CHECK-FIXES: fun(std::to_wstring(e));
   fun(boost::lexical_cast(f));
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring {{..}}
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring 
   // CHECK-FIXES: fun(std::to_wstring(f));
 
   // No change for floating numbers
@@ -117,13 +117,13 @@ void test_to_wstring() {
 }
 
 const auto glob = boost::lexical_cast(42)

Re: [PATCH] D21279: Fix some issues in clang-format's AlignConsecutive modes

2016-06-28 Thread Ben Harper via cfe-commits
bmharper added a comment.

Friendly PING.

Please let me know if there's anything else that I need to do here,
otherwise I'll keep quiet and expect a merge at some point?


Repository:
  rL LLVM

http://reviews.llvm.org/D21279



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


Re: [PATCH] D21279: Fix some issues in clang-format's AlignConsecutive modes

2016-06-28 Thread Daniel Jasper via cfe-commits
djasper added a comment.

Sorry.. Really busy at the moment, but will try to get this reviewed and 
submitted this week. If not, please ping again!


Repository:
  rL LLVM

http://reviews.llvm.org/D21279



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


[PATCH] D21787: [include-fixer] make HeaderMapCollector maps from regex instead of postfix.

2016-06-28 Thread Eric Liu via cfe-commits
ioeric created this revision.
ioeric added a reviewer: bkramer.
ioeric added subscribers: hokein, cfe-commits.

this enables us to map a group of headers to one header name,
e.g. headers from one directory can be mapped to the same header.

http://reviews.llvm.org/D21787

Files:
  include-fixer/find-all-symbols/FindAllSymbolsAction.cpp
  include-fixer/find-all-symbols/FindAllSymbolsAction.h
  include-fixer/find-all-symbols/HeaderMapCollector.cpp
  include-fixer/find-all-symbols/HeaderMapCollector.h
  include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp
  unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp

Index: unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
===
--- unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
+++ unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
@@ -66,15 +66,15 @@
 
 std::string FileName = "symbol.cc";
 
-const std::string InternalHeader = "internal/internal.h";
+const std::string InternalHeader = "internal/internal_header.h";
 const std::string TopHeader = "";
 // Test .inc header path. The header for `IncHeaderClass` should be
 // internal.h, which will eventually be mapped to .
 std::string IncHeader = "internal/private.inc";
 std::string IncHeaderCode = "class IncHeaderClass {};";
 
-HeaderMapCollector::HeaderMap PostfixMap = {
-{"internal.h", TopHeader},
+HeaderMapCollector::HeaderMap RegexMap = {
+{R"(internal_.*\.h$)", TopHeader},
 };
 
 std::string InternalCode =
@@ -89,7 +89,7 @@
 llvm::MemoryBuffer::getMemBuffer(InternalCode));
 
 std::unique_ptr Factory(
-new FindAllSymbolsActionFactory(&Reporter, &PostfixMap));
+new FindAllSymbolsActionFactory(&Reporter, &RegexMap));
 
 tooling::ToolInvocation Invocation(
 {std::string("find_all_symbols"), std::string("-fsyntax-only"),
@@ -102,7 +102,8 @@
 
 std::string Content = "#include\"" + std::string(HeaderName) +
   "\"\n"
-  "#include \"internal/internal.h\"";
+  "#include \"" +
+  InternalHeader + "\"";
 #if !defined(_MSC_VER) && !defined(__MINGW32__)
 // Test path cleaning for both decls and macros.
 const std::string DirtyHeader = "./internal/./a/b.h";
Index: include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp
===
--- include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp
+++ include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp
@@ -14,634 +14,634 @@
 
 const HeaderMapCollector::HeaderMap *getSTLPostfixHeaderMap() {
   static const HeaderMapCollector::HeaderMap STLPostfixHeaderMap = {
-  {"include/__stddef_max_align_t.h", ""},
-  {"include/__wmmintrin_aes.h", ""},
-  {"include/__wmmintrin_pclmul.h", ""},
-  {"include/adxintrin.h", ""},
-  {"include/ammintrin.h", ""},
-  {"include/avx2intrin.h", ""},
-  {"include/avx512bwintrin.h", ""},
-  {"include/avx512cdintrin.h", ""},
-  {"include/avx512dqintrin.h", ""},
-  {"include/avx512erintrin.h", ""},
-  {"include/avx512fintrin.h", ""},
-  {"include/avx512ifmaintrin.h", ""},
-  {"include/avx512ifmavlintrin.h", ""},
-  {"include/avx512pfintrin.h", ""},
-  {"include/avx512vbmiintrin.h", ""},
-  {"include/avx512vbmivlintrin.h", ""},
-  {"include/avx512vlbwintrin.h", ""},
-  {"include/avx512vlcdintrin.h", ""},
-  {"include/avx512vldqintrin.h", ""},
-  {"include/avx512vlintrin.h", ""},
-  {"include/avxintrin.h", ""},
-  {"include/bmi2intrin.h", ""},
-  {"include/bmiintrin.h", ""},
-  {"include/emmintrin.h", ""},
-  {"include/f16cintrin.h", ""},
-  {"include/float.h", ""},
-  {"include/fma4intrin.h", ""},
-  {"include/fmaintrin.h", ""},
-  {"include/fxsrintrin.h", ""},
-  {"include/ia32intrin.h", ""},
-  {"include/immintrin.h", ""},
-  {"include/inttypes.h", ""},
-  {"include/limits.h", ""},
-  {"include/lzcntintrin.h", ""},
-  {"include/mm3dnow.h", ""},
-  {"include/mm_malloc.h", ""},
-  {"include/mmintrin.h", ""},
-  {"include/mwaitxintrin.h", ""},
-  {"include/pkuintrin.h", ""},
-  {"include/pmmintrin.h", ""},
-  {"include/popcntintrin.h", ""},
-  {"include/prfchwintrin.h", ""},
-  {"include/rdseedintrin.h", ""},
-  {"include/rtmintrin.h", ""},
-  {"include/shaintrin.h", ""},
-  {"include/smmintrin.h", ""},
-  {"include/stdalign.h", ""},
-  {"include/stdarg.h", ""},
-  {"include/stdbool.h", ""},
-  {"include/stddef.h", ""},
-  {"include/stdint.h", ""},
-  {"include/tbmintrin.h", ""},
-  {"include/tmmintrin.h", ""},
-  {"include/wmmintrin.h", ""},
-  {"include/x86intrin.h", ""},
-  {"include/xmmintrin.h", ""},
-  {"include/xopintrin.h", ""}

Re: [PATCH] D21601: Make tooling::applyAllReplacements return llvm::Expected instead of empty string to indicate potential error.

2016-06-28 Thread Eric Liu via cfe-commits
ioeric marked 3 inline comments as done.
ioeric added a comment.

Friendly ping


http://reviews.llvm.org/D21601



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


Re: [PATCH] D21502: Fix heuristics skipping invalid ctor-initializers with C++11

2016-06-28 Thread Olivier Goffart via cfe-commits
ogoffart added a comment.

Ping.

The problem i'm fixing here is how we recover invalid code in the ctor-init 
part as we skip the function body. 
In particular, we want to know if the '{' is the begining of the body or not. 
In C++03, we always consider it as the beginng of the body.  The problem was 
that in C++11 we don't, making the code skip too much, causing worse parse 
error later.

So what this patch is doing is finding heuristics to know if the '{' is 
starting a function body or not.
The rules are the following:  If we are not in a template argument, anf that 
the previous tokens are not an identifier, or a > , then it is much more likely 
to be the function body.  We verify that further by checking that the token 
after the matching '}'

I also changed the code to just ignore the code_completion token at this point. 
The previous code was making it thinking that it would then be a template 
argument. But this is not likely.


http://reviews.llvm.org/D21502



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


Re: [PATCH] D21642: [clang-tidy] boost-use-to-string arg expr location bugfix

2016-06-28 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments.


Comment at: test/clang-tidy/boost-use-to-string.cpp:154
@@ +153,3 @@
+  float floating;
+  Fields* wierd;
+  const int &getConstInteger() const {return integer;}

alexfh wrote:
> "wierd" is weird ;)
I should have been more clear in the first place: please fix the typo.

http://www.google.com/#q=wierd


Repository:
  rL LLVM

http://reviews.llvm.org/D21642



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


Re: [PATCH] D21603: [include-fixer] Fix namespace after inserting a missing header.

2016-06-28 Thread Daniel Jasper via cfe-commits
djasper added a comment.

Sorry, I completely forgot about this. Will try to review today. Is this part 
about the patch description accurate?

"This version only fixes the first discovered unidentified symbol.
In the long run, include-fixer should fix all unidentified symbols
with a same name at one run.

Currently, it works on command-line tool. The vim integration is not
implemented yet."

Specifically, what needs to be implemented in vim to make this work?


http://reviews.llvm.org/D21603



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


Re: [PATCH] D21783: [CodeView] Implement support for bitfields in Clang

2016-06-28 Thread Amjad Aboud via cfe-commits
aaboud added a comment.

Looks good, one minor comments below.



Comment at: lib/CodeGen/CGDebugInfo.h:243
@@ +242,3 @@
+   llvm::DIScope *RecordTy,
+   const RecordDecl *RD, SourceLocation Loc);
+

You have a mismatch between definition and this declaration, definition does 
not take SourceLocation parameter!


http://reviews.llvm.org/D21783



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


Re: [PATCH] D21507: Changes after running check modernize-use-emplace (D20964)

2016-06-28 Thread Piotr Padlewski via cfe-commits
Prazek added a comment.

In http://reviews.llvm.org/D21507#465733, @sanjoy wrote:

> One other thing to point out -- have you verified that the changes in 
> `unittests/` are benign (i.e. you're not semantically changing the tests)?


Yes I do.


Repository:
  rL LLVM

http://reviews.llvm.org/D21507



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


Re: [PATCH] D21603: [include-fixer] Fix namespace after inserting a missing header.

2016-06-28 Thread Haojian Wu via cfe-commits
hokein added a comment.

In http://reviews.llvm.org/D21603#468717, @djasper wrote:

> Sorry, I completely forgot about this. Will try to review today. Is this part 
> about the patch description accurate?


Yes, the description is accurate.

> Specifically, what needs to be implemented in vim to make this work?


We need a way to dump the mapping relationship between symbols and their 
headers, so that include-fixer can know which namespace prefix should be used 
when user selects a particular header in vim.


http://reviews.llvm.org/D21603



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


Re: [PATCH] D21676: clang-rename: add a -export-fixes option

2016-06-28 Thread Miklos Vajna via cfe-commits
vmiklos added a comment.

Something related: currently in case multiple symbols is to be renamed in the 
same translation unit, clang-rename has to be invoked multiple times. This is 
problematic from a performance point of view, in case the symbols are in common 
headers of a codebase (and clang-rename is invoked for each translation unit). 
Would a patch that allows multiple renames to be performed with one invocation 
be welcome? E.g. initially via the -offset + -new-name options (let's say using 
`,` as separator), but later it would be probably more friendly to allow an 
input YAML file that describes what symbols should be renamed to what new names.


Repository:
  rL LLVM

http://reviews.llvm.org/D21676



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


[PATCH] D21790: [Clang][Feature] Adding CLFLUSHOPT feature to clang

2016-06-28 Thread michael zuckerman via cfe-commits
m_zuckerman created this revision.
m_zuckerman added reviewers: AsafBadouh, igorb, delena.
m_zuckerman added a subscriber: cfe-commits.

http://reviews.llvm.org/D21790

Files:
  include/clang/Basic/BuiltinsX86.def
  lib/Headers/CMakeLists.txt
  lib/Headers/immintrin.h

Index: lib/Headers/immintrin.h
===
--- lib/Headers/immintrin.h
+++ lib/Headers/immintrin.h
@@ -54,6 +54,10 @@
 #include 
 #endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__CLFLUSHOPT__)
+#include 
+#endif
+
 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX__)
 #include 
 #endif
Index: lib/Headers/CMakeLists.txt
===
--- lib/Headers/CMakeLists.txt
+++ lib/Headers/CMakeLists.txt
@@ -27,6 +27,7 @@
   __clang_cuda_runtime_wrapper.h
   cpuid.h
   cuda_builtin_vars.h
+  clflushoptintrin.h
   emmintrin.h
   f16cintrin.h
   float.h
Index: include/clang/Basic/BuiltinsX86.def
===
--- include/clang/Basic/BuiltinsX86.def
+++ include/clang/Basic/BuiltinsX86.def
@@ -652,6 +652,9 @@
 TARGET_BUILTIN(__builtin_ia32_xsaves, "vv*ULLi", "", "xsaves")
 TARGET_BUILTIN(__builtin_ia32_xsaves64, "vv*ULLi", "", "xsaves")
 
+//CLFLUSHOPT
+TARGET_BUILTIN(__builtin_ia32_clflushopt, "vc*", "", "clflushopt")
+
 // ADX
 TARGET_BUILTIN(__builtin_ia32_addcarryx_u32, "UcUcUiUiUi*", "", "adx")
 TARGET_BUILTIN(__builtin_ia32_addcarryx_u64, "UcUcULLiULLiULLi*", "", "adx")


Index: lib/Headers/immintrin.h
===
--- lib/Headers/immintrin.h
+++ lib/Headers/immintrin.h
@@ -54,6 +54,10 @@
 #include 
 #endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__CLFLUSHOPT__)
+#include 
+#endif
+
 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX__)
 #include 
 #endif
Index: lib/Headers/CMakeLists.txt
===
--- lib/Headers/CMakeLists.txt
+++ lib/Headers/CMakeLists.txt
@@ -27,6 +27,7 @@
   __clang_cuda_runtime_wrapper.h
   cpuid.h
   cuda_builtin_vars.h
+  clflushoptintrin.h
   emmintrin.h
   f16cintrin.h
   float.h
Index: include/clang/Basic/BuiltinsX86.def
===
--- include/clang/Basic/BuiltinsX86.def
+++ include/clang/Basic/BuiltinsX86.def
@@ -652,6 +652,9 @@
 TARGET_BUILTIN(__builtin_ia32_xsaves, "vv*ULLi", "", "xsaves")
 TARGET_BUILTIN(__builtin_ia32_xsaves64, "vv*ULLi", "", "xsaves")
 
+//CLFLUSHOPT
+TARGET_BUILTIN(__builtin_ia32_clflushopt, "vc*", "", "clflushopt")
+
 // ADX
 TARGET_BUILTIN(__builtin_ia32_addcarryx_u32, "UcUcUiUiUi*", "", "adx")
 TARGET_BUILTIN(__builtin_ia32_addcarryx_u64, "UcUcULLiULLiULLi*", "", "adx")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r274015 - [ASTMatchers] Add isLambda() matcher.

2016-06-28 Thread Samuel Benzaquen via cfe-commits
Author: sbenza
Date: Tue Jun 28 09:08:56 2016
New Revision: 274015

URL: http://llvm.org/viewvc/llvm-project?rev=274015&view=rev
Log:
[ASTMatchers] Add isLambda() matcher.

Modified:
cfe/trunk/docs/LibASTMatchersReference.html
cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
cfe/trunk/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp

Modified: cfe/trunk/docs/LibASTMatchersReference.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=274015&r1=274014&r2=274015&view=diff
==
--- cfe/trunk/docs/LibASTMatchersReference.html (original)
+++ cfe/trunk/docs/LibASTMatchersReference.html Tue Jun 28 09:08:56 2016
@@ -2137,6 +2137,17 @@ matches A and C::f, but not B, C, or B::
 
 
 
+MatcherCXXRecordDecl>isLambda
+Matches the generated 
class of lambda expressions.
+
+Given:
+  auto x = []{};
+
+cxxRecordDecl(isLambda()) matches the implicit class declaration of
+decltype(x)
+
+
+
 MatcherCXXRecordDecl>isSameOrDerivedFromstd::string 
BaseName
 Overloaded 
method as shortcut for
 isSameOrDerivedFrom(hasName(...)).

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=274015&r1=274014&r2=274015&view=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Tue Jun 28 09:08:56 2016
@@ -2197,6 +2197,19 @@ AST_MATCHER_P(CXXRecordDecl, hasMethod,
 Node.method_end(), Finder, Builder);
 }
 
+/// \brief Matches the generated class of lambda expressions.
+///
+/// Given:
+/// \code
+///   auto x = []{};
+/// \endcode
+///
+/// \c cxxRecordDecl(isLambda()) matches the implicit class declaration of
+/// \c decltype(x)
+AST_MATCHER(CXXRecordDecl, isLambda) {
+  return Node.isLambda();
+}
+
 /// \brief Matches AST nodes that have child AST nodes that match the
 /// provided matcher.
 ///

Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp?rev=274015&r1=274014&r2=274015&view=diff
==
--- cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp (original)
+++ cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp Tue Jun 28 09:08:56 2016
@@ -307,6 +307,7 @@ RegistryMaps::RegistryMaps() {
   REGISTER_MATCHER(isInteger);
   REGISTER_MATCHER(isIntegral);
   REGISTER_MATCHER(isInTemplateInstantiation);
+  REGISTER_MATCHER(isLambda);
   REGISTER_MATCHER(isListInitialization);
   REGISTER_MATCHER(isMemberInitializer);
   REGISTER_MATCHER(isMoveAssignmentOperator);

Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp?rev=274015&r1=274014&r2=274015&view=diff
==
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp Tue Jun 28 
09:08:56 2016
@@ -537,6 +537,12 @@ TEST(DeclarationMatcher, ClassIsDerived)
 cxxRecordDecl(isDerivedFrom(namedDecl(hasName("X"));
 }
 
+TEST(DeclarationMatcher, IsLambda) {
+  const auto IsLambda = cxxMethodDecl(ofClass(cxxRecordDecl(isLambda(;
+  EXPECT_TRUE(matches("auto x = []{};", IsLambda));
+  EXPECT_TRUE(notMatches("struct S { void operator()() const; };", IsLambda));
+}
+
 TEST(Matcher, BindMatchedNodes) {
   DeclarationMatcher ClassX = has(recordDecl(hasName("::X")).bind("x"));
 


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


[libcxx] r274016 - Updated C++1Z status page with new work from Oulu WG21 meeting

2016-06-28 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Jun 28 09:11:54 2016
New Revision: 274016

URL: http://llvm.org/viewvc/llvm-project?rev=274016&view=rev
Log:
Updated C++1Z status page with new work from Oulu WG21 meeting

Modified:
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=274016&r1=274015&r2=274016&view=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Tue Jun 28 09:11:54 2016
@@ -93,6 +93,34 @@
http://wg21.link/P0031R0";>P0031R0LWGA Proposal to 
Add Constexpr Modifiers to reverse_iterator, move_iterator, array and Range 
AccessJacksonville
http://wg21.link/P0272R1";>P0272R1LWGGive 
std::string a non-const .data() member 
functionJacksonvilleComplete3.9
http://wg21.link/P0077R2";>P0077R2LWGis_callable,
 the missing INVOKE related 
traitJacksonvilleComplete3.9
+   
+   http://wg21.link/p0032r3";>p0032r3LWGHomogeneous 
interface for variant, any and optionalOulu
+   http://wg21.link/p0040r3";>p0040r3LWGExtending 
memory management toolsOulu
+   http://wg21.link/p0063r3";>p0063r3LWGC++17 should 
refer to C11 instead of C99Oulu
+   http://wg21.link/p0067r3";>p0067r3LWGElementary 
string conversionsOulu
+   http://wg21.link/p0083r3";>p0083r3LWGSplicing Maps 
and SetsOulu
+   http://wg21.link/p0084r2";>p0084r2LWGEmplace Return 
TypeOulu
+   http://wg21.link/p0088r3";>p0088r3LWGVariant: a 
type-safe union for C++17Oulu
+   http://wg21.link/p0163r0";>p0163r0LWGshared_ptr::weak_typeOulu
+   http://wg21.link/p0174r2";>p0174r2LWGDeprecating 
Vestigial Library Parts in C++17Oulu
+   http://wg21.link/p0175r1";>p0175r1LWGSynopses for 
the C libraryOulu
+   http://wg21.link/p0180r2";>p0180r2LWGReserve a New 
Library Namespace for Future 
StandardizationOulu
+   http://wg21.link/p0181r1";>p0181r1LWGOrdered by 
DefaultOulu
+   http://wg21.link/p0209r2";>p0209r2LWGmake_from_tuple:
 apply for constructionOulu
+   http://wg21.link/p0219r1";>p0219r1LWGRelative Paths 
for FilesystemOulu
+   http://wg21.link/p0254r2";>p0254r2LWGIntegrating 
std::string_view and std::stringOulu
+   http://wg21.link/p0258r2";>p0258r2LWGhas_unique_object_representationsOulu
+   http://wg21.link/p0295r0";>p0295r0LWGAdopt Selected 
Library Fundamentals V2 Components for 
C++17Oulu
+   http://wg21.link/p0302r1";>p0302r1LWGRemoving 
Allocator Support in std::functionOulu
+   http://wg21.link/p0307r2";>p0307r2LWGMaking Optional 
Greater Equal AgainOulu
+   http://wg21.link/p0336r1";>p0336r1LWGBetter Names 
for Parallel Execution Policies in 
C++17Oulu
+   http://wg21.link/p0337r0";>p0337r0LWGDelete 
operator= for polymorphic_allocatorOulu
+   http://wg21.link/p0346r1";>p0346r1LWGA 
 Nomenclature TweakOulu
+   http://wg21.link/p0358r1";>p0358r1LWGFixes for 
not_fnOulu
+   http://wg21.link/p0371r1";>p0371r1LWGTemporarily 
discourage memory_order_consumeOulu
+   http://wg21.link/p0392r0";>p0392r0LWGAdapting 
string_view by filesystem pathsOulu
+   http://wg21.link/p0393r3";>p0393r3LWGMaking Variant 
Greater EqualOulu
+   http://wg21.link/P0394r4";>P0394r4LWGHotel 
Parallelifornia: terminate() for Parallel Algorithms Exception 
HandlingOulu
 
   
 
@@ -231,6 +259,57 @@
http://cplusplus.github.io/LWG/lwg-defects.html#2585";>2585forward_list::resize(size_type,
 const value_type&) effects 
incorrectJacksonvilleComplete
http://cplusplus.github.io/LWG/lwg-defects.html#2586";>2586Wrong
 value category used in 
scoped_allocator_adaptor::construct()Jacksonville
http://cplusplus.github.io/LWG/lwg-defects.html#2590";>2590Aggregate
 initialization for 
std::arrayJacksonvilleComplete
+   
+   http://wg21.link/LWG2181";>2181Exceptions 
from seed sequence operationsOulu
+   http://wg21.link/LWG2309";>2309mutex::lock() should not throw 
device_or_resource_busyOulu
+   http://wg21.link/LWG2310";>2310Public 
exposition only member in std::arrayOulu
+   http://wg21.link/LWG2312";>2312tuple's 
constructor constraints need to be phrased more 
preciselyOulu
+   http://wg21.link/LWG2328";>2328Rvalue 
stream extraction should use perfect forwardingOulu
+   http://wg21.link/LWG2393";>2393std::function's Callable 
definition is brokenOulu
+   http://wg21.link/LWG2422";>2422std::numeric_limits::is_modulo
 description: "most machines" errataOulu
+   http://wg21.link/LWG2426";>2426Issue about 
compare_exchangeOulu
+   http://wg21.link/LWG2436";>2436Comparators 
for associative containers should always be 
CopyConstructibleOulu
+   http://wg21.link/LWG2441";>2441Exact-width 
atomic typedefs should be providedOulu
+   http://wg21.link/LWG2451";>2451[fund.ts.v2] optional should 
'forward' T's implicit conversionsOulu
+   http://wg21.link/LWG2509";

[libcxx] r274018 - Use WG21.link reflector to get to issues, rather than linking directly

2016-06-28 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Jun 28 09:13:28 2016
New Revision: 274018

URL: http://llvm.org/viewvc/llvm-project?rev=274018&view=rev
Log:
Use WG21.link reflector to get to issues, rather than linking directly

Modified:
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=274018&r1=274017&r2=274018&view=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Tue Jun 28 09:13:28 2016
@@ -128,137 +128,137 @@
 
   
Issue #Issue 
NameMeetingStatus
-   http://cplusplus.github.io/LWG/lwg-defects.html#2016";>2016Allocators
 must be no-throw swappableUrbanaComplete
-   http://cplusplus.github.io/LWG/lwg-defects.html#2376";>2118unique_ptr
 for array does not support cv qualification conversion of actual 
argumentUrbanaComplete
-   http://cplusplus.github.io/LWG/lwg-defects.html#2170";>2170Aggregates
 cannot be 
DefaultConstructibleUrbanaComplete
-   http://cplusplus.github.io/LWG/lwg-defects.html#2308";>2308Clarify
 container destructor requirements w.r.t. 
std::arrayUrbanaComplete
-   http://cplusplus.github.io/LWG/lwg-defects.html#2340";>2340Replacement
 allocation functions declared as 
inlineUrbanaComplete
-   http://cplusplus.github.io/LWG/lwg-defects.html#2354";>2354Unnecessary
 copying when inserting into maps with braced-init 
syntaxUrbanaComplete
-   http://cplusplus.github.io/LWG/lwg-defects.html#2377";>2377std::align
 requirements overly strictUrbanaComplete
-   http://cplusplus.github.io/LWG/lwg-defects.html#2396";>2396underlying_type
 doesn't say what to do for an incomplete enumeration 
typeUrbanaComplete
-   http://cplusplus.github.io/LWG/lwg-defects.html#2399";>2399shared_ptr's
 constructor from unique_ptr should be 
constrainedUrbanaComplete
-   http://cplusplus.github.io/LWG/lwg-defects.html#2400";>2400shared_ptr's
 get_deleter() should use 
addressof()UrbanaComplete
-   http://cplusplus.github.io/LWG/lwg-defects.html#2401";>2401std::function
 needs more noexceptUrbanaComplete
-   http://cplusplus.github.io/LWG/lwg-defects.html#2404";>2404mismatch()'s
 complexity needs to be updatedUrbanaComplete
-   http://cplusplus.github.io/LWG/lwg-defects.html#2408";>2408SFINAE-friendly
 common_type / iterator_traits is missing in 
C++14Urbanacommon_type is waiting on http://cplusplus.github.io/LWG/lwg-defects.html#2465";>LWG#2465
+   http://wg21.link/LWG2016";>2016Allocators 
must be no-throw swappableUrbanaComplete
+   http://wg21.link/LWG2376";>2118unique_ptr for array 
does not support cv qualification conversion of actual 
argumentUrbanaComplete
+   http://wg21.link/LWG2170";>2170Aggregates 
cannot be 
DefaultConstructibleUrbanaComplete
+   http://wg21.link/LWG2308";>2308Clarify 
container destructor requirements w.r.t. 
std::arrayUrbanaComplete
+   http://wg21.link/LWG2340";>2340Replacement 
allocation functions declared as 
inlineUrbanaComplete
+   http://wg21.link/LWG2354";>2354Unnecessary 
copying when inserting into maps with braced-init 
syntaxUrbanaComplete
+   http://wg21.link/LWG2377";>2377std::align 
requirements overly strictUrbanaComplete
+   http://wg21.link/LWG2396";>2396underlying_type 
doesn't say what to do for an incomplete enumeration 
typeUrbanaComplete
+   http://wg21.link/LWG2399";>2399shared_ptr's 
constructor from unique_ptr should be 
constrainedUrbanaComplete
+   http://wg21.link/LWG2400";>2400shared_ptr's 
get_deleter() should use 
addressof()UrbanaComplete
+   http://wg21.link/LWG2401";>2401std::function 
needs more noexceptUrbanaComplete
+   http://wg21.link/LWG2404";>2404mismatch()'s 
complexity needs to be updatedUrbanaComplete
+   http://wg21.link/LWG2408";>2408SFINAE-friendly 
common_type / iterator_traits is missing in 
C++14Urbanacommon_type is waiting on http://wg21.link/LWG2465";>LWG#2465

-   http://cplusplus.github.io/LWG/lwg-defects.html#2106";>2106move_iterator
 wrapping iterators returning prvaluesUrbanaComplete
-   http://cplusplus.github.io/LWG/lwg-defects.html#2129";>2129User 
specializations of 
std::initializer_listUrbanaComplete
-   http://cplusplus.github.io/LWG/lwg-defects.html#2212";>2212tuple_size
 for const pair request  
headerUrbanaComplete
-   http://cplusplus.github.io/LWG/lwg-defects.html#2217";>2217operator==(sub_match,
 string) slices on embedded 
'\0'sUrbanaComplete
-   http://cplusplus.github.io/LWG/lwg-defects.html#2230";>2230"see 
below" for initializer_list constructors of unordered 
containersUrbanaComplete
-   http://cplusplus.github.io/LWG/lwg-defects.html#2233";>2233bad_function_call::what()
 unhelpfulUrbanaComplete
-   http://cplusplus.github.io/LWG/lwg-defects.html#2266";>2266vector
 and deque have incorrect insert 
requirementsUrbanaComplete
-   http://cplusplus

[PATCH] D21792: [Clang][Feature] Adding CLFLUSHOPT feature and intrinsic to clang

2016-06-28 Thread michael zuckerman via cfe-commits
m_zuckerman created this revision.
m_zuckerman added reviewers: AsafBadouh, igorb, delena.
m_zuckerman added a subscriber: cfe-commits.

http://reviews.llvm.org/D21792

Files:
  include/clang/Basic/BuiltinsX86.def
  lib/Headers/CMakeLists.txt
  lib/Headers/clflushoptintrin.h
  lib/Headers/immintrin.h
  test/CodeGen/builtin-clflushopt.c

Index: test/CodeGen/builtin-clflushopt.c
===
--- test/CodeGen/builtin-clflushopt.c
+++ test/CodeGen/builtin-clflushopt.c
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +clflushopt  -emit-llvm -o - -Werror | FileCheck %s
+#define __MM_MALLOC_H
+
+#include 
+void test_mm_clflushopt(char * __m) {
+  //CHECK-LABLE: @test_mm_clflushopt
+  //CHECK: @llvm.x86.clflushopt
+  _mm_clflushopt(__m);
+}
Index: lib/Headers/immintrin.h
===
--- lib/Headers/immintrin.h
+++ lib/Headers/immintrin.h
@@ -54,6 +54,10 @@
 #include 
 #endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__CLFLUSHOPT__)
+#include 
+#endif
+
 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX__)
 #include 
 #endif
Index: lib/Headers/clflushoptintrin.h
===
--- lib/Headers/clflushoptintrin.h
+++ lib/Headers/clflushoptintrin.h
@@ -0,0 +1,41 @@
+/*=== clflushoptintrin.h - CLFLUSHOPT intrinsic ===
+ *
+ * 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 __IMMINTRIN_H
+#error "Never use  directly; include  instead."
+#endif
+
+#ifndef __CLFLUSHOPTINTRIN_H
+#define __CLFLUSHOPTINTRIN_H
+
+/* Define the default attributes for the functions in this file. */
+#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__,  __target__("clflushopt")))
+
+static __inline__ void __DEFAULT_FN_ATTRS
+_mm_clflushopt(char * __m) {
+  __builtin_ia32_clflushopt(__m);
+}
+
+#undef __DEFAULT_FN_ATTRS
+
+#endif
Index: lib/Headers/CMakeLists.txt
===
--- lib/Headers/CMakeLists.txt
+++ lib/Headers/CMakeLists.txt
@@ -27,6 +27,7 @@
   __clang_cuda_runtime_wrapper.h
   cpuid.h
   cuda_builtin_vars.h
+  clflushoptintrin.h
   emmintrin.h
   f16cintrin.h
   float.h
Index: include/clang/Basic/BuiltinsX86.def
===
--- include/clang/Basic/BuiltinsX86.def
+++ include/clang/Basic/BuiltinsX86.def
@@ -652,6 +652,9 @@
 TARGET_BUILTIN(__builtin_ia32_xsaves, "vv*ULLi", "", "xsaves")
 TARGET_BUILTIN(__builtin_ia32_xsaves64, "vv*ULLi", "", "xsaves")
 
+//CLFLUSHOPT
+TARGET_BUILTIN(__builtin_ia32_clflushopt, "vc*", "", "clflushopt")
+
 // ADX
 TARGET_BUILTIN(__builtin_ia32_addcarryx_u32, "UcUcUiUiUi*", "", "adx")
 TARGET_BUILTIN(__builtin_ia32_addcarryx_u64, "UcUcULLiULLiULLi*", "", "adx")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r274019 - [clang-tidy] Do not match on lambdas.

2016-06-28 Thread Samuel Benzaquen via cfe-commits
Author: sbenza
Date: Tue Jun 28 09:19:41 2016
New Revision: 274019

URL: http://llvm.org/viewvc/llvm-project?rev=274019&view=rev
Log:
[clang-tidy] Do not match on lambdas.

We match on the generated FunctionDecl of the lambda and try to fix it.
This causes a crash.
The right behavior is to ignore lambdas, because they are a definition.

Modified:
clang-tools-extra/trunk/clang-tidy/readability/AvoidConstParamsInDecls.cpp

clang-tools-extra/trunk/test/clang-tidy/readability-avoid-const-params-in-decls.cpp

Modified: 
clang-tools-extra/trunk/clang-tidy/readability/AvoidConstParamsInDecls.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/AvoidConstParamsInDecls.cpp?rev=274019&r1=274018&r2=274019&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/readability/AvoidConstParamsInDecls.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/readability/AvoidConstParamsInDecls.cpp 
Tue Jun 28 09:19:41 2016
@@ -32,10 +32,14 @@ SourceRange getTypeRange(const ParmVarDe
 void AvoidConstParamsInDecls::registerMatchers(MatchFinder *Finder) {
   const auto ConstParamDecl =
   parmVarDecl(hasType(qualType(isConstQualified(.bind("param");
-  Finder->addMatcher(functionDecl(unless(isDefinition()),
-  has(typeLoc(forEach(ConstParamDecl
- .bind("func"),
- this);
+  Finder->addMatcher(
+  functionDecl(unless(isDefinition()),
+   // Lambdas are always their own definition, but they
+   // generate a non-definition FunctionDecl too. Ignore those.
+   unless(cxxMethodDecl(ofClass(cxxRecordDecl(isLambda(),
+   has(typeLoc(forEach(ConstParamDecl
+  .bind("func"),
+  this);
 }
 
 // Re-lex the tokens to get precise location of last 'const'

Modified: 
clang-tools-extra/trunk/test/clang-tidy/readability-avoid-const-params-in-decls.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-avoid-const-params-in-decls.cpp?rev=274019&r1=274018&r2=274019&view=diff
==
--- 
clang-tools-extra/trunk/test/clang-tidy/readability-avoid-const-params-in-decls.cpp
 (original)
+++ 
clang-tools-extra/trunk/test/clang-tidy/readability-avoid-const-params-in-decls.cpp
 Tue Jun 28 09:19:41 2016
@@ -90,3 +90,7 @@ void ConstNotVisible(CONCAT(cons, t) int
 // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: parameter 'i'
 // We warn, but we can't give a fix
 // CHECK-FIXES: void ConstNotVisible(CONCAT(cons, t) int i);
+
+// Regression test. We should not warn (or crash) on lambda expressions
+auto lambda_with_name = [](const int n) {};
+auto lambda_without_name = [](const int) {};


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


Re: [PATCH] D21075: Correct invalid end location in diagnostics for some identifiers.

2016-06-28 Thread Manuel Klimek via cfe-commits
klimek added inline comments.


Comment at: lib/Sema/SemaType.cpp:1339
@@ +1338,3 @@
+auto R = DS.getSourceRange();
+if (R.getEnd().isInvalid())
+  R.setEnd(R.getBegin());

Do you know in which cases we get source ranges that are half valid?


http://reviews.llvm.org/D21075



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


Re: [PATCH] D21277: Resubmit r270688: Using new TargetParser in Clang.

2016-06-28 Thread Mehdi AMINI via cfe-commits
mehdi_amini added a comment.

Why was it closed? Was it committed? It'd be nice to have a comment with the 
closing action.


Repository:
  rL LLVM

http://reviews.llvm.org/D21277



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


Re: [PATCH] D21744: [OpenCL] Fix code generation of kernel pipe parameters.

2016-06-28 Thread Anastasia Stulova via cfe-commits
Anastasia accepted this revision.
Anastasia added a comment.
This revision is now accepted and ready to land.

LGTM!



Comment at: lib/CodeGen/CodeGenFunction.cpp:535
@@ -531,3 +534,3 @@
   if (isPipe)
-baseTypeName =
-  
cast(ty)->getElementType().getCanonicalType().getAsString(Policy);
+baseTypeName = ty.getCanonicalType()
+   ->getAs()

I am guessing this is output of clang-format, looks a bit strange though...


http://reviews.llvm.org/D21744



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


Re: [PATCH] D21737: [PATCH] [CodeGen] Insert TargetLibraryInfoWrapperPass before anything else.

2016-06-28 Thread Mehdi AMINI via cfe-commits
mehdi_amini requested changes to this revision.
mehdi_amini added a comment.
This revision now requires changes to proceed.

Missing test.


Repository:
  rL LLVM

http://reviews.llvm.org/D21737



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


Re: [PATCH] D21737: [PATCH] [CodeGen] Insert TargetLibraryInfoWrapperPass before anything else.

2016-06-28 Thread Mehdi AMINI via cfe-commits
mehdi_amini added inline comments.


Comment at: lib/CodeGen/BackendUtil.cpp:459
@@ -456,2 +458,3 @@
   legacy::FunctionPassManager *FPM = getPerFunctionPasses();
+  FPM->add(new TargetLibraryInfoWrapperPass(*TLII));
   if (CodeGenOpts.VerifyModule)

It is not super clean to duplicated this code.
Also the minimum is to document why it is done.


Repository:
  rL LLVM

http://reviews.llvm.org/D21737



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


[PATCH] D21795: [OpenCL] Add attribute 'pure' to read_image built-in functions to enable optimizations.

2016-06-28 Thread Alexey Bader via cfe-commits
bader created this revision.
bader added reviewers: Anastasia, yaxunl.
bader added subscribers: cfe-commits, pxli168, pekka.jaaskelainen.

http://reviews.llvm.org/D21795

Files:
  lib/Headers/opencl-c.h

Index: lib/Headers/opencl-c.h
===
--- lib/Headers/opencl-c.h
+++ lib/Headers/opencl-c.h
@@ -19,7 +19,7 @@
 #define __ovld __attribute__((overloadable))
 
 // Optimizations
-
+#define __purefn __attribute__((pure))
 #define __cnfn __attribute__((const))
 
 // built-in scalar data types:
@@ -15685,324 +15685,324 @@
  * in the description above are undefined.
  */
 
-float4 __ovld read_imagef(read_only image2d_t image, sampler_t sampler, int2 coord);
-float4 __ovld read_imagef(read_only image2d_t image, sampler_t sampler, float2 coord);
+float4 __purefn __ovld read_imagef(read_only image2d_t image, sampler_t sampler, int2 coord);
+float4 __purefn __ovld read_imagef(read_only image2d_t image, sampler_t sampler, float2 coord);
 
-int4 __ovld read_imagei(read_only image2d_t image, sampler_t sampler, int2 coord);
-int4 __ovld read_imagei(read_only image2d_t image, sampler_t sampler, float2 coord);
-uint4 __ovld read_imageui(read_only image2d_t image, sampler_t sampler, int2 coord);
-uint4 __ovld read_imageui(read_only image2d_t image, sampler_t sampler, float2 coord);
+int4 __purefn __ovld read_imagei(read_only image2d_t image, sampler_t sampler, int2 coord);
+int4 __purefn __ovld read_imagei(read_only image2d_t image, sampler_t sampler, float2 coord);
+uint4 __purefn __ovld read_imageui(read_only image2d_t image, sampler_t sampler, int2 coord);
+uint4 __purefn __ovld read_imageui(read_only image2d_t image, sampler_t sampler, float2 coord);
 
-float4 __ovld read_imagef(read_only image3d_t image, sampler_t sampler, int4 coord);
-float4 __ovld read_imagef(read_only image3d_t image, sampler_t sampler, float4 coord);
+float4 __purefn __ovld read_imagef(read_only image3d_t image, sampler_t sampler, int4 coord);
+float4 __purefn __ovld read_imagef(read_only image3d_t image, sampler_t sampler, float4 coord);
 
-int4 __ovld read_imagei(read_only image3d_t image, sampler_t sampler, int4 coord);
-int4 __ovld read_imagei(read_only image3d_t image, sampler_t sampler, float4 coord);
-uint4 __ovld read_imageui(read_only image3d_t image, sampler_t sampler, int4 coord);
-uint4 __ovld read_imageui(read_only image3d_t image, sampler_t sampler, float4 coord);
+int4 __purefn __ovld read_imagei(read_only image3d_t image, sampler_t sampler, int4 coord);
+int4 __purefn __ovld read_imagei(read_only image3d_t image, sampler_t sampler, float4 coord);
+uint4 __purefn __ovld read_imageui(read_only image3d_t image, sampler_t sampler, int4 coord);
+uint4 __purefn __ovld read_imageui(read_only image3d_t image, sampler_t sampler, float4 coord);
 
-float4 __ovld read_imagef(read_only image2d_array_t image_array, sampler_t sampler, int4 coord);
-float4 __ovld read_imagef(read_only image2d_array_t image_array, sampler_t sampler, float4 coord);
+float4 __purefn __ovld read_imagef(read_only image2d_array_t image_array, sampler_t sampler, int4 coord);
+float4 __purefn __ovld read_imagef(read_only image2d_array_t image_array, sampler_t sampler, float4 coord);
 
-int4 __ovld read_imagei(read_only image2d_array_t image_array, sampler_t sampler, int4 coord);
-int4 __ovld read_imagei(read_only image2d_array_t image_array, sampler_t sampler, float4 coord);
-uint4 __ovld read_imageui(read_only image2d_array_t image_array, sampler_t sampler, int4 coord);
-uint4 __ovld read_imageui(read_only image2d_array_t image_array, sampler_t sampler, float4 coord);
+int4 __purefn __ovld read_imagei(read_only image2d_array_t image_array, sampler_t sampler, int4 coord);
+int4 __purefn __ovld read_imagei(read_only image2d_array_t image_array, sampler_t sampler, float4 coord);
+uint4 __purefn __ovld read_imageui(read_only image2d_array_t image_array, sampler_t sampler, int4 coord);
+uint4 __purefn __ovld read_imageui(read_only image2d_array_t image_array, sampler_t sampler, float4 coord);
 
-float4 __ovld read_imagef(read_only image1d_t image, sampler_t sampler, int coord);
-float4 __ovld read_imagef(read_only image1d_t image, sampler_t sampler, float coord);
+float4 __purefn __ovld read_imagef(read_only image1d_t image, sampler_t sampler, int coord);
+float4 __purefn __ovld read_imagef(read_only image1d_t image, sampler_t sampler, float coord);
 
-int4 __ovld read_imagei(read_only image1d_t image, sampler_t sampler, int coord);
-int4 __ovld read_imagei(read_only image1d_t image, sampler_t sampler, float coord);
-uint4 __ovld read_imageui(read_only image1d_t image, sampler_t sampler, int coord);
-uint4 __ovld read_imageui(read_only image1d_t image, sampler_t sampler, float coord);
+int4 __purefn __ovld read_imagei(read_only image1d_t image, sampler_t sampler, int coord);
+int4 __purefn __ovld read_imagei(read_only image1d_t image, sampler_t sampler, float coord);
+uint4 __purefn __ovld read_imageui(read_only ima

Re: [PATCH] D21783: [CodeView] Implement support for bitfields in Clang

2016-06-28 Thread David Majnemer via cfe-commits
majnemer updated this revision to Diff 62095.
majnemer added a comment.

- Address review comments


http://reviews.llvm.org/D21783

Files:
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CGDebugInfo.h
  test/CodeGen/debug-info-packed-struct.c
  test/CodeGenCXX/debug-info-ms-bitfields.cpp

Index: test/CodeGenCXX/debug-info-ms-bitfields.cpp
===
--- /dev/null
+++ test/CodeGenCXX/debug-info-ms-bitfields.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple x86_64-pc-win32 -debug-info-kind=limited -gcodeview %s -emit-llvm -o - | FileCheck %s
+
+#pragma pack(1)
+struct S {
+  char : 8;
+  short   : 8;
+  short x : 8;
+} s;
+
+// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "x", {{.*}}, size: 8, align: 16, offset: 16, flags: DIFlagBitField, extraData: i64 8)
Index: test/CodeGen/debug-info-packed-struct.c
===
--- test/CodeGen/debug-info-packed-struct.c
+++ test/CodeGen/debug-info-packed-struct.c
@@ -21,7 +21,7 @@
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l0_ofs8",
 // CHECK-SAME: {{.*}}size: 64, align: 64, offset: 64)
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l0_ofs16",
-// CHECK-SAME: {{.*}}size: 1, align: 32, offset: 128)
+// CHECK-SAME: {{.*}}size: 1, align: 32, offset: 128, flags: DIFlagBitField, extraData: i64 128)
 
 
 // -
@@ -40,7 +40,7 @@
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l1_ofs1",
 // CHECK-SAME: {{.*}}size: 64, align: 8, offset: 8)
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l1_ofs9",
-// CHECK-SAME: {{.*}}size: 1, align: 32, offset: 72)
+// CHECK-SAME: {{.*}}size: 1, align: 32, offset: 72, flags: DIFlagBitField, extraData: i64 72)
 
 
 // -
@@ -61,7 +61,7 @@
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l2_ofs1",
 // CHECK-SAME: {{.*}}size: 64, align: 8, offset: 8)
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l2_ofs9",
-// CHECK-SAME: {{.*}}size: 1, align: 32, offset: 72)
+// CHECK-SAME: {{.*}}size: 1, align: 32, offset: 72, flags: DIFlagBitField, extraData: i64 72)
 
 
 
@@ -83,7 +83,7 @@
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l3_ofs4",
 // CHECK-SAME: {{.*}}size: 64, align: 32, offset: 32)
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l3_ofs12",
-// CHECK-SAME: {{.*}}size: 1, align: 32, offset: 96)
+// CHECK-SAME: {{.*}}size: 1, align: 32, offset: 96, flags: DIFlagBitField, extraData: i64 96)
 
 struct layout0 l0;
 struct layout1 l1;
Index: lib/CodeGen/CGDebugInfo.h
===
--- lib/CodeGen/CGDebugInfo.h
+++ lib/CodeGen/CGDebugInfo.h
@@ -232,11 +232,16 @@
llvm::DIFile *F);
 
   llvm::DIType *createFieldType(StringRef name, QualType type,
-uint64_t sizeInBitsOverride, SourceLocation loc,
-AccessSpecifier AS, uint64_t offsetInBits,
-llvm::DIFile *tunit, llvm::DIScope *scope,
+SourceLocation loc, AccessSpecifier AS,
+uint64_t offsetInBits, llvm::DIFile *tunit,
+llvm::DIScope *scope,
 const RecordDecl *RD = nullptr);
 
+  /// Create new bit field member.
+  llvm::DIType *createBitFieldType(const FieldDecl *BitFieldDecl,
+   llvm::DIScope *RecordTy,
+   const RecordDecl *RD);
+
   /// Helpers for collecting fields of a record.
   /// @{
   void CollectRecordLambdaFields(const CXXRecordDecl *CXXDecl,
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -13,6 +13,7 @@
 
 #include "CGDebugInfo.h"
 #include "CGBlocks.h"
+#include "CGRecordLayout.h"
 #include "CGCXXABI.h"
 #include "CGObjCRuntime.h"
 #include "CodeGenFunction.h"
@@ -905,10 +906,38 @@
   llvm_unreachable("unexpected access enumerator");
 }
 
-llvm::DIType *CGDebugInfo::createFieldType(
-StringRef name, QualType type, uint64_t sizeInBitsOverride,
-SourceLocation loc, AccessSpecifier AS, uint64_t offsetInBits,
-llvm::DIFile *tunit, llvm::DIScope *scope, const RecordDecl *RD) {
+llvm::DIType *CGDebugInfo::createBitFieldType(const FieldDecl *BitFieldDecl,
+  llvm::DIScope *RecordTy,
+  const RecordDecl *RD) {
+  StringRef Name = BitFieldDecl->getName();
+  QualType Ty = BitFieldDecl->getType();
+  SourceLocation Loc = BitFieldDecl->getLocation();
+  llvm::DIFile *VUnit = getOrCreateFile(Loc);
+  llvm::DIType *DebugType = getOrCreateType(Ty, VUnit);
+
+  // Get the location for the f

Re: [PATCH] D20338: [PCH] Fixed overridden files always invalidating preamble even when unchanged

2016-06-28 Thread Cameron via cfe-commits
cameron314 added a comment.

Anyone have a few minutes to look at this?


http://reviews.llvm.org/D20338



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


Re: [PATCH] D21145: [Sema] Fix crash on valid where instantiation of lambda cannot access type of 'this'

2016-06-28 Thread Erik Pilkington via cfe-commits
erik.pilkington added a comment.

Okay, thanks! I'll add the assert in.
@rsmith: Any thoughts on this?


http://reviews.llvm.org/D21145



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


Re: r273911 - [ExprConstant] Fix PR28314 - crash while evluating objectsize.

2016-06-28 Thread Hans Wennborg via cfe-commits
+Tom who does the "dot" releases.

I don't know if he's planning for a 3.8.2, but just in case, I suppose
it's on the radar now :-)

Thanks,
Hans

On Mon, Jun 27, 2016 at 11:21 PM, George Burgess IV
 wrote:
> +Richard, Hans
>
> This patch fixes a crash that's also present in Clang 3.8. So, I think it
> should find its way into 3.8.2, if possible.
>
> Thank you! :)
>
> -- Forwarded message --
> From: George Burgess IV via cfe-commits 
> Date: Mon, Jun 27, 2016 at 12:40 PM
> Subject: r273911 - [ExprConstant] Fix PR28314 - crash while evluating
> objectsize.
> To: cfe-commits@lists.llvm.org
>
>
> Author: gbiv
> Date: Mon Jun 27 14:40:41 2016
> New Revision: 273911
>
> URL: http://llvm.org/viewvc/llvm-project?rev=273911&view=rev
> Log:
> [ExprConstant] Fix PR28314 - crash while evluating objectsize.
>
> This fixes a crash in code like:
> ```
> struct A {
>   struct B b;
>   char c[1];
> }
>
> int foo(struct A* a) { return __builtin_object_size(a->c, 0); }
> ```
>
> We wouldn't check whether the structs we were examining were invalid,
> and getting the layout of an invalid struct is (unsurprisingly) A Bad
> Thing. With this patch, we'll always return conservatively if we see an
> invalid struct, since I'm assuming the presence of an invalid struct
> means that our compilation failed (so having a conservative result isn't
> such a big deal).
>
> Modified:
> cfe/trunk/lib/AST/ExprConstant.cpp
> cfe/trunk/test/Sema/builtin-object-size.c
>
> Modified: cfe/trunk/lib/AST/ExprConstant.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=273911&r1=273910&r2=273911&view=diff
> ==
> --- cfe/trunk/lib/AST/ExprConstant.cpp (original)
> +++ cfe/trunk/lib/AST/ExprConstant.cpp Mon Jun 27 14:40:41 2016
> @@ -6540,25 +6540,32 @@ static const Expr *ignorePointerCastsAnd
>  ///
>  /// Please note: this function is specialized for how __builtin_object_size
>  /// views "objects".
> +///
> +/// If this encounters an invalid RecordDecl, it will always return true.
>  static bool isDesignatorAtObjectEnd(const ASTContext &Ctx, const LValue
> &LVal) {
>assert(!LVal.Designator.Invalid);
>
> -  auto IsLastFieldDecl = [&Ctx](const FieldDecl *FD) {
> -if (FD->getParent()->isUnion())
> +  auto IsLastOrInvalidFieldDecl = [&Ctx](const FieldDecl *FD, bool
> &Invalid) {
> +const RecordDecl *Parent = FD->getParent();
> +Invalid = Parent->isInvalidDecl();
> +if (Invalid || Parent->isUnion())
>return true;
> -const ASTRecordLayout &Layout =
> Ctx.getASTRecordLayout(FD->getParent());
> +const ASTRecordLayout &Layout = Ctx.getASTRecordLayout(Parent);
>  return FD->getFieldIndex() + 1 == Layout.getFieldCount();
>};
>
>auto &Base = LVal.getLValueBase();
>if (auto *ME = dyn_cast_or_null(Base.dyn_cast *>())) {
>  if (auto *FD = dyn_cast(ME->getMemberDecl())) {
> -  if (!IsLastFieldDecl(FD))
> -return false;
> +  bool Invalid;
> +  if (!IsLastOrInvalidFieldDecl(FD, Invalid))
> +return Invalid;
>  } else if (auto *IFD =
> dyn_cast(ME->getMemberDecl())) {
> -  for (auto *FD : IFD->chain())
> -if (!IsLastFieldDecl(cast(FD)))
> -  return false;
> +  for (auto *FD : IFD->chain()) {
> +bool Invalid;
> +if (!IsLastOrInvalidFieldDecl(cast(FD), Invalid))
> +  return Invalid;
> +  }
>  }
>}
>
> @@ -6581,8 +6588,9 @@ static bool isDesignatorAtObjectEnd(cons
>  return false;
>BaseType = CT->getElementType();
>  } else if (auto *FD = getAsField(LVal.Designator.Entries[I])) {
> -  if (!IsLastFieldDecl(FD))
> -return false;
> +  bool Invalid;
> +  if (!IsLastOrInvalidFieldDecl(FD, Invalid))
> +return Invalid;
>BaseType = FD->getType();
>  } else {
>assert(getAsBaseClass(LVal.Designator.Entries[I]) != nullptr &&
>
> Modified: cfe/trunk/test/Sema/builtin-object-size.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/builtin-object-size.c?rev=273911&r1=273910&r2=273911&view=diff
> ==
> --- cfe/trunk/test/Sema/builtin-object-size.c (original)
> +++ cfe/trunk/test/Sema/builtin-object-size.c Mon Jun 27 14:40:41 2016
> @@ -52,3 +52,27 @@ void f6(void)
>__builtin___memccpy_chk (buf, b, '\0', sizeof(b), __builtin_object_size
> (buf, 0));
>__builtin___memccpy_chk (b, buf, '\0', sizeof(buf), __builtin_object_size
> (b, 0));  // expected-warning {{'__builtin___memccpy_chk' will always
> overflow destination buffer}}
>  }
> +
> +int pr28314(void) {
> +  struct {
> +struct InvalidField a; // expected-error{{has incomplete type}}
> expected-note 3{{forward declaration of 'struct InvalidField'}}
> +char b[0];
> +  } *p;
> +
> +  struct {
> +struct InvalidField a; // expected-error{{has incomplete type}}
> +char b[1];
> +  } *p

Re: [PATCH] D21744: [OpenCL] Fix code generation of kernel pipe parameters.

2016-06-28 Thread Alexey Bader via cfe-commits
bader updated this revision to Diff 62100.
bader added a comment.

Re-format the patch.
No functional changes.


http://reviews.llvm.org/D21744

Files:
  lib/CodeGen/CodeGenFunction.cpp
  test/CodeGenOpenCL/pipe_types.cl

Index: test/CodeGenOpenCL/pipe_types.cl
===
--- test/CodeGenOpenCL/pipe_types.cl
+++ test/CodeGenOpenCL/pipe_types.cl
@@ -25,3 +25,23 @@
 void test5(read_only pipe int4 p) {
 // CHECK: define void @test5(%opencl.pipe_t* %p)
 }
+
+typedef pipe int MyPipe;
+kernel void test6(read_only MyPipe p) {
+// CHECK: define void @test6(%opencl.pipe_t* %p)
+}
+
+struct Person {
+  const char *Name;
+  bool isFemale;
+  int ID;
+};
+
+void test_reserved_read_pipe(global struct Person *SDst,
+ read_only pipe struct Person SPipe) {
+// CHECK: define void @test_reserved_read_pipe
+  read_pipe (SPipe, SDst);
+  // CHECK: call i32 @__read_pipe_2(%opencl.pipe_t* %{{.*}}, i8* %{{.*}})
+  read_pipe (SPipe, SDst);
+  // CHECK: call i32 @__read_pipe_2(%opencl.pipe_t* %{{.*}}, i8* %{{.*}})
+}
Index: lib/CodeGen/CodeGenFunction.cpp
===
--- lib/CodeGen/CodeGenFunction.cpp
+++ lib/CodeGen/CodeGenFunction.cpp
@@ -516,7 +516,8 @@
   // Get argument type name.
   std::string typeName;
   if (isPipe)
-typeName = cast(ty)->getElementType().getAsString(Policy);
+typeName = ty.getCanonicalType()->getAs()->getElementType()
+ .getAsString(Policy);
   else
 typeName = ty.getUnqualifiedType().getAsString(Policy);
 
@@ -529,8 +530,9 @@
 
   std::string baseTypeName;
   if (isPipe)
-baseTypeName =
-  
cast(ty)->getElementType().getCanonicalType().getAsString(Policy);
+baseTypeName = ty.getCanonicalType()->getAs()
+  ->getElementType().getCanonicalType()
+  .getAsString(Policy);
   else
 baseTypeName =
   ty.getUnqualifiedType().getCanonicalType().getAsString(Policy);


Index: test/CodeGenOpenCL/pipe_types.cl
===
--- test/CodeGenOpenCL/pipe_types.cl
+++ test/CodeGenOpenCL/pipe_types.cl
@@ -25,3 +25,23 @@
 void test5(read_only pipe int4 p) {
 // CHECK: define void @test5(%opencl.pipe_t* %p)
 }
+
+typedef pipe int MyPipe;
+kernel void test6(read_only MyPipe p) {
+// CHECK: define void @test6(%opencl.pipe_t* %p)
+}
+
+struct Person {
+  const char *Name;
+  bool isFemale;
+  int ID;
+};
+
+void test_reserved_read_pipe(global struct Person *SDst,
+ read_only pipe struct Person SPipe) {
+// CHECK: define void @test_reserved_read_pipe
+  read_pipe (SPipe, SDst);
+  // CHECK: call i32 @__read_pipe_2(%opencl.pipe_t* %{{.*}}, i8* %{{.*}})
+  read_pipe (SPipe, SDst);
+  // CHECK: call i32 @__read_pipe_2(%opencl.pipe_t* %{{.*}}, i8* %{{.*}})
+}
Index: lib/CodeGen/CodeGenFunction.cpp
===
--- lib/CodeGen/CodeGenFunction.cpp
+++ lib/CodeGen/CodeGenFunction.cpp
@@ -516,7 +516,8 @@
   // Get argument type name.
   std::string typeName;
   if (isPipe)
-typeName = cast(ty)->getElementType().getAsString(Policy);
+typeName = ty.getCanonicalType()->getAs()->getElementType()
+ .getAsString(Policy);
   else
 typeName = ty.getUnqualifiedType().getAsString(Policy);
 
@@ -529,8 +530,9 @@
 
   std::string baseTypeName;
   if (isPipe)
-baseTypeName =
-  cast(ty)->getElementType().getCanonicalType().getAsString(Policy);
+baseTypeName = ty.getCanonicalType()->getAs()
+  ->getElementType().getCanonicalType()
+  .getAsString(Policy);
   else
 baseTypeName =
   ty.getUnqualifiedType().getCanonicalType().getAsString(Policy);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21795: [OpenCL] Add attribute 'pure' to read_image built-in functions to enable optimizations.

2016-06-28 Thread Anastasia Stulova via cfe-commits
Anastasia accepted this revision.
Anastasia added a comment.
This revision is now accepted and ready to land.

LGTM!


http://reviews.llvm.org/D21795



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


Re: [PATCH] D21367: AMDGPU: Set amdgpu_kernel calling convention for OpenCL kernels.

2016-06-28 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: lib/Basic/Targets.cpp:2122
@@ +2121,3 @@
+
+  
+  CallingConvCheckResult checkCallingConvention(CallingConv CC) const override 
{

One extra line?


http://reviews.llvm.org/D21367



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


[PATCH] D21799: [ASTMatchers] Add missing forEachArgumentWithParam() to code sample

2016-06-28 Thread Martin Böhme via cfe-commits
mboehme created this revision.
mboehme added a reviewer: klimek.
mboehme added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

http://reviews.llvm.org/D21799

Files:
  include/clang/ASTMatchers/ASTMatchers.h

Index: include/clang/ASTMatchers/ASTMatchers.h
===
--- include/clang/ASTMatchers/ASTMatchers.h
+++ include/clang/ASTMatchers/ASTMatchers.h
@@ -3154,8 +3154,11 @@
 ///   int y;
 ///   f(y);
 /// \endcode
-/// callExpr(declRefExpr(to(varDecl(hasName("y",
-/// parmVarDecl(hasType(isInteger(
+/// callExpr(
+///   forEachArgumentWithParam(
+/// declRefExpr(to(varDecl(hasName("y",
+/// parmVarDecl(hasType(isInteger()))
+/// ))
 ///   matches f(y);
 /// with declRefExpr(...)
 ///   matching int y


Index: include/clang/ASTMatchers/ASTMatchers.h
===
--- include/clang/ASTMatchers/ASTMatchers.h
+++ include/clang/ASTMatchers/ASTMatchers.h
@@ -3154,8 +3154,11 @@
 ///   int y;
 ///   f(y);
 /// \endcode
-/// callExpr(declRefExpr(to(varDecl(hasName("y",
-/// parmVarDecl(hasType(isInteger(
+/// callExpr(
+///   forEachArgumentWithParam(
+/// declRefExpr(to(varDecl(hasName("y",
+/// parmVarDecl(hasType(isInteger()))
+/// ))
 ///   matches f(y);
 /// with declRefExpr(...)
 ///   matching int y
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r274031 - [CMake] [Apple Clang] Enable Compiler-RT tests on stage2 builds

2016-06-28 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Tue Jun 28 11:32:48 2016
New Revision: 274031

URL: http://llvm.org/viewvc/llvm-project?rev=274031&view=rev
Log:
[CMake] [Apple Clang] Enable Compiler-RT tests on stage2 builds

We want to be able to run the compiler-rt tests on stage2 build configurations 
in CI. This should enable that.

Modified:
cfe/trunk/cmake/caches/Apple-stage2.cmake

Modified: cfe/trunk/cmake/caches/Apple-stage2.cmake
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/caches/Apple-stage2.cmake?rev=274031&r1=274030&r2=274031&view=diff
==
--- cfe/trunk/cmake/caches/Apple-stage2.cmake (original)
+++ cfe/trunk/cmake/caches/Apple-stage2.cmake Tue Jun 28 11:32:48 2016
@@ -21,8 +21,6 @@ set(COMPILER_RT_ENABLE_IOS ON CACHE BOOL
 
 # Make unit tests (if present) part of the ALL target
 set(LLVM_BUILD_TESTS ON CACHE BOOL "")
-# Don't build or run the compiler-rt tests
-set(COMPILER_RT_INCLUDE_TESTS OFF CACHE BOOL "")
 
 set(LLVM_ENABLE_LTO ON CACHE BOOL "")
 set(CMAKE_C_FLAGS "-fno-stack-protector -fno-common 
-Wno-profile-instr-unprofiled" CACHE STRING "")


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


Re: [PATCH] D21666: [Tooling] Add optional argument to getFullyQualifiedName to prepend "::".

2016-06-28 Thread Siva Chandra via cfe-commits
sivachandra added a comment.

Ping.


http://reviews.llvm.org/D21666



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


r274035 - [CMake] Pass LLVM_LIT_ARGS into compiler-rt build.

2016-06-28 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Tue Jun 28 12:00:49 2016
New Revision: 274035

URL: http://llvm.org/viewvc/llvm-project?rev=274035&view=rev
Log:
[CMake] Pass LLVM_LIT_ARGS into compiler-rt build.

If top-level lit args are specified, you probably want that in the sub-project 
too.

Modified:
cfe/trunk/runtime/CMakeLists.txt

Modified: cfe/trunk/runtime/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/runtime/CMakeLists.txt?rev=274035&r1=274034&r2=274035&view=diff
==
--- cfe/trunk/runtime/CMakeLists.txt (original)
+++ cfe/trunk/runtime/CMakeLists.txt Tue Jun 28 12:00:49 2016
@@ -70,6 +70,7 @@ if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND E
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
-DLLVM_CONFIG_PATH=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-config
+   -DLLVM_LIT_ARGS=${LLVM_LIT_ARGS}

-DCOMPILER_RT_OUTPUT_DIR=${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}
-DCOMPILER_RT_EXEC_OUTPUT_DIR=${LLVM_RUNTIME_OUTPUT_INTDIR}

-DCOMPILER_RT_INSTALL_PATH:STRING=lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}


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


Re: [PATCH] D21453: Add support for attribute "overallocated"

2016-06-28 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment.

I think you are right. There are other places that need to be fixed to properly 
support over-allocated structures. I'll see if I can come up with a patch that 
treats the over-allocated array as flexible array member.


http://reviews.llvm.org/D21453



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


Re: [PATCH] D21700: [SemaExpr] Support lax conversions in assignments with vector and scalars with same size

2016-06-28 Thread Bruno Cardoso Lopes via cfe-commits
bruno added a comment.

Ping!


http://reviews.llvm.org/D21700



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


Re: [PATCH] D21641: Use ArgList::hasFlag to check if -miamcu/-mno-iamcu is passed. NFC.

2016-06-28 Thread Bruno Cardoso Lopes via cfe-commits
bruno accepted this revision.
bruno added a comment.
This revision is now accepted and ready to land.

Cool, thanks! LGTM


http://reviews.llvm.org/D21641



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


r274045 - [CMake] Connect check-compiler-rt to check-all

2016-06-28 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Tue Jun 28 13:32:22 2016
New Revision: 274045

URL: http://llvm.org/viewvc/llvm-project?rev=274045&view=rev
Log:
[CMake] Connect check-compiler-rt to check-all

When using the LLVM_BUILD_EXTERNAL_COMPILER_RT option with
LLVM_ENABLE_TESTS we should also bind check-compiler-rt to check-all so
that the compiler-rt tests run too.

Modified:
cfe/trunk/runtime/CMakeLists.txt

Modified: cfe/trunk/runtime/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/runtime/CMakeLists.txt?rev=274045&r1=274044&r2=274045&view=diff
==
--- cfe/trunk/runtime/CMakeLists.txt (original)
+++ cfe/trunk/runtime/CMakeLists.txt Tue Jun 28 13:32:22 2016
@@ -141,6 +141,7 @@ if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND E
   COMMAND ${run_check_compiler_rt}
   DEPENDS compiler-rt-build ${COMPILER_RT_TEST_DEPENDENCIES}
   WORKING_DIRECTORY ${BINARY_DIR}
-  VERBATIM)
+  VERBATIM USES_TERMINAL)
+set_property(GLOBAL APPEND PROPERTY LLVM_LIT_DEPENDS check-compiler-rt)
   endif()
 endif()


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


[PATCH] D21810: Don't instantiate a full host toolchain in ASTMatchersTest.

2016-06-28 Thread Justin Lebar via cfe-commits
jlebar created this revision.
jlebar added a reviewer: chandlerc.
jlebar added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

This test was stat()'ing large swaths of /usr/lib hundreds of times, as
every invocation of matchesConditionally*() created a new Linux
toolchain.

In addition to being slow, perf indicated this was causing substantial
contention in the kernel.

Something is...interesting in the kernel, as without this patch I
sometimes see ~11m spent in the kernel, and sometimes ~5m.  This
corresponds to bimodal ninja check-clang times of ~30s and ~20s.

It's not clear to me exactly what causes the bimodality.  In any case,
this change makes this test run in 2.5s, down from 17s, and it seems to
cause us to get the 20s ninja check-clang time unconditionally.

http://reviews.llvm.org/D21810

Files:
  unittests/ASTMatchers/ASTMatchersTest.h

Index: unittests/ASTMatchers/ASTMatchersTest.h
===
--- unittests/ASTMatchers/ASTMatchersTest.h
+++ unittests/ASTMatchers/ASTMatchersTest.h
@@ -73,12 +73,16 @@
 return testing::AssertionFailure() << "Could not add dynamic matcher";
   std::unique_ptr Factory(
   newFrontendActionFactory(&Finder));
-  // Some tests use typeof, which is a gnu extension.
-  std::vector Args;
-  Args.push_back(CompileArg);
-  // Some tests need rtti/exceptions on
-  Args.push_back("-frtti");
-  Args.push_back("-fexceptions");
+  // Some tests need rtti/exceptions on.  Use an unknown-unknown triple so we
+  // don't instantiate the full system toolchain.  On Linux, instantiting the
+  // toolchain involves stat'ing large portions of /usr/lib, and this slows 
down
+  // not only this test, but all other tests, via contention in the kernel.
+  //
+  // FIXME: This is a hack to work around the fact that there's no way to do 
the
+  // equivalent of runToolOnCodeWithArgs without instantiating a full Driver.
+  // We should consider having a function, at least for tests, that invokes 
cc1.
+  std::vector Args = {CompileArg, "-frtti", "-fexceptions",
+   "-target", "i386-unknown-unknown"};
   if (!runToolOnCodeWithArgs(
   Factory->create(), Code, Args, Filename, "clang-tool",
   std::make_shared(), VirtualMappedFiles)) {
@@ -180,13 +184,12 @@
 return testing::AssertionFailure() << "Could not add dynamic matcher";
   std::unique_ptr Factory(
   newFrontendActionFactory(&Finder));
-  // Some tests use typeof, which is a gnu extension.
-  std::vector Args;
-  Args.push_back("-xcuda");
-  Args.push_back("-fno-ms-extensions");
-  Args.push_back("--cuda-host-only");
-  Args.push_back("-nocudainc");
-  Args.push_back(CompileArg);
+  // Some tests use typeof, which is a gnu extension.  Using an explicit
+  // unknown-unknown triple is good for a large speedup, because it lets us
+  // avoid constructing a full system triple.
+  std::vector Args = {
+  "-xcuda",  "-fno-ms-extensions",  "--cuda-host-only", "-nocudainc",
+  "-target", "nvptx64-unknown-unknown", CompileArg};
   if (!runToolOnCodeWithArgs(Factory->create(),
  CudaHeader + Code, Args)) {
 return testing::AssertionFailure() << "Parsing error in \"" << Code << 
"\"";
@@ -230,8 +233,11 @@
   Finder.addMatcher(AMatcher, &VerifyVerifiedResult);
   std::unique_ptr Factory(
   newFrontendActionFactory(&Finder));
-  // Some tests use typeof, which is a gnu extension.
-  std::vector Args(1, "-std=gnu++98");
+  // Some tests use typeof, which is a gnu extension.  Using an explicit
+  // unknown-unknown triple is good for a large speedup, because it lets us
+  // avoid constructing a full system triple.
+  std::vector Args = {"-std=gnu++98", "-target",
+   "i386-unknown-unknown"};
   if (!runToolOnCodeWithArgs(Factory->create(), Code, Args)) {
 return testing::AssertionFailure() << "Parsing error in \"" << Code << 
"\"";
   }


Index: unittests/ASTMatchers/ASTMatchersTest.h
===
--- unittests/ASTMatchers/ASTMatchersTest.h
+++ unittests/ASTMatchers/ASTMatchersTest.h
@@ -73,12 +73,16 @@
 return testing::AssertionFailure() << "Could not add dynamic matcher";
   std::unique_ptr Factory(
   newFrontendActionFactory(&Finder));
-  // Some tests use typeof, which is a gnu extension.
-  std::vector Args;
-  Args.push_back(CompileArg);
-  // Some tests need rtti/exceptions on
-  Args.push_back("-frtti");
-  Args.push_back("-fexceptions");
+  // Some tests need rtti/exceptions on.  Use an unknown-unknown triple so we
+  // don't instantiate the full system toolchain.  On Linux, instantiting the
+  // toolchain involves stat'ing large portions of /usr/lib, and this slows down
+  // not only this test, but all other tests, via contention in the kernel.
+  //
+  // FIXME: This is a hack to work around the fact that there's no way to do the
+  // equivalent of runToolOnC

Re: [PATCH] D21783: [CodeView] Implement support for bitfields in Clang

2016-06-28 Thread Amjad Aboud via cfe-commits
aaboud accepted this revision.
aaboud added a comment.
This revision is now accepted and ready to land.

LGTM.
Please update PR28162.


http://reviews.llvm.org/D21783



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


r274050 - Fix unreasonably-precise CHECK.

2016-06-28 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Tue Jun 28 14:09:30 2016
New Revision: 274050

URL: http://llvm.org/viewvc/llvm-project?rev=274050&view=rev
Log:
Fix unreasonably-precise CHECK.

Modified:
cfe/trunk/test/CodeGenCXX/inheriting-constructor.cpp

Modified: cfe/trunk/test/CodeGenCXX/inheriting-constructor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/inheriting-constructor.cpp?rev=274050&r1=274049&r2=274050&view=diff
==
--- cfe/trunk/test/CodeGenCXX/inheriting-constructor.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/inheriting-constructor.cpp Tue Jun 28 14:09:30 
2016
@@ -386,12 +386,12 @@ namespace inline_virt {
   // B base object inheriting constructor does not get passed arguments.
   // ITANIUM-LABEL: define linkonce_odr void 
@_ZN11inline_virt1BCI2NS_1AEE1QiS1_OS1_z(
   // ITANIUM-NOT: call
-  // ITANIUM: call void @_ZN1ZC2Ev(%struct.Z* %2)
+  // ITANIUM: call void @_ZN1ZC2Ev(
   // ITANIUM-NOT: call
   // VTT -> vtable
   // ITANIUM: store
   // ITANIUM-NOT: call
-  // ITANIUM: call void @_ZN1ZC1Ev(%struct.Z* %z)
+  // ITANIUM: call void @_ZN1ZC1Ev(
   // ITANIUM-NOT: call
   // ITANIUM: }
 }


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


Re: [PATCH] D21810: Don't instantiate a full host toolchain in ASTMatchersTest.

2016-06-28 Thread Manuel Klimek via cfe-commits
klimek added inline comments.


Comment at: unittests/ASTMatchers/ASTMatchersTest.h:77
@@ +76,3 @@
+  // Some tests need rtti/exceptions on.  Use an unknown-unknown triple so we
+  // don't instantiate the full system toolchain.  On Linux, instantiting the
+  // toolchain involves stat'ing large portions of /usr/lib, and this slows 
down

typo: instantiting


Comment at: unittests/ASTMatchers/ASTMatchersTest.h:81-83
@@ +80,5 @@
+  //
+  // FIXME: This is a hack to work around the fact that there's no way to do 
the
+  // equivalent of runToolOnCodeWithArgs without instantiating a full Driver.
+  // We should consider having a function, at least for tests, that invokes 
cc1.
+  std::vector Args = {CompileArg, "-frtti", "-fexceptions",

Couldn't we use -ccc-install-dir to prevent toolchain search?


http://reviews.llvm.org/D21810



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


Buildbot numbers for the last week of 6/19/2016 - 6/25/2016

2016-06-28 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the last week of 6/19/2016 - 6/25/2016.

Please see the same data in attached csv files:

The longest time each builder was red during the last week;
"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green);
Count of commits by project;
Number of completed builds, failed builds and average build time for
successful builds per active builder;
Average waiting time for a revision to get build result per active builder
(response time);

Thanks

Galina


The longest time each builder was red during the last week:

 buildername  |  was_red
--+---
 lldb-x86-windows-msvc2015| 132:47:15
 sanitizer-x86_64-linux-fast  | 58:07:21
 sanitizer-x86_64-linux   | 48:59:06
 perf-x86_64-penryn-O3| 41:37:20
 clang-cmake-thumbv7-a15-full-sh  | 34:34:23
 clang-cmake-armv7-a15-selfhost   | 34:18:12
 clang-cmake-mipsel   | 30:27:12
 clang-x86-win2008-selfhost   | 25:04:16
 clang-ppc64be-linux-lnt  | 24:21:09
 sanitizer-x86_64-linux-bootstrap | 24:01:14
 clang-ppc64be-linux-multistage   | 23:07:28
 clang-cmake-armv7-a15-selfhost-neon  | 22:57:51
 clang-ppc64le-linux-lnt  | 19:37:05
 clang-ppc64le-linux  | 18:39:01
 clang-cmake-mips | 18:27:47
 clang-s390x-linux| 18:23:18
 clang-ppc64be-linux  | 18:20:46
 clang-ppc64le-linux-multistage   | 18:06:13
 clang-native-aarch64-full| 15:48:44
 lldb-x86_64-ubuntu-14.04-cmake   | 14:34:45
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast | 12:15:24
 lldb-windows7-android| 11:00:17
 clang-atom-d525-fedora-rel   | 08:43:11
 clang-x86_64-linux-selfhost-modules  | 08:31:25
 perf-x86_64-penryn-O3-polly  | 08:03:30
 llvm-clang-lld-x86_64-debian-fast| 06:27:29
 clang-x64-ninja-win7 | 06:22:40
 lldb-x86_64-ubuntu-14.04-android | 05:53:09
 llvm-mips-linux  | 05:38:44
 lld-x86_64-win7  | 05:21:12
 clang-native-arm-lnt | 04:15:53
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast   | 04:00:56
 clang-cmake-armv7-a15-full   | 03:49:33
 sanitizer-ppc64le-linux  | 03:32:36
 clang-cmake-aarch64-full | 03:17:37
 clang-x86_64-debian-fast | 02:55:23
 clang-cmake-armv7-a15| 02:38:03
 clang-cmake-thumbv7-a15  | 02:36:39
 clang-cmake-aarch64-quick| 02:30:09
 clang-cmake-aarch64-42vma| 02:12:53
 lldb-x86_64-ubuntu-14.04-buildserver | 02:02:40
 libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11 | 01:55:09
 clang-3stage-ubuntu  | 01:48:54
 clang-cuda-build | 01:43:56
 sanitizer-ppc64be-linux  | 01:43:19
 polly-amd64-linux| 01:41:23
 clang-hexagon-elf| 01:38:38
 lldb-x86_64-darwin-13.4  | 01:34:23
 libcxx-libcxxabi-x86_64-linux-ubuntu-asan| 01:27:16
 lld-x86_64-darwin13  | 01:26:31
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx14   | 01:25:36
 lld-x86_64-freebsd   | 01:24:39
 sanitizer-windows| 01:21:29
 lldb-amd64-ninja-netbsd7 | 01:16:52
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx1z   | 01:16:27
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx11   | 01:15:06
 perf-x86_64-penryn-O3-polly-unprofitable | 01:08:08
 sanitizer-x86_64-linux-fuzzer| 01:00:19
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx03   | 00:49:27
 perf-x86_64-penryn-O3-polly-parallel-fast| 00:38:09
 sanitizer-x86_64-linux-autoconf  | 00:36:04
 clang-x86_64-linux-abi-test  | 00:23:03
 llvm-hexagon-elf | 00:11:20
(63 rows)


"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green):

 buildername| builds |
changes | status change ratio
++-+-
 perf-x86_64-penryn-O3-polly 

Re: [PATCH] D21367: AMDGPU: Set amdgpu_kernel calling convention for OpenCL kernels.

2016-06-28 Thread Yaxun Liu via cfe-commits
yaxunl added a comment.



> Maybe we can use the fact that calling conventions are separate in AST and in 
> LLVM IR. So in AST maybe we can have opencl_kernel and in LLVM it can map to 
> spir_kernel for SPIR and amdgpu_kernel for AMDGPU.


This approach looks good to me. Thanks.


http://reviews.llvm.org/D21367



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


Re: [PATCH] D21810: Don't instantiate a full host toolchain in ASTMatchersTest.

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


Comment at: unittests/ASTMatchers/ASTMatchersTest.h:81-83
@@ +80,5 @@
+  //
+  // FIXME: This is a hack to work around the fact that there's no way to do 
the
+  // equivalent of runToolOnCodeWithArgs without instantiating a full Driver.
+  // We should consider having a function, at least for tests, that invokes 
cc1.
+  std::vector Args = {CompileArg, "-frtti", "-fexceptions",

klimek wrote:
> Couldn't we use -ccc-install-dir to prevent toolchain search?
> Couldn't we use -ccc-install-dir to prevent toolchain search?

I tried -ccc-install-dir /does/not/exist and it had no speedup relative to the 
original.


http://reviews.llvm.org/D21810



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


Re: [PATCH] D21810: Don't instantiate a full host toolchain in ASTMatchersTest.

2016-06-28 Thread Chandler Carruth via cfe-commits
chandlerc added inline comments.


Comment at: unittests/ASTMatchers/ASTMatchersTest.h:81-83
@@ +80,5 @@
+  //
+  // FIXME: This is a hack to work around the fact that there's no way to do 
the
+  // equivalent of runToolOnCodeWithArgs without instantiating a full Driver.
+  // We should consider having a function, at least for tests, that invokes 
cc1.
+  std::vector Args = {CompileArg, "-frtti", "-fexceptions",

jlebar wrote:
> klimek wrote:
> > Couldn't we use -ccc-install-dir to prevent toolchain search?
> > Couldn't we use -ccc-install-dir to prevent toolchain search?
> 
> I tried -ccc-install-dir /does/not/exist and it had no speedup relative to 
> the original.
Yea, that just won't help sadly.

As I indicated to Justin, I think the correct fix long-term is to expose a 
routine that uses CC1 flags directly for use in unittests. That will completely 
eliminate the need for this. Fundamentally, the unittests shouldn't be reaching 
through the entire driver, they should be directly running the frontend. There 
should be specific and dedicated unittests for the driver bits that point the 
driver at a fake tree instead of the real tree as well.

But I think this is a reasonable workaround until such an API can be provided.


http://reviews.llvm.org/D21810



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


Re: [PATCH] D21810: Don't instantiate a full host toolchain in ASTMatchersTest.

2016-06-28 Thread Justin Lebar via cfe-commits
jlebar updated this revision to Diff 62132.
jlebar marked 3 inline comments as done.
jlebar added a comment.

Fix typo in comment.


http://reviews.llvm.org/D21810

Files:
  unittests/ASTMatchers/ASTMatchersTest.h

Index: unittests/ASTMatchers/ASTMatchersTest.h
===
--- unittests/ASTMatchers/ASTMatchersTest.h
+++ unittests/ASTMatchers/ASTMatchersTest.h
@@ -73,12 +73,16 @@
 return testing::AssertionFailure() << "Could not add dynamic matcher";
   std::unique_ptr Factory(
   newFrontendActionFactory(&Finder));
-  // Some tests use typeof, which is a gnu extension.
-  std::vector Args;
-  Args.push_back(CompileArg);
-  // Some tests need rtti/exceptions on
-  Args.push_back("-frtti");
-  Args.push_back("-fexceptions");
+  // Some tests need rtti/exceptions on.  Use an unknown-unknown triple so we
+  // don't instantiate the full system toolchain.  On Linux, instantiating the
+  // toolchain involves stat'ing large portions of /usr/lib, and this slows 
down
+  // not only this test, but all other tests, via contention in the kernel.
+  //
+  // FIXME: This is a hack to work around the fact that there's no way to do 
the
+  // equivalent of runToolOnCodeWithArgs without instantiating a full Driver.
+  // We should consider having a function, at least for tests, that invokes 
cc1.
+  std::vector Args = {CompileArg, "-frtti", "-fexceptions",
+   "-target", "i386-unknown-unknown"};
   if (!runToolOnCodeWithArgs(
   Factory->create(), Code, Args, Filename, "clang-tool",
   std::make_shared(), VirtualMappedFiles)) {
@@ -180,13 +184,12 @@
 return testing::AssertionFailure() << "Could not add dynamic matcher";
   std::unique_ptr Factory(
   newFrontendActionFactory(&Finder));
-  // Some tests use typeof, which is a gnu extension.
-  std::vector Args;
-  Args.push_back("-xcuda");
-  Args.push_back("-fno-ms-extensions");
-  Args.push_back("--cuda-host-only");
-  Args.push_back("-nocudainc");
-  Args.push_back(CompileArg);
+  // Some tests use typeof, which is a gnu extension.  Using an explicit
+  // unknown-unknown triple is good for a large speedup, because it lets us
+  // avoid constructing a full system triple.
+  std::vector Args = {
+  "-xcuda",  "-fno-ms-extensions",  "--cuda-host-only", "-nocudainc",
+  "-target", "nvptx64-unknown-unknown", CompileArg};
   if (!runToolOnCodeWithArgs(Factory->create(),
  CudaHeader + Code, Args)) {
 return testing::AssertionFailure() << "Parsing error in \"" << Code << 
"\"";
@@ -230,8 +233,11 @@
   Finder.addMatcher(AMatcher, &VerifyVerifiedResult);
   std::unique_ptr Factory(
   newFrontendActionFactory(&Finder));
-  // Some tests use typeof, which is a gnu extension.
-  std::vector Args(1, "-std=gnu++98");
+  // Some tests use typeof, which is a gnu extension.  Using an explicit
+  // unknown-unknown triple is good for a large speedup, because it lets us
+  // avoid constructing a full system triple.
+  std::vector Args = {"-std=gnu++98", "-target",
+   "i386-unknown-unknown"};
   if (!runToolOnCodeWithArgs(Factory->create(), Code, Args)) {
 return testing::AssertionFailure() << "Parsing error in \"" << Code << 
"\"";
   }


Index: unittests/ASTMatchers/ASTMatchersTest.h
===
--- unittests/ASTMatchers/ASTMatchersTest.h
+++ unittests/ASTMatchers/ASTMatchersTest.h
@@ -73,12 +73,16 @@
 return testing::AssertionFailure() << "Could not add dynamic matcher";
   std::unique_ptr Factory(
   newFrontendActionFactory(&Finder));
-  // Some tests use typeof, which is a gnu extension.
-  std::vector Args;
-  Args.push_back(CompileArg);
-  // Some tests need rtti/exceptions on
-  Args.push_back("-frtti");
-  Args.push_back("-fexceptions");
+  // Some tests need rtti/exceptions on.  Use an unknown-unknown triple so we
+  // don't instantiate the full system toolchain.  On Linux, instantiating the
+  // toolchain involves stat'ing large portions of /usr/lib, and this slows down
+  // not only this test, but all other tests, via contention in the kernel.
+  //
+  // FIXME: This is a hack to work around the fact that there's no way to do the
+  // equivalent of runToolOnCodeWithArgs without instantiating a full Driver.
+  // We should consider having a function, at least for tests, that invokes cc1.
+  std::vector Args = {CompileArg, "-frtti", "-fexceptions",
+   "-target", "i386-unknown-unknown"};
   if (!runToolOnCodeWithArgs(
   Factory->create(), Code, Args, Filename, "clang-tool",
   std::make_shared(), VirtualMappedFiles)) {
@@ -180,13 +184,12 @@
 return testing::AssertionFailure() << "Could not add dynamic matcher";
   std::unique_ptr Factory(
   newFrontendActionFactory(&Finder));
-  // Some tests use typeof, which is a gnu extension.
-  std::vector Args

[PATCH] D21814: clang-rename: support multiple renames with one invocation

2016-06-28 Thread Miklos Vajna via cfe-commits
vmiklos created this revision.
vmiklos added a reviewer: klimek.
vmiklos added a subscriber: cfe-commits.

This way parsing the source input multiple times for multiple renames can be 
avoided.

http://reviews.llvm.org/D21814

Files:
  clang-rename/RenamingAction.cpp
  clang-rename/RenamingAction.h
  clang-rename/tool/ClangRename.cpp
  test/clang-rename/ClassTestMulti.cpp
  test/clang-rename/ClassTestMultiByName.cpp

Index: test/clang-rename/ClassTestMultiByName.cpp
===
--- /dev/null
+++ test/clang-rename/ClassTestMultiByName.cpp
@@ -0,0 +1,8 @@
+// RUN: cat %s > %t.cpp
+// RUN: clang-rename -old-name=Cla1,Cla2 -new-name=Kla1,Kla2 %t.cpp -i --
+// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
+class Cla1 { // CHECK: class Kla1
+};
+
+class Cla2 { // CHECK: class Kla2
+};
Index: test/clang-rename/ClassTestMulti.cpp
===
--- /dev/null
+++ test/clang-rename/ClassTestMulti.cpp
@@ -0,0 +1,8 @@
+// RUN: cat %s > %t.cpp
+// RUN: clang-rename -offset=145,183 -new-name=Kla1,Kla2 %t.cpp -i --
+// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
+class Cla1 { // CHECK: class Kla1
+};
+
+class Cla2 { // CHECK: class Kla2
+};
Index: clang-rename/tool/ClangRename.cpp
===
--- clang-rename/tool/ClangRename.cpp
+++ clang-rename/tool/ClangRename.cpp
@@ -38,23 +38,24 @@
 #include "llvm/Support/Host.h"
 #include 
 #include 
+#include 
 
 using namespace llvm;
 
 cl::OptionCategory ClangRenameCategory("Clang-rename options");
 
 static cl::opt
-NewName(
+NewNames(
 "new-name",
 cl::desc("The new name to change the symbol to."),
 cl::cat(ClangRenameCategory));
-static cl::opt
-SymbolOffset(
+static cl::opt
+SymbolOffsets(
 "offset",
 cl::desc("Locates the symbol by offset as opposed to :."),
 cl::cat(ClangRenameCategory));
 static cl::opt
-OldName(
+OldNames(
 "old-name",
 cl::desc("The fully qualified name of the symbol, if -offset is not used."),
 cl::cat(ClangRenameCategory));
@@ -91,39 +92,100 @@
 const char RenameUsage[] = "A tool to rename symbols in C/C++ code.\n\
 clang-rename renames every occurrence of a symbol found at  in\n\
 . If -i is specified, the edited files are overwritten to disk.\n\
-Otherwise, the results are written to stdout.\n";
+Otherwise, the results are written to stdout.\n\
+-offset, -old-name and -new-name accept a comma-separated list to perform\n\
+multiple renames with one invocation.\n";
 
 int main(int argc, const char **argv) {
   cl::SetVersionPrinter(PrintVersion);
   tooling::CommonOptionsParser OP(argc, argv, ClangRenameCategory, RenameUsage);
 
   // Check the arguments for correctness.
 
-  if (NewName.empty()) {
+  if (NewNames.empty()) {
 errs() << "clang-rename: no new name provided.\n\n";
 cl::PrintHelpMessage();
 exit(1);
   }
 
-  // Get the USRs.
-  auto Files = OP.getSourcePathList();
-  tooling::RefactoringTool Tool(OP.getCompilations(), Files);
-  rename::USRFindingAction USRAction(SymbolOffset, OldName);
+  // Tokenize the new names.
+  std::stringstream NewNameStream(NewNames);
+  std::vector NewNameList;
+  while (NewNameStream.good()) {
+std::string Token;
+std::getline(NewNameStream, Token, ',');
+NewNameList.push_back(Token);
+  }
+
+  // Tokenize the offsets.
+  std::stringstream SymbolOffsetStream(SymbolOffsets);
+  std::vector SymbolOffsetList;
+  while (SymbolOffsetStream.good()) {
+std::string Token;
+std::getline(SymbolOffsetStream, Token, ',');
+if (Token.empty()) {
+  break;
+}
+SymbolOffsetList.push_back(std::stoi(Token));
+  }
+
+  if (!SymbolOffsetList.empty() && SymbolOffsetList.size() != NewNameList.size()) {
+errs() << "clang-rename: number of offsets (" << SymbolOffsetList.size() <<
+  ") do not equal to number of new names (" << NewNameList.size() <<
+  ").\n\n";
+cl::PrintHelpMessage();
+exit(1);
+  }
 
-  // Find the USRs.
-  Tool.run(tooling::newFrontendActionFactory(&USRAction).get());
-  const auto &USRs = USRAction.getUSRs();
-  const auto &PrevName = USRAction.getUSRSpelling();
+  // Tokenize the old names.
+  std::stringstream OldNameStream(OldNames);
+  std::vector OldNameList;
+  while (OldNameStream.good()) {
+std::string Token;
+std::getline(OldNameStream, Token, ',');
+if (Token.empty()) {
+  break;
+}
+OldNameList.push_back(Token);
+  }
 
-  if (PrevName.empty())
-// An error should have already been printed.
+  if (!OldNameList.empty() && OldNameList.size() != NewNameList.size()) {
+errs() << "clang-rename: number of old names (" << OldNameList.size() <<
+  ") do not equal to number of new names (" << NewNameList.size() <<
+  ").\n\n";
+cl::PrintHelpMessage();
 exit(1);
+  }
 
-  if (PrintName)
-errs() << "clang-rename: found name: " << PrevName << "\n";
+  std::vector> USRList;
+  std::vector PrevNameList;
+  

[PATCH] D21815: [clang-tidy] Add 'included from' details to warning message.

2016-06-28 Thread Samuel Benzaquen via cfe-commits
sbenza created this revision.
sbenza added a reviewer: alexfh.
sbenza added a subscriber: cfe-commits.

Add 'included from' details to warning message to 
google-global-names-in-headers.
It should make it clearer on those cases where a non-header is being mistakenly 
#included.

http://reviews.llvm.org/D21815

Files:
  clang-tidy/google/GlobalNamesInHeadersCheck.cpp
  unittests/clang-tidy/GoogleModuleTest.cpp

Index: unittests/clang-tidy/GoogleModuleTest.cpp
===
--- unittests/clang-tidy/GoogleModuleTest.cpp
+++ unittests/clang-tidy/GoogleModuleTest.cpp
@@ -58,25 +58,34 @@
 
 class GlobalNamesInHeadersCheckTest : public ::testing::Test {
 protected:
-  bool runCheckOnCode(const std::string &Code, const std::string &Filename) {
+  bool runCheckOnCode(const std::string &Code, const std::string &Filename,
+  bool IsIncluded = false) {
 static const char *const Header = "namespace std {\n"
   "class string {};\n"
   "}  // namespace std\n"
+  "#include \"header.h\"\n"
   "\n"
   "#define SOME_MACRO(x) using x\n";
 std::vector Errors;
 std::vector Args;
 if (!StringRef(Filename).endswith(".cpp")) {
   Args.emplace_back("-xc++-header");
 }
+std::map Paths;
+Paths["header.h"] = IsIncluded ? StringRef(Code) : StringRef("\n");
+ClangTidyOptions Options;
+Options.HeaderFilterRegex = ".*";
 test::runCheckOnCode(
-Header + Code, &Errors, Filename, Args);
+Header + (IsIncluded ? "" : Code), &Errors,
+IsIncluded ? "main.cpp" : Filename, Args, Options, Paths);
 if (Errors.empty())
   return false;
 assert(Errors.size() == 1);
-assert(
-Errors[0].Message.Message ==
-"using declarations in the global namespace in headers are prohibited");
+std::string Expected =
+"using declarations in the global namespace in headers are prohibited";
+if (IsIncluded)
+  Expected += "; in file included from 'main.cpp'";
+assert(Errors[0].Message.Message == Expected);
 return true;
   }
 };
@@ -89,6 +98,7 @@
   "}  // my_namespace\n",
   "foo.h"));
   EXPECT_FALSE(runCheckOnCode("SOME_MACRO(std::string);", "foo.h"));
+  EXPECT_TRUE(runCheckOnCode("using std::string;", "foo.h", true));
 }
 
 TEST_F(GlobalNamesInHeadersCheckTest, UsingDirectives) {
@@ -99,6 +109,7 @@
   "}  // my_namespace\n",
   "foo.h"));
   EXPECT_FALSE(runCheckOnCode("SOME_MACRO(namespace std);", "foo.h"));
+  EXPECT_TRUE(runCheckOnCode("using namespace std;", "foo.h", true));
 }
 
 TEST_F(GlobalNamesInHeadersCheckTest, RegressionAnonymousNamespace) {
Index: clang-tidy/google/GlobalNamesInHeadersCheck.cpp
===
--- clang-tidy/google/GlobalNamesInHeadersCheck.cpp
+++ clang-tidy/google/GlobalNamesInHeadersCheck.cpp
@@ -46,6 +46,24 @@
   this);
 }
 
+namespace {
+std::string getIncludeFromMessage(SourceLocation DeclLoc,
+  const SourceManager &SM) {
+  FileID FID = SM.getFileID(DeclLoc);
+  bool Invalid;
+  const auto &Entry = SM.getSLocEntry(FID, &Invalid);
+  if (Invalid)
+return "";
+  SourceLocation IncludeLoc = Entry.getFile().getIncludeLoc();
+  if (!IncludeLoc.isValid())
+return "";
+  StringRef Filename = SM.getFilename(IncludeLoc);
+  if (Filename.empty())
+return "";
+  return (Twine("; in file included from '") + Filename + "'").str();
+}
+}  // namespace
+
 void GlobalNamesInHeadersCheck::check(const MatchFinder::MatchResult &Result) {
   const auto *D = Result.Nodes.getNodeAs("using_decl");
   // If it comes from a macro, we'll assume it is fine.
@@ -71,8 +89,12 @@
 }
   }
 
+  std::string IncludeMessage =
+  getIncludeFromMessage(D->getLocStart(), *Result.SourceManager);
+
   diag(D->getLocStart(),
-   "using declarations in the global namespace in headers are prohibited");
+   "using declarations in the global namespace in headers are prohibited%0")
+  << IncludeMessage;
 }
 
 } // namespace readability
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r274056 - [CMake] Adding USES_TERMINAL to a few additional custom targets

2016-06-28 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Tue Jun 28 15:30:52 2016
New Revision: 274056

URL: http://llvm.org/viewvc/llvm-project?rev=274056&view=rev
Log:
[CMake] Adding USES_TERMINAL to a few additional custom targets

These are all long-running commands that should be in the ninja console job 
pool.

Modified:
cfe/trunk/runtime/CMakeLists.txt

Modified: cfe/trunk/runtime/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/runtime/CMakeLists.txt?rev=274056&r1=274055&r2=274056&view=diff
==
--- cfe/trunk/runtime/CMakeLists.txt (original)
+++ cfe/trunk/runtime/CMakeLists.txt Tue Jun 28 15:30:52 2016
@@ -102,7 +102,8 @@ if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND E
 DEPENDS compiler-rt
 COMMAND "${CMAKE_COMMAND}"
  -DCMAKE_INSTALL_COMPONENT=compiler-rt
- -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+ -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
+USES_TERMINAL)
 
   # Add top-level targets that build specific compiler-rt runtimes.
   set(COMPILER_RT_RUNTIMES asan builtins dfsan lsan msan profile tsan ubsan)
@@ -112,7 +113,7 @@ if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND E
   COMMAND ${build_runtime_cmd}
   DEPENDS compiler-rt-configure
   WORKING_DIRECTORY ${BINARY_DIR}
-  VERBATIM)
+  VERBATIM USES_TERMINAL)
   endforeach()
 
   if(LLVM_INCLUDE_TESTS)


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


r274058 - Update cxx_dr_status from test/CXX/drs.

2016-06-28 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Tue Jun 28 15:35:53 2016
New Revision: 274058

URL: http://llvm.org/viewvc/llvm-project?rev=274058&view=rev
Log:
Update cxx_dr_status from test/CXX/drs.

Modified:
cfe/trunk/www/cxx_dr_status.html

Modified: cfe/trunk/www/cxx_dr_status.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_dr_status.html?rev=274058&r1=274057&r2=274058&view=diff
==
--- cfe/trunk/www/cxx_dr_status.html (original)
+++ cfe/trunk/www/cxx_dr_status.html Tue Jun 28 15:35:53 2016
@@ -7969,7 +7969,7 @@ and POD class
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1359";>1359
 CD3
 constexpr union constructors
-SVN
+Clang 3.5
   
   
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1360";>1360
@@ -9253,7 +9253,7 @@ and POD class
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1573";>1573
 DRWP
 Inherited constructor characteristics
-Unknown
+SVN
   
   
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#1574";>1574
@@ -9601,7 +9601,7 @@ and POD class
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1631";>1631
 DRWP
 Incorrect overload resolution for single-element 
initializer-list
-Clang 3.7 (C++11 onwards)
+Clang 3.7
   
   
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1632";>1632
@@ -9685,7 +9685,7 @@ and POD class
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1645";>1645
 DR
 Identical inheriting constructors via default arguments
-Unknown
+SVN
   
   
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1646";>1646
@@ -10105,7 +10105,7 @@ and POD class
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1715";>1715
 DR
 Access and inherited constructor templates
-Unknown
+SVN
   
   
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1716";>1716
@@ -10231,7 +10231,7 @@ and POD class
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1736";>1736
 DR
 Inheriting constructor templates in a local class
-Unknown
+SVN
   
   
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1737";>1737
@@ -10351,7 +10351,7 @@ and POD class
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1756";>1756
 DRWP
 Direct-list-initialization of a non-class object
-Clang 3.7 (C++11 onwards)
+Clang 3.7
   
   
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1757";>1757
@@ -10363,7 +10363,7 @@ and POD class
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1758";>1758
 DRWP
 Explicit conversion in copy/move list initialization
-Clang 3.7 (C++11 onwards)
+Clang 3.7
   
   
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1759";>1759
@@ -11461,7 +11461,7 @@ and POD class
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1941";>1941
 DR
 SFINAE and inherited constructor default arguments
-Unknown
+SVN
   
   
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1942";>1942
@@ -11569,7 +11569,7 @@ and POD class
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1959";>1959
 DR
 Inadvertently inherited copy constructor
-Unknown
+SVN
   
   
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#1960";>1960
@@ -11761,7 +11761,7 @@ and POD class
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1991";>1991
 DR
 Inheriting constructors vs default arguments
-Unknown
+SVN
   
   
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1992";>1992


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


r274059 - cxx_status: fix footnote for p0136.

2016-06-28 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Tue Jun 28 15:37:00 2016
New Revision: 274059

URL: http://llvm.org/viewvc/llvm-project?rev=274059&view=rev
Log:
cxx_status: fix footnote for p0136.

Modified:
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/www/cxx_status.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=274059&r1=274058&r2=274059&view=diff
==
--- cfe/trunk/www/cxx_status.html (original)
+++ cfe/trunk/www/cxx_status.html Tue Jun 28 15:37:00 2016
@@ -623,7 +623,7 @@ as the draft C++1z standard evolves.
 
   New specification for inheriting constructors (DR1941 et al)
   http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0136r1.html";>P0136R1
-  SVN (9)
+  SVN (9)
 
 
 
@@ -735,6 +735,8 @@ all language versions that allow type de
 (per the request of the C++ committee).
 In Clang 3.7, a warning is emitted for all cases that would change meaning.
 
+
+
 (9): This is the resolution to a Defect Report, so is applied
 to all language versions supporting inheriting constructors.
 


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


r274060 - cxx_status: make c++17 footnote list formatting consistent with other footnote lists.

2016-06-28 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Tue Jun 28 15:37:43 2016
New Revision: 274060

URL: http://llvm.org/viewvc/llvm-project?rev=274060&view=rev
Log:
cxx_status: make c++17 footnote list formatting consistent with other footnote 
lists.

Modified:
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/www/cxx_status.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=274060&r1=274059&r2=274060&view=diff
==
--- cfe/trunk/www/cxx_status.html (original)
+++ cfe/trunk/www/cxx_status.html Tue Jun 28 15:37:43 2016
@@ -734,9 +734,7 @@ as the draft C++1z standard evolves.
 all language versions that allow type deduction from auto
 (per the request of the C++ committee).
 In Clang 3.7, a warning is emitted for all cases that would change meaning.
-
-
-
+
 (9): This is the resolution to a Defect Report, so is applied
 to all language versions supporting inheriting constructors.
 


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


r274064 - AvailabilityAttr: we accept "macos" as the platform name.

2016-06-28 Thread Manman Ren via cfe-commits
Author: mren
Date: Tue Jun 28 15:55:30 2016
New Revision: 274064

URL: http://llvm.org/viewvc/llvm-project?rev=274064&view=rev
Log:
AvailabilityAttr: we accept "macos" as the platform name.

We continue accepting "macosx" but canonicalize it to "macos", When emitting
diagnostics, we use "macOS" instead of "OS X".

The PlatformName in TargetInfo is changed from "macosx" to "macos" so we can
directly compare the Platform in AvailabilityAttr with the PlatformName
in TargetInfo.

rdar://26795172
rdar://26800775

Modified:
cfe/trunk/include/clang-c/Index.h
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Basic/AttrDocs.td
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/test/Index/annotate-comments-availability-attrs.cpp
cfe/trunk/test/Index/availability.c
cfe/trunk/test/Misc/ast-print-objectivec.m
cfe/trunk/test/Sema/attr-availability-macosx.c
cfe/trunk/test/Sema/attr-availability.c
cfe/trunk/test/Sema/attr-print.c
cfe/trunk/test/SemaCXX/attr-deprecated-replacement-fixit.cpp
cfe/trunk/test/SemaObjC/attr-availability-1.m
cfe/trunk/test/SemaObjC/attr-availability.m
cfe/trunk/test/SemaObjC/attr-deprecated.m
cfe/trunk/test/SemaObjC/property-noninherited-availability-attr.m

Modified: cfe/trunk/include/clang-c/Index.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=274064&r1=274063&r2=274064&view=diff
==
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Tue Jun 28 15:55:30 2016
@@ -2570,7 +2570,7 @@ typedef struct CXPlatformAvailability {
* \brief A string that describes the platform for which this structure
* provides availability information.
*
-   * Possible values are "ios" or "macosx".
+   * Possible values are "ios" or "macos".
*/
   CXString Platform;
   /**

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=274064&r1=274063&r2=274064&view=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Tue Jun 28 15:55:30 2016
@@ -477,11 +477,11 @@ def Availability : InheritableAttr {
 return llvm::StringSwitch(Platform)
  .Case("android", "Android")
  .Case("ios", "iOS")
- .Case("macosx", "OS X")
+ .Case("macos", "macOS")
  .Case("tvos", "tvOS")
  .Case("watchos", "watchOS")
  .Case("ios_app_extension", "iOS (App Extension)")
- .Case("macosx_app_extension", "OS X (App Extension)")
+ .Case("macos_app_extension", "macOS (App Extension)")
  .Case("tvos_app_extension", "tvOS (App Extension)")
  .Case("watchos_app_extension", "watchOS (App Extension)")
  .Default(llvm::StringRef());

Modified: cfe/trunk/include/clang/Basic/AttrDocs.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/AttrDocs.td?rev=274064&r1=274063&r2=274064&view=diff
==
--- cfe/trunk/include/clang/Basic/AttrDocs.td (original)
+++ cfe/trunk/include/clang/Basic/AttrDocs.td Tue Jun 28 15:55:30 2016
@@ -691,7 +691,7 @@ the function declaration for a hypotheti
 
 .. code-block:: c++
 
-  void f(void) 
__attribute__((availability(macosx,introduced=10.4,deprecated=10.6,obsoleted=10.7)));
+  void f(void) 
__attribute__((availability(macos,introduced=10.4,deprecated=10.6,obsoleted=10.7)));
 
 The availability attribute states that ``f`` was introduced in Mac OS X 10.4,
 deprecated in Mac OS X 10.6, and obsoleted in Mac OS X 10.7.  This information
@@ -743,7 +743,7 @@ are:
   the ``-mios-version-min=*version*`` or ``-miphoneos-version-min=*version*``
   command-line arguments.
 
-``macosx``
+``macos``
   Apple's Mac OS X operating system.  The minimum deployment target is
   specified by the ``-mmacosx-version-min=*version*`` command-line argument.
 
@@ -777,24 +777,24 @@ platform. For example:
 
 .. code-block:: c
 
-  void g(void) __attribute__((availability(macosx,introduced=10.4)));
-  void g(void) __attribute__((availability(macosx,introduced=10.4))); // okay, 
matches
+  void g(void) __attribute__((availability(macos,introduced=10.4)));
+  void g(void) __attribute__((availability(macos,introduced=10.4))); // okay, 
matches
   void g(void) __attribute__((availability(ios,introduced=4.0))); // okay, 
adds a new platform
-  void g(void); // okay, inherits both macosx and ios availability from above.
-  void g(void) __attribute__((availability(macosx,introduced=10.5))); // 
error: mismatch
+  void g(void); // okay, inherits both macos and ios availability from above.
+ 

Re: [PATCH] D21619: [Sema] Implement C++14's DR1579: Prefer moving id-expression out of functions

2016-06-28 Thread Richard Smith via cfe-commits
rsmith added a comment.

Thank you for working on this! Please also add a test to 
test/CXX/drs/dr15xx.cpp with a "// dr1579: 3.9" comment (we have a script that 
turns those comments into www/cxx_dr_status.html).



Comment at: include/clang/Sema/Sema.h:3473
@@ -3472,3 +3472,3 @@
   VarDecl *getCopyElisionCandidate(QualType ReturnType, Expr *E,
-   bool AllowFunctionParameters);
+   bool AllowParamOrMoveConstructable);
   bool isCopyElisionCandidate(QualType ReturnType, const VarDecl *VD,

Constructable -> Constructible.


Comment at: lib/Sema/SemaStmt.cpp:2756-2759
@@ -2755,4 +2755,6 @@
 // ... the same cv-unqualified type as the function return type ...
 if (!VDType->isDependentType() &&
-!Context.hasSameUnqualifiedType(ReturnType, VDType))
-  return false;
+!Context.hasSameUnqualifiedType(ReturnType, VDType)) {
+  // When considering moving this expression out, allow dissimilar types.
+  if (!AllowParamOrMoveConstructable)
+return false;

Combine these conditions into a single `if`, and put the (cheapest) `bool` 
check first.


Comment at: lib/Sema/SemaStmt.cpp:2773-2783
@@ -2769,13 +2772,13 @@
 
   // ...non-volatile...
   if (VD->getType().isVolatileQualified()) return false;
 
   // __block variables can't be allocated in a way that permits NRVO.
   if (VD->hasAttr()) return false;
 
   // Variables with higher required alignment than their type's ABI
   // alignment cannot use NRVO.
   if (!VD->getType()->isDependentType() && VD->hasAttr() &&
   Context.getDeclAlign(VD) > Context.getTypeAlignInChars(VD->getType()))
 return false;
 

None of this should be checked for the `AllowParamOrMoveConstructible` case.


Comment at: lib/Sema/SemaStmt.cpp:2820
@@ -2814,5 +2819,3 @@
 
-//   [...] If overload resolution fails, or if the type of the first
-//   parameter of the selected constructor is not an rvalue reference
-//   to the object's type (possibly cv-qualified), overload resolution
-//   is performed again, considering the object as an lvalue.
+InitializationKind Kind = InitializationKind::CreateDirect(
+Value->getLocStart(), Value->getLocStart(), Value->getLocEnd());

Why are you using direct-initialization here? The return value should always be 
copy-initialized.


http://reviews.llvm.org/D21619



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


Re: [PATCH] D21653: [Sema] Disallow ambiguous base-to-derived conversion in template argument deduction

2016-06-28 Thread Richard Smith via cfe-commits
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

Please also add the testcase from PR27601.


http://reviews.llvm.org/D21653



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


Re: [PATCH] D21653: [Sema] Disallow ambiguous base-to-derived conversion in template argument deduction

2016-06-28 Thread Richard Smith via cfe-commits
On Thu, Jun 23, 2016 at 10:37 AM, Erik Pilkington via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> erik.pilkington created this revision.
> erik.pilkington added reviewers: rsmith, faisalv.
> erik.pilkington added a subscriber: cfe-commits.
>
> Previously, Clang would incorrectly accept the following:
> ```
> template struct A {};
> struct B : A<0>, A<1> {};
> template int f(A);
> int main() { f(B()); }
> ```
> The problem is that when considering the base classes of B, there are 2
> possible ambiguous bases that could be deduced. Therefore, deduction ought
> to fail (temp.deduct.call p5).
>
> There are 3 improvements that I want to make here as well:
>  1. Introduce a TDK_AmbiguousBaseClasses so that this diagnostic isn't
> terrible.
>  2. Reapply Richard's r267453, (with some modifications) which previously
> broke stdlibc++'s tuple implementation (PR27601, reverted in r270016). This
> refactors the handmade base class traversal I fixed here to instead use
> CXXRecordDecl::forallBases(), I believe that requiring matching number of
> arguments in the DeduceTemplateArguments at SemaTemplateDeduction.cpp:433
> will fix it.
>  3. A NFC patch to rename the 10 (!) overloads of DeduceTemplateArguments
> to have more descriptive names. These functions are *really* annoying to
> deal with because of that.
>

I would love to see these as follow-up changes :)


> If it would be better to do a subset (or all) of these improvements here,
> I could always update the diff. Fixes PR28195.
>
> Thanks!
>
> http://reviews.llvm.org/D21653
>
> Files:
>   lib/Sema/SemaTemplateDeduction.cpp
>   test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21501: [Driver] Add support for Broadcom Vulcan core

2016-06-28 Thread Richard Smith via cfe-commits
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

This seems fine to me.


http://reviews.llvm.org/D21501



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


Re: [PATCH] D21653: [Sema] Disallow ambiguous base-to-derived conversion in template argument deduction

2016-06-28 Thread Erik Pilkington via cfe-commits
erik.pilkington added a comment.

Do you mean Faisal's example? He committed that in r270016.
Thanks for taking a look!


http://reviews.llvm.org/D21653



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


Re: [PATCH] D21277: Resubmit r270688: Using new TargetParser in Clang.

2016-06-28 Thread Renato Golin via cfe-commits
rengolin added a comment.

Sorry, this was committed and reverted (bugs, being fixed by 
http://reviews.llvm.org/D21785). We should start a new one when that's in.

Ignore this one. :)


Repository:
  rL LLVM

http://reviews.llvm.org/D21277



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


Re: [PATCH] D21277: Resubmit r270688: Using new TargetParser in Clang.

2016-06-28 Thread Renato Golin via cfe-commits
rengolin reopened this revision.
rengolin added a comment.
This revision is now accepted and ready to land.

Reopening, as this is the right patch.

This patch is approved, waiting on http://reviews.llvm.org/D21785, which fixes 
the issue that made us revert http://reviews.llvm.org/D20088 in the first place.

Once http://reviews.llvm.org/D21785 gets approved, Jojo will commit both.

I had a bad day today, I apologise. :(

-renato


Repository:
  rL LLVM

http://reviews.llvm.org/D21277



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


Re: [PATCH] D21392: [clang-tidy] Enhance redundant-expression check

2016-06-28 Thread Etienne Bergeron via cfe-commits
etienneb added inline comments.


Comment at: clang-tidy/misc/RedundantExpressionCheck.cpp:27
@@ -25,1 +26,3 @@
 
+static bool incrementWithoutOverflow(const llvm::APSInt &Value,
+ llvm::APSInt &Result) {

aaron.ballman wrote:
> I think this could be implemented using APInt overflow checks, no? 
> `APInt::sadd_ov()`?
It could be implemented using sadd_ov and uadd_ov.
The 'signedness' need to be take into account. The class 'APInt' doesn't not 
carry signedness.

Using the operator++ here let the instantiated type do the right increment and 
right comparison.


Comment at: clang-tidy/misc/RedundantExpressionCheck.cpp:274
@@ +273,3 @@
+Value = -Value;
+  }
+}

aaron.ballman wrote:
> > In this case -128 (8-bits) will give -128.
> 
> So negating -128 doesn't yield 128, it yields -128? That seems weird.
> 
> > The APSInt is behaving the same way than a real value of the same width and 
> > signedness.
> 
> A real value of the same width and signedness has UB with that case, which is 
> why I was asking. The range of an 8-bit signed int is -128 to 127, so 
> negating -128 yields an out-of-range value. I want to make sure we aren't 
> butchering that by canonicalizing the negate expression.
The value produced by 'canonicalNegateExpr' is the same value produced by 
executing the sub instruction on the CPU.
Even if the value make no sense in math.

Btw, there is a unittest to cover this case.


Comment at: clang-tidy/misc/RedundantExpressionCheck.cpp:364
@@ +363,3 @@
+
+  // A cast can be matched as a comparator to zero.
+  const auto CastExpr =

alexfh wrote:
> Not sure I understand this comment.
if ( implicit-int-to-bool(x) )   <<-- the implicit-int-to-bool(...) could be 
consider as  x != 0


http://reviews.llvm.org/D21392



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


r274041 - NFC. Test commit, remove a redundant empty line in Tooling.cpp

2016-06-28 Thread Artur Pilipenko via cfe-commits
Author: apilipenko
Date: Tue Jun 28 12:56:29 2016
New Revision: 274041

URL: http://llvm.org/viewvc/llvm-project?rev=274041&view=rev
Log:
NFC. Test commit, remove a redundant empty line in Tooling.cpp

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

Modified: cfe/trunk/lib/Tooling/Tooling.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Tooling.cpp?rev=274041&r1=274040&r2=274041&view=diff
==
--- cfe/trunk/lib/Tooling/Tooling.cpp (original)
+++ cfe/trunk/lib/Tooling/Tooling.cpp Tue Jun 28 12:56:29 2016
@@ -482,7 +482,6 @@ public:
 return true;
   }
 };
-
 }
 
 int ClangTool::buildASTs(std::vector> &ASTs) {


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


RE: r273950 -

2016-06-28 Thread Chris.Dewhurst via cfe-commits
Sorry. I did enter a commit message. I’ve no idea why it’s not there. I’ll 
re-commit later today.

From: tha...@google.com [mailto:tha...@google.com] On Behalf Of Nico Weber
Sent: 28 June 2016 01:12
To: Chris.Dewhurst 
Cc: cfe-commits 
Subject: Re: r273950 -

Did you land this intentionally? What was the commit message supposed to be?

On Mon, Jun 27, 2016 at 6:11 PM, Chris Dewhurst via cfe-commits 
mailto:cfe-commits@lists.llvm.org>> wrote:
Author: lerochris
Date: Mon Jun 27 17:11:12 2016
New Revision: 273950

URL: http://llvm.org/viewvc/llvm-project?rev=273950&view=rev
Log: (empty)

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=273950&r1=273949&r2=273950&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Jun 27 17:11:12 2016
@@ -6594,6 +6594,8 @@ public:
   PtrDiffType = SignedLong;
   break;
 }
+
+MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
   }

   void getTargetDefines(const LangOptions &Opts,


___
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


r273997 - [Driver] Add method to redirect output of Compilation.

2016-06-28 Thread Nikolay Haustov via cfe-commits
Author: nhaustov
Date: Tue Jun 28 03:00:42 2016
New Revision: 273997

URL: http://llvm.org/viewvc/llvm-project?rev=273997&view=rev
Log:
[Driver] Add method to redirect output of Compilation.

Summary:
Currently output of child process, however in my use case, it
needs to be captured and presented to the user.

Add Redirect method to Compilation and use existing infrastructure
for redirecting output of commands.

Reviewers: tstellarAMD

Subscribers: cfe-commits

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

Modified:
cfe/trunk/include/clang/Driver/Compilation.h
cfe/trunk/lib/Driver/Compilation.cpp

Modified: cfe/trunk/include/clang/Driver/Compilation.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Compilation.h?rev=273997&r1=273996&r2=273997&view=diff
==
--- cfe/trunk/include/clang/Driver/Compilation.h (original)
+++ cfe/trunk/include/clang/Driver/Compilation.h Tue Jun 28 03:00:42 2016
@@ -252,6 +252,15 @@ public:
 
   /// Return true if we're compiling for diagnostics.
   bool isForDiagnostics() const { return ForDiagnostics; }
+
+  /// Redirect - Redirect output of this compilation. Can only be done once.
+  ///
+  /// \param Redirects - array of pointers to paths. The array
+  /// should have a size of three. The inferior process's
+  /// stdin(0), stdout(1), and stderr(2) will be redirected to the
+  /// corresponding paths. This compilation instance becomes
+  /// the owner of Redirects and will delete the array and StringRef's.
+  void Redirect(const StringRef** Redirects);
 };
 
 } // end namespace driver

Modified: cfe/trunk/lib/Driver/Compilation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Compilation.cpp?rev=273997&r1=273996&r2=273997&view=diff
==
--- cfe/trunk/lib/Driver/Compilation.cpp (original)
+++ cfe/trunk/lib/Driver/Compilation.cpp Tue Jun 28 03:00:42 2016
@@ -45,6 +45,7 @@ Compilation::~Compilation() {
 
   // Free redirections of stdout/stderr.
   if (Redirects) {
+delete Redirects[0];
 delete Redirects[1];
 delete Redirects[2];
 delete [] Redirects;
@@ -213,3 +214,7 @@ void Compilation::initCompilationForDiag
 StringRef Compilation::getSysRoot() const {
   return getDriver().SysRoot;
 }
+
+void Compilation::Redirect(const StringRef** Redirects) {
+  this->Redirects = Redirects;
+}


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


Re: [PATCH] D18035: [GCC] PR23529 Mangler part of attrbute abi_tag support

2016-06-28 Thread Richard Smith via cfe-commits
rsmith added a comment.

Thank you! I'm happy with this implementation (other than some data structure 
improvements), and cxx-abi-dev discussion seems to be settling on this approach 
(mangling the return type / variable type to extract attributes) being the 
right one.

(Minor nit: please make sure that your comments start with a capital letter and 
end in a period.)



Comment at: lib/AST/ItaniumMangle.cpp:352-355
@@ +351,6 @@
+  UsedAbiTags.insert(Tag);
+  if (std::find(TagList.begin(), TagList.end(), Tag) == TagList.end()) 
{
+// don't insert duplicates
+TagList.push_back(Tag);
+  }
+}

You're going to sort the result list anyway, so how about adding the tag here 
without checking if it's already present, then using `std::unique` to weed out 
duplicates after you sort?


Comment at: lib/AST/ItaniumMangle.cpp:679-683
@@ +678,7 @@
+  // Get tags from return type that are not present in function name or 
encoding
+  AbiTagList AdditionalAbiTags;
+  for (const auto &Tag : ReturnTypeAbiTags) {
+if (!FunctionEncodingMangler.AbiTagsRoot.getUsedAbiTags().count(Tag))
+  AdditionalAbiTags.push_back(Tag);
+  }
+

Instead of keeping the `UsedAbiTags` as a `SmallSetVector`, you can just keep a 
`SmallVector` of them, and sort/unique it here. Since you keep the list of 
emitted ABI tags sorted, you can then use `std::set_difference` to extract the 
additional tags in linear time.


http://reviews.llvm.org/D18035



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


r274044 - Update the expected masked load/store intrinsics names in tests

2016-06-28 Thread Artur Pilipenko via cfe-commits
Author: apilipenko
Date: Tue Jun 28 13:28:45 2016
New Revision: 274044

URL: http://llvm.org/viewvc/llvm-project?rev=274044&view=rev
Log:
Update the expected masked load/store intrinsics names in tests

The mangling of their names was changed in order to support arbitrary addrspace 
pointers as arguments in rL274043.

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

Modified: cfe/trunk/test/CodeGen/avx512bw-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512bw-builtins.c?rev=274044&r1=274043&r2=274044&view=diff
==
--- cfe/trunk/test/CodeGen/avx512bw-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512bw-builtins.c Tue Jun 28 13:28:45 2016
@@ -1376,30 +1376,30 @@ __mmask32 test_mm512_kunpackw(__mmask32
 
 __m512i test_mm512_mask_loadu_epi16(__m512i __W, __mmask32 __U, void const 
*__P) {
   // CHECK-LABEL: @test_mm512_mask_loadu_epi16
-  // CHECK: @llvm.masked.load.v32i16(<32 x i16>* %{{.*}}, i32 1, <32 x i1> 
%{{.*}}, <32 x i16> %{{.*}})
+  // CHECK: @llvm.masked.load.v32i16.p0v32i16(<32 x i16>* %{{.*}}, i32 1, <32 
x i1> %{{.*}}, <32 x i16> %{{.*}})
   return _mm512_mask_loadu_epi16(__W, __U, __P); 
 }
 
 __m512i test_mm512_maskz_loadu_epi16(__mmask32 __U, void const *__P) {
   // CHECK-LABEL: @test_mm512_maskz_loadu_epi16
-  // CHECK: @llvm.masked.load.v32i16(<32 x i16>* %{{.*}}, i32 1, <32 x i1> 
%{{.*}}, <32 x i16> %{{.*}})
+  // CHECK: @llvm.masked.load.v32i16.p0v32i16(<32 x i16>* %{{.*}}, i32 1, <32 
x i1> %{{.*}}, <32 x i16> %{{.*}})
   return _mm512_maskz_loadu_epi16(__U, __P); 
 }
 
 __m512i test_mm512_mask_loadu_epi8(__m512i __W, __mmask64 __U, void const 
*__P) {
   // CHECK-LABEL: @test_mm512_mask_loadu_epi8
-  // CHECK: @llvm.masked.load.v64i8(<64 x i8>* %{{.*}}, i32 1, <64 x i1> 
%{{.*}}, <64 x i8> %{{.*}})
+  // CHECK: @llvm.masked.load.v64i8.p0v64i8(<64 x i8>* %{{.*}}, i32 1, <64 x 
i1> %{{.*}}, <64 x i8> %{{.*}})
   return _mm512_mask_loadu_epi8(__W, __U, __P); 
 }
 
 __m512i test_mm512_maskz_loadu_epi8(__mmask64 __U, void const *__P) {
   // CHECK-LABEL: @test_mm512_maskz_loadu_epi8
-  // CHECK: @llvm.masked.load.v64i8(<64 x i8>* %{{.*}}, i32 1, <64 x i1> 
%{{.*}}, <64 x i8> %{{.*}})
+  // CHECK: @llvm.masked.load.v64i8.p0v64i8(<64 x i8>* %{{.*}}, i32 1, <64 x 
i1> %{{.*}}, <64 x i8> %{{.*}})
   return _mm512_maskz_loadu_epi8(__U, __P); 
 }
 void test_mm512_mask_storeu_epi16(void *__P, __mmask32 __U, __m512i __A) {
   // CHECK-LABEL: @test_mm512_mask_storeu_epi16
-  // CHECK: @llvm.masked.store.v32i16(<32 x i16> %{{.*}}, <32 x i16>* %{{.*}}, 
i32 1, <32 x i1> %{{.*}})
+  // CHECK: @llvm.masked.store.v32i16.p0v32i16(<32 x i16> %{{.*}}, <32 x i16>* 
%{{.*}}, i32 1, <32 x i1> %{{.*}})
   return _mm512_mask_storeu_epi16(__P, __U, __A); 
 }
 __mmask64 test_mm512_test_epi8_mask(__m512i __A, __m512i __B) {
@@ -1410,7 +1410,7 @@ __mmask64 test_mm512_test_epi8_mask(__m5
 
 void test_mm512_mask_storeu_epi8(void *__P, __mmask64 __U, __m512i __A) {
   // CHECK-LABEL: @test_mm512_mask_storeu_epi8
-  // CHECK: @llvm.masked.store.v64i8(<64 x i8> %{{.*}}, <64 x i8>* %{{.*}}, 
i32 1, <64 x i1> %{{.*}})
+  // CHECK: @llvm.masked.store.v64i8.p0v64i8(<64 x i8> %{{.*}}, <64 x i8>* 
%{{.*}}, i32 1, <64 x i1> %{{.*}})
   return _mm512_mask_storeu_epi8(__P, __U, __A); 
 }
 __mmask64 test_mm512_mask_test_epi8_mask(__mmask64 __U, __m512i __A, __m512i 
__B) {

Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=274044&r1=274043&r2=274044&view=diff
==
--- cfe/trunk/test/CodeGen/avx512f-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c Tue Jun 28 13:28:45 2016
@@ -186,7 +186,7 @@ void test_mm512_storeu_pd(void *p, __m51
 void test_mm512_mask_store_ps(void *p, __m512 a, __mmask16 m)
 {
   // CHECK-LABEL: @test_mm512_mask_store_ps
-  // CHECK: @llvm.masked.store.v16f32(<16 x float> %{{.*}}, <16 x float>* 
%{{.*}}, i32 64, <16 x i1> %{{.*}})
+  // CHECK: @llvm.masked.store.v16f32.p0v16f32(<16 x float> %{{.*}}, <16 x 
float>* %{{.*}}, i32 64, <16 x i1> %{{.*}})
   _mm512_mask_store_ps(p, m, a);
 }
 
@@ -237,19 +237,19 @@ void test_mm512_store_pd(void *p, __m512
 void test_mm512_mask_store_pd(void *p, __m512d a, __mmask8 m)
 {
   // CHECK-LABEL: @test_mm512_mask_store_pd
-  // CHECK: @llvm.masked.store.v8f64(<8 x double> %{{.*}}, <8 x double>* 
%{{.*}}, i32 64, <8 x i1> %{{.*}})
+  // CHECK: @llvm.masked.store.v8f64.p0v8f64(<8 x double> %{{.*}}, <8 x 
double>* %{{.*}}, i32 64, <8 x i1> %{{.*}})
   _mm512_mask_store_pd(p, m, a);
 }
 
 void test_mm512_mask_storeu_epi32(void *__P, __mmask16 __U, __m512i __A) {
   // CHECK-LABEL: @test_mm512_mask_storeu_epi32
-  // CHECK: @llvm.masked.store.

r274012 - [SPARC] Allows inlining of atomics for Sparc32 with appropriate store barrier.

2016-06-28 Thread Chris Dewhurst via cfe-commits
Author: lerochris
Date: Tue Jun 28 07:55:55 2016
New Revision: 274012

URL: http://llvm.org/viewvc/llvm-project?rev=274012&view=rev
Log:
[SPARC] Allows inlining of atomics for Sparc32 with appropriate store barrier.

The final change is required to extend the back-end's AtomicExpandPass that was 
implemented for Sparc (64 bit) and later extended for Sparc (32 bit).

Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/CodeGen/atomics-inlining.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=274012&r1=274011&r2=274012&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Tue Jun 28 07:55:55 2016
@@ -6601,6 +6601,7 @@ public:
   PtrDiffType = SignedLong;
   break;
 }
+MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
   }
 
   void getTargetDefines(const LangOptions &Opts,

Modified: cfe/trunk/test/CodeGen/atomics-inlining.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/atomics-inlining.c?rev=274012&r1=274011&r2=274012&view=diff
==
--- cfe/trunk/test/CodeGen/atomics-inlining.c (original)
+++ cfe/trunk/test/CodeGen/atomics-inlining.c Tue Jun 28 07:55:55 2016
@@ -3,6 +3,7 @@
 // RUN: %clang_cc1 -triple powerpc64-linux-gnu -emit-llvm %s -o - | FileCheck 
%s -check-prefix=PPC64
 // RUN: %clang_cc1 -triple mipsel-linux-gnu -emit-llvm %s -o - | FileCheck %s 
-check-prefix=MIPS32
 // RUN: %clang_cc1 -triple mips64el-linux-gnu -emit-llvm %s -o - | FileCheck 
%s -check-prefix=MIPS64
+// RUN: %clang_cc1 -triple sparc-unknown-eabi -emit-llvm %s -o - | FileCheck 
%s -check-prefix=SPARC
 
 unsigned char c1, c2;
 unsigned short s1, s2;
@@ -90,4 +91,16 @@ void test1(void) {
 // MIPS64: store atomic i64 {{.*}}, i64* @ll1 seq_cst
 // MIPS64: call void @__atomic_load(i64 zeroext 100, i8* getelementptr 
inbounds ([100 x i8], [100 x i8]* @a1, i32 0, i32 0)
 // MIPS64: call void @__atomic_store(i64 zeroext 100, i8* getelementptr 
inbounds ([100 x i8], [100 x i8]* @a1, i32 0, i32 0), i8* getelementptr 
inbounds ([100 x i8], [100 x i8]* @a2, i32 0, i32 0)
+
+// SPARC-LABEL: define void @test1
+// SPARC: = load atomic i8, i8* @c1 seq_cst
+// SPARC: store atomic i8 {{.*}}, i8* @c1 seq_cst
+// SPARC: = load atomic i16, i16* @s1 seq_cst
+// SPARC: store atomic i16 {{.*}}, i16* @s1 seq_cst
+// SPARC: = load atomic i32, i32* @i1 seq_cst
+// SPARC: store atomic i32 {{.*}}, i32* @i1 seq_cst
+// SPARC: = load atomic i64, i64* @ll1 seq_cst
+// SPARC: store atomic i64 {{.*}}, i64* @ll1 seq_cst
+// SPARC: call void @__atomic_load(i32 100, i8* getelementptr inbounds ([100 x 
i8], [100 x i8]* @a1, i32 0, i32 0), i8* getelementptr inbounds ([100 x i8], 
[100 x i8]* @a2, i32 0, i32 0)
+// SPARC: call void @__atomic_store(i32 100, i8* getelementptr inbounds ([100 
x i8], [100 x i8]* @a1, i32 0, i32 0), i8* getelementptr inbounds ([100 x i8], 
[100 x i8]* @a2, i32 0, i32 0)
 }


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


[PATCH] D21803: [libcxxabi] Provide a fallback __cxa_thread_atexit() implementation

2016-06-28 Thread Tavian Barnes via cfe-commits
tavianator created this revision.
tavianator added reviewers: danalbert, jroelofs.
tavianator added a subscriber: cfe-commits.
Herald added subscribers: danalbert, tberghammer.

__cxa_thread_atexit_impl() isn't present on all platforms, for example
Android pre-6.0.  This patch uses a weak symbol to detect _impl() 
support, falling back to a pthread_key_t-based implementation.

http://reviews.llvm.org/D21803

Files:
  cmake/config-ix.cmake
  src/CMakeLists.txt
  src/cxa_thread_atexit.cpp
  test/CMakeLists.txt
  test/cxa_thread_atexit_test.pass.cpp
  test/libcxxabi/test/config.py
  test/lit.site.cfg.in

Index: test/lit.site.cfg.in
===
--- test/lit.site.cfg.in
+++ test/lit.site.cfg.in
@@ -13,7 +13,6 @@
 config.enable_32bit = "@LIBCXXABI_BUILD_32_BITS@"
 config.target_info  = "@LIBCXXABI_TARGET_INFO@"
 config.executor = "@LIBCXXABI_EXECUTOR@"
-config.thread_atexit= "@LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL@"
 config.libcxxabi_shared = "@LIBCXXABI_ENABLE_SHARED@"
 config.enable_shared= "@LIBCXX_ENABLE_SHARED@"
 config.enable_exceptions= "@LIBCXXABI_ENABLE_EXCEPTIONS@"
Index: test/libcxxabi/test/config.py
===
--- test/libcxxabi/test/config.py
+++ test/libcxxabi/test/config.py
@@ -37,8 +37,6 @@
 super(Configuration, self).configure_features()
 if not self.get_lit_bool('enable_exceptions', True):
 self.config.available_features.add('libcxxabi-no-exceptions')
-if self.get_lit_bool('thread_atexit', True):
-self.config.available_features.add('thread_atexit')
 
 def configure_compile_flags(self):
 self.cxx.compile_flags += ['-DLIBCXXABI_NO_TIMER']
Index: test/cxa_thread_atexit_test.pass.cpp
===
--- test/cxa_thread_atexit_test.pass.cpp
+++ test/cxa_thread_atexit_test.pass.cpp
@@ -8,7 +8,6 @@
 //===--===//
 
 // REQUIRES: linux
-// REQUIRES: thread_atexit
 
 #include 
 #include 
Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -16,7 +16,6 @@
 pythonize_bool(LIBCXXABI_ENABLE_THREADS)
 pythonize_bool(LIBCXXABI_ENABLE_EXCEPTIONS)
 pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
-pythonize_bool(LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL)
 set(LIBCXXABI_TARGET_INFO "libcxx.test.target_info.LocalTI" CACHE STRING
 "TargetInfo to use when setting up test environment.")
 set(LIBCXXABI_EXECUTOR "None" CACHE STRING
Index: src/cxa_thread_atexit.cpp
===
--- src/cxa_thread_atexit.cpp
+++ src/cxa_thread_atexit.cpp
@@ -8,19 +8,77 @@
 //===--===//
 
 #include "cxxabi.h"
+#include 
+#include 
 
 namespace __cxxabiv1 {
-extern "C" {
+namespace {
+  typedef void (*Dtor)(void *);
+
+  struct DtorList {
+Dtor dtor;
+void* obj;
+DtorList* next;
+  };
+
+  void run_dtors(void* ptr) {
+auto elem = static_cast(ptr);
+while (elem) {
+  auto saved = elem;
+  elem = elem->next;
+  saved->dtor(saved->obj);
+  std::free(saved);
+}
+  }
+
+  class DtorListHolder {
+  public:
+DtorListHolder() {
+  pthread_key_create(&key_, run_dtors);
+}
+
+~DtorListHolder() {
+  run_dtors(get());
+  pthread_key_delete(key_);
+}
+
+DtorList* get() {
+  return static_cast(pthread_getspecific(key_));
+}
+
+void set(DtorList* list) {
+  pthread_setspecific(key_, list);
+}
+
+  private:
+pthread_key_t key_;
+  };
+} // namespace
 
-#ifdef HAVE___CXA_THREAD_ATEXIT_IMPL
+extern "C" {
 
-_LIBCXXABI_FUNC_VIS int __cxa_thread_atexit(void (*dtor)(void *), void *obj,
+_LIBCXXABI_FUNC_VIS int __cxa_thread_atexit(Dtor dtor, void *obj,
 void *dso_symbol) throw() {
-  extern int __cxa_thread_atexit_impl(void (*)(void *), void *, void *);
-  return __cxa_thread_atexit_impl(dtor, obj, dso_symbol);
-}
+  extern int __cxa_thread_atexit_impl(Dtor, void *, void *)
+__attribute__((__weak__));
 
-#endif // HAVE__CXA_THREAD_ATEXIT_IMPL
+  if (__cxa_thread_atexit_impl) {
+return __cxa_thread_atexit_impl(dtor, obj, dso_symbol);
+  } else {
+static DtorListHolder dtors;
+
+auto head = static_cast(std::malloc(sizeof(DtorList)));
+if (!head) {
+  return -1;
+}
+
+head->dtor = dtor;
+head->obj = obj;
+head->next = dtors.get();
+dtors.set(head);
+return 0;
+  }
+}
 
 } // extern "C"
 } // namespace __cxxabiv1
Index: src/CMakeLists.txt
===
--- src/CMakeLists.txt
+++ src/CMakeLists.txt
@@ -41,10 +41,6 @@
 
 include_directories("${LIBCXXABI_LIBCX

Re: [PATCH] D21653: [Sema] Disallow ambiguous base-to-derived conversion in template argument deduction

2016-06-28 Thread Richard Smith via cfe-commits
rsmith added a comment.

Well OK then, commit away! :)


http://reviews.llvm.org/D21653



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


Re: [PATCH] D21803: [libcxxabi] Provide a fallback __cxa_thread_atexit() implementation

2016-06-28 Thread David Majnemer via cfe-commits
majnemer added a subscriber: majnemer.


Comment at: src/cxa_thread_atexit.cpp:36-47
@@ +35,14 @@
+  public:
+DtorListHolder() {
+  pthread_key_create(&key_, run_dtors);
+}
+
+~DtorListHolder() {
+  run_dtors(get());
+  pthread_key_delete(key_);
+}
+
+DtorList* get() {
+  return static_cast(pthread_getspecific(key_));
+}
+

What happens if `pthread_key_create` fails?


Comment at: src/cxa_thread_atexit.cpp:61-67
@@ -18,6 +60,9 @@
+_LIBCXXABI_FUNC_VIS int __cxa_thread_atexit(Dtor dtor, void *obj,
 void *dso_symbol) throw() {
-  extern int __cxa_thread_atexit_impl(void (*)(void *), void *, void *);
-  return __cxa_thread_atexit_impl(dtor, obj, dso_symbol);
-}
+  extern int __cxa_thread_atexit_impl(Dtor, void *, void *)
+__attribute__((__weak__));
 
-#endif // HAVE__CXA_THREAD_ATEXIT_IMPL
+  if (__cxa_thread_atexit_impl) {
+return __cxa_thread_atexit_impl(dtor, obj, dso_symbol);
+  } else {
+static DtorListHolder dtors;

Is there a reason to use the weak symbol on non-Android platforms?


http://reviews.llvm.org/D21803



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


LLVM buildmaster will be restarted tonight

2016-06-28 Thread Galina Kistanova via cfe-commits
Hello everyone,

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

Thanks

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


r274076 - ObjC Class Property: diagnostics when accessing a class property using instance.

2016-06-28 Thread Manman Ren via cfe-commits
Author: mren
Date: Tue Jun 28 18:01:49 2016
New Revision: 274076

URL: http://llvm.org/viewvc/llvm-project?rev=274076&view=rev
Log:
ObjC Class Property: diagnostics when accessing a class property using instance.

When a class property is accessed with an object instance, before this commit,
we try to apply a typo correction of the same property:
property 'c' not found on object of type 'A *'; did you mean 'c'?

With this commit, we correctly emit a diagnostics:
property 'c' is a class property; did you mean to access it with class 'A'?

rdar://26866973

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaExprObjC.cpp
cfe/trunk/test/FixIt/fixit-objc.m
cfe/trunk/test/SemaObjC/objc-class-property.m

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=274076&r1=274075&r2=274076&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Jun 28 18:01:49 
2016
@@ -7761,6 +7761,8 @@ def err_typecheck_member_reference_ivar_
   "%0 does not have a member named %1; did you mean %2?">;
 def err_property_not_found_suggest : Error<
   "property %0 not found on object of type %1; did you mean %2?">;
+def err_class_property_found : Error<
+  "property %0 is a class property; did you mean to access it with class 
'%1'?">;
 def err_ivar_access_using_property_syntax_suggest : Error<
   "property %0 not found on object of type %1; did you mean to access instance 
variable %2?">;
 def warn_property_access_suggest : Warning<

Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=274076&r1=274075&r2=274076&view=diff
==
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Tue Jun 28 18:01:49 2016
@@ -1817,7 +1817,7 @@ HandleExprPropertyRefExpr(const ObjCObje
   Selector Sel = PP.getSelectorTable().getNullarySelector(Member);
   ObjCMethodDecl *Getter = IFace->lookupInstanceMethod(Sel);
   
-  // May be founf in property's qualified list.
+  // May be found in property's qualified list.
   if (!Getter)
 Getter = LookupMethodInQualifiedType(Sel, OPT, true);
 
@@ -1837,7 +1837,7 @@ HandleExprPropertyRefExpr(const ObjCObje
PP.getSelectorTable(), Member);
   ObjCMethodDecl *Setter = IFace->lookupInstanceMethod(SetterSel);
   
-  // May be founf in property's qualified list.
+  // May be found in property's qualified list.
   if (!Setter)
 Setter = LookupMethodInQualifiedType(SetterSel, OPT, true);
   
@@ -1885,12 +1885,29 @@ HandleExprPropertyRefExpr(const ObjCObje
   LookupOrdinaryName, nullptr, nullptr,
   llvm::make_unique>(),
   CTK_ErrorRecovery, IFace, false, OPT)) {
-diagnoseTypo(Corrected, PDiag(diag::err_property_not_found_suggest)
-  << MemberName << QualType(OPT, 0));
 DeclarationName TypoResult = Corrected.getCorrection();
-return HandleExprPropertyRefExpr(OPT, BaseExpr, OpLoc,
- TypoResult, MemberLoc,
- SuperLoc, SuperType, Super);
+if (TypoResult.isIdentifier() &&
+TypoResult.getAsIdentifierInfo() == Member) {
+  // There is no need to try the correction if it is the same.
+  NamedDecl *ChosenDecl =
+Corrected.isKeyword() ? nullptr : Corrected.getFoundDecl();
+  if (ChosenDecl && isa(ChosenDecl))
+if (cast(ChosenDecl)->isClassProperty()) {
+  // This is a class property, we should not use the instance to
+  // access it.
+  Diag(MemberLoc, diag::err_class_property_found) << MemberName
+  << OPT->getInterfaceDecl()->getName()
+  << FixItHint::CreateReplacement(BaseExpr->getSourceRange(),
+  OPT->getInterfaceDecl()->getName());
+  return ExprError();
+}
+} else {
+  diagnoseTypo(Corrected, PDiag(diag::err_property_not_found_suggest)
+<< MemberName << QualType(OPT, 0));
+  return HandleExprPropertyRefExpr(OPT, BaseExpr, OpLoc,
+   TypoResult, MemberLoc,
+   SuperLoc, SuperType, Super);
+}
   }
   ObjCInterfaceDecl *ClassDeclared;
   if (ObjCIvarDecl *Ivar = 

Modified: cfe/trunk/test/FixIt/fixit-objc.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/FixIt/fixit-objc.m?rev=274076&r1=274075&r2=274076&view=diff
==
--- cfe/trunk/test/FixIt/fixit-objc.m (original)
+++ cfe/

[PATCH] D21820: [libcxx] [test] Make swap_noexcept.pass.cpp tests more portable.

2016-06-28 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.

Make swap_noexcept.pass.cpp tests more portable.

These tests define types like some_alloc, which dramatically fail to meet the 
allocator requirements. They don't even have allocate() member functions. Then, 
they actually default-construct containers with these not-allocators. MSVC's 
STL can't tolerate this, because we need to dynamically allocate sentinel nodes 
and debugging machinery.

A true fix would involve centralizing these allocators, allowing 
POCS/is_always_equal/etc. to be customized as desired, while actually providing 
conformant allocators. But in the meantime, I have incremental improvements.

The bulk of these changes involves including  for declval(), then 
replacing

C c1, c2;
static_assert(noexcept(swap(c1, c2)), "");

with

static_assert(noexcept(swap(std::declval(), std::declval())), "");

This avoids instantiating the containers' default constructors.

The other part of these changes involves replacing static_assert with 
LIBCPP_STATIC_ASSERT for certain things that aren't guaranteed by the Standard. 
(We're already including "test_macros.h" explicitly.)


test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp
test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp
test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp
test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp

For the ordered associative containers, the Working Paper inspects 
is_always_equal && is_nothrow_swappable_v.

The updated lines are using std::less or some_comp2, which are 
nothrow-swappable, so that's okay. However, they're using test_allocator 
(stateful), other_allocator (stateful), or some_alloc3 (with is_always_equal 
being false_type). Therefore, these assertions aren't guaranteed by the WP.

BONUS CHANGE: In multimap.special/swap_noexcept.pass.cpp, there was one 
occurrence of std::map that's being changed to std::multimap.


test/std/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp
test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp
test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp
test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp

Same for the unordered associative containers. They inspect is_always_equal && 
is_nothrow_swappable_v && is_nothrow_swappable_v. 
std::hash/std::equal_to and some_hash2/some_comp2 are nothrow-swappable, but 
test_allocator/other_allocator/some_alloc3 aren't always-equal.


test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp
test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp
test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp

For these sequences, the WP inspects is_always_equal. 
test_allocator/other_allocator aren't always-equal.


test/std/containers/sequences/vector/vector.special/swap_noexcept.pass.cpp
test/std/strings/basic.string/string.nonmembers/string.special/swap_noexcept.pass.cpp

For vector and basic_string, the WP inspects POCS || is_always_equal. 
test_allocator is stateful and doesn't set POCS, which defaults to false.


test/std/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp
test/std/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp
test/std/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp

No LIBCPP_STATIC_ASSERT changes, just declval.


test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp

vector::swap() is depicted without noexcept in the WP.

http://reviews.llvm.org/D21820

Files:
  test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp
  
test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp
  
test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp
  test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp
  
test/std/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp
  
test/std/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp
  
test/std/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp
  test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp
  
test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp
  test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp
  test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp
  test/std/containers/sequences/vector/vector.special/swap_noexcept.pass.cpp
  test/std/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp
  
test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp
  
test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp
  test/std/contai

r274077 - [Sema] Disallow ambigious base classes in template argument deduction

2016-06-28 Thread Erik Pilkington via cfe-commits
Author: epilk
Date: Tue Jun 28 18:05:09 2016
New Revision: 274077

URL: http://llvm.org/viewvc/llvm-project?rev=274077&view=rev
Log:
[Sema] Disallow ambigious base classes in template argument deduction

Fixes PR28195.

Differential revision: http://reviews.llvm.org/D21653

Modified:
cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
cfe/trunk/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp?rev=274077&r1=274076&r2=274077&view=diff
==
--- cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp Tue Jun 28 18:05:09 2016
@@ -103,12 +103,12 @@ DeduceTemplateArgumentsByTypeMatch(Sema
bool PartialOrdering = false);
 
 static Sema::TemplateDeductionResult
-DeduceTemplateArguments(Sema &S,
-TemplateParameterList *TemplateParams,
+DeduceTemplateArguments(Sema &S, TemplateParameterList *TemplateParams,
 const TemplateArgument *Params, unsigned NumParams,
 const TemplateArgument *Args, unsigned NumArgs,
 TemplateDeductionInfo &Info,
-SmallVectorImpl &Deduced);
+SmallVectorImpl &Deduced,
+bool NumberOfArgumentsMustMatch);
 
 /// \brief If the given expression is of a form that permits the deduction
 /// of a non-type template parameter, return the declaration of that
@@ -453,10 +453,10 @@ DeduceTemplateArguments(Sema &S,
 // Perform template argument deduction on each template
 // argument. Ignore any missing/extra arguments, since they could be
 // filled in by default arguments.
-return DeduceTemplateArguments(S, TemplateParams,
-   Param->getArgs(), Param->getNumArgs(),
-   SpecArg->getArgs(), SpecArg->getNumArgs(),
-   Info, Deduced);
+return DeduceTemplateArguments(S, TemplateParams, Param->getArgs(),
+   Param->getNumArgs(), SpecArg->getArgs(),
+   SpecArg->getNumArgs(), Info, Deduced,
+   /*NumberOfArgumentsMustMatch=*/false);
   }
 
   // If the argument type is a class template specialization, we
@@ -487,11 +487,10 @@ DeduceTemplateArguments(Sema &S,
 return Result;
 
   // Perform template argument deduction for the template arguments.
-  return DeduceTemplateArguments(S, TemplateParams,
- Param->getArgs(), Param->getNumArgs(),
- SpecArg->getTemplateArgs().data(),
- SpecArg->getTemplateArgs().size(),
- Info, Deduced);
+  return DeduceTemplateArguments(
+  S, TemplateParams, Param->getArgs(), Param->getNumArgs(),
+  SpecArg->getTemplateArgs().data(), SpecArg->getTemplateArgs().size(),
+  Info, Deduced, /*NumberOfArgumentsMustMatch=*/true);
 }
 
 /// \brief Determines whether the given type is an opaque type that
@@ -1461,6 +1460,7 @@ DeduceTemplateArgumentsByTypeMatch(Sema
   SmallVector ToVisit;
   ToVisit.push_back(RecordT);
   bool Successful = false;
+  SmallVector SuccessfulDeduced;
   while (!ToVisit.empty()) {
 // Retrieve the next class in the inheritance hierarchy.
 const RecordType *NextT = ToVisit.pop_back_val();
@@ -1481,14 +1481,20 @@ DeduceTemplateArgumentsByTypeMatch(Sema
   // note that we had some success. Otherwise, ignore any deductions
   // from this base class.
   if (BaseResult == Sema::TDK_Success) {
+// If we've already seen some success, then deduction fails due to
+// an ambiguity (temp.deduct.call p5).
+if (Successful)
+  return Sema::TDK_MiscellaneousDeductionFailure;
+
 Successful = true;
-DeducedOrig.clear();
-DeducedOrig.append(Deduced.begin(), Deduced.end());
+std::swap(SuccessfulDeduced, Deduced);
+
 Info.Param = BaseInfo.Param;
 Info.FirstArg = BaseInfo.FirstArg;
 Info.SecondArg = BaseInfo.SecondArg;
-  } else
-Deduced = DeducedOrig;
+  }
+
+  Deduced = DeducedOrig;
 }
 
 // Visit base classes
@@ -1500,8 +1506,10 @@ DeduceTemplateArgumentsByTypeMatch(Sema
 }
   }
 
-  if (Successful)
+  if (Successful) {
+std::swap(SuccessfulDeduced, Deduced);
 return Sema::TDK_Success;
+  }
 
   return Result;
 }
@@ -1825,12 +1833,12 @@ static bool hasPackExpansionBeforeEnd(co
 }
 
 static Sema::TemplateDeductionResult
-DeduceTemplateArguments(Sema &S,
-  

Re: [PATCH] D21653: [Sema] Disallow ambiguous base-to-derived conversion in template argument deduction

2016-06-28 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL274077: [Sema] Disallow ambigious base classes in template 
argument deduction (authored by epilk).

Changed prior to commit:
  http://reviews.llvm.org/D21653?vs=61691&id=62149#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21653

Files:
  cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
  cfe/trunk/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp

Index: cfe/trunk/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp
===
--- cfe/trunk/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp
+++ cfe/trunk/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp
@@ -160,3 +160,16 @@
 }
 
 }
+
+namespace PR28195 {
+
+template struct B {};
+struct D : B<0>, B<1> {};
+
+template int callee(B); // expected-note{{failed template argument deduction}}
+
+int caller() {
+  callee(D()); // expected-error{{no matching function}}
+}
+
+}
Index: cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
===
--- cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
+++ cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
@@ -103,12 +103,12 @@
bool PartialOrdering = false);
 
 static Sema::TemplateDeductionResult
-DeduceTemplateArguments(Sema &S,
-TemplateParameterList *TemplateParams,
+DeduceTemplateArguments(Sema &S, TemplateParameterList *TemplateParams,
 const TemplateArgument *Params, unsigned NumParams,
 const TemplateArgument *Args, unsigned NumArgs,
 TemplateDeductionInfo &Info,
-SmallVectorImpl &Deduced);
+SmallVectorImpl &Deduced,
+bool NumberOfArgumentsMustMatch);
 
 /// \brief If the given expression is of a form that permits the deduction
 /// of a non-type template parameter, return the declaration of that
@@ -453,10 +453,10 @@
 // Perform template argument deduction on each template
 // argument. Ignore any missing/extra arguments, since they could be
 // filled in by default arguments.
-return DeduceTemplateArguments(S, TemplateParams,
-   Param->getArgs(), Param->getNumArgs(),
-   SpecArg->getArgs(), SpecArg->getNumArgs(),
-   Info, Deduced);
+return DeduceTemplateArguments(S, TemplateParams, Param->getArgs(),
+   Param->getNumArgs(), SpecArg->getArgs(),
+   SpecArg->getNumArgs(), Info, Deduced,
+   /*NumberOfArgumentsMustMatch=*/false);
   }
 
   // If the argument type is a class template specialization, we
@@ -487,11 +487,10 @@
 return Result;
 
   // Perform template argument deduction for the template arguments.
-  return DeduceTemplateArguments(S, TemplateParams,
- Param->getArgs(), Param->getNumArgs(),
- SpecArg->getTemplateArgs().data(),
- SpecArg->getTemplateArgs().size(),
- Info, Deduced);
+  return DeduceTemplateArguments(
+  S, TemplateParams, Param->getArgs(), Param->getNumArgs(),
+  SpecArg->getTemplateArgs().data(), SpecArg->getTemplateArgs().size(),
+  Info, Deduced, /*NumberOfArgumentsMustMatch=*/true);
 }
 
 /// \brief Determines whether the given type is an opaque type that
@@ -1461,6 +1460,7 @@
   SmallVector ToVisit;
   ToVisit.push_back(RecordT);
   bool Successful = false;
+  SmallVector SuccessfulDeduced;
   while (!ToVisit.empty()) {
 // Retrieve the next class in the inheritance hierarchy.
 const RecordType *NextT = ToVisit.pop_back_val();
@@ -1481,14 +1481,20 @@
   // note that we had some success. Otherwise, ignore any deductions
   // from this base class.
   if (BaseResult == Sema::TDK_Success) {
+// If we've already seen some success, then deduction fails due to
+// an ambiguity (temp.deduct.call p5).
+if (Successful)
+  return Sema::TDK_MiscellaneousDeductionFailure;
+
 Successful = true;
-DeducedOrig.clear();
-DeducedOrig.append(Deduced.begin(), Deduced.end());
+std::swap(SuccessfulDeduced, Deduced);
+
 Info.Param = BaseInfo.Param;
 Info.FirstArg = BaseInfo.FirstArg;
 Info.SecondArg = BaseInfo.SecondArg;
-  } else
-Deduced = DeducedOrig;
+  }
+
+  Deduced = DeducedOrig;
 }
 
 // Visit base classes
@@ -1500,8 +1506,10 @@
 }
   }
 
-  if (Successful)
+  if (Successful) {
+std::swap(SuccessfulDeduced, Deduced);
 return Sema:

r274080 - Function declarations are, in fact, permitted in the init-statement of a for

2016-06-28 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Tue Jun 28 18:26:18 2016
New Revision: 274080

URL: http://llvm.org/viewvc/llvm-project?rev=274080&view=rev
Log:
Function declarations are, in fact, permitted in the init-statement of a for
loop. Don't confuse Sema by saying they're not.

Modified:
cfe/trunk/include/clang/Sema/DeclSpec.h
cfe/trunk/test/SemaCXX/cxx1y-deduced-return-type.cpp

Modified: cfe/trunk/include/clang/Sema/DeclSpec.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/DeclSpec.h?rev=274080&r1=274079&r2=274080&view=diff
==
--- cfe/trunk/include/clang/Sema/DeclSpec.h (original)
+++ cfe/trunk/include/clang/Sema/DeclSpec.h Tue Jun 28 18:26:18 2016
@@ -2119,9 +2119,9 @@ public:
 case FileContext:
 case MemberContext:
 case BlockContext:
+case ForContext:
   return true;
 
-case ForContext:
 case ConditionContext:
 case KNRTypeListContext:
 case TypeNameContext:

Modified: cfe/trunk/test/SemaCXX/cxx1y-deduced-return-type.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx1y-deduced-return-type.cpp?rev=274080&r1=274079&r2=274080&view=diff
==
--- cfe/trunk/test/SemaCXX/cxx1y-deduced-return-type.cpp (original)
+++ cfe/trunk/test/SemaCXX/cxx1y-deduced-return-type.cpp Tue Jun 28 18:26:18 
2016
@@ -502,3 +502,7 @@ namespace PR24989 {
   using T = decltype(x);
   void (T::*p)(int) const = &T::operator();
 }
+
+void forinit_decltypeauto() {
+  for (decltype(auto) forinit_decltypeauto_inner();;) {} // expected-warning 
{{interpreted as a function}} expected-note {{replace}}
+}


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


[PATCH] D21823: [Driver] Add flags for enabling both types of PGO Instrumentation

2016-06-28 Thread Jake VanAdrighem via cfe-commits
jakev created this revision.
jakev added reviewers: silvas, davidxl, friss, vsk, bob.wilson, xur.
jakev added a subscriber: cfe-commits.
jakev set the repository for this revision to rL LLVM.

The flags:
For frontend instrumentation: `-fpgo-train=source-cfg`
For IR-level instrumentation: `-fpgo-train=optimizer-cfg`
When applying profile data: `-fpgo-apply=/path/to/profdata`

This flag format is convenient in the event that we want to extend the feature 
set we enable/disable on the command line. As an example, something like 
value-profiling via `-fpgo-train=optimizer-cfg,value-profiling`.

Repository:
  rL LLVM

http://reviews.llvm.org/D21823

Files:
  include/clang/Driver/Options.td
  lib/Driver/ToolChain.cpp
  lib/Driver/Tools.cpp
  test/Driver/clang_f_opts.c

Index: test/Driver/clang_f_opts.c
===
--- test/Driver/clang_f_opts.c
+++ test/Driver/clang_f_opts.c
@@ -97,10 +97,20 @@
 // RUN: %clang -### -S -fcoverage-mapping %s 2>&1 | FileCheck -check-prefix=CHECK-COVERAGE-AND-GEN %s
 // RUN: %clang -### -S -fcoverage-mapping -fno-coverage-mapping %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-COVERAGE %s
 // RUN: %clang -### -S -fprofile-instr-generate -fcoverage-mapping -fno-coverage-mapping %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-COVERAGE %s
+// RUN: %clang -### -S -fpgo-train=source-cfg %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE %s
+// RUN: %clang -### -S -fpgo-train=optimizer-cfg %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE-LLVM %s
+// RUN: %clang -### -S -fpgo-train=source-cfg -fcoverage-mapping %s 2>&1 | FileCheck -check-prefix=CHECK-COVERAGE-AND-GEN %s
+// RUN: %clang -### -S -fpgo-train=optimizer-cfg -fcoverage-mapping %s 2>&1 | FileCheck -check-prefix=CHECK-COVERAGE-AND-GEN %s
+// RUN: %clang -### -S -fpgo-train=source-cfg -fprofile-instr-generate %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-TRAIN-GEN %s
+// RUN: %clang -### -S -fpgo-train=optimizer-cfg -fprofile-instr-generate %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-TRAIN-GEN %s
+// RUN: %clang -### -S -fpgo-train=source-cfg -fpgo-apply=file %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE %s
+// RUN: %clang -### -S -fpgo-train=optimizer-cfg -fpgo-apply=file %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE-LLVM %s
 // CHECK-PROFILE-GENERATE: "-fprofile-instrument=clang"
+// CHECK-PROFILE-GENERATE-LLVM: "-fprofile-instrument=llvm"
 // CHECK-PROFILE-GENERATE-DIR: "-fprofile-instrument-path=/some/dir{{/|}}default.profraw"
 // CHECK-PROFILE-GENERATE-FILE: "-fprofile-instrument-path=/tmp/somefile.profraw"
 // CHECK-NO-MIX-GEN-USE: '{{[a-z=-]*}}' not allowed with '{{[a-z=-]*}}'
+// CHECK-NO-MIX-TRAIN-GEN: '{{[a-z=-]*}}' not allowed with '{{[a-z=-]*}}'
 // CHECK-DISABLE-GEN-NOT: "-fprofile-instrument=clang"
 // CHECK-DISABLE-USE-NOT: "-fprofile-instr-use"
 // CHECK-COVERAGE-AND-GEN: '-fcoverage-mapping' only allowed with '-fprofile-instr-generate'
@@ -111,9 +121,14 @@
 // RUN: mkdir -p %t.d/some/dir
 // RUN: %clang -### -S -fprofile-use=%t.d/some/dir %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE-DIR %s
 // RUN: %clang -### -S -fprofile-instr-use=/tmp/somefile.prof %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE-FILE %s
+// RUN: %clang -### -S -fpgo-apply=/tmp/somefile.prof %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE-FILE %s
+// RUN: %clang -### -S -fpgo-train=source-cfg -fpgo-apply=/tmp/somefile.prof %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE-FILE %s
+// RUN: %clang -### -S -fpgo-train=optimizer-cfg  -fpgo-apply=/tmp/somefile.prof %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE-FILE %s
+// RUN: %clang -### -S -fprofile-instr-use=/tmp/somefile.prof -fpgo-apply=/tmp/somefile.prof %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-APPLY-USE %s
 // CHECK-PROFILE-USE: "-fprofile-instrument-use-path=default.profdata"
 // CHECK-PROFILE-USE-DIR: "-fprofile-instrument-use-path={{.*}}.d/some/dir{{/|}}default.profdata"
 // CHECK-PROFILE-USE-FILE: "-fprofile-instrument-use-path=/tmp/somefile.prof"
+// CHECK-NO-MIX-APPLY-USE: '{{[a-z=-]*}}' not allowed with '{{[a-z=-]*}}'
 
 // RUN: %clang -### -S -fvectorize %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
 // RUN: %clang -### -S -fno-vectorize -fvectorize %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3470,6 +3470,14 @@
 static void addPGOAndCoverageFlags(Compilation &C, const Driver &D,
const InputInfo &Output, const ArgList &Args,
ArgStringList &CmdArgs) {
+
+  auto *ProfileTrainingArg =
+  Args.getLastArg(options::OPT_fpgo_train_EQ,
+  options::OPT_fno_pgo_train);
+  if (ProfileTrainingArg &&
+  ProfileTrainingArg->getOption().matches(options::OPT_fno_pgo_train))
+ProfileTrainingArg = nullptr;
+
 

r274084 - Revert "[PS4] Tighten up a test (noticed in passing)"

2016-06-28 Thread Sean Silva via cfe-commits
Author: silvas
Date: Tue Jun 28 19:29:23 2016
New Revision: 274084

URL: http://llvm.org/viewvc/llvm-project?rev=274084&view=rev
Log:
Revert "[PS4] Tighten up a test (noticed in passing)"

This reverts commit r269709.

r262285 changed this deliberately so that the test would not be
sensitive to which binaries are in the same directory as clang.
See the commit message of that commit for more background.

Modified:
cfe/trunk/test/Driver/ps4-linker-win.c

Modified: cfe/trunk/test/Driver/ps4-linker-win.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ps4-linker-win.c?rev=274084&r1=274083&r2=274084&view=diff
==
--- cfe/trunk/test/Driver/ps4-linker-win.c (original)
+++ cfe/trunk/test/Driver/ps4-linker-win.c Tue Jun 28 19:29:23 2016
@@ -22,5 +22,5 @@
 // RUN: env "PATH=%T;%PATH%;" %clang -target x86_64-scei-ps4  %s -shared \
 // RUN: -fuse-ld=ps4 -### 2>&1 | FileCheck --check-prefix=CHECK-PS4-LINKER 
%s
 
-// CHECK-PS4-GOLD: \\orbis-ld.gold.exe"
-// CHECK-PS4-LINKER: \\orbis-ld.exe"
+// CHECK-PS4-GOLD: \\orbis-ld.gold
+// CHECK-PS4-LINKER: \\orbis-ld


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


Re: [PATCH] D21773: [clang] Update an optimization remark test for change D18777

2016-06-28 Thread Sanjoy Das via cfe-commits
sanjoy added a subscriber: anemet.
sanjoy added a comment.

Sound plausible, but I don't know this area (optimization remarks) well enough 
to sign off on this.  @anemet can you please take a look?


http://reviews.llvm.org/D21773



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


Re: [PATCH] D21773: [clang] Update an optimization remark test for change D18777

2016-06-28 Thread Adam Nemet via cfe-commits
anemet added a comment.

> This test checks the loop-vectorization remarks when pointer checking 
> threshold is exceeded. The change in http://reviews.llvm.org/D18777 would 
> introduce zexts that cannot be removed so that the "loop not vectorized" 
> reason is changed, hence breaking this test.


Can you please elaborate?  The "loop not vectorized" reason is changed, to what?


http://reviews.llvm.org/D21773



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


Re: [PATCH] D20334: [libcxx] Fix a bug in strstreambuf::overflow

2016-06-28 Thread Duncan P. N. Exon Smith via cfe-commits
The fix looks fairly obvious, but you haven't added a testcase.  Would you 
please do so?

> On 2016-May-17, at 12:20, Akira Hatanaka via cfe-commits 
>  wrote:
> 
> ahatanak created this revision.
> ahatanak added reviewers: mclow.lists, EricWF, howard.hinnant.
> ahatanak added a subscriber: cfe-commits.
> 
> The end pointer should point to one past the end of the newly allocated 
> buffer.
> 
> Without this fix, asan reports an error when the following code is compiled 
> and executed:
> 
> $ cat test.cpp
> 
> ```
> std::string stringOfLength(const size_t length) {
>  std::string s("");
> 
>  std::string characters("abcdefghijklmnopqrstuvwxyz0123456789+-*/");
>  for (size_t i = 0; i < length; ++i) {
>s += characters[i % characters.size()];
>  }
> 
>  return s;
> }
> 
> int main(int, char const **argv) {
>  std::ostrstream oss;
> 
>  oss << stringOfLength(atoi(argv[1])) << std::ends;
>  std::cout << oss.str();
>  oss.freeze(false);
> 
>  return 0;
> }```
> 
> $ clang++  -fsanitize=address test.cpp && ./a.out 4096
> ==18970==ERROR: AddressSanitizer: heap-buffer-overflow on address 
> 0x6211dd00 at pc 0x00010277c45d bp 0x7fff5d4ce6e0 sp 0x7fff5d4cdea0
> READ of size 4097 at 0x6211dd00 thread T0
>#0 0x10277c45c in wrap_strlen (libclang_rt.asan_osx_dynamic.dylib+0x4345c)
>#1 0x102733954 in std::__1::char_traits::length(char const*) 
> (a.out+0x12954)
>#2 0x10273390b in std::__1::basic_ostream std::__1::char_traits >& 
> std::__1::operator<< 
> >(std::__1::basic_ostream >&, char const*) 
> (a.out+0x1290b)
>#3 0x102733346 in main (a.out+0x12346)
>#4 0x7fff901905ac in start (libdyld.dylib+0x35ac)
>#5 0x1  ()
> 
> 0x6211dd00 is located 0 bytes to the right of 4096-byte region 
> [0x6211cd00,0x6211dd00)
> allocated by thread T0 here:
>#0 0x10278d42b in wrap__Znam (libclang_rt.asan_osx_dynamic.dylib+0x5442b)
>#1 0x7fff9bdc9fa1 in std::__1::strstreambuf::overflow(int) 
> (libc++.1.dylib+0x44fa1)
>#2 0x7fff9bd901cc in std::__1::basic_streambuf std::__1::char_traits >::xsputn(char const*, long) 
> (libc++.1.dylib+0xb1cc)
>#3 0x10273547c in std::__1::ostreambuf_iterator std::__1::char_traits > std::__1::__pad_and_output std::__1::char_traits >(std::__1::ostreambuf_iterator std::__1::char_traits >, char const*, char const*, char const*, 
> std::__1::ios_base&, char) (a.out+0x1447c)
>#4 0x102734312 in std::__1::basic_ostream std::__1::char_traits >& std::__1::__put_character_sequence std::__1::char_traits >(std::__1::basic_ostream std::__1::char_traits >&, char const*, unsigned long) 
> (a.out+0x13312)
>#5 0x10273389d in std::__1::basic_ostream std::__1::char_traits >& std::__1::operator<< std::__1::char_traits, std::__1::allocator 
> >(std::__1::basic_ostream >&, 
> std::__1::basic_string, 
> std::__1::allocator > const&) (a.out+0x1289d)
>#6 0x1027332c4 in main (a.out+0x122c4)
>#7 0x7fff901905ac in start (libdyld.dylib+0x35ac)
>#8 0x1  ()
> 
> http://reviews.llvm.org/D20334
> 
> Files:
>  src/strstream.cpp
> 
> Index: src/strstream.cpp
> ===
> --- src/strstream.cpp
> +++ src/strstream.cpp
> @@ -180,7 +180,7 @@
> delete [] eback();
> }
> setg(buf, buf + ninp, buf + einp);
> -setp(buf + einp, buf + einp + eout);
> +setp(buf + einp, buf + new_size);
> pbump(static_cast(nout));
> __strmode_ |= __allocated;
> }
> 
> 
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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


Re: [PATCH] D20334: [libcxx] Fix a bug in strstreambuf::overflow

2016-06-28 Thread Duncan P. N. Exon Smith via cfe-commits
(Ignore me, I was looking at an old version.)

> On 2016-Jun-28, at 17:56, Duncan P. N. Exon Smith via cfe-commits 
>  wrote:
> 
> The fix looks fairly obvious, but you haven't added a testcase.  Would you 
> please do so?
> 
>> On 2016-May-17, at 12:20, Akira Hatanaka via cfe-commits 
>>  wrote:
>> 
>> ahatanak created this revision.
>> ahatanak added reviewers: mclow.lists, EricWF, howard.hinnant.
>> ahatanak added a subscriber: cfe-commits.
>> 
>> The end pointer should point to one past the end of the newly allocated 
>> buffer.
>> 
>> Without this fix, asan reports an error when the following code is compiled 
>> and executed:
>> 
>> $ cat test.cpp
>> 
>> ```
>> std::string stringOfLength(const size_t length) {
>> std::string s("");
>> 
>> std::string characters("abcdefghijklmnopqrstuvwxyz0123456789+-*/");
>> for (size_t i = 0; i < length; ++i) {
>>   s += characters[i % characters.size()];
>> }
>> 
>> return s;
>> }
>> 
>> int main(int, char const **argv) {
>> std::ostrstream oss;
>> 
>> oss << stringOfLength(atoi(argv[1])) << std::ends;
>> std::cout << oss.str();
>> oss.freeze(false);
>> 
>> return 0;
>> }```
>> 
>> $ clang++  -fsanitize=address test.cpp && ./a.out 4096
>> ==18970==ERROR: AddressSanitizer: heap-buffer-overflow on address 
>> 0x6211dd00 at pc 0x00010277c45d bp 0x7fff5d4ce6e0 sp 0x7fff5d4cdea0
>> READ of size 4097 at 0x6211dd00 thread T0
>>   #0 0x10277c45c in wrap_strlen (libclang_rt.asan_osx_dynamic.dylib+0x4345c)
>>   #1 0x102733954 in std::__1::char_traits::length(char const*) 
>> (a.out+0x12954)
>>   #2 0x10273390b in std::__1::basic_ostream> std::__1::char_traits >& 
>> std::__1::operator<< 
>> >(std::__1::basic_ostream >&, char const*) 
>> (a.out+0x1290b)
>>   #3 0x102733346 in main (a.out+0x12346)
>>   #4 0x7fff901905ac in start (libdyld.dylib+0x35ac)
>>   #5 0x1  ()
>> 
>> 0x6211dd00 is located 0 bytes to the right of 4096-byte region 
>> [0x6211cd00,0x6211dd00)
>> allocated by thread T0 here:
>>   #0 0x10278d42b in wrap__Znam (libclang_rt.asan_osx_dynamic.dylib+0x5442b)
>>   #1 0x7fff9bdc9fa1 in std::__1::strstreambuf::overflow(int) 
>> (libc++.1.dylib+0x44fa1)
>>   #2 0x7fff9bd901cc in std::__1::basic_streambuf> std::__1::char_traits >::xsputn(char const*, long) 
>> (libc++.1.dylib+0xb1cc)
>>   #3 0x10273547c in std::__1::ostreambuf_iterator> std::__1::char_traits > std::__1::__pad_and_output> std::__1::char_traits >(std::__1::ostreambuf_iterator> std::__1::char_traits >, char const*, char const*, char const*, 
>> std::__1::ios_base&, char) (a.out+0x1447c)
>>   #4 0x102734312 in std::__1::basic_ostream> std::__1::char_traits >& std::__1::__put_character_sequence> std::__1::char_traits >(std::__1::basic_ostream> std::__1::char_traits >&, char const*, unsigned long) 
>> (a.out+0x13312)
>>   #5 0x10273389d in std::__1::basic_ostream> std::__1::char_traits >& std::__1::operator<<> std::__1::char_traits, std::__1::allocator 
>> >(std::__1::basic_ostream >&, 
>> std::__1::basic_string, 
>> std::__1::allocator > const&) (a.out+0x1289d)
>>   #6 0x1027332c4 in main (a.out+0x122c4)
>>   #7 0x7fff901905ac in start (libdyld.dylib+0x35ac)
>>   #8 0x1  ()
>> 
>> http://reviews.llvm.org/D20334
>> 
>> Files:
>> src/strstream.cpp
>> 
>> Index: src/strstream.cpp
>> ===
>> --- src/strstream.cpp
>> +++ src/strstream.cpp
>> @@ -180,7 +180,7 @@
>>delete [] eback();
>>}
>>setg(buf, buf + ninp, buf + einp);
>> -setp(buf + einp, buf + einp + eout);
>> +setp(buf + einp, buf + new_size);
>>pbump(static_cast(nout));
>>__strmode_ |= __allocated;
>>}
>> 
>> 
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> 
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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


Re: [PATCH] D20334: [libcxx] Fix a bug in strstreambuf::overflow

2016-06-28 Thread Duncan P. N. Exon Smith via cfe-commits
dexonsmith added a comment.

I agree with Ben that this looks good.

Marshall and Eric, do you want Akira to hold off, or are you happy deferring to 
Ben and me?


http://reviews.llvm.org/D20334



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


Re: [PATCH] D20334: [libcxx] Fix a bug in strstreambuf::overflow

2016-06-28 Thread Duncan P. N. Exon Smith via cfe-commits
I agree with Ben that this looks good.

Marshall and Eric, do you want Akira to hold off, or are you happy deferring to 
Ben and me?

> On 2016-May-26, at 18:31, Akira Hatanaka via cfe-commits 
>  wrote:
> 
> ahatanak updated this revision to Diff 58740.
> ahatanak added a comment.
> 
> Remove unused variable and add test case.
> 
> 
> http://reviews.llvm.org/D20334
> 
> Files:
>  src/strstream.cpp
>  
> test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp
> 
> Index: 
> test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp
> ===
> --- /dev/null
> +++ 
> test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp
> @@ -0,0 +1,32 @@
> +//===--===//
> +//
> +// 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.
> +//
> +//===--===//
> +
> +// 
> +
> +// class strstreambuf
> +
> +// int overflow(int c);
> +
> +#include 
> +#include 
> +#include 
> +
> +int main(int, char const **argv) {
> +  std::ostrstream oss;
> +  std::string s;
> +
> +  for (int i = 0; i < 4096; ++i)
> +s.push_back((i % 16) + 'a');
> +
> +  oss << s << std::ends;
> +  std::cout << oss.str();
> +  oss.freeze(false);
> +
> +  return 0;
> +}
> Index: src/strstream.cpp
> ===
> --- src/strstream.cpp
> +++ src/strstream.cpp
> @@ -171,16 +171,15 @@
> ptrdiff_t ninp = gptr()  - eback();
> ptrdiff_t einp = egptr() - eback();
> ptrdiff_t nout = pptr()  - pbase();
> -ptrdiff_t eout = epptr() - pbase();
> if (__strmode_ & __allocated)
> {
> if (__pfree_)
> __pfree_(eback());
> else
> delete [] eback();
> }
> setg(buf, buf + ninp, buf + einp);
> -setp(buf + einp, buf + einp + eout);
> +setp(buf + einp, buf + new_size);
> pbump(static_cast(nout));
> __strmode_ |= __allocated;
> }
> 
> 
> ___
> 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] D21825: Driver: Forbid -fthinlto-index with output formats other than object files.

2016-06-28 Thread Peter Collingbourne via cfe-commits
pcc created this revision.
pcc added a reviewer: tejohnson.
pcc added a subscriber: cfe-commits.
Herald added a subscriber: mehdi_amini.

The other output formats aren't really useful to end users. The equivalent
functionality can still be accessed by developers with tools such as llvm-lto.

http://reviews.llvm.org/D21825

Files:
  lib/Driver/Tools.cpp
  test/Driver/thinlto_backend.c

Index: test/Driver/thinlto_backend.c
===
--- test/Driver/thinlto_backend.c
+++ test/Driver/thinlto_backend.c
@@ -6,5 +6,9 @@
 // CHECK-THINLTOBE-ACTION: -fthinlto-index=
 
 // Ensure clang driver gives the expected error for incorrect input type
-// RUN: not %clang -O2 -o %t1.o %s -c -fthinlto-index=%t.thinlto.bc 2>&1 | 
FileCheck %s -check-prefix=CHECK-WARNING
-// CHECK-WARNING: error: invalid argument '-fthinlto-index={{.*}}' only 
allowed with '-x ir'
+// RUN: not %clang -O2 -o %t1.o %s -c -fthinlto-index=%t.thinlto.bc 2>&1 | 
FileCheck %s -check-prefix=CHECK-ERR1
+// CHECK-ERR1: error: invalid argument '-fthinlto-index={{.*}}' only allowed 
with '-x ir'
+
+// And for incorrect output type
+// RUN: not %clang -O2 -o %t1.o -x ir %s -S -fthinlto-index=%t.thinlto.bc 2>&1 
| FileCheck %s -check-prefix=CHECK-ERR2
+// CHECK-ERR2: error: invalid argument '-fthinlto-index={{.*}}' only allowed 
with '-c'
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3895,6 +3895,9 @@
 if (!types::isLLVMIR(Input.getType()))
   D.Diag(diag::err_drv_argument_only_allowed_with) << A->getAsString(Args)
<< "-x ir";
+if (!isa(JA))
+  D.Diag(diag::err_drv_argument_only_allowed_with) << A->getAsString(Args)
+   << "-c";
 Args.AddLastArg(CmdArgs, options::OPT_fthinlto_index_EQ);
   }
 


Index: test/Driver/thinlto_backend.c
===
--- test/Driver/thinlto_backend.c
+++ test/Driver/thinlto_backend.c
@@ -6,5 +6,9 @@
 // CHECK-THINLTOBE-ACTION: -fthinlto-index=
 
 // Ensure clang driver gives the expected error for incorrect input type
-// RUN: not %clang -O2 -o %t1.o %s -c -fthinlto-index=%t.thinlto.bc 2>&1 | FileCheck %s -check-prefix=CHECK-WARNING
-// CHECK-WARNING: error: invalid argument '-fthinlto-index={{.*}}' only allowed with '-x ir'
+// RUN: not %clang -O2 -o %t1.o %s -c -fthinlto-index=%t.thinlto.bc 2>&1 | FileCheck %s -check-prefix=CHECK-ERR1
+// CHECK-ERR1: error: invalid argument '-fthinlto-index={{.*}}' only allowed with '-x ir'
+
+// And for incorrect output type
+// RUN: not %clang -O2 -o %t1.o -x ir %s -S -fthinlto-index=%t.thinlto.bc 2>&1 | FileCheck %s -check-prefix=CHECK-ERR2
+// CHECK-ERR2: error: invalid argument '-fthinlto-index={{.*}}' only allowed with '-c'
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3895,6 +3895,9 @@
 if (!types::isLLVMIR(Input.getType()))
   D.Diag(diag::err_drv_argument_only_allowed_with) << A->getAsString(Args)
<< "-x ir";
+if (!isa(JA))
+  D.Diag(diag::err_drv_argument_only_allowed_with) << A->getAsString(Args)
+   << "-c";
 Args.AddLastArg(CmdArgs, options::OPT_fthinlto_index_EQ);
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21545: CodeGen: Replace ThinLTO backend implementation with a client of LTO/Resolution.

2016-06-28 Thread Peter Collingbourne via cfe-commits
pcc updated this revision to Diff 62160.
pcc marked 2 inline comments as done.
pcc added a comment.

- Use ComputeCrossModuleImportForModule


http://reviews.llvm.org/D21545

Files:
  lib/CodeGen/BackendUtil.cpp
  lib/CodeGen/CMakeLists.txt

Index: lib/CodeGen/CMakeLists.txt
===
--- lib/CodeGen/CMakeLists.txt
+++ lib/CodeGen/CMakeLists.txt
@@ -8,6 +8,7 @@
   IRReader
   InstCombine
   Instrumentation
+  LTOResolution
   Linker
   MC
   ObjCARCOpts
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -29,9 +29,11 @@
 #include "llvm/IR/LegacyPassManager.h"
 #include "llvm/IR/Module.h"
 #include "llvm/IR/Verifier.h"
+#include "llvm/LTO/Resolution/LTOBackend.h"
 #include "llvm/MC/SubtargetFeature.h"
 #include "llvm/Object/ModuleSummaryIndexObjectFile.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/TargetRegistry.h"
 #include "llvm/Support/Timer.h"
@@ -74,8 +76,7 @@
   /// Set LLVM command line options passed through -backend-option.
   void setCommandLineOpts();
 
-  void CreatePasses(legacy::PassManager &MPM, legacy::FunctionPassManager &FPM,
-ModuleSummaryIndex *ModuleSummary);
+  void CreatePasses(legacy::PassManager &MPM, legacy::FunctionPassManager &FPM);
 
   /// Generates the TargetMachine.
   /// Leaves TM unchanged if it is unable to create the target machine.
@@ -281,8 +282,7 @@
 }
 
 void EmitAssemblyHelper::CreatePasses(legacy::PassManager &MPM,
-  legacy::FunctionPassManager &FPM,
-  ModuleSummaryIndex *ModuleSummary) {
+  legacy::FunctionPassManager &FPM) {
   if (CodeGenOpts.DisableLLVMPasses)
 return;
 
@@ -334,14 +334,6 @@
   PMBuilder.PrepareForLTO = CodeGenOpts.PrepareForLTO;
   PMBuilder.RerollLoops = CodeGenOpts.RerollLoops;
 
-  // If we are performing a ThinLTO importing compile, invoke the LTO
-  // pipeline and pass down the in-memory module summary index.
-  if (ModuleSummary) {
-PMBuilder.ModuleSummary = ModuleSummary;
-PMBuilder.populateThinLTOPassManager(MPM);
-return;
-  }
-
   // Add target-specific passes that need to run as early as possible.
   if (TM)
 PMBuilder.addExtension(
@@ -660,35 +652,15 @@
   if (TM)
 TheModule->setDataLayout(TM->createDataLayout());
 
-  // If we are performing a ThinLTO importing compile, load the function
-  // index into memory and pass it into CreatePasses, which will add it
-  // to the PassManagerBuilder and invoke LTO passes.
-  std::unique_ptr ModuleSummary;
-  if (!CodeGenOpts.ThinLTOIndexFile.empty()) {
-ErrorOr> IndexOrErr =
-llvm::getModuleSummaryIndexForFile(
-CodeGenOpts.ThinLTOIndexFile, [&](const DiagnosticInfo &DI) {
-  TheModule->getContext().diagnose(DI);
-});
-if (std::error_code EC = IndexOrErr.getError()) {
-  std::string Error = EC.message();
-  errs() << "Error loading index file '" << CodeGenOpts.ThinLTOIndexFile
- << "': " << Error << "\n";
-  return;
-}
-ModuleSummary = std::move(IndexOrErr.get());
-assert(ModuleSummary && "Expected non-empty module summary index");
-  }
-
   legacy::PassManager PerModulePasses;
   PerModulePasses.add(
   createTargetTransformInfoWrapperPass(getTargetIRAnalysis()));
 
   legacy::FunctionPassManager PerFunctionPasses(TheModule);
   PerFunctionPasses.add(
   createTargetTransformInfoWrapperPass(getTargetIRAnalysis()));
 
-  CreatePasses(PerModulePasses, PerFunctionPasses, ModuleSummary.get());
+  CreatePasses(PerModulePasses, PerFunctionPasses);
 
   legacy::PassManager CodeGenPasses;
   CodeGenPasses.add(
@@ -741,12 +713,69 @@
   }
 }
 
+static void runThinLTOBackend(const CodeGenOptions &CGOpts, Module *M,
+  std::unique_ptr OS) {
+  // If we are performing a ThinLTO importing compile, load the function index
+  // into memory and pass it into thinBackend, which will run the function
+  // importer and invoke LTO passes.
+  ErrorOr> IndexOrErr =
+  llvm::getModuleSummaryIndexForFile(
+  CGOpts.ThinLTOIndexFile,
+  [&](const DiagnosticInfo &DI) { M->getContext().diagnose(DI); });
+  if (std::error_code EC = IndexOrErr.getError()) {
+std::string Error = EC.message();
+errs() << "Error loading index file '" << CGOpts.ThinLTOIndexFile
+   << "': " << Error << "\n";
+return;
+  }
+  std::unique_ptr CombinedIndex = std::move(*IndexOrErr);
+
+  auto AddStream = [&](size_t Task) { return std::move(OS); };
+
+  StringMap>
+  ModuleToDefinedGVSummaries;
+  CombinedIndex->collectDefinedGVSummariesPerModule(ModuleToDefinedGVSummaries);
+
+  FunctionImporter::ImportMapTy ImportList;
+  ComputeCrossModuleImportFo

r274088 - Mark inheriting constructors as deleted if the corresponding defaulted default

2016-06-28 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Tue Jun 28 20:10:27 2016
New Revision: 274088

URL: http://llvm.org/viewvc/llvm-project?rev=274088&view=rev
Log:
Mark inheriting constructors as deleted if the corresponding defaulted default
constructor would be; this is effectively required by P0136R1. This has the
effect of exposing the validity of the base class initialization steps to
SFINAE checks.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/test/CXX/drs/dr15xx.cpp
cfe/trunk/test/CXX/special/class.init/class.inhctor.init/p1.cpp
cfe/trunk/test/SemaCXX/cxx11-inheriting-ctors.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=274088&r1=274087&r2=274088&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Jun 28 20:10:27 
2016
@@ -4295,20 +4295,25 @@ def err_new_abi_tag_on_redeclaration : E
 def note_deleted_dtor_no_operator_delete : Note<
   "virtual destructor requires an unambiguous, accessible 'operator delete'">;
 def note_deleted_special_member_class_subobject : Note<
-  "%select{default constructor|copy constructor|move constructor|"
-  "copy assignment operator|move assignment operator|destructor}0 of "
+  "%select{default constructor of|copy constructor of|move constructor of|"
+  "copy assignment operator of|move assignment operator of|destructor of|"
+  "constructor inherited by}0 "
   "%1 is implicitly deleted because "
   "%select{base class %3|%select{variant }4field %3}2 has "
   "%select{no|a deleted|multiple|an inaccessible|a non-trivial}4 "
   "%select{%select{default constructor|copy constructor|move constructor|copy "
-  "assignment operator|move assignment operator|destructor}0|destructor}5"
+  "assignment operator|move assignment operator|destructor|"
+  "%select{default|corresponding|default|default|default}4 constructor}0|"
+  "destructor}5"
   "%select{||s||}4">;
 def note_deleted_default_ctor_uninit_field : Note<
-  "default constructor of %0 is implicitly deleted because field %1 of "
-  "%select{reference|const-qualified}3 type %2 would not be initialized">;
+  "%select{default constructor of|constructor inherited by}0 "
+  "%1 is implicitly deleted because field %2 of "
+  "%select{reference|const-qualified}4 type %3 would not be initialized">;
 def note_deleted_default_ctor_all_const : Note<
-  "default constructor of %0 is implicitly deleted because all "
-  "%select{data members|data members of an anonymous union member}1"
+  "%select{default constructor of|constructor inherited by}0 "
+  "%1 is implicitly deleted because all "
+  "%select{data members|data members of an anonymous union member}2"
   " are const-qualified">;
 def note_deleted_copy_ctor_rvalue_reference : Note<
   "copy constructor of %0 is implicitly deleted because field %1 is of "
@@ -6567,6 +6572,8 @@ def err_nontemporal_builtin_must_be_poin
   "pointer, or a vector of such types (%0 invalid)">;
 
 def err_deleted_function_use : Error<"attempt to use a deleted function">;
+def err_deleted_inherited_ctor_use : Error<
+  "constructor inherited by %0 from base class %1 is implicitly deleted">;
 
 def err_kern_type_not_void_return : Error<
   "kernel function type %0 must have void return type">;

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=274088&r1=274087&r2=274088&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Tue Jun 28 20:10:27 2016
@@ -3634,6 +3634,7 @@ public:
  const ObjCInterfaceDecl *UnknownObjCClass=nullptr,
  bool ObjCPropertyAccess=false);
   void NoteDeletedFunction(FunctionDecl *FD);
+  void NoteDeletedInheritingConstructor(CXXConstructorDecl *CD);
   std::string getDeletedOrUnavailableSuffix(const FunctionDecl *FD);
   bool DiagnosePropertyAccessorMismatch(ObjCPropertyDecl *PD,
 ObjCMethodDecl *Getter,
@@ -4460,9 +4461,12 @@ public:
  ArrayRef DynamicExceptionRanges,
  Expr *NoexceptExpr);
 
+  class InheritedConstructorInfo;
+
   /// \brief Determine if a special member function should have a deleted
   /// definition when it is defaulted.
   bool ShouldDeleteSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM,
+ InheritedConstructorInfo *ICI = nullptr,
  bool Diagnose = false);
 
   /// \brief Declare the implicit default constructor for the given class.

Modified: cf

Re: [PATCH] D21803: [libcxxabi] Provide a fallback __cxa_thread_atexit() implementation

2016-06-28 Thread Tavian Barnes via cfe-commits
tavianator added inline comments.


Comment at: src/cxa_thread_atexit.cpp:36-47
@@ +35,14 @@
+  public:
+DtorListHolder() {
+  pthread_key_create(&key_, run_dtors);
+}
+
+~DtorListHolder() {
+  run_dtors(get());
+  pthread_key_delete(key_);
+}
+
+DtorList* get() {
+  return static_cast(pthread_getspecific(key_));
+}
+

majnemer wrote:
> What happens if `pthread_key_create` fails?
Nothing good!  I'll add the necessary error handling.


Comment at: src/cxa_thread_atexit.cpp:61-67
@@ -18,6 +60,9 @@
+_LIBCXXABI_FUNC_VIS int __cxa_thread_atexit(Dtor dtor, void *obj,
 void *dso_symbol) throw() {
-  extern int __cxa_thread_atexit_impl(void (*)(void *), void *, void *);
-  return __cxa_thread_atexit_impl(dtor, obj, dso_symbol);
-}
+  extern int __cxa_thread_atexit_impl(Dtor, void *, void *)
+__attribute__((__weak__));
 
-#endif // HAVE__CXA_THREAD_ATEXIT_IMPL
+  if (__cxa_thread_atexit_impl) {
+return __cxa_thread_atexit_impl(dtor, obj, dso_symbol);
+  } else {
+static DtorListHolder dtors;

majnemer wrote:
> Is there a reason to use the weak symbol on non-Android platforms?
Just simplicity.  (There are some fringe benefits, like the ability to build 
against pre-2.18 glibc but have it detect ..._impl() support when run with 
newer libraries.  Or magically supporting musl etc. if they add it, without 
having to recompile.)

Would you rather keep the build-time checks for non-Android platforms?


http://reviews.llvm.org/D21803



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


Re: [PATCH] D21545: CodeGen: Replace ThinLTO backend implementation with a client of LTO/Resolution.

2016-06-28 Thread Teresa Johnson via cfe-commits
tejohnson accepted this revision.
tejohnson added a comment.
This revision is now accepted and ready to land.

LGTM



Comment at: lib/CodeGen/BackendUtil.cpp:757
@@ +756,3 @@
+  }
+
+  lto::Config Conf;

Ok, please add a comment.


http://reviews.llvm.org/D21545



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


Re: [PATCH] D21277: Resubmit r270688: Using new TargetParser in Clang.

2016-06-28 Thread jojo.ma via cfe-commits
jojo added a comment.

I'm sorry that I should have submitted this and its fix in one review.
Now the old fix http://reviews.llvm.org/D21276 is abandoned,as a latest fix is 
included in http://reviews.llvm.org/D21785.
I will commit http://reviews.llvm.org/D21277 and 
http://reviews.llvm.org/D21785,once http://reviews.llvm.org/D21785 is approved.


Repository:
  rL LLVM

http://reviews.llvm.org/D21277



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


Re: [PATCH] D21773: [clang] Update an optimization remark test for change D18777

2016-06-28 Thread Adam Nemet via cfe-commits
anemet added a comment.

In http://reviews.llvm.org/D21773#469596, @lihuang wrote:

> IV is promoted to 64-bit but the trunc/zext cannot be eliminated (at least 
> cannot be eliminated with the -O1 pass pipeline). Then optimzation remark 
> becomes:
>
>   optimization-remark-options.c:17:3: remark: loop not vectorized: cannot 
> identify array bounds
>  [-Rpass-analysis=loop-vectorize]
>   for (int i = 0; i < N; i++) {


That sounds like an optimization regression.  It seems to me that you could 
create a testcase with fewer arrays than in the above test such that you don't 
exceed the max number of memchecks.  This new testcase would be vectorized 
before http://reviews.llvm.org/D18777 but not after.

Adam


http://reviews.llvm.org/D21773



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


r274101 - [Diag] Add getter shouldAlwaysPrint. NFC

2016-06-28 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Tue Jun 28 23:55:31 2016
New Revision: 274101

URL: http://llvm.org/viewvc/llvm-project?rev=274101&view=rev
Log:
[Diag] Add getter shouldAlwaysPrint. NFC

For the new hotness attribute, the API will take the pass rather than
the pass name so we can no longer play the trick of AlwaysPrint being a
special pass name. This adds a getter to help the transition.

There is also a corresponding llvm patch.

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

Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=274101&r1=274100&r2=274101&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Tue Jun 28 23:55:31 2016
@@ -535,7 +535,7 @@ void BackendConsumer::OptimizationRemark
   // llvm::DiagnosticInfo::AlwasyPrint or if the -Rpass-analysis flag has a
   // regular expression that matches the name of the pass name in \p D.
 
-  if (D.getPassName() == llvm::DiagnosticInfo::AlwaysPrint ||
+  if (D.shouldAlwaysPrint() ||
   (CodeGenOpts.OptimizationRemarkAnalysisPattern &&
CodeGenOpts.OptimizationRemarkAnalysisPattern->match(D.getPassName(
 EmitOptimizationMessage(
@@ -548,7 +548,7 @@ void BackendConsumer::OptimizationRemark
   // llvm::DiagnosticInfo::AlwasyPrint or if the -Rpass-analysis flag has a
   // regular expression that matches the name of the pass name in \p D.
 
-  if (D.getPassName() == llvm::DiagnosticInfo::AlwaysPrint ||
+  if (D.shouldAlwaysPrint() ||
   (CodeGenOpts.OptimizationRemarkAnalysisPattern &&
CodeGenOpts.OptimizationRemarkAnalysisPattern->match(D.getPassName(
 EmitOptimizationMessage(
@@ -561,7 +561,7 @@ void BackendConsumer::OptimizationRemark
   // llvm::DiagnosticInfo::AlwasyPrint or if the -Rpass-analysis flag has a
   // regular expression that matches the name of the pass name in \p D.
 
-  if (D.getPassName() == llvm::DiagnosticInfo::AlwaysPrint ||
+  if (D.shouldAlwaysPrint() ||
   (CodeGenOpts.OptimizationRemarkAnalysisPattern &&
CodeGenOpts.OptimizationRemarkAnalysisPattern->match(D.getPassName(
 EmitOptimizationMessage(


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


Re: [PATCH] D21823: [Driver] Add flags for enabling both types of PGO Instrumentation

2016-06-28 Thread Sean Silva via cfe-commits
silvas added a comment.

Some basic comments.



Comment at: include/clang/Driver/Options.td:483
@@ +482,3 @@
+Group, Flags<[DriverOption]>, MetaVarName<"">,
+HelpText<"Generate instrumented code to collect execution counts into 
 (overridden by LLVM_PROFILE_FILE env var)">;
+def fpgo_apply_EQ : Joined<["-"], "fpgo-apply=">,

This help text is stale.


Comment at: include/clang/Driver/Options.td:486
@@ -481,1 +485,3 @@
+Group, Flags<[DriverOption]>, MetaVarName<"">,
+HelpText<"Use instrumentation data for profile-guided optimization">;
 def fprofile_instr_use : Flag<["-"], "fprofile-instr-use">, Group,

You should probably update this help text to say something about applying.


Comment at: lib/Driver/Tools.cpp:3474
@@ +3473,3 @@
+
+  auto *ProfileTrainingArg =
+  Args.getLastArg(options::OPT_fpgo_train_EQ,

Call this PGOTrainArg for consistency.


Comment at: lib/Driver/Tools.cpp:3496
@@ +3495,3 @@
+
+  auto *ProfileApplyArg =
+  Args.getLastArg(options::OPT_fpgo_apply_EQ, options::OPT_fno_pgo_apply);

Call this PGOApplyArg for consistency.


Repository:
  rL LLVM

http://reviews.llvm.org/D21823



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


Re: [PATCH] D21823: [Driver] Add flags for enabling both types of PGO Instrumentation

2016-06-28 Thread Vedant Kumar via cfe-commits
vsk added a comment.

This lgtm with one nit, and pending approval from others.



Comment at: include/clang/Driver/Options.td:482
@@ +481,3 @@
+def fpgo_train_EQ : Joined<["-"], "fpgo-train=">,
+Group, Flags<[DriverOption]>, MetaVarName<"">,
+HelpText<"Generate instrumented code to collect execution counts into 
 (overridden by LLVM_PROFILE_FILE env var)">;

Would something like `` be a better MetaVarName?


Repository:
  rL LLVM

http://reviews.llvm.org/D21823



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


r274104 - Revert "[Coverage] Adopt llvm::coverage::encodeFilenamesAndRawMappings (NFC)"

2016-06-28 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Wed Jun 29 00:33:09 2016
New Revision: 274104

URL: http://llvm.org/viewvc/llvm-project?rev=274104&view=rev
Log:
Revert "[Coverage] Adopt llvm::coverage::encodeFilenamesAndRawMappings (NFC)"

This reverts commit 161ff9db3a3d0d62880d1cb18d58182cd3034912 (r273056).

This is breaking stage2 instrumented builds with "malformed coverage
data" errors.

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

Modified: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp?rev=274104&r1=274103&r2=274104&view=diff
==
--- cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp (original)
+++ cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp Wed Jun 29 00:33:09 2016
@@ -1013,27 +1013,35 @@ void CoverageMappingModuleGen::emit() {
 
   // Create the filenames and merge them with coverage mappings
   llvm::SmallVector FilenameStrs;
+  llvm::SmallVector FilenameRefs;
   FilenameStrs.resize(FileEntries.size());
+  FilenameRefs.resize(FileEntries.size());
   for (const auto &Entry : FileEntries) {
 llvm::SmallString<256> Path(Entry.first->getName());
 llvm::sys::fs::make_absolute(Path);
 
 auto I = Entry.second;
 FilenameStrs[I] = std::string(Path.begin(), Path.end());
+FilenameRefs[I] = FilenameStrs[I];
   }
 
-  size_t FilenamesSize;
-  size_t CoverageMappingSize;
-  llvm::Expected CoverageDataOrErr = 
encodeFilenamesAndRawMappings(
-  FilenameStrs, CoverageMappings, FilenamesSize, CoverageMappingSize);
-  if (llvm::Error E = CoverageDataOrErr.takeError()) {
-llvm::handleAllErrors(std::move(E), [](llvm::ErrorInfoBase &EI) {
-  llvm::report_fatal_error(EI.message());
-});
+  std::string FilenamesAndCoverageMappings;
+  llvm::raw_string_ostream OS(FilenamesAndCoverageMappings);
+  CoverageFilenamesSectionWriter(FilenameRefs).write(OS);
+  std::string RawCoverageMappings =
+  llvm::join(CoverageMappings.begin(), CoverageMappings.end(), "");
+  OS << RawCoverageMappings;
+  size_t CoverageMappingSize = RawCoverageMappings.size();
+  size_t FilenamesSize = OS.str().size() - CoverageMappingSize;
+  // Append extra zeroes if necessary to ensure that the size of the filenames
+  // and coverage mappings is a multiple of 8.
+  if (size_t Rem = OS.str().size() % 8) {
+CoverageMappingSize += 8 - Rem;
+for (size_t I = 0, S = 8 - Rem; I < S; ++I)
+  OS << '\0';
   }
-  std::string CoverageData = std::move(CoverageDataOrErr.get());
   auto *FilenamesAndMappingsVal =
-  llvm::ConstantDataArray::getString(Ctx, CoverageData, false);
+  llvm::ConstantDataArray::getString(Ctx, OS.str(), false);
 
   // Create the deferred function records array
   auto RecordsTy =


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