r282701 - XFAIL Driver/darwin-stdlib.cpp if CLANG_DEFAULT_CXX_STDLIB is set

2016-09-29 Thread Jonas Hahnfeld via cfe-commits
Author: hahnfeld
Date: Thu Sep 29 02:43:08 2016
New Revision: 282701

URL: http://llvm.org/viewvc/llvm-project?rev=282701&view=rev
Log:
XFAIL Driver/darwin-stdlib.cpp if CLANG_DEFAULT_CXX_STDLIB is set

Until someone rewrites the stdlib logic for Darwin so that we don't need
to pass down the -stdlib argument to cc1.
(see https://llvm.org/bugs/show_bug.cgi?id=30548)

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

Modified:
cfe/trunk/test/Driver/darwin-stdlib.cpp
cfe/trunk/test/lit.cfg
cfe/trunk/test/lit.site.cfg.in

Modified: cfe/trunk/test/Driver/darwin-stdlib.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-stdlib.cpp?rev=282701&r1=282700&r2=282701&view=diff
==
--- cfe/trunk/test/Driver/darwin-stdlib.cpp (original)
+++ cfe/trunk/test/Driver/darwin-stdlib.cpp Thu Sep 29 02:43:08 2016
@@ -1,3 +1,7 @@
+// This test will fail if CLANG_DEFAULT_CXX_STDLIB is set to anything different
+// than the platform default. (see https://llvm.org/bugs/show_bug.cgi?id=30548)
+// XFAIL: default-cxx-stdlib-set
+
 // RUN: %clang -target x86_64-apple-darwin -arch arm64 
-miphoneos-version-min=7.0 %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-LIBCXX
 // RUN: %clang -target x86_64-apple-darwin -mmacosx-version-min=10.8 %s -### 
2>&1 | FileCheck %s --check-prefix=CHECK-LIBSTDCXX
 // RUN: %clang -target x86_64-apple-darwin -mmacosx-version-min=10.9 %s -### 
2>&1 | FileCheck %s --check-prefix=CHECK-LIBCXX

Modified: cfe/trunk/test/lit.cfg
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.cfg?rev=282701&r1=282700&r2=282701&view=diff
==
--- cfe/trunk/test/lit.cfg (original)
+++ cfe/trunk/test/lit.cfg Thu Sep 29 02:43:08 2016
@@ -343,6 +343,9 @@ for pattern in tool_patterns:
 
 # Set available features we allow tests to conditionalize on.
 #
+if config.clang_default_cxx_stdlib != '':
+config.available_features.add('default-cxx-stdlib-set')
+
 # Enabled/disabled features
 if config.clang_staticanalyzer != 0:
 config.available_features.add("staticanalyzer")

Modified: cfe/trunk/test/lit.site.cfg.in
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.site.cfg.in?rev=282701&r1=282700&r2=282701&view=diff
==
--- cfe/trunk/test/lit.site.cfg.in (original)
+++ cfe/trunk/test/lit.site.cfg.in Thu Sep 29 02:43:08 2016
@@ -16,6 +16,7 @@ config.target_triple = "@TARGET_TRIPLE@"
 config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
 config.have_zlib = "@HAVE_LIBZ@"
 config.clang_arcmt = @ENABLE_CLANG_ARCMT@
+config.clang_default_cxx_stdlib = "@CLANG_DEFAULT_CXX_STDLIB@"
 config.clang_staticanalyzer = @ENABLE_CLANG_STATIC_ANALYZER@
 config.clang_examples = @ENABLE_CLANG_EXAMPLES@
 config.enable_shared = @ENABLE_SHARED@


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


Re: [PATCH] D24601: XFAIL Driver/darwin-stdlib.cpp if CLANG_DEFAULT_CXX_STDLIB is set

2016-09-29 Thread Jonas Hahnfeld via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL282701: XFAIL Driver/darwin-stdlib.cpp if 
CLANG_DEFAULT_CXX_STDLIB is set (authored by Hahnfeld).

Changed prior to commit:
  https://reviews.llvm.org/D24601?vs=72765&id=72960#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D24601

Files:
  cfe/trunk/test/Driver/darwin-stdlib.cpp
  cfe/trunk/test/lit.cfg
  cfe/trunk/test/lit.site.cfg.in

Index: cfe/trunk/test/lit.site.cfg.in
===
--- cfe/trunk/test/lit.site.cfg.in
+++ cfe/trunk/test/lit.site.cfg.in
@@ -16,6 +16,7 @@
 config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
 config.have_zlib = "@HAVE_LIBZ@"
 config.clang_arcmt = @ENABLE_CLANG_ARCMT@
+config.clang_default_cxx_stdlib = "@CLANG_DEFAULT_CXX_STDLIB@"
 config.clang_staticanalyzer = @ENABLE_CLANG_STATIC_ANALYZER@
 config.clang_examples = @ENABLE_CLANG_EXAMPLES@
 config.enable_shared = @ENABLE_SHARED@
Index: cfe/trunk/test/Driver/darwin-stdlib.cpp
===
--- cfe/trunk/test/Driver/darwin-stdlib.cpp
+++ cfe/trunk/test/Driver/darwin-stdlib.cpp
@@ -1,3 +1,7 @@
+// This test will fail if CLANG_DEFAULT_CXX_STDLIB is set to anything different
+// than the platform default. (see https://llvm.org/bugs/show_bug.cgi?id=30548)
+// XFAIL: default-cxx-stdlib-set
+
 // RUN: %clang -target x86_64-apple-darwin -arch arm64 
-miphoneos-version-min=7.0 %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-LIBCXX
 // RUN: %clang -target x86_64-apple-darwin -mmacosx-version-min=10.8 %s -### 
2>&1 | FileCheck %s --check-prefix=CHECK-LIBSTDCXX
 // RUN: %clang -target x86_64-apple-darwin -mmacosx-version-min=10.9 %s -### 
2>&1 | FileCheck %s --check-prefix=CHECK-LIBCXX
Index: cfe/trunk/test/lit.cfg
===
--- cfe/trunk/test/lit.cfg
+++ cfe/trunk/test/lit.cfg
@@ -343,6 +343,9 @@
 
 # Set available features we allow tests to conditionalize on.
 #
+if config.clang_default_cxx_stdlib != '':
+config.available_features.add('default-cxx-stdlib-set')
+
 # Enabled/disabled features
 if config.clang_staticanalyzer != 0:
 config.available_features.add("staticanalyzer")


Index: cfe/trunk/test/lit.site.cfg.in
===
--- cfe/trunk/test/lit.site.cfg.in
+++ cfe/trunk/test/lit.site.cfg.in
@@ -16,6 +16,7 @@
 config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
 config.have_zlib = "@HAVE_LIBZ@"
 config.clang_arcmt = @ENABLE_CLANG_ARCMT@
+config.clang_default_cxx_stdlib = "@CLANG_DEFAULT_CXX_STDLIB@"
 config.clang_staticanalyzer = @ENABLE_CLANG_STATIC_ANALYZER@
 config.clang_examples = @ENABLE_CLANG_EXAMPLES@
 config.enable_shared = @ENABLE_SHARED@
Index: cfe/trunk/test/Driver/darwin-stdlib.cpp
===
--- cfe/trunk/test/Driver/darwin-stdlib.cpp
+++ cfe/trunk/test/Driver/darwin-stdlib.cpp
@@ -1,3 +1,7 @@
+// This test will fail if CLANG_DEFAULT_CXX_STDLIB is set to anything different
+// than the platform default. (see https://llvm.org/bugs/show_bug.cgi?id=30548)
+// XFAIL: default-cxx-stdlib-set
+
 // RUN: %clang -target x86_64-apple-darwin -arch arm64 -miphoneos-version-min=7.0 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBCXX
 // RUN: %clang -target x86_64-apple-darwin -mmacosx-version-min=10.8 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBSTDCXX
 // RUN: %clang -target x86_64-apple-darwin -mmacosx-version-min=10.9 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBCXX
Index: cfe/trunk/test/lit.cfg
===
--- cfe/trunk/test/lit.cfg
+++ cfe/trunk/test/lit.cfg
@@ -343,6 +343,9 @@
 
 # Set available features we allow tests to conditionalize on.
 #
+if config.clang_default_cxx_stdlib != '':
+config.available_features.add('default-cxx-stdlib-set')
+
 # Enabled/disabled features
 if config.clang_staticanalyzer != 0:
 config.available_features.add("staticanalyzer")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D22452: [libcxx] Fix last_write_time tests for filesystems that don't support negative and very large times.

2016-09-29 Thread Jonas Hahnfeld via cfe-commits
Hahnfeld added a comment.

ping?


https://reviews.llvm.org/D22452



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


Re: [PATCH] D25027: Add getCommonRoot Interface in CompilationDatabase.

2016-09-29 Thread Haojian Wu via cfe-commits
hokein updated this revision to Diff 72963.
hokein added a comment.

Correct the implementation of FixedCompilationDatabase::getCommonRoot.


https://reviews.llvm.org/D25027

Files:
  include/clang/Tooling/CompilationDatabase.h
  include/clang/Tooling/JSONCompilationDatabase.h
  lib/Tooling/CommonOptionsParser.cpp
  lib/Tooling/CompilationDatabase.cpp
  lib/Tooling/JSONCompilationDatabase.cpp
  unittests/Tooling/CompilationDatabaseTest.cpp

Index: unittests/Tooling/CompilationDatabaseTest.cpp
===
--- unittests/Tooling/CompilationDatabaseTest.cpp
+++ unittests/Tooling/CompilationDatabaseTest.cpp
@@ -95,6 +95,34 @@
   << ErrorMessage;
 }
 
+TEST(JSONCompilationDatabase, GetCommonRoot) {
+  std::string ErrorMessage;
+  std::string JSONDatabase = "[{\"directory\":\"//dir/build/\","
+ "\"command\":\"command\","
+ "\"file\":\"file1\"},"
+ " {\"directory\":\"//dir/build/\","
+ "\"command\":\"command\","
+ "\"file\":\"file2\"}]";
+
+  std::unique_ptr Database(
+  JSONCompilationDatabase::loadFromBuffer(JSONDatabase, ErrorMessage,
+  JSONCommandLineSyntax::Gnu));
+  auto CommonRoot = Database->getCommonRoot();
+  ASSERT_TRUE(CommonRoot.hasValue());
+  EXPECT_EQ("//dir/build/", *CommonRoot);
+
+  JSONDatabase = "[{\"directory\":\"//dir/build/\","
+ "\"command\":\"command\","
+ "\"file\":\"file1\"},"
+ " {\"directory\":\"//dir/build2/\","
+ "\"command\":\"command\","
+ "\"file\":\"file2\"}]";
+  Database = JSONCompilationDatabase::loadFromBuffer(
+  JSONDatabase, ErrorMessage, JSONCommandLineSyntax::Gnu);
+  CommonRoot = Database->getCommonRoot();
+  EXPECT_FALSE(CommonRoot.hasValue());
+}
+
 TEST(JSONCompilationDatabase, GetAllCompileCommands) {
   std::string ErrorMessage;
   EXPECT_EQ(
Index: lib/Tooling/JSONCompilationDatabase.cpp
===
--- lib/Tooling/JSONCompilationDatabase.cpp
+++ lib/Tooling/JSONCompilationDatabase.cpp
@@ -366,6 +366,20 @@
 AllCommands.push_back(Cmd);
 MatchTrie.insert(NativeFilePath);
   }
+  if (!AllCommands.empty()) {
+SmallString<128> DirectoryStorage;
+SmallString<128> NextDirectoryStorage;
+llvm::StringRef Directory =
+std::get<0>(AllCommands[0])->getValue(DirectoryStorage);
+auto It = std::find_if(
+AllCommands.begin() + 1, AllCommands.end(),
+[&](JSONCompilationDatabase::CompileCommandRef &Command) {
+  return Directory !=
+ std::get<0>(Command)->getValue(NextDirectoryStorage);
+});
+if (It == AllCommands.end())
+  CommonRoot = Directory.str();
+  }
   return true;
 }
 
Index: lib/Tooling/CompilationDatabase.cpp
===
--- lib/Tooling/CompilationDatabase.cpp
+++ lib/Tooling/CompilationDatabase.cpp
@@ -322,6 +322,17 @@
   return std::vector();
 }
 
+llvm::Optional FixedCompilationDatabase::getCommonRoot() const {
+  auto It =
+  std::find_if(CompileCommands.begin(), CompileCommands.end(),
+   [&](const clang::tooling::CompileCommand &Command) {
+ return CompileCommands[0].Directory != Command.Directory;
+   });
+  if (It == CompileCommands.end())
+return CompileCommands[0].Directory;
+  return llvm::None;
+}
+
 namespace clang {
 namespace tooling {
 
Index: lib/Tooling/CommonOptionsParser.cpp
===
--- lib/Tooling/CommonOptionsParser.cpp
+++ lib/Tooling/CommonOptionsParser.cpp
@@ -78,6 +78,10 @@
 return adjustCommands(Compilations->getAllCompileCommands());
   }
 
+  llvm::Optional getCommonRoot() const override {
+return Compilations->getCommonRoot();
+  }
+
 private:
   std::unique_ptr Compilations;
   std::vector Adjusters;
Index: include/clang/Tooling/JSONCompilationDatabase.h
===
--- include/clang/Tooling/JSONCompilationDatabase.h
+++ include/clang/Tooling/JSONCompilationDatabase.h
@@ -90,12 +90,18 @@
   /// database.
   std::vector getAllCompileCommands() const override;
 
+  /// \brief Returns the common build directory for all translation units in the
+  /// JSON compilation database.
+  llvm::Optional getCommonRoot() const override {
+return CommonRoot;
+  }
+
 private:
   /// \brief Constructs a JSON compilation database on a memory buffer.
   JSONCompilationDatabase(std::unique_ptr Database,
   JSONCommandLineSyntax Syntax)
   : Database(std::move(Database)), Syntax(Syntax),
-YAMLStream(this->Database->getBuffer(), SM) {}
+YAMLStream(this->Database->getBuffer(), SM), CommonRoot(llvm::None) {}
 
 

[libcxxabi] r282703 - Revert r282692: Use fallback_malloc to allocate __cxa_eh_globals in case of dynamic memory exhaustion.

2016-09-29 Thread Igor Kudrin via cfe-commits
Author: ikudrin
Date: Thu Sep 29 03:11:57 2016
New Revision: 282703

URL: http://llvm.org/viewvc/llvm-project?rev=282703&view=rev
Log:
Revert r282692: Use fallback_malloc to allocate __cxa_eh_globals in case of 
dynamic memory exhaustion.

The test breaks build bots.

Added:
libcxxabi/trunk/src/fallback_malloc.ipp
  - copied unchanged from r282691, libcxxabi/trunk/src/fallback_malloc.ipp
Removed:
libcxxabi/trunk/src/fallback_malloc.cpp
libcxxabi/trunk/src/fallback_malloc.h
libcxxabi/trunk/test/test_exception_storage_nodynmem.pass.cpp
Modified:
libcxxabi/trunk/src/CMakeLists.txt
libcxxabi/trunk/src/cxa_exception.cpp
libcxxabi/trunk/src/cxa_exception_storage.cpp
libcxxabi/trunk/test/test_fallback_malloc.pass.cpp

Modified: libcxxabi/trunk/src/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/CMakeLists.txt?rev=282703&r1=282702&r2=282703&view=diff
==
--- libcxxabi/trunk/src/CMakeLists.txt (original)
+++ libcxxabi/trunk/src/CMakeLists.txt Thu Sep 29 03:11:57 2016
@@ -12,7 +12,6 @@ set(LIBCXXABI_SOURCES
   cxa_vector.cpp
   cxa_virtual.cpp
   exception.cpp
-  fallback_malloc.cpp
   private_typeinfo.cpp
   stdexcept.cpp
   typeinfo.cpp

Modified: libcxxabi/trunk/src/cxa_exception.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_exception.cpp?rev=282703&r1=282702&r2=282703&view=diff
==
--- libcxxabi/trunk/src/cxa_exception.cpp (original)
+++ libcxxabi/trunk/src/cxa_exception.cpp Thu Sep 29 03:11:57 2016
@@ -15,10 +15,13 @@
 #include "cxxabi.h"
 
 #include // for std::terminate
+#include   // for malloc, free
 #include   // for memset
+#ifndef _LIBCXXABI_HAS_NO_THREADS
+#  include   // for fallback_malloc.ipp's mutexes
+#endif
 #include "cxa_exception.hpp"
 #include "cxa_handlers.hpp"
-#include "fallback_malloc.h"
 
 // +---+-+---+
 // | __cxa_exception   | _Unwind_Exception CLNGC++\0 | thrown object |
@@ -101,6 +104,20 @@ static inline  int decrementHandlerCount
 return --exception->handlerCount;
 }
 
+#include "fallback_malloc.ipp"
+
+//  Allocate some memory from _somewhere_
+static void *do_malloc(size_t size) {
+void *ptr = std::malloc(size);
+if (NULL == ptr) // if malloc fails, fall back to emergency stash
+ptr = fallback_malloc(size);
+return ptr;
+}
+
+static void do_free(void *ptr) {
+is_fallback_ptr(ptr) ? fallback_free(ptr) : std::free(ptr);
+}
+
 /*
 If reason isn't _URC_FOREIGN_EXCEPTION_CAUGHT, then the terminateHandler
 stored in exc is called.  Otherwise the exceptionDestructor stored in 
@@ -141,8 +158,7 @@ extern "C" {
 //  user's exception object.
 _LIBCXXABI_FUNC_VIS void *__cxa_allocate_exception(size_t thrown_size) throw() 
{
 size_t actual_size = 
cxa_exception_size_from_exception_thrown_size(thrown_size);
-__cxa_exception *exception_header =
-static_cast<__cxa_exception *>(__malloc_with_fallback(actual_size));
+__cxa_exception* exception_header = 
static_cast<__cxa_exception*>(do_malloc(actual_size));
 if (NULL == exception_header)
 std::terminate();
 std::memset(exception_header, 0, actual_size);
@@ -152,7 +168,7 @@ _LIBCXXABI_FUNC_VIS void *__cxa_allocate
 
 //  Free a __cxa_exception object allocated with __cxa_allocate_exception.
 _LIBCXXABI_FUNC_VIS void __cxa_free_exception(void *thrown_object) throw() {
-__free_with_fallback(cxa_exception_from_thrown_object(thrown_object));
+do_free(cxa_exception_from_thrown_object(thrown_object));
 }
 
 
@@ -161,7 +177,7 @@ _LIBCXXABI_FUNC_VIS void __cxa_free_exce
 //  Otherwise, it will work like __cxa_allocate_exception.
 void * __cxa_allocate_dependent_exception () {
 size_t actual_size = sizeof(__cxa_dependent_exception);
-void *ptr = __malloc_with_fallback(actual_size);
+void *ptr = do_malloc(actual_size);
 if (NULL == ptr)
 std::terminate();
 std::memset(ptr, 0, actual_size);
@@ -172,7 +188,7 @@ void * __cxa_allocate_dependent_exceptio
 //  This function shall free a dependent_exception.
 //  It does not affect the reference count of the primary exception.
 void __cxa_free_dependent_exception (void * dependent_exception) {
-__free_with_fallback(dependent_exception);
+do_free(dependent_exception);
 }
 
 

Modified: libcxxabi/trunk/src/cxa_exception_storage.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_exception_storage.cpp?rev=282703&r1=282702&r2=282703&view=diff
==
--- libcxxabi/trunk/src/cxa_exception_storage.cpp (original)
+++ libcxxabi/trunk/src/cxa_exception_storage.cpp Thu Sep 29 03:11:57 2016
@@ -45,8 +45,8 @@ extern "C" {
 #else
 
 #include 
+#include   // for calloc, free
 #include "ab

Re: [PATCH] D24963: [change-namespace] fix namespace specifier of global variables.

2016-09-29 Thread Haojian Wu via cfe-commits
hokein accepted this revision.
hokein added a comment.
This revision is now accepted and ready to land.

LGTM.


https://reviews.llvm.org/D24963



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


r282710 - Revert "[PR30341] Alias must point to a definition"

2016-09-29 Thread Aditya Kumar via cfe-commits
Author: hiraditya
Date: Thu Sep 29 06:37:23 2016
New Revision: 282710

URL: http://llvm.org/viewvc/llvm-project?rev=282710&view=rev
Log:
Revert "[PR30341] Alias must point to a definition"

This reverts commit r282679.

Ninja check fails, reverting to debug the issue.

Removed:
cfe/trunk/test/CodeGenCXX/alias-available-externally.cpp
Modified:
cfe/trunk/lib/CodeGen/CGCXX.cpp

Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=282710&r1=282709&r2=282710&view=diff
==
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Thu Sep 29 06:37:23 2016
@@ -134,11 +134,6 @@ bool CodeGenModule::TryEmitDefinitionAsA
   llvm::GlobalValue::LinkageTypes TargetLinkage =
   getFunctionLinkage(TargetDecl);
 
-  // available_externally definitions aren't real definitions, so we cannot
-  // create an alias to one.
-  if (TargetLinkage == llvm::GlobalValue::AvailableExternallyLinkage)
-return true;
-
   // Check if we have it already.
   StringRef MangledName = getMangledName(AliasDecl);
   llvm::GlobalValue *Entry = GetGlobalValue(MangledName);
@@ -161,7 +156,14 @@ bool CodeGenModule::TryEmitDefinitionAsA
 
   // Instead of creating as alias to a linkonce_odr, replace all of the uses
   // of the aliasee.
-  if (llvm::GlobalValue::isDiscardableIfUnused(Linkage)) {
+  if (llvm::GlobalValue::isDiscardableIfUnused(Linkage) &&
+ (TargetLinkage != llvm::GlobalValue::AvailableExternallyLinkage ||
+  !TargetDecl.getDecl()->hasAttr())) {
+// FIXME: An extern template instantiation will create functions with
+// linkage "AvailableExternally". In libc++, some classes also define
+// members with attribute "AlwaysInline" and expect no reference to
+// be generated. It is desirable to reenable this optimisation after
+// corresponding LLVM changes.
 addReplacement(MangledName, Aliasee);
 return false;
   }

Removed: cfe/trunk/test/CodeGenCXX/alias-available-externally.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/alias-available-externally.cpp?rev=282709&view=auto
==
--- cfe/trunk/test/CodeGenCXX/alias-available-externally.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/alias-available-externally.cpp (removed)
@@ -1,19 +0,0 @@
-// RUN: %clang_cc1 -O1 -std=c++11 -emit-llvm -disable-llvm-passes -o - %s | 
FileCheck %s
-// Clang should not generate alias to available_externally definitions.
-// Check that the destructor of Foo is defined.
-// CHECK: define linkonce_odr void @_ZN3FooD2Ev
-template 
-struct String {
-  String() {}
-  ~String();
-};
-
-template 
-inline __attribute__((visibility("hidden"), always_inline))
-String::~String() {}
-
-extern template struct String;
-
-struct Foo : public String { Foo() { String s; } };
-
-Foo f;


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


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

2016-09-29 Thread coby via cfe-commits
coby updated this revision to Diff 72961.
coby marked an inline comment as done.
coby added a comment.

Addressing comments:
Added a check for KNL as well


Repository:
  rL LLVM

https://reviews.llvm.org/D25004

Files:
  x86-inline-asm-v-constraint.c

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


Index: x86-inline-asm-v-constraint.c
===
--- x86-inline-asm-v-constraint.c
+++ x86-inline-asm-v-constraint.c
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -target-cpu x86-64 -o - | FileCheck %s --check-prefix SSE
+// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -target-cpu skylake -D AVX -o - | FileCheck %s --check-prefixes AVX,SSE
+// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -target-cpu skylake-avx512 -D AVX512 -D AVX -o - | FileCheck %s --check-prefixes AVX512,AVX,SSE
+// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -target-cpu knl -D AVX -D AVX512 -o - | FileCheck %s --check-prefixes AVX512,AVX,SSE
+
+typedef float __m128 __attribute__ ((vector_size (16)));
+typedef float __m256 __attribute__ ((vector_size (32)));
+typedef float __m512 __attribute__ ((vector_size (64)));
+
+// SSE: call <4 x float> asm "vmovhlps $1, $2, $0", "=v,v,v,~{dirflag},~{fpsr},~{flags}"(i64 %0, <4 x float> %1)
+__m128 testXMM(__m128 _xmm0, long _l) {
+  __asm__("vmovhlps %1, %2, %0" :"=v"(_xmm0) : "v"(_l), "v"(_xmm0));
+  return _xmm0;
+}
+
+// AVX: call <8 x float> asm "vmovsldup $1, $0", "=v,v,~{dirflag},~{fpsr},~{flags}"(<8 x float> %0)
+__m256 testYMM(__m256 _ymm0) {
+#ifdef AVX
+  __asm__("vmovsldup %1, %0" :"=v"(_ymm0) : "v"(_ymm0));
+#endif
+  return _ymm0;
+}
+
+// AVX512: call <16 x float> asm "vpternlogd $$0, $1, $2, $0", "=v,v,v,~{dirflag},~{fpsr},~{flags}"(<16 x float> %0, <16 x float> %1)
+__m512 testZMM(__m512 _zmm0, __m512 _zmm1) {
+#ifdef AVX512
+  __asm__("vpternlogd $0, %1, %2, %0" :"=v"(_zmm0) : "v"(_zmm1), "v"(_zmm0));
+#endif
+  return _zmm0;
+}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r282735 - [sanitizer-coverage/libFuzzer] make the guards for trace-pc 32-bit; create one array of guards per function, instead of one guard per BB. reorganize the code so that trace-pc-guard does not

2016-09-29 Thread Kostya Serebryany via cfe-commits
Author: kcc
Date: Thu Sep 29 12:43:24 2016
New Revision: 282735

URL: http://llvm.org/viewvc/llvm-project?rev=282735&view=rev
Log:
[sanitizer-coverage/libFuzzer] make the guards for trace-pc 32-bit; create one 
array of guards per function, instead of one guard per BB. reorganize the code 
so that trace-pc-guard does not create unneeded globals

Modified:
cfe/trunk/docs/SanitizerCoverage.rst

Modified: cfe/trunk/docs/SanitizerCoverage.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/SanitizerCoverage.rst?rev=282735&r1=282734&r2=282735&view=diff
==
--- cfe/trunk/docs/SanitizerCoverage.rst (original)
+++ cfe/trunk/docs/SanitizerCoverage.rst Thu Sep 29 12:43:24 2016
@@ -334,7 +334,7 @@ on every edge:
if (guard_variable)
  __sanitizer_cov_trace_pc_guard(&guard_variable)
 
-Every edge will have its own `guard_variable` (uintptr_t).
+Every edge will have its own `guard_variable` (uint32_t).
 
 The compler will also insert a module constructor that will call
 
@@ -342,7 +342,7 @@ The compler will also insert a module co
 
// The guards are [start, stop).
// This function may be called multiple times with the same values of 
start/stop.
-   __sanitizer_cov_trace_pc_guard_init(uintptr_t *start, uintptr_t *stop);
+   __sanitizer_cov_trace_pc_guard_init(uint32_t_t *start, uint32_t *stop);
 
 Similarly to `trace-pc,indirect-calls`, with `trace-pc-guards,indirect-calls`
 ``__sanitizer_cov_trace_pc_indirect(void *callee)`` will be inserted on every 
indirect call.


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


r282749 - [sanitize-coverage] doc typo

2016-09-29 Thread Kostya Serebryany via cfe-commits
Author: kcc
Date: Thu Sep 29 13:34:40 2016
New Revision: 282749

URL: http://llvm.org/viewvc/llvm-project?rev=282749&view=rev
Log:
[sanitize-coverage] doc typo

Modified:
cfe/trunk/docs/SanitizerCoverage.rst

Modified: cfe/trunk/docs/SanitizerCoverage.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/SanitizerCoverage.rst?rev=282749&r1=282748&r2=282749&view=diff
==
--- cfe/trunk/docs/SanitizerCoverage.rst (original)
+++ cfe/trunk/docs/SanitizerCoverage.rst Thu Sep 29 13:34:40 2016
@@ -342,7 +342,7 @@ The compler will also insert a module co
 
// The guards are [start, stop).
// This function may be called multiple times with the same values of 
start/stop.
-   __sanitizer_cov_trace_pc_guard_init(uint32_t_t *start, uint32_t *stop);
+   __sanitizer_cov_trace_pc_guard_init(uint32_t *start, uint32_t *stop);
 
 Similarly to `trace-pc,indirect-calls`, with `trace-pc-guards,indirect-calls`
 ``__sanitizer_cov_trace_pc_indirect(void *callee)`` will be inserted on every 
indirect call.


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


Re: [PATCH] D25060: [Coroutines] Fix assertion about uncorrected typos in co_await/co_yield/co_return expressions.

2016-09-29 Thread Richard Smith via cfe-commits
LGTM

On Wed, Sep 28, 2016 at 10:09 PM, Eric Fiselier  wrote:

> EricWF created this revision.
> EricWF added reviewers: rsmith, GorNishanov.
> EricWF added a subscriber: cfe-commits.
> Herald added a subscriber: mehdi_amini.
>
> If there is an error finding the `coroutine_traits` template when building
> a coroutine AST nodes we throw away the remainder of the assignment
> expression. If the expression has uncorrected typo's this will trigger an
> assertion in `~Sema()`.
>
> This patch attempts to preemptively correct those typo's when we encounter
> an error building the coroutine nodes, at least for the case where the
> `coroutine_traits` template is invalid.
>
> https://reviews.llvm.org/D25060
>
> Files:
>   lib/Sema/SemaCoroutine.cpp
>   test/SemaCXX/coroutines.cpp
>
> Index: test/SemaCXX/coroutines.cpp
> ===
> --- test/SemaCXX/coroutines.cpp
> +++ test/SemaCXX/coroutines.cpp
> @@ -1,5 +1,22 @@
>  // RUN: %clang_cc1 -std=c++14 -fcoroutines -verify %s
>
> +void no_coroutine_traits_bad_arg_await() {
> +  co_await a; // expected-error {{include }}
> +  // expected-error@-1 {{use of undeclared identifier 'a'}}
> +}
> +
> +void no_coroutine_traits_bad_arg_yield() {
> +  co_yield a; // expected-error {{include }}
> +  // expected-error@-1 {{use of undeclared identifier 'a'}}
> +}
> +
> +
> +void no_coroutine_traits_bad_arg_return() {
> +  co_return a; // expected-error {{include }}
> +  // expected-error@-1 {{use of undeclared identifier 'a'}}
> +}
> +
> +
>  struct awaitable {
>bool await_ready();
>void await_suspend(); // FIXME: coroutine_handle
> Index: lib/Sema/SemaCoroutine.cpp
> ===
> --- lib/Sema/SemaCoroutine.cpp
> +++ lib/Sema/SemaCoroutine.cpp
> @@ -213,6 +213,11 @@
>  }
>
>  ExprResult Sema::ActOnCoawaitExpr(Scope *S, SourceLocation Loc, Expr *E) {
> +  auto *Coroutine = checkCoroutineContext(*this, Loc, "co_await");
> +  if (!Coroutine) {
> +CorrectDelayedTyposInExpr(E);
> +return ExprError();
> +  }
>if (E->getType()->isPlaceholderType()) {
>  ExprResult R = CheckPlaceholderExpr(E);
>  if (R.isInvalid()) return ExprError();
> @@ -222,6 +227,7 @@
>ExprResult Awaitable = buildOperatorCoawaitCall(*this, S, Loc, E);
>if (Awaitable.isInvalid())
>  return ExprError();
> +
>return BuildCoawaitExpr(Loc, Awaitable.get());
>  }
>  ExprResult Sema::BuildCoawaitExpr(SourceLocation Loc, Expr *E) {
> @@ -275,8 +281,10 @@
>
>  ExprResult Sema::ActOnCoyieldExpr(Scope *S, SourceLocation Loc, Expr *E) {
>auto *Coroutine = checkCoroutineContext(*this, Loc, "co_yield");
> -  if (!Coroutine)
> +  if (!Coroutine) {
> +CorrectDelayedTyposInExpr(E);
>  return ExprError();
> +  }
>
>// Build yield_value call.
>ExprResult Awaitable =
> @@ -325,6 +333,11 @@
>  }
>
>  StmtResult Sema::ActOnCoreturnStmt(SourceLocation Loc, Expr *E) {
> +  auto *Coroutine = checkCoroutineContext(*this, Loc, "co_return");
> +  if (!Coroutine) {
> +CorrectDelayedTyposInExpr(E);
> +return StmtError();
> +  }
>return BuildCoreturnStmt(Loc, E);
>  }
>  StmtResult Sema::BuildCoreturnStmt(SourceLocation Loc, Expr *E) {
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r282751 - [sanitizer-coverage] more docs

2016-09-29 Thread Kostya Serebryany via cfe-commits
Author: kcc
Date: Thu Sep 29 13:58:17 2016
New Revision: 282751

URL: http://llvm.org/viewvc/llvm-project?rev=282751&view=rev
Log:
[sanitizer-coverage] more docs

Modified:
cfe/trunk/docs/SanitizerCoverage.rst

Modified: cfe/trunk/docs/SanitizerCoverage.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/SanitizerCoverage.rst?rev=282751&r1=282750&r2=282751&view=diff
==
--- cfe/trunk/docs/SanitizerCoverage.rst (original)
+++ cfe/trunk/docs/SanitizerCoverage.rst Thu Sep 29 13:58:17 2016
@@ -349,6 +349,73 @@ Similarly to `trace-pc,indirect-calls`,
 
 The functions `__sanitizer_cov_trace_pc_*` should be defined by the user.
 
+Example: 
+
+.. code-block:: c++
+
+  // trace-pc-guard-cb.cc
+  #include 
+  #include 
+  #include 
+
+  // This callback is inserted by the compiler as a module constructor
+  // into every compilation unit. 'start' and 'stop' correspond to the
+  // beginning and end of the section with the guards for the entire
+  // binary (executable or DSO) and so it will be called multiple times
+  // with the same parameters.
+  extern "C" void __sanitizer_cov_trace_pc_guard_init(uint32_t *start,
+  uint32_t *stop) {
+static uint64_t N;  // Counter for the guards.
+if (start == stop || *start) return;  // Initialize only once.
+printf("INIT: %p %p\n", start, stop);
+for (uint32_t *x = start; x < stop; x++)
+  *x = ++N;  // Guards should start from 1.
+  }
+
+  // This callback is inserted by the compiler on every edge in the
+  // control flow (some optimizations apply).
+  // Typically, the compiler will emit the code like this:
+  //if(*guard)
+  //  __sanitizer_cov_trace_pc_guard(guard);
+  // But for large functions it will emit a simple call:
+  //__sanitizer_cov_trace_pc_guard(guard);
+  extern "C" void __sanitizer_cov_trace_pc_guard(uint32_t *guard) {
+if (!*guard) return;  // Duplicate the guard check.
+// If you set *guard to 0 this code will not be called again for this edge.
+// Now you can get the PC and do whatever you want: 
+//   store it somewhere or symbolize it and print right away.
+// The values of `*guard` are as you set them in
+// __sanitizer_cov_trace_pc_guard_init and so you can make the consecutive
+// and use them to dereference an array or a bit vector.
+void *PC = __builtin_return_address(0);
+char PcDescr[1024];
+// This function is a part of the sanitizer run-time.
+// To use it, link with AddressSanitizer or other sanitizer.
+__sanitizer_symbolize_pc(PC, "%p %F %L", PcDescr, sizeof(PcDescr));
+printf("guard: %p %x PC %s\n", guard, *guard, PcDescr);
+  }
+
+.. code-block:: c++
+
+  // trace-pc-guard-example.cc
+  void foo() { }
+  int main(int argc, char **argv) {
+if (argc > 1) foo();
+  }
+
+.. code-block:: console
+  
+  clang++ -g  -fsanitize-coverage=trace-pc-guard trace-pc-guard-example.cc -c
+  clang++ trace-pc-guard-cb.cc trace-pc-guard-example.o -fsanitize=address
+  ASAN_OPTIONS=strip_path_prefix=`pwd`/ ./a.out
+
+.. code-block:: console
+
+  INIT: 0x71bcd0 0x71bce0
+  guard: 0x71bcd4 2 PC 0x4ecd5b in main trace-pc-guard-example.cc:2
+  guard: 0x71bcd8 3 PC 0x4ecd9e in main trace-pc-guard-example.cc:3:7
+
+
 Tracing data flow
 =
 


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


r282752 - [sanitizer-coverage] a bit more docs

2016-09-29 Thread Kostya Serebryany via cfe-commits
Author: kcc
Date: Thu Sep 29 14:06:09 2016
New Revision: 282752

URL: http://llvm.org/viewvc/llvm-project?rev=282752&view=rev
Log:
[sanitizer-coverage] a bit more docs

Modified:
cfe/trunk/docs/SanitizerCoverage.rst

Modified: cfe/trunk/docs/SanitizerCoverage.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/SanitizerCoverage.rst?rev=282752&r1=282751&r2=282752&view=diff
==
--- cfe/trunk/docs/SanitizerCoverage.rst (original)
+++ cfe/trunk/docs/SanitizerCoverage.rst Thu Sep 29 14:06:09 2016
@@ -385,7 +385,7 @@ Example:
 // Now you can get the PC and do whatever you want: 
 //   store it somewhere or symbolize it and print right away.
 // The values of `*guard` are as you set them in
-// __sanitizer_cov_trace_pc_guard_init and so you can make the consecutive
+// __sanitizer_cov_trace_pc_guard_init and so you can make them consecutive
 // and use them to dereference an array or a bit vector.
 void *PC = __builtin_return_address(0);
 char PcDescr[1024];
@@ -415,6 +415,18 @@ Example:
   guard: 0x71bcd4 2 PC 0x4ecd5b in main trace-pc-guard-example.cc:2
   guard: 0x71bcd8 3 PC 0x4ecd9e in main trace-pc-guard-example.cc:3:7
 
+.. code-block:: console
+
+  ASAN_OPTIONS=strip_path_prefix=`pwd`/ ./a.out with-foo
+
+
+.. code-block:: console
+
+  INIT: 0x71bcd0 0x71bce0
+  guard: 0x71bcd4 2 PC 0x4ecd5b in main trace-pc-guard-example.cc:3
+  guard: 0x71bcdc 4 PC 0x4ecdc7 in main trace-pc-guard-example.cc:4:17
+  guard: 0x71bcd0 1 PC 0x4ecd20 in foo() trace-pc-guard-example.cc:2:14
+
 
 Tracing data flow
 =


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


r282757 - [Myriad] Silently ignore -fno-split-dwarf-inlining

2016-09-29 Thread Douglas Katzman via cfe-commits
Author: dougk
Date: Thu Sep 29 14:59:12 2016
New Revision: 282757

URL: http://llvm.org/viewvc/llvm-project?rev=282757&view=rev
Log:
[Myriad] Silently ignore -fno-split-dwarf-inlining

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/myriad-toolchain.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=282757&r1=282756&r2=282757&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Sep 29 14:59:12 2016
@@ -11003,12 +11003,14 @@ void tools::SHAVE::Compiler::ConstructJo
   // Append all -I, -iquote, -isystem paths, defines/undefines,
   // 'f' flags, optimize flags, and warning options.
   // These are spelled the same way in clang and moviCompile.
-  Args.AddAllArgs(CmdArgs, {options::OPT_I_Group, options::OPT_clang_i_Group,
-options::OPT_std_EQ, options::OPT_D, 
options::OPT_U,
-options::OPT_f_Group, options::OPT_f_clang_Group,
-options::OPT_g_Group, options::OPT_M_Group,
-options::OPT_O_Group, options::OPT_W_Group,
-options::OPT_mcpu_EQ});
+  Args.AddAllArgsExcept(
+  CmdArgs,
+  {options::OPT_I_Group, options::OPT_clang_i_Group, options::OPT_std_EQ,
+   options::OPT_D, options::OPT_U, options::OPT_f_Group,
+   options::OPT_f_clang_Group, options::OPT_g_Group, options::OPT_M_Group,
+   options::OPT_O_Group, options::OPT_W_Group, options::OPT_mcpu_EQ},
+  {options::OPT_fno_split_dwarf_inlining});
+  Args.hasArg(options::OPT_fno_split_dwarf_inlining); // Claim it if present.
 
   // If we're producing a dependency file, and assembly is the final action,
   // then the name of the target in the dependency file should be the '.o'

Modified: cfe/trunk/test/Driver/myriad-toolchain.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/myriad-toolchain.c?rev=282757&r1=282756&r2=282757&view=diff
==
--- cfe/trunk/test/Driver/myriad-toolchain.c (original)
+++ cfe/trunk/test/Driver/myriad-toolchain.c Thu Sep 29 14:59:12 2016
@@ -50,8 +50,9 @@
 // RUN:   | FileCheck %s -check-prefix=INCLUDES
 // INCLUDES: "-iquote" "quotepath" "-isystem" "syspath"
 
+// -fno-split-dwarf-inlining is consumed but not passed to moviCompile.
 // RUN: %clang -target shave-myriad -c -### %s -g -fno-inline-functions \
-// RUN: -fno-inline-functions-called-once -Os -Wall -MF dep.d \
+// RUN: -fno-inline-functions-called-once -Os -Wall -MF dep.d 
-fno-split-dwarf-inlining \
 // RUN: -ffunction-sections 2>&1 | FileCheck %s -check-prefix=PASSTHRU_OPTIONS
 // PASSTHRU_OPTIONS: "-g" "-fno-inline-functions" 
"-fno-inline-functions-called-once"
 // PASSTHRU_OPTIONS: "-Os" "-Wall" "-MF" "dep.d" "-ffunction-sections"


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


r282777 - Switch to a different workaround for unimplementability of P0145R3 in MS ABIs.

2016-09-29 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Sep 29 16:30:12 2016
New Revision: 282777

URL: http://llvm.org/viewvc/llvm-project?rev=282777&view=rev
Log:
Switch to a different workaround for unimplementability of P0145R3 in MS ABIs.
Instead of ignoring the evaluation order rule, ignore the "destroy parameters
in reverse construction order" rule for the small number of problematic cases.
This only causes incorrect behavior in the rare case where both parameters to
an overloaded operator <<, >>, ->*, &&, ||, or comma are of class type with
non-trivial destructor, and the program is depending on those parameters being
destroyed in reverse construction order.

We could do a little better here by reversing the order of parameter
destruction for those functions (and reversing the argument evaluation order
for all direct calls, not just those with operator syntax), but that is not a
complete solution to the problem, as the same situation can be reached by an
indirect function call.

Approach reviewed off-line by rnk.

Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/CodeGen/CGExprCXX.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
cfe/trunk/test/CodeGenCXX/cxx1z-eval-order.cpp
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=282777&r1=282776&r2=282777&view=diff
==
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Thu Sep 29 16:30:12 2016
@@ -3173,7 +3173,7 @@ void CodeGenFunction::EmitCallArgs(
 CallArgList &Args, ArrayRef ArgTypes,
 llvm::iterator_range ArgRange,
 const FunctionDecl *CalleeDecl, unsigned ParamsToSkip,
-bool ForceRightToLeftEvaluation) {
+EvaluationOrder Order) {
   assert((int)ArgTypes.size() == (ArgRange.end() - ArgRange.begin()));
 
   auto MaybeEmitImplicitObjectSize = [&](unsigned I, const Expr *Arg) {
@@ -3191,11 +3191,18 @@ void CodeGenFunction::EmitCallArgs(
   };
 
   // We *have* to evaluate arguments from right to left in the MS C++ ABI,
-  // because arguments are destroyed left to right in the callee.
-  if (CGM.getTarget().getCXXABI().areArgsDestroyedLeftToRightInCallee() ||
-  ForceRightToLeftEvaluation) {
-// Insert a stack save if we're going to need any inalloca args.
-bool HasInAllocaArgs = false;
+  // because arguments are destroyed left to right in the callee. As a special
+  // case, there are certain language constructs that require left-to-right
+  // evaluation, and in those cases we consider the evaluation order 
requirement
+  // to trump the "destruction order is reverse construction order" guarantee.
+  bool LeftToRight =
+  CGM.getTarget().getCXXABI().areArgsDestroyedLeftToRightInCallee()
+  ? Order == EvaluationOrder::ForceLeftToRight
+  : Order != EvaluationOrder::ForceRightToLeft;
+
+  // Insert a stack save if we're going to need any inalloca args.
+  bool HasInAllocaArgs = false;
+  if (CGM.getTarget().getCXXABI().isMicrosoft()) {
 for (ArrayRef::iterator I = ArgTypes.begin(), E = ArgTypes.end();
  I != E && !HasInAllocaArgs; ++I)
   HasInAllocaArgs = isInAllocaArgument(CGM.getCXXABI(), *I);
@@ -3203,30 +3210,24 @@ void CodeGenFunction::EmitCallArgs(
   assert(getTarget().getTriple().getArch() == llvm::Triple::x86);
   Args.allocateArgumentMemory(*this);
 }
+  }
 
-// Evaluate each argument.
-size_t CallArgsStart = Args.size();
-for (int I = ArgTypes.size() - 1; I >= 0; --I) {
-  CallExpr::const_arg_iterator Arg = ArgRange.begin() + I;
-  MaybeEmitImplicitObjectSize(I, *Arg);
-  EmitCallArg(Args, *Arg, ArgTypes[I]);
-  EmitNonNullArgCheck(Args.back().RV, ArgTypes[I], (*Arg)->getExprLoc(),
-  CalleeDecl, ParamsToSkip + I);
-}
+  // Evaluate each argument in the appropriate order.
+  size_t CallArgsStart = Args.size();
+  for (unsigned I = 0, E = ArgTypes.size(); I != E; ++I) {
+unsigned Idx = LeftToRight ? I : E - I - 1;
+CallExpr::const_arg_iterator Arg = ArgRange.begin() + Idx;
+if (!LeftToRight) MaybeEmitImplicitObjectSize(Idx, *Arg);
+EmitCallArg(Args, *Arg, ArgTypes[Idx]);
+EmitNonNullArgCheck(Args.back().RV, ArgTypes[Idx], (*Arg)->getExprLoc(),
+CalleeDecl, ParamsToSkip + Idx);
+if (LeftToRight) MaybeEmitImplicitObjectSize(Idx, *Arg);
+  }
 
+  if (!LeftToRight) {
 // Un-reverse the arguments we just evaluated so they match up with the 
LLVM
 // IR function.
 std::reverse(Args.begin() + CallArgsStart, Args.end());
-return;
-  }
-
-  for (unsigned I = 0, E = ArgTypes.size(); I != E; ++I) {
-CallExpr::const_arg_iterator Arg = ArgRange.begin() + I;
-assert(Arg != ArgRange.end());
-EmitCallArg(Args, *Arg, ArgTypes[I]);
-EmitNonNullArgCheck(Args.back().RV, ArgTypes[I], (*Arg)->getExprLoc(),
-  

r282792 - [Coroutines] Fix assertion about uncorrected typos in co_await/co_yield/co_return expressions

2016-09-29 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Sep 29 16:47:39 2016
New Revision: 282792

URL: http://llvm.org/viewvc/llvm-project?rev=282792&view=rev
Log:
[Coroutines] Fix assertion about uncorrected typos in 
co_await/co_yield/co_return expressions

Modified:
cfe/trunk/lib/Sema/SemaCoroutine.cpp
cfe/trunk/test/SemaCXX/coroutines.cpp

Modified: cfe/trunk/lib/Sema/SemaCoroutine.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCoroutine.cpp?rev=282792&r1=282791&r2=282792&view=diff
==
--- cfe/trunk/lib/Sema/SemaCoroutine.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCoroutine.cpp Thu Sep 29 16:47:39 2016
@@ -213,6 +213,11 @@ static ReadySuspendResumeResult buildCoa
 }
 
 ExprResult Sema::ActOnCoawaitExpr(Scope *S, SourceLocation Loc, Expr *E) {
+  auto *Coroutine = checkCoroutineContext(*this, Loc, "co_await");
+  if (!Coroutine) {
+CorrectDelayedTyposInExpr(E);
+return ExprError();
+  }
   if (E->getType()->isPlaceholderType()) {
 ExprResult R = CheckPlaceholderExpr(E);
 if (R.isInvalid()) return ExprError();
@@ -222,6 +227,7 @@ ExprResult Sema::ActOnCoawaitExpr(Scope
   ExprResult Awaitable = buildOperatorCoawaitCall(*this, S, Loc, E);
   if (Awaitable.isInvalid())
 return ExprError();
+
   return BuildCoawaitExpr(Loc, Awaitable.get());
 }
 ExprResult Sema::BuildCoawaitExpr(SourceLocation Loc, Expr *E) {
@@ -275,8 +281,10 @@ static ExprResult buildPromiseCall(Sema
 
 ExprResult Sema::ActOnCoyieldExpr(Scope *S, SourceLocation Loc, Expr *E) {
   auto *Coroutine = checkCoroutineContext(*this, Loc, "co_yield");
-  if (!Coroutine)
+  if (!Coroutine) {
+CorrectDelayedTyposInExpr(E);
 return ExprError();
+  }
 
   // Build yield_value call.
   ExprResult Awaitable =
@@ -325,6 +333,11 @@ ExprResult Sema::BuildCoyieldExpr(Source
 }
 
 StmtResult Sema::ActOnCoreturnStmt(SourceLocation Loc, Expr *E) {
+  auto *Coroutine = checkCoroutineContext(*this, Loc, "co_return");
+  if (!Coroutine) {
+CorrectDelayedTyposInExpr(E);
+return StmtError();
+  }
   return BuildCoreturnStmt(Loc, E);
 }
 StmtResult Sema::BuildCoreturnStmt(SourceLocation Loc, Expr *E) {

Modified: cfe/trunk/test/SemaCXX/coroutines.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/coroutines.cpp?rev=282792&r1=282791&r2=282792&view=diff
==
--- cfe/trunk/test/SemaCXX/coroutines.cpp (original)
+++ cfe/trunk/test/SemaCXX/coroutines.cpp Thu Sep 29 16:47:39 2016
@@ -1,5 +1,22 @@
 // RUN: %clang_cc1 -std=c++14 -fcoroutines -verify %s
 
+void no_coroutine_traits_bad_arg_await() {
+  co_await a; // expected-error {{include }}
+  // expected-error@-1 {{use of undeclared identifier 'a'}}
+}
+
+void no_coroutine_traits_bad_arg_yield() {
+  co_yield a; // expected-error {{include }}
+  // expected-error@-1 {{use of undeclared identifier 'a'}}
+}
+
+
+void no_coroutine_traits_bad_arg_return() {
+  co_return a; // expected-error {{include }}
+  // expected-error@-1 {{use of undeclared identifier 'a'}}
+}
+
+
 struct awaitable {
   bool await_ready();
   void await_suspend(); // FIXME: coroutine_handle


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


r282800 - P0035R4: add std::align_val_t overloads of operator new/delete in C++17 mode.

2016-09-29 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Sep 29 17:49:46 2016
New Revision: 282800

URL: http://llvm.org/viewvc/llvm-project?rev=282800&view=rev
Log:
P0035R4: add std::align_val_t overloads of operator new/delete in C++17 mode.

Added:
cfe/trunk/test/PCH/cxx1z-aligned-alloc.cpp
Modified:
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/DeclCXX.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp
cfe/trunk/test/CXX/drs/dr5xx.cpp

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=282800&r1=282799&r2=282800&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Thu Sep 29 17:49:46 2016
@@ -721,6 +721,10 @@ public:
   /// standard library.
   LazyDeclPtr StdBadAlloc;
 
+  /// \brief The C++ "std::align_val_t" enum class, which is defined by the C++
+  /// standard library.
+  LazyDeclPtr StdAlignValT;
+
   /// \brief The C++ "std::initializer_list" template, which is defined in
   /// \.
   ClassTemplateDecl *StdInitializerList;
@@ -4237,6 +4241,7 @@ public:
   NamespaceDecl *getOrCreateStdNamespace();
 
   CXXRecordDecl *getStdBadAlloc() const;
+  EnumDecl *getStdAlignValT() const;
 
   /// \brief Tests whether Ty is an instance of std::initializer_list and, if
   /// it is and Element is not NULL, assigns the element type to Element.
@@ -4838,8 +4843,7 @@ public:
   bool Diagnose = true);
   void DeclareGlobalNewDelete();
   void DeclareGlobalAllocationFunction(DeclarationName Name, QualType Return,
-   QualType Param1,
-   QualType Param2 = QualType());
+   ArrayRef Params);
 
   bool FindDeallocationFunction(SourceLocation StartLoc, CXXRecordDecl *RD,
 DeclarationName Name, FunctionDecl* &Operator,

Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=282800&r1=282799&r2=282800&view=diff
==
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Thu Sep 29 17:49:46 2016
@@ -1577,7 +1577,7 @@ bool CXXMethodDecl::isUsualDeallocationF
   //   deallocation function. [...]
   if (getNumParams() == 1)
 return true;
-  
+
   // C++ [basic.stc.dynamic.deallocation]p2:
   //   [...] If class T does not declare such an operator delete but does 
   //   declare a member deallocation function named operator delete with 

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=282800&r1=282799&r2=282800&view=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Sep 29 17:49:46 2016
@@ -12535,6 +12535,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned
   DeclContext *SearchDC = CurContext;
   DeclContext *DC = CurContext;
   bool isStdBadAlloc = false;
+  bool isStdAlignValT = false;
 
   RedeclarationKind Redecl = ForRedeclaration;
   if (TUK == TUK_Friend || TUK == TUK_Reference)
@@ -12689,15 +12690,20 @@ Decl *Sema::ActOnTag(Scope *S, unsigned
   }
 
   if (getLangOpts().CPlusPlus && Name && DC && StdNamespace &&
-  DC->Equals(getStdNamespace()) && Name->isStr("bad_alloc")) {
-// This is a declaration of or a reference to "std::bad_alloc".
-isStdBadAlloc = true;
-
-if (Previous.empty() && StdBadAlloc) {
-  // std::bad_alloc has been implicitly declared (but made invisible to
-  // name lookup). Fill in this implicit declaration as the previous
+  DC->Equals(getStdNamespace())) {
+if (Name->isStr("bad_alloc")) {
+  // This is a declaration of or a reference to "std::bad_alloc".
+  isStdBadAlloc = true;
+
+  // If std::bad_alloc has been implicitly declared (but made invisible to
+  // name lookup), fill in this implicit declaration as the previous
   // declaration, so that the declarations get chained appropriately.
-  Previous.addDecl(getStdBadAlloc());
+  if (Previous.empty() && StdBadAlloc)
+Previous.addDecl(getStdBadAlloc());
+} else if (Name->isStr("align_val_t")) {
+  isStdAlignValT = true;
+  if (Previous.empty() && StdAlignValT)
+Previous.addDecl(getStdAlignValT());
 }
   }
 
@@ -13089,6 +13095,10 @@ CreateNewDecl:
 New = EnumDecl::Create(Context, SearchDC, KWLoc, Loc, Name,
cast_or_null(PrevDecl), ScopedEnum,
ScopedEnumUsesClassTag, !EnumUnderlying.isNull());
+
+if (isStdAlignValT && (!StdAlignValT

[PATCH] [coroutines] Rename driver flag -fcoroutines to -fcoroutines-ts

2016-09-29 Thread Gor Nishanov via cfe-commits
Currently the -fcoroutines flag is a CC1 only flag. It really should be
both a Driver and CC1 flag. This patch fixes the option and adds tests for
the new options.

Also adds a __has_feature for coroutines.
Patch is mostly by Eric Fiselier
.
Meticulous and painstaking extraction from the larger coroutine branch by
Gor Nishanov

P.S.

Switching to lowercase [coroutines] tag in the title, as most of the
coroutine commits in cfe were done with lowercase tag.
diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td
index 66e1ad6..73ab5e6 100644
--- a/include/clang/Driver/CC1Options.td
+++ b/include/clang/Driver/CC1Options.td
@@ -638,10 +638,6 @@ def fdefault_calling_conv_EQ : Joined<["-"], "fdefault-calling-conv=">,
 def finclude_default_header : Flag<["-"], "finclude-default-header">,
   HelpText<"Include the default header file for OpenCL">;
 
-// C++ TSes.
-def fcoroutines : Flag<["-"], "fcoroutines">,
-  HelpText<"Enable support for the C++ Coroutines TS">;
-
 //===--===//
 // Header Search Options
 //===--===//
diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td
index 6090304..dba95c7 100644
--- a/include/clang/Driver/Options.td
+++ b/include/clang/Driver/Options.td
@@ -481,6 +481,13 @@ def fno_autolink : Flag <["-"], "fno-autolink">, Group,
   Flags<[DriverOption, CC1Option]>,
   HelpText<"Disable generation of linker directives for automatic library linking">;
 
+// C++ Coroutines TS
+def fcoroutines : Flag <["-"], "fcoroutines-ts">, Group,
+  Flags<[DriverOption, CC1Option]>,
+  HelpText<"Enable support for the C++ Coroutines TS">;
+def fno_coroutines : Flag <["-"], "fno-coroutines-ts">, Group,
+  Flags<[DriverOption]>;
+
 def fembed_bitcode_EQ : Joined<["-"], "fembed-bitcode=">,
 Group, Flags<[DriverOption, CC1Option]>, MetaVarName<"">,
 HelpText<"Embed LLVM bitcode (option: off, all, bitcode, marker)">;
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index d806efd..18891cf 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -5423,6 +5423,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
   CmdArgs.push_back("-fblocks-runtime-optional");
   }
 
+  if (Args.hasFlag(options::OPT_fcoroutines, options::OPT_fno_coroutines, false)
+  && types::isCXX(InputType)) {
+CmdArgs.push_back("-fcoroutines-ts");
+  }
+
   // -fmodules enables the use of precompiled modules (off by default).
   // Users can pass -fno-cxx-modules to turn off modules support for
   // C++/Objective-C++ programs.
diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp
index 940192b..838f769 100644
--- a/lib/Lex/PPMacroExpansion.cpp
+++ b/lib/Lex/PPMacroExpansion.cpp
@@ -1213,6 +1213,7 @@ static bool HasFeature(const Preprocessor &PP, StringRef Feature) {
   // Type traits
   // N.B. Additional type traits should not be added to the following list.
   // Instead, they should be detected by has_extension.
+  .Case("coroutines", LangOpts.Coroutines)
   .Case("has_nothrow_assign", LangOpts.CPlusPlus)
   .Case("has_nothrow_copy", LangOpts.CPlusPlus)
   .Case("has_nothrow_constructor", LangOpts.CPlusPlus)
diff --git a/test/CodeGenCoroutines/microsoft-abi-operator-coawait.cpp b/test/CodeGenCoroutines/microsoft-abi-operator-coawait.cpp
index e87fed0..1921c06 100644
--- a/test/CodeGenCoroutines/microsoft-abi-operator-coawait.cpp
+++ b/test/CodeGenCoroutines/microsoft-abi-operator-coawait.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc18.0.0 -fcoroutines -emit-llvm %s -o - -std=c++14 -disable-llvm-passes | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc18.0.0 -fcoroutines-ts -emit-llvm %s -o - -std=c++14 -disable-llvm-passes | FileCheck %s
 struct no_suspend {
   bool await_ready() { return true; }
   template  void await_suspend(F) {}
diff --git a/test/Driver/coroutines.m b/test/Driver/coroutines.m
new file mode 100644
index 000..d610234
--- /dev/null
+++ b/test/Driver/coroutines.m
@@ -0,0 +1,6 @@
+// RUN: %clang -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-CORO %s
+// RUN: %clang -fcoroutines-ts -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-CORO %s
+// RUN: %clang -fno-coroutines-ts -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-CORO %s
+// RUN: %clang -fno-coroutines-ts -fcoroutines-ts -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-CORO %s
+// CHECK-NO-CORO-NOT: -fcoroutines-ts
+
diff --git a/test/Driver/coroutines.mm b/test/Driver/coroutines.mm
new file mode 100644
index 000..99e0ff5
--- /dev/null
+++ b/test/Driver/coroutines.mm
@@ -0,0 +1,9 @@
+// RUN: %clang -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-CORO %s
+// RUN: %clang -fcoroutines-ts -fno-coroutines-ts -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-CORO %s
+// RUN: %clang -fno-coroutines-ts -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-

Re: [PATCH] [coroutines] Rename driver flag -fcoroutines to -fcoroutines-ts

2016-09-29 Thread Gor Nishanov via cfe-commits
Let's see if renaming the attachment to *.txt helps.

On Thu, Sep 29, 2016 at 5:42 PM, Gor Nishanov  wrote:

> Currently the -fcoroutines flag is a CC1 only flag. It really should be
> both a Driver and CC1 flag. This patch fixes the option and adds tests for
> the new options.
>
> Also adds a __has_feature for coroutines.
> Patch is mostly by Eric Fiselier
> .
> Meticulous and painstaking extraction from the larger coroutine branch by
> Gor Nishanov
>
> P.S.
>
> Switching to lowercase [coroutines] tag in the title, as most of the
> coroutine commits in cfe were done with lowercase tag.
>
diff --git a/include/clang/Driver/CC1Options.td 
b/include/clang/Driver/CC1Options.td
index 66e1ad6..73ab5e6 100644
--- a/include/clang/Driver/CC1Options.td
+++ b/include/clang/Driver/CC1Options.td
@@ -638,10 +638,6 @@ def fdefault_calling_conv_EQ : Joined<["-"], 
"fdefault-calling-conv=">,
 def finclude_default_header : Flag<["-"], "finclude-default-header">,
   HelpText<"Include the default header file for OpenCL">;
 
-// C++ TSes.
-def fcoroutines : Flag<["-"], "fcoroutines">,
-  HelpText<"Enable support for the C++ Coroutines TS">;
-
 
//===--===//
 // Header Search Options
 
//===--===//
diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td
index 6090304..dba95c7 100644
--- a/include/clang/Driver/Options.td
+++ b/include/clang/Driver/Options.td
@@ -481,6 +481,13 @@ def fno_autolink : Flag <["-"], "fno-autolink">, 
Group,
   Flags<[DriverOption, CC1Option]>,
   HelpText<"Disable generation of linker directives for automatic library 
linking">;
 
+// C++ Coroutines TS
+def fcoroutines : Flag <["-"], "fcoroutines-ts">, Group,
+  Flags<[DriverOption, CC1Option]>,
+  HelpText<"Enable support for the C++ Coroutines TS">;
+def fno_coroutines : Flag <["-"], "fno-coroutines-ts">, Group,
+  Flags<[DriverOption]>;
+
 def fembed_bitcode_EQ : Joined<["-"], "fembed-bitcode=">,
 Group, Flags<[DriverOption, CC1Option]>, MetaVarName<"">,
 HelpText<"Embed LLVM bitcode (option: off, all, bitcode, marker)">;
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index d806efd..18891cf 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -5423,6 +5423,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction 
&JA,
   CmdArgs.push_back("-fblocks-runtime-optional");
   }
 
+  if (Args.hasFlag(options::OPT_fcoroutines, options::OPT_fno_coroutines, 
false)
+  && types::isCXX(InputType)) {
+CmdArgs.push_back("-fcoroutines-ts");
+  }
+
   // -fmodules enables the use of precompiled modules (off by default).
   // Users can pass -fno-cxx-modules to turn off modules support for
   // C++/Objective-C++ programs.
diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp
index 940192b..838f769 100644
--- a/lib/Lex/PPMacroExpansion.cpp
+++ b/lib/Lex/PPMacroExpansion.cpp
@@ -1213,6 +1213,7 @@ static bool HasFeature(const Preprocessor &PP, StringRef 
Feature) {
   // Type traits
   // N.B. Additional type traits should not be added to the following list.
   // Instead, they should be detected by has_extension.
+  .Case("coroutines", LangOpts.Coroutines)
   .Case("has_nothrow_assign", LangOpts.CPlusPlus)
   .Case("has_nothrow_copy", LangOpts.CPlusPlus)
   .Case("has_nothrow_constructor", LangOpts.CPlusPlus)
diff --git a/test/CodeGenCoroutines/microsoft-abi-operator-coawait.cpp 
b/test/CodeGenCoroutines/microsoft-abi-operator-coawait.cpp
index e87fed0..1921c06 100644
--- a/test/CodeGenCoroutines/microsoft-abi-operator-coawait.cpp
+++ b/test/CodeGenCoroutines/microsoft-abi-operator-coawait.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc18.0.0 -fcoroutines 
-emit-llvm %s -o - -std=c++14 -disable-llvm-passes | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc18.0.0 -fcoroutines-ts 
-emit-llvm %s -o - -std=c++14 -disable-llvm-passes | FileCheck %s
 struct no_suspend {
   bool await_ready() { return true; }
   template  void await_suspend(F) {}
diff --git a/test/Driver/coroutines.m b/test/Driver/coroutines.m
new file mode 100644
index 000..d610234
--- /dev/null
+++ b/test/Driver/coroutines.m
@@ -0,0 +1,6 @@
+// RUN: %clang -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-CORO %s
+// RUN: %clang -fcoroutines-ts -### %s 2>&1 | FileCheck 
-check-prefix=CHECK-NO-CORO %s
+// RUN: %clang -fno-coroutines-ts -### %s 2>&1 | FileCheck 
-check-prefix=CHECK-NO-CORO %s
+// RUN: %clang -fno-coroutines-ts -fcoroutines-ts -### %s 2>&1 | FileCheck 
-check-prefix=CHECK-NO-CORO %s
+// CHECK-NO-CORO-NOT: -fcoroutines-ts
+
diff --git a/test/Driver/coroutines.mm b/test/Driver/coroutines.mm
new file mode 100644
index 000..99e0ff5
--- /dev/null
+++ b/test/Driver/coroutines.mm
@@ -0,0 +1,9 @@
+// RUN: %clang -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-CORO %s
+// RUN: %clang -fcoroutines-ts -fno-co

r282822 - Move UTF functions into namespace llvm.

2016-09-29 Thread Justin Lebar via cfe-commits
Author: jlebar
Date: Thu Sep 29 19:38:45 2016
New Revision: 282822

URL: http://llvm.org/viewvc/llvm-project?rev=282822&view=rev
Log:
Move UTF functions into namespace llvm.

Summary:
This lets people link against LLVM and their own version of the UTF
library.

I determined this only affects llvm, clang, lld, and lldb by running

$ git grep -wl 'UTF[0-9]\+\|\bConvertUTF\bisLegalUTF\|getNumBytesFor' | cut -f 
1 -d '/' | sort | uniq
  clang
  lld
  lldb
  llvm

Tested with

  ninja lldb
  ninja check-clang check-llvm check-lld

(ninja check-lldb doesn't complete for me with or without this patch.)

Reviewers: rnk

Subscribers: klimek, beanz, mgorny, llvm-commits

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

Modified:
cfe/trunk/lib/Analysis/FormatString.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/Format/Encoding.h
cfe/trunk/lib/Frontend/TextDiagnostic.cpp
cfe/trunk/lib/Lex/Lexer.cpp
cfe/trunk/lib/Lex/LiteralSupport.cpp
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/lib/Analysis/FormatString.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/FormatString.cpp?rev=282822&r1=282821&r2=282822&view=diff
==
--- cfe/trunk/lib/Analysis/FormatString.cpp (original)
+++ cfe/trunk/lib/Analysis/FormatString.cpp Thu Sep 29 19:38:45 2016
@@ -266,14 +266,15 @@ bool clang::analyze_format_string::Parse
   if (SpecifierBegin + 1 >= FmtStrEnd)
 return false;
 
-  const UTF8 *SB = reinterpret_cast(SpecifierBegin + 1);
-  const UTF8 *SE = reinterpret_cast(FmtStrEnd);
+  const llvm::UTF8 *SB =
+  reinterpret_cast(SpecifierBegin + 1);
+  const llvm::UTF8 *SE = reinterpret_cast(FmtStrEnd);
   const char FirstByte = *SB;
 
   // If the invalid specifier is a multibyte UTF-8 string, return the
   // total length accordingly so that the conversion specifier can be
   // properly updated to reflect a complete UTF-8 specifier.
-  unsigned NumBytes = getNumBytesForUTF8(FirstByte);
+  unsigned NumBytes = llvm::getNumBytesForUTF8(FirstByte);
   if (NumBytes == 1)
 return false;
   if (SB + NumBytes > SE)

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=282822&r1=282821&r2=282822&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Thu Sep 29 19:38:45 2016
@@ -3136,13 +3136,12 @@ GetConstantCFStringEntry(llvm::StringMap
   // Otherwise, convert the UTF8 literals into a string of shorts.
   IsUTF16 = true;
 
-  SmallVector ToBuf(NumBytes + 1); // +1 for ending nulls.
-  const UTF8 *FromPtr = (const UTF8 *)String.data();
-  UTF16 *ToPtr = &ToBuf[0];
+  SmallVector ToBuf(NumBytes + 1); // +1 for ending nulls.
+  const llvm::UTF8 *FromPtr = (const llvm::UTF8 *)String.data();
+  llvm::UTF16 *ToPtr = &ToBuf[0];
 
-  (void)ConvertUTF8toUTF16(&FromPtr, FromPtr + NumBytes,
-   &ToPtr, ToPtr + NumBytes,
-   strictConversion);
+  (void)llvm::ConvertUTF8toUTF16(&FromPtr, FromPtr + NumBytes, &ToPtr,
+ ToPtr + NumBytes, llvm::strictConversion);
 
   // ConvertUTF8toUTF16 returns the length in ToPtr.
   StringLength = ToPtr - &ToBuf[0];

Modified: cfe/trunk/lib/Format/Encoding.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Encoding.h?rev=282822&r1=282821&r2=282822&view=diff
==
--- cfe/trunk/lib/Format/Encoding.h (original)
+++ cfe/trunk/lib/Format/Encoding.h Thu Sep 29 19:38:45 2016
@@ -33,16 +33,17 @@ enum Encoding {
 /// \brief Detects encoding of the Text. If the Text can be decoded using 
UTF-8,
 /// it is considered UTF8, otherwise we treat it as some 8-bit encoding.
 inline Encoding detectEncoding(StringRef Text) {
-  const UTF8 *Ptr = reinterpret_cast(Text.begin());
-  const UTF8 *BufEnd = reinterpret_cast(Text.end());
-  if (::isLegalUTF8String(&Ptr, BufEnd))
+  const llvm::UTF8 *Ptr = reinterpret_cast(Text.begin());
+  const llvm::UTF8 *BufEnd = reinterpret_cast(Text.end());
+  if (llvm::isLegalUTF8String(&Ptr, BufEnd))
 return Encoding_UTF8;
   return Encoding_Unknown;
 }
 
 inline unsigned getCodePointCountUTF8(StringRef Text) {
   unsigned CodePoints = 0;
-  for (size_t i = 0, e = Text.size(); i < e; i += getNumBytesForUTF8(Text[i])) 
{
+  for (size_t i = 0, e = Text.size(); i < e;
+   i += llvm::getNumBytesForUTF8(Text[i])) {
 ++CodePoints;
   }
   return CodePoints;
@@ -97,7 +98,7 @@ inline unsigned columnWidthWithTabs(Stri
 inline unsigned getCodePointNumBytes(char FirstChar, Encoding Encoding) {
   switch (Encoding) {
   case Encoding_UTF8:
-return getNumBytesForUTF8(FirstChar);
+return llvm::getNumBytesForUTF8(FirstChar);
   defaul

Re: [PATCH] [coroutines] Rename driver flag -fcoroutines to -fcoroutines-ts

2016-09-29 Thread Richard Smith via cfe-commits
+def fcoroutines : Flag <["-"], "fcoroutines-ts">, Group,
+  Flags<[DriverOption, CC1Option]>,
+  HelpText<"Enable support for the C++ Coroutines TS">;
+def fno_coroutines : Flag <["-"], "fno-coroutines-ts">, Group,

These should be named fcoroutines_ts, fno_coroutines_ts (see comment at the
top of the file for the naming scheme).

+  .Case("coroutines", LangOpts.Coroutines)

We should use the SD-6 macro name (__cpp_coroutines) rather than
__has_feature for new features that are covered by SD-6. However, we
shouldn't be defining this until we have a complete implementation. (Code
using this for a feature test wants to test whether the feature works, not
just whether it's enabled on the command line.)

On Thu, Sep 29, 2016 at 5:45 PM, Gor Nishanov  wrote:

> Let's see if renaming the attachment to *.txt helps.
>
> On Thu, Sep 29, 2016 at 5:42 PM, Gor Nishanov 
> wrote:
>
>> Currently the -fcoroutines flag is a CC1 only flag. It really should be
>> both a Driver and CC1 flag. This patch fixes the option and adds tests for
>> the new options.
>>
>> Also adds a __has_feature for coroutines.
>> Patch is mostly by Eric Fiselier
>> .
>> Meticulous and painstaking extraction from the larger coroutine branch by
>> Gor Nishanov
>>
>> P.S.
>>
>> Switching to lowercase [coroutines] tag in the title, as most of the
>> coroutine commits in cfe were done with lowercase tag.
>>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] [coroutines] Rename driver flag -fcoroutines to -fcoroutines-ts

2016-09-29 Thread Gor Nishanov via cfe-commits
You beat me to it, Eric. :) I'll add mine for review, too. Let's see which
one Richard will respond :) .

1. Remove __has_feature
2. Rename fcoroutines => fcoroutines_TS
3. Rename __cpp_coroutines => __cpp_experimental_coroutines

Since phabricator is down, here is a handy diff on a github
https://github.com/GorNishanov/clang/commit/e129083a73cf82e0bcea0817045ae6baaadccbb7




On Thu, Sep 29, 2016 at 6:22 PM, Eric Fiselier  wrote:

> I've attached an updated patch which addresses the comments.
>
> 1. Remove __has_feature changes.
> 2. Rename OPT_fcoroutines -> OPT_fcoroutines_TS.
>
> /Eric
>
> On Thu, Sep 29, 2016 at 6:58 PM, Richard Smith 
> wrote:
>
>> +def fcoroutines : Flag <["-"], "fcoroutines-ts">, Group,
>> +  Flags<[DriverOption, CC1Option]>,
>> +  HelpText<"Enable support for the C++ Coroutines TS">;
>> +def fno_coroutines : Flag <["-"], "fno-coroutines-ts">, Group,
>>
>> These should be named fcoroutines_ts, fno_coroutines_ts (see comment at
>> the top of the file for the naming scheme).
>>
>> +  .Case("coroutines", LangOpts.Coroutines)
>>
>> We should use the SD-6 macro name (__cpp_coroutines) rather than
>> __has_feature for new features that are covered by SD-6. However, we
>> shouldn't be defining this until we have a complete implementation. (Code
>> using this for a feature test wants to test whether the feature works, not
>> just whether it's enabled on the command line.)
>>
>> On Thu, Sep 29, 2016 at 5:45 PM, Gor Nishanov 
>> wrote:
>>
>>> Let's see if renaming the attachment to *.txt helps.
>>>
>>> On Thu, Sep 29, 2016 at 5:42 PM, Gor Nishanov 
>>> wrote:
>>>
 Currently the -fcoroutines flag is a CC1 only flag. It really should be
 both a Driver and CC1 flag. This patch fixes the option and adds tests for
 the new options.

 Also adds a __has_feature for coroutines.
 Patch is mostly by Eric Fiselier
 .
 Meticulous and painstaking extraction from the larger coroutine branch
 by Gor Nishanov

 P.S.

 Switching to lowercase [coroutines] tag in the title, as most of the
 coroutine commits in cfe were done with lowercase tag.

>>>
>>>
>>
>
diff --git a/include/clang/Basic/LangOptions.def 
b/include/clang/Basic/LangOptions.def
index b738f83..fc8ce78 100644
--- a/include/clang/Basic/LangOptions.def
+++ b/include/clang/Basic/LangOptions.def
@@ -133,7 +133,7 @@ LANGOPT(Freestanding, 1, 0, "freestanding implementation")
 LANGOPT(NoBuiltin , 1, 0, "disable builtin functions")
 LANGOPT(NoMathBuiltin , 1, 0, "disable math builtin functions")
 LANGOPT(GNUAsm, 1, 1, "GNU-style inline assembly")
-LANGOPT(Coroutines, 1, 0, "C++ coroutines")
+LANGOPT(CoroutinesTS  , 1, 0, "C++ coroutines TS")
 
 BENIGN_LANGOPT(ThreadsafeStatics , 1, 1, "thread-safe static initializers")
 LANGOPT(POSIXThreads  , 1, 0, "POSIX thread support")
diff --git a/include/clang/Driver/CC1Options.td 
b/include/clang/Driver/CC1Options.td
index 66e1ad6..73ab5e6 100644
--- a/include/clang/Driver/CC1Options.td
+++ b/include/clang/Driver/CC1Options.td
@@ -638,10 +638,6 @@ def fdefault_calling_conv_EQ : Joined<["-"], 
"fdefault-calling-conv=">,
 def finclude_default_header : Flag<["-"], "finclude-default-header">,
   HelpText<"Include the default header file for OpenCL">;
 
-// C++ TSes.
-def fcoroutines : Flag<["-"], "fcoroutines">,
-  HelpText<"Enable support for the C++ Coroutines TS">;
-
 
//===--===//
 // Header Search Options
 
//===--===//
diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td
index 6090304..dc3567a 100644
--- a/include/clang/Driver/Options.td
+++ b/include/clang/Driver/Options.td
@@ -481,6 +481,13 @@ def fno_autolink : Flag <["-"], "fno-autolink">, 
Group,
   Flags<[DriverOption, CC1Option]>,
   HelpText<"Disable generation of linker directives for automatic library 
linking">;
 
+// C++ Coroutines TS
+def fcoroutines_ts : Flag <["-"], "fcoroutines-ts">, Group,
+  Flags<[DriverOption, CC1Option]>,
+  HelpText<"Enable support for the C++ Coroutines TS">;
+def fno_coroutines_ts : Flag <["-"], "fno-coroutines-ts">, Group,
+  Flags<[DriverOption]>;
+
 def fembed_bitcode_EQ : Joined<["-"], "fembed-bitcode=">,
 Group, Flags<[DriverOption, CC1Option]>, MetaVarName<"">,
 HelpText<"Embed LLVM bitcode (option: off, all, bitcode, marker)">;
diff --git a/lib/Basic/IdentifierTable.cpp b/lib/Basic/IdentifierTable.cpp
index 537a2b7..dcd1e8b 100644
--- a/lib/Basic/IdentifierTable.cpp
+++ b/lib/Basic/IdentifierTable.cpp
@@ -150,7 +150,7 @@ static KeywordStatus getKeywordStatus(const LangOptions 
&LangOpts,
   if (LangOpts.ObjC2 && (Flags & KEYARC)) return KS_Enabled;
   if (LangOpts.ObjC2 && (Flags & KEYOBJC2)) return KS_Enabled;
   if (LangOpts.ConceptsTS && (Flags & KEYCONCEPTS)) return KS_Enabled;
-  if (LangOpts.Coroutines && (Flags & KEYCOROUTINES)) return KS_

[PATCH] [Commented On] D24963: [change-namespace] fix namespace specifier of global variables.

2016-09-29 Thread Eric Liu via cfe-commits
ioeric added a comment.
View RevisionPhab test.https://reviews.llvm.org/D24963

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


[PATCH] [Request, 41 lines] D25065: [change-namespace] Fixed a bug in getShortestQualifiedNameInNamespace.

2016-09-29 Thread Eric Liu via cfe-commits
ioeric created this revision.ioeric added a reviewer: hokein.ioeric added a subscriber: cfe-commits.
View RevisionAlso test phabricator.https://reviews.llvm.org/D25065Files:change-namespace/ChangeNamespace.cpp
unittests/change-namespace/ChangeNamespaceTests.cppunittests/change-namespace/ChangeNamespaceTests.cpp}

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";
change-namespace/ChangeNamespace.cpp// 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".
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();
  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();

  llvm::StringRef Prefix = NsName;
  while (true) {
if (DeclName.consume_front((Prefix + "::").str()))
  return DeclName.str();
NsName = Prefix;
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;
Prefix = NsName.substr(0, Pos - 1);
  }
  return DeclName;
Index: unittests/change-namespace/ChangeNamespaceTests.cpp
===
--- unittests/change-namespace/ChangeNamespaceTests.cpp
+++ 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: change-namespace/ChangeNamespace.cpp
===
--- change-namespace/ChangeNamespace.cpp
+++ change-namespace/ChangeNamespace.cpp
@@ -172,21 +172,26 @@
 // 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".
 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();
+  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();
+
+  llvm::StringRef Prefix = NsName;
   while (true) {
+if (DeclName.consume_front((Prefix +

Re: [llvm-dev] Upgrading phabricator

2016-09-29 Thread Eric Liu via cfe-commits
Hi all,

Phabricator is (finally) back online! Let me know if you have any feedback
or problem :)

Thanks,
Eric

On Thu, Sep 29, 2016 at 10:23 PM Eric Liu  wrote:

> According to top and iotop, mysqld is still working, and the progress bar
> did move by a little bit, so I think it's just really slow. Apologies if
> this is blocking you.
>
> On Thu, Sep 29, 2016 at 10:17 PM Zachary Turner via llvm-dev <
> llvm-...@lists.llvm.org> wrote:
>
> Still no word on when it will be back up?  It's not hung is it?  :D
>
> On Thu, Sep 29, 2016 at 9:03 AM mats petersson via llvm-dev <
> llvm-...@lists.llvm.org> wrote:
>
> On 29 September 2016 at 16:11, Mehdi Amini via llvm-dev <
> llvm-...@lists.llvm.org> wrote:
>
>
> On Sep 29, 2016, at 7:21 AM, Eric Liu via llvm-dev <
> llvm-...@lists.llvm.org> wrote:
>
> Sorry for blocking everyone for so long.
>
>
> No pb, thanks very much for taking care of it :)
>
> It has been more than a year since the last upgrade, and mysql is
> adjusting schema for a table with ~150G data on a single VM instance.
>
>
> 150GB? I’m very surprised there is so much data in our phab! That seems
> huge...
>
>
> My guess is that this includes all the diffs for every revision of every
> review (as well as all the comments, etc), and it probably isn't as clever
> with diffs as for example git. Which quite soon adds up to huge numbers
> when you have tens of thousands of reviews.
>
> Purse speculation of course, I have never looked inside phabricator (or
> for that matter, any other code-review tool).
>
> --
> Mats
>
>
> —
> Mehdi
>
> Sadly, the progress bar isn't giving useful information (plus I am not a
> good system admin),  so I couldn't tell the ETA...
>
> FYI: According to previous maintainer, it takes a couple of hours for the
> last upgrade, so this should be done within a few hours (hopefully!).
>
> On Thu, Sep 29, 2016 at 4:04 PM Krzysztof Parzyszek via llvm-dev <
> llvm-...@lists.llvm.org> wrote:
>
> Is there any ETA?
>
> -Krzysztof
>
> On 9/29/2016 5:34 AM, Eric Liu via llvm-dev wrote:
> > That was a bad estimation. Database upgrade is taking time.
> >
> > On Thu, Sep 29, 2016 at 11:03 AM Eric Liu  > > wrote:
> >
> > Hi all,
> >
> > Phabricator(reviews.llvm.org ) will be down
> > for ~30 mins for an upgrade. Sorry for the short notice.
> >
> > Regards,
> > Eric
> >
> >
> >
> > ___
> > LLVM Developers mailing list
> > llvm-...@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
> >
>
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> hosted by The Linux Foundation
> ___
> LLVM Developers mailing list
> llvm-...@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
> ___
> LLVM Developers mailing list
> llvm-...@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
>
> ___
> LLVM Developers mailing list
> llvm-...@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
> ___
> LLVM Developers mailing list
> llvm-...@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
> ___
> LLVM Developers mailing list
> llvm-...@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [llvm-dev] Upgrading phabricator

2016-09-29 Thread Zachary Turner via cfe-commits
You mentioned this was for an upgrade. Are there any major new features or
bugfixes to be aware of?
On Thu, Sep 29, 2016 at 9:26 PM Eric Liu via llvm-commits <
llvm-comm...@lists.llvm.org> wrote:

> Hi all,
>
> Phabricator is (finally) back online! Let me know if you have any feedback
> or problem :)
>
> Thanks,
> Eric
>
> On Thu, Sep 29, 2016 at 10:23 PM Eric Liu  wrote:
>
> According to top and iotop, mysqld is still working, and the progress bar
> did move by a little bit, so I think it's just really slow. Apologies if
> this is blocking you.
>
> On Thu, Sep 29, 2016 at 10:17 PM Zachary Turner via llvm-dev <
> llvm-...@lists.llvm.org> wrote:
>
> Still no word on when it will be back up?  It's not hung is it?  :D
>
> On Thu, Sep 29, 2016 at 9:03 AM mats petersson via llvm-dev <
> llvm-...@lists.llvm.org> wrote:
>
> On 29 September 2016 at 16:11, Mehdi Amini via llvm-dev <
> llvm-...@lists.llvm.org> wrote:
>
>
> On Sep 29, 2016, at 7:21 AM, Eric Liu via llvm-dev <
> llvm-...@lists.llvm.org> wrote:
>
> Sorry for blocking everyone for so long.
>
>
> No pb, thanks very much for taking care of it :)
>
> It has been more than a year since the last upgrade, and mysql is
> adjusting schema for a table with ~150G data on a single VM instance.
>
>
> 150GB? I’m very surprised there is so much data in our phab! That seems
> huge...
>
>
> My guess is that this includes all the diffs for every revision of every
> review (as well as all the comments, etc), and it probably isn't as clever
> with diffs as for example git. Which quite soon adds up to huge numbers
> when you have tens of thousands of reviews.
>
> Purse speculation of course, I have never looked inside phabricator (or
> for that matter, any other code-review tool).
>
> --
> Mats
>
>
> —
> Mehdi
>
> Sadly, the progress bar isn't giving useful information (plus I am not a
> good system admin),  so I couldn't tell the ETA...
>
> FYI: According to previous maintainer, it takes a couple of hours for the
> last upgrade, so this should be done within a few hours (hopefully!).
>
> On Thu, Sep 29, 2016 at 4:04 PM Krzysztof Parzyszek via llvm-dev <
> llvm-...@lists.llvm.org> wrote:
>
> Is there any ETA?
>
> -Krzysztof
>
> On 9/29/2016 5:34 AM, Eric Liu via llvm-dev wrote:
> > That was a bad estimation. Database upgrade is taking time.
> >
> > On Thu, Sep 29, 2016 at 11:03 AM Eric Liu  > > wrote:
> >
> > Hi all,
> >
> > Phabricator(reviews.llvm.org ) will be down
> > for ~30 mins for an upgrade. Sorry for the short notice.
> >
> > Regards,
> > Eric
> >
> >
> >
> > ___
> > LLVM Developers mailing list
> > llvm-...@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
> >
>
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> hosted by The Linux Foundation
> ___
> LLVM Developers mailing list
> llvm-...@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
> ___
> LLVM Developers mailing list
> llvm-...@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
>
> ___
> LLVM Developers mailing list
> llvm-...@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
> ___
> LLVM Developers mailing list
> llvm-...@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
> ___
> LLVM Developers mailing list
> llvm-...@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
> ___
> llvm-commits mailing list
> llvm-comm...@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] [Request, 69 lines] D25068: [coroutines] Switch to using std::experimental namespace per P0057R5

2016-09-29 Thread Gor Nishanov via cfe-commits
GorNishanov created this revision.GorNishanov added reviewers: EricWF, rsmith, cfe-commits.Herald added a subscriber: mehdi_amini.
View RevisionLook for coroutine_traits and friends in std::experimental namespace.
Patch (mostly) by EricWF.https://reviews.llvm.org/D25068Files:include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Sema/Sema.h
lib/Sema/SemaCoroutine.cpp
lib/Sema/SemaDeclCXX.cpp
test/SemaCXX/coroutines.cppIndex: test/SemaCXX/coroutines.cpp
===
--- test/SemaCXX/coroutines.cpp
+++ test/SemaCXX/coroutines.cpp
@@ -1,18 +1,18 @@
 // RUN: %clang_cc1 -std=c++14 -fcoroutines -verify %s
 
 void no_coroutine_traits_bad_arg_await() {
-  co_await a; // expected-error {{include }}
+  co_await a; // expected-error {{include }}
   // expected-error@-1 {{use of undeclared identifier 'a'}}
 }
 
 void no_coroutine_traits_bad_arg_yield() {
-  co_yield a; // expected-error {{include }}
+  co_yield a; // expected-error {{include }}
   // expected-error@-1 {{use of undeclared identifier 'a'}}
 }
 
 
 void no_coroutine_traits_bad_arg_return() {
-  co_return a; // expected-error {{include }}
+  co_return a; // expected-error {{include }}
   // expected-error@-1 {{use of undeclared identifier 'a'}}
 }
 
@@ -36,43 +36,48 @@
 };
 
 void no_coroutine_traits() {
-  co_await a; // expected-error {{need to include }}
+  co_await a; // expected-error {{need to include }}
 }
 
-namespace std {
+namespace std { namespace experimental {
   template struct coroutine_traits; // expected-note {{declared here}}
-};
+}}
 
 template struct coro {};
 template
-struct std::coroutine_traits, Ps...> {
+struct std::experimental::coroutine_traits, Ps...> {
   using promise_type = Promise;
 };
 
 void no_specialization() {
-  co_await a; // expected-error {{implicit instantiation of undefined template 'std::coroutine_traits'}}
+  co_await a; // expected-error {{implicit instantiation of undefined template 'std::experimental::coroutine_traits'}}
 }
 
-template struct std::coroutine_traits {};
+template struct std::experimental::coroutine_traits {};
 
 int no_promise_type() {
-  co_await a; // expected-error {{this function cannot be a coroutine: 'std::coroutine_traits' has no member named 'promise_type'}}
+  co_await a; // expected-error {{this function cannot be a coroutine: 'std::experimental::coroutine_traits' has no member named 'promise_type'}}
 }
 
-template<> struct std::coroutine_traits { typedef int promise_type; };
+template<> struct std::experimental::coroutine_traits { typedef int promise_type; };
 double bad_promise_type(double) {
-  co_await a; // expected-error {{this function cannot be a coroutine: 'std::coroutine_traits::promise_type' (aka 'int') is not a class}}
+  co_await a; // expected-error {{this function cannot be a coroutine: 'experimental::coroutine_traits::promise_type' (aka 'int') is not a class}}
 }
 
-template<> struct std::coroutine_traits {
+template<> struct std::experimental::coroutine_traits {
   struct promise_type {};
 };
 double bad_promise_type_2(int) {
-  co_yield 0; // expected-error {{no member named 'yield_value' in 'std::coroutine_traits::promise_type'}}
+  co_yield 0; // expected-error {{no member named 'yield_value' in 'std::experimental::coroutine_traits::promise_type'}}
 }
 
 struct promise; // expected-note 2{{forward declaration}}
-template struct std::coroutine_traits { using promise_type = promise; };
+template struct std::experimental::coroutine_traits { using promise_type = promise; };
+
+
+namespace std { namespace experimental {
+  template  struct coroutine_handle;
+}}
 
   // FIXME: This diagnostic is terrible.
 void undefined_promise() { // expected-error {{variable has incomplete type 'promise_type'}}
@@ -200,7 +205,7 @@
 }
 
 struct yield_fn_tag {};
-template<> struct std::coroutine_traits {
+template<> struct std::experimental::coroutine_traits {
   struct promise_type {
 // FIXME: add an await_transform overload for functions
 awaitable yield_value(int());
Index: lib/Sema/SemaDeclCXX.cpp
===
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -8111,6 +8111,7 @@
   bool IsInline = InlineLoc.isValid();
   bool IsInvalid = false;
   bool IsStd = false;
+  bool IsStdExperimental = false;
   bool AddToKnown = false;
   Scope *DeclRegionScope = NamespcScope->getParent();
 
@@ -8152,6 +8153,11 @@
   PrevNS = getStdNamespace();
   IsStd = true;
   AddToKnown = !IsInline;
+} else if (II->isStr("experimental") &&
+  CurContext->getRedeclContext()->isStdNamespace()) {
+  PrevNS = getStdExperimentalNamespace();
+  IsStdExperimental = true;
+  AddToKnown = !IsInline;
 } else {
   // We've seen this namespace for the first time.
   AddToKnown = !IsInline;
@@ -8186,6 +8192,8 @@
 
   if (IsStd)
 StdNamespace = Namespc;
+  if (IsStdExperimental)
+StdExperimentalNamespace = Namespc;
   if (AddT

[clang-tools-extra] r282837 - [change-namespace] fix namespace specifier of global variables.

2016-09-29 Thread Eric Liu via cfe-commits
Author: ioeric
Date: Thu Sep 29 23:32:39 2016
New Revision: 282837

URL: http://llvm.org/viewvc/llvm-project?rev=282837&view=rev
Log:
[change-namespace] fix namespace specifier of global variables.

Reviewers: hokein

Subscribers: cfe-commits

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

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=282837&r1=282836&r2=282837&view=diff
==
--- clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp (original)
+++ clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp Thu Sep 29 
23:32:39 2016
@@ -230,8 +230,6 @@ ChangeNamespaceTool::ChangeNamespaceTool
   DiffNewNamespace = joinNamespaces(NewNsSplitted);
 }
 
-// FIXME: handle the following symbols:
-//   - Variable references.
 void ChangeNamespaceTool::registerMatchers(ast_matchers::MatchFinder *Finder) {
   // Match old namespace blocks.
   std::string FullOldNs = "::" + OldNamespace;
@@ -303,6 +301,14 @@ void ChangeNamespaceTool::registerMatche
IsInMovedNs, unless(isImplicit()))
   .bind("dc"),
   this);
+
+  auto GlobalVarMatcher = varDecl(
+  hasGlobalStorage(), hasParent(namespaceDecl()),
+  unless(anyOf(IsInMovedNs, hasAncestor(namespaceDecl(isAnonymous());
+  Finder->addMatcher(declRefExpr(IsInMovedNs, hasAncestor(decl().bind("dc")),
+ to(GlobalVarMatcher.bind("var_decl")))
+ .bind("var_ref"),
+ this);
 }
 
 void ChangeNamespaceTool::run(
@@ -324,8 +330,19 @@ void ChangeNamespaceTool::run(
   } else if (const auto *TLoc = Result.Nodes.getNodeAs("type")) {
 fixTypeLoc(Result, startLocationForType(*TLoc), EndLocationForType(*TLoc),
*TLoc);
+  } else if (const auto *VarRef = 
Result.Nodes.getNodeAs("var_ref")){
+const auto *Var = Result.Nodes.getNodeAs("var_decl");
+assert(Var);
+if (Var->getCanonicalDecl()->isStaticDataMember())
+  return;
+std::string Name = Var->getQualifiedNameAsString();
+const clang::Decl *Context = Result.Nodes.getNodeAs("dc");
+assert(Context && "Empty decl context.");
+clang::SourceRange VarRefRange = VarRef->getSourceRange();
+replaceQualifiedSymbolInDeclContext(Result, Context, 
VarRefRange.getBegin(),
+VarRefRange.getEnd(), Name);
   } else {
-const auto* Call = Result.Nodes.getNodeAs("call");
+const auto *Call = Result.Nodes.getNodeAs("call");
 assert(Call != nullptr &&"Expecting callback for CallExpr.");
 const clang::FunctionDecl* Func = Call->getDirectCallee();
 assert(Func != nullptr);

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=282837&r1=282836&r2=282837&view=diff
==
--- clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp 
(original)
+++ clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp 
Thu Sep 29 23:32:39 2016
@@ -447,6 +447,72 @@ TEST_F(ChangeNamespaceTest, FixFunctionN
   EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code));
 }
 
+TEST_F(ChangeNamespaceTest, MoveAndFixGlobalVariables) {
+  std::string Code = "namespace na {\n"
+ "int GlobA;\n"
+ "static int GlobAStatic = 0;\n"
+ "namespace nc { int GlobC; }\n"
+ "namespace nb {\n"
+ "int GlobB;\n"
+ "void f() {\n"
+ "  int a = GlobA;\n"
+ "  int b = GlobAStatic;\n"
+ "  int c = nc::GlobC;\n"
+ "}\n"
+ "} // namespace nb\n"
+ "} // namespace na\n";
+
+  std::string Expected = "namespace na {\n"
+ "int GlobA;\n"
+ "static int GlobAStatic = 0;\n"
+ "namespace nc { int GlobC; }\n"
+ "\n"
+ "} // namespace na\n"
+ "namespace x {\n"
+ "namespace y {\n"
+ "int GlobB;\n"
+ "void f() {\n"
+ "  int a = na::GlobA;\n"
+ "  int b = na::GlobAStatic;\n"
+ "  int c = na::nc::GlobC;\n"
+ "}\n"
+ "}  // namespace y\n"
+ "}  // namespace x\n";
+
+  EXPECT_EQ(format

[PATCH] [Closed] D24963: [change-namespace] fix namespace specifier of global variables.

2016-09-29 Thread Eric Liu via cfe-commits
This revision was automatically updated to reflect the committed changes.Closed by commit rL282837: [change-namespace] fix namespace specifier of global variables. (authored by ioeric).
View RevisionChanged prior to commit:https://reviews.llvm.org/D24963?vs=72648&id=72976#tocRepository:rL LLVMhttps://reviews.llvm.org/D24963Files:clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp
clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cppIndex: 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
@@ -447,6 +447,72 @@
   EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code));
 }
 
+TEST_F(ChangeNamespaceTest, MoveAndFixGlobalVariables) {
+  std::string Code = "namespace na {\n"
+ "int GlobA;\n"
+ "static int GlobAStatic = 0;\n"
+ "namespace nc { int GlobC; }\n"
+ "namespace nb {\n"
+ "int GlobB;\n"
+ "void f() {\n"
+ "  int a = GlobA;\n"
+ "  int b = GlobAStatic;\n"
+ "  int c = nc::GlobC;\n"
+ "}\n"
+ "} // namespace nb\n"
+ "} // namespace na\n";
+
+  std::string Expected = "namespace na {\n"
+ "int GlobA;\n"
+ "static int GlobAStatic = 0;\n"
+ "namespace nc { int GlobC; }\n"
+ "\n"
+ "} // namespace na\n"
+ "namespace x {\n"
+ "namespace y {\n"
+ "int GlobB;\n"
+ "void f() {\n"
+ "  int a = na::GlobA;\n"
+ "  int b = na::GlobAStatic;\n"
+ "  int c = na::nc::GlobC;\n"
+ "}\n"
+ "}  // namespace y\n"
+ "}  // namespace x\n";
+
+  EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code));
+}
+
+TEST_F(ChangeNamespaceTest, DoNotFixStaticVariableOfClass) {
+  std::string Code = "namespace na {\n"
+ "class A {\n"
+ "public:\n"
+ "static int A1;\n"
+ "static int A2;\n"
+ "}\n"
+ "static int A::A1 = 0;\n"
+ "namespace nb {\n"
+ "void f() { int a = A::A1; int b = A::A2; }"
+ "} // namespace nb\n"
+ "} // namespace na\n";
+
+  std::string Expected = "namespace na {\n"
+ "class A {\n"
+ "public:\n"
+ "static int A1;\n"
+ "static int A2;\n"
+ "}\n"
+ "static int A::A1 = 0;\n"
+ "\n"
+ "} // namespace na\n"
+ "namespace x {\n"
+ "namespace y {\n"
+ "void f() { int a = na::A::A1; int b = na::A::A2; }"
+ "}  // namespace y\n"
+ "}  // namespace x\n";
+
+  EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code));
+}
+
 } // anonymous namespace
 } // namespace change_namespace
 } // namespace clang
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
@@ -230,8 +230,6 @@
   DiffNewNamespace = joinNamespaces(NewNsSplitted);
 }
 
-// FIXME: handle the following symbols:
-//   - Variable references.
 void ChangeNamespaceTool::registerMatchers(ast_matchers::MatchFinder *Finder) {
   // Match old namespace blocks.
   std::string FullOldNs = "::" + OldNamespace;
@@ -303,6 +301,14 @@
IsInMovedNs, unless(isImplicit()))
   .bind("dc"),
   this);
+
+  auto GlobalVarMatcher = varDecl(
+  hasGlobalStorage(), hasParent(namespaceDecl()),
+  unless(anyOf(IsInMovedNs, hasAncestor(namespaceDecl(isAnonymous());
+  Finder->addMatcher(declRefExpr(IsInMovedNs, hasAncestor(decl().bind("dc")),
+ to(GlobalVarMatcher.bind("var_decl")))
+ .bind("var_ref"),
+ this);
 }
 
 void ChangeNamespaceTool::run(
@@ -324,8 +330,19 @@
   } else if (const auto *TLoc = Result.Nodes.getNodeAs("type")) {
 fixTypeLoc(Result, startLocationForType(*TLoc), EndLocationForType(*TLoc),
*TLoc);
+  } else if (const auto *VarRef = Result.Nodes.getNodeAs("var_ref"))

Re: [PATCH] [coroutines] Rename driver flag -fcoroutines to -fcoroutines-ts

2016-09-29 Thread Eric Fiselier via cfe-commits
On Sep 29, 2016 8:23 PM, "Gor Nishanov"  wrote:
>
> You beat me to it, Eric. :) I'll add mine for review, too. Let's see
which one Richard will respond :) .
>
> 1. Remove __has_feature
> 2. Rename fcoroutines => fcoroutines_TS
> 3. Rename __cpp_coroutines => __cpp_experimental_coroutines

The TS spec uses __cpp_coroutines. What's the reason for changing it?

>
> Since phabricator is down, here is a handy diff on a github
>
https://github.com/GorNishanov/clang/commit/e129083a73cf82e0bcea0817045ae6baaadccbb7
>
>
>
>
> On Thu, Sep 29, 2016 at 6:22 PM, Eric Fiselier  wrote:
>>
>> I've attached an updated patch which addresses the comments.
>>
>> 1. Remove __has_feature changes.
>> 2. Rename OPT_fcoroutines -> OPT_fcoroutines_TS.
>>
>> /Eric
>>
>> On Thu, Sep 29, 2016 at 6:58 PM, Richard Smith 
wrote:
>>>
>>> +def fcoroutines : Flag <["-"], "fcoroutines-ts">, Group, +
Flags<[DriverOption, CC1Option]>, + HelpText<"Enable support for the C++
Coroutines TS">; +def fno_coroutines : Flag <["-"], "fno-coroutines-ts">,
Group,
>>>
>>> These should be named fcoroutines_ts, fno_coroutines_ts (see comment at
the top of the file for the naming scheme).
>>>
>>> + .Case("coroutines", LangOpts.Coroutines)
>>>
>>> We should use the SD-6 macro name (__cpp_coroutines) rather than
__has_feature for new features that are covered by SD-6. However, we
shouldn't be defining this until we have a complete implementation. (Code
using this for a feature test wants to test whether the feature works, not
just whether it's enabled on the command line.)
>>>
>>> On Thu, Sep 29, 2016 at 5:45 PM, Gor Nishanov 
wrote:

 Let's see if renaming the attachment to *.txt helps.

 On Thu, Sep 29, 2016 at 5:42 PM, Gor Nishanov 
wrote:
>
> Currently the -fcoroutines flag is a CC1 only flag. It really should
be both a Driver and CC1 flag. This patch fixes the option and adds tests
for the new options.
>
> Also adds a __has_feature for coroutines.
>
> Patch is mostly by Eric Fiselier
> .
> Meticulous and painstaking extraction from the larger coroutine
branch by Gor Nishanov
>
> P.S.
>
> Switching to lowercase [coroutines] tag in the title, as most of the
coroutine commits in cfe were done with lowercase tag.


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


[PATCH] [Changed Subscribers] D25068: [coroutines] Switch to using std::experimental namespace per P0057R5

2016-09-29 Thread David Majnemer via cfe-commits
majnemer added inline comments.
View RevisionView InlineSemaDeclCXX.cpp:8287-8290
NamespaceDecl *Sema::getStdExperimentalNamespace() const {
  return cast_or_null(
 StdExperimentalNamespace.get(Context.getExternalSource()));
}

Is this clang-format'd?https://reviews.llvm.org/D25068

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


[PATCH] [Updated, 105 lines] D24886: Add [[clang::suppress(rule, ...)]] attribute

2016-09-29 Thread Matthias Gehre via cfe-commits
mgehre updated this revision to Diff 72981.mgehre added a comment.
View RevisionAdd additional gsl::suppress spelling, add test, add documentationhttps://reviews.llvm.org/D24886Files:include/clang/Basic/Attr.td
include/clang/Basic/AttrDocs.td
lib/Sema/SemaDeclAttr.cpp
lib/Sema/SemaStmtAttr.cpp
test/SemaCXX/suppress.cppIndex: test/SemaCXX/suppress.cpp
===
--- /dev/null
+++ test/SemaCXX/suppress.cpp
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only %s -verify
+
+[[clang::suppress("globally")]];
+
+namespace N {
+  [[clang::suppress("in-a-namespace")]];
+}
+
+[[clang::suppress("readability-identifier-naming")]]
+void f_() {
+  int *aVar_Name;
+  [[gsl::suppress("type", "bounds")]] {
+aVar_Name = reinterpret_cast(7);
+  }
+
+  [[clang::suppress]] int x; // expected-error {{'suppress' attribute takes at least 1 argument}}
+  [[clang::suppress()]] int y; // expected-error {{'suppress' attribute takes at least 1 argument}}
+  int [[clang::suppress("r")]] z; // expected-error {{'suppress' attribute cannot be applied to types}}
+  [[clang::suppress(f_)]] float f; // expected-error {{'suppress' attribute requires a string}}
+}
+
+union [[gsl::suppress("type.1")]] U {
+  int i;
+  float f;
+};
Index: lib/Sema/SemaStmtAttr.cpp
===
--- lib/Sema/SemaStmtAttr.cpp
+++ lib/Sema/SemaStmtAttr.cpp
@@ -53,6 +53,28 @@
   return ::new (S.Context) auto(Attr);
 }
 
+static Attr *handleSuppressAttr(Sema &S, Stmt *St, const AttributeList &A,
+SourceRange Range) {
+  if (A.getNumArgs() < 1) {
+S.Diag(A.getLoc(), diag::err_attribute_too_few_arguments) << A.getName() << 1;
+return nullptr;
+  }
+
+  std::vector Rules;
+  for (unsigned I = 0, E = A.getNumArgs(); I != E; ++I) {
+StringRef RuleName;
+SourceLocation LiteralLoc;
+
+if (!S.checkStringLiteralArgumentAttr(A, I, RuleName, &LiteralLoc))
+  return nullptr;
+
+Rules.push_back(RuleName);
+  }
+
+  return ::new (S.Context) SuppressAttr(A.getRange(), S.Context, Rules.data(), Rules.size(),
+A.getAttributeSpellingListIndex());
+}
+
 static Attr *handleLoopHintAttr(Sema &S, Stmt *St, const AttributeList &A,
 SourceRange) {
   IdentifierLoc *PragmaNameLoc = A.getArgAsIdent(0);
@@ -283,6 +305,8 @@
 return handleLoopHintAttr(S, St, A, Range);
   case AttributeList::AT_OpenCLUnrollHint:
 return handleOpenCLUnrollHint(S, St, A, Range);
+  case AttributeList::AT_Suppress:
+return handleSuppressAttr(S, St, A, Range);
   default:
 // if we're here, then we parsed a known attribute, but didn't recognize
 // it as a statement attribute => it is declaration attribute
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -3838,6 +3838,26 @@
   }
 }
 
+static void handleSuppressAttr(Sema &S, Decl *D, const AttributeList &Attr) {
+  if (!checkAttributeAtLeastNumArgs(S, Attr, 1))
+return;
+
+  std::vector Rules;
+  for (unsigned I = 0, E = Attr.getNumArgs(); I != E; ++I) {
+StringRef RuleName;
+SourceLocation LiteralLoc;
+
+if (!S.checkStringLiteralArgumentAttr(Attr, I, RuleName, &LiteralLoc))
+  return;
+
+Rules.push_back(RuleName);
+  }
+  D->addAttr(::new (S.Context) SuppressAttr(
+  Attr.getRange(), S.Context, Rules.data(), Rules.size(),
+  Attr.getAttributeSpellingListIndex()));
+}
+
+
 bool Sema::CheckCallingConvAttr(const AttributeList &attr, CallingConv &CC, 
 const FunctionDecl *FD) {
   if (attr.isInvalid())
@@ -5830,6 +5850,9 @@
   case AttributeList::AT_PreserveAll:
 handleCallConvAttr(S, D, Attr);
 break;
+  case AttributeList::AT_Suppress:
+handleSuppressAttr(S, D, Attr);
+break;
   case AttributeList::AT_OpenCLKernel:
 handleSimpleAttribute(S, D, Attr);
 break;
Index: include/clang/Basic/AttrDocs.td
===
--- include/clang/Basic/AttrDocs.td
+++ include/clang/Basic/AttrDocs.td
@@ -2501,6 +2501,33 @@
   }];
 }
 
+def SuppressDocs : Documentation {
+  let Category = DocCatStmt;
+  let Content = [{
+The ``[[clang::suppress]]`` and ``[[gsl::suppress]]`` attributes can be used
+to suppress specific clang-tidy warnings. They can be attached to a scope,
+statement or type. The ``[[gsl::suppress]]`` is an alias of ``[[clang::suppress]]``
+which is intended to be used for suppressing rules of the C++ Core Guidelines_
+in a portable way. The attribute can be attached to declarations, statements,
+and on namespace scope.
+
+.. code-block: c++
+  [[clang::suppress("readability-identifier-naming")]]
+  void f_() {
+int *aVar_Name;
+[[gsl::suppress("type")]] {
+  aVar_Name = reinterpret-cast(7);
+}
+  }
+  namespace N {
+[[clang::suppress("type", "bounds")

Re: [llvm-dev] Upgrading phabricator

2016-09-29 Thread Sanjoy Das via cfe-commits

It looks like the new phabricator sends html email by default.

I personally prefer text email.  What do others think?  Is this configurable in 
the new installation?

Thanks,
-- Sanjoy

Zachary Turner via llvm-commits wrote:

You mentioned this was for an upgrade. Are there any major new features or 
bugfixes to be aware of?
On Thu, Sep 29, 2016 at 9:26 PM Eric Liu via llvm-commits 
mailto:llvm-comm...@lists.llvm.org>> wrote:

Hi all,

Phabricator is (finally) back online! Let me know if you have any feedback 
or problem :)

Thanks,
Eric

On Thu, Sep 29, 2016 at 10:23 PM Eric Liu mailto:ioe...@google.com>> wrote:

According to top and iotop, mysqld is still working, and the progress 
bar did move by a little bit, so I think
it's just really slow. Apologies if this is blocking you.

On Thu, Sep 29, 2016 at 10:17 PM Zachary Turner via llvm-dev 
mailto:llvm-...@lists.llvm.org>> wrote:

Still no word on when it will be back up?  It's not hung is it?  :D

On Thu, Sep 29, 2016 at 9:03 AM mats petersson via llvm-dev 
mailto:llvm-...@lists.llvm.org>> wrote:

On 29 September 2016 at 16:11, Mehdi Amini via llvm-dev 
mailto:llvm-...@lists.llvm.org>> wrote:



On Sep 29, 2016, at 7:21 AM, Eric Liu via llvm-dev 
mailto:llvm-...@lists.llvm.org>> wrote:

Sorry for blocking everyone for so long.


No pb, thanks very much for taking care of it :)


It has been more than a year since the last upgrade, and 
mysql is adjusting schema for a table
with ~150G data on a single VM instance.


150GB? I’m very surprised there is so much data in our 
phab! That seems huge...


My guess is that this includes all the diffs for every revision 
of every review (as well as all the
comments, etc), and it probably isn't as clever with diffs as 
for example git. Which quite soon adds up
to huge numbers when you have tens of thousands of reviews.

Purse speculation of course, I have never looked inside 
phabricator (or for that matter, any other
code-review tool).

--
Mats


—
Mehdi


Sadly, the progress bar isn't giving useful information 
(plus I am not a good system admin),  so I
couldn't tell the ETA...

FYI: According to previous maintainer, it takes a couple of 
hours for the last upgrade, so this
should be done within a few hours (hopefully!).

On Thu, Sep 29, 2016 at 4:04 PM Krzysztof Parzyszek via 
llvm-dev mailto:llvm-...@lists.llvm.org>> wrote:

Is there any ETA?

-Krzysztof

On 9/29/2016 5:34 AM, Eric Liu via llvm-dev wrote:
> That was a bad estimation. Database upgrade is taking 
time.
>
> On Thu, Sep 29, 2016 at 11:03 AM Eric Liu 
mailto:ioe...@google.com>
> >> wrote:
>
> Hi all,
>
> Phabricator(reviews.llvm.org 
 >) will be down
> for ~30 mins for an upgrade. Sorry for the short 
notice.
>
> Regards,
> Eric
>
>
>
> ___
> LLVM Developers mailing list
> llvm-...@lists.llvm.org 

> 
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>

--
Qualcomm Innovation Center, Inc. is a member of Code 
Aurora Forum,
hosted by The Linux Foundation
___
LLVM Developers mailing list
llvm-...@lists.llvm.org 
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

___
LLVM Developers mailing list
llvm-...@lists.llvm.org 
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



___
LLVM Developers mailing list

Re: [llvm-dev] Upgrading phabricator

2016-09-29 Thread Mehdi Amini via cfe-commits
One of the new “feature” is that emails are HTML only right now. Not quite nice 
for the archive (or for interacting by email). 
See for instance: 
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160926/172081.html

(Also the funky "[Changed Subscribers] “ in the title)

Another issue is that we can’t delete unposted inline comment anymore.

— 
Mehdi

> On Sep 29, 2016, at 9:35 PM, Zachary Turner via llvm-dev 
>  wrote:
> 
> You mentioned this was for an upgrade. Are there any major new features or 
> bugfixes to be aware of?
> On Thu, Sep 29, 2016 at 9:26 PM Eric Liu via llvm-commits 
> mailto:llvm-comm...@lists.llvm.org>> wrote:
> Hi all,
> 
> Phabricator is (finally) back online! Let me know if you have any feedback or 
> problem :)
> 
> Thanks,
> Eric
> 
> On Thu, Sep 29, 2016 at 10:23 PM Eric Liu  > wrote:
> According to top and iotop, mysqld is still working, and the progress bar did 
> move by a little bit, so I think it's just really slow. Apologies if this is 
> blocking you.
> 
> On Thu, Sep 29, 2016 at 10:17 PM Zachary Turner via llvm-dev 
> mailto:llvm-...@lists.llvm.org>> wrote:
> Still no word on when it will be back up?  It's not hung is it?  :D
> 
> On Thu, Sep 29, 2016 at 9:03 AM mats petersson via llvm-dev 
> mailto:llvm-...@lists.llvm.org>> wrote:
> On 29 September 2016 at 16:11, Mehdi Amini via llvm-dev 
> mailto:llvm-...@lists.llvm.org>> wrote:
> 
>> On Sep 29, 2016, at 7:21 AM, Eric Liu via llvm-dev > > wrote:
>> 
>> Sorry for blocking everyone for so long.
> 
> No pb, thanks very much for taking care of it :)
> 
>> It has been more than a year since the last upgrade, and mysql is adjusting 
>> schema for a table with ~150G data on a single VM instance.
> 
> 150GB? I’m very surprised there is so much data in our phab! That seems 
> huge...
> 
> My guess is that this includes all the diffs for every revision of every 
> review (as well as all the comments, etc), and it probably isn't as clever 
> with diffs as for example git. Which quite soon adds up to huge numbers when 
> you have tens of thousands of reviews.
> 
> Purse speculation of course, I have never looked inside phabricator (or for 
> that matter, any other code-review tool).
> 
> --
> Mats
> 
> — 
> Mehdi
> 
>> Sadly, the progress bar isn't giving useful information (plus I am not a 
>> good system admin),  so I couldn't tell the ETA...
>> 
>> FYI: According to previous maintainer, it takes a couple of hours for the 
>> last upgrade, so this should be done within a few hours (hopefully!).
>> 
>> On Thu, Sep 29, 2016 at 4:04 PM Krzysztof Parzyszek via llvm-dev 
>> mailto:llvm-...@lists.llvm.org>> wrote:
>> Is there any ETA?
>> 
>> -Krzysztof
>> 
>> On 9/29/2016 5:34 AM, Eric Liu via llvm-dev wrote:
>> > That was a bad estimation. Database upgrade is taking time.
>> >
>> > On Thu, Sep 29, 2016 at 11:03 AM Eric Liu > > 
>> > >> wrote:
>> >
>> > Hi all,
>> >
>> > Phabricator(reviews.llvm.org  
>> > >) will be down
>> > for ~30 mins for an upgrade. Sorry for the short notice.
>> >
>> > Regards,
>> > Eric
>> >
>> >
>> >
>> > ___
>> > LLVM Developers mailing list
>> > llvm-...@lists.llvm.org 
>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev 
>> > 
>> >
>> 
>> --
>> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
>> hosted by The Linux Foundation
>> ___
>> LLVM Developers mailing list
>> llvm-...@lists.llvm.org 
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev 
>> 
>> ___
>> LLVM Developers mailing list
>> llvm-...@lists.llvm.org 
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev 
>> 
> 
> 
> ___
> LLVM Developers mailing list
> llvm-...@lists.llvm.org 
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev 
> 
> 
> ___
> LLVM Developers mailing list
> llvm-...@lists.llvm.org 
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev 
> 
> ___
> LLVM Developers mailing list
> llvm-...@lists.llvm.org 
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev 
> 

Re: [llvm-dev] Upgrading phabricator

2016-09-29 Thread Eric Liu via cfe-commits
I've switched the default email format to be plain text only now. This
option should be per-user configurable, but somehow it is not shown in the
"Settings"; I'll try if I can make the option personalized.

Regarding new features and bug fixes in this upgrade, I don't really have a
list since the Phabricator we are running is the open-source repo + some
local modification. The last merge was more than one year ago, so I guess
there should be a long list of new features and bug fixes.

Some new features that I am aware of:
- Syntax highlighting.
- Patch size in email headers
- HTML email (disabled)
- More compatible with modern arc (the reason for this upgrade)
- and more to be discovered! :)

@Mehdi Deleting unposted inline comments works for me. At which patch did
this issue occur?

- Eric

On Fri, Sep 30, 2016 at 7:39 AM Mehdi Amini  wrote:

> One of the new “feature” is that emails are HTML only right now. Not quite
> nice for the archive (or for interacting by email).
> See for instance:
> http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160926/172081.html
>
> (Also the funky "[Changed Subscribers] “ in the title)
>
> Another issue is that we can’t delete unposted inline comment anymore.
>
> —
> Mehdi
>
> On Sep 29, 2016, at 9:35 PM, Zachary Turner via llvm-dev <
> llvm-...@lists.llvm.org> wrote:
>
> You mentioned this was for an upgrade. Are there any major new features or
> bugfixes to be aware of?
> On Thu, Sep 29, 2016 at 9:26 PM Eric Liu via llvm-commits <
> llvm-comm...@lists.llvm.org> wrote:
>
> Hi all,
>
> Phabricator is (finally) back online! Let me know if you have any feedback
> or problem :)
>
> Thanks,
> Eric
>
> On Thu, Sep 29, 2016 at 10:23 PM Eric Liu  wrote:
>
> According to top and iotop, mysqld is still working, and the progress bar
> did move by a little bit, so I think it's just really slow. Apologies if
> this is blocking you.
>
> On Thu, Sep 29, 2016 at 10:17 PM Zachary Turner via llvm-dev <
> llvm-...@lists.llvm.org> wrote:
>
> Still no word on when it will be back up?  It's not hung is it?  :D
>
> On Thu, Sep 29, 2016 at 9:03 AM mats petersson via llvm-dev <
> llvm-...@lists.llvm.org> wrote:
>
> On 29 September 2016 at 16:11, Mehdi Amini via llvm-dev <
> llvm-...@lists.llvm.org> wrote:
>
>
> On Sep 29, 2016, at 7:21 AM, Eric Liu via llvm-dev <
> llvm-...@lists.llvm.org> wrote:
>
> Sorry for blocking everyone for so long.
>
>
> No pb, thanks very much for taking care of it :)
>
> It has been more than a year since the last upgrade, and mysql is
> adjusting schema for a table with ~150G data on a single VM instance.
>
>
> 150GB? I’m very surprised there is so much data in our phab! That seems
> huge...
>
>
> My guess is that this includes all the diffs for every revision of every
> review (as well as all the comments, etc), and it probably isn't as clever
> with diffs as for example git. Which quite soon adds up to huge numbers
> when you have tens of thousands of reviews.
>
> Purse speculation of course, I have never looked inside phabricator (or
> for that matter, any other code-review tool).
>
> --
> Mats
>
>
> —
> Mehdi
>
> Sadly, the progress bar isn't giving useful information (plus I am not a
> good system admin),  so I couldn't tell the ETA...
>
> FYI: According to previous maintainer, it takes a couple of hours for the
> last upgrade, so this should be done within a few hours (hopefully!).
>
> On Thu, Sep 29, 2016 at 4:04 PM Krzysztof Parzyszek via llvm-dev <
> llvm-...@lists.llvm.org> wrote:
>
> Is there any ETA?
>
> -Krzysztof
>
> On 9/29/2016 5:34 AM, Eric Liu via llvm-dev wrote:
> > That was a bad estimation. Database upgrade is taking time.
> >
> > On Thu, Sep 29, 2016 at 11:03 AM Eric Liu  > > wrote:
> >
> > Hi all,
> >
> > Phabricator(reviews.llvm.org ) will be down
> > for ~30 mins for an upgrade. Sorry for the short notice.
> >
> > Regards,
> > Eric
> >
> >
> >
> > ___
> > LLVM Developers mailing list
> > llvm-...@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
> >
>
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> hosted by The Linux Foundation
> ___
> LLVM Developers mailing list
> llvm-...@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
> ___
> LLVM Developers mailing list
> llvm-...@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
>
> ___
> LLVM Developers mailing list
> llvm-...@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
> ___
> LLVM Developers mailing list
> llvm-...@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
> ___
> LLVM Developers mailing list
> l

[PATCH] [Commented On] D24986: [MS] Implement __iso_volatile loads/stores as builtins

2016-09-29 Thread David Majnemer via cfe-commits
majnemer added inline comments.


> CGBuiltin.cpp:2597-2611
> +case ARM::BI__iso_volatile_load8:
> +case ARM::BI__iso_volatile_load16:
> +case ARM::BI__iso_volatile_load32:
> +case ARM::BI__iso_volatile_load64:
> +  return RValue::get(EmitVolatileLoad(*this, E));
> +case ARM::BI__iso_volatile_store8:
> +case ARM::BI__iso_volatile_store16:

I think you could sink this into `EmitARMBuiltinExpr`.  You don't really need 
or want the fancy CGF machinery here. I'd just return the result of 
`CreateAlignedStore`/`CreateAlignedLoad` which should handle the 
`EmitTargetBuiltinExpr` issue.

https://reviews.llvm.org/D24986



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


[PATCH] [Commented On] D25008: [libcxx] Include unwinder library in the linker script

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

Side note: I see that gcc is solving similar problem via .spec files for its 
libraries, e.g.:

  $ cat /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/libgomp.spec 
  # This spec file is read by gcc when linking.  It is used to specify the
  # standard libraries we need in order to link with libgomp.
  *link_gomp: -lgomp %{static: -ldl }

If we wanted to be more portable, I guess we could establish something similar 
for clang, and install such a file along with libc++. However, I don't know if 
that's a problem.


https://reviews.llvm.org/D25008



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


[PATCH] [Commented On] D24954: [ToolChains] Disable OpenSUSE rules for SLES10

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

@ismail, ping.


https://reviews.llvm.org/D24954



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


[PATCH] [Request, 2 lines] D25071: [openmp] fix a compile error on musl-libc

2016-09-29 Thread Lei Zhang via cfe-commits
zlei created this revision.
zlei added a reviewer: jcownie.
zlei added a subscriber: cfe-commits.

Function `strerror_r()` has different signatures in different implementations 
of libc: glibc's version returns a `char*`, while BSDs and musl return a `int`. 
libomp unconditionally assumes glibc on Linux and thus fails to compile against 
musl-libc. This patch addresses this issue.


https://reviews.llvm.org/D25071

Files:
  runtime/src/kmp_i18n.c


Index: runtime/src/kmp_i18n.c
===
--- runtime/src/kmp_i18n.c
+++ runtime/src/kmp_i18n.c
@@ -809,7 +809,7 @@
 intstrerror_r( int, char *, size_t );  // XSI version
 */
 
-#if KMP_OS_LINUX
+#if KMP_OS_LINUX && __GLIBC__
 
 // GNU version of strerror_r.
 


Index: runtime/src/kmp_i18n.c
===
--- runtime/src/kmp_i18n.c
+++ runtime/src/kmp_i18n.c
@@ -809,7 +809,7 @@
 intstrerror_r( int, char *, size_t );  // XSI version
 */
 
-#if KMP_OS_LINUX
+#if KMP_OS_LINUX && __GLIBC__
 
 // GNU version of strerror_r.
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r282846 - Cosmetic fix: deleted unnecessary line break in comment.

2016-09-29 Thread Victor Leschuk via cfe-commits
Author: vleschuk
Date: Fri Sep 30 01:39:48 2016
New Revision: 282846

URL: http://llvm.org/viewvc/llvm-project?rev=282846&view=rev
Log:
Cosmetic fix: deleted unnecessary line break in comment.

Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.h

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=282846&r1=282845&r2=282846&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Fri Sep 30 01:39:48 2016
@@ -97,8 +97,7 @@ class CGDebugInfo {
   /// List of interfaces we want to keep even if orphaned.
   std::vector RetainedTypes;
 
-  /// Cache of forward declared types to RAUW at the end of
-  /// compilation.
+  /// Cache of forward declared types to RAUW at the end of compilation.
   std::vector> ReplaceMap;
 
   /// Cache of replaceable forward declarations (functions and


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


[PATCH] [Updated, 56 lines] D24986: [MS] Implement __iso_volatile loads/stores as builtins

2016-09-29 Thread Martin Storsjö via cfe-commits
mstorsjo updated this revision to Diff 72988.
mstorsjo added a comment.

Implemented using `CreateAlignedStore` and `CreateAlignedLoad` instead.

I'm less confident in what this actually does though - e.g. is the 
`CreateBitCast` part necessary at all? I just based this on code I found in the 
same file calling `CreateAlignedStore`. (If I comment out the `CreateBitCast` 
line, it still works just as fine, at least for the unit test - but what about 
actual use?)

Compared to the previous patch, the generated IR now lacks a `!tbaa !3` marker 
at the end - is that an issue?


https://reviews.llvm.org/D24986

Files:
  include/clang/Basic/BuiltinsARM.def
  lib/CodeGen/CGBuiltin.cpp
  test/CodeGen/ms-volatile-arm.c


Index: test/CodeGen/ms-volatile-arm.c
===
--- /dev/null
+++ test/CodeGen/ms-volatile-arm.c
@@ -0,0 +1,13 @@
+// REQUIRES: arm-registered-target
+// RUN: %clang_cc1 -triple thumbv7-win32 -emit-llvm -fms-extensions 
-fms-volatile -o - < %s | FileCheck %s
+
+void test1(int volatile *p, int v) {
+  __iso_volatile_store32(p, v);
+  // CHECK-LABEL: @test1
+  // CHECK: store volatile {{.*}}, {{.*}}
+}
+int test2(const int volatile *p) {
+  return __iso_volatile_load32(p);
+  // CHECK-LABEL: @test2
+  // CHECK: load volatile {{.*}}
+}
Index: lib/CodeGen/CGBuiltin.cpp
===
--- lib/CodeGen/CGBuiltin.cpp
+++ lib/CodeGen/CGBuiltin.cpp
@@ -4279,6 +4279,41 @@
 return Builder.CreateCall(F, {StoreVal, StoreAddr}, "strex");
   }
 
+  switch (BuiltinID) {
+  case ARM::BI__iso_volatile_load8:
+  case ARM::BI__iso_volatile_load16:
+  case ARM::BI__iso_volatile_load32:
+  case ARM::BI__iso_volatile_load64: {
+Value *Ptr = EmitScalarExpr(E->getArg(0));
+QualType ElTy = E->getArg(0)->getType()->getPointeeType();
+CharUnits LoadSize = getContext().getTypeSizeInChars(ElTy);
+llvm::Type *ITy = llvm::IntegerType::get(getLLVMContext(),
+ LoadSize.getQuantity() * 8);
+Ptr = Builder.CreateBitCast(Ptr, ITy->getPointerTo());
+llvm::LoadInst *Load =
+  Builder.CreateAlignedLoad(Ptr, LoadSize);
+Load->setVolatile(true);
+return Load;
+  }
+  case ARM::BI__iso_volatile_store8:
+  case ARM::BI__iso_volatile_store16:
+  case ARM::BI__iso_volatile_store32:
+  case ARM::BI__iso_volatile_store64: {
+Value *Ptr = EmitScalarExpr(E->getArg(0));
+Value *Value = EmitScalarExpr(E->getArg(1));
+QualType ElTy = E->getArg(0)->getType()->getPointeeType();
+CharUnits StoreSize = getContext().getTypeSizeInChars(ElTy);
+llvm::Type *ITy = llvm::IntegerType::get(getLLVMContext(),
+ StoreSize.getQuantity() * 8);
+Ptr = Builder.CreateBitCast(Ptr, ITy->getPointerTo());
+llvm::StoreInst *Store =
+  Builder.CreateAlignedStore(Value, Ptr,
+ StoreSize);
+Store->setVolatile(true);
+return Store;
+  }
+  }
+
   if (BuiltinID == ARM::BI__builtin_arm_clrex) {
 Function *F = CGM.getIntrinsic(Intrinsic::arm_clrex);
 return Builder.CreateCall(F);
Index: include/clang/Basic/BuiltinsARM.def
===
--- include/clang/Basic/BuiltinsARM.def
+++ include/clang/Basic/BuiltinsARM.def
@@ -115,6 +115,14 @@
 LANGBUILTIN(__dmb, "vUi", "nc", ALL_MS_LANGUAGES)
 LANGBUILTIN(__dsb, "vUi", "nc", ALL_MS_LANGUAGES)
 LANGBUILTIN(__isb, "vUi", "nc", ALL_MS_LANGUAGES)
+LANGBUILTIN(__iso_volatile_load8,   "ccCD*", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(__iso_volatile_load16,  "ssCD*", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(__iso_volatile_load32,  "iiCD*", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(__iso_volatile_load64,  "LLiLLiCD*", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(__iso_volatile_store8,  "vcD*c", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(__iso_volatile_store16, "vsD*s", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(__iso_volatile_store32, "viD*i", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(__iso_volatile_store64, "vLLiD*LLi", "n", ALL_MS_LANGUAGES)
 LANGBUILTIN(__ldrexd, "WiWiCD*", "", ALL_MS_LANGUAGES)
 LANGBUILTIN(_MoveFromCoprocessor, "UiIUiIUiIUiIUiIUi", "", ALL_MS_LANGUAGES)
 LANGBUILTIN(_MoveFromCoprocessor2, "UiIUiIUiIUiIUiIUi", "", ALL_MS_LANGUAGES)


Index: test/CodeGen/ms-volatile-arm.c
===
--- /dev/null
+++ test/CodeGen/ms-volatile-arm.c
@@ -0,0 +1,13 @@
+// REQUIRES: arm-registered-target
+// RUN: %clang_cc1 -triple thumbv7-win32 -emit-llvm -fms-extensions -fms-volatile -o - < %s | FileCheck %s
+
+void test1(int volatile *p, int v) {
+  __iso_volatile_store32(p, v);
+  // CHECK-LABEL: @test1
+  // CHECK: store volatile {{.*}}, {{.*}}
+}
+int test2(const int volatile *p) {
+  return __iso_volatile_load32(p);
+  // CHECK-LABEL: @test2
+  // CHECK: load volatile {{.*}}
+}
Index: lib/CodeGen/CGBuiltin.cpp
=