[PATCH] D25019: [clang-tidy] Make add_new_check.py Python 3 compatible

2016-10-05 Thread Alexander Kornienko via cfe-commits
alexfh requested changes to this revision.
alexfh added inline comments.
This revision now requires changes to proceed.


> add_new_check.py:58
> +f.write(b'//===--- ')
> +f.write((os.path.basename(filename)).encode())
> +f.write(b' - clang-tidy')

Too many parentheses.

> add_new_check.py:97-100
> +""" % {b'header_guard': header_guard.encode(),
> +   b'check_name': check_name_camel.encode(),
> +   b'check_name_dashes': check_name_dashes.encode(),
> +   b'module': module.encode()})

Is it better to encode the result of the formatting operator instead?

  (""" . """ % {'header_guard': header_guard, ... }).encode()

https://reviews.llvm.org/D25019



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


[PATCH] D15075: No error for conflict between inputs\outputs and clobber list

2016-10-05 Thread Akira Hatanaka via cfe-commits
ahatanak added inline comments.


> TargetInfo.cpp:430
>if (AN == Name && ARN.RegNum < Names.size())
> -return Name;
> +if (ReturnCanonical)
> +  return Names[ARN.RegNum];

Please use braces or a ternary operator here.

> ahatanak wrote in Targets.cpp:2718
> Can we skip the checks for all these non-alphabet characters and handle them 
> in "default"? Would doing so be incorrect?

Sorry for not being clear. Because this will fail to find registers for 
constraints like "=", I was thinking you can just check the first alphabet 
after skipping all the non-alphabets (using isalpha, for example).

> Targets.cpp:2714
>}
> +  virtual StringRef getConstraintRegister(const StringRef ,
> +const StringRef ) const {

Use "override" instead of "virtual".

> SemaStmtAsm.cpp:186
> +if (InOutVars.find(Clobber) != InOutVars.end()){
> +  SourceLocation Loc = Clobbers[i]->getLocStart();
> +  return 

You don't want to return the address of a local variable. Just change this 
function to return a SourceLocation by value. You can use 
SourceLocation::isValid in ActOnGCCAsmStmt to determine whether it is a valid 
SourceLocation.

> SemaStmtAsm.cpp:190
> +  }
> +  return nullptr;
> +}

Return "SourceLocation()"

> SemaStmtAsm.cpp:602
> +Constraints, Clobbers, NumClobbers, Context.getTargetInfo(), Context);
> +  if (ConstraintLoc) {
> +return Diag(*ConstraintLoc,

You don't need braces here.

https://reviews.llvm.org/D15075



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


r283417 - Taking StringRef in Driver.h APIs instead of raw pointers (NFC)

2016-10-05 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Thu Oct  6 00:11:48 2016
New Revision: 283417

URL: http://llvm.org/viewvc/llvm-project?rev=283417=rev
Log:
Taking StringRef in Driver.h APIs instead of raw pointers (NFC)

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

Modified: cfe/trunk/include/clang/Driver/Driver.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=283417=283416=283417=diff
==
--- cfe/trunk/include/clang/Driver/Driver.h (original)
+++ cfe/trunk/include/clang/Driver/Driver.h Thu Oct  6 00:11:48 2016
@@ -223,7 +223,7 @@ private:
   // Before executing jobs, sets up response files for commands that need them.
   void setUpResponseFiles(Compilation , Command );
 
-  void generatePrefixedToolNames(const char *Tool, const ToolChain ,
+  void generatePrefixedToolNames(StringRef Tool, const ToolChain ,
  SmallVectorImpl ) const;
 
 public:
@@ -369,7 +369,7 @@ public:
   /// directories to search.
   //
   // FIXME: This should be in CompilationInfo.
-  std::string GetFilePath(const char *Name, const ToolChain ) const;
+  std::string GetFilePath(StringRef Name, const ToolChain ) const;
 
   /// GetProgramPath - Lookup \p Name in the list of program search paths.
   ///
@@ -377,7 +377,7 @@ public:
   /// directories to search.
   //
   // FIXME: This should be in CompilationInfo.
-  std::string GetProgramPath(const char *Name, const ToolChain ) const;
+  std::string GetProgramPath(StringRef Name, const ToolChain ) const;
 
   /// HandleImmediateArgs - Handle any arguments which should be
   /// treated before building actions or binding tools.
@@ -427,7 +427,7 @@ public:
   /// as part of compilation; the file will have the given prefix and suffix.
   ///
   /// GCC goes to extra lengths here to be a bit more robust.
-  std::string GetTemporaryPath(StringRef Prefix, const char *Suffix) const;
+  std::string GetTemporaryPath(StringRef Prefix, StringRef Suffix) const;
 
   /// Return the pathname of the pch file in clang-cl mode.
   std::string GetClPchPath(Compilation , StringRef BaseName) const;
@@ -483,9 +483,8 @@ public:
   /// \return True if the entire string was parsed (9.2), or all
   /// groups were parsed (10.3.5extrastuff). HadExtra is true if all
   /// groups were parsed but extra characters remain at the end.
-  static bool GetReleaseVersion(const char *Str, unsigned ,
-unsigned , unsigned ,
-bool );
+  static bool GetReleaseVersion(StringRef Str, unsigned , unsigned 
,
+unsigned , bool );
 
   /// Parse digits from a string \p Str and fulfill \p Digits with
   /// the parsed numbers. This method assumes that the max number of
@@ -493,7 +492,7 @@ public:
   ///
   /// \return True if the entire string was parsed and there are
   /// no extra characters remaining at the end.
-  static bool GetReleaseVersion(const char *Str,
+  static bool GetReleaseVersion(StringRef Str,
 MutableArrayRef Digits);
 };
 

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=283417=283416=283417=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Thu Oct  6 00:11:48 2016
@@ -2908,7 +2908,7 @@ const char *Driver::GetNamedOutputPath(C
   }
 }
 
-std::string Driver::GetFilePath(const char *Name, const ToolChain ) const {
+std::string Driver::GetFilePath(StringRef Name, const ToolChain ) const {
   // Respect a limited subset of the '-Bprefix' functionality in GCC by
   // attempting to use this prefix when looking for file paths.
   for (const std::string  : PrefixDirs) {
@@ -2938,16 +2938,16 @@ std::string Driver::GetFilePath(const ch
 }
 
 void Driver::generatePrefixedToolNames(
-const char *Tool, const ToolChain ,
+StringRef Tool, const ToolChain ,
 SmallVectorImpl ) const {
   // FIXME: Needs a better variable than DefaultTargetTriple
-  Names.emplace_back(DefaultTargetTriple + "-" + Tool);
+  Names.emplace_back((DefaultTargetTriple + "-" + Tool).str());
   Names.emplace_back(Tool);
 
   // Allow the discovery of tools prefixed with LLVM's default target triple.
   std::string LLVMDefaultTargetTriple = llvm::sys::getDefaultTargetTriple();
   if (LLVMDefaultTargetTriple != DefaultTargetTriple)
-Names.emplace_back(LLVMDefaultTargetTriple + "-" + Tool);
+Names.emplace_back((LLVMDefaultTargetTriple + "-" + Tool).str());
 }
 
 static bool ScanDirForExecutable(SmallString<128> ,
@@ -2961,8 +2961,7 @@ static bool ScanDirForExecutable(SmallSt
   return false;
 }
 
-std::string Driver::GetProgramPath(const char *Name,
-   const ToolChain ) const {
+std::string Driver::GetProgramPath(StringRef 

r283416 - Use llvm::raw_string_ostream instead of std::stringstream (NFC)

2016-10-05 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Wed Oct  5 23:26:16 2016
New Revision: 283416

URL: http://llvm.org/viewvc/llvm-project?rev=283416=rev
Log:
Use llvm::raw_string_ostream instead of std::stringstream (NFC)

As a side effect, this avoid having to call .data() on the StringRef.

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

Modified: cfe/trunk/lib/Tooling/CompilationDatabase.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/CompilationDatabase.cpp?rev=283416=283415=283416=diff
==
--- cfe/trunk/lib/Tooling/CompilationDatabase.cpp (original)
+++ cfe/trunk/lib/Tooling/CompilationDatabase.cpp Wed Oct  5 23:26:16 2016
@@ -39,7 +39,7 @@ CompilationDatabase::~CompilationDatabas
 std::unique_ptr
 CompilationDatabase::loadFromDirectory(StringRef BuildDirectory,
std::string ) {
-  std::stringstream ErrorStream;
+  llvm::raw_string_ostream ErrorStream(ErrorMessage);
   for (CompilationDatabasePluginRegistry::iterator
It = CompilationDatabasePluginRegistry::begin(),
Ie = CompilationDatabasePluginRegistry::end();
@@ -49,9 +49,8 @@ CompilationDatabase::loadFromDirectory(S
 if (std::unique_ptr DB =
 Plugin->loadFromDirectory(BuildDirectory, DatabaseErrorMessage))
   return DB;
-ErrorStream << It->getName().data() << ": " << DatabaseErrorMessage << 
"\n";
+ErrorStream << It->getName() << ": " << DatabaseErrorMessage << "\n";
   }
-  ErrorMessage = ErrorStream.str();
   return nullptr;
 }
 


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


[PATCH] D25153: preprocessor supports `-dI` flag

2016-10-05 Thread Steve O'Brien via cfe-commits
elsteveogrande updated this revision to Diff 73720.
elsteveogrande marked an inline comment as done.
elsteveogrande added a comment.

Using `consume_front(sequence)`, cleaner escaping code.


https://reviews.llvm.org/D25153

Files:
  include/clang/Driver/Options.td
  include/clang/Frontend/PreprocessorOutputOptions.h
  lib/Frontend/CompilerInvocation.cpp
  lib/Frontend/PrintPreprocessedOutput.cpp
  test/Preprocessor/dump_import.h
  test/Preprocessor/dump_import.m
  test/Preprocessor/dump_include.c
  test/Preprocessor/dump_include.h

Index: test/Preprocessor/dump_include.h
===
--- /dev/null
+++ test/Preprocessor/dump_include.h
@@ -0,0 +1,2 @@
+#pragma once
+#define DUMP_INCLUDE_TESTVAL 1
Index: test/Preprocessor/dump_include.c
===
--- /dev/null
+++ test/Preprocessor/dump_include.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -w -E -dI -isystem %S %s -o - | grep '^#include *

[PATCH] D25248: [libcxx] [test] Fix shadow warnings.

2016-10-05 Thread Marshall Clow via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D25248



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


[PATCH] D25153: preprocessor supports `-dI` flag

2016-10-05 Thread Steve O'Brien via cfe-commits
elsteveogrande marked an inline comment as done.
elsteveogrande added inline comments.


> majnemer wrote in PrintPreprocessedOutput.cpp:331-349
> I think this loop would be easier to understand like so:
> 
>   while (!Path.empty()) {
> if (Path.consume_front("\\")) {
>   Buffer.push_back("");
> } else if (Path.consume_front("\"")) {
>   Buffer.push_back("\\\"");
> } else if (Path.consume_front("*/")) {
>   Buffer.push_back("*\\/");
> } else {
>   Buffer.push_back(Path.front());
>   Path = Path.drop_front();
> }
>   }
> 
> The big takeaway is that we now avoid messy `I + 1 < N` type checks.

yes!  I like this much better, thanks.  Didn't know about that method, very 
handy.

Also at the risk of changing more stuff and possibly churning more (thank you 
for sticking with me this long!) I'll change it to use either a 
`std::stringstream`, or `std::string` with `operator+=` to build it up.

A `std::vector` won't take additional strings `push_back`'ed like that, 
and while it's more handy than `char[]`, it's slightly weird, when this is 
stringstream's purpose, imho.

https://reviews.llvm.org/D25153



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


[PATCH] D25204: Register Calling Convention, Clang changes

2016-10-05 Thread Erich Keane via cfe-commits
erichkeane updated this revision to Diff 73716.
erichkeane marked 6 inline comments as done.
erichkeane added a comment.

Updated tests to properly show mangling for C++ types.  Required some fixes.  
Note that the decorating of names doesn't match ICC in non-named functions due 
to a bug in ICC, and the spec is silent about it, so this patch decorates them 
in the way that best fits the spec.


https://reviews.llvm.org/D25204

Files:
  include/clang-c/Index.h
  include/clang/AST/Type.h
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  include/clang/Basic/Specifiers.h
  include/clang/Basic/TokenKinds.def
  lib/AST/Expr.cpp
  lib/AST/ItaniumMangle.cpp
  lib/AST/Mangle.cpp
  lib/AST/MicrosoftMangle.cpp
  lib/AST/Type.cpp
  lib/AST/TypePrinter.cpp
  lib/Basic/Targets.cpp
  lib/CodeGen/CGCall.cpp
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/TargetInfo.cpp
  lib/Parse/ParseDecl.cpp
  lib/Parse/ParseTentative.cpp
  lib/Sema/SemaDeclAttr.cpp
  lib/Sema/SemaType.cpp
  test/CodeGen/regcall.c
  test/CodeGenCXX/regcall.cpp
  tools/libclang/CXType.cpp

Index: lib/Parse/ParseDecl.cpp
===
--- lib/Parse/ParseDecl.cpp
+++ lib/Parse/ParseDecl.cpp
@@ -605,6 +605,7 @@
 case tok::kw___fastcall:
 case tok::kw___stdcall:
 case tok::kw___thiscall:
+case tok::kw___regcall:
 case tok::kw___cdecl:
 case tok::kw___vectorcall:
 case tok::kw___ptr64:
@@ -3137,6 +3138,7 @@
 case tok::kw___stdcall:
 case tok::kw___fastcall:
 case tok::kw___thiscall:
+case tok::kw___regcall:
 case tok::kw___vectorcall:
   ParseMicrosoftTypeAttributes(DS.getAttributes());
   continue;
@@ -4454,6 +4456,7 @@
   case tok::kw___stdcall:
   case tok::kw___fastcall:
   case tok::kw___thiscall:
+  case tok::kw___regcall:
   case tok::kw___vectorcall:
   case tok::kw___w64:
   case tok::kw___ptr64:
@@ -4638,6 +4641,7 @@
   case tok::kw___stdcall:
   case tok::kw___fastcall:
   case tok::kw___thiscall:
+  case tok::kw___regcall:
   case tok::kw___vectorcall:
   case tok::kw___w64:
   case tok::kw___sptr:
@@ -4876,6 +4880,7 @@
 case tok::kw___stdcall:
 case tok::kw___fastcall:
 case tok::kw___thiscall:
+case tok::kw___regcall:
 case tok::kw___vectorcall:
   if (AttrReqs & AR_DeclspecAttributesParsed) {
 ParseMicrosoftTypeAttributes(DS.getAttributes());
Index: lib/Parse/ParseTentative.cpp
===
--- lib/Parse/ParseTentative.cpp
+++ lib/Parse/ParseTentative.cpp
@@ -909,7 +909,7 @@
   // '(' abstract-declarator ')'
   if (Tok.isOneOf(tok::kw___attribute, tok::kw___declspec, tok::kw___cdecl,
   tok::kw___stdcall, tok::kw___fastcall, tok::kw___thiscall,
-  tok::kw___vectorcall))
+  tok::kw___regcall, tok::kw___vectorcall))
 return TPResult::True; // attributes indicate declaration
   TPResult TPR = TryParseDeclarator(mayBeAbstract, mayHaveIdentifier);
   if (TPR != TPResult::Ambiguous)
@@ -1058,6 +1058,7 @@
   case tok::kw___stdcall:
   case tok::kw___fastcall:
   case tok::kw___thiscall:
+  case tok::kw___regcall:
   case tok::kw___vectorcall:
   case tok::kw___unaligned:
   case tok::kw___vector:
@@ -1351,6 +1352,7 @@
   case tok::kw___stdcall:
   case tok::kw___fastcall:
   case tok::kw___thiscall:
+  case tok::kw___regcall:
   case tok::kw___vectorcall:
   case tok::kw___w64:
   case tok::kw___sptr:
Index: lib/CodeGen/CodeGenModule.cpp
===
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -683,7 +683,16 @@
   } else {
 IdentifierInfo *II = ND->getIdentifier();
 assert(II && "Attempt to mangle unnamed decl.");
-Str = II->getName();
+const auto *FD = dyn_cast(ND);
+
+if (FD &&
+FD->getType()->castAs()->getCallConv() == CC_X86RegCall) {
+  llvm::raw_svector_ostream Out(Buffer);
+  Out << "__regcall3__" << II->getName();
+  Str = Out.str();
+} else {
+  Str = II->getName();
+}
   }
 
   // Keep the first result in the case of a mangling collision.
Index: lib/CodeGen/CGCall.cpp
===
--- lib/CodeGen/CGCall.cpp
+++ lib/CodeGen/CGCall.cpp
@@ -48,6 +48,7 @@
   default: return llvm::CallingConv::C;
   case CC_X86StdCall: return llvm::CallingConv::X86_StdCall;
   case CC_X86FastCall: return llvm::CallingConv::X86_FastCall;
+  case CC_X86RegCall: return llvm::CallingConv::X86_RegCall;
   case CC_X86ThisCall: return llvm::CallingConv::X86_ThisCall;
   case CC_X86_64Win64: return llvm::CallingConv::X86_64_Win64;
   case CC_X86_64SysV: return llvm::CallingConv::X86_64_SysV;
@@ -173,6 +174,9 @@
   if (D->hasAttr())
 return CC_X86FastCall;
 
+  if (D->hasAttr())
+return CC_X86RegCall;
+
   if (D->hasAttr())
 return CC_X86ThisCall;
 

[PATCH] D24715: [OpenCL] Block captured variables in dynamic parallelism - OpenCL 2.0

2016-10-05 Thread bekket mcclane via cfe-commits
mshockwave added a comment.

> From this picture I don't see how the flattening itself can help us to avoid 
> using global memory. Surely in both cases the captures content will have to 
> be copied into the memory accessible for the enqueued kernel (which is a 
> global memory in a general case, but doesn't have to be in some cases I am 
> guessing). Perhaps I am missing some extra step in the approach you are 
> proposing. If you rely on the parameter passing using normal function call 
> into the block_invoke then in both cases we can skip the memcpy of captures 
> at all. Otherwise both appoaches will need to make a copy of the captures.

Now I agree with the necessity of global `accessable_memory`. After all, kernel 
enqueuing functions in the host side(clEnqueueNDRangeXXX) also require 
pre-allocated `__global` memory, we should follow the same fashion.

> What we can improve though is avoiding extra data copy using the copy helpers 
> you are proposing (this can also be achieved by calling mempy passing the 
> capture offset pointer into block_literal and captures size instead of the 
> the whole block_literal as highlighted above). We can also potentially avoid 
> reloading of the captures in the enqueued kernel though the capture 
> flattening, but this depends on the calling convention (or rather enqueueing 
> convension I would say).

It seems that the flattening approach leave little space for the 
implementation, which violate the generic property of llvm. Also, although 
cap_copy_helper looks helpful, I think there is little chance for one to copy 
individual captured variables - copy the entire block_literal is sufficient. Of 
course, we can reduce block_literal size by removing redundant fields for the 
sake of optimization but that's another discussion topic I think.

I would like to remove this code review. 
@Anastasia thanks for your patient discussing with newbie llvm/clang developer 
like me :)


https://reviews.llvm.org/D24715



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


[PATCH] D25292: [coroutines] Add diagnostics for copy/move assignment operators and functions with deduced return types.

2016-10-05 Thread David Majnemer via cfe-commits
majnemer added inline comments.


> SemaCoroutine.cpp:140
> +  // or the function 'main' are declared as a coroutine.
> +  CXXMethodDecl *MD = dyn_cast(FD);
> +  if (MD && isa(MD))

`auto *`

https://reviews.llvm.org/D25292



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


[PATCH] D25267: cmake: Set CMAKE_INSTALL_RPATH in Clang when building separately from LLVM

2016-10-05 Thread Chris Bieneman via cfe-commits
beanz added a comment.

This is actually not the right fix here. We should actually fix this in LLVM to 
setup the rpath correctly on the targets during llvm_add_executable, then we 
can remove this hack from LLVM instead of copying it to Clang. It might also 
let us fix the RPATH goop in other tools too.


https://reviews.llvm.org/D25267



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


Re: Buildbot numbers for the week of 9/25/2016 - 10/1/2016

2016-10-05 Thread Aaron Ballman via cfe-commits
On Wed, Oct 5, 2016 at 7:40 PM, Galina Kistanova via cfe-commits
 wrote:
> Hello everyone,
>
> Below are some buildbot numbers for the last week of 9/25/2016 - 10/1/2016.
>
> Please see the same data in attached csv files:

Can we please fix the clang-tools-sphinx-docs builder or take it
offline entirely? It has never been green (to the best of my
knowledge). I know some folks have tried fixing it before, but it
seems to have not worked out.

http://lab.llvm.org:8011/builders/clang-tools-sphinx-docs/builds/624/steps/docs-clang-tools-html/logs/stdio

The builder continually fails with "ninja: error: unknown target
'docs-clang-tools-html'".

~Aaron

>
> 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
> +---
>  clang-cmake-mipsel | 113:03:59
>  clang-cmake-mips   | 89:43:33
>  libomp-ompt-clang-x86_64-linux-debian  | 72:01:30
>  sanitizer-x86_64-linux | 69:51:49
>  clang-cmake-aarch64-quick  | 50:18:34
>  clang-x86-windows-msvc2015 | 50:07:13
>  lldb-x86_64-ubuntu-14.04-cmake | 35:07:56
>  clang-ppc64le-linux-multistage | 26:40:23
>  clang-sphinx-docs  | 16:57:01
>  lldb-windows7-android  | 15:52:05
>  sanitizer-ppc64be-linux| 15:05:26
>  sanitizer-ppc64le-linux| 13:56:02
>  clang-x86-win2008-selfhost | 13:55:23
>  lldb-x86_64-darwin-13.4| 13:21:14
>  lldb-x86_64-ubuntu-14.04-android   | 12:34:33
>  clang-x64-ninja-win7   | 11:24:55
>  sanitizer-windows  | 11:01:58
>  lld-x86_64-win7| 11:00:28
>  llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast   | 10:44:15
>  clang-cmake-thumbv7-a15-full-sh| 09:54:20
>  clang-cmake-armv7-a15-selfhost-neon| 07:15:43
>  libcxx-libcxxabi-libunwind-arm-linux   | 06:41:17
>  sanitizer-x86_64-linux-autoconf| 06:39:25
>  clang-cmake-thumbv7-a15| 06:30:16
>  clang-cmake-armv7-a15  | 06:30:16
>  clang-cmake-armv7-a15-full | 06:26:04
>  clang-cmake-aarch64-full   | 06:15:53
>  clang-cmake-armv7-a15-selfhost | 06:11:34
>  libcxx-libcxxabi-libunwind-arm-linux-noexceptions  | 04:02:06
>  clang-with-lto-ubuntu  | 03:46:36
>  llvm-sphinx-docs   | 03:34:07
>  sanitizer-x86_64-linux-bootstrap   | 03:03:14
>  llvm-mips-linux| 02:42:20
>  clang-ppc64be-linux| 02:41:21
>  clang-hexagon-elf  | 02:40:45
>  clang-s390x-linux  | 02:38:57
>  clang-ppc64be-linux-multistage | 02:31:40
>  clang-ppc64be-linux-lnt| 02:29:47
>  clang-ppc64le-linux-lnt| 02:24:52
>  clang-ppc64le-linux| 02:20:39
>  clang-native-arm-lnt   | 02:19:37
>  clang-cmake-aarch64-42vma  | 02:11:32
>  lld-x86_64-darwin13| 02:10:32
>  sanitizer-x86_64-linux-fast| 02:09:59
>  clang-x86_64-linux-selfhost-modules| 01:59:26
>  libcxx-libcxxabi-x86_64-linux-ubuntu-tsan  | 01:47:24
>  libcxx-libcxxabi-singlethreaded-x86_64-linux-debian| 01:40:28
>  libcxx-libcxxabi-x86_64-linux-ubuntu-msan  | 01:36:45
>  clang-x86_64-debian-fast   | 01:33:12
>  clang-cuda-build  

Buildbot numbers for the week of 9/25/2016 - 10/1/2016

2016-10-05 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the last week of 9/25/2016 - 10/1/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
+---
 clang-cmake-mipsel | 113:03:59
 clang-cmake-mips   | 89:43:33
 libomp-ompt-clang-x86_64-linux-debian  | 72:01:30
 sanitizer-x86_64-linux | 69:51:49
 clang-cmake-aarch64-quick  | 50:18:34
 clang-x86-windows-msvc2015 | 50:07:13
 lldb-x86_64-ubuntu-14.04-cmake | 35:07:56
 clang-ppc64le-linux-multistage | 26:40:23
 clang-sphinx-docs  | 16:57:01
 lldb-windows7-android  | 15:52:05
 sanitizer-ppc64be-linux| 15:05:26
 sanitizer-ppc64le-linux| 13:56:02
 clang-x86-win2008-selfhost | 13:55:23
 lldb-x86_64-darwin-13.4| 13:21:14
 lldb-x86_64-ubuntu-14.04-android   | 12:34:33
 clang-x64-ninja-win7   | 11:24:55
 sanitizer-windows  | 11:01:58
 lld-x86_64-win7| 11:00:28
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast   | 10:44:15
 clang-cmake-thumbv7-a15-full-sh| 09:54:20
 clang-cmake-armv7-a15-selfhost-neon| 07:15:43
 libcxx-libcxxabi-libunwind-arm-linux   | 06:41:17
 sanitizer-x86_64-linux-autoconf| 06:39:25
 clang-cmake-thumbv7-a15| 06:30:16
 clang-cmake-armv7-a15  | 06:30:16
 clang-cmake-armv7-a15-full | 06:26:04
 clang-cmake-aarch64-full   | 06:15:53
 clang-cmake-armv7-a15-selfhost | 06:11:34
 libcxx-libcxxabi-libunwind-arm-linux-noexceptions  | 04:02:06
 clang-with-lto-ubuntu  | 03:46:36
 llvm-sphinx-docs   | 03:34:07
 sanitizer-x86_64-linux-bootstrap   | 03:03:14
 llvm-mips-linux| 02:42:20
 clang-ppc64be-linux| 02:41:21
 clang-hexagon-elf  | 02:40:45
 clang-s390x-linux  | 02:38:57
 clang-ppc64be-linux-multistage | 02:31:40
 clang-ppc64be-linux-lnt| 02:29:47
 clang-ppc64le-linux-lnt| 02:24:52
 clang-ppc64le-linux| 02:20:39
 clang-native-arm-lnt   | 02:19:37
 clang-cmake-aarch64-42vma  | 02:11:32
 lld-x86_64-darwin13| 02:10:32
 sanitizer-x86_64-linux-fast| 02:09:59
 clang-x86_64-linux-selfhost-modules| 01:59:26
 libcxx-libcxxabi-x86_64-linux-ubuntu-tsan  | 01:47:24
 libcxx-libcxxabi-singlethreaded-x86_64-linux-debian| 01:40:28
 libcxx-libcxxabi-x86_64-linux-ubuntu-msan  | 01:36:45
 clang-x86_64-debian-fast   | 01:33:12
 clang-cuda-build   | 01:31:56
 clang-bpf-build| 01:30:18
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast | 01:29:27
 perf-x86_64-penryn-O3-polly-unprofitable   | 01:21:23
 lldb-x86_64-ubuntu-14.04-buildserver   | 01:11:42
 clang-3stage-ubuntu| 01:08:59
 llvm-hexagon-elf   | 00:58:01
 lld-x86_64-freebsd | 00:55:20
 sanitizer-x86_64-linux-fuzzer  | 00:49:46
 clang-atom-d525-fedora-rel | 00:49:37
 

[PATCH] D390: add __attribute__ no_uninitialized_checks. Map no_uninitialized_checks/no_thread_safety_analysis to LLVM function attributes.

2016-10-05 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a comment.
This revision now requires review to proceed.

Looks like patch was not committed.


https://reviews.llvm.org/D390



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


[PATCH] D25292: [Coroutines] Add diagnostics for copy/move assignment operators and functions with deduced return types.

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

Diagnose a coroutine `main` function in the same way as other invalid contexts.


https://reviews.llvm.org/D25292

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaCoroutine.cpp
  test/SemaCXX/coroutines.cpp

Index: test/SemaCXX/coroutines.cpp
===
--- test/SemaCXX/coroutines.cpp
+++ test/SemaCXX/coroutines.cpp
@@ -167,7 +167,19 @@
   }
   // FIXME: The spec says this is ill-formed.
   void operator=(CtorDtor&) {
-co_yield 0;
+co_yield 0; // expected-error {{'co_yield' cannot be used in a copy assignment operator}}
+  }
+  void operator=(CtorDtor const &) {
+co_yield 0; // expected-error {{'co_yield' cannot be used in a copy assignment operator}}
+  }
+  void operator=(CtorDtor &&) {
+co_await a; // expected-error {{'co_await' cannot be used in a move assignment operator}}
+  }
+  void operator=(CtorDtor const &&) {
+co_await a; // expected-error {{'co_await' cannot be used in a move assignment operator}}
+  }
+  void operator=(int) {
+co_await a; // OK. Not a special member
   }
 };
 
@@ -180,14 +192,19 @@
   typeid(co_yield a); // expected-error {{cannot be used in an unevaluated context}}
 }
 
-constexpr void constexpr_coroutine() {
+constexpr auto constexpr_deduced_return_coroutine() {
   co_yield 0; // expected-error {{'co_yield' cannot be used in a constexpr function}}
+  // expected-error@-1 {{'co_yield' cannot be used in a function with a deduced return type}}
 }
 
 void varargs_coroutine(const char *, ...) {
   co_await a; // expected-error {{'co_await' cannot be used in a varargs function}}
 }
 
+auto deduced_return_coroutine() {
+  co_await a; // expected-error {{'co_await' cannot be used in a function with a deduced return type}}
+}
+
 struct outer {};
 
 namespace dependent_operator_co_await_lookup {
@@ -303,6 +320,6 @@
 template<> struct std::experimental::coroutine_traits
 { using promise_type = promise; };
 
-int main(int, const char**) { // expected-error {{'main' cannot be a coroutine}}
-  co_await a; // expected-note {{function is a coroutine due to use of 'co_await' here}}
+int main(int, const char**) {
+  co_await a; // expected-error {{'co_await' cannot be used in the 'main' function}}
 }
Index: lib/Sema/SemaCoroutine.cpp
===
--- lib/Sema/SemaCoroutine.cpp
+++ lib/Sema/SemaCoroutine.cpp
@@ -99,67 +99,98 @@
   return PromiseType;
 }
 
-/// Check that this is a context in which a coroutine suspension can appear.
-static FunctionScopeInfo *
-checkCoroutineContext(Sema , SourceLocation Loc, StringRef Keyword) {
+static bool isValidCoroutineContext(Sema , SourceLocation Loc,
+StringRef Keyword) {
   // 'co_await' and 'co_yield' are not permitted in unevaluated operands.
   if (S.isUnevaluatedContext()) {
 S.Diag(Loc, diag::err_coroutine_unevaluated_context) << Keyword;
-return nullptr;
+return false;
   }
 
   // Any other usage must be within a function.
-  // FIXME: Reject a coroutine with a deduced return type.
   auto *FD = dyn_cast(S.CurContext);
   if (!FD) {
 S.Diag(Loc, isa(S.CurContext)
 ? diag::err_coroutine_objc_method
 : diag::err_coroutine_outside_function) << Keyword;
-  } else if (isa(FD) || isa(FD)) {
-// Coroutines TS [special]/6:
-//   A special member function shall not be a coroutine.
-//
-// FIXME: We assume that this really means that a coroutine cannot
-//be a constructor or destructor.
-S.Diag(Loc, diag::err_coroutine_ctor_dtor)
-  << isa(FD) << Keyword;
-  } else if (FD->isConstexpr()) {
-S.Diag(Loc, diag::err_coroutine_constexpr) << Keyword;
-  } else if (FD->isVariadic()) {
-S.Diag(Loc, diag::err_coroutine_varargs) << Keyword;
-  } else if (FD->isMain()) {
-S.Diag(FD->getLocStart(), diag::err_coroutine_main);
-S.Diag(Loc, diag::note_declared_coroutine_here)
-  << (Keyword == "co_await" ? 0 :
-  Keyword == "co_yield" ? 1 : 2);
-  } else {
-auto *ScopeInfo = S.getCurFunction();
-assert(ScopeInfo && "missing function scope for function");
-
-// If we don't have a promise variable, build one now.
-if (!ScopeInfo->CoroutinePromise) {
-  QualType T =
-  FD->getType()->isDependentType()
-  ? S.Context.DependentTy
-  : lookupPromiseType(S, FD->getType()->castAs(),
-  Loc);
-  if (T.isNull())
-return nullptr;
-
-  // Create and default-initialize the promise.
-  ScopeInfo->CoroutinePromise =
-  VarDecl::Create(S.Context, FD, FD->getLocation(), FD->getLocation(),
-  ().get("__promise"), T,
-  S.Context.getTrivialTypeSourceInfo(T, Loc), SC_None);
-  

[libcxx] r283408 - Fix strict-aliasing violation in typeinfo::hash_code()

2016-10-05 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Oct  5 17:55:10 2016
New Revision: 283408

URL: http://llvm.org/viewvc/llvm-project?rev=283408=rev
Log:
Fix strict-aliasing violation in typeinfo::hash_code()

Summary:
The current implementation of `hash_code()` for uniqued RTTI strings violates 
strict aliasing by dereferencing a type-punned pointer. Specifically it 
generates a `const char**` pointer from the address of the `__name` member 
before casting it to `const size_t*` and dereferencing it to get the hash. This 
is really just a complex and incorrect way of writing 
`reinterpret_cast(__name)`.

This patch changes the conversion sequence so that it no longer contains UB.


Reviewers: howard.hinnant, mclow.lists

Subscribers: rjmccall, cfe-commits

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

Modified:
libcxx/trunk/include/__config
libcxx/trunk/include/typeinfo

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=283408=283407=283408=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Wed Oct  5 17:55:10 2016
@@ -694,12 +694,6 @@ template  struct __static_asse
 #define _NOALIAS
 #endif
 
-#ifdef __GNUC__
-#define _LIBCPP_MAY_ALIAS __attribute__((__may_alias__))
-#else
-#define _LIBCPP_MAY_ALIAS
-#endif
-
 #if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__)
 #   define _LIBCPP_EXPLICIT explicit
 #else

Modified: libcxx/trunk/include/typeinfo
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/typeinfo?rev=283408=283407=283408=diff
==
--- libcxx/trunk/include/typeinfo (original)
+++ libcxx/trunk/include/typeinfo Wed Oct  5 17:55:10 2016
@@ -77,8 +77,6 @@ class _LIBCPP_EXCEPTION_ABI type_info
 type_info& operator=(const type_info&);
 type_info(const type_info&);
 
-typedef size_t _LIBCPP_MAY_ALIAS _ASizeT; // Avoid strict-aliasing issues.
-
 protected:
 #ifndef _LIBCPP_NONUNIQUE_RTTI_BIT
 const char* __type_name;
@@ -119,7 +117,7 @@ public:
 _LIBCPP_INLINE_VISIBILITY
 size_t hash_code() const _NOEXCEPT
 #ifndef _LIBCPP_NONUNIQUE_RTTI_BIT
-{return *reinterpret_cast(&__type_name);}
+{return reinterpret_cast(__type_name);}
 #else
 {if (!(__type_name & _LIBCPP_NONUNIQUE_RTTI_BIT)) return __type_name;
  const char *__ptr = name();


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


[PATCH] D25153: preprocessor supports `-dI` flag

2016-10-05 Thread David Majnemer via cfe-commits
majnemer added inline comments.


> PrintPreprocessedOutput.cpp:331-349
> +  const size_t N = Path.size();
> +  size_t I = 0;
> +  while (I < N) {
> +if (Path[I] == '\\' || Path[I] == '\"') {
> +  // Have to escape backslashes or double-quotes.
> +  // Send out backslash to escape the next char.
> +  Buffer.push_back('\\');

I think this loop would be easier to understand like so:

  while (!Path.empty()) {
if (Path.consume_front("\\")) {
  Buffer.push_back("");
} else if (Path.consume_front("\"")) {
  Buffer.push_back("\\\"");
} else if (Path.consume_front("*/")) {
  Buffer.push_back("*\\/");
} else {
  Buffer.push_back(Path.front());
  Path = Path.drop_front();
}
  }

The big takeaway is that we now avoid messy `I + 1 < N` type checks.

https://reviews.llvm.org/D25153



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


r283406 - PR22924, PR22845, some of CWG1464: When checking the initializer for an array

2016-10-05 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Oct  5 17:41:02 2016
New Revision: 283406

URL: http://llvm.org/viewvc/llvm-project?rev=283406=rev
Log:
PR22924, PR22845, some of CWG1464: When checking the initializer for an array
new expression, distinguish between the case of a constant and non-constant
initializer. In the former case, if the bound is erroneous (too many
initializer elements, bound is negative, or allocated size overflows), reject,
and take the bound into account when determining whether we need to
default-construct any elements. In the remanining cases, move the logic to
check for default-constructibility of trailing elements into the initialization
code rather than inventing a bogus array bound, to cope with cases where the
number of initialized elements is not the same as the number of initializer
list elements (this can happen due to string literal initialization or brace
elision).

This also fixes rejects-valid and crash-on-valid errors when initializing a
new'd array of character type from a braced string literal.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticGroups.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Sema/Initialization.h
cfe/trunk/lib/CodeGen/CGExprCXX.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/test/Analysis/cfg.cpp
cfe/trunk/test/CodeGenCXX/new-array-init.cpp
cfe/trunk/test/SemaCXX/new-delete-cxx0x.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=283406=283405=283406=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Wed Oct  5 17:41:02 2016
@@ -62,7 +62,6 @@ def NullConversion : DiagGroup<"null-con
 def ImplicitConversionFloatingPointToBool :
   DiagGroup<"implicit-conversion-floating-point-to-bool">;
 def ObjCLiteralConversion : DiagGroup<"objc-literal-conversion">;
-def BadArrayNewLength : DiagGroup<"bad-array-new-length">;
 def MacroRedefined : DiagGroup<"macro-redefined">;
 def BuiltinMacroRedefined : DiagGroup<"builtin-macro-redefined">;
 def BuiltinRequiresHeader : DiagGroup<"builtin-requires-header">;

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=283406=283405=283406=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Oct  5 17:41:02 
2016
@@ -1745,8 +1745,10 @@ def warn_uninit_byref_blockvar_captured_
 def note_block_var_fixit_add_initialization : Note<
   "did you mean to use __block %0?">;
 def note_in_omitted_aggregate_initializer : Note<
-  "in implicit initialization of %select{array element %1|field %1}0 "
-  "with omitted initializer">;
+  "in implicit initialization of %select{"
+  "array element %1 with omitted initializer|"
+  "field %1 with omitted initializer|"
+  "trailing array elements in runtime-sized array new}0">;
 def note_in_reference_temporary_list_initializer : Note<
   "in initialization of temporary of type %0 created to "
   "list-initialize this reference">;
@@ -4556,9 +4558,6 @@ def err_vm_func_decl : Error<
   "function declaration cannot have variably modified type">;
 def err_array_too_large : Error<
   "array is too large (%0 elements)">;
-def warn_array_new_too_large : Warning<"array is too large (%0 elements)">,
-  // FIXME PR11644: ", will throw std::bad_array_new_length at runtime"
-  InGroup;
 
 // -Wpadded, -Wpacked
 def warn_padded_struct_field : Warning<
@@ -4576,9 +4575,6 @@ def warn_unnecessary_packed : Warning<
   "packed attribute is unnecessary for %0">, InGroup, DefaultIgnore;
 
 def err_typecheck_negative_array_size : Error<"array size is negative">;
-def warn_typecheck_negative_array_new_size : Warning<"array size is negative">,
-  // FIXME PR11644: ", will throw std::bad_array_new_length at runtime"
-  InGroup;
 def warn_typecheck_function_qualifiers_ignored : Warning<
   "'%0' qualifier on function type %1 has no effect">,
   InGroup;

Modified: cfe/trunk/include/clang/Sema/Initialization.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Initialization.h?rev=283406=283405=283406=diff
==
--- cfe/trunk/include/clang/Sema/Initialization.h (original)
+++ cfe/trunk/include/clang/Sema/Initialization.h Wed Oct  5 17:41:02 2016
@@ -395,6 +395,12 @@ public:
 return Base & 0x1;
   }
 
+  /// \brief Determine whether this is an array new with an unknown bound.
+  bool isVariableLengthArrayNew() const {
+return getKind() == EK_New && dyn_cast_or_null(
+  

[PATCH] D24012: Fix strict-aliasing violation in typeinfo::hash_code()

2016-10-05 Thread Marshall Clow via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a comment.
This revision is now accepted and ready to land.

LGTM.


https://reviews.llvm.org/D24012



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


[PATCH] D25225: Add an option to save the backend-produced YAML optimization record to a file

2016-10-05 Thread Hal Finkel via cfe-commits
hfinkel added a comment.

@rsmith  @rjmccall - I chatted with @anemet about this on IRC, and he's happy 
with it. Please look this over, in part to make sure you're happy with the 
option name.

On the name, two of my thoughts behind using -fsave-optimization-record were: 
1) I did not want to call it a "report", because it is YAML output and not 
something for a human to use directly and 2) I thought that record, the noun, 
fit well, but not necessarily the verb, and by putting 'save' in the name it 
seems clear (at least to me) that record is the noun.


https://reviews.llvm.org/D25225



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


[PATCH] D24562: [libcxx] Recover no-exceptions XFAILs

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

In https://reviews.llvm.org/D24562#562339, @rmaprath wrote:

> First batch of XFAIL fixes.
>
> I've changed some XFAILs to UNSUPPORTED where the test is all about exception 
> handling. In other cases, I've used the test macro TEST_HAS_NO_EXCEPTIONS to 
> conditionally exclude those parts that test
>  exception handling behaviour.


The changes look great! Thanks for the patch.

The only suggestion I have is using `TEST_THROW` to guard a single throw 
statement. `TEST_THROW` will abort if it's executed in a no-exceptions build, 
which is better than silently passing over code that should throw. See the 
inline comments for example usage.

> @EricWF: I can create a separate review if necessary, thought I'll re-use 
> this review for the first batch, will be opening new reviews for the 
> follow-ups.

Sounds good to me. This batch LGTM but I can't re-approve this review. Please 
commit w/ requested inline changes and then close this revision.

> / Asiri





> async.pass.cpp:76
>  std::this_thread::sleep_for(ms(200));
>  throw j;
> +#endif

To guard a single `throw x;` consider using `TEST_THROW(x)`. This way the test 
will abort ungracefully if it tries to evaluate a `throw` at runtime.

> move_ctor.pass.cpp:23
>  #include "test_allocator.h"
> +#include "test_macros.h"
>  

Nit: I prefer including `test_macros.h` as the first support header.

> set_value_const.pass.cpp:28
> +A(const A&) {
> +#ifndef TEST_HAS_NO_EXCEPTIONS
> +throw 10;

Nit: Use `TEST_THROW`

> F.pass.cpp:36
>  if (throw_one == 0)
>  throw std::bad_alloc();
>  --throw_one;

Nit: `TEST_THROW`

https://reviews.llvm.org/D24562



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


[PATCH] D545: Allow to use -fsanitize=address for iOS simulator

2016-10-05 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko closed this revision.
Eugene.Zelenko added a comment.

Committed in https://reviews.llvm.org/rL177633.


https://reviews.llvm.org/D545



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


[PATCH] D25292: [Coroutines] Add diagnostics for copy/move assignment operators and functions with deduced return types.

2016-10-05 Thread Eric Fiselier via cfe-commits
EricWF created this revision.
EricWF added reviewers: rsmith, GorNishanov.
EricWF added a subscriber: cfe-commits.
Herald added a subscriber: mehdi_amini.

The title says it all. Additionally this patch refactors the diagnostic code 
into a separate function.


https://reviews.llvm.org/D25292

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaCoroutine.cpp
  test/SemaCXX/coroutines.cpp

Index: test/SemaCXX/coroutines.cpp
===
--- test/SemaCXX/coroutines.cpp
+++ test/SemaCXX/coroutines.cpp
@@ -167,7 +167,19 @@
   }
   // FIXME: The spec says this is ill-formed.
   void operator=(CtorDtor&) {
-co_yield 0;
+co_yield 0; // expected-error {{'co_yield' cannot be used in a copy assignment operator}}
+  }
+  void operator=(CtorDtor const &) {
+co_yield 0; // expected-error {{'co_yield' cannot be used in a copy assignment operator}}
+  }
+  void operator=(CtorDtor &&) {
+co_await a; // expected-error {{'co_await' cannot be used in a move assignment operator}}
+  }
+  void operator=(CtorDtor const &&) {
+co_await a; // expected-error {{'co_await' cannot be used in a move assignment operator}}
+  }
+  void operator=(int) {
+co_await a; // OK. Not a special member
   }
 };
 
@@ -180,14 +192,19 @@
   typeid(co_yield a); // expected-error {{cannot be used in an unevaluated context}}
 }
 
-constexpr void constexpr_coroutine() {
+constexpr auto constexpr_deduced_return_coroutine() {
   co_yield 0; // expected-error {{'co_yield' cannot be used in a constexpr function}}
+  // expected-error@-1 {{'co_yield' cannot be used in a function with a deduced return type}}
 }
 
 void varargs_coroutine(const char *, ...) {
   co_await a; // expected-error {{'co_await' cannot be used in a varargs function}}
 }
 
+auto deduced_return_coroutine() {
+  co_await a; // expected-error {{'co_await' cannot be used in a function with a deduced return type}}
+}
+
 struct outer {};
 
 namespace dependent_operator_co_await_lookup {
Index: lib/Sema/SemaCoroutine.cpp
===
--- lib/Sema/SemaCoroutine.cpp
+++ lib/Sema/SemaCoroutine.cpp
@@ -99,67 +99,102 @@
   return PromiseType;
 }
 
-/// Check that this is a context in which a coroutine suspension can appear.
-static FunctionScopeInfo *
-checkCoroutineContext(Sema , SourceLocation Loc, StringRef Keyword) {
+static bool isValidCoroutineContext(Sema , SourceLocation Loc,
+StringRef Keyword) {
   // 'co_await' and 'co_yield' are not permitted in unevaluated operands.
   if (S.isUnevaluatedContext()) {
 S.Diag(Loc, diag::err_coroutine_unevaluated_context) << Keyword;
-return nullptr;
+return false;
   }
 
   // Any other usage must be within a function.
-  // FIXME: Reject a coroutine with a deduced return type.
   auto *FD = dyn_cast(S.CurContext);
   if (!FD) {
 S.Diag(Loc, isa(S.CurContext)
 ? diag::err_coroutine_objc_method
 : diag::err_coroutine_outside_function) << Keyword;
-  } else if (isa(FD) || isa(FD)) {
-// Coroutines TS [special]/6:
-//   A special member function shall not be a coroutine.
-//
-// FIXME: We assume that this really means that a coroutine cannot
-//be a constructor or destructor.
-S.Diag(Loc, diag::err_coroutine_ctor_dtor)
-  << isa(FD) << Keyword;
-  } else if (FD->isConstexpr()) {
-S.Diag(Loc, diag::err_coroutine_constexpr) << Keyword;
-  } else if (FD->isVariadic()) {
-S.Diag(Loc, diag::err_coroutine_varargs) << Keyword;
-  } else if (FD->isMain()) {
-S.Diag(FD->getLocStart(), diag::err_coroutine_main);
-S.Diag(Loc, diag::note_declared_coroutine_here)
-  << (Keyword == "co_await" ? 0 :
-  Keyword == "co_yield" ? 1 : 2);
-  } else {
-auto *ScopeInfo = S.getCurFunction();
-assert(ScopeInfo && "missing function scope for function");
-
-// If we don't have a promise variable, build one now.
-if (!ScopeInfo->CoroutinePromise) {
-  QualType T =
-  FD->getType()->isDependentType()
-  ? S.Context.DependentTy
-  : lookupPromiseType(S, FD->getType()->castAs(),
-  Loc);
-  if (T.isNull())
-return nullptr;
-
-  // Create and default-initialize the promise.
-  ScopeInfo->CoroutinePromise =
-  VarDecl::Create(S.Context, FD, FD->getLocation(), FD->getLocation(),
-  ().get("__promise"), T,
-  S.Context.getTrivialTypeSourceInfo(T, Loc), SC_None);
-  S.CheckVariableDeclarationType(ScopeInfo->CoroutinePromise);
-  if (!ScopeInfo->CoroutinePromise->isInvalidDecl())
-S.ActOnUninitializedDecl(ScopeInfo->CoroutinePromise, false);
-}
-
-return ScopeInfo;
+return false;
+  }
+
+  // An enumeration for mapping the diagnostic type to the correct diagnostic
+  // selection index.
+  enum 

[PATCH] D25063: [x86][inline-asm][AVX512][clang][PART-1] Introducing "k" and "Yk" constraints for extended inline assembly, enabling use of AVX512 masked vectorized instructions.

2016-10-05 Thread Reid Kleckner via cfe-commits
rnk added inline comments.


> avx512-mask-op-inline_asm_specific.c:1
> +// RUN: %clang_cc1 %s -target-cpu skylake-avx512 -O0  -S -o - -Wall -Werror 
> | FileCheck %s
> +// This test checks validity of inline assembly for avx512 supported 
> constraint k and Yk along with the required 

Please check the generated LLVM IR, not the assembly.

Repository:
  rL LLVM

https://reviews.llvm.org/D25063



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


[PATCH] D25062: [x86][inline-asm][AVX512][llvm][PART-2] Introducing "k" and "Yk" constraints for extended inline assembly, enabling use of AVX512 masked vectorized instructions.

2016-10-05 Thread Reid Kleckner via cfe-commits
rnk added a comment.

Looks good functionally with some surface level nits



> X86ISelLowering.cpp:31979
>break;
>  }
>}

Let's check size 2 after size 1, it seems more logical, and is 1 is probably 
the common case.

> X86ISelLowering.cpp:32025
>case 'Y':
> +// Impliment Y (two letters variant) constraints handle here.
> +if (constraint[1] == 'k') {

Typo on "Impliment". Also the comment could be reworded.

> X86ISelLowering.cpp:32321
> +//  Only supported in AVX512 or later.
> +if (VT == MVT::i32)
> +  return std::make_pair(0U, ::VK32RegClass);

Seems like a good place to use a switch on VT

> X86ISelLowering.cpp:32429
> +case 'k':
> +  // This regiter class doesn't allocate k0 for masked vector operation.
> +  if (Subtarget.hasAVX512()) { // Only supported in AVX512.

"register"

> X86ISelLowering.cpp:32431
> +  if (Subtarget.hasAVX512()) { // Only supported in AVX512.
> +if (VT == MVT::i32)
> +  return std::make_pair(0U, ::VK32WMRegClass);

Maybe do a switch?

Repository:
  rL LLVM

https://reviews.llvm.org/D25062



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


[PATCH] D25264: Implement MS _BitScan intrinsics

2016-10-05 Thread David Majnemer via cfe-commits
majnemer added inline comments.


> agutowski wrote in CGBuiltin.cpp:2665
> Is this line needed? I took it from __builtin_fpclassify, but I don't know 
> what could be its purpose (it's repeated below, where the "bitscan_end" block 
> really starts).

It's needed for the call to CreatePHI to be in the correct basic block.

https://reviews.llvm.org/D25264



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


[PATCH] D25171: clang-format: Add two new formatting options

2016-10-05 Thread Robin Sommer via cfe-commits
rsmmr added a comment.

Well, last time I counted it was more like 100 contributors---Bro existed 
before GitHub (and before git). The style-guide is lacking, yes ... what can I 
say.

I don't really want to argue about importance of the project. We would like to 
use clang-format here and elsewhere, and I'd think these options could be 
useful to others as well, so I created a patch and submitted. If you guys don't 
like it, your call.


https://reviews.llvm.org/D25171



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


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

2016-10-05 Thread Richard Smith via cfe-commits
rsmith added a comment.

This looks like it's going in the right direction.



> Decl.cpp:2269-2272
> +  // If we have hit a point where the user provided a specialization of
> +  // this template, we're done looking.
> +  if (VarTemplate->isMemberSpecialization())
> +break;

I think we need a similar check in the static data member case above.

> Decl.cpp:2278
> +!isTemplateInstantiation(getTemplateSpecializationKind())) &&
> +   "couldn't find pattern for enum instantiation");
> +

enum?

> rsmith wrote in SemaTemplate.cpp:509
> `else if` doesn't make sense here -- we either need to produce a diagnostic 
> on all paths through here, or suppress the notes if we didn't produce a 
> diagnostic.

This function still appears to be able to return true (indicating to the caller 
that a diagnostic was produced) without actually producing a diagnostic.

> ASTWriterDecl.cpp:896-897
>Record.push_back(D->getInitStyle());
> +  Record.push_back(D->isThisDeclarationADemotedDefinition());
>if (!isa(D)) {
>  Record.push_back(D->isExceptionVariable());

Sink this flag into the "not for `ParmVarDecl`" block below.

> ASTWriterDecl.cpp:1965
> +  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // TSCSpec
> +  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // InitStyle
> +  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // 
> IsThisDeclarationADemotedDefinition

Hmm. The width of the `InitStyle` field is definitely wrong right now, but 
should be fixed separately from this change. It looks like we don't hit this 
today because we don't use this abbreviation for a variable with an 
initializer. In addition to fixing the width of this field, we should also 
remove the `getInit() == nullptr` check when selecting the abbreviation in 
`ASTDeclWriter::VisitVarDecl`.

https://reviews.llvm.org/D24508



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


[PATCH] D25171: clang-format: Add two new formatting options

2016-10-05 Thread Daniel Jasper via cfe-commits
djasper added a comment.

It's not about whether or not we like the patch. It's whether adding these 
options is a good trade-off for clang-format overall. If we find that actually 
more people would find these styles desirable, we can reconsider.

I have left some comments anyway in case you want to keep the patch around.



> Format.h:603
>  
> +  /// \brief If ``true``, spaces will be inserted around if/for/while 
> conditions.
> +  bool SpacesAroundConditions;

It's actually more than if/for/while.

> Format.cpp:355
>  IO.mapOptional("SpacesInSquareBrackets", Style.SpacesInSquareBrackets);
> +IO.mapOptional("SpacesAfterNot",
> +   Style.SpacesAfterNot);

Unnecessary linebreaks.

> TokenAnnotator.cpp:1989
> +if (Left.is(tok::l_paren) && Left.Previous &&
> +  Left.Previous->isOneOf(tok::kw_if, tok::pp_elif, tok::kw_for, 
> tok::kw_while,
> + tok::kw_switch, TT_ForEachMacro))

Indent is off.

> TokenAnnotator.cpp:1989-1990
> +if (Left.is(tok::l_paren) && Left.Previous &&
> +  Left.Previous->isOneOf(tok::kw_if, tok::pp_elif, tok::kw_for, 
> tok::kw_while,
> + tok::kw_switch, TT_ForEachMacro))
> +return true;

This should go into a helper function or lambda so that it can be reused. What 
about catch? Also some of these aren't tested, e.g. the preprocessor ones.

> TokenAnnotator.cpp:1993
> +if (Right.is(tok::r_paren) && Right.MatchingParen && 
> Right.MatchingParen->Previous &&
> +  Right.MatchingParen->Previous->isOneOf(tok::kw_if, tok::pp_elif, 
> tok::kw_for, tok::kw_while,
> + tok::kw_switch, 
> TT_ForEachMacro))

Indent is off.

> TokenAnnotator.cpp:2232
>}
> + if (Style.SpacesAfterNot && Left.is(tok::exclaim))
> +return true;

Note that at least JavaScript/TypeScript has a ! postfix operator, i.e. unary 
operator that applies to the token before it. You definitely don't want to 
always add a space after that.

> TokenAnnotator.cpp:2233
> + if (Style.SpacesAfterNot && Left.is(tok::exclaim))
> +return true;
>if (Left.is(TT_UnaryOperator))

Indent is off.

> TokenAnnotator.cpp:2252
>  return false;
> -  if (Right.is(tok::coloncolon) && !Left.isOneOf(tok::l_brace, tok::comment))
> +  if (Right.is(tok::coloncolon) && !Left.isOneOf(tok::l_brace, tok::comment, 
> tok::l_paren))
>  return (Left.is(TT_TemplateOpener) &&

Is this related in any way? I don't see a test with ::

> FormatTest.cpp:11508
> +  Spaces.SpacesAfterNot = true;
> +  verifyFormat("if (! a)\n  return;", Spaces);
> +  verifyFormat("while (! (x || y))\n  return;", Spaces);

While you have added some test here, I think the more debatable ones are 
actually where there is also a space before the !, e.g.:

  if (a && ! b) ..
return ! c;
  bool x = ! y && z;

The last one is especially tricky, because it makes it less clear that ! binds 
stronger than &&. Might seem obvious in this case, but IIRC, we fought quite a 
few bugs of the form:

  if (! a < b) ..

Until a warning was added in Clang.

https://reviews.llvm.org/D25171



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


[PATCH] D15075: No error for conflict between inputs\outputs and clobber list

2016-10-05 Thread Reid Kleckner via cfe-commits
rnk added a comment.

You should use git-clang-format or some equivalent to format your change.



> TargetInfo.h:597
> +  StringRef getNormalizedGCCRegisterName(StringRef Name,
> +bool ReturnCanonical = false) const;
>  

format

> TargetInfo.h:600
> +  virtual StringRef getConstraintRegister(const StringRef ,
> +const StringRef ) const {
> +return "";

format

> TargetInfo.cpp:405
> +TargetInfo::getNormalizedGCCRegisterName(StringRef Name,
> +bool ReturnCanonical) const {
>assert(isValidGCCRegisterName(Name) && "Invalid register passed in");

format

> SemaStmtAsm.cpp:144
> +StringRef ExtractRegisterName(const Expr *Expression, const TargetInfo 
> ) {
> +  while (const ImplicitCastExpr *P = dyn_cast(Expression)) 
> {
> +Expression = P->getSubExpr();

This is a reimplementation of Expression->IgnoreImpCasts(), use that instead.

> SemaStmtAsm.cpp:153
> +return Target.isValidGCCRegisterName(Attr->getLabel())
> +? Target.getNormalizedGCCRegisterName(Attr->getLabel(), true)
> +: "";

format

> SemaStmtAsm.cpp:185
> +// Go over the output's registers we collected
> +if (InOutVars.find(Clobber) != InOutVars.end()){
> +  SourceLocation Loc = Clobbers[i]->getLocStart();

This can be InOutVars.count(Clobber), which is more idiomatic for testing set 
membership.

https://reviews.llvm.org/D15075



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


[PATCH] D25047: [AST] Add a const version of CallExpr::children() (NFC)

2016-10-05 Thread Vedant Kumar via cfe-commits
vsk abandoned this revision.
vsk added a comment.

I no longer need this functionality.


https://reviews.llvm.org/D25047



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


[PATCH] D834: Private Headers for Modules

2016-10-05 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a comment.
This revision now requires review to proceed.

Committed in https://reviews.llvm.org/rL184471 and 
https://reviews.llvm.org/rL184472.


https://reviews.llvm.org/D834



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


[PATCH] D25171: clang-format: Add two new formatting options

2016-10-05 Thread Daniel Jasper via cfe-commits
djasper added a comment.

Sorry, but that's actually not enough, at least at first sight. With 37 
contributors total, bro is still quite small and only 12 of them have more than 
a handful of commits. And it doesn't have a real style guide. It has: 
https://www.bro.org/development/contribute.html#coding-guidelines, which 
basically says "adapt to the existing code structure" and "We don’t have many 
strict rules".


https://reviews.llvm.org/D25171



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


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

2016-10-05 Thread Vassil Vassilev via cfe-commits
v.g.vassilev updated this revision to Diff 73688.
v.g.vassilev added a comment.

Address some comments and publish current progress.


https://reviews.llvm.org/D24508

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

Index: test/Modules/pr28752.cpp
===
--- /dev/null
+++ test/Modules/pr28752.cpp
@@ -0,0 +1,19 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -std=c++11 -nostdsysteminc -I%S/Inputs/PR28752 -verify %s
+// RUN: %clang_cc1 -std=c++11 -nostdsysteminc -fmodules -fmodule-map-file=%S/Inputs/PR28752/Subdir1/module.modulemap -fmodule-map-file=%S/Inputs/PR28752/module.modulemap -fmodules-cache-path=%t -I%S/Inputs/PR28752 -I%S/Inputs/PR28752/Subdir1 -verify %s
+
+#include "a.h"
+#include "Subdir1/c.h"
+#include 
+
+class TClingClassInfo {
+  std::vector fIterStack;
+};
+
+TClingClassInfo *a;
+class TClingBaseClassInfo {
+  TClingBaseClassInfo() { new TClingClassInfo(*a); }
+};
+
+// expected-no-diagnostics
+
Index: test/Modules/merge-class-definition-visibility.cpp
===
--- test/Modules/merge-class-definition-visibility.cpp
+++ test/Modules/merge-class-definition-visibility.cpp
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t
 // RUN: %clang_cc1 -fmodules -fmodule-map-file=%S/Inputs/merge-class-definition-visibility/modmap \
-// RUN:-I%S/Inputs/merge-class-definition-visibility \
+// RUN:-std=c++1z -I%S/Inputs/merge-class-definition-visibility \
 // RUN:-fmodules-cache-path=%t %s -verify \
 // RUN:-fmodules-local-submodule-visibility
 // expected-no-diagnostics
Index: test/Modules/Inputs/merge-class-definition-visibility/c.h
===
--- test/Modules/Inputs/merge-class-definition-visibility/c.h
+++ test/Modules/Inputs/merge-class-definition-visibility/c.h
@@ -1 +1,3 @@
 struct A;
+
+inline int var_A;
Index: test/Modules/Inputs/merge-class-definition-visibility/a.h
===
--- test/Modules/Inputs/merge-class-definition-visibility/a.h
+++ test/Modules/Inputs/merge-class-definition-visibility/a.h
@@ -1 +1,3 @@
 struct A {};
+
+inline int var_A = 2;
Index: test/Modules/Inputs/PR28752/vector
===
--- /dev/null
+++ test/Modules/Inputs/PR28752/vector
@@ -0,0 +1,28 @@
+#ifndef VECTOR
+#define VECTOR
+template  struct B;
+template  struct B { typedef _Tp type; };
+namespace std {
+template  struct D {
+
+  template  struct F {
+static const bool value = 0;
+  };
+
+  template 
+  typename B::value, _Alloc2>::type _S_select(_Alloc2);
+  template 
+  static
+  typename B::value, _Alloc2>::type _S_select(_Alloc2);
+};
+template 
+template 
+const bool D<_Alloc>::F<_Alloc2>::value;
+
+template  class vector {
+public:
+  vector(int);
+  vector(vector &) : vector(D::_S_select((bool)0)) {}
+};
+}
+#endif // VECTOR
\ No newline at end of file
Index: test/Modules/Inputs/PR28752/module.modulemap
===
--- /dev/null
+++ test/Modules/Inputs/PR28752/module.modulemap
@@ -0,0 +1 @@
+module a { header "a.h" export * }
Index: test/Modules/Inputs/PR28752/a.h
===
--- /dev/null
+++ test/Modules/Inputs/PR28752/a.h
@@ -0,0 +1 @@
+#include 
Index: test/Modules/Inputs/PR28752/Subdir1/module.modulemap
===
--- /dev/null
+++ test/Modules/Inputs/PR28752/Subdir1/module.modulemap
@@ -0,0 +1,5 @@
+module b {
+  module "b.h" { header "b.h" export * }
+  module "c.h" { header "c.h" export * }
+  export *
+}
Index: test/Modules/Inputs/PR28752/Subdir1/b.h
===
--- /dev/null
+++ test/Modules/Inputs/PR28752/Subdir1/b.h
@@ -0,0 +1 @@
+#include 
Index: lib/Serialization/ASTWriterDecl.cpp
===
--- lib/Serialization/ASTWriterDecl.cpp
+++ lib/Serialization/ASTWriterDecl.cpp
@@ -893,6 +893,7 @@
   Record.push_back(D->getStorageClass());
   Record.push_back(D->getTSCSpec());
   Record.push_back(D->getInitStyle());
+  

[PATCH] D25171: clang-format: Add two new formatting options

2016-10-05 Thread Robin Sommer via cfe-commits
rsmmr added a comment.

Sure, I'm aiming to use clang-format on a couple of open-source code bases 
using this style, with the main one being the Bro network security monitor, see 
www.bro.org and github.com/bro/bro (note the stars and forks :-) Bro is also 
featured on GitHub's list of security show cases, 
https://github.com/showcases/security.


https://reviews.llvm.org/D25171



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


[PATCH] D1067: Variable templates w/ partial support for static data members

2016-10-05 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko closed this revision.
Eugene.Zelenko added a comment.

Committed in https://reviews.llvm.org/rL187762.


https://reviews.llvm.org/D1067



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


[PATCH] D1147: FIXME fix: improving diagnostics for template arguments deduction of class templates and explicit specializations

2016-10-05 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko closed this revision.
Eugene.Zelenko added a comment.

Committed in https://reviews.llvm.org/rL186727.


https://reviews.llvm.org/D1147



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


[PATCH] D25264: Implement MS _BitScan intrinsics

2016-10-05 Thread Albert Gutowski via cfe-commits
agutowski added inline comments.


> CGBuiltin.cpp:2665
> +BasicBlock *End = createBasicBlock("bitscan_end", this->CurFn);
> +Builder.SetInsertPoint(End);
> +PHINode *Result = Builder.CreatePHI(ResultType, 2, "bitscan_result");

Is this line needed? I took it from __builtin_fpclassify, but I don't know what 
could be its purpose (it's repeated below, where the "bitscan_end" block really 
starts).

https://reviews.llvm.org/D25264



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


[PATCH] D1391: Bug fix: note diagnosis on expression narrowing...

2016-10-05 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko closed this revision.
Eugene.Zelenko added a comment.

Committed in https://reviews.llvm.org/rL188409.


https://reviews.llvm.org/D1391



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


[PATCH] D25264: Implement MS _BitScan intrinsics

2016-10-05 Thread Albert Gutowski via cfe-commits
agutowski updated this revision to Diff 73685.
agutowski added a comment.

make _BitScan intrinsics compatible with Intel specification when the mask is 
zero


https://reviews.llvm.org/D25264

Files:
  include/clang/Basic/BuiltinsARM.def
  include/clang/Basic/BuiltinsX86.def
  include/clang/Basic/BuiltinsX86_64.def
  lib/Basic/Targets.cpp
  lib/CodeGen/CGBuiltin.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/Headers/intrin.h
  test/CodeGen/ms-intrinsics.c

Index: lib/Headers/intrin.h
===
--- lib/Headers/intrin.h
+++ lib/Headers/intrin.h
@@ -447,20 +447,6 @@
 |* Bit Counting and Testing
 \**/
 static __inline__ unsigned char __DEFAULT_FN_ATTRS
-_BitScanForward(unsigned long *_Index, unsigned long _Mask) {
-  if (!_Mask)
-return 0;
-  *_Index = __builtin_ctzl(_Mask);
-  return 1;
-}
-static __inline__ unsigned char __DEFAULT_FN_ATTRS
-_BitScanReverse(unsigned long *_Index, unsigned long _Mask) {
-  if (!_Mask)
-return 0;
-  *_Index = 31 - __builtin_clzl(_Mask);
-  return 1;
-}
-static __inline__ unsigned char __DEFAULT_FN_ATTRS
 _bittest(long const *_BitBase, long _BitPos) {
   return (*_BitBase >> _BitPos) & 1;
 }
@@ -506,20 +492,6 @@
 #endif
 #ifdef __x86_64__
 static __inline__ unsigned char __DEFAULT_FN_ATTRS
-_BitScanForward64(unsigned long *_Index, unsigned __int64 _Mask) {
-  if (!_Mask)
-return 0;
-  *_Index = __builtin_ctzll(_Mask);
-  return 1;
-}
-static __inline__ unsigned char __DEFAULT_FN_ATTRS
-_BitScanReverse64(unsigned long *_Index, unsigned __int64 _Mask) {
-  if (!_Mask)
-return 0;
-  *_Index = 63 - __builtin_clzll(_Mask);
-  return 1;
-}
-static __inline__ unsigned char __DEFAULT_FN_ATTRS
 _bittest64(__int64 const *_BitBase, __int64 _BitPos) {
   return (*_BitBase >> _BitPos) & 1;
 }
Index: lib/CodeGen/CGBuiltin.cpp
===
--- lib/CodeGen/CGBuiltin.cpp
+++ lib/CodeGen/CGBuiltin.cpp
@@ -2637,6 +2637,68 @@
   }
 }
 
+// Many of MSVC builtins are on both x64 and ARM; to avoid repeating code, we
+// handle them here.
+enum class CodeGenFunction::MSVCIntrin {
+  _BitScanForward,
+  _BitScanReverse
+};
+
+Value *CodeGenFunction::EmitMSVCBuiltinExpr(MSVCIntrin BuiltinID,
+const CallExpr *E) {
+  switch (BuiltinID) {
+  case MSVCIntrin::_BitScanForward:
+  case MSVCIntrin::_BitScanReverse: {
+Value *ArgValue = EmitScalarExpr(E->getArg(1));
+
+llvm::Type *ArgType = ArgValue->getType();
+llvm::Type *IndexType =
+EmitScalarExpr(E->getArg(0))->getType()->getPointerElementType();
+llvm::Type *ResultType = ConvertType(E->getType());
+
+Value *ArgZero = llvm::Constant::getNullValue(ArgType);
+Value *ResZero = llvm::Constant::getNullValue(ResultType);
+Value *ResOne = llvm::ConstantInt::get(ResultType, 1);
+
+BasicBlock *Begin = Builder.GetInsertBlock();
+BasicBlock *End = createBasicBlock("bitscan_end", this->CurFn);
+Builder.SetInsertPoint(End);
+PHINode *Result = Builder.CreatePHI(ResultType, 2, "bitscan_result");
+
+Builder.SetInsertPoint(Begin);
+Value *IsZero = Builder.CreateICmpEQ(ArgValue, ArgZero);
+BasicBlock *NotZero = createBasicBlock("bitscan_not_zero", this->CurFn);
+Builder.CreateCondBr(IsZero, End, NotZero);
+Result->addIncoming(ResZero, Begin);
+
+Builder.SetInsertPoint(NotZero);
+Address IndexAddress = EmitPointerWithAlignment(E->getArg(0));
+
+if (BuiltinID == MSVCIntrin::_BitScanForward) {
+  Value *F = CGM.getIntrinsic(Intrinsic::cttz, ArgType);
+  Value *ZeroCount = Builder.CreateCall(F, {ArgValue, Builder.getTrue()});
+  ZeroCount = Builder.CreateIntCast(ZeroCount, IndexType, false);
+  Builder.CreateStore(ZeroCount, IndexAddress, false);
+} else {
+  unsigned ArgWidth = cast(ArgType)->getBitWidth();
+  Value *ArgTypeLastIndex = llvm::ConstantInt::get(IndexType, ArgWidth - 1);
+
+  Value *F = CGM.getIntrinsic(Intrinsic::ctlz, ArgType);
+  Value *ZeroCount = Builder.CreateCall(F, {ArgValue, Builder.getTrue()});
+  ZeroCount = Builder.CreateIntCast(ZeroCount, IndexType, false);
+  Value *Index = Builder.CreateNSWSub(ArgTypeLastIndex, ZeroCount);
+  Builder.CreateStore(Index, IndexAddress, false);
+}
+Builder.CreateBr(End);
+Result->addIncoming(ResOne, NotZero);
+
+Builder.SetInsertPoint(End);
+return Result;
+  }
+  }
+  llvm_unreachable("Incorrect MSVC intrinsic!");
+}
+
 Value *CodeGenFunction::EmitTargetBuiltinExpr(unsigned BuiltinID,
   const CallExpr *E) {
   if (getContext().BuiltinInfo.isAuxBuiltinID(BuiltinID)) {
@@ -4561,6 +4623,12 @@
 return Builder.CreateCall(F, {Ops[1], Ops[2], Ops[0],
   Ops[3], Ops[4], Ops[5]});
   }
+  case ARM::BI_BitScanForward:
+  case ARM::BI_BitScanForward64:
+

[PATCH] D25282: [clang-move] Cleanup around replacements.

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

Lg


https://reviews.llvm.org/D25282



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


Re: [PATCH] D24397: Target Power9 bit counting and vector comparison instructions through builtins (front end portion)

2016-10-05 Thread Nemanja Ivanovic via cfe-commits
 Committed revision 283363.

On Wed, Oct 5, 2016 at 9:18 PM, Nemanja Ivanovic 
wrote:

> OK, will remove optimization and the selects and commit this now.
> Sorry about the delay.
>
> On Wed, Oct 5, 2016 at 9:16 PM, Sanjay Patel 
> wrote:
>
>> You should not need to account for any nsw/nuw flags if the clang test
>> does not enable the optimizer.
>> Ie, D24955 should not be running at -O0.
>>
>> On Wed, Oct 5, 2016 at 1:09 PM, Nemanja Ivanovic > > wrote:
>>
>>> OK, I get testing that I'm fine with if I remove the -O2 and the checks
>>> for 'select i1'.
>>>
>>> Does that change suffice for the purposes of
>>> https://reviews.llvm.org/D24955?
>>>
>>> Namely, do I need to account for the possible addition of nsw/nuw flags
>>> to the add instructions even without -O2?
>>>
>>> On Wed, Oct 5, 2016 at 8:24 PM, Sanjay Patel 
>>> wrote:
>>>
 spatel added a comment.

 In https://reviews.llvm.org/D24397#562469, @bjope wrote:

 > (I'm still hesitating about commiting https://reviews.llvm.org/D24955
 in llvm since that would make these clang tests fail...)


 You can't do that. Bots will send you fail mail all day as they choke
 on the clang tests - speaking from experience. :)
 We either need to fix or revert this commit in order to let
 https://reviews.llvm.org/D24955 proceed.


 Repository:
   rL LLVM

 https://reviews.llvm.org/D24397




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


r283363 - Removing optimization from the RUN lines and adjusting the checks

2016-10-05 Thread Nemanja Ivanovic via cfe-commits
Author: nemanjai
Date: Wed Oct  5 14:11:36 2016
New Revision: 283363

URL: http://llvm.org/viewvc/llvm-project?rev=283363=rev
Log:
Removing optimization from the RUN lines and adjusting the checks
to not rely on optimization.

Modified:
cfe/trunk/test/CodeGen/builtins-ppc-p9vector.c

Modified: cfe/trunk/test/CodeGen/builtins-ppc-p9vector.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-ppc-p9vector.c?rev=283363=283362=283363=diff
==
--- cfe/trunk/test/CodeGen/builtins-ppc-p9vector.c (original)
+++ cfe/trunk/test/CodeGen/builtins-ppc-p9vector.c Wed Oct  5 14:11:36 2016
@@ -1,11 +1,11 @@
 // REQUIRES: powerpc-registered-target
 // RUN: %clang_cc1 -faltivec -target-feature +power9-vector \
 // RUN:   -triple powerpc64-unknown-unknown -emit-llvm %s \
-// RUN:   -O2 -o - | FileCheck %s -check-prefix=CHECK-BE
+// RUN:   -o - | FileCheck %s -check-prefix=CHECK-BE
 
 // RUN: %clang_cc1 -faltivec -target-feature +power9-vector \
 // RUN:   -triple powerpc64le-unknown-unknown -emit-llvm %s \
-// RUN:   -O2 -o - | FileCheck %s
+// RUN:   -o - | FileCheck %s
 
 #include 
 
@@ -31,7 +31,6 @@ unsigned test1(void) {
 // CHECK-BE: icmp eq i64 {{.*}}, 64
 // CHECK-BE: extractelement <2 x i64>
 // CHECK-BE: add i64 {{.*}}, 64
-// CHECK-BE: select i1
 // CHECK-BE: lshr i64 {{.*}}, 3
 // CHECK: @llvm.ppc.altivec.vcmpequb(<16 x i8>
 // CHECK: @llvm.cttz.v2i64(<2 x i64>
@@ -39,7 +38,6 @@ unsigned test1(void) {
 // CHECK: icmp eq i64 {{.*}}, 64
 // CHECK: extractelement <2 x i64>
 // CHECK: add i64 {{.*}}, 64
-// CHECK: select i1
 // CHECK: lshr i64 {{.*}}, 3
   return vec_first_match_index (vsca, vscb);
 }
@@ -50,7 +48,6 @@ unsigned test2(void) {
 // CHECK-BE: icmp eq i64 {{.*}}, 64
 // CHECK-BE: extractelement <2 x i64>
 // CHECK-BE: add i64 {{.*}}, 64
-// CHECK-BE: select i1
 // CHECK-BE: lshr i64 {{.*}}, 3
 // CHECK: @llvm.ppc.altivec.vcmpequb(<16 x i8>
 // CHECK: @llvm.cttz.v2i64(<2 x i64>
@@ -58,7 +55,6 @@ unsigned test2(void) {
 // CHECK: icmp eq i64 {{.*}}, 64
 // CHECK: extractelement <2 x i64>
 // CHECK: add i64 {{.*}}, 64
-// CHECK: select i1
 // CHECK: lshr i64 {{.*}}, 3
   return vec_first_match_index (vuca, vucb);
 }
@@ -69,7 +65,6 @@ unsigned test3(void) {
 // CHECK-BE: icmp eq i64 {{.*}}, 64
 // CHECK-BE: extractelement <2 x i64>
 // CHECK-BE: add i64 {{.*}}, 64
-// CHECK-BE: select i1
 // CHECK-BE: lshr i64 {{.*}}, 5
 // CHECK: @llvm.ppc.altivec.vcmpequw(<4 x i32>
 // CHECK: @llvm.cttz.v2i64(<2 x i64>
@@ -77,7 +72,6 @@ unsigned test3(void) {
 // CHECK: icmp eq i64 {{.*}}, 64
 // CHECK: extractelement <2 x i64>
 // CHECK: add i64 {{.*}}, 64
-// CHECK: select i1
 // CHECK: lshr i64 {{.*}}, 5
   return vec_first_match_index (vsia, vsib);
 }
@@ -88,7 +82,6 @@ unsigned test4(void) {
 // CHECK-BE: icmp eq i64 {{.*}}, 64
 // CHECK-BE: extractelement <2 x i64>
 // CHECK-BE: add i64 {{.*}}, 64
-// CHECK-BE: select i1
 // CHECK-BE: lshr i64 {{.*}}, 5
 // CHECK: @llvm.ppc.altivec.vcmpequw(<4 x i32>
 // CHECK: @llvm.cttz.v2i64(<2 x i64>
@@ -96,7 +89,6 @@ unsigned test4(void) {
 // CHECK: icmp eq i64 {{.*}}, 64
 // CHECK: extractelement <2 x i64>
 // CHECK: add i64 {{.*}}, 64
-// CHECK: select i1
 // CHECK: lshr i64 {{.*}}, 5
   return vec_first_match_index (vuia, vuib);
 }
@@ -107,7 +99,6 @@ unsigned test5(void) {
 // CHECK-BE: icmp eq i64 {{.*}}, 64
 // CHECK-BE: extractelement <2 x i64>
 // CHECK-BE: add i64 {{.*}}, 64
-// CHECK-BE: select i1
 // CHECK-BE: lshr i64 {{.*}}, 4
 // CHECK: @llvm.ppc.altivec.vcmpequh(<8 x i16>
 // CHECK: @llvm.cttz.v2i64(<2 x i64>
@@ -115,7 +106,6 @@ unsigned test5(void) {
 // CHECK: icmp eq i64 {{.*}}, 64
 // CHECK: extractelement <2 x i64>
 // CHECK: add i64 {{.*}}, 64
-// CHECK: select i1
 // CHECK: lshr i64 {{.*}}, 4
   return vec_first_match_index (vssa, vssb);
 }
@@ -126,7 +116,6 @@ unsigned test6(void) {
 // CHECK-BE: icmp eq i64 {{.*}}, 64
 // CHECK-BE: extractelement <2 x i64>
 // CHECK-BE: add i64 {{.*}}, 64
-// CHECK-BE: select i1
 // CHECK-BE: lshr i64 {{.*}}, 4
 // CHECK: @llvm.ppc.altivec.vcmpequh(<8 x i16>
 // CHECK: @llvm.cttz.v2i64(<2 x i64>
@@ -134,7 +123,6 @@ unsigned test6(void) {
 // CHECK: icmp eq i64 {{.*}}, 64
 // CHECK: extractelement <2 x i64>
 // CHECK: add i64 {{.*}}, 64
-// CHECK: select i1
 // CHECK: lshr i64 {{.*}}, 4
   return vec_first_match_index (vusa, vusb);
 }
@@ -149,7 +137,6 @@ unsigned test7(void) {
 // CHECK-BE: icmp eq i64 {{.*}}, 64
 // CHECK-BE: extractelement <2 x i64>
 // CHECK-BE: add i64 {{.*}}, 64
-// CHECK-BE: select i1
 // CHECK-BE: lshr i64 {{.*}}, 3
 // CHECK: @llvm.ppc.altivec.vcmpequb(<16 x i8>
 // CHECK: @llvm.ppc.altivec.vcmpequb(<16 x i8>
@@ -161,7 +148,6 @@ unsigned test7(void) {
 // CHECK: icmp eq i64 {{.*}}, 64
 // CHECK: extractelement <2 x i64>
 // CHECK: add i64 {{.*}}, 64
-// CHECK: select i1
 // CHECK: lshr i64 {{.*}}, 3
   return vec_first_match_or_eos_index (vsca, vscb);
 }
@@ -176,7 +162,6 @@ unsigned test8(void) {
 // 

Re: [PATCH] D24397: Target Power9 bit counting and vector comparison instructions through builtins (front end portion)

2016-10-05 Thread Nemanja Ivanovic via cfe-commits
OK, will remove optimization and the selects and commit this now.
Sorry about the delay.

On Wed, Oct 5, 2016 at 9:16 PM, Sanjay Patel  wrote:

> You should not need to account for any nsw/nuw flags if the clang test
> does not enable the optimizer.
> Ie, D24955 should not be running at -O0.
>
> On Wed, Oct 5, 2016 at 1:09 PM, Nemanja Ivanovic 
> wrote:
>
>> OK, I get testing that I'm fine with if I remove the -O2 and the checks
>> for 'select i1'.
>>
>> Does that change suffice for the purposes of
>> https://reviews.llvm.org/D24955?
>>
>> Namely, do I need to account for the possible addition of nsw/nuw flags
>> to the add instructions even without -O2?
>>
>> On Wed, Oct 5, 2016 at 8:24 PM, Sanjay Patel 
>> wrote:
>>
>>> spatel added a comment.
>>>
>>> In https://reviews.llvm.org/D24397#562469, @bjope wrote:
>>>
>>> > (I'm still hesitating about commiting https://reviews.llvm.org/D24955
>>> in llvm since that would make these clang tests fail...)
>>>
>>>
>>> You can't do that. Bots will send you fail mail all day as they choke on
>>> the clang tests - speaking from experience. :)
>>> We either need to fix or revert this commit in order to let
>>> https://reviews.llvm.org/D24955 proceed.
>>>
>>>
>>> Repository:
>>>   rL LLVM
>>>
>>> https://reviews.llvm.org/D24397
>>>
>>>
>>>
>>>
>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24397: Target Power9 bit counting and vector comparison instructions through builtins (front end portion)

2016-10-05 Thread Sanjay Patel via cfe-commits
You should not need to account for any nsw/nuw flags if the clang test does
not enable the optimizer.
Ie, D24955 should not be running at -O0.

On Wed, Oct 5, 2016 at 1:09 PM, Nemanja Ivanovic 
wrote:

> OK, I get testing that I'm fine with if I remove the -O2 and the checks
> for 'select i1'.
>
> Does that change suffice for the purposes of
> https://reviews.llvm.org/D24955?
>
> Namely, do I need to account for the possible addition of nsw/nuw flags to
> the add instructions even without -O2?
>
> On Wed, Oct 5, 2016 at 8:24 PM, Sanjay Patel 
> wrote:
>
>> spatel added a comment.
>>
>> In https://reviews.llvm.org/D24397#562469, @bjope wrote:
>>
>> > (I'm still hesitating about commiting https://reviews.llvm.org/D24955
>> in llvm since that would make these clang tests fail...)
>>
>>
>> You can't do that. Bots will send you fail mail all day as they choke on
>> the clang tests - speaking from experience. :)
>> We either need to fix or revert this commit in order to let
>> https://reviews.llvm.org/D24955 proceed.
>>
>>
>> Repository:
>>   rL LLVM
>>
>> https://reviews.llvm.org/D24397
>>
>>
>>
>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24397: Target Power9 bit counting and vector comparison instructions through builtins (front end portion)

2016-10-05 Thread Nemanja Ivanovic via cfe-commits
OK, I get testing that I'm fine with if I remove the -O2 and the checks for
'select i1'.

Does that change suffice for the purposes of https://reviews.llvm.org/D24955
?

Namely, do I need to account for the possible addition of nsw/nuw flags to
the add instructions even without -O2?

On Wed, Oct 5, 2016 at 8:24 PM, Sanjay Patel  wrote:

> spatel added a comment.
>
> In https://reviews.llvm.org/D24397#562469, @bjope wrote:
>
> > (I'm still hesitating about commiting https://reviews.llvm.org/D24955
> in llvm since that would make these clang tests fail...)
>
>
> You can't do that. Bots will send you fail mail all day as they choke on
> the clang tests - speaking from experience. :)
> We either need to fix or revert this commit in order to let
> https://reviews.llvm.org/D24955 proceed.
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D24397
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r283360 - Comment out failing test while I figure out who is at fault

2016-10-05 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Oct  5 13:47:18 2016
New Revision: 283360

URL: http://llvm.org/viewvc/llvm-project?rev=283360=rev
Log:
Comment out failing test while I figure out who is at fault

Modified:

libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp?rev=283360=283359=283360=diff
==
--- 
libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp
 Wed Oct  5 13:47:18 2016
@@ -95,7 +95,7 @@ int main()
 test_is_not_empty();
 test_is_not_empty();
 test_is_not_empty();
-test_is_empty();
+//test_is_not_empty();
 
 test_is_empty();
 test_is_empty();


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


[libcxx] r283356 - Mark LWG#2679 as complete

2016-10-05 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Oct  5 13:36:24 2016
New Revision: 283356

URL: http://llvm.org/viewvc/llvm-project?rev=283356=rev
Log:
Mark LWG#2679 as complete

Modified:
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=283356=283355=283356=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Wed Oct  5 13:36:24 2016
@@ -93,7 +93,7 @@
 http://wg21.link/LWG2665;>2665remove_filename() post 
condition is incorrectIssaquah
 http://wg21.link/LWG2672;>2672Should 
is_empty use error_code in its 
specification?Issaquah
 http://wg21.link/LWG2678;>2678std::filesystem enum classes 
overspecifiedIssaquah
-http://wg21.link/LWG2679;>2679Inconsistent Use of Effects 
and Equivalent ToIssaquah
+http://wg21.link/LWG2679;>2679Inconsistent Use of Effects 
and Equivalent ToIssaquahNothing to do
 http://wg21.link/LWG2680;>2680Add 
"Equivalent to" to filesystemIssaquah
 http://wg21.link/LWG2681;>2681filesystem::copy() cannot copy 
symlinksIssaquah
 http://wg21.link/LWG2682;>2682filesystem::copy() won't 
create a symlink to a directoryIssaquah
@@ -167,7 +167,7 @@
 2665 - 
 2672 - 
 2678 - 
-2679 - 
+2679 - This is just wording cleanup. 
 2680 - 
 2681 - 
 2682 - 


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


[PATCH] D23096: [Sema] Pass CombineWithOuterScope = true to constructor of LocalInstantiationScope

2016-10-05 Thread Serge Pavlov via cfe-commits
sepavloff added a comment.

IIUC, the problem is observed because `Sema::getTemplateInstantiationArgs` does 
not handle the case of variable templates properly. Classes and functions are 
declaration contexts and implementation of the aforementioned function (and 
probably others) relies on this fact. Variable does not represents a context, 
and this causes errors like this. We cannot make 
`VarTemplateSpecializationDecl` a subclass of `DeclContext` because the latter 
not only serves as a host for other declarations but also supports name lookup. 
None is pertinent to the case of variable specialization.

I think, logic of `getTemplateInstantiationArgs` should be changed. The new 
implementation could inspect current instantiation 
(`Sema::ActiveTemplateInstantiations`) to check if it is an instantiation of a 
variable template. This could eliminate need of `VarTemplateSpec` and 
`VarTemplateSpecializationRAII`. Such solution looks more flexible as variable 
initializer may contain references to other variable instantiations, so single 
value of `VarTemplateSpec` is not sufficient to track instantiations.


https://reviews.llvm.org/D23096



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


[PATCH] D24397: Target Power9 bit counting and vector comparison instructions through builtins (front end portion)

2016-10-05 Thread Sanjay Patel via cfe-commits
spatel added a comment.

In https://reviews.llvm.org/D24397#562469, @bjope wrote:

> (I'm still hesitating about commiting https://reviews.llvm.org/D24955 in llvm 
> since that would make these clang tests fail...)


You can't do that. Bots will send you fail mail all day as they choke on the 
clang tests - speaking from experience. :)
We either need to fix or revert this commit in order to let 
https://reviews.llvm.org/D24955 proceed.


Repository:
  rL LLVM

https://reviews.llvm.org/D24397



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


[PATCH] D25264: Implement MS _BitScan intrinsics

2016-10-05 Thread David Majnemer via cfe-commits
majnemer added inline comments.


> agutowski wrote in CGBuiltin.cpp:2656-2684
> MSDN doesn't specify what should be put under the "Index" address when the 
> argument is zero; as I checked, VS2015 with optimizations puts undefined 
> value there, and I hope that's what I'm doing here.

Intel (https://software.intel.com/en-us/node/523362) says the following:
Sets *p to the bit index of the least significant set bit of b or leaves it 
unchanged if b is zero. The function returns a non-zero result when b is 
non-zero and returns zero when b is zero.

This seems to mesh with this Mozilla bug report: 
https://bugzilla.mozilla.org/show_bug.cgi?id=1182370

https://reviews.llvm.org/D25264



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


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

2016-10-05 Thread Serge Rogatch via cfe-commits
rSerge updated this revision to Diff 73673.

https://reviews.llvm.org/D24799

Files:
  lib/Driver/Tools.cpp
  test/Driver/xray-instrument.c


Index: test/Driver/xray-instrument.c
===
--- test/Driver/xray-instrument.c
+++ test/Driver/xray-instrument.c
@@ -0,0 +1,3 @@
+// RUN: not %clang -v -fxray-instrument -c %s
+// XFAIL: amd64-, x86_64-, x86_64h-, arm
+typedef int a;
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4784,7 +4784,20 @@
 
   if (Args.hasFlag(options::OPT_fxray_instrument,
options::OPT_fnoxray_instrument, false)) {
-CmdArgs.push_back("-fxray-instrument");
+const char* const XRayInstrumentOption = "-fxray-instrument";
+switch(getToolChain().getArch()) {
+case llvm::Triple::arm:
+case llvm::Triple::x86_64:
+  break;
+default:
+{
+  std::string Feature(XRayInstrumentOption);
+  Feature += " on ";
+  Feature += Triple.getArchName().data();
+  D.Diag(diag::err_drv_clang_unsupported) << Feature;
+  break;
+} }
+CmdArgs.push_back(XRayInstrumentOption);
 if (const Arg *A =
 Args.getLastArg(options::OPT_fxray_instruction_threshold_,
 options::OPT_fxray_instruction_threshold_EQ)) {


Index: test/Driver/xray-instrument.c
===
--- test/Driver/xray-instrument.c
+++ test/Driver/xray-instrument.c
@@ -0,0 +1,3 @@
+// RUN: not %clang -v -fxray-instrument -c %s
+// XFAIL: amd64-, x86_64-, x86_64h-, arm
+typedef int a;
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4784,7 +4784,20 @@
 
   if (Args.hasFlag(options::OPT_fxray_instrument,
options::OPT_fnoxray_instrument, false)) {
-CmdArgs.push_back("-fxray-instrument");
+const char* const XRayInstrumentOption = "-fxray-instrument";
+switch(getToolChain().getArch()) {
+case llvm::Triple::arm:
+case llvm::Triple::x86_64:
+  break;
+default:
+{
+  std::string Feature(XRayInstrumentOption);
+  Feature += " on ";
+  Feature += Triple.getArchName().data();
+  D.Diag(diag::err_drv_clang_unsupported) << Feature;
+  break;
+} }
+CmdArgs.push_back(XRayInstrumentOption);
 if (const Arg *A =
 Args.getLastArg(options::OPT_fxray_instruction_threshold_,
 options::OPT_fxray_instruction_threshold_EQ)) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-10-05 Thread Serge Rogatch via cfe-commits
rSerge added a comment.

In https://reviews.llvm.org/D24799#561879, @dberris wrote:

> In https://reviews.llvm.org/D24799#561106, @rSerge wrote:
>
> > My mistake was that initially I only enumerated the unsupported targets 
> > from llvm\include\llvm\ADT\Triple.h . Now I've added also the cases from 
> > llvm\lib\Support\Triple.cpp .
> >  `XFAIL` requires a list of all unsupported cases, which is currently much 
> > larger than the list of supported cases. However, AFAIK there is nothing 
> > like `XPASS` in LIT.
>
>
> I just thought about reversing this. How about if you do something like:
>
>   // RUN: not %clang -v -fxray-instrument -c %s
>   // XFAIL: x86_64-, arm7-
>
>
> I suspect that would be sufficient to work as an `XPASS` of sorts?


Good idea, thanks. I've used it.


https://reviews.llvm.org/D24799



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


[PATCH] D24397: Target Power9 bit counting and vector comparison instructions through builtins (front end portion)

2016-10-05 Thread Bjorn Pettersson via cfe-commits
bjope added a comment.

What is the progress about getting rid of these code generation checks?

(I'm still hesitating about commiting https://reviews.llvm.org/D24955 in llvm 
since that would make these clang tests fail...)


Repository:
  rL LLVM

https://reviews.llvm.org/D24397



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


[PATCH] D24932: Fix PR 30440

2016-10-05 Thread Dmitry Polukhin via cfe-commits
DmitryPolukhin accepted this revision.
DmitryPolukhin added a comment.
This revision is now accepted and ready to land.

I think we need to fix this regression.


Repository:
  rL LLVM

https://reviews.llvm.org/D24932



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


[PATCH] D25264: Implement MS _BitScan intrinsics

2016-10-05 Thread Reid Kleckner via cfe-commits
rnk added inline comments.


> CodeGenFunction.h:2964
> +private:
> +  enum class MSVCIntrin;
> +

Does this work on Linux? I thought you had to give it an explicit underlying 
type (enum class MSVCIntrin : unsigned;) to make that work.

https://reviews.llvm.org/D25264



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


[PATCH] D25273: Fix PR30520: Fix incomplete type crash when dealing with transparent_union attribute

2016-10-05 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.

LGTM, thank you!


Repository:
  rL LLVM

https://reviews.llvm.org/D25273



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


[PATCH] D25264: Implement MS _BitScan intrinsics

2016-10-05 Thread Albert Gutowski via cfe-commits
agutowski updated this revision to Diff 73668.
agutowski added a comment.

change enum in MSVC namespace to enum class MSVCIntrin in CodeGenFunction; 
cover all control paths


https://reviews.llvm.org/D25264

Files:
  include/clang/Basic/BuiltinsARM.def
  include/clang/Basic/BuiltinsX86.def
  include/clang/Basic/BuiltinsX86_64.def
  lib/Basic/Targets.cpp
  lib/CodeGen/CGBuiltin.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/Headers/intrin.h
  test/CodeGen/ms-intrinsics.c

Index: lib/Headers/intrin.h
===
--- lib/Headers/intrin.h
+++ lib/Headers/intrin.h
@@ -447,20 +447,6 @@
 |* Bit Counting and Testing
 \**/
 static __inline__ unsigned char __DEFAULT_FN_ATTRS
-_BitScanForward(unsigned long *_Index, unsigned long _Mask) {
-  if (!_Mask)
-return 0;
-  *_Index = __builtin_ctzl(_Mask);
-  return 1;
-}
-static __inline__ unsigned char __DEFAULT_FN_ATTRS
-_BitScanReverse(unsigned long *_Index, unsigned long _Mask) {
-  if (!_Mask)
-return 0;
-  *_Index = 31 - __builtin_clzl(_Mask);
-  return 1;
-}
-static __inline__ unsigned char __DEFAULT_FN_ATTRS
 _bittest(long const *_BitBase, long _BitPos) {
   return (*_BitBase >> _BitPos) & 1;
 }
@@ -506,20 +492,6 @@
 #endif
 #ifdef __x86_64__
 static __inline__ unsigned char __DEFAULT_FN_ATTRS
-_BitScanForward64(unsigned long *_Index, unsigned __int64 _Mask) {
-  if (!_Mask)
-return 0;
-  *_Index = __builtin_ctzll(_Mask);
-  return 1;
-}
-static __inline__ unsigned char __DEFAULT_FN_ATTRS
-_BitScanReverse64(unsigned long *_Index, unsigned __int64 _Mask) {
-  if (!_Mask)
-return 0;
-  *_Index = 63 - __builtin_clzll(_Mask);
-  return 1;
-}
-static __inline__ unsigned char __DEFAULT_FN_ATTRS
 _bittest64(__int64 const *_BitBase, __int64 _BitPos) {
   return (*_BitBase >> _BitPos) & 1;
 }
Index: lib/CodeGen/CGBuiltin.cpp
===
--- lib/CodeGen/CGBuiltin.cpp
+++ lib/CodeGen/CGBuiltin.cpp
@@ -2637,6 +2637,56 @@
   }
 }
 
+// Many of MSVC builtins are on both x64 and ARM; to avoid repeating code, we
+// handle them here.
+enum class CodeGenFunction::MSVCIntrin {
+  _BitScanForward,
+  _BitScanReverse
+};
+
+Value *CodeGenFunction::EmitMSVCBuiltinExpr(MSVCIntrin BuiltinID,
+const CallExpr *E) {
+  switch (BuiltinID) {
+  case MSVCIntrin::_BitScanForward:
+  case MSVCIntrin::_BitScanReverse: {
+Value *ArgValue = EmitScalarExpr(E->getArg(1));
+
+llvm::Type *ArgType = ArgValue->getType();
+llvm::Type *IndexType =
+EmitScalarExpr(E->getArg(0))->getType()->getPointerElementType();
+llvm::Type *ResultType = ConvertType(E->getType());
+
+Value *ArgZero = llvm::Constant::getNullValue(ArgType);
+Value *ResZero = llvm::Constant::getNullValue(ResultType);
+Value *ResOne = llvm::ConstantInt::get(ResultType, 1);
+
+Value *IsZero = Builder.CreateICmpEQ(ArgValue, ArgZero);
+Value *Result = Builder.CreateSelect(IsZero, ResZero, ResOne);
+
+Address IndexAddress = EmitPointerWithAlignment(E->getArg(0));
+
+if (BuiltinID == MSVCIntrin::_BitScanForward) {
+  Value *F = CGM.getIntrinsic(Intrinsic::cttz, ArgType);
+  Value *ZeroCount = Builder.CreateCall(F, {ArgValue, Builder.getTrue()});
+  ZeroCount = Builder.CreateIntCast(ZeroCount, IndexType, false);
+  Builder.CreateStore(ZeroCount, IndexAddress, false);
+} else {
+  unsigned ArgWidth = cast(ArgType)->getBitWidth();
+  Value *ArgTypeLastIndex = llvm::ConstantInt::get(IndexType, ArgWidth - 1);
+
+  Value *F = CGM.getIntrinsic(Intrinsic::ctlz, ArgType);
+  Value *ZeroCount = Builder.CreateCall(F, {ArgValue, Builder.getTrue()});
+  ZeroCount = Builder.CreateIntCast(ZeroCount, IndexType, false);
+  Value *Index = Builder.CreateNSWSub(ArgTypeLastIndex, ZeroCount);
+  Builder.CreateStore(Index, IndexAddress, false);
+}
+
+return Result;
+  }
+  }
+  llvm_unreachable("Incorrect MSVC intrinsic!");
+}
+
 Value *CodeGenFunction::EmitTargetBuiltinExpr(unsigned BuiltinID,
   const CallExpr *E) {
   if (getContext().BuiltinInfo.isAuxBuiltinID(BuiltinID)) {
@@ -4561,6 +4611,12 @@
 return Builder.CreateCall(F, {Ops[1], Ops[2], Ops[0],
   Ops[3], Ops[4], Ops[5]});
   }
+  case ARM::BI_BitScanForward:
+  case ARM::BI_BitScanForward64:
+return EmitMSVCBuiltinExpr(MSVCIntrin::_BitScanForward, E);
+  case ARM::BI_BitScanReverse:
+  case ARM::BI_BitScanReverse64:
+return EmitMSVCBuiltinExpr(MSVCIntrin::_BitScanReverse, E);
   }
 
   // Get the last argument, which specifies the vector type.
@@ -7599,6 +7655,13 @@
 HigherBits = Builder.CreateIntCast(HigherBits, ResType, IsSigned);
 return HigherBits;
   }
+
+  case X86::BI_BitScanForward:
+  case X86::BI_BitScanForward64:
+return 

[clang-tools-extra] r283338 - [change-namespace] Pass Style to ChangeNamespaceTool.

2016-10-05 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Wed Oct  5 12:00:40 2016
New Revision: 283338

URL: http://llvm.org/viewvc/llvm-project?rev=283338=rev
Log:
[change-namespace] Pass Style to ChangeNamespaceTool.

Modified:
clang-tools-extra/trunk/change-namespace/tool/ClangChangeNamespace.cpp

Modified: clang-tools-extra/trunk/change-namespace/tool/ClangChangeNamespace.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/change-namespace/tool/ClangChangeNamespace.cpp?rev=283338=283337=283338=diff
==
--- clang-tools-extra/trunk/change-namespace/tool/ClangChangeNamespace.cpp 
(original)
+++ clang-tools-extra/trunk/change-namespace/tool/ClangChangeNamespace.cpp Wed 
Oct  5 12:00:40 2016
@@ -74,7 +74,7 @@ int main(int argc, const char **argv) {
   const auto  = OptionsParser.getSourcePathList();
   tooling::RefactoringTool Tool(OptionsParser.getCompilations(), Files);
   change_namespace::ChangeNamespaceTool NamespaceTool(
-  OldNamespace, NewNamespace, FilePattern, ());
+  OldNamespace, NewNamespace, FilePattern, (), Style);
   ast_matchers::MatchFinder Finder;
   NamespaceTool.registerMatchers();
   std::unique_ptr Factory =


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


[PATCH] D25273: Fix PR30520: Fix incomplete type crash when dealing with transparent_union attribute

2016-10-05 Thread Reid Kleckner via cfe-commits
rnk accepted this revision.
rnk added a reviewer: rnk.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm, thanks!


Repository:
  rL LLVM

https://reviews.llvm.org/D25273



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


[libcxx] r283341 - Mark LWG#2358 as done

2016-10-05 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Oct  5 12:02:43 2016
New Revision: 283341

URL: http://llvm.org/viewvc/llvm-project?rev=283341=rev
Log:
Mark LWG#2358 as done

Modified:
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=283341=283340=283341=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Wed Oct  5 12:02:43 2016
@@ -64,7 +64,7 @@
 http://wg21.link/LWG2221;>2221No 
formatted output operator for nullptrIssaquahPatch 
ready
 http://wg21.link/LWG2223;>2223shrink_to_fit effect on 
iterator validityIssaquah
 http://wg21.link/LWG2261;>2261Are 
containers required to use their 'pointer' type 
internally?Issaquah
-http://wg21.link/LWG2358;>2358Apparently-bogus definition of 
is_empty type traitIssaquah
+http://wg21.link/LWG2358;>2358Apparently-bogus definition of 
is_empty type traitIssaquahWe already do this
 http://wg21.link/LWG2394;>2394locale::name specification 
unclear - what is implementation-defined?Issaquah
 http://wg21.link/LWG2460;>2460LWG issue 
2408 and value categoriesIssaquah
 http://wg21.link/LWG2468;>2468Self-move-assignment of 
library typesIssaquah
@@ -138,7 +138,7 @@
 2221 - Patch and tests ready
 2223 - 
 2261 - 
-2358 - 
+2358 - We already do this; I improved the tests
 2394 - 
 2460 - 
 2468 - 


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


[libcxx] r283339 - Make tests for is_empty better. No functional change.

2016-10-05 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Oct  5 12:01:16 2016
New Revision: 283339

URL: http://llvm.org/viewvc/llvm-project?rev=283339=rev
Log:
Make tests for is_empty better. No functional change.

Modified:

libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp?rev=283339=283338=283339=diff
==
--- 
libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp
 Wed Oct  5 12:01:16 2016
@@ -11,6 +11,14 @@
 
 // is_empty
 
+// T is a non-union class type with:
+//  no non-static data members,
+//  no unnamed bit-fields of non-zero length,
+//  no virtual member functions,
+//  no virtual base classes,
+//  and no base class B for which is_empty_v is false.
+
+
 #include 
 #include "test_macros.h"
 
@@ -44,22 +52,33 @@ void test_is_not_empty()
 #endif
 }
 
-class Empty
-{
-};
+class Empty {};
+struct NotEmpty { int foo; };
 
-class NotEmpty
+class VirtualFn
 {
-virtual ~NotEmpty();
+virtual ~VirtualFn();
 };
 
 union Union {};
 
+struct EmptyBase: public Empty {};
+struct VirtualBase  : virtual Empty {};
+struct NotEmptyBase : public NotEmpty {};
+
+struct StaticMember{ static int foo; };
+struct NonStaticMember {int foo; };
+
 struct bit_zero
 {
 int :  0;
 };
 
+struct bit_one
+{
+int :  1;
+};
+
 int main()
 {
 test_is_not_empty();
@@ -72,7 +91,14 @@ int main()
 test_is_not_empty();
 test_is_not_empty();
 test_is_not_empty();
+test_is_not_empty();
+test_is_not_empty();
+test_is_not_empty();
+test_is_not_empty();
+test_is_empty();
 
 test_is_empty();
+test_is_empty();
+test_is_empty();
 test_is_empty();
 }


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


[PATCH] D25284: AvailabilityAttrs: Delay partial availability diagnostics

2016-10-05 Thread Erik Pilkington via cfe-commits
erik.pilkington created this revision.
erik.pilkington added a reviewer: manmanren.
erik.pilkington added a subscriber: cfe-commits.

Note: this patch depends on: https://reviews.llvm.org/D25283

This patch delays handling of `AR_NotYetIntroduced` diagnostics, so that the 
following compiles with no warnings:

  typedef int new_int __attribute__((availability(macos, introduced=100)));
  
  new_int f() __attribute__((availability(macos, introduced=100)));

This is done by treating `AR_NotYetIntroduced` diagnostics as delayed, just 
like `AR_Unavailable` and `AR_Deprecated`. This means that we emit the 
diagnostic once we finished parsing `f()`, at which point we have the context 
to determine if we should diagnose `new_int`.

Thanks!


https://reviews.llvm.org/D25284

Files:
  include/clang/Sema/DelayedDiagnostic.h
  lib/Sema/DelayedDiagnostic.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/SemaObjC/unguarded-availability.m

Index: test/SemaObjC/unguarded-availability.m
===
--- test/SemaObjC/unguarded-availability.m
+++ test/SemaObjC/unguarded-availability.m
@@ -63,7 +63,7 @@
 #ifdef OBJCPP
 // expected-note@+2 {{marked partial here}}
 #endif
-typedef int int_10_12 AVAILABLE_10_12; // expected-note 3 {{'int_10_12' has been explicitly marked partial here}}
+typedef int int_10_12 AVAILABLE_10_12; // expected-note 2 {{'int_10_12' has been explicitly marked partial here}}
 
 void use_typedef() {
   int_10_11 x; // expected-warning{{'int_10_11' is only available on macOS 10.11 or newer}} expected-note{{enclose 'int_10_11' in an @available check to silence this warning}}
@@ -127,8 +127,7 @@
 
 void test_params(int_10_12 x); // expected-warning {{'int_10_12' is partial: introduced in macOS 10.12}} expected-note{{redeclare}}
 
-// FIXME: This should be fine!
-void test_params2(int_10_12 x) AVAILABLE_10_12; // expected-warning {{'int_10_12' is partial: introduced in macOS 10.12}} expected-note{{redeclare}}
+void test_params2(int_10_12 x) AVAILABLE_10_12; // no warn
 
 #ifdef OBJCPP
 
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -6464,9 +6464,6 @@
 break;
 
   case AR_NotYetIntroduced:
-assert(!S.getCurFunctionOrMethodDecl() &&
-   "Function-level partial availablity should not be diagnosed here!");
-
 diag = diag::warn_partial_availability;
 diag_message = diag::warn_partial_message;
 diag_fwdclass_message = diag::warn_partial_fwdclass_message;
@@ -6539,15 +6536,14 @@
 
 static void handleDelayedAvailabilityCheck(Sema , DelayedDiagnostic ,
Decl *Ctx) {
-  assert(DD.Kind == DelayedDiagnostic::Deprecation ||
- DD.Kind == DelayedDiagnostic::Unavailable);
-  AvailabilityResult AR = DD.Kind == DelayedDiagnostic::Deprecation
-  ? AR_Deprecated
-  : AR_Unavailable;
+  assert(DD.Kind == DelayedDiagnostic::Availability &&
+ "Expected an availability diagnostic here");
+
   DD.Triggered = true;
-  DoEmitAvailabilityWarning(
-  S, AR, Ctx, DD.getDeprecationDecl(), DD.getDeprecationMessage(), DD.Loc,
-  DD.getUnknownObjCClass(), DD.getObjCProperty(), false);
+  DoEmitAvailabilityWarning(S, DD.getAvailabilityResult(), Ctx,
+DD.getDeprecationDecl(), DD.getDeprecationMessage(),
+DD.Loc, DD.getUnknownObjCClass(),
+DD.getObjCProperty(), false);
 }
 
 void Sema::PopParsingDeclaration(ParsingDeclState state, Decl *decl) {
@@ -6577,8 +6573,7 @@
 continue;
 
   switch (diag.Kind) {
-  case DelayedDiagnostic::Deprecation:
-  case DelayedDiagnostic::Unavailable:
+  case DelayedDiagnostic::Availability:
 // Don't bother giving deprecation/unavailable diagnostics if
 // the decl is invalid.
 if (!decl->isInvalidDecl())
@@ -6613,8 +6608,7 @@
const ObjCPropertyDecl  *ObjCProperty,
bool ObjCPropertyAccess) {
   // Delay if we're currently parsing a declaration.
-  if (DelayedDiagnostics.shouldDelayDiagnostics() &&
-  AR != AR_NotYetIntroduced) {
+  if (DelayedDiagnostics.shouldDelayDiagnostics()) {
 DelayedDiagnostics.add(DelayedDiagnostic::makeAvailability(
 AR, Loc, D, UnknownObjCClass, ObjCProperty, Message,
 ObjCPropertyAccess));
Index: lib/Sema/DelayedDiagnostic.cpp
===
--- lib/Sema/DelayedDiagnostic.cpp
+++ lib/Sema/DelayedDiagnostic.cpp
@@ -20,24 +20,15 @@
 using namespace sema;
 
 DelayedDiagnostic
-DelayedDiagnostic::makeAvailability(AvailabilityResult AD,
+DelayedDiagnostic::makeAvailability(AvailabilityResult AR,
 SourceLocation Loc,
 const NamedDecl *D,
 

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

2016-10-05 Thread Erik Pilkington via cfe-commits
erik.pilkington created this revision.
erik.pilkington added a reviewer: manmanren.
erik.pilkington added a subscriber: cfe-commits.

This patch removes some redundant functions that implement checking 
availability against context, and implements a new, more correct one: 
`ShouldDiagnoseAvailabilityInContext`. This is done to more easily allow 
delaying `AD_NotYetIntroduced` diagnostics, which is a patch I'll submit right 
after this!

As it happens, this fixes a bug:

  int unavailable_global __attribute__((unavailable));
  
  __attribute__((unavailable))
  @interface Foo
  - meth;
  @end
  
  @implementation Foo
  - meth {
(void) unavailable_global; // no error
(void) ^{
  (void) unavailable_global; // incorrect-error: 'unavailable_global' is 
not available
};
  }
  @end

Here, there is a reference to an unavailable declaration, `unavailable`, in the 
context of a block. We shouldn't emit an error here because 'meth' is 
implicitly unavailable, meaning that we should be able to reference other 
unavailable declarations inside it

The problem is that, though both `isDeclUnavailable()` and 
`getCurContextAvailability()` check the reference to `unavailable_global`, 
`isDeclUnavailable` doesn't infer availability attributes from @interface to 
@implementation (But does consider nested contexts), and 
`getCurContextAvailability()` doesn't consider non-immediate contexts (But does 
infer from @interface -> @implementation). Since they both don't catch this 
case, this error is emitted when it really shouldn't be!

Thanks for taking a look!


https://reviews.llvm.org/D25283

Files:
  include/clang/Sema/Sema.h
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclAttr.cpp
  lib/Sema/SemaExpr.cpp
  test/SemaObjC/class-unavail-warning.m

Index: test/SemaObjC/class-unavail-warning.m
===
--- test/SemaObjC/class-unavail-warning.m
+++ test/SemaObjC/class-unavail-warning.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1  -fsyntax-only  -triple x86_64-apple-darwin10 -verify %s
+// RUN: %clang_cc1  -fsyntax-only -fblocks -triple x86_64-apple-darwin10 -verify %s
 // rdar://9092208
 
 __attribute__((unavailable("not available")))
@@ -98,3 +98,19 @@
 @end
 @interface UnavailSub(cat) // no error
 @end
+
+int unavail_global UNAVAILABLE;
+
+UNAVAILABLE __attribute__((objc_root_class))
+@interface TestAttrContext
+-meth;
+@end
+
+@implementation TestAttrContext
+-meth {
+  unavail_global = 2; // no warn
+  (void) ^{
+unavail_global = 4; // no warn
+  };
+}
+@end
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -103,17 +103,17 @@
   return false;
 }
 
-AvailabilityResult Sema::ShouldDiagnoseAvailabilityOfDecl(
-NamedDecl *, VersionTuple ContextVersion, std::string *Message) {
-  AvailabilityResult Result = D->getAvailability(Message, ContextVersion);
+AvailabilityResult
+Sema::ShouldDiagnoseAvailabilityOfDecl(NamedDecl *, std::string *Message) {
+  AvailabilityResult Result = D->getAvailability(Message);
 
   // For typedefs, if the typedef declaration appears available look
   // to the underlying type to see if it is more restrictive.
   while (const TypedefNameDecl *TD = dyn_cast(D)) {
 if (Result == AR_Available) {
   if (const TagType *TT = TD->getUnderlyingType()->getAs()) {
 D = TT->getDecl();
-Result = D->getAvailability(Message, ContextVersion);
+Result = D->getAvailability(Message);
 continue;
   }
 }
@@ -124,26 +124,18 @@
   if (ObjCInterfaceDecl *IDecl = dyn_cast(D)) {
 if (IDecl->getDefinition()) {
   D = IDecl->getDefinition();
-  Result = D->getAvailability(Message, ContextVersion);
+  Result = D->getAvailability(Message);
 }
   }
 
   if (const EnumConstantDecl *ECD = dyn_cast(D))
 if (Result == AR_Available) {
   const DeclContext *DC = ECD->getDeclContext();
   if (const EnumDecl *TheEnumDecl = dyn_cast(DC))
-Result = TheEnumDecl->getAvailability(Message, ContextVersion);
+Result = TheEnumDecl->getAvailability(Message);
 }
 
-  switch (Result) {
-  case AR_Available:
-return Result;
-
-  case AR_Unavailable:
-  case AR_Deprecated:
-return getCurContextAvailability() != Result ? Result : AR_Available;
-
-  case AR_NotYetIntroduced: {
+  if (Result == AR_NotYetIntroduced) {
 // Don't do this for enums, they can't be redeclared.
 if (isa(D) || isa(D))
   return AR_Available;
@@ -166,23 +158,18 @@
 
 return Warn ? AR_NotYetIntroduced : AR_Available;
   }
-  }
-  llvm_unreachable("Unknown availability result!");
+
+  return Result;
 }
 
 static void
 DiagnoseAvailabilityOfDecl(Sema , NamedDecl *D, SourceLocation Loc,
const ObjCInterfaceDecl *UnknownObjCClass,
bool ObjCPropertyAccess) {
-  VersionTuple ContextVersion;
-  if (const DeclContext *DC = 

[PATCH] D24562: [libcxx] Recover no-exceptions XFAILs

2016-10-05 Thread Asiri Rathnayake via cfe-commits
rmaprath updated this revision to Diff 73661.
rmaprath added a comment.

First batch of XFAIL fixes.

I've changed some XFAILs to UNSUPPORTED where the test is all about exception 
handling. In other cases, I've used the test macro TEST_HAS_NO_EXCEPTIONS to 
conditionally exclude those parts that test
exception handling behaviour.

@EricWF: I can create a separate review if necessary, thought I'll re-use this 
review for the first batch, will be opening new reviews for the follow-ups.

/ Asiri


https://reviews.llvm.org/D24562

Files:
  test/std/re/re.alg/re.alg.search/grep.pass.cpp
  test/std/re/re.regex/re.regex.assign/assign.pass.cpp
  test/std/re/re.regex/re.regex.construct/bad_escape.pass.cpp
  test/std/re/re.regex/re.regex.construct/bad_repeat.pass.cpp
  test/std/thread/futures/futures.async/async.pass.cpp
  test/std/thread/futures/futures.promise/dtor.pass.cpp
  test/std/thread/futures/futures.promise/get_future.pass.cpp
  test/std/thread/futures/futures.promise/move_ctor.pass.cpp
  test/std/thread/futures/futures.promise/set_exception.pass.cpp
  test/std/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp
  test/std/thread/futures/futures.promise/set_lvalue.pass.cpp
  test/std/thread/futures/futures.promise/set_value_const.pass.cpp
  test/std/thread/futures/futures.promise/set_value_void.pass.cpp
  test/std/thread/futures/futures.shared_future/get.pass.cpp
  test/std/thread/futures/futures.task/futures.task.members/dtor.pass.cpp
  test/std/thread/futures/futures.task/futures.task.members/get_future.pass.cpp
  
test/std/thread/futures/futures.task/futures.task.members/make_ready_at_thread_exit.pass.cpp
  test/std/thread/futures/futures.task/futures.task.members/operator.pass.cpp
  test/std/thread/futures/futures.task/futures.task.members/reset.pass.cpp
  test/std/thread/futures/futures.unique_future/get.pass.cpp
  
test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp

Index: test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp
===
--- test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp
+++ test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp
@@ -7,7 +7,6 @@
 //
 //===--===//
 //
-// XFAIL: libcpp-no-exceptions
 // UNSUPPORTED: libcpp-has-no-threads
 
 // 
@@ -32,9 +31,11 @@
 
 void* operator new(std::size_t s) throw(std::bad_alloc)
 {
+#ifndef TEST_HAS_NO_EXCEPTIONS
 if (throw_one == 0)
 throw std::bad_alloc();
 --throw_one;
+#endif
 ++outstanding_new;
 void* ret = std::malloc(s);
 if (!ret) std::abort(); // placate MSVC's unchecked malloc warning
@@ -118,6 +119,7 @@
 //  3 Finally check that a thread runs successfully if we throw after 'N+1'
 //allocations.
 void test_throwing_new_during_thread_creation() {
+#ifndef TEST_HAS_NO_EXCEPTIONS
 throw_one = 0xFFF;
 {
 std::thread t(f);
@@ -142,6 +144,7 @@
 }
 f_run = false;
 throw_one = 0xFFF;
+#endif
 }
 
 int main()
@@ -162,6 +165,7 @@
 assert(G::op_run);
 }
 G::op_run = false;
+#ifndef TEST_HAS_NO_EXCEPTIONS
 {
 try
 {
@@ -178,6 +182,7 @@
 assert(!G::op_run);
 }
 }
+#endif
 #if TEST_STD_VER >= 11
 {
 assert(G::n_alive == 0);
Index: test/std/thread/futures/futures.unique_future/get.pass.cpp
===
--- test/std/thread/futures/futures.unique_future/get.pass.cpp
+++ test/std/thread/futures/futures.unique_future/get.pass.cpp
@@ -7,7 +7,6 @@
 //
 //===--===//
 //
-// XFAIL: libcpp-no-exceptions
 // UNSUPPORTED: libcpp-has-no-threads
 // UNSUPPORTED: c++98, c++03
 
@@ -22,6 +21,8 @@
 #include 
 #include 
 
+#include "test_macros.h"
+
 void func1(std::promise p)
 {
 std::this_thread::sleep_for(std::chrono::milliseconds(500));
@@ -73,6 +74,7 @@
 assert(f.get() == 3);
 assert(!f.valid());
 }
+#ifndef TEST_HAS_NO_EXCEPTIONS
 {
 std::promise p;
 std::future f = p.get_future();
@@ -89,6 +91,7 @@
 }
 assert(!f.valid());
 }
+#endif
 }
 {
 typedef int& T;
@@ -100,6 +103,7 @@
 assert(f.get() == 5);
 assert(!f.valid());
 }
+#ifndef TEST_HAS_NO_EXCEPTIONS
 {
 std::promise p;
 std::future f = p.get_future();
@@ -116,6 +120,7 @@
 }
 assert(!f.valid());
 }
+#endif
 }
 {
 typedef void T;
@@ -127,6 +132,7 @@
 f.get();
 assert(!f.valid());
 }
+#ifndef TEST_HAS_NO_EXCEPTIONS
 {
 std::promise p;
 std::future f = p.get_future();
@@ -143,5 +149,6 @@
 }

[PATCH] D25282: [clang-move] Cleanup around replacements.

2016-10-05 Thread Haojian Wu via cfe-commits
hokein created this revision.
hokein added a reviewer: ioeric.
hokein added a subscriber: cfe-commits.

cleanup the remaining empty namespace after moving out the
class defintitions.


https://reviews.llvm.org/D25282

Files:
  clang-move/ClangMove.cpp
  clang-move/ClangMove.h
  clang-move/tool/ClangMoveMain.cpp
  test/clang-move/move-class.cpp
  unittests/clang-move/ClangMoveTests.cpp

Index: unittests/clang-move/ClangMoveTests.cpp
===
--- unittests/clang-move/ClangMoveTests.cpp
+++ unittests/clang-move/ClangMoveTests.cpp
@@ -161,7 +161,7 @@
   assert(!EC);
   (void)EC;
   auto Factory = llvm::make_unique(
-  Spec, FileToReplacements, InitialDirectory.str());
+  Spec, FileToReplacements, InitialDirectory.str(), "LLVM");
 
   tooling::runToolOnCodeWithArgs(
   Factory->create(), TestCC, {"-std=c++11"}, TestCCName, "clang-move",
Index: test/clang-move/move-class.cpp
===
--- test/clang-move/move-class.cpp
+++ test/clang-move/move-class.cpp
@@ -7,15 +7,15 @@
 // RUN: FileCheck -input-file=%T/clang-move/new_test.cpp -check-prefix=CHECK-NEW-TEST-CPP %s
 // RUN: FileCheck -input-file=%T/clang-move/new_test.h -check-prefix=CHECK-NEW-TEST-H %s
 // RUN: FileCheck -input-file=%T/clang-move/test.cpp -check-prefix=CHECK-OLD-TEST-CPP %s
-// RUN: FileCheck -input-file=%T/clang-move/test.h -check-prefix=CHECK-OLD-TEST-H %s
+// RUN: FileCheck -input-file=%T/clang-move/test.h %s -implicit-check-not='{{namespace.*}}'
 //
 // RUN: cp %S/Inputs/test*  %T/clang-move/
 // RUN: cd %T/clang-move
 // RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=%T/clang-move/test.cpp -old_header=%T/clang-move/test.h %T/clang-move/test.cpp
 // RUN: FileCheck -input-file=%T/clang-move/new_test.cpp -check-prefix=CHECK-NEW-TEST-CPP %s
 // RUN: FileCheck -input-file=%T/clang-move/new_test.h -check-prefix=CHECK-NEW-TEST-H %s
 // RUN: FileCheck -input-file=%T/clang-move/test.cpp -check-prefix=CHECK-OLD-TEST-CPP %s
-// RUN: FileCheck -input-file=%T/clang-move/test.h -check-prefix=CHECK-OLD-TEST-H %s
+// RUN: FileCheck -input-file=%T/clang-move/test.h %s -implicit-check-not='{{namespace.*}}'
 //
 // CHECK-NEW-TEST-H: namespace a {
 // CHECK-NEW-TEST-H: class Foo {
@@ -30,10 +30,5 @@
 // CHECK-NEW-TEST-CPP: int Foo::f() { return 0; }
 // CHECK-NEW-TEST-CPP: } // namespace a
 //
-// CHECK-OLD-TEST-H: namespace a {
-// CHECK-OLD-TEST-H: } // namespace a
-//
 // CHECK-OLD-TEST-CPP: #include "test.h"
 // CHECK-OLD-TEST-CPP: #include "test2.h"
-// CHECK-OLD-TEST-CPP: namespace a {
-// CHECK-OLD-TEST-CPP: } // namespace a
Index: clang-move/tool/ClangMoveMain.cpp
===
--- clang-move/tool/ClangMoveMain.cpp
+++ clang-move/tool/ClangMoveMain.cpp
@@ -86,7 +86,7 @@
  Twine(EC.message()));
 
   auto Factory = llvm::make_unique(
-  Spec, Tool.getReplacements(), InitialDirectory.str());
+  Spec, Tool.getReplacements(), InitialDirectory.str(), Style);
 
   int CodeStatus = Tool.run(Factory.get());
   if (CodeStatus)
Index: clang-move/ClangMove.h
===
--- clang-move/ClangMove.h
+++ clang-move/ClangMove.h
@@ -50,7 +50,7 @@
   ClangMoveTool(
   const MoveDefinitionSpec ,
   std::map ,
-  llvm::StringRef OriginalRunningDirectory);
+  llvm::StringRef OriginalRunningDirectory, llvm::StringRef Style);
 
   void registerMatchers(ast_matchers::MatchFinder *Finder);
 
@@ -95,15 +95,18 @@
   // directory when analyzing the source file. We save the original working
   // directory in order to get the absolute file path for the fields in Spec.
   std::string OriginalRunningDirectory;
+  // The name of a predefined code style.
+  std::string FallbackStyle;
 };
 
 class ClangMoveAction : public clang::ASTFrontendAction {
 public:
   ClangMoveAction(
   const ClangMoveTool::MoveDefinitionSpec ,
   std::map ,
-  llvm::StringRef OriginalRunningDirectory)
-  : MoveTool(spec, FileToReplacements, OriginalRunningDirectory) {
+  llvm::StringRef OriginalRunningDirectory, llvm::StringRef FallbackStyle)
+  : MoveTool(spec, FileToReplacements, OriginalRunningDirectory,
+ FallbackStyle) {
 MoveTool.registerMatchers();
   }
 
@@ -123,18 +126,21 @@
   ClangMoveActionFactory(
   const ClangMoveTool::MoveDefinitionSpec ,
   std::map ,
-  llvm::StringRef OriginalRunningDirectory)
+  llvm::StringRef OriginalRunningDirectory, llvm::StringRef FallbackStyle)
   : Spec(Spec), FileToReplacements(FileToReplacements),
-OriginalRunningDirectory(OriginalRunningDirectory) {}
+OriginalRunningDirectory(OriginalRunningDirectory),
+

[PATCH] D25264: Implement MS _BitScan intrinsics

2016-10-05 Thread Albert Gutowski via cfe-commits
agutowski added inline comments.


> majnemer wrote in CGBuiltin.cpp:2640-2647
> This should be in an anonymous namespace. Also, consider using an `enum 
> class` instead of an `enum` nested inside a namespace.

I can see three options:
 (1) put the existing code inside an anonymous namespace;
 (2) create a private enum class in CodeGenFunction;
 (3) pull EmitMSVCBuiltinExpr outside of CodeGenFunction and take CGF object as 
an argument (and then make enum class inside an anonymous namespace);
I don't really like any of them. Enum class sounds nice as I can imagine 
someone trying to pass the global builtin ID (like X86::BI_BitScanForward) 
instead of the one from MSVCIntrin namespace (although it should fail on any 
test; still, it would compile without enum class). But builtins use CGF methods 
all of the time, so pulling it out will make the code of every bulitin uglier. 
So I guess I'll try to go with the private enum class inside the 
CodeGenFunction, but if you have any better ideas, I'm eager to listen.

https://reviews.llvm.org/D25264



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


[PATCH] D25264: Implement MS _BitScan intrinsics

2016-10-05 Thread Reid Kleckner via cfe-commits
rnk added a comment.

Nice, probably ready to land with one revision.



> majnemer wrote in CGBuiltin.cpp:2640-2647
> This should be in an anonymous namespace. Also, consider using an `enum 
> class` instead of an `enum` nested inside a namespace.

Let's also use a more specific name than MSVC, maybe MSVCIntrin or something.

https://reviews.llvm.org/D25264



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


Re: [PATCH] D25254: test-suite: Change extension used for reference outputs by Makefile-based harness so we can start improving how the CMake-based harness works without breaking the old system or the

2016-10-05 Thread Abe Skolnik via cfe-commits

Can you expand on how you plan to add the second set of reference outputs?


I plan to {either re-target or replace with normal files} the new symlinks in upcoming patches. 
 The patch proposal to which you referred in the above is just "stage 1" of a large clean-up. 
We [Sebastian and I] have CMake code in progress that will significantly improve the harness 
WRT reference outputs.




We already have multiple reference outputs, for example big endian vs. little 
endian.


Yes.  I have noticed that, and made appropriate use of it in the WIP CMake code.  That CMake 
code is not yet ready for general inspection, but if anybody reading this wants to read what`s 
new in the WIP then please send me an e-mail about that.




I was expecting you to have done a similar thing, which doesn't involve 
changing every single reference file. :)


1: I _am_ doing a "similar thing", but it is not yet ready for general inspection.  In my WIP 
check-out of "test-suite" much is currently broken, waiting for me to fix it as part of my work 
[e.g. half-done fixes and improvements].  I`m reasonably sure the already-proposed patch is 
free of new breakage.


2: I didn`t change _any_ reference files in the patch proposal to which you referred in the 
above; I simply changed what the Makefile harness demands in terms of its reference-output 
pathnames, and added symlinks to the then-current reference output pathnames so that the 
Makefile harness won`t break.


The objective of the preceding, as I mentioned earlier, is to enable us all to fix/improve the 
CMake harness without breaking the Makefile harness.




One way this could be simpler is to change the Makefile on each affected 
directories to duplicate the tests & check differently
 against the reference file. It can be the same reference, but with different thresholds for 

different fp-contract options.

A key motivation in the relevant proposed patch is to change the Makefile harness as _little_ 
as _possible_.  We [SP & I] are not planning to improve the Makefile harness except in such a 
way as to make it "get out of the way" of the modern harness [as in the proposed patch 
currently under discussion].


If the Makefile harness is going to be completely-unneeded extremely soon, then a valid 
alternative is to just delete all files in the repo that are only there for the benefit of the 
Makefile harness and to cease assuming that we need to preserve backwards compatibility.  That 
would make the relevant proposed patch obsolete.


Regards,

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


[PATCH] D25065: [change-namespace] Fixed a bug in getShortestQualifiedNameInNamespace.

2016-10-05 Thread Eric Liu via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL28: [change-namespace] Fixed a bug in 
getShortestQualifiedNameInNamespace. (authored by ioeric).

Changed prior to commit:
  https://reviews.llvm.org/D25065?vs=73459=73653#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25065

Files:
  clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp
  clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp


Index: 
clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp
===
--- clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp
+++ clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp
@@ -113,6 +113,24 @@
   EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code));
 }
 
+TEST_F(ChangeNamespaceTest, MoveIntoAnotherNestedNamespaceWithRef) {
+  NewNamespace = "na::nc";
+  std::string Code = "namespace na {\n"
+ "class A {};\n"
+ "namespace nb {\n"
+ "class X { A a; };\n"
+ "} // namespace nb\n"
+ "} // namespace na\n";
+  std::string Expected = "namespace na {\n"
+ "class A {};\n"
+ "\n"
+ "namespace nc {\n"
+ "class X { A a; };\n"
+ "} // namespace nc\n"
+ "} // namespace na\n";
+  EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code));
+}
+
 TEST_F(ChangeNamespaceTest, SimpleMoveNestedNamespace) {
   NewNamespace = "na::x::y";
   std::string Code = "namespace na {\n"
Index: clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp
===
--- clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp
+++ clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp
@@ -173,21 +173,24 @@
 // Returns the shortest qualified name for declaration `DeclName` in the
 // namespace `NsName`. For example, if `DeclName` is "a::b::X" and `NsName`
 // is "a::c::d", then "b::X" will be returned.
+// \param DeclName A fully qualified name, "::a::b::X" or "a::b::X".
+// \param NsName A fully qualified name, "::a::b" or "a::b". Global namespace
+//will have empty name.
 std::string getShortestQualifiedNameInNamespace(llvm::StringRef DeclName,
 llvm::StringRef NsName) {
-  llvm::SmallVector DeclNameSplitted;
-  DeclName.split(DeclNameSplitted, "::");
-  if (DeclNameSplitted.size() == 1)
-return DeclName;
-  const auto UnqualifiedName = DeclNameSplitted.back();
-  while (true) {
+  DeclName = DeclName.ltrim(':');
+  NsName = NsName.ltrim(':');
+  // If `DeclName` is a global variable, we prepend "::" to it if it is not in
+  // the global namespace.
+  if (DeclName.find(':') == llvm::StringRef::npos)
+return NsName.empty() ? DeclName.str() : ("::" + DeclName).str();
+
+  while (!DeclName.consume_front((NsName + "::").str())) {
 const auto Pos = NsName.find_last_of(':');
 if (Pos == llvm::StringRef::npos)
   return DeclName;
-const auto Prefix = NsName.substr(0, Pos - 1);
-if (DeclName.startswith(Prefix))
-  return (Prefix + "::" + UnqualifiedName).str();
-NsName = Prefix;
+assert(Pos > 0);
+NsName = NsName.substr(0, Pos - 1);
   }
   return DeclName;
 }


Index: clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp
===
--- clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp
+++ clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp
@@ -113,6 +113,24 @@
   EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code));
 }
 
+TEST_F(ChangeNamespaceTest, MoveIntoAnotherNestedNamespaceWithRef) {
+  NewNamespace = "na::nc";
+  std::string Code = "namespace na {\n"
+ "class A {};\n"
+ "namespace nb {\n"
+ "class X { A a; };\n"
+ "} // namespace nb\n"
+ "} // namespace na\n";
+  std::string Expected = "namespace na {\n"
+ "class A {};\n"
+ "\n"
+ "namespace nc {\n"
+ "class X { A a; };\n"
+ "} // namespace nc\n"
+ "} // namespace na\n";
+  EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code));
+}
+
 TEST_F(ChangeNamespaceTest, SimpleMoveNestedNamespace) {
   NewNamespace = "na::x::y";
   std::string Code = "namespace na {\n"
Index: clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp
===
--- clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp
+++ 

[PATCH] D25264: Implement MS _BitScan intrinsics

2016-10-05 Thread Albert Gutowski via cfe-commits
agutowski added inline comments.


> majnemer wrote in CGBuiltin.cpp:2656-2684
> Does this do the right thing if the arg is zero?  I think it would if you 
> gave the call to the intrinsic an operand of false instead of true.

MSDN doesn't specify what should be put under the "Index" address when the 
argument is zero; as I checked, VS2015 with optimizations puts undefined value 
there, and I hope that's what I'm doing here.

https://reviews.llvm.org/D25264



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


[clang-tools-extra] r283333 - [change-namespace] Fixed a bug in getShortestQualifiedNameInNamespace.

2016-10-05 Thread Eric Liu via cfe-commits
Author: ioeric
Date: Wed Oct  5 10:52:39 2016
New Revision: 28

URL: http://llvm.org/viewvc/llvm-project?rev=28=rev
Log:
[change-namespace] Fixed a bug in getShortestQualifiedNameInNamespace.

Reviewers: hokein

Subscribers: cfe-commits

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

Modified:
clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp
clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp

Modified: clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp?rev=28=283332=28=diff
==
--- clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp (original)
+++ clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp Wed Oct  5 
10:52:39 2016
@@ -173,21 +173,24 @@ tooling::Replacement createInsertion(Sou
 // Returns the shortest qualified name for declaration `DeclName` in the
 // namespace `NsName`. For example, if `DeclName` is "a::b::X" and `NsName`
 // is "a::c::d", then "b::X" will be returned.
+// \param DeclName A fully qualified name, "::a::b::X" or "a::b::X".
+// \param NsName A fully qualified name, "::a::b" or "a::b". Global namespace
+//will have empty name.
 std::string getShortestQualifiedNameInNamespace(llvm::StringRef DeclName,
 llvm::StringRef NsName) {
-  llvm::SmallVector DeclNameSplitted;
-  DeclName.split(DeclNameSplitted, "::");
-  if (DeclNameSplitted.size() == 1)
-return DeclName;
-  const auto UnqualifiedName = DeclNameSplitted.back();
-  while (true) {
+  DeclName = DeclName.ltrim(':');
+  NsName = NsName.ltrim(':');
+  // If `DeclName` is a global variable, we prepend "::" to it if it is not in
+  // the global namespace.
+  if (DeclName.find(':') == llvm::StringRef::npos)
+return NsName.empty() ? DeclName.str() : ("::" + DeclName).str();
+
+  while (!DeclName.consume_front((NsName + "::").str())) {
 const auto Pos = NsName.find_last_of(':');
 if (Pos == llvm::StringRef::npos)
   return DeclName;
-const auto Prefix = NsName.substr(0, Pos - 1);
-if (DeclName.startswith(Prefix))
-  return (Prefix + "::" + UnqualifiedName).str();
-NsName = Prefix;
+assert(Pos > 0);
+NsName = NsName.substr(0, Pos - 1);
   }
   return DeclName;
 }

Modified: 
clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp?rev=28=283332=28=diff
==
--- clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp 
(original)
+++ clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp 
Wed Oct  5 10:52:39 2016
@@ -113,6 +113,24 @@ TEST_F(ChangeNamespaceTest, SimpleMoveIn
   EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code));
 }
 
+TEST_F(ChangeNamespaceTest, MoveIntoAnotherNestedNamespaceWithRef) {
+  NewNamespace = "na::nc";
+  std::string Code = "namespace na {\n"
+ "class A {};\n"
+ "namespace nb {\n"
+ "class X { A a; };\n"
+ "} // namespace nb\n"
+ "} // namespace na\n";
+  std::string Expected = "namespace na {\n"
+ "class A {};\n"
+ "\n"
+ "namespace nc {\n"
+ "class X { A a; };\n"
+ "} // namespace nc\n"
+ "} // namespace na\n";
+  EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code));
+}
+
 TEST_F(ChangeNamespaceTest, SimpleMoveNestedNamespace) {
   NewNamespace = "na::x::y";
   std::string Code = "namespace na {\n"


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


[PATCH] D25162: Make DeletedLines local variables in checkEmptyNamespace.

2016-10-05 Thread Eric Liu via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL283332: Make DeletedLines local variables in 
checkEmptyNamespace. (authored by ioeric).

Changed prior to commit:
  https://reviews.llvm.org/D25162?vs=73641=73652#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25162

Files:
  cfe/trunk/lib/Format/Format.cpp
  cfe/trunk/unittests/Format/CleanupTest.cpp


Index: cfe/trunk/lib/Format/Format.cpp
===
--- cfe/trunk/lib/Format/Format.cpp
+++ cfe/trunk/lib/Format/Format.cpp
@@ -1041,11 +1041,12 @@
 
   // Iterate through all lines and remove any empty (nested) namespaces.
   void checkEmptyNamespace(SmallVectorImpl ) {
+std::set DeletedLines;
 for (unsigned i = 0, e = AnnotatedLines.size(); i != e; ++i) {
   auto  = *AnnotatedLines[i];
   if (Line.startsWith(tok::kw_namespace) ||
   Line.startsWith(tok::kw_inline, tok::kw_namespace)) {
-checkEmptyNamespace(AnnotatedLines, i, i);
+checkEmptyNamespace(AnnotatedLines, i, i, DeletedLines);
   }
 }
 
@@ -1063,7 +1064,8 @@
   // sets \p NewLine to the last line checked.
   // Returns true if the current namespace is empty.
   bool checkEmptyNamespace(SmallVectorImpl ,
-   unsigned CurrentLine, unsigned ) {
+   unsigned CurrentLine, unsigned ,
+   std::set ) {
 unsigned InitLine = CurrentLine, End = AnnotatedLines.size();
 if (Style.BraceWrapping.AfterNamespace) {
   // If the left brace is in a new line, we should consume it first so that
@@ -1083,7 +1085,8 @@
   if (AnnotatedLines[CurrentLine]->startsWith(tok::kw_namespace) ||
   AnnotatedLines[CurrentLine]->startsWith(tok::kw_inline,
   tok::kw_namespace)) {
-if (!checkEmptyNamespace(AnnotatedLines, CurrentLine, NewLine))
+if (!checkEmptyNamespace(AnnotatedLines, CurrentLine, NewLine,
+ DeletedLines))
   return false;
 CurrentLine = NewLine;
 continue;
@@ -1208,8 +1211,6 @@
 
   // Tokens to be deleted.
   std::set DeletedTokens;
-  // The line numbers of lines to be deleted.
-  std::set DeletedLines;
 };
 
 struct IncludeDirective {
Index: cfe/trunk/unittests/Format/CleanupTest.cpp
===
--- cfe/trunk/unittests/Format/CleanupTest.cpp
+++ cfe/trunk/unittests/Format/CleanupTest.cpp
@@ -119,6 +119,24 @@
   EXPECT_EQ(Expected, Result);
 }
 
+TEST_F(CleanupTest, EmptyNamespaceAroundConditionalCompilation) {
+  std::string Code = "#ifdef A\n"
+ "int a;\n"
+ "int b;\n"
+ "#else\n"
+ "#endif\n"
+ "namespace {}";
+  std::string Expected = "#ifdef A\n"
+ "int a;\n"
+ "int b;\n"
+ "#else\n"
+ "#endif\n";
+  std::vector Ranges(1, tooling::Range(0, Code.size()));
+  FormatStyle Style = getLLVMStyle();
+  std::string Result = cleanup(Code, Ranges, Style);
+  EXPECT_EQ(Expected, Result);
+}
+
 TEST_F(CleanupTest, CtorInitializationSimpleRedundantComma) {
   std::string Code = "class A {\nA() : , {} };";
   std::string Expected = "class A {\nA()  {} };";


Index: cfe/trunk/lib/Format/Format.cpp
===
--- cfe/trunk/lib/Format/Format.cpp
+++ cfe/trunk/lib/Format/Format.cpp
@@ -1041,11 +1041,12 @@
 
   // Iterate through all lines and remove any empty (nested) namespaces.
   void checkEmptyNamespace(SmallVectorImpl ) {
+std::set DeletedLines;
 for (unsigned i = 0, e = AnnotatedLines.size(); i != e; ++i) {
   auto  = *AnnotatedLines[i];
   if (Line.startsWith(tok::kw_namespace) ||
   Line.startsWith(tok::kw_inline, tok::kw_namespace)) {
-checkEmptyNamespace(AnnotatedLines, i, i);
+checkEmptyNamespace(AnnotatedLines, i, i, DeletedLines);
   }
 }
 
@@ -1063,7 +1064,8 @@
   // sets \p NewLine to the last line checked.
   // Returns true if the current namespace is empty.
   bool checkEmptyNamespace(SmallVectorImpl ,
-   unsigned CurrentLine, unsigned ) {
+   unsigned CurrentLine, unsigned ,
+   std::set ) {
 unsigned InitLine = CurrentLine, End = AnnotatedLines.size();
 if (Style.BraceWrapping.AfterNamespace) {
   // If the left brace is in a new line, we should consume it first so that
@@ -1083,7 +1085,8 @@
   if (AnnotatedLines[CurrentLine]->startsWith(tok::kw_namespace) ||
   AnnotatedLines[CurrentLine]->startsWith(tok::kw_inline,
   tok::kw_namespace)) {
-if (!checkEmptyNamespace(AnnotatedLines, CurrentLine, NewLine))
+if 

r283332 - Make DeletedLines local variables in checkEmptyNamespace.

2016-10-05 Thread Eric Liu via cfe-commits
Author: ioeric
Date: Wed Oct  5 10:49:01 2016
New Revision: 283332

URL: http://llvm.org/viewvc/llvm-project?rev=283332=rev
Log:
Make DeletedLines local variables in checkEmptyNamespace.

Summary: Patch by Sam McCall!

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

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

Modified: cfe/trunk/lib/Format/Format.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=283332=283331=283332=diff
==
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Wed Oct  5 10:49:01 2016
@@ -1041,11 +1041,12 @@ private:
 
   // Iterate through all lines and remove any empty (nested) namespaces.
   void checkEmptyNamespace(SmallVectorImpl ) {
+std::set DeletedLines;
 for (unsigned i = 0, e = AnnotatedLines.size(); i != e; ++i) {
   auto  = *AnnotatedLines[i];
   if (Line.startsWith(tok::kw_namespace) ||
   Line.startsWith(tok::kw_inline, tok::kw_namespace)) {
-checkEmptyNamespace(AnnotatedLines, i, i);
+checkEmptyNamespace(AnnotatedLines, i, i, DeletedLines);
   }
 }
 
@@ -1063,7 +1064,8 @@ private:
   // sets \p NewLine to the last line checked.
   // Returns true if the current namespace is empty.
   bool checkEmptyNamespace(SmallVectorImpl ,
-   unsigned CurrentLine, unsigned ) {
+   unsigned CurrentLine, unsigned ,
+   std::set ) {
 unsigned InitLine = CurrentLine, End = AnnotatedLines.size();
 if (Style.BraceWrapping.AfterNamespace) {
   // If the left brace is in a new line, we should consume it first so that
@@ -1083,7 +1085,8 @@ private:
   if (AnnotatedLines[CurrentLine]->startsWith(tok::kw_namespace) ||
   AnnotatedLines[CurrentLine]->startsWith(tok::kw_inline,
   tok::kw_namespace)) {
-if (!checkEmptyNamespace(AnnotatedLines, CurrentLine, NewLine))
+if (!checkEmptyNamespace(AnnotatedLines, CurrentLine, NewLine,
+ DeletedLines))
   return false;
 CurrentLine = NewLine;
 continue;
@@ -1208,8 +1211,6 @@ private:
 
   // Tokens to be deleted.
   std::set DeletedTokens;
-  // The line numbers of lines to be deleted.
-  std::set DeletedLines;
 };
 
 struct IncludeDirective {

Modified: cfe/trunk/unittests/Format/CleanupTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/CleanupTest.cpp?rev=283332=283331=283332=diff
==
--- cfe/trunk/unittests/Format/CleanupTest.cpp (original)
+++ cfe/trunk/unittests/Format/CleanupTest.cpp Wed Oct  5 10:49:01 2016
@@ -119,6 +119,24 @@ TEST_F(CleanupTest, EmptyNamespaceWithCo
   EXPECT_EQ(Expected, Result);
 }
 
+TEST_F(CleanupTest, EmptyNamespaceAroundConditionalCompilation) {
+  std::string Code = "#ifdef A\n"
+ "int a;\n"
+ "int b;\n"
+ "#else\n"
+ "#endif\n"
+ "namespace {}";
+  std::string Expected = "#ifdef A\n"
+ "int a;\n"
+ "int b;\n"
+ "#else\n"
+ "#endif\n";
+  std::vector Ranges(1, tooling::Range(0, Code.size()));
+  FormatStyle Style = getLLVMStyle();
+  std::string Result = cleanup(Code, Ranges, Style);
+  EXPECT_EQ(Expected, Result);
+}
+
 TEST_F(CleanupTest, CtorInitializationSimpleRedundantComma) {
   std::string Code = "class A {\nA() : , {} };";
   std::string Expected = "class A {\nA()  {} };";


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


[libcxx] r283331 - Add another append test for basic_string

2016-10-05 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Oct  5 10:47:13 2016
New Revision: 283331

URL: http://llvm.org/viewvc/llvm-project?rev=283331=rev
Log:
Add another append test for basic_string

Modified:

libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp

Modified: 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp?rev=283331=283330=283331=diff
==
--- 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp
 Wed Oct  5 10:47:13 2016
@@ -164,6 +164,10 @@ int main()
 sv = s;
 s.append(sv, 0, std::string::npos);
 assert(s == "ABCDABCDABCDABCD");
+
+sv = s;
+s.append(sv, sv.size());
+assert(s == "ABCDABCDABCDABCD");
 }
 
 {


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


[PATCH] D21026: [clang-format] append newline after code when inserting new headers at the end of the code which does not end with newline.

2016-10-05 Thread Eric Liu via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL283330: [clang-format] append newline after code when 
inserting new headers at the end… (authored by ioeric).

Changed prior to commit:
  https://reviews.llvm.org/D21026?vs=73648=73651#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D21026

Files:
  cfe/trunk/lib/Format/Format.cpp
  cfe/trunk/unittests/Format/CleanupTest.cpp


Index: cfe/trunk/lib/Format/Format.cpp
===
--- cfe/trunk/lib/Format/Format.cpp
+++ cfe/trunk/lib/Format/Format.cpp
@@ -1662,6 +1662,7 @@
 if (CategoryEndOffsets.find(*I) == CategoryEndOffsets.end())
   CategoryEndOffsets[*I] = CategoryEndOffsets[*std::prev(I)];
 
+  bool NeedNewLineAtEnd = !Code.empty() && Code.back() != '\n';
   for (const auto  : HeaderInsertions) {
 auto IncludeDirective = R.getReplacementText();
 bool Matched = IncludeRegex.match(IncludeDirective, );
@@ -1680,10 +1681,18 @@
 std::string NewInclude = !IncludeDirective.endswith("\n")
  ? (IncludeDirective + "\n").str()
  : IncludeDirective.str();
+// When inserting headers at end of the code, also append '\n' to the code
+// if it does not end with '\n'.
+if (NeedNewLineAtEnd && Offset == Code.size()) {
+  NewInclude = "\n" + NewInclude;
+  NeedNewLineAtEnd = false;
+}
 auto NewReplace = tooling::Replacement(FileName, Offset, 0, NewInclude);
 auto Err = Result.add(NewReplace);
 if (Err) {
   llvm::consumeError(std::move(Err));
+  unsigned NewOffset = Result.getShiftedCodePosition(Offset);
+  NewReplace = tooling::Replacement(FileName, NewOffset, 0, NewInclude);
   Result = Result.merge(tooling::Replacements(NewReplace));
 }
   }
Index: cfe/trunk/unittests/Format/CleanupTest.cpp
===
--- cfe/trunk/unittests/Format/CleanupTest.cpp
+++ cfe/trunk/unittests/Format/CleanupTest.cpp
@@ -709,16 +709,24 @@
   EXPECT_EQ(Expected, apply(Code, Replaces));
 }
 
-// FIXME: although this case does not crash, the insertion is wrong. A '\n'
-// should be inserted between the two #includes.
 TEST_F(CleanUpReplacementsTest, NoNewLineAtTheEndOfCode) {
   std::string Code = "#include ";
-  std::string Expected = "#include #include \n";
+  std::string Expected = "#include \n#include \n";
   tooling::Replacements Replaces =
   toReplacements({createInsertion("#include ")});
   EXPECT_EQ(Expected, apply(Code, Replaces));
 }
 
+TEST_F(CleanUpReplacementsTest, NoNewLineAtTheEndOfCodeMultipleInsertions) {
+  std::string Code = "#include ";
+  std::string Expected =
+  "#include \n#include \n#include \n";
+  tooling::Replacements Replaces =
+  toReplacements({createInsertion("#include "),
+  createInsertion("#include ")});
+  EXPECT_EQ(Expected, apply(Code, Replaces));
+}
+
 TEST_F(CleanUpReplacementsTest, SkipExistingHeaders) {
   std::string Code = "#include \"a.h\"\n"
  "#include \n";


Index: cfe/trunk/lib/Format/Format.cpp
===
--- cfe/trunk/lib/Format/Format.cpp
+++ cfe/trunk/lib/Format/Format.cpp
@@ -1662,6 +1662,7 @@
 if (CategoryEndOffsets.find(*I) == CategoryEndOffsets.end())
   CategoryEndOffsets[*I] = CategoryEndOffsets[*std::prev(I)];
 
+  bool NeedNewLineAtEnd = !Code.empty() && Code.back() != '\n';
   for (const auto  : HeaderInsertions) {
 auto IncludeDirective = R.getReplacementText();
 bool Matched = IncludeRegex.match(IncludeDirective, );
@@ -1680,10 +1681,18 @@
 std::string NewInclude = !IncludeDirective.endswith("\n")
  ? (IncludeDirective + "\n").str()
  : IncludeDirective.str();
+// When inserting headers at end of the code, also append '\n' to the code
+// if it does not end with '\n'.
+if (NeedNewLineAtEnd && Offset == Code.size()) {
+  NewInclude = "\n" + NewInclude;
+  NeedNewLineAtEnd = false;
+}
 auto NewReplace = tooling::Replacement(FileName, Offset, 0, NewInclude);
 auto Err = Result.add(NewReplace);
 if (Err) {
   llvm::consumeError(std::move(Err));
+  unsigned NewOffset = Result.getShiftedCodePosition(Offset);
+  NewReplace = tooling::Replacement(FileName, NewOffset, 0, NewInclude);
   Result = Result.merge(tooling::Replacements(NewReplace));
 }
   }
Index: cfe/trunk/unittests/Format/CleanupTest.cpp
===
--- cfe/trunk/unittests/Format/CleanupTest.cpp
+++ cfe/trunk/unittests/Format/CleanupTest.cpp
@@ -709,16 +709,24 @@
   EXPECT_EQ(Expected, apply(Code, Replaces));
 }
 
-// FIXME: although this case does not crash, the insertion is wrong. A '\n'
-// should be inserted between the two #includes.
 TEST_F(CleanUpReplacementsTest, 

r283330 - [clang-format] append newline after code when inserting new headers at the end of the code which does not end with newline.

2016-10-05 Thread Eric Liu via cfe-commits
Author: ioeric
Date: Wed Oct  5 10:42:19 2016
New Revision: 283330

URL: http://llvm.org/viewvc/llvm-project?rev=283330=rev
Log:
[clang-format] append newline after code when inserting new headers at the end 
of the code which does not end with newline.

Summary:
append newline after code when inserting new headers at the end of the
code which does not end with newline.

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

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

Modified: cfe/trunk/lib/Format/Format.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=283330=283329=283330=diff
==
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Wed Oct  5 10:42:19 2016
@@ -1662,6 +1662,7 @@ fixCppIncludeInsertions(StringRef Code,
 if (CategoryEndOffsets.find(*I) == CategoryEndOffsets.end())
   CategoryEndOffsets[*I] = CategoryEndOffsets[*std::prev(I)];
 
+  bool NeedNewLineAtEnd = !Code.empty() && Code.back() != '\n';
   for (const auto  : HeaderInsertions) {
 auto IncludeDirective = R.getReplacementText();
 bool Matched = IncludeRegex.match(IncludeDirective, );
@@ -1680,10 +1681,18 @@ fixCppIncludeInsertions(StringRef Code,
 std::string NewInclude = !IncludeDirective.endswith("\n")
  ? (IncludeDirective + "\n").str()
  : IncludeDirective.str();
+// When inserting headers at end of the code, also append '\n' to the code
+// if it does not end with '\n'.
+if (NeedNewLineAtEnd && Offset == Code.size()) {
+  NewInclude = "\n" + NewInclude;
+  NeedNewLineAtEnd = false;
+}
 auto NewReplace = tooling::Replacement(FileName, Offset, 0, NewInclude);
 auto Err = Result.add(NewReplace);
 if (Err) {
   llvm::consumeError(std::move(Err));
+  unsigned NewOffset = Result.getShiftedCodePosition(Offset);
+  NewReplace = tooling::Replacement(FileName, NewOffset, 0, NewInclude);
   Result = Result.merge(tooling::Replacements(NewReplace));
 }
   }

Modified: cfe/trunk/unittests/Format/CleanupTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/CleanupTest.cpp?rev=283330=283329=283330=diff
==
--- cfe/trunk/unittests/Format/CleanupTest.cpp (original)
+++ cfe/trunk/unittests/Format/CleanupTest.cpp Wed Oct  5 10:42:19 2016
@@ -709,16 +709,24 @@ TEST_F(CleanUpReplacementsTest, EmptyCod
   EXPECT_EQ(Expected, apply(Code, Replaces));
 }
 
-// FIXME: although this case does not crash, the insertion is wrong. A '\n'
-// should be inserted between the two #includes.
 TEST_F(CleanUpReplacementsTest, NoNewLineAtTheEndOfCode) {
   std::string Code = "#include ";
-  std::string Expected = "#include #include \n";
+  std::string Expected = "#include \n#include \n";
   tooling::Replacements Replaces =
   toReplacements({createInsertion("#include ")});
   EXPECT_EQ(Expected, apply(Code, Replaces));
 }
 
+TEST_F(CleanUpReplacementsTest, NoNewLineAtTheEndOfCodeMultipleInsertions) {
+  std::string Code = "#include ";
+  std::string Expected =
+  "#include \n#include \n#include \n";
+  tooling::Replacements Replaces =
+  toReplacements({createInsertion("#include "),
+  createInsertion("#include ")});
+  EXPECT_EQ(Expected, apply(Code, Replaces));
+}
+
 TEST_F(CleanUpReplacementsTest, SkipExistingHeaders) {
   std::string Code = "#include \"a.h\"\n"
  "#include \n";


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


[PATCH] D25204: Register Calling Convention, Clang changes

2016-10-05 Thread Erich Keane via cfe-commits
erichkeane marked 9 inline comments as done.
erichkeane added inline comments.


> oren_ben_simhon wrote in AttrDocs.td:1267
> You might want to use the following link instead because it is most updated: 
> https://software.intel.com/en-us/node/693069

This has changed 2x since I started this project.  Is there a way to get a 
STABLE link?  I imagine that much of this documentation is filled with broken 
links (since MSDN breaks them constantly), but don't really want to add to it.

> oren_ben_simhon wrote in TargetInfo.cpp:3352
> According to the ABI, there are 12 free int regs for windows and 11 free int 
> regs for non-windows (linux, OSX, etc). Is that taken into account somewhere?

Yes.  There are separate ABIInfo types for windows.

> oren_ben_simhon wrote in TargetInfo.cpp:3732
> Maybe i misinterpret the comment, but AFAIK, RegCall gives us 16 SSE 
> registers for each (return values and passed arguments)

I'd misread that in the spec and Ried corrected my implementation below.  
Updating the comment.

> oren_ben_simhon wrote in regcall.c:26
> I see that expended structures don't get InReg attribute. IMHO, If you know 
> that the value should be saved in register then you InReg attribute should be 
> added.

I am not sure that is the case.  That behavior doesn't happen in vectorcall 
seemingly.

https://reviews.llvm.org/D25204



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


[PATCH] D24644: Pass -ffunction-sections/-fdata-sections along to gold-plugin

2016-10-05 Thread Eric Christopher via cfe-commits
echristo added a comment.

In https://reviews.llvm.org/D24644#562286, @mehdi_amini wrote:

> What about function attributes? Hey that's the trend :)
>  You could have a subset of the functions in their own sections but not all. 
> With LTO it means that you can disable this for a single input file.


True, but we'd need data attributes too for -fdata-sections. That's the main 
reason I haven't migrated the options out of TargetOptions and into the IR 
here. Rough sketch on module merge time: We'd probably want to error on 
functions/data that had separate section set in one module but not in another - 
there are a few ways to make that not error at link time, but at that point 
you're really relying on weird linker side effects and it's probably not what 
you intended anyhow.

-eric


https://reviews.llvm.org/D24644



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


[libcxx] r283325 - Mark LWG issues 2221, 2556 and 2589 as complete

2016-10-05 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Oct  5 10:21:11 2016
New Revision: 283325

URL: http://llvm.org/viewvc/llvm-project?rev=283325=rev
Log:
Mark LWG issues 2221, 2556 and 2589 as complete

Modified:
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=283325=283324=283325=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Wed Oct  5 10:21:11 2016
@@ -61,7 +61,7 @@
 
 http://wg21.link/LWG2062;>2062Effect 
contradictions w/o no-throw guarantee of std::function 
swapsIssaquah
 http://wg21.link/LWG2166;>2166Heap 
property underspecified?Issaquah
-http://wg21.link/LWG2221;>2221No 
formatted output operator for nullptrIssaquah
+http://wg21.link/LWG2221;>2221No 
formatted output operator for nullptrIssaquahPatch 
ready
 http://wg21.link/LWG2223;>2223shrink_to_fit effect on 
iterator validityIssaquah
 http://wg21.link/LWG2261;>2261Are 
containers required to use their 'pointer' type 
internally?Issaquah
 http://wg21.link/LWG2358;>2358Apparently-bogus definition of 
is_empty type traitIssaquah
@@ -79,14 +79,14 @@
 http://wg21.link/LWG2540;>2540unordered_multimap::insert 
hint iteratorIssaquah
 http://wg21.link/LWG2543;>2543LWG 2148 
(hash support for enum types) seems 
under-specifiedIssaquah
 http://wg21.link/LWG2544;>2544istreambuf_iterator(basic_streambuf* s) effects unclear when s is 0Issaquah
-http://wg21.link/LWG2556;>2556Wide 
contract for future::share()Issaquah
+http://wg21.link/LWG2556;>2556Wide 
contract for future::share()IssaquahPatch ready
 http://wg21.link/LWG2562;>2562Consistent 
total ordering of pointers by comparison 
functorsIssaquah
 http://wg21.link/LWG2567;>2567Specification of logical 
operator traits uses BaseCharacteristic, which is defined only for 
UnaryTypeTraits and BinaryTypeTraitsIssaquah
 http://wg21.link/LWG2569;>2569conjunction and disjunction 
requirements are too strictIssaquah
 http://wg21.link/LWG2570;>2570[fund.ts.v2] conjunction and 
disjunction requirements are too strictIssaquah
 http://wg21.link/LWG2578;>2578Iterator 
requirements should reference iterator traitsIssaquahNothing 
to do
 http://wg21.link/LWG2584;>2584 
ECMAScript IdentityEscape is ambiguousIssaquah
-http://wg21.link/LWG2589;>2589match_results can't satisfy 
the requirements of a containerIssaquah
+http://wg21.link/LWG2589;>2589match_results can't satisfy 
the requirements of a containerIssaquahNothing to do
 http://wg21.link/LWG2591;>2591std::function's member 
template target() should not lead to undefined 
behaviourIssaquah
 http://wg21.link/LWG2598;>2598addressof 
works on temporariesIssaquahPatch ready
 http://wg21.link/LWG2664;>2664operator/ 
(and other append) semantics not useful if argument has 
rootIssaquah
@@ -135,7 +135,7 @@
 
 2062 - 
 2166 - 
-2221 - 
+2221 - Patch and tests ready
 2223 - 
 2261 - 
 2358 - 
@@ -153,14 +153,14 @@
 2540 - 
 2543 - 
 2544 - 
-2556 - 
+2556 - Patch and tests ready
 2562 - 
 2567 - 
 2569 - 
 2570 - 
 2578 - This is just wording cleanup. 
 2584 - 
-2589 - 
+2589 - This is just wording cleanup. 
 2591 - 
 2598 - Patch and tests ready
 2664 - 
@@ -205,7 +205,7 @@
 2769 - 
 
 
-Last Updated: 4-Oct-2016
+Last Updated: 5-Oct-2016
 
 
 


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


[PATCH] D24644: Pass -ffunction-sections/-fdata-sections along to gold-plugin

2016-10-05 Thread Mehdi AMINI via cfe-commits
mehdi_amini added a comment.

What about function attributes? Hey that's the trend :)
You could have a subset of the functions in their own sections but not all. 
With LTO it means that you can disable this for a single input file.


https://reviews.llvm.org/D24644



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


[PATCH] D25162: Make DeletedLines local variables in checkEmptyNamespace.

2016-10-05 Thread Daniel Jasper via cfe-commits
djasper accepted this revision.
djasper added a comment.
This revision is now accepted and ready to land.

Looks good.


https://reviews.llvm.org/D25162



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


[PATCH] D24644: Pass -ffunction-sections/-fdata-sections along to gold-plugin

2016-10-05 Thread Eric Christopher via cfe-commits
echristo added a comment.

There are two things pushing and pulling here:

a) You want to be able to pass compiler code generation options at the time 
we're actually doing the code generation,
b) "Traditionally" we don't pass CFLAGS to the linker.

I think I'd like to see us passing more options down at code generation time 
and handling it explicitly. In particular for this we don't have the knowledge 
at link time of what was intended. Even if we only turn it on when we see 
-gc-sections we won't know if the programmer wants function and data sections 
or just the former. Or maybe they want function sections for some reason other 
than gc-sections.

In short, I'm more on the a) side here in what I want :)

To go to PR22999: I think it might be reasonable for the linker during code 
generation to turn on function/data-sections where it isn't reasonable for us 
to do so in the compiler. I can come up with weird cases to break it, but those 
are largely module level inline assembly.


https://reviews.llvm.org/D24644



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


[PATCH] D21026: [clang-format] append newline after code when inserting new headers at the end of the code which does not end with newline.

2016-10-05 Thread Daniel Jasper via cfe-commits
djasper accepted this revision.
djasper added a comment.
This revision is now accepted and ready to land.

Looks good.


https://reviews.llvm.org/D21026



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


[PATCH] D21026: [clang-format] append newline after code when inserting new headers at the end of the code which does not end with newline.

2016-10-05 Thread Eric Liu via cfe-commits
ioeric updated this revision to Diff 73648.
ioeric marked 2 inline comments as done.
ioeric added a comment.

- Merged with origin/master.
- Update newline insertion according to the new Replacements implementation.


https://reviews.llvm.org/D21026

Files:
  lib/Format/Format.cpp
  unittests/Format/CleanupTest.cpp


Index: unittests/Format/CleanupTest.cpp
===
--- unittests/Format/CleanupTest.cpp
+++ unittests/Format/CleanupTest.cpp
@@ -709,16 +709,24 @@
   EXPECT_EQ(Expected, apply(Code, Replaces));
 }
 
-// FIXME: although this case does not crash, the insertion is wrong. A '\n'
-// should be inserted between the two #includes.
 TEST_F(CleanUpReplacementsTest, NoNewLineAtTheEndOfCode) {
   std::string Code = "#include ";
-  std::string Expected = "#include #include \n";
+  std::string Expected = "#include \n#include \n";
   tooling::Replacements Replaces =
   toReplacements({createInsertion("#include ")});
   EXPECT_EQ(Expected, apply(Code, Replaces));
 }
 
+TEST_F(CleanUpReplacementsTest, NoNewLineAtTheEndOfCodeMultipleInsertions) {
+  std::string Code = "#include ";
+  std::string Expected =
+  "#include \n#include \n#include \n";
+  tooling::Replacements Replaces =
+  toReplacements({createInsertion("#include "),
+  createInsertion("#include ")});
+  EXPECT_EQ(Expected, apply(Code, Replaces));
+}
+
 TEST_F(CleanUpReplacementsTest, SkipExistingHeaders) {
   std::string Code = "#include \"a.h\"\n"
  "#include \n";
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -1662,6 +1662,7 @@
 if (CategoryEndOffsets.find(*I) == CategoryEndOffsets.end())
   CategoryEndOffsets[*I] = CategoryEndOffsets[*std::prev(I)];
 
+  bool NeedNewLineAtEnd = !Code.empty() && Code.back() != '\n';
   for (const auto  : HeaderInsertions) {
 auto IncludeDirective = R.getReplacementText();
 bool Matched = IncludeRegex.match(IncludeDirective, );
@@ -1680,10 +1681,18 @@
 std::string NewInclude = !IncludeDirective.endswith("\n")
  ? (IncludeDirective + "\n").str()
  : IncludeDirective.str();
+// When inserting headers at end of the code, also append '\n' to the code
+// if it does not end with '\n'.
+if (NeedNewLineAtEnd && Offset == Code.size()) {
+  NewInclude = "\n" + NewInclude;
+  NeedNewLineAtEnd = false;
+}
 auto NewReplace = tooling::Replacement(FileName, Offset, 0, NewInclude);
 auto Err = Result.add(NewReplace);
 if (Err) {
   llvm::consumeError(std::move(Err));
+  unsigned NewOffset = Result.getShiftedCodePosition(Offset);
+  NewReplace = tooling::Replacement(FileName, NewOffset, 0, NewInclude);
   Result = Result.merge(tooling::Replacements(NewReplace));
 }
   }


Index: unittests/Format/CleanupTest.cpp
===
--- unittests/Format/CleanupTest.cpp
+++ unittests/Format/CleanupTest.cpp
@@ -709,16 +709,24 @@
   EXPECT_EQ(Expected, apply(Code, Replaces));
 }
 
-// FIXME: although this case does not crash, the insertion is wrong. A '\n'
-// should be inserted between the two #includes.
 TEST_F(CleanUpReplacementsTest, NoNewLineAtTheEndOfCode) {
   std::string Code = "#include ";
-  std::string Expected = "#include #include \n";
+  std::string Expected = "#include \n#include \n";
   tooling::Replacements Replaces =
   toReplacements({createInsertion("#include ")});
   EXPECT_EQ(Expected, apply(Code, Replaces));
 }
 
+TEST_F(CleanUpReplacementsTest, NoNewLineAtTheEndOfCodeMultipleInsertions) {
+  std::string Code = "#include ";
+  std::string Expected =
+  "#include \n#include \n#include \n";
+  tooling::Replacements Replaces =
+  toReplacements({createInsertion("#include "),
+  createInsertion("#include ")});
+  EXPECT_EQ(Expected, apply(Code, Replaces));
+}
+
 TEST_F(CleanUpReplacementsTest, SkipExistingHeaders) {
   std::string Code = "#include \"a.h\"\n"
  "#include \n";
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -1662,6 +1662,7 @@
 if (CategoryEndOffsets.find(*I) == CategoryEndOffsets.end())
   CategoryEndOffsets[*I] = CategoryEndOffsets[*std::prev(I)];
 
+  bool NeedNewLineAtEnd = !Code.empty() && Code.back() != '\n';
   for (const auto  : HeaderInsertions) {
 auto IncludeDirective = R.getReplacementText();
 bool Matched = IncludeRegex.match(IncludeDirective, );
@@ -1680,10 +1681,18 @@
 std::string NewInclude = !IncludeDirective.endswith("\n")
  ? (IncludeDirective + "\n").str()
  : IncludeDirective.str();
+// When inserting headers at end of the code, also append '\n' 

[PATCH] D21026: [clang-format] append newline after code when inserting new headers at the end of the code which does not end with newline.

2016-10-05 Thread Eric Liu via cfe-commits
ioeric added a comment.

Sorry for the delay

I've updated the patch to work with the new tooling::Replacements.


https://reviews.llvm.org/D21026



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


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

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


> ahatanak wrote in SemaExpr.cpp:8787
> Is it possible to use ASTContext::getTypeSize here?

You are right.

https://reviews.llvm.org/D24669



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


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

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

https://reviews.llvm.org/D24669

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


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

[PATCH] D24085: arm: Fix ttype encoding assertion failure.

2016-10-05 Thread Marshall Clow via cfe-commits
mclow.lists added inline comments.


> cxa_personality.cpp:363
> +   "Unexpected TTypeEncoding");
>  (void)ttypeEncoding;
>  

It's not clear to me how this accomplishes what you want.
You're looking for `00/10/90`, right?  Why not just check for that?

Why are you anding with 0x0f ?
Before, this would pass only a single value - `DW_EH_PE_absptr` (aka 0)
With this change, it passes 32 values: 00, 03, 10, 13, 20, 23, and so on.

Was that your intent?

https://reviews.llvm.org/D24085



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


[PATCH] D25162: Make DeletedLines local variables in checkEmptyNamespace.

2016-10-05 Thread Eric Liu via cfe-commits
ioeric updated this revision to Diff 73641.
ioeric added a comment.

- Added a test case.


https://reviews.llvm.org/D25162

Files:
  lib/Format/Format.cpp
  unittests/Format/CleanupTest.cpp


Index: unittests/Format/CleanupTest.cpp
===
--- unittests/Format/CleanupTest.cpp
+++ unittests/Format/CleanupTest.cpp
@@ -119,6 +119,24 @@
   EXPECT_EQ(Expected, Result);
 }
 
+TEST_F(CleanupTest, EmptyNamespaceAroundConditionalCompilation) {
+  std::string Code = "#ifdef A\n"
+ "int a;\n"
+ "int b;\n"
+ "#else\n"
+ "#endif\n"
+ "namespace {}";
+  std::string Expected = "#ifdef A\n"
+ "int a;\n"
+ "int b;\n"
+ "#else\n"
+ "#endif\n";
+  std::vector Ranges(1, tooling::Range(0, Code.size()));
+  FormatStyle Style = getLLVMStyle();
+  std::string Result = cleanup(Code, Ranges, Style);
+  EXPECT_EQ(Expected, Result);
+}
+
 TEST_F(CleanupTest, CtorInitializationSimpleRedundantComma) {
   std::string Code = "class A {\nA() : , {} };";
   std::string Expected = "class A {\nA()  {} };";
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -1041,11 +1041,12 @@
 
   // Iterate through all lines and remove any empty (nested) namespaces.
   void checkEmptyNamespace(SmallVectorImpl ) {
+std::set DeletedLines;
 for (unsigned i = 0, e = AnnotatedLines.size(); i != e; ++i) {
   auto  = *AnnotatedLines[i];
   if (Line.startsWith(tok::kw_namespace) ||
   Line.startsWith(tok::kw_inline, tok::kw_namespace)) {
-checkEmptyNamespace(AnnotatedLines, i, i);
+checkEmptyNamespace(AnnotatedLines, i, i, DeletedLines);
   }
 }
 
@@ -1063,7 +1064,8 @@
   // sets \p NewLine to the last line checked.
   // Returns true if the current namespace is empty.
   bool checkEmptyNamespace(SmallVectorImpl ,
-   unsigned CurrentLine, unsigned ) {
+   unsigned CurrentLine, unsigned ,
+   std::set ) {
 unsigned InitLine = CurrentLine, End = AnnotatedLines.size();
 if (Style.BraceWrapping.AfterNamespace) {
   // If the left brace is in a new line, we should consume it first so that
@@ -1083,7 +1085,8 @@
   if (AnnotatedLines[CurrentLine]->startsWith(tok::kw_namespace) ||
   AnnotatedLines[CurrentLine]->startsWith(tok::kw_inline,
   tok::kw_namespace)) {
-if (!checkEmptyNamespace(AnnotatedLines, CurrentLine, NewLine))
+if (!checkEmptyNamespace(AnnotatedLines, CurrentLine, NewLine,
+ DeletedLines))
   return false;
 CurrentLine = NewLine;
 continue;
@@ -1208,8 +1211,6 @@
 
   // Tokens to be deleted.
   std::set DeletedTokens;
-  // The line numbers of lines to be deleted.
-  std::set DeletedLines;
 };
 
 struct IncludeDirective {


Index: unittests/Format/CleanupTest.cpp
===
--- unittests/Format/CleanupTest.cpp
+++ unittests/Format/CleanupTest.cpp
@@ -119,6 +119,24 @@
   EXPECT_EQ(Expected, Result);
 }
 
+TEST_F(CleanupTest, EmptyNamespaceAroundConditionalCompilation) {
+  std::string Code = "#ifdef A\n"
+ "int a;\n"
+ "int b;\n"
+ "#else\n"
+ "#endif\n"
+ "namespace {}";
+  std::string Expected = "#ifdef A\n"
+ "int a;\n"
+ "int b;\n"
+ "#else\n"
+ "#endif\n";
+  std::vector Ranges(1, tooling::Range(0, Code.size()));
+  FormatStyle Style = getLLVMStyle();
+  std::string Result = cleanup(Code, Ranges, Style);
+  EXPECT_EQ(Expected, Result);
+}
+
 TEST_F(CleanupTest, CtorInitializationSimpleRedundantComma) {
   std::string Code = "class A {\nA() : , {} };";
   std::string Expected = "class A {\nA()  {} };";
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -1041,11 +1041,12 @@
 
   // Iterate through all lines and remove any empty (nested) namespaces.
   void checkEmptyNamespace(SmallVectorImpl ) {
+std::set DeletedLines;
 for (unsigned i = 0, e = AnnotatedLines.size(); i != e; ++i) {
   auto  = *AnnotatedLines[i];
   if (Line.startsWith(tok::kw_namespace) ||
   Line.startsWith(tok::kw_inline, tok::kw_namespace)) {
-checkEmptyNamespace(AnnotatedLines, i, i);
+checkEmptyNamespace(AnnotatedLines, i, i, DeletedLines);
   }
 }
 
@@ -1063,7 +1064,8 @@
   // sets \p NewLine to the last line checked.
   // Returns true if the current namespace is empty.
   

[PATCH] D25204: Register Calling Convention, Clang changes

2016-10-05 Thread Alexey Bataev via cfe-commits
ABataev added inline comments.


> Type.h:1381
>  /// regparm and the calling convention.
> -unsigned ExtInfo : 9;
> +unsigned ExtInfo : 10;
>  

Erich, do you really need this? You don't increase number of required bits 
anymore, so this code must be restored

> Type.h:2909-2921
> +// Feel free to rearrange or add bits, but if you go over 10,
>  // you'll need to adjust both the Bits field below and
>  // Type::FunctionTypeBitfields.
>  
>  //   |  CC  |noreturn|produces|regparm|
> -//   |0 .. 3|   4|5   | 6 .. 8|
> +//   |0 .. 4|   5|6   | 7 .. 9|
>  //

Also, you don't need these changes anymore

> MicrosoftMangle.cpp:434
> +
> +  if (auto FD = dyn_cast(D))
> +if (FD->getType()->castAs()->getCallConv() ==

`auto*`

> CodeGenModule.cpp:686
>  assert(II && "Attempt to mangle unnamed decl.");
> -Str = II->getName();
> +const FunctionDecl *FD = dyn_cast(ND);
> +

`const auto *FD`

> ABataev wrote in TargetInfo.cpp:1546-1548
> Seems to me this code is clang-formatted

I mean, did you try to reformat the whole `return` statement? It looks ugly

> rnk wrote in TargetInfo.cpp:3321
> variable naming

I believe the whole patch must be `clang-tide`d

https://reviews.llvm.org/D25204



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


[PATCH] D25252: [OpenMP] Check if the template specialization is mappable instead of specialized template

2016-10-05 Thread Alexey Bataev via cfe-commits
ABataev accepted this revision.
ABataev added a comment.
This revision is now accepted and ready to land.

LG


https://reviews.llvm.org/D25252



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


[PATCH] D19586: Misleading Indentation check

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


> MisleadingIndentationCheck.cpp:20
> +
> +void MisleadingIndentationCheck::danglingElseCheck(
> +const MatchFinder::MatchResult ) {

There is no handling of tabs and spaces by danglingElseCheck as far as I see.

The "if" might for example be indented with spaces. And then the corresponding 
"else" is indented with a tab. Then I guess there is false positive.

If the "if" is indented with 2 spaces and the "else" is indented with 2 tabs. 
then I assume there is false negative.

It's unfortunate. Is it ok?

> MisleadingIndentationCheck.cpp:34
> +  Result.SourceManager->getExpansionColumnNumber(ElseLoc))
> +diag(ElseLoc, "potential dangling else");
> +}

I see no test case that says "potential dangling else". If I'm not mistaken 
that should be added.

Is it really sufficient to write that? It's not obvious to me why clang-tidy 
would think it's dangling.

> MisleadingIndentationCheck.cpp:44
> +
> +if (isa(CurrentStmt)) {
> +  IfStmt *CurrentIf = dyn_cast(CurrentStmt);

You don't need to use both isa and dyn_cast:

  if (const auto *CurrentIf = dyn_cast(CurrentStmt)) {
  Inside = CurrentIf->getElse() ? CurrentIf->getElse() : 
CurrentIf->getThen();
  } 

> MisleadingIndentationCheck.h:20
> +/// Checks the code for dangling else,
> +///   and possible misleading indentations due to missing braces.
> +///

there are too many spaces in this comment

https://reviews.llvm.org/D19586



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


[PATCH] D21021: [Clang][AVX512][BuiltIn]Adding intrinsics move_{sd|ss} to clang

2016-10-05 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL283314: [Clang][AVX512][BuiltIn]Adding missing intrinsics 
move_{sd|ss} to clang (authored by mzuckerm).

Changed prior to commit:
  https://reviews.llvm.org/D21021?vs=59720=73638#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D21021

Files:
  cfe/trunk/include/clang/Basic/BuiltinsX86.def
  cfe/trunk/lib/Headers/avx512fintrin.h
  cfe/trunk/test/CodeGen/avx512f-builtins.c


Index: cfe/trunk/include/clang/Basic/BuiltinsX86.def
===
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def
@@ -2021,6 +2021,8 @@
 TARGET_BUILTIN(__builtin_ia32_expandsf512_mask, "V16fV16fV16fUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_expandsi512_mask, "V16iV16iV16iUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_cvtps2pd512_mask, "V8dV8fV8dUcIi","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_movss_mask, "V4fV4fV4fV4fUc","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_movsd_mask, "V2dV2dV2dV2dUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_compressstoredf512_mask, 
"vV8d*V8dUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_compressstoredi512_mask, 
"vV8LLi*V8LLiUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_compressstoresf512_mask, 
"vV16f*V16fUs","","avx512f")
Index: cfe/trunk/test/CodeGen/avx512f-builtins.c
===
--- cfe/trunk/test/CodeGen/avx512f-builtins.c
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c
@@ -7863,6 +7863,34 @@
   return _mm512_setzero_pd();
 }
 
+__m128 test_mm_mask_move_ss (__m128 __W, __mmask8 __U, __m128 __A, __m128 __B)
+{
+  // CHECK-LABEL: @test_mm_mask_move_ss
+  // CHECK: @llvm.x86.avx512.mask.move.ss
+  return _mm_mask_move_ss ( __W,  __U,  __A,  __B);
+}
+
+__m128 test_mm_maskz_move_ss (__mmask8 __U, __m128 __A, __m128 __B)
+{
+  // CHECK-LABEL: @test_mm_maskz_move_ss
+  // CHECK: @llvm.x86.avx512.mask.move.ss
+  return _mm_maskz_move_ss (__U, __A, __B);
+}
+
+__m128d test_mm_mask_move_sd (__m128 __W, __mmask8 __U, __m128d __A, __m128d 
__B)
+{
+  // CHECK-LABEL: @test_mm_mask_move_sd
+  // CHECK: @llvm.x86.avx512.mask.move.sd
+  return _mm_mask_move_sd ( __W,  __U,  __A,  __B);
+}
+
+__m128d test_mm_maskz_move_sd (__mmask8 __U, __m128d __A, __m128d __B)
+{
+  // CHECK-LABEL: @test_mm_maskz_move_sd
+  // CHECK: @llvm.x86.avx512.mask.move.sd
+  return _mm_maskz_move_sd (__U, __A, __B);
+}
+
 __m512d test_mm512_abs_pd(__m512d a){
   // CHECK-LABEL: @test_mm512_abs_pd
   // CHECK: and <8 x i64> 
Index: cfe/trunk/lib/Headers/avx512fintrin.h
===
--- cfe/trunk/lib/Headers/avx512fintrin.h
+++ cfe/trunk/lib/Headers/avx512fintrin.h
@@ -9140,6 +9140,40 @@
  (__v16sf)_mm512_setzero_ps());
 }
 
+static __inline__ __m128 __DEFAULT_FN_ATTRS
+_mm_mask_move_ss (__m128 __W, __mmask8 __U, __m128 __A, __m128 __B)
+{
+  return (__m128) __builtin_ia32_movss_mask ((__v4sf) __A, (__v4sf) __B,
+   (__v4sf) __W,
+   (__mmask8) __U);
+}
+
+static __inline__ __m128 __DEFAULT_FN_ATTRS
+_mm_maskz_move_ss (__mmask8 __U, __m128 __A, __m128 __B)
+{
+  return (__m128) __builtin_ia32_movss_mask ((__v4sf) __A, (__v4sf) __B,
+   (__v4sf)
+   _mm_setzero_si128(),
+   (__mmask8) __U);
+}
+
+static __inline__ __m128d __DEFAULT_FN_ATTRS
+_mm_mask_move_sd (__m128d __W, __mmask8 __U, __m128d __A, __m128d __B)
+{
+  return (__m128d) __builtin_ia32_movsd_mask ((__v2df) __A, (__v2df) __B,
+   (__v2df) __W,
+   (__mmask8) __U);
+}
+
+static __inline__ __m128d __DEFAULT_FN_ATTRS
+_mm_maskz_move_sd (__mmask8 __U, __m128d __A, __m128d __B)
+{
+  return (__m128d) __builtin_ia32_movsd_mask ((__v2df) __A, (__v2df) __B,
+   (__v2df)
+   _mm_setzero_pd (),
+   (__mmask8) __U);
+}
+
 #define _mm512_shuffle_epi32(A, I) __extension__ ({ \
   (__m512i)__builtin_shufflevector((__v16si)(__m512i)(A), \
(__v16si)_mm512_undefined_epi32(), \


Index: cfe/trunk/include/clang/Basic/BuiltinsX86.def
===
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def
@@ -2021,6 +2021,8 @@
 TARGET_BUILTIN(__builtin_ia32_expandsf512_mask, "V16fV16fV16fUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_expandsi512_mask, "V16iV16iV16iUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_cvtps2pd512_mask, "V8dV8fV8dUcIi","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_movss_mask, "V4fV4fV4fV4fUc","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_movsd_mask, "V2dV2dV2dV2dUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_compressstoredf512_mask, "vV8d*V8dUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_compressstoredi512_mask, "vV8LLi*V8LLiUc","","avx512f")
 

r283314 - [Clang][AVX512][BuiltIn]Adding missing intrinsics move_{sd|ss} to clang

2016-10-05 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Wed Oct  5 07:56:06 2016
New Revision: 283314

URL: http://llvm.org/viewvc/llvm-project?rev=283314=rev
Log:
[Clang][AVX512][BuiltIn]Adding missing intrinsics move_{sd|ss} to clang

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


Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/avx512fintrin.h
cfe/trunk/test/CodeGen/avx512f-builtins.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=283314=283313=283314=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Wed Oct  5 07:56:06 2016
@@ -2021,6 +2021,8 @@ TARGET_BUILTIN(__builtin_ia32_expandload
 TARGET_BUILTIN(__builtin_ia32_expandsf512_mask, "V16fV16fV16fUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_expandsi512_mask, "V16iV16iV16iUs","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_cvtps2pd512_mask, "V8dV8fV8dUcIi","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_movss_mask, "V4fV4fV4fV4fUc","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_movsd_mask, "V2dV2dV2dV2dUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_compressstoredf512_mask, 
"vV8d*V8dUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_compressstoredi512_mask, 
"vV8LLi*V8LLiUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_compressstoresf512_mask, 
"vV16f*V16fUs","","avx512f")

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=283314=283313=283314=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Wed Oct  5 07:56:06 2016
@@ -9140,6 +9140,40 @@ _mm512_maskz_moveldup_ps (__mmask16 __U,
  (__v16sf)_mm512_setzero_ps());
 }
 
+static __inline__ __m128 __DEFAULT_FN_ATTRS
+_mm_mask_move_ss (__m128 __W, __mmask8 __U, __m128 __A, __m128 __B)
+{
+  return (__m128) __builtin_ia32_movss_mask ((__v4sf) __A, (__v4sf) __B,
+   (__v4sf) __W,
+   (__mmask8) __U);
+}
+
+static __inline__ __m128 __DEFAULT_FN_ATTRS
+_mm_maskz_move_ss (__mmask8 __U, __m128 __A, __m128 __B)
+{
+  return (__m128) __builtin_ia32_movss_mask ((__v4sf) __A, (__v4sf) __B,
+   (__v4sf)
+   _mm_setzero_si128(),
+   (__mmask8) __U);
+}
+
+static __inline__ __m128d __DEFAULT_FN_ATTRS
+_mm_mask_move_sd (__m128d __W, __mmask8 __U, __m128d __A, __m128d __B)
+{
+  return (__m128d) __builtin_ia32_movsd_mask ((__v2df) __A, (__v2df) __B,
+   (__v2df) __W,
+   (__mmask8) __U);
+}
+
+static __inline__ __m128d __DEFAULT_FN_ATTRS
+_mm_maskz_move_sd (__mmask8 __U, __m128d __A, __m128d __B)
+{
+  return (__m128d) __builtin_ia32_movsd_mask ((__v2df) __A, (__v2df) __B,
+   (__v2df)
+   _mm_setzero_pd (),
+   (__mmask8) __U);
+}
+
 #define _mm512_shuffle_epi32(A, I) __extension__ ({ \
   (__m512i)__builtin_shufflevector((__v16si)(__m512i)(A), \
(__v16si)_mm512_undefined_epi32(), \

Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=283314=283313=283314=diff
==
--- cfe/trunk/test/CodeGen/avx512f-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c Wed Oct  5 07:56:06 2016
@@ -7863,6 +7863,34 @@ __m512d test_mm512_setzero_pd()
   return _mm512_setzero_pd();
 }
 
+__m128 test_mm_mask_move_ss (__m128 __W, __mmask8 __U, __m128 __A, __m128 __B)
+{
+  // CHECK-LABEL: @test_mm_mask_move_ss
+  // CHECK: @llvm.x86.avx512.mask.move.ss
+  return _mm_mask_move_ss ( __W,  __U,  __A,  __B);
+}
+
+__m128 test_mm_maskz_move_ss (__mmask8 __U, __m128 __A, __m128 __B)
+{
+  // CHECK-LABEL: @test_mm_maskz_move_ss
+  // CHECK: @llvm.x86.avx512.mask.move.ss
+  return _mm_maskz_move_ss (__U, __A, __B);
+}
+
+__m128d test_mm_mask_move_sd (__m128 __W, __mmask8 __U, __m128d __A, __m128d 
__B)
+{
+  // CHECK-LABEL: @test_mm_mask_move_sd
+  // CHECK: @llvm.x86.avx512.mask.move.sd
+  return _mm_mask_move_sd ( __W,  __U,  __A,  __B);
+}
+
+__m128d test_mm_maskz_move_sd (__mmask8 __U, __m128d __A, __m128d __B)
+{
+  // CHECK-LABEL: @test_mm_maskz_move_sd
+  // CHECK: @llvm.x86.avx512.mask.move.sd
+  return _mm_maskz_move_sd (__U, __A, __B);
+}
+
 __m512d test_mm512_abs_pd(__m512d a){
   // CHECK-LABEL: @test_mm512_abs_pd
   // CHECK: and <8 x i64> 


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


[PATCH] D25012: [x86][inline-asm] Add support for curly brackets escape using "%" in extended inline asm.

2016-10-05 Thread Matan via cfe-commits
mharoush marked an inline comment as done.
mharoush added a comment.

Done


Repository:
  rL LLVM

https://reviews.llvm.org/D25012



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


[PATCH] D25011: [x86][inline-asm] Introducing (AVX512) k0-k7 registers for inline-asm usage

2016-10-05 Thread Matan via cfe-commits
mharoush added a comment.

This patch is a part of a larger support for k constraints, its main purpose is 
to add the option to choose the specific kN register while using basic inline 
assembly, the constraint support for extended inline assembly is being 
supported by another patch D25062    D25063 



Repository:
  rL LLVM

https://reviews.llvm.org/D25011



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


[PATCH] D15075: No error for conflict between inputs\outputs and clobber list

2016-10-05 Thread Ziv Izhar via cfe-commits
zizhar updated this revision to Diff 73617.
zizhar added a comment.

Changed the '^' to point to the clobber which conflicts.
Changed the relevant comments.
However, regarding the point about the non-alphabetical characters - It's a 
different behavior for these specific characters,
since these should be ignored and the default case is for an unknown character.


https://reviews.llvm.org/D15075

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/TargetInfo.h
  lib/Basic/TargetInfo.cpp
  lib/Basic/Targets.cpp
  lib/Headers/intrin.h
  lib/Sema/SemaStmtAsm.cpp
  test/Sema/asm.c

Index: test/Sema/asm.c
===
--- test/Sema/asm.c
+++ test/Sema/asm.c
@@ -28,6 +28,16 @@
   asm ("nop" : : : "204"); // expected-error {{unknown register name '204' in asm}}
   asm ("nop" : : : "-1"); // expected-error {{unknown register name '-1' in asm}}
   asm ("nop" : : : "+1"); // expected-error {{unknown register name '+1' in asm}}
+  register void *clobber_conflict asm ("%rcx");
+  register void *no_clobber_conflict asm ("%rax");
+  int a,b,c;
+  asm ("nop" : "=r" (no_clobber_conflict) : "r" (clobber_conflict) : "%rcx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
+  asm ("nop" : "=r" (clobber_conflict) : "r" (no_clobber_conflict) : "%rcx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
+  asm ("nop" : "=r" (clobber_conflict) : "r" (clobber_conflict) : "%rcx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
+  asm ("nop" : "=c" (a) : "r" (no_clobber_conflict) : "%rcx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
+  asm ("nop" : "=r" (no_clobber_conflict) : "c" (c) : "%rcx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
+  asm ("nop" : "=r" (clobber_conflict) : "c" (c) : "%rcx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
+  asm ("nop" : "=a" (a) : "b" (b) : "%rcx", "%rbx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}} 
 }
 
 // rdar://6094010
Index: lib/Sema/SemaStmtAsm.cpp
===
--- lib/Sema/SemaStmtAsm.cpp
+++ lib/Sema/SemaStmtAsm.cpp
@@ -22,6 +22,7 @@
 #include "clang/Sema/ScopeInfo.h"
 #include "clang/Sema/SemaInternal.h"
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/StringSet.h"
 #include "llvm/MC/MCParser/MCAsmParser.h"
 using namespace clang;
 using namespace sema;
@@ -137,6 +138,58 @@
   return false;
 }
 
+// Extracting the register name from the Expression value,
+// if there is no register name to extract, returns ""
+StringRef ExtractRegisterName(const Expr *Expression, const TargetInfo ) {
+  while (const ImplicitCastExpr *P = dyn_cast(Expression)) {
+Expression = P->getSubExpr();
+  }
+  if (const DeclRefExpr *AsmDeclRef = dyn_cast(Expression)) {
+// Handle cases where the expression is a variable
+const VarDecl *Variable = dyn_cast(AsmDeclRef->getDecl());
+if (Variable && Variable->getStorageClass() == SC_Register) {
+  if (AsmLabelAttr *Attr = Variable->getAttr())
+return Target.isValidGCCRegisterName(Attr->getLabel())
+? Target.getNormalizedGCCRegisterName(Attr->getLabel(), true)
+: "";
+}
+  }
+  return "";
+}
+
+// Checks if there is a conflict between the input and output lists with the
+// clobbers list. If there's a conflict, returns the location of the
+// conflicted clobber, else returns nullptr
+SourceLocation* GetClobberConflictLocation(MultiExprArg Exprs, 
+  StringLiteral **Constraints, StringLiteral **Clobbers, int NumClobbers,
+  const TargetInfo , ASTContext ) {
+  llvm::StringSet<> InOutVars;
+  // Collect all the input and output registers from the extended asm statement
+  // in order to check for conflicts with the clobber list
+  for (int i = 0; i < Exprs.size(); ++i) {
+StringRef Constraint = Constraints[i]->getString();
+StringRef InOutReg = Target.getConstraintRegister(
+  Constraint, ExtractRegisterName(Exprs[i], Target));
+if (InOutReg != "")
+  InOutVars.insert(InOutReg);
+  }
+  // Check for each item in the clobber list if it conflicts with the input
+  // or output
+  for (int i = 0; i < NumClobbers; ++i) {
+StringRef Clobber = Clobbers[i]->getString();
+// We only check registers, therefore we don't check cc and memory clobbers
+if (Clobber == "cc" || Clobber == "memory")
+  continue;
+Clobber = Target.getNormalizedGCCRegisterName(Clobber, true);
+// Go over the output's registers we collected
+if (InOutVars.find(Clobber) != InOutVars.end()){
+  SourceLocation Loc = Clobbers[i]->getLocStart();
+  return 
+}
+  }
+  return nullptr;
+}
+
 StmtResult 

[PATCH] D25012: [x86][inline-asm] Add support for curly brackets escape using "%" in extended inline asm.

2016-10-05 Thread Matan via cfe-commits
mharoush updated this revision to Diff 73602.

Repository:
  rL LLVM

https://reviews.llvm.org/D25012

Files:
  lib/AST/Stmt.cpp
  test/CodeGen/x86_inlineasm_curly_bracket_escape.c


Index: lib/AST/Stmt.cpp
===
--- lib/AST/Stmt.cpp
+++ lib/AST/Stmt.cpp
@@ -533,15 +533,17 @@
   DiagOffs = CurPtr-StrStart-1;
   return diag::err_asm_invalid_escape;
 }
-
+// Handle escaped char and continue looping over the asm string.
 char EscapedChar = *CurPtr++;
-if (EscapedChar == '%') {  // %% -> %
-  // Escaped percentage sign.
-  CurStringPiece += '%';
+switch (EscapedChar) {
+default:
+  break;
+case '%': // %% -> %
+case '{': // %{ -> {
+case '}': // %} -> }
+  CurStringPiece += EscapedChar;
   continue;
-}
-
-if (EscapedChar == '=') {  // %= -> Generate an unique ID.
+case '=': // %= -> Generate a unique ID.
   CurStringPiece += "${:uid}";
   continue;
 }
Index: test/CodeGen/x86_inlineasm_curly_bracket_escape.c
===
--- test/CodeGen/x86_inlineasm_curly_bracket_escape.c
+++ test/CodeGen/x86_inlineasm_curly_bracket_escape.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 %s -target-cpu skylake-avx512 -O0  -S -emit-llvm -o - -Wall 
-Werror | FileCheck %s
+// This test checks validity of inline assembly using curly brackets syntax
+// for extended inline asm.
+
+void test_curly_brackets() {
+//CHECK:  %xmm1,%xmm0,%xmm1 {%k1}{z}
+asm("vpaddb\t %%xmm1,%%xmm0,%%xmm1 %{%%k1%}%{z%}\t":::);
+}
\ No newline at end of file


Index: lib/AST/Stmt.cpp
===
--- lib/AST/Stmt.cpp
+++ lib/AST/Stmt.cpp
@@ -533,15 +533,17 @@
   DiagOffs = CurPtr-StrStart-1;
   return diag::err_asm_invalid_escape;
 }
-
+// Handle escaped char and continue looping over the asm string.
 char EscapedChar = *CurPtr++;
-if (EscapedChar == '%') {  // %% -> %
-  // Escaped percentage sign.
-  CurStringPiece += '%';
+switch (EscapedChar) {
+default:
+  break;
+case '%': // %% -> %
+case '{': // %{ -> {
+case '}': // %} -> }
+  CurStringPiece += EscapedChar;
   continue;
-}
-
-if (EscapedChar == '=') {  // %= -> Generate an unique ID.
+case '=': // %= -> Generate a unique ID.
   CurStringPiece += "${:uid}";
   continue;
 }
Index: test/CodeGen/x86_inlineasm_curly_bracket_escape.c
===
--- test/CodeGen/x86_inlineasm_curly_bracket_escape.c
+++ test/CodeGen/x86_inlineasm_curly_bracket_escape.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 %s -target-cpu skylake-avx512 -O0  -S -emit-llvm -o - -Wall -Werror | FileCheck %s
+// This test checks validity of inline assembly using curly brackets syntax
+// for extended inline asm.
+
+void test_curly_brackets() {
+//CHECK:  %xmm1,%xmm0,%xmm1 {%k1}{z}
+asm("vpaddb\t %%xmm1,%%xmm0,%%xmm1 %{%%k1%}%{z%}\t":::);
+}
\ No newline at end of file
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25204: Register Calling Convention, Clang changes

2016-10-05 Thread Oren Ben Simhon via cfe-commits
oren_ben_simhon added inline comments.


> AttrDocs.td:1267
> +
> +.. _`__regcall`: https://software.intel.com/en-us/node/512847
> +  }];

You might want to use the following link instead because it is most updated: 
https://software.intel.com/en-us/node/693069

> TargetInfo.cpp:3352
>// Keep track of the number of assigned registers.
> -  unsigned freeIntRegs = 6, freeSSERegs = 8;
> +  unsigned freeIntRegs = IsRegCall ? 11 : 6;
> +  unsigned freeSSERegs = IsRegCall ? 16 : 8;

According to the ABI, there are 12 free int regs for windows and 11 free int 
regs for non-windows (linux, OSX, etc). Is that taken into account somewhere?

> TargetInfo.cpp:3732
> +  } else if (IsRegCall) {
> +// RegCall gives us 16 SSE registers total, return or otherwise.
> +FreeSSERegs = 16;

Maybe i misinterpret the comment, but AFAIK, RegCall gives us 16 SSE registers 
for each (return values and passed arguments)

> regcall.c:26
> +void __regcall v3(int a, struct Small b, int c) {}
> +// Win32: define x86_regcallcc void @"\01__regcall3__v3@12"(i32 inreg %a, 
> i32 %b.0, i32 inreg %c)
> +// Win64: define x86_regcallcc void @"\01__regcall3__v3@24"(i32 %a, i32 
> %b.coerce, i32 %c)

I see that expended structures don't get InReg attribute. IMHO, If you know 
that the value should be saved in register then you InReg attribute should be 
added.

https://reviews.llvm.org/D25204



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


  1   2   >